@documentation-robotics/cli 0.1.13 → 0.3.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 +74 -2
- package/dist/analysis/relationship-classifier.js +2 -9
- package/dist/analysis/relationship-classifier.js.map +2 -2
- package/dist/analyzers/call-graph-utils.js +2 -2
- package/dist/analyzers/call-graph-utils.js.map +2 -2
- package/dist/analyzers/cards/build.js +171 -0
- package/dist/analyzers/cards/build.js.map +7 -0
- package/dist/analyzers/cards/classify.js +42 -0
- package/dist/analyzers/cards/classify.js.map +7 -0
- package/dist/analyzers/cards/edge-index.js +44 -0
- package/dist/analyzers/cards/edge-index.js.map +7 -0
- package/dist/analyzers/cards/facts.js +46 -0
- package/dist/analyzers/cards/facts.js.map +7 -0
- package/dist/analyzers/cards/graph.js +42 -0
- package/dist/analyzers/cards/graph.js.map +7 -0
- package/dist/analyzers/cards/index.js +8 -0
- package/dist/analyzers/cards/index.js.map +7 -0
- package/dist/analyzers/cards/tier0.js +18 -0
- package/dist/analyzers/cards/tier0.js.map +7 -0
- package/dist/analyzers/cards/types.js +1 -0
- package/dist/analyzers/cards/types.js.map +7 -0
- package/dist/analyzers/cbm-analyzer.js +195 -171
- package/dist/analyzers/cbm-analyzer.js.map +2 -2
- package/dist/analyzers/cbm-responses.js +336 -0
- package/dist/analyzers/cbm-responses.js.map +7 -0
- package/dist/analyzers/edge-relationships.js +45 -0
- package/dist/analyzers/edge-relationships.js.map +7 -0
- package/dist/analyzers/mapping-loader.js +9 -0
- package/dist/analyzers/mapping-loader.js.map +2 -2
- package/dist/analyzers/tier0-rules.js +153 -0
- package/dist/analyzers/tier0-rules.js.map +7 -0
- package/dist/analyzers/types.js.map +1 -1
- package/dist/analyzers/verify-engine.js +22 -19
- package/dist/analyzers/verify-engine.js.map +2 -2
- package/dist/audit/relationships/ai/prompts.js +10 -10
- package/dist/audit/relationships/ai/prompts.js.map +2 -2
- package/dist/audit/relationships/analysis/layer-templates.js +52 -52
- package/dist/audit/relationships/analysis/layer-templates.js.map +1 -1
- package/dist/cli.js +112 -28
- package/dist/cli.js.map +3 -3
- package/dist/coding-agents/agents/claude-code.js +3 -1
- package/dist/coding-agents/agents/claude-code.js.map +2 -2
- package/dist/coding-agents/claude-code-client.js +2 -1
- package/dist/coding-agents/claude-code-client.js.map +2 -2
- package/dist/coding-agents/copilot-client.js +17 -12
- package/dist/coding-agents/copilot-client.js.map +2 -2
- package/dist/coding-agents/default-permissions.js +152 -0
- package/dist/coding-agents/default-permissions.js.map +7 -0
- package/dist/coding-agents/drbot-mcp.js +167 -0
- package/dist/coding-agents/drbot-mcp.js.map +7 -0
- package/dist/commands/add.js +12 -7
- package/dist/commands/add.js.map +2 -2
- package/dist/commands/analyzer.js +134 -23
- package/dist/commands/analyzer.js.map +2 -2
- package/dist/commands/audit.js +6 -6
- package/dist/commands/audit.js.map +2 -2
- package/dist/commands/changeset-verify.js +55 -0
- package/dist/commands/changeset-verify.js.map +7 -0
- package/dist/commands/changeset.js +261 -147
- package/dist/commands/changeset.js.map +2 -2
- package/dist/commands/delete.js +52 -19
- package/dist/commands/delete.js.map +3 -3
- package/dist/commands/element.js +3 -2
- package/dist/commands/element.js.map +2 -2
- package/dist/commands/farm.js +773 -0
- package/dist/commands/farm.js.map +7 -0
- package/dist/commands/init.js +11 -1
- package/dist/commands/init.js.map +2 -2
- package/dist/commands/mcp.js +122 -0
- package/dist/commands/mcp.js.map +7 -0
- package/dist/commands/relationship.js +251 -47
- package/dist/commands/relationship.js.map +2 -2
- package/dist/commands/reports.js +1 -1
- package/dist/commands/reports.js.map +2 -2
- package/dist/commands/update.js +56 -24
- package/dist/commands/update.js.map +2 -2
- package/dist/commands/upgrade.js +99 -11
- package/dist/commands/upgrade.js.map +3 -3
- package/dist/commands/validate.js +41 -3
- package/dist/commands/validate.js.map +2 -2
- package/dist/commands/version.js +2 -2
- package/dist/commands/version.js.map +2 -2
- package/dist/commands/visualize.js +4 -3
- package/dist/commands/visualize.js.map +2 -2
- package/dist/config.js +83 -0
- package/dist/config.js.map +7 -0
- package/dist/core/annotation-store.js +138 -0
- package/dist/core/annotation-store.js.map +7 -0
- package/dist/core/catalog-migration.js +33 -0
- package/dist/core/catalog-migration.js.map +7 -0
- package/dist/core/changeset-analysis.js +421 -0
- package/dist/core/changeset-analysis.js.map +7 -0
- package/dist/core/changeset-base-index.js +153 -0
- package/dist/core/changeset-base-index.js.map +7 -0
- package/dist/core/changeset-brief-delta.js +102 -0
- package/dist/core/changeset-brief-delta.js.map +7 -0
- package/dist/core/changeset-graph.js +281 -0
- package/dist/core/changeset-graph.js.map +7 -0
- package/dist/core/changeset-only-guard.js +32 -0
- package/dist/core/changeset-only-guard.js.map +7 -0
- package/dist/core/changeset-summary.js +68 -0
- package/dist/core/changeset-summary.js.map +7 -0
- package/dist/core/changeset-validator.js +66 -20
- package/dist/core/changeset-validator.js.map +2 -2
- package/dist/core/changeset-verify.js +518 -0
- package/dist/core/changeset-verify.js.map +7 -0
- package/dist/core/changeset.js +56 -9
- package/dist/core/changeset.js.map +2 -2
- package/dist/core/element-type-migration.js +145 -0
- package/dist/core/element-type-migration.js.map +7 -0
- package/dist/core/farm-manifest.js +140 -0
- package/dist/core/farm-manifest.js.map +7 -0
- package/dist/core/farm-sync-engine.js +346 -0
- package/dist/core/farm-sync-engine.js.map +7 -0
- package/dist/core/farm-sync-state.js +167 -0
- package/dist/core/farm-sync-state.js.map +7 -0
- package/dist/core/manifest.js +6 -3
- package/dist/core/manifest.js.map +2 -2
- package/dist/core/migration-registry.js +84 -1
- package/dist/core/migration-registry.js.map +2 -2
- package/dist/core/model-upgrade.js +102 -0
- package/dist/core/model-upgrade.js.map +7 -0
- package/dist/core/model.js +257 -44
- package/dist/core/model.js.map +3 -3
- package/dist/core/mutation-handler.js +71 -6
- package/dist/core/mutation-handler.js.map +2 -2
- package/dist/core/relationship-migration-table.js +6639 -0
- package/dist/core/relationship-migration-table.js.map +7 -0
- package/dist/core/relationship-migration.js +272 -0
- package/dist/core/relationship-migration.js.map +7 -0
- package/dist/core/relationship-prune.js +49 -0
- package/dist/core/relationship-prune.js.map +7 -0
- package/dist/core/relationship-staging.js +68 -0
- package/dist/core/relationship-staging.js.map +7 -0
- package/dist/core/relationships.js +26 -4
- package/dist/core/relationships.js.map +2 -2
- package/dist/core/report-data-model.js +7 -13
- package/dist/core/report-data-model.js.map +2 -2
- package/dist/core/staged-changeset-storage.js +64 -17
- package/dist/core/staged-changeset-storage.js.map +2 -2
- package/dist/core/staged-source-reference.js +28 -0
- package/dist/core/staged-source-reference.js.map +7 -0
- package/dist/core/staging-area.js +83 -18
- package/dist/core/staging-area.js.map +2 -2
- package/dist/core/virtual-projection.js +14 -5
- package/dist/core/virtual-projection.js.map +2 -2
- package/dist/export/archimate-exporter.js +1 -0
- package/dist/export/archimate-exporter.js.map +2 -2
- package/dist/generated/compiled-validators.js +2 -2
- package/dist/generated/compiled-validators.js.map +2 -2
- package/dist/generated/layer-registry.js +16 -16
- package/dist/generated/layer-registry.js.map +2 -2
- package/dist/generated/node-types.js +186 -168
- package/dist/generated/node-types.js.map +2 -2
- package/dist/generated/relationship-index.js +2209 -7727
- package/dist/generated/relationship-index.js.map +2 -2
- package/dist/integrations/claude_code/agents/dr-architect.md +16 -3
- package/dist/integrations/claude_code/agents/dr-extractor.md +1 -1
- package/dist/integrations/claude_code/commands/dr-analyzer.md +565 -0
- package/dist/integrations/claude_code/commands/dr-map.md +13 -0
- package/dist/integrations/claude_code/commands/dr-plan.md +40 -0
- package/dist/integrations/claude_code/commands/dr-relate.md +106 -96
- package/dist/integrations/claude_code/commands/dr-verify.md +45 -2
- package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +14 -0
- package/dist/integrations/claude_code/docs/MCP_SERVER.md +79 -0
- package/dist/integrations/claude_code/docs/QUICK_START.md +37 -8
- package/dist/integrations/claude_code/docs/README.md +52 -1
- package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +93 -72
- package/dist/integrations/claude_code/skills/dr_02_business_layer/SKILL.md +163 -126
- package/dist/integrations/claude_code/skills/dr_03_product_layer/SKILL.md +161 -126
- package/dist/integrations/claude_code/skills/dr_04_security_layer/SKILL.md +153 -133
- package/dist/integrations/claude_code/skills/dr_05_application_layer/SKILL.md +129 -100
- package/dist/integrations/claude_code/skills/dr_06_technology_layer/SKILL.md +111 -94
- package/dist/integrations/claude_code/skills/dr_07_api_layer/SKILL.md +143 -157
- package/dist/integrations/claude_code/skills/dr_08_data_model_layer/SKILL.md +117 -33
- package/dist/integrations/claude_code/skills/dr_09_dataset_layer/SKILL.md +74 -25
- package/dist/integrations/claude_code/skills/dr_10_ux_layer/SKILL.md +88 -12
- package/dist/integrations/claude_code/skills/dr_11_navigation_layer/SKILL.md +83 -24
- package/dist/integrations/claude_code/skills/dr_12_apm_layer/SKILL.md +57 -12
- package/dist/integrations/claude_code/skills/dr_13_testing_layer/SKILL.md +92 -15
- package/dist/integrations/claude_code/skills/dr_change_planning/SKILL.md +119 -0
- package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +3 -0
- package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +1 -1
- package/dist/integrations/github_copilot/agents/dr-architect.md +1 -1
- package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +182 -102
- package/dist/integrations/github_copilot/skills/dr_02_business_layer/SKILL.md +266 -148
- package/dist/integrations/github_copilot/skills/dr_03_product_layer/SKILL.md +547 -86
- package/dist/integrations/github_copilot/skills/dr_04_security_layer/SKILL.md +164 -169
- package/dist/integrations/github_copilot/skills/dr_05_application_layer/SKILL.md +420 -150
- package/dist/integrations/github_copilot/skills/dr_06_technology_layer/SKILL.md +331 -138
- package/dist/integrations/github_copilot/skills/dr_07_api_layer/SKILL.md +265 -201
- package/dist/integrations/github_copilot/skills/dr_08_data_model_layer/SKILL.md +181 -58
- package/dist/integrations/github_copilot/skills/dr_09_dataset_layer/SKILL.md +209 -57
- package/dist/integrations/github_copilot/skills/dr_10_ux_layer/SKILL.md +277 -112
- package/dist/integrations/github_copilot/skills/dr_11_navigation_layer/SKILL.md +219 -70
- package/dist/integrations/github_copilot/skills/dr_12_apm_layer/SKILL.md +189 -105
- package/dist/integrations/github_copilot/skills/dr_13_testing_layer/SKILL.md +222 -102
- package/dist/integrations/github_copilot/skills/dr_change_planning/SKILL.md +119 -0
- package/dist/integrations/github_copilot/skills/dr_changeset_reviewer/SKILL.md +3 -0
- package/dist/integrations/hash-utils.js.map +2 -2
- package/dist/mcp/api-key-manager.js +111 -0
- package/dist/mcp/api-key-manager.js.map +7 -0
- package/dist/mcp/changeset-only.js +34 -0
- package/dist/mcp/changeset-only.js.map +7 -0
- package/dist/mcp/http-transport.js +176 -0
- package/dist/mcp/http-transport.js.map +7 -0
- package/dist/mcp/resource-registry.js +97 -0
- package/dist/mcp/resource-registry.js.map +7 -0
- package/dist/mcp/tool-registry.js +60 -0
- package/dist/mcp/tool-registry.js.map +7 -0
- package/dist/mcp/tools/annotation-create.js +39 -0
- package/dist/mcp/tools/annotation-create.js.map +7 -0
- package/dist/mcp/tools/annotation-delete.js +29 -0
- package/dist/mcp/tools/annotation-delete.js.map +7 -0
- package/dist/mcp/tools/annotation-get.js +29 -0
- package/dist/mcp/tools/annotation-get.js.map +7 -0
- package/dist/mcp/tools/annotation-list.js +24 -0
- package/dist/mcp/tools/annotation-list.js.map +7 -0
- package/dist/mcp/tools/annotation-reply.js +34 -0
- package/dist/mcp/tools/annotation-reply.js.map +7 -0
- package/dist/mcp/tools/annotation-shared.js +10 -0
- package/dist/mcp/tools/annotation-shared.js.map +7 -0
- package/dist/mcp/tools/annotation-update.js +39 -0
- package/dist/mcp/tools/annotation-update.js.map +7 -0
- package/dist/mcp/tools/changeset-analysis-tools.js +78 -0
- package/dist/mcp/tools/changeset-analysis-tools.js.map +7 -0
- package/dist/mcp/tools/changeset-editing.js +184 -0
- package/dist/mcp/tools/changeset-editing.js.map +7 -0
- package/dist/mcp/tools/changeset-lifecycle.js +83 -0
- package/dist/mcp/tools/changeset-lifecycle.js.map +7 -0
- package/dist/mcp/tools/changeset-list.js +33 -0
- package/dist/mcp/tools/changeset-list.js.map +7 -0
- package/dist/mcp/tools/changeset-shared.js +31 -0
- package/dist/mcp/tools/changeset-shared.js.map +7 -0
- package/dist/mcp/tools/changeset-show.js +55 -0
- package/dist/mcp/tools/changeset-show.js.map +7 -0
- package/dist/mcp/tools/changeset-verify.js +43 -0
- package/dist/mcp/tools/changeset-verify.js.map +7 -0
- package/dist/mcp/tools/chat-launch.js +50 -0
- package/dist/mcp/tools/chat-launch.js.map +7 -0
- package/dist/mcp/tools/chat-status.js +26 -0
- package/dist/mcp/tools/chat-status.js.map +7 -0
- package/dist/mcp/tools/index.js +65 -0
- package/dist/mcp/tools/index.js.map +7 -0
- package/dist/mcp/tools/model-add.js +107 -0
- package/dist/mcp/tools/model-add.js.map +7 -0
- package/dist/mcp/tools/model-delete.js +99 -0
- package/dist/mcp/tools/model-delete.js.map +7 -0
- package/dist/mcp/tools/model-export.js +72 -0
- package/dist/mcp/tools/model-export.js.map +7 -0
- package/dist/mcp/tools/model-info.js +51 -0
- package/dist/mcp/tools/model-info.js.map +7 -0
- package/dist/mcp/tools/model-list.js +53 -0
- package/dist/mcp/tools/model-list.js.map +7 -0
- package/dist/mcp/tools/model-reload.js +34 -0
- package/dist/mcp/tools/model-reload.js.map +7 -0
- package/dist/mcp/tools/model-search.js +102 -0
- package/dist/mcp/tools/model-search.js.map +7 -0
- package/dist/mcp/tools/model-show.js +68 -0
- package/dist/mcp/tools/model-show.js.map +7 -0
- package/dist/mcp/tools/model-stats.js +22 -0
- package/dist/mcp/tools/model-stats.js.map +7 -0
- package/dist/mcp/tools/model-trace.js +118 -0
- package/dist/mcp/tools/model-trace.js.map +7 -0
- package/dist/mcp/tools/model-update.js +121 -0
- package/dist/mcp/tools/model-update.js.map +7 -0
- package/dist/mcp/tools/model-validate.js +78 -0
- package/dist/mcp/tools/model-validate.js.map +7 -0
- package/dist/mcp/tools/relationship-tools.js +98 -0
- package/dist/mcp/tools/relationship-tools.js.map +7 -0
- package/dist/mcp/tools/shared.js +126 -0
- package/dist/mcp/tools/shared.js.map +7 -0
- package/dist/mcp/tools/spec-type.js +90 -0
- package/dist/mcp/tools/spec-type.js.map +7 -0
- package/dist/reports/model-layer-report-generator.js +5 -3
- package/dist/reports/model-layer-report-generator.js.map +2 -2
- package/dist/reports/model-readme-generator.js +116 -0
- package/dist/reports/model-readme-generator.js.map +7 -0
- package/dist/reports/model-report-data.js +37 -1
- package/dist/reports/model-report-data.js.map +2 -2
- package/dist/reports/model-report-orchestrator.js +29 -6
- package/dist/reports/model-report-orchestrator.js.map +2 -2
- package/dist/reports/model-report-utils.js +9 -0
- package/dist/reports/model-report-utils.js.map +7 -0
- package/dist/schemas/bundled/analyzers/cbm.json +1186 -68
- package/dist/schemas/bundled/analyzers/manifest.json +2 -2
- package/dist/schemas/bundled/api.json +1029 -1658
- package/dist/schemas/bundled/apm.json +499 -734
- package/dist/schemas/bundled/application.json +745 -370
- package/dist/schemas/bundled/base.json +3 -220
- package/dist/schemas/bundled/business.json +452 -366
- package/dist/schemas/bundled/data-model.json +403 -383
- package/dist/schemas/bundled/data-store.json +334 -558
- package/dist/schemas/bundled/manifest.json +18 -18
- package/dist/schemas/bundled/motivation.json +349 -368
- package/dist/schemas/bundled/navigation.json +415 -731
- package/dist/schemas/bundled/product.json +325 -159
- package/dist/schemas/bundled/security.json +864 -1232
- package/dist/schemas/bundled/technology.json +574 -703
- package/dist/schemas/bundled/testing.json +718 -1643
- package/dist/schemas/bundled/ux.json +739 -1352
- package/dist/server/schemas.js +8 -0
- package/dist/server/schemas.js.map +2 -2
- package/dist/server/server.js +234 -31
- package/dist/server/server.js.map +2 -2
- package/dist/server-entry.js +2 -1
- package/dist/server-entry.js.map +2 -2
- package/dist/telemetry/config.js +2 -40
- package/dist/telemetry/config.js.map +2 -2
- package/dist/telemetry/index.js +1 -1
- package/dist/types/index.js.map +2 -2
- package/dist/utils/ansi-suppressor.js +23 -0
- package/dist/utils/ansi-suppressor.js.map +7 -0
- package/dist/utils/attribute-patch.js +41 -0
- package/dist/utils/attribute-patch.js.map +7 -0
- package/dist/utils/color-utils.js +34 -0
- package/dist/utils/color-utils.js.map +7 -0
- package/dist/utils/element-reference-shape.js +15 -1
- package/dist/utils/element-reference-shape.js.map +3 -3
- package/dist/utils/error-hints.js +29 -0
- package/dist/utils/error-hints.js.map +7 -0
- package/dist/utils/errors.js +75 -10
- package/dist/utils/errors.js.map +2 -2
- package/dist/utils/globals.js +17 -1
- package/dist/utils/globals.js.map +2 -2
- package/dist/utils/project-paths.js +50 -3
- package/dist/utils/project-paths.js.map +2 -2
- package/dist/utils/reference-path-parser.js +49 -0
- package/dist/utils/reference-path-parser.js.map +7 -0
- package/dist/utils/source-reference.js +17 -10
- package/dist/utils/source-reference.js.map +2 -2
- package/dist/utils/spec-version.js +10 -2
- package/dist/utils/spec-version.js.map +2 -2
- package/dist/validators/composed-reference-validator.js +240 -0
- package/dist/validators/composed-reference-validator.js.map +7 -0
- package/dist/validators/reference-validator.js +57 -13
- package/dist/validators/reference-validator.js.map +3 -3
- package/dist/validators/relationship-schema-validator.js +33 -5
- package/dist/validators/relationship-schema-validator.js.map +3 -3
- package/dist/validators/schema-validator.js +27 -9
- package/dist/validators/schema-validator.js.map +2 -2
- package/dist/validators/types.js.map +1 -1
- package/dist/viewer/README.md +6 -6
- package/dist/viewer/assets/main-CxzcuU_o.js +84 -0
- package/dist/viewer/assets/main-j-7ULYpm.css +1 -0
- package/dist/viewer/index.html +2 -2
- package/dist/viewer/manifest.json +10 -10
- package/dist/viewer/version.json +1 -1
- package/package.json +7 -3
- package/dist/viewer/assets/main-B7AOQXXX.js +0 -81
- package/dist/viewer/assets/main-vdrFrG7q.css +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var EM=Object.defineProperty,RM=Object.defineProperties;var TM=Object.getOwnPropertyDescriptors;var _f=Object.getOwnPropertySymbols;var Db=Object.prototype.hasOwnProperty,Lb=Object.prototype.propertyIsEnumerable;var Ob=e=>{throw TypeError(e)},$a=Math.pow,Hm=(e,t,n)=>t in e?EM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t)=>{for(var n in t||(t={}))Db.call(t,n)&&Hm(e,n,t[n]);if(_f)for(var n of _f(t))Lb.call(t,n)&&Hm(e,n,t[n]);return e},Z=(e,t)=>RM(e,TM(t));var Me=(e,t)=>{var n={};for(var a in e)Db.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&_f)for(var a of _f(e))t.indexOf(a)<0&&Lb.call(e,a)&&(n[a]=e[a]);return n};var AM=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Lt=(e,t,n)=>Hm(e,typeof t!="symbol"?t+"":t,n),qm=(e,t,n)=>t.has(e)||Ob("Cannot "+n);var te=(e,t,n)=>(qm(e,t,"read from private field"),n?n.call(e):t.get(e)),nt=(e,t,n)=>t.has(e)?Ob("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ve=(e,t,n,a)=>(qm(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),_t=(e,t,n)=>(qm(e,t,"access private method"),n);var wf=(e,t,n,a)=>({set _(s){Ve(e,t,s,n)},get _(){return te(e,t,a)}});var ut=(e,t,n)=>new Promise((a,s)=>{var o=u=>{try{c(n.next(u))}catch(f){s(f)}},l=u=>{try{c(n.throw(u))}catch(f){s(f)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(o,l);c((n=n.apply(e,t)).next())});import{r as av,a as RS,g as DM,b as T,R as ve,c as Sh}from"./vendor-CxKvDp2x.js";var LF=AM(x1=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var Vm={exports:{}},iu={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ib;function LM(){if(Ib)return iu;Ib=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,o){var l=null;if(o!==void 0&&(l=""+o),s.key!==void 0&&(l=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:e,type:a,key:l,ref:s!==void 0?s:null,props:o}}return iu.Fragment=t,iu.jsx=n,iu.jsxs=n,iu}var zb;function OM(){return zb||(zb=1,Vm.exports=LM()),Vm.exports}var h=OM(),Gm={exports:{}},su={},Ym={exports:{}},Xm={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* scheduler.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Bb;function IM(){return Bb||(Bb=1,(function(e){function t(P,G){var K=P.length;P.push(G);e:for(;0<K;){var se=K-1>>>1,V=P[se];if(0<s(V,G))P[se]=G,P[K]=V,K=se;else break e}}function n(P){return P.length===0?null:P[0]}function a(P){if(P.length===0)return null;var G=P[0],K=P.pop();if(K!==G){P[0]=K;e:for(var se=0,V=P.length,re=V>>>1;se<re;){var fe=2*(se+1)-1,B=P[fe],W=fe+1,ae=P[W];if(0>s(B,K))W<V&&0>s(ae,B)?(P[se]=ae,P[W]=K,se=W):(P[se]=B,P[fe]=K,se=fe);else if(W<V&&0>s(ae,K))P[se]=ae,P[W]=K,se=W;else break e}}return G}function s(P,G){var K=P.sortIndex-G.sortIndex;return K!==0?K:P.id-G.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,c=l.now();e.unstable_now=function(){return l.now()-c}}var u=[],f=[],m=1,p=null,y=3,v=!1,x=!1,b=!1,w=!1,C=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate!="undefined"?setImmediate:null;function M(P){for(var G=n(f);G!==null;){if(G.callback===null)a(f);else if(G.startTime<=P)a(f),G.sortIndex=G.expirationTime,t(u,G);else break;G=n(f)}}function D(P){if(b=!1,M(P),!x)if(n(u)!==null)x=!0,j||(j=!0,L());else{var G=n(f);G!==null&&$(D,G.startTime-P)}}var j=!1,A=-1,O=5,R=-1;function E(){return w?!0:!(e.unstable_now()-R<O)}function I(){if(w=!1,j){var P=e.unstable_now();R=P;var G=!0;try{e:{x=!1,b&&(b=!1,N(A),A=-1),v=!0;var K=y;try{t:{for(M(P),p=n(u);p!==null&&!(p.expirationTime>P&&E());){var se=p.callback;if(typeof se=="function"){p.callback=null,y=p.priorityLevel;var V=se(p.expirationTime<=P);if(P=e.unstable_now(),typeof V=="function"){p.callback=V,M(P),G=!0;break t}p===n(u)&&a(u),M(P)}else a(u);p=n(u)}if(p!==null)G=!0;else{var re=n(f);re!==null&&$(D,re.startTime-P),G=!1}}break e}finally{p=null,y=K,v=!1}G=void 0}}finally{G?L():j=!1}}}var L;if(typeof k=="function")L=function(){k(I)};else if(typeof MessageChannel!="undefined"){var H=new MessageChannel,U=H.port2;H.port1.onmessage=I,L=function(){U.postMessage(null)}}else L=function(){C(I,0)};function $(P,G){A=C(function(){P(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(P){switch(y){case 1:case 2:case 3:var G=3;break;default:G=y}var K=y;y=G;try{return P()}finally{y=K}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(P,G){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var K=y;y=P;try{return G()}finally{y=K}},e.unstable_scheduleCallback=function(P,G,K){var se=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?se+K:se):K=se,P){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=K+V,P={id:m++,callback:G,priorityLevel:P,startTime:K,expirationTime:V,sortIndex:-1},K>se?(P.sortIndex=K,t(f,P),n(u)===null&&P===n(f)&&(b?(N(A),A=-1):b=!0,$(D,K-se))):(P.sortIndex=V,t(u,P),x||v||(x=!0,j||(j=!0,L()))),P},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(P){var G=y;return function(){var K=y;y=G;try{return P.apply(this,arguments)}finally{y=K}}}})(Xm)),Xm}var Ub;function zM(){return Ub||(Ub=1,Ym.exports=IM()),Ym.exports}/**
|
|
18
|
+
* @license React
|
|
19
|
+
* react-dom-client.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var Fb;function BM(){if(Fb)return su;Fb=1;var e=zM(),t=av(),n=RS();function a(i){var r="https://react.dev/errors/"+i;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)r+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+i+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function o(i){var r=i,d=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(d=r.return),i=r.return;while(i)}return r.tag===3?d:null}function l(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function c(i){if(i.tag===31){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function u(i){if(o(i)!==i)throw Error(a(188))}function f(i){var r=i.alternate;if(!r){if(r=o(i),r===null)throw Error(a(188));return r!==i?null:i}for(var d=i,g=r;;){var _=d.return;if(_===null)break;var S=_.alternate;if(S===null){if(g=_.return,g!==null){d=g;continue}break}if(_.child===S.child){for(S=_.child;S;){if(S===d)return u(_),i;if(S===g)return u(_),r;S=S.sibling}throw Error(a(188))}if(d.return!==g.return)d=_,g=S;else{for(var z=!1,Y=_.child;Y;){if(Y===d){z=!0,d=_,g=S;break}if(Y===g){z=!0,g=_,d=S;break}Y=Y.sibling}if(!z){for(Y=S.child;Y;){if(Y===d){z=!0,d=S,g=_;break}if(Y===g){z=!0,g=S,d=_;break}Y=Y.sibling}if(!z)throw Error(a(189))}}if(d.alternate!==g)throw Error(a(190))}if(d.tag!==3)throw Error(a(188));return d.stateNode.current===d?i:r}function m(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=m(i),r!==null)return r;i=i.sibling}return null}var p=Object.assign,y=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),k=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),E=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function L(i){return i===null||typeof i!="object"?null:(i=I&&i[I]||i["@@iterator"],typeof i=="function"?i:null)}var H=Symbol.for("react.client.reference");function U(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===H?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case b:return"Fragment";case C:return"Profiler";case w:return"StrictMode";case D:return"Suspense";case j:return"SuspenseList";case R:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case x:return"Portal";case k:return i.displayName||"Context";case N:return(i._context.displayName||"Context")+".Consumer";case M:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case A:return r=i.displayName||null,r!==null?r:U(i.type)||"Memo";case O:r=i._payload,i=i._init;try{return U(i(r))}catch(d){}}return null}var $=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},se=[],V=-1;function re(i){return{current:i}}function fe(i){0>V||(i.current=se[V],se[V]=null,V--)}function B(i,r){V++,se[V]=i.current,i.current=r}var W=re(null),ae=re(null),J=re(null),le=re(null);function be(i,r){switch(B(J,r),B(ae,i),B(W,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?nb(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=nb(r),i=ab(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}fe(W),B(W,i)}function je(){fe(W),fe(ae),fe(J)}function De(i){i.memoizedState!==null&&B(le,i);var r=W.current,d=ab(r,i.type);r!==d&&(B(ae,i),B(W,d))}function Ae(i){ae.current===i&&(fe(W),fe(ae)),le.current===i&&(fe(le),eu._currentValue=K)}var Xe,Fe;function me(i){if(Xe===void 0)try{throw Error()}catch(d){var r=d.stack.trim().match(/\n( *(at )?)/);Xe=r&&r[1]||"",Fe=-1<d.stack.indexOf(`
|
|
26
|
+
at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
27
|
+
`+Xe+i+Fe}var Q=!1;function ue(i,r){if(!i||Q)return"";Q=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var g={DetermineComponentFrameRoot:function(){try{if(r){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(_e){var ge=_e}Reflect.construct(i,[],Ee)}else{try{Ee.call()}catch(_e){ge=_e}i.call(Ee.prototype)}}else{try{throw Error()}catch(_e){ge=_e}(Ee=i())&&typeof Ee.catch=="function"&&Ee.catch(function(){})}}catch(_e){if(_e&&ge&&typeof _e.stack=="string")return[_e.stack,ge.stack]}return[null,null]}};g.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(g.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(g.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=g.DetermineComponentFrameRoot(),z=S[0],Y=S[1];if(z&&Y){var ee=z.split(`
|
|
28
|
+
`),pe=Y.split(`
|
|
29
|
+
`);for(_=g=0;g<ee.length&&!ee[g].includes("DetermineComponentFrameRoot");)g++;for(;_<pe.length&&!pe[_].includes("DetermineComponentFrameRoot");)_++;if(g===ee.length||_===pe.length)for(g=ee.length-1,_=pe.length-1;1<=g&&0<=_&&ee[g]!==pe[_];)_--;for(;1<=g&&0<=_;g--,_--)if(ee[g]!==pe[_]){if(g!==1||_!==1)do if(g--,_--,0>_||ee[g]!==pe[_]){var Ce=`
|
|
30
|
+
`+ee[g].replace(" at new "," at ");return i.displayName&&Ce.includes("<anonymous>")&&(Ce=Ce.replace("<anonymous>",i.displayName)),Ce}while(1<=g&&0<=_);break}}}finally{Q=!1,Error.prepareStackTrace=d}return(d=i?i.displayName||i.name:"")?me(d):""}function xe(i,r){switch(i.tag){case 26:case 27:case 5:return me(i.type);case 16:return me("Lazy");case 13:return i.child!==r&&r!==null?me("Suspense Fallback"):me("Suspense");case 19:return me("SuspenseList");case 0:case 15:return ue(i.type,!1);case 11:return ue(i.type.render,!1);case 1:return ue(i.type,!0);case 31:return me("Activity");default:return""}}function ze(i){try{var r="",d=null;do r+=xe(i,d),d=i,i=i.return;while(i);return r}catch(g){return`
|
|
31
|
+
Error generating stack: `+g.message+`
|
|
32
|
+
`+g.stack}}var X=Object.prototype.hasOwnProperty,ke=e.unstable_scheduleCallback,we=e.unstable_cancelCallback,$e=e.unstable_shouldYield,tt=e.unstable_requestPaint,Ke=e.unstable_now,dt=e.unstable_getCurrentPriorityLevel,ye=e.unstable_ImmediatePriority,Se=e.unstable_UserBlockingPriority,Be=e.unstable_NormalPriority,at=e.unstable_LowPriority,Pe=e.unstable_IdlePriority,gt=e.log,ct=e.unstable_setDisableYieldValue,Et=null,qe=null;function vt(i){if(typeof gt=="function"&&ct(i),qe&&typeof qe.setStrictMode=="function")try{qe.setStrictMode(Et,i)}catch(r){}}var ht=Math.clz32?Math.clz32:Qa,Vt=Math.log,Zt=Math.LN2;function Qa(i){return i>>>=0,i===0?32:31-(Vt(i)/Zt|0)|0}var ln=256,cn=262144,aa=4194304;function rn(i){var r=i&42;if(r!==0)return r;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Zn(i,r,d){var g=i.pendingLanes;if(g===0)return 0;var _=0,S=i.suspendedLanes,z=i.pingedLanes;i=i.warmLanes;var Y=g&134217727;return Y!==0?(g=Y&~S,g!==0?_=rn(g):(z&=Y,z!==0?_=rn(z):d||(d=Y&~i,d!==0&&(_=rn(d))))):(Y=g&~S,Y!==0?_=rn(Y):z!==0?_=rn(z):d||(d=g&~i,d!==0&&(_=rn(d)))),_===0?0:r!==0&&r!==_&&(r&S)===0&&(S=_&-_,d=r&-r,S>=d||S===32&&(d&4194048)!==0)?r:_}function gn(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function Ln(i,r){switch(i){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ia(){var i=aa;return aa<<=1,(aa&62914560)===0&&(aa=4194304),i}function Li(i){for(var r=[],d=0;31>d;d++)r.push(i);return r}function nn(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function ja(i,r,d,g,_,S){var z=i.pendingLanes;i.pendingLanes=d,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=d,i.entangledLanes&=d,i.errorRecoveryDisabledLanes&=d,i.shellSuspendCounter=0;var Y=i.entanglements,ee=i.expirationTimes,pe=i.hiddenUpdates;for(d=z&~d;0<d;){var Ce=31-ht(d),Ee=1<<Ce;Y[Ce]=0,ee[Ce]=-1;var ge=pe[Ce];if(ge!==null)for(pe[Ce]=null,Ce=0;Ce<ge.length;Ce++){var _e=ge[Ce];_e!==null&&(_e.lane&=-536870913)}d&=~Ee}g!==0&&an(i,g,0),S!==0&&_===0&&i.tag!==0&&(i.suspendedLanes|=S&~(z&~r))}function an(i,r,d){i.pendingLanes|=r,i.suspendedLanes&=~r;var g=31-ht(r);i.entangledLanes|=r,i.entanglements[g]=i.entanglements[g]|1073741824|d&261930}function Za(i,r){var d=i.entangledLanes|=r;for(i=i.entanglements;d;){var g=31-ht(d),_=1<<g;_&r|i[g]&r&&(i[g]|=r),d&=~_}}function xi(i,r){var d=r&-r;return d=(d&42)!==0?1:wn(d),(d&(i.suspendedLanes|r))!==0?0:d}function wn(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Oi(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Ii(){var i=G.p;return i!==0?i:(i=window.event,i===void 0?32:kb(i.type))}function bi(i,r){var d=G.p;try{return G.p=i,r()}finally{G.p=d}}var Ea=Math.random().toString(36).slice(2),ce="__reactFiber$"+Ea,Ue="__reactProps$"+Ea,Je="__reactContainer$"+Ea,ft="__reactEvents$"+Ea,on="__reactListeners$"+Ea,Ra="__reactHandles$"+Ea,_i="__reactResources$"+Ea,Sn="__reactMarker$"+Ea;function Ta(i){delete i[ce],delete i[Ue],delete i[ft],delete i[on],delete i[Ra]}function Ja(i){var r=i[ce];if(r)return r;for(var d=i.parentNode;d;){if(r=d[Je]||d[ce]){if(d=r.alternate,r.child!==null||d!==null&&d.child!==null)for(i=ub(i);i!==null;){if(d=i[ce])return d;i=ub(i)}return r}i=d,d=i.parentNode}return null}function Aa(i){if(i=i[ce]||i[Je]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function Wa(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(a(33))}function Is(i){var r=i[_i];return r||(r=i[_i]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Cn(i){i[Sn]=!0}var pc=new Set,nd={};function ha(i,r){as(i,r),as(i+"Capture",r)}function as(i,r){for(nd[i]=r,i=0;i<r.length;i++)pc.add(r[i])}var Br=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),mc={},ad={};function xt(i){return X.call(ad,i)?!0:X.call(mc,i)?!1:Br.test(i)?ad[i]=!0:(mc[i]=!0,!1)}function Ho(i,r,d){if(xt(r))if(d===null)i.removeAttribute(r);else{switch(typeof d){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var g=r.toLowerCase().slice(0,5);if(g!=="data-"&&g!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+d)}}function Ur(i,r,d){if(d===null)i.removeAttribute(r);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+d)}}function On(i,r,d,g){if(g===null)i.removeAttribute(d);else{switch(typeof g){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(d);return}i.setAttributeNS(r,d,""+g)}}function sa(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Fr(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function qo(i,r,d){var g=Object.getOwnPropertyDescriptor(i.constructor.prototype,r);if(!i.hasOwnProperty(r)&&typeof g!="undefined"&&typeof g.get=="function"&&typeof g.set=="function"){var _=g.get,S=g.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return _.call(this)},set:function(z){d=""+z,S.call(this,z)}}),Object.defineProperty(i,r,{enumerable:g.enumerable}),{getValue:function(){return d},setValue:function(z){d=""+z},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function Vo(i){if(!i._valueTracker){var r=Fr(i)?"checked":"value";i._valueTracker=qo(i,r,""+i[r])}}function $r(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var d=r.getValue(),g="";return i&&(g=Fr(i)?i.checked?"true":"false":i.value),i=g,i!==d?(r.setValue(i),!0):!1}function Pr(i){if(i=i||(typeof document!="undefined"?document:void 0),typeof i=="undefined")return null;try{return i.activeElement||i.body}catch(r){return i.body}}var Hr=/[\n"\\]/g;function Hn(i){return i.replace(Hr,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function zi(i,r,d,g,_,S,z,Y){i.name="",z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?i.type=z:i.removeAttribute("type"),r!=null?z==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+sa(r)):i.value!==""+sa(r)&&(i.value=""+sa(r)):z!=="submit"&&z!=="reset"||i.removeAttribute("value"),r!=null?Vr(i,z,sa(r)):d!=null?Vr(i,z,sa(d)):g!=null&&i.removeAttribute("value"),_==null&&S!=null&&(i.defaultChecked=!!S),_!=null&&(i.checked=_&&typeof _!="function"&&typeof _!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?i.name=""+sa(Y):i.removeAttribute("name")}function qr(i,r,d,g,_,S,z,Y){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(i.type=S),r!=null||d!=null){if(!(S!=="submit"&&S!=="reset"||r!=null)){Vo(i);return}d=d!=null?""+sa(d):"",r=r!=null?""+sa(r):d,Y||r===i.value||(i.value=r),i.defaultValue=r}g=g!=null?g:_,g=typeof g!="function"&&typeof g!="symbol"&&!!g,i.checked=Y?i.checked:!!g,i.defaultChecked=!!g,z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"&&(i.name=z),Vo(i)}function Vr(i,r,d){r==="number"&&Pr(i.ownerDocument)===i||i.defaultValue===""+d||(i.defaultValue=""+d)}function is(i,r,d,g){if(i=i.options,r){r={};for(var _=0;_<d.length;_++)r["$"+d[_]]=!0;for(d=0;d<i.length;d++)_=r.hasOwnProperty("$"+i[d].value),i[d].selected!==_&&(i[d].selected=_),_&&g&&(i[d].defaultSelected=!0)}else{for(d=""+sa(d),r=null,_=0;_<i.length;_++){if(i[_].value===d){i[_].selected=!0,g&&(i[_].defaultSelected=!0);return}r!==null||i[_].disabled||(r=i[_])}r!==null&&(r.selected=!0)}}function zs(i,r,d){if(r!=null&&(r=""+sa(r),r!==i.value&&(i.value=r),d==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=d!=null?""+sa(d):""}function ss(i,r,d,g){if(r==null){if(g!=null){if(d!=null)throw Error(a(92));if($(g)){if(1<g.length)throw Error(a(93));g=g[0]}d=g}d==null&&(d=""),r=d}d=sa(r),i.defaultValue=d,g=i.textContent,g===d&&g!==""&&g!==null&&(i.value=g),Vo(i)}function Da(i,r){if(r){var d=i.firstChild;if(d&&d===i.lastChild&&d.nodeType===3){d.nodeValue=r;return}}i.textContent=r}var Go=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function id(i,r,d){var g=r.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?g?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":g?i.setProperty(r,d):typeof d!="number"||d===0||Go.has(r)?r==="float"?i.cssFloat=d:i[r]=(""+d).trim():i[r]=d+"px"}function pt(i,r,d){if(r!=null&&typeof r!="object")throw Error(a(62));if(i=i.style,d!=null){for(var g in d)!d.hasOwnProperty(g)||r!=null&&r.hasOwnProperty(g)||(g.indexOf("--")===0?i.setProperty(g,""):g==="float"?i.cssFloat="":i[g]="");for(var _ in r)g=r[_],r.hasOwnProperty(_)&&d[_]!==g&&id(i,_,g)}else for(var S in r)r.hasOwnProperty(S)&&id(i,S,r[S])}function Bi(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var qn=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),pa=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function La(i){return pa.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Bt(){}var Ui=null;function Bs(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var wi=null,Si=null;function sd(i){var r=Aa(i);if(r&&(i=r.stateNode)){var d=i[Ue]||null;e:switch(i=r.stateNode,r.type){case"input":if(zi(i,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),r=d.name,d.type==="radio"&&r!=null){for(d=i;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+Hn(""+r)+'"][type="radio"]'),r=0;r<d.length;r++){var g=d[r];if(g!==i&&g.form===i.form){var _=g[Ue]||null;if(!_)throw Error(a(90));zi(g,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(r=0;r<d.length;r++)g=d[r],g.form===i.form&&$r(g)}break e;case"textarea":zs(i,d.value,d.defaultValue);break e;case"select":r=d.value,r!=null&&is(i,!!d.multiple,r,!1)}}}var gc=!1;function yc(i,r,d){if(gc)return i(r,d);gc=!0;try{var g=i(r);return g}finally{if(gc=!1,(wi!==null||Si!==null)&&(Jd(),wi&&(r=wi,i=Si,Si=wi=null,sd(r),i)))for(r=0;r<i.length;r++)sd(i[r])}}function rs(i,r){var d=i.stateNode;if(d===null)return null;var g=d[Ue]||null;if(g===null)return null;d=g[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(i=i.type,g=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!g;break e;default:i=!1}if(i)return null;if(d&&typeof d!="function")throw Error(a(231,r,typeof d));return d}var Ci=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),vc=!1;if(Ci)try{var os={};Object.defineProperty(os,"passive",{get:function(){vc=!0}}),window.addEventListener("test",os,os),window.removeEventListener("test",os,os)}catch(i){vc=!1}var Fi=null,xc=null,Yo=null;function Xo(){if(Yo)return Yo;var i,r=xc,d=r.length,g,_="value"in Fi?Fi.value:Fi.textContent,S=_.length;for(i=0;i<d&&r[i]===_[i];i++);var z=d-i;for(g=1;g<=z&&r[d-g]===_[S-g];g++);return Yo=_.slice(i,1<g?1-g:void 0)}function Ni(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function Us(){return!0}function bc(){return!1}function In(i){function r(d,g,_,S,z){this._reactName=d,this._targetInst=_,this.type=g,this.nativeEvent=S,this.target=z,this.currentTarget=null;for(var Y in i)i.hasOwnProperty(Y)&&(d=i[Y],this[Y]=d?d(S):S[Y]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Us:bc,this.isPropagationStopped=bc,this}return p(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Us)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Us)},persist:function(){},isPersistent:Us}),r}var $i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zn=In($i),Pi=p({},$i,{view:0,detail:0}),Ko=In(Pi),Fs,Gr,ei,Yr=p({},Pi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:wc,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==ei&&(ei&&i.type==="mousemove"?(Fs=i.screenX-ei.screenX,Gr=i.screenY-ei.screenY):Gr=Fs=0,ei=i),Fs)},movementY:function(i){return"movementY"in i?i.movementY:Gr}}),Xr=In(Yr),rd=p({},Yr,{dataTransfer:0}),od=In(rd),ld=p({},Pi,{relatedTarget:0}),_c=In(ld),cd=p({},$i,{animationName:0,elapsedTime:0,pseudoElement:0}),Ph=In(cd),Hh=p({},$i,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),ud=In(Hh),dd=p({},$i,{data:0}),Vn=In(dd),qh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vh={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},fd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qo(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=fd[i])?!!r[i]:!1}function wc(){return Qo}var Gh=p({},Pi,{key:function(i){if(i.key){var r=qh[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Ni(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Vh[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:wc,charCode:function(i){return i.type==="keypress"?Ni(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ni(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Zo=In(Gh),Sc=p({},Yr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hd=In(Sc),pd=p({},Pi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:wc}),ra=In(pd),md=p({},$i,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kr=In(md),Bn=p({},Yr,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Cc=In(Bn),Yh=p({},$i,{newState:0,oldState:0}),Xh=In(Yh),Kh=[9,13,27,32],ti=Ci&&"CompositionEvent"in window,Qr=null;Ci&&"documentMode"in document&&(Qr=document.documentMode);var Qh=Ci&&"TextEvent"in window&&!Qr,q=Ci&&(!ti||Qr&&8<Qr&&11>=Qr),ie=" ",de=!1;function Le(i,r){switch(i){case"keyup":return Kh.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function et(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ie=!1;function Ge(i,r){switch(i){case"compositionend":return et(r);case"keypress":return r.which!==32?null:(de=!0,ie);case"textInput":return i=r.data,i===ie&&de?null:i;default:return null}}function Ye(i,r){if(Ie)return i==="compositionend"||!ti&&Le(i,r)?(i=Xo(),Yo=xc=Fi=null,Ie=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return q&&r.locale!=="ko"?null:r.data;default:return null}}var Ze={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Jt(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!Ze[i.type]:r==="textarea"}function Nn(i,r,d,g){wi?Si?Si.push(g):Si=[g]:wi=g,r=rf(r,"onChange"),0<r.length&&(d=new zn("onChange","change",null,d,g),i.push({event:d,listeners:r}))}var yn=null,un=null;function Kt(i){Qx(i,0)}function rt(i){var r=Wa(i);if($r(r))return i}function vn(i,r){if(i==="change")return r}var $s=!1;if(Ci){var oa;if(Ci){var ls="oninput"in document;if(!ls){var Ps=document.createElement("div");Ps.setAttribute("oninput","return;"),ls=typeof Ps.oninput=="function"}oa=ls}else oa=!1;$s=oa&&(!document.documentMode||9<document.documentMode)}function Hs(){yn&&(yn.detachEvent("onpropertychange",Zr),un=yn=null)}function Zr(i){if(i.propertyName==="value"&&rt(un)){var r=[];Nn(r,un,i,Bs(i)),yc(Kt,r)}}function gd(i,r,d){i==="focusin"?(Hs(),yn=r,un=d,yn.attachEvent("onpropertychange",Zr)):i==="focusout"&&Hs()}function yd(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return rt(un)}function Zh(i,r){if(i==="click")return rt(r)}function Jo(i,r){if(i==="input"||i==="change")return rt(r)}function ki(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var dn=typeof Object.is=="function"?Object.is:ki;function qs(i,r){if(dn(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var d=Object.keys(i),g=Object.keys(r);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var _=d[g];if(!X.call(r,_)||!dn(i[_],r[_]))return!1}return!0}function b1(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function _1(i,r){var d=b1(i);i=0;for(var g;d;){if(d.nodeType===3){if(g=i+d.textContent.length,i<=r&&g>=r)return{node:d,offset:r-i};i=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=b1(d)}}function w1(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?w1(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function S1(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Pr(i.document);r instanceof i.HTMLIFrameElement;){try{var d=typeof r.contentWindow.location.href=="string"}catch(g){d=!1}if(d)i=r.contentWindow;else break;r=Pr(i.document)}return r}function Jh(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var lk=Ci&&"documentMode"in document&&11>=document.documentMode,Wo=null,Wh=null,Nc=null,ep=!1;function C1(i,r,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;ep||Wo==null||Wo!==Pr(g)||(g=Wo,"selectionStart"in g&&Jh(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Nc&&qs(Nc,g)||(Nc=g,g=rf(Wh,"onSelect"),0<g.length&&(r=new zn("onSelect","select",null,r,d),i.push({event:r,listeners:g}),r.target=Wo)))}function Jr(i,r){var d={};return d[i.toLowerCase()]=r.toLowerCase(),d["Webkit"+i]="webkit"+r,d["Moz"+i]="moz"+r,d}var el={animationend:Jr("Animation","AnimationEnd"),animationiteration:Jr("Animation","AnimationIteration"),animationstart:Jr("Animation","AnimationStart"),transitionrun:Jr("Transition","TransitionRun"),transitionstart:Jr("Transition","TransitionStart"),transitioncancel:Jr("Transition","TransitionCancel"),transitionend:Jr("Transition","TransitionEnd")},tp={},N1={};Ci&&(N1=document.createElement("div").style,"AnimationEvent"in window||(delete el.animationend.animation,delete el.animationiteration.animation,delete el.animationstart.animation),"TransitionEvent"in window||delete el.transitionend.transition);function Wr(i){if(tp[i])return tp[i];if(!el[i])return i;var r=el[i],d;for(d in r)if(r.hasOwnProperty(d)&&d in N1)return tp[i]=r[d];return i}var k1=Wr("animationend"),M1=Wr("animationiteration"),j1=Wr("animationstart"),ck=Wr("transitionrun"),uk=Wr("transitionstart"),dk=Wr("transitioncancel"),E1=Wr("transitionend"),R1=new Map,np="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");np.push("scrollEnd");function Mi(i,r){R1.set(i,r),ha(r,[i])}var vd=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},ni=[],tl=0,ap=0;function xd(){for(var i=tl,r=ap=tl=0;r<i;){var d=ni[r];ni[r++]=null;var g=ni[r];ni[r++]=null;var _=ni[r];ni[r++]=null;var S=ni[r];if(ni[r++]=null,g!==null&&_!==null){var z=g.pending;z===null?_.next=_:(_.next=z.next,z.next=_),g.pending=_}S!==0&&T1(d,_,S)}}function bd(i,r,d,g){ni[tl++]=i,ni[tl++]=r,ni[tl++]=d,ni[tl++]=g,ap|=g,i.lanes|=g,i=i.alternate,i!==null&&(i.lanes|=g)}function ip(i,r,d,g){return bd(i,r,d,g),_d(i)}function eo(i,r){return bd(i,null,null,r),_d(i)}function T1(i,r,d){i.lanes|=d;var g=i.alternate;g!==null&&(g.lanes|=d);for(var _=!1,S=i.return;S!==null;)S.childLanes|=d,g=S.alternate,g!==null&&(g.childLanes|=d),S.tag===22&&(i=S.stateNode,i===null||i._visibility&1||(_=!0)),i=S,S=S.return;return i.tag===3?(S=i.stateNode,_&&r!==null&&(_=31-ht(d),i=S.hiddenUpdates,g=i[_],g===null?i[_]=[r]:g.push(r),r.lane=d|536870912),S):null}function _d(i){if(50<Yc)throw Yc=0,hm=null,Error(a(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var nl={};function fk(i,r,d,g){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Oa(i,r,d,g){return new fk(i,r,d,g)}function sp(i){return i=i.prototype,!(!i||!i.isReactComponent)}function cs(i,r){var d=i.alternate;return d===null?(d=Oa(i.tag,r,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=r,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&65011712,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,r=i.dependencies,d.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d.refCleanup=i.refCleanup,d}function A1(i,r){i.flags&=65011714;var d=i.alternate;return d===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=d.childLanes,i.lanes=d.lanes,i.child=d.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=d.memoizedProps,i.memoizedState=d.memoizedState,i.updateQueue=d.updateQueue,i.type=d.type,r=d.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function wd(i,r,d,g,_,S){var z=0;if(g=i,typeof i=="function")sp(i)&&(z=1);else if(typeof i=="string")z=yM(i,d,W.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case R:return i=Oa(31,d,r,_),i.elementType=R,i.lanes=S,i;case b:return to(d.children,_,S,r);case w:z=8,_|=24;break;case C:return i=Oa(12,d,r,_|2),i.elementType=C,i.lanes=S,i;case D:return i=Oa(13,d,r,_),i.elementType=D,i.lanes=S,i;case j:return i=Oa(19,d,r,_),i.elementType=j,i.lanes=S,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case k:z=10;break e;case N:z=9;break e;case M:z=11;break e;case A:z=14;break e;case O:z=16,g=null;break e}z=29,d=Error(a(130,i===null?"null":typeof i,"")),g=null}return r=Oa(z,d,r,_),r.elementType=i,r.type=g,r.lanes=S,r}function to(i,r,d,g){return i=Oa(7,i,g,r),i.lanes=d,i}function rp(i,r,d){return i=Oa(6,i,null,r),i.lanes=d,i}function D1(i){var r=Oa(18,null,null,0);return r.stateNode=i,r}function op(i,r,d){return r=Oa(4,i.children!==null?i.children:[],i.key,r),r.lanes=d,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var L1=new WeakMap;function ai(i,r){if(typeof i=="object"&&i!==null){var d=L1.get(i);return d!==void 0?d:(r={value:i,source:r,stack:ze(r)},L1.set(i,r),r)}return{value:i,source:r,stack:ze(r)}}var al=[],il=0,Sd=null,kc=0,ii=[],si=0,Vs=null,Hi=1,qi="";function us(i,r){al[il++]=kc,al[il++]=Sd,Sd=i,kc=r}function O1(i,r,d){ii[si++]=Hi,ii[si++]=qi,ii[si++]=Vs,Vs=i;var g=Hi;i=qi;var _=32-ht(g)-1;g&=~(1<<_),d+=1;var S=32-ht(r)+_;if(30<S){var z=_-_%5;S=(g&(1<<z)-1).toString(32),g>>=z,_-=z,Hi=1<<32-ht(r)+_|d<<_|g,qi=S+i}else Hi=1<<S|d<<_|g,qi=i}function lp(i){i.return!==null&&(us(i,1),O1(i,1,0))}function cp(i){for(;i===Sd;)Sd=al[--il],al[il]=null,kc=al[--il],al[il]=null;for(;i===Vs;)Vs=ii[--si],ii[si]=null,qi=ii[--si],ii[si]=null,Hi=ii[--si],ii[si]=null}function I1(i,r){ii[si++]=Hi,ii[si++]=qi,ii[si++]=Vs,Hi=r.id,qi=r.overflow,Vs=i}var Gn=null,Wt=null,Mt=!1,Gs=null,ri=!1,up=Error(a(519));function Ys(i){var r=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Mc(ai(r,i)),up}function z1(i){var r=i.stateNode,d=i.type,g=i.memoizedProps;switch(r[ce]=i,r[Ue]=g,d){case"dialog":St("cancel",r),St("close",r);break;case"iframe":case"object":case"embed":St("load",r);break;case"video":case"audio":for(d=0;d<Kc.length;d++)St(Kc[d],r);break;case"source":St("error",r);break;case"img":case"image":case"link":St("error",r),St("load",r);break;case"details":St("toggle",r);break;case"input":St("invalid",r),qr(r,g.value,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name,!0);break;case"select":St("invalid",r);break;case"textarea":St("invalid",r),ss(r,g.value,g.defaultValue,g.children)}d=g.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||r.textContent===""+d||g.suppressHydrationWarning===!0||eb(r.textContent,d)?(g.popover!=null&&(St("beforetoggle",r),St("toggle",r)),g.onScroll!=null&&St("scroll",r),g.onScrollEnd!=null&&St("scrollend",r),g.onClick!=null&&(r.onclick=Bt),r=!0):r=!1,r||Ys(i,!0)}function B1(i){for(Gn=i.return;Gn;)switch(Gn.tag){case 5:case 31:case 13:ri=!1;return;case 27:case 3:ri=!0;return;default:Gn=Gn.return}}function sl(i){if(i!==Gn)return!1;if(!Mt)return B1(i),Mt=!0,!1;var r=i.tag,d;if((d=r!==3&&r!==27)&&((d=r===5)&&(d=i.type,d=!(d!=="form"&&d!=="button")||jm(i.type,i.memoizedProps)),d=!d),d&&Wt&&Ys(i),B1(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Wt=cb(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Wt=cb(i)}else r===27?(r=Wt,or(i.type)?(i=Dm,Dm=null,Wt=i):Wt=r):Wt=Gn?li(i.stateNode.nextSibling):null;return!0}function no(){Wt=Gn=null,Mt=!1}function dp(){var i=Gs;return i!==null&&(va===null?va=i:va.push.apply(va,i),Gs=null),i}function Mc(i){Gs===null?Gs=[i]:Gs.push(i)}var fp=re(null),ao=null,ds=null;function Xs(i,r,d){B(fp,r._currentValue),r._currentValue=d}function fs(i){i._currentValue=fp.current,fe(fp)}function hp(i,r,d){for(;i!==null;){var g=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,g!==null&&(g.childLanes|=r)):g!==null&&(g.childLanes&r)!==r&&(g.childLanes|=r),i===d)break;i=i.return}}function pp(i,r,d,g){var _=i.child;for(_!==null&&(_.return=i);_!==null;){var S=_.dependencies;if(S!==null){var z=_.child;S=S.firstContext;e:for(;S!==null;){var Y=S;S=_;for(var ee=0;ee<r.length;ee++)if(Y.context===r[ee]){S.lanes|=d,Y=S.alternate,Y!==null&&(Y.lanes|=d),hp(S.return,d,i),g||(z=null);break e}S=Y.next}}else if(_.tag===18){if(z=_.return,z===null)throw Error(a(341));z.lanes|=d,S=z.alternate,S!==null&&(S.lanes|=d),hp(z,d,i),z=null}else z=_.child;if(z!==null)z.return=_;else for(z=_;z!==null;){if(z===i){z=null;break}if(_=z.sibling,_!==null){_.return=z.return,z=_;break}z=z.return}_=z}}function rl(i,r,d,g){i=null;for(var _=r,S=!1;_!==null;){if(!S){if((_.flags&524288)!==0)S=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var z=_.alternate;if(z===null)throw Error(a(387));if(z=z.memoizedProps,z!==null){var Y=_.type;dn(_.pendingProps.value,z.value)||(i!==null?i.push(Y):i=[Y])}}else if(_===le.current){if(z=_.alternate,z===null)throw Error(a(387));z.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(i!==null?i.push(eu):i=[eu])}_=_.return}i!==null&&pp(r,i,d,g),r.flags|=262144}function Cd(i){for(i=i.firstContext;i!==null;){if(!dn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function io(i){ao=i,ds=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Yn(i){return U1(ao,i)}function Nd(i,r){return ao===null&&io(i),U1(i,r)}function U1(i,r){var d=r._currentValue;if(r={context:r,memoizedValue:d,next:null},ds===null){if(i===null)throw Error(a(308));ds=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else ds=ds.next=r;return d}var hk=typeof AbortController!="undefined"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(d,g){i.push(g)}};this.abort=function(){r.aborted=!0,i.forEach(function(d){return d()})}},pk=e.unstable_scheduleCallback,mk=e.unstable_NormalPriority,kn={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function mp(){return{controller:new hk,data:new Map,refCount:0}}function jc(i){i.refCount--,i.refCount===0&&pk(mk,function(){i.controller.abort()})}var Ec=null,gp=0,ol=0,ll=null;function gk(i,r){if(Ec===null){var d=Ec=[];gp=0,ol=xm(),ll={status:"pending",value:void 0,then:function(g){d.push(g)}}}return gp++,r.then(F1,F1),r}function F1(){if(--gp===0&&Ec!==null){ll!==null&&(ll.status="fulfilled");var i=Ec;Ec=null,ol=0,ll=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function yk(i,r){var d=[],g={status:"pending",value:null,reason:null,then:function(_){d.push(_)}};return i.then(function(){g.status="fulfilled",g.value=r;for(var _=0;_<d.length;_++)(0,d[_])(r)},function(_){for(g.status="rejected",g.reason=_,_=0;_<d.length;_++)(0,d[_])(void 0)}),g}var $1=P.S;P.S=function(i,r){Cx=Ke(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&gk(i,r),$1!==null&&$1(i,r)};var so=re(null);function yp(){var i=so.current;return i!==null?i:Gt.pooledCache}function kd(i,r){r===null?B(so,so.current):B(so,r.pool)}function P1(){var i=yp();return i===null?null:{parent:kn._currentValue,pool:i}}var cl=Error(a(460)),vp=Error(a(474)),Md=Error(a(542)),jd={then:function(){}};function H1(i){return i=i.status,i==="fulfilled"||i==="rejected"}function q1(i,r,d){switch(d=i[d],d===void 0?i.push(r):d!==r&&(r.then(Bt,Bt),r=d),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,G1(i),i;default:if(typeof r.status=="string")r.then(Bt,Bt);else{if(i=Gt,i!==null&&100<i.shellSuspendCounter)throw Error(a(482));i=r,i.status="pending",i.then(function(g){if(r.status==="pending"){var _=r;_.status="fulfilled",_.value=g}},function(g){if(r.status==="pending"){var _=r;_.status="rejected",_.reason=g}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,G1(i),i}throw oo=r,cl}}function ro(i){try{var r=i._init;return r(i._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?(oo=d,cl):d}}var oo=null;function V1(){if(oo===null)throw Error(a(459));var i=oo;return oo=null,i}function G1(i){if(i===cl||i===Md)throw Error(a(483))}var ul=null,Rc=0;function Ed(i){var r=Rc;return Rc+=1,ul===null&&(ul=[]),q1(ul,i,r)}function Tc(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function Rd(i,r){throw r.$$typeof===y?Error(a(525)):(i=Object.prototype.toString.call(r),Error(a(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function Y1(i){function r(oe,ne){if(i){var he=oe.deletions;he===null?(oe.deletions=[ne],oe.flags|=16):he.push(ne)}}function d(oe,ne){if(!i)return null;for(;ne!==null;)r(oe,ne),ne=ne.sibling;return null}function g(oe){for(var ne=new Map;oe!==null;)oe.key!==null?ne.set(oe.key,oe):ne.set(oe.index,oe),oe=oe.sibling;return ne}function _(oe,ne){return oe=cs(oe,ne),oe.index=0,oe.sibling=null,oe}function S(oe,ne,he){return oe.index=he,i?(he=oe.alternate,he!==null?(he=he.index,he<ne?(oe.flags|=67108866,ne):he):(oe.flags|=67108866,ne)):(oe.flags|=1048576,ne)}function z(oe){return i&&oe.alternate===null&&(oe.flags|=67108866),oe}function Y(oe,ne,he,Ne){return ne===null||ne.tag!==6?(ne=rp(he,oe.mode,Ne),ne.return=oe,ne):(ne=_(ne,he),ne.return=oe,ne)}function ee(oe,ne,he,Ne){var it=he.type;return it===b?Ce(oe,ne,he.props.children,Ne,he.key):ne!==null&&(ne.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===O&&ro(it)===ne.type)?(ne=_(ne,he.props),Tc(ne,he),ne.return=oe,ne):(ne=wd(he.type,he.key,he.props,null,oe.mode,Ne),Tc(ne,he),ne.return=oe,ne)}function pe(oe,ne,he,Ne){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==he.containerInfo||ne.stateNode.implementation!==he.implementation?(ne=op(he,oe.mode,Ne),ne.return=oe,ne):(ne=_(ne,he.children||[]),ne.return=oe,ne)}function Ce(oe,ne,he,Ne,it){return ne===null||ne.tag!==7?(ne=to(he,oe.mode,Ne,it),ne.return=oe,ne):(ne=_(ne,he),ne.return=oe,ne)}function Ee(oe,ne,he){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=rp(""+ne,oe.mode,he),ne.return=oe,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case v:return he=wd(ne.type,ne.key,ne.props,null,oe.mode,he),Tc(he,ne),he.return=oe,he;case x:return ne=op(ne,oe.mode,he),ne.return=oe,ne;case O:return ne=ro(ne),Ee(oe,ne,he)}if($(ne)||L(ne))return ne=to(ne,oe.mode,he,null),ne.return=oe,ne;if(typeof ne.then=="function")return Ee(oe,Ed(ne),he);if(ne.$$typeof===k)return Ee(oe,Nd(oe,ne),he);Rd(oe,ne)}return null}function ge(oe,ne,he,Ne){var it=ne!==null?ne.key:null;if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return it!==null?null:Y(oe,ne,""+he,Ne);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case v:return he.key===it?ee(oe,ne,he,Ne):null;case x:return he.key===it?pe(oe,ne,he,Ne):null;case O:return he=ro(he),ge(oe,ne,he,Ne)}if($(he)||L(he))return it!==null?null:Ce(oe,ne,he,Ne,null);if(typeof he.then=="function")return ge(oe,ne,Ed(he),Ne);if(he.$$typeof===k)return ge(oe,ne,Nd(oe,he),Ne);Rd(oe,he)}return null}function _e(oe,ne,he,Ne,it){if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint")return oe=oe.get(he)||null,Y(ne,oe,""+Ne,it);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case v:return oe=oe.get(Ne.key===null?he:Ne.key)||null,ee(ne,oe,Ne,it);case x:return oe=oe.get(Ne.key===null?he:Ne.key)||null,pe(ne,oe,Ne,it);case O:return Ne=ro(Ne),_e(oe,ne,he,Ne,it)}if($(Ne)||L(Ne))return oe=oe.get(he)||null,Ce(ne,oe,Ne,it,null);if(typeof Ne.then=="function")return _e(oe,ne,he,Ed(Ne),it);if(Ne.$$typeof===k)return _e(oe,ne,he,Nd(ne,Ne),it);Rd(ne,Ne)}return null}function Qe(oe,ne,he,Ne){for(var it=null,Tt=null,We=ne,bt=ne=0,kt=null;We!==null&&bt<he.length;bt++){We.index>bt?(kt=We,We=null):kt=We.sibling;var At=ge(oe,We,he[bt],Ne);if(At===null){We===null&&(We=kt);break}i&&We&&At.alternate===null&&r(oe,We),ne=S(At,ne,bt),Tt===null?it=At:Tt.sibling=At,Tt=At,We=kt}if(bt===he.length)return d(oe,We),Mt&&us(oe,bt),it;if(We===null){for(;bt<he.length;bt++)We=Ee(oe,he[bt],Ne),We!==null&&(ne=S(We,ne,bt),Tt===null?it=We:Tt.sibling=We,Tt=We);return Mt&&us(oe,bt),it}for(We=g(We);bt<he.length;bt++)kt=_e(We,oe,bt,he[bt],Ne),kt!==null&&(i&&kt.alternate!==null&&We.delete(kt.key===null?bt:kt.key),ne=S(kt,ne,bt),Tt===null?it=kt:Tt.sibling=kt,Tt=kt);return i&&We.forEach(function(fr){return r(oe,fr)}),Mt&&us(oe,bt),it}function lt(oe,ne,he,Ne){if(he==null)throw Error(a(151));for(var it=null,Tt=null,We=ne,bt=ne=0,kt=null,At=he.next();We!==null&&!At.done;bt++,At=he.next()){We.index>bt?(kt=We,We=null):kt=We.sibling;var fr=ge(oe,We,At.value,Ne);if(fr===null){We===null&&(We=kt);break}i&&We&&fr.alternate===null&&r(oe,We),ne=S(fr,ne,bt),Tt===null?it=fr:Tt.sibling=fr,Tt=fr,We=kt}if(At.done)return d(oe,We),Mt&&us(oe,bt),it;if(We===null){for(;!At.done;bt++,At=he.next())At=Ee(oe,At.value,Ne),At!==null&&(ne=S(At,ne,bt),Tt===null?it=At:Tt.sibling=At,Tt=At);return Mt&&us(oe,bt),it}for(We=g(We);!At.done;bt++,At=he.next())At=_e(We,oe,bt,At.value,Ne),At!==null&&(i&&At.alternate!==null&&We.delete(At.key===null?bt:At.key),ne=S(At,ne,bt),Tt===null?it=At:Tt.sibling=At,Tt=At);return i&&We.forEach(function(jM){return r(oe,jM)}),Mt&&us(oe,bt),it}function qt(oe,ne,he,Ne){if(typeof he=="object"&&he!==null&&he.type===b&&he.key===null&&(he=he.props.children),typeof he=="object"&&he!==null){switch(he.$$typeof){case v:e:{for(var it=he.key;ne!==null;){if(ne.key===it){if(it=he.type,it===b){if(ne.tag===7){d(oe,ne.sibling),Ne=_(ne,he.props.children),Ne.return=oe,oe=Ne;break e}}else if(ne.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===O&&ro(it)===ne.type){d(oe,ne.sibling),Ne=_(ne,he.props),Tc(Ne,he),Ne.return=oe,oe=Ne;break e}d(oe,ne);break}else r(oe,ne);ne=ne.sibling}he.type===b?(Ne=to(he.props.children,oe.mode,Ne,he.key),Ne.return=oe,oe=Ne):(Ne=wd(he.type,he.key,he.props,null,oe.mode,Ne),Tc(Ne,he),Ne.return=oe,oe=Ne)}return z(oe);case x:e:{for(it=he.key;ne!==null;){if(ne.key===it)if(ne.tag===4&&ne.stateNode.containerInfo===he.containerInfo&&ne.stateNode.implementation===he.implementation){d(oe,ne.sibling),Ne=_(ne,he.children||[]),Ne.return=oe,oe=Ne;break e}else{d(oe,ne);break}else r(oe,ne);ne=ne.sibling}Ne=op(he,oe.mode,Ne),Ne.return=oe,oe=Ne}return z(oe);case O:return he=ro(he),qt(oe,ne,he,Ne)}if($(he))return Qe(oe,ne,he,Ne);if(L(he)){if(it=L(he),typeof it!="function")throw Error(a(150));return he=it.call(he),lt(oe,ne,he,Ne)}if(typeof he.then=="function")return qt(oe,ne,Ed(he),Ne);if(he.$$typeof===k)return qt(oe,ne,Nd(oe,he),Ne);Rd(oe,he)}return typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint"?(he=""+he,ne!==null&&ne.tag===6?(d(oe,ne.sibling),Ne=_(ne,he),Ne.return=oe,oe=Ne):(d(oe,ne),Ne=rp(he,oe.mode,Ne),Ne.return=oe,oe=Ne),z(oe)):d(oe,ne)}return function(oe,ne,he,Ne){try{Rc=0;var it=qt(oe,ne,he,Ne);return ul=null,it}catch(We){if(We===cl||We===Md)throw We;var Tt=Oa(29,We,null,oe.mode);return Tt.lanes=Ne,Tt.return=oe,Tt}finally{}}}var lo=Y1(!0),X1=Y1(!1),Ks=!1;function xp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bp(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Qs(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Zs(i,r,d){var g=i.updateQueue;if(g===null)return null;if(g=g.shared,(Dt&2)!==0){var _=g.pending;return _===null?r.next=r:(r.next=_.next,_.next=r),g.pending=r,r=_d(i),T1(i,null,d),r}return bd(i,g,r,d),_d(i)}function Ac(i,r,d){if(r=r.updateQueue,r!==null&&(r=r.shared,(d&4194048)!==0)){var g=r.lanes;g&=i.pendingLanes,d|=g,r.lanes=d,Za(i,d)}}function _p(i,r){var d=i.updateQueue,g=i.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var _=null,S=null;if(d=d.firstBaseUpdate,d!==null){do{var z={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};S===null?_=S=z:S=S.next=z,d=d.next}while(d!==null);S===null?_=S=r:S=S.next=r}else _=S=r;d={baseState:g.baseState,firstBaseUpdate:_,lastBaseUpdate:S,shared:g.shared,callbacks:g.callbacks},i.updateQueue=d;return}i=d.lastBaseUpdate,i===null?d.firstBaseUpdate=r:i.next=r,d.lastBaseUpdate=r}var wp=!1;function Dc(){if(wp){var i=ll;if(i!==null)throw i}}function Lc(i,r,d,g){wp=!1;var _=i.updateQueue;Ks=!1;var S=_.firstBaseUpdate,z=_.lastBaseUpdate,Y=_.shared.pending;if(Y!==null){_.shared.pending=null;var ee=Y,pe=ee.next;ee.next=null,z===null?S=pe:z.next=pe,z=ee;var Ce=i.alternate;Ce!==null&&(Ce=Ce.updateQueue,Y=Ce.lastBaseUpdate,Y!==z&&(Y===null?Ce.firstBaseUpdate=pe:Y.next=pe,Ce.lastBaseUpdate=ee))}if(S!==null){var Ee=_.baseState;z=0,Ce=pe=ee=null,Y=S;do{var ge=Y.lane&-536870913,_e=ge!==Y.lane;if(_e?(Nt&ge)===ge:(g&ge)===ge){ge!==0&&ge===ol&&(wp=!0),Ce!==null&&(Ce=Ce.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var Qe=i,lt=Y;ge=r;var qt=d;switch(lt.tag){case 1:if(Qe=lt.payload,typeof Qe=="function"){Ee=Qe.call(qt,Ee,ge);break e}Ee=Qe;break e;case 3:Qe.flags=Qe.flags&-65537|128;case 0:if(Qe=lt.payload,ge=typeof Qe=="function"?Qe.call(qt,Ee,ge):Qe,ge==null)break e;Ee=p({},Ee,ge);break e;case 2:Ks=!0}}ge=Y.callback,ge!==null&&(i.flags|=64,_e&&(i.flags|=8192),_e=_.callbacks,_e===null?_.callbacks=[ge]:_e.push(ge))}else _e={lane:ge,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},Ce===null?(pe=Ce=_e,ee=Ee):Ce=Ce.next=_e,z|=ge;if(Y=Y.next,Y===null){if(Y=_.shared.pending,Y===null)break;_e=Y,Y=_e.next,_e.next=null,_.lastBaseUpdate=_e,_.shared.pending=null}}while(!0);Ce===null&&(ee=Ee),_.baseState=ee,_.firstBaseUpdate=pe,_.lastBaseUpdate=Ce,S===null&&(_.shared.lanes=0),nr|=z,i.lanes=z,i.memoizedState=Ee}}function K1(i,r){if(typeof i!="function")throw Error(a(191,i));i.call(r)}function Q1(i,r){var d=i.callbacks;if(d!==null)for(i.callbacks=null,i=0;i<d.length;i++)K1(d[i],r)}var dl=re(null),Td=re(0);function Z1(i,r){i=_s,B(Td,i),B(dl,r),_s=i|r.baseLanes}function Sp(){B(Td,_s),B(dl,dl.current)}function Cp(){_s=Td.current,fe(dl),fe(Td)}var Ia=re(null),oi=null;function Js(i){var r=i.alternate;B(xn,xn.current&1),B(Ia,i),oi===null&&(r===null||dl.current!==null||r.memoizedState!==null)&&(oi=i)}function Np(i){B(xn,xn.current),B(Ia,i),oi===null&&(oi=i)}function J1(i){i.tag===22?(B(xn,xn.current),B(Ia,i),oi===null&&(oi=i)):Ws()}function Ws(){B(xn,xn.current),B(Ia,Ia.current)}function za(i){fe(Ia),oi===i&&(oi=null),fe(xn)}var xn=re(0);function Ad(i){for(var r=i;r!==null;){if(r.tag===13){var d=r.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Tm(d)||Am(d)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var hs=0,yt=null,Pt=null,Mn=null,Dd=!1,fl=!1,co=!1,Ld=0,Oc=0,hl=null,vk=0;function fn(){throw Error(a(321))}function kp(i,r){if(r===null)return!1;for(var d=0;d<r.length&&d<i.length;d++)if(!dn(i[d],r[d]))return!1;return!0}function Mp(i,r,d,g,_,S){return hs=S,yt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,P.H=i===null||i.memoizedState===null?O0:Pp,co=!1,S=d(g,_),co=!1,fl&&(S=e0(r,d,g,_)),W1(i),S}function W1(i){P.H=Bc;var r=Pt!==null&&Pt.next!==null;if(hs=0,Mn=Pt=yt=null,Dd=!1,Oc=0,hl=null,r)throw Error(a(300));i===null||jn||(i=i.dependencies,i!==null&&Cd(i)&&(jn=!0))}function e0(i,r,d,g){yt=i;var _=0;do{if(fl&&(hl=null),Oc=0,fl=!1,25<=_)throw Error(a(301));if(_+=1,Mn=Pt=null,i.updateQueue!=null){var S=i.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}P.H=I0,S=r(d,g)}while(fl);return S}function xk(){var i=P.H,r=i.useState()[0];return r=typeof r.then=="function"?Ic(r):r,i=i.useState()[0],(Pt!==null?Pt.memoizedState:null)!==i&&(yt.flags|=1024),r}function jp(){var i=Ld!==0;return Ld=0,i}function Ep(i,r,d){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~d}function Rp(i){if(Dd){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Dd=!1}hs=0,Mn=Pt=yt=null,fl=!1,Oc=Ld=0,hl=null}function la(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mn===null?yt.memoizedState=Mn=i:Mn=Mn.next=i,Mn}function bn(){if(Pt===null){var i=yt.alternate;i=i!==null?i.memoizedState:null}else i=Pt.next;var r=Mn===null?yt.memoizedState:Mn.next;if(r!==null)Mn=r,Pt=i;else{if(i===null)throw yt.alternate===null?Error(a(467)):Error(a(310));Pt=i,i={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},Mn===null?yt.memoizedState=Mn=i:Mn=Mn.next=i}return Mn}function Od(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ic(i){var r=Oc;return Oc+=1,hl===null&&(hl=[]),i=q1(hl,i,r),r=yt,(Mn===null?r.memoizedState:Mn.next)===null&&(r=r.alternate,P.H=r===null||r.memoizedState===null?O0:Pp),i}function Id(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Ic(i);if(i.$$typeof===k)return Yn(i)}throw Error(a(438,String(i)))}function Tp(i){var r=null,d=yt.updateQueue;if(d!==null&&(r=d.memoCache),r==null){var g=yt.alternate;g!==null&&(g=g.updateQueue,g!==null&&(g=g.memoCache,g!=null&&(r={data:g.data.map(function(_){return _.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),d===null&&(d=Od(),yt.updateQueue=d),d.memoCache=r,d=r.data[r.index],d===void 0)for(d=r.data[r.index]=Array(i),g=0;g<i;g++)d[g]=E;return r.index++,d}function ps(i,r){return typeof r=="function"?r(i):r}function zd(i){var r=bn();return Ap(r,Pt,i)}function Ap(i,r,d){var g=i.queue;if(g===null)throw Error(a(311));g.lastRenderedReducer=d;var _=i.baseQueue,S=g.pending;if(S!==null){if(_!==null){var z=_.next;_.next=S.next,S.next=z}r.baseQueue=_=S,g.pending=null}if(S=i.baseState,_===null)i.memoizedState=S;else{r=_.next;var Y=z=null,ee=null,pe=r,Ce=!1;do{var Ee=pe.lane&-536870913;if(Ee!==pe.lane?(Nt&Ee)===Ee:(hs&Ee)===Ee){var ge=pe.revertLane;if(ge===0)ee!==null&&(ee=ee.next={lane:0,revertLane:0,gesture:null,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null}),Ee===ol&&(Ce=!0);else if((hs&ge)===ge){pe=pe.next,ge===ol&&(Ce=!0);continue}else Ee={lane:0,revertLane:pe.revertLane,gesture:null,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},ee===null?(Y=ee=Ee,z=S):ee=ee.next=Ee,yt.lanes|=ge,nr|=ge;Ee=pe.action,co&&d(S,Ee),S=pe.hasEagerState?pe.eagerState:d(S,Ee)}else ge={lane:Ee,revertLane:pe.revertLane,gesture:pe.gesture,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},ee===null?(Y=ee=ge,z=S):ee=ee.next=ge,yt.lanes|=Ee,nr|=Ee;pe=pe.next}while(pe!==null&&pe!==r);if(ee===null?z=S:ee.next=Y,!dn(S,i.memoizedState)&&(jn=!0,Ce&&(d=ll,d!==null)))throw d;i.memoizedState=S,i.baseState=z,i.baseQueue=ee,g.lastRenderedState=S}return _===null&&(g.lanes=0),[i.memoizedState,g.dispatch]}function Dp(i){var r=bn(),d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=i;var g=d.dispatch,_=d.pending,S=r.memoizedState;if(_!==null){d.pending=null;var z=_=_.next;do S=i(S,z.action),z=z.next;while(z!==_);dn(S,r.memoizedState)||(jn=!0),r.memoizedState=S,r.baseQueue===null&&(r.baseState=S),d.lastRenderedState=S}return[S,g]}function t0(i,r,d){var g=yt,_=bn(),S=Mt;if(S){if(d===void 0)throw Error(a(407));d=d()}else d=r();var z=!dn((Pt||_).memoizedState,d);if(z&&(_.memoizedState=d,jn=!0),_=_.queue,Ip(i0.bind(null,g,_,i),[i]),_.getSnapshot!==r||z||Mn!==null&&Mn.memoizedState.tag&1){if(g.flags|=2048,pl(9,{destroy:void 0},a0.bind(null,g,_,d,r),null),Gt===null)throw Error(a(349));S||(hs&127)!==0||n0(g,r,d)}return d}function n0(i,r,d){i.flags|=16384,i={getSnapshot:r,value:d},r=yt.updateQueue,r===null?(r=Od(),yt.updateQueue=r,r.stores=[i]):(d=r.stores,d===null?r.stores=[i]:d.push(i))}function a0(i,r,d,g){r.value=d,r.getSnapshot=g,s0(r)&&r0(i)}function i0(i,r,d){return d(function(){s0(r)&&r0(i)})}function s0(i){var r=i.getSnapshot;i=i.value;try{var d=r();return!dn(i,d)}catch(g){return!0}}function r0(i){var r=eo(i,2);r!==null&&xa(r,i,2)}function Lp(i){var r=la();if(typeof i=="function"){var d=i;if(i=d(),co){vt(!0);try{d()}finally{vt(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:i},r}function o0(i,r,d,g){return i.baseState=d,Ap(i,Pt,typeof g=="function"?g:ps)}function bk(i,r,d,g,_){if(Fd(i))throw Error(a(485));if(i=r.action,i!==null){var S={payload:_,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(z){S.listeners.push(z)}};P.T!==null?d(!0):S.isTransition=!1,g(S),d=r.pending,d===null?(S.next=r.pending=S,l0(r,S)):(S.next=d.next,r.pending=d.next=S)}}function l0(i,r){var d=r.action,g=r.payload,_=i.state;if(r.isTransition){var S=P.T,z={};P.T=z;try{var Y=d(_,g),ee=P.S;ee!==null&&ee(z,Y),c0(i,r,Y)}catch(pe){Op(i,r,pe)}finally{S!==null&&z.types!==null&&(S.types=z.types),P.T=S}}else try{S=d(_,g),c0(i,r,S)}catch(pe){Op(i,r,pe)}}function c0(i,r,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(g){u0(i,r,g)},function(g){return Op(i,r,g)}):u0(i,r,d)}function u0(i,r,d){r.status="fulfilled",r.value=d,d0(r),i.state=d,r=i.pending,r!==null&&(d=r.next,d===r?i.pending=null:(d=d.next,r.next=d,l0(i,d)))}function Op(i,r,d){var g=i.pending;if(i.pending=null,g!==null){g=g.next;do r.status="rejected",r.reason=d,d0(r),r=r.next;while(r!==g)}i.action=null}function d0(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function f0(i,r){return r}function h0(i,r){if(Mt){var d=Gt.formState;if(d!==null){e:{var g=yt;if(Mt){if(Wt){t:{for(var _=Wt,S=ri;_.nodeType!==8;){if(!S){_=null;break t}if(_=li(_.nextSibling),_===null){_=null;break t}}S=_.data,_=S==="F!"||S==="F"?_:null}if(_){Wt=li(_.nextSibling),g=_.data==="F!";break e}}Ys(g)}g=!1}g&&(r=d[0])}}return d=la(),d.memoizedState=d.baseState=r,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:f0,lastRenderedState:r},d.queue=g,d=A0.bind(null,yt,g),g.dispatch=d,g=Lp(!1),S=$p.bind(null,yt,!1,g.queue),g=la(),_={state:r,dispatch:null,action:i,pending:null},g.queue=_,d=bk.bind(null,yt,_,S,d),_.dispatch=d,g.memoizedState=i,[r,d,!1]}function p0(i){var r=bn();return m0(r,Pt,i)}function m0(i,r,d){if(r=Ap(i,r,f0)[0],i=zd(ps)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var g=Ic(r)}catch(z){throw z===cl?Md:z}else g=r;r=bn();var _=r.queue,S=_.dispatch;return d!==r.memoizedState&&(yt.flags|=2048,pl(9,{destroy:void 0},_k.bind(null,_,d),null)),[g,S,i]}function _k(i,r){i.action=r}function g0(i){var r=bn(),d=Pt;if(d!==null)return m0(r,d,i);bn(),r=r.memoizedState,d=bn();var g=d.queue.dispatch;return d.memoizedState=i,[r,g,!1]}function pl(i,r,d,g){return i={tag:i,create:d,deps:g,inst:r,next:null},r=yt.updateQueue,r===null&&(r=Od(),yt.updateQueue=r),d=r.lastEffect,d===null?r.lastEffect=i.next=i:(g=d.next,d.next=i,i.next=g,r.lastEffect=i),i}function y0(){return bn().memoizedState}function Bd(i,r,d,g){var _=la();yt.flags|=i,_.memoizedState=pl(1|r,{destroy:void 0},d,g===void 0?null:g)}function Ud(i,r,d,g){var _=bn();g=g===void 0?null:g;var S=_.memoizedState.inst;Pt!==null&&g!==null&&kp(g,Pt.memoizedState.deps)?_.memoizedState=pl(r,S,d,g):(yt.flags|=i,_.memoizedState=pl(1|r,S,d,g))}function v0(i,r){Bd(8390656,8,i,r)}function Ip(i,r){Ud(2048,8,i,r)}function wk(i){yt.flags|=4;var r=yt.updateQueue;if(r===null)r=Od(),yt.updateQueue=r,r.events=[i];else{var d=r.events;d===null?r.events=[i]:d.push(i)}}function x0(i){var r=bn().memoizedState;return wk({ref:r,nextImpl:i}),function(){if((Dt&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}function b0(i,r){return Ud(4,2,i,r)}function _0(i,r){return Ud(4,4,i,r)}function w0(i,r){if(typeof r=="function"){i=i();var d=r(i);return function(){typeof d=="function"?d():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function S0(i,r,d){d=d!=null?d.concat([i]):null,Ud(4,4,w0.bind(null,r,i),d)}function zp(){}function C0(i,r){var d=bn();r=r===void 0?null:r;var g=d.memoizedState;return r!==null&&kp(r,g[1])?g[0]:(d.memoizedState=[i,r],i)}function N0(i,r){var d=bn();r=r===void 0?null:r;var g=d.memoizedState;if(r!==null&&kp(r,g[1]))return g[0];if(g=i(),co){vt(!0);try{i()}finally{vt(!1)}}return d.memoizedState=[g,r],g}function Bp(i,r,d){return d===void 0||(hs&1073741824)!==0&&(Nt&261930)===0?i.memoizedState=r:(i.memoizedState=d,i=kx(),yt.lanes|=i,nr|=i,d)}function k0(i,r,d,g){return dn(d,r)?d:dl.current!==null?(i=Bp(i,d,g),dn(i,r)||(jn=!0),i):(hs&42)===0||(hs&1073741824)!==0&&(Nt&261930)===0?(jn=!0,i.memoizedState=d):(i=kx(),yt.lanes|=i,nr|=i,r)}function M0(i,r,d,g,_){var S=G.p;G.p=S!==0&&8>S?S:8;var z=P.T,Y={};P.T=Y,$p(i,!1,r,d);try{var ee=_(),pe=P.S;if(pe!==null&&pe(Y,ee),ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){var Ce=yk(ee,g);zc(i,r,Ce,Fa(i))}else zc(i,r,g,Fa(i))}catch(Ee){zc(i,r,{then:function(){},status:"rejected",reason:Ee},Fa())}finally{G.p=S,z!==null&&Y.types!==null&&(z.types=Y.types),P.T=z}}function Sk(){}function Up(i,r,d,g){if(i.tag!==5)throw Error(a(476));var _=j0(i).queue;M0(i,_,r,K,d===null?Sk:function(){return E0(i),d(g)})}function j0(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:K},next:null};var d={};return r.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:d},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function E0(i){var r=j0(i);r.next===null&&(r=i.alternate.memoizedState),zc(i,r.next.queue,{},Fa())}function Fp(){return Yn(eu)}function R0(){return bn().memoizedState}function T0(){return bn().memoizedState}function Ck(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var d=Fa();i=Qs(d);var g=Zs(r,i,d);g!==null&&(xa(g,r,d),Ac(g,r,d)),r={cache:mp()},i.payload=r;return}r=r.return}}function Nk(i,r,d){var g=Fa();d={lane:g,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Fd(i)?D0(r,d):(d=ip(i,r,d,g),d!==null&&(xa(d,i,g),L0(d,r,g)))}function A0(i,r,d){var g=Fa();zc(i,r,d,g)}function zc(i,r,d,g){var _={lane:g,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(Fd(i))D0(r,_);else{var S=i.alternate;if(i.lanes===0&&(S===null||S.lanes===0)&&(S=r.lastRenderedReducer,S!==null))try{var z=r.lastRenderedState,Y=S(z,d);if(_.hasEagerState=!0,_.eagerState=Y,dn(Y,z))return bd(i,r,_,0),Gt===null&&xd(),!1}catch(ee){}finally{}if(d=ip(i,r,_,g),d!==null)return xa(d,i,g),L0(d,r,g),!0}return!1}function $p(i,r,d,g){if(g={lane:2,revertLane:xm(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Fd(i)){if(r)throw Error(a(479))}else r=ip(i,d,g,2),r!==null&&xa(r,i,2)}function Fd(i){var r=i.alternate;return i===yt||r!==null&&r===yt}function D0(i,r){fl=Dd=!0;var d=i.pending;d===null?r.next=r:(r.next=d.next,d.next=r),i.pending=r}function L0(i,r,d){if((d&4194048)!==0){var g=r.lanes;g&=i.pendingLanes,d|=g,r.lanes=d,Za(i,d)}}var Bc={readContext:Yn,use:Id,useCallback:fn,useContext:fn,useEffect:fn,useImperativeHandle:fn,useLayoutEffect:fn,useInsertionEffect:fn,useMemo:fn,useReducer:fn,useRef:fn,useState:fn,useDebugValue:fn,useDeferredValue:fn,useTransition:fn,useSyncExternalStore:fn,useId:fn,useHostTransitionStatus:fn,useFormState:fn,useActionState:fn,useOptimistic:fn,useMemoCache:fn,useCacheRefresh:fn};Bc.useEffectEvent=fn;var O0={readContext:Yn,use:Id,useCallback:function(i,r){return la().memoizedState=[i,r===void 0?null:r],i},useContext:Yn,useEffect:v0,useImperativeHandle:function(i,r,d){d=d!=null?d.concat([i]):null,Bd(4194308,4,w0.bind(null,r,i),d)},useLayoutEffect:function(i,r){return Bd(4194308,4,i,r)},useInsertionEffect:function(i,r){Bd(4,2,i,r)},useMemo:function(i,r){var d=la();r=r===void 0?null:r;var g=i();if(co){vt(!0);try{i()}finally{vt(!1)}}return d.memoizedState=[g,r],g},useReducer:function(i,r,d){var g=la();if(d!==void 0){var _=d(r);if(co){vt(!0);try{d(r)}finally{vt(!1)}}}else _=r;return g.memoizedState=g.baseState=_,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:_},g.queue=i,i=i.dispatch=Nk.bind(null,yt,i),[g.memoizedState,i]},useRef:function(i){var r=la();return i={current:i},r.memoizedState=i},useState:function(i){i=Lp(i);var r=i.queue,d=A0.bind(null,yt,r);return r.dispatch=d,[i.memoizedState,d]},useDebugValue:zp,useDeferredValue:function(i,r){var d=la();return Bp(d,i,r)},useTransition:function(){var i=Lp(!1);return i=M0.bind(null,yt,i.queue,!0,!1),la().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,d){var g=yt,_=la();if(Mt){if(d===void 0)throw Error(a(407));d=d()}else{if(d=r(),Gt===null)throw Error(a(349));(Nt&127)!==0||n0(g,r,d)}_.memoizedState=d;var S={value:d,getSnapshot:r};return _.queue=S,v0(i0.bind(null,g,S,i),[i]),g.flags|=2048,pl(9,{destroy:void 0},a0.bind(null,g,S,d,r),null),d},useId:function(){var i=la(),r=Gt.identifierPrefix;if(Mt){var d=qi,g=Hi;d=(g&~(1<<32-ht(g)-1)).toString(32)+d,r="_"+r+"R_"+d,d=Ld++,0<d&&(r+="H"+d.toString(32)),r+="_"}else d=vk++,r="_"+r+"r_"+d.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:Fp,useFormState:h0,useActionState:h0,useOptimistic:function(i){var r=la();r.memoizedState=r.baseState=i;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=d,r=$p.bind(null,yt,!0,d),d.dispatch=r,[i,r]},useMemoCache:Tp,useCacheRefresh:function(){return la().memoizedState=Ck.bind(null,yt)},useEffectEvent:function(i){var r=la(),d={impl:i};return r.memoizedState=d,function(){if((Dt&2)!==0)throw Error(a(440));return d.impl.apply(void 0,arguments)}}},Pp={readContext:Yn,use:Id,useCallback:C0,useContext:Yn,useEffect:Ip,useImperativeHandle:S0,useInsertionEffect:b0,useLayoutEffect:_0,useMemo:N0,useReducer:zd,useRef:y0,useState:function(){return zd(ps)},useDebugValue:zp,useDeferredValue:function(i,r){var d=bn();return k0(d,Pt.memoizedState,i,r)},useTransition:function(){var i=zd(ps)[0],r=bn().memoizedState;return[typeof i=="boolean"?i:Ic(i),r]},useSyncExternalStore:t0,useId:R0,useHostTransitionStatus:Fp,useFormState:p0,useActionState:p0,useOptimistic:function(i,r){var d=bn();return o0(d,Pt,i,r)},useMemoCache:Tp,useCacheRefresh:T0};Pp.useEffectEvent=x0;var I0={readContext:Yn,use:Id,useCallback:C0,useContext:Yn,useEffect:Ip,useImperativeHandle:S0,useInsertionEffect:b0,useLayoutEffect:_0,useMemo:N0,useReducer:Dp,useRef:y0,useState:function(){return Dp(ps)},useDebugValue:zp,useDeferredValue:function(i,r){var d=bn();return Pt===null?Bp(d,i,r):k0(d,Pt.memoizedState,i,r)},useTransition:function(){var i=Dp(ps)[0],r=bn().memoizedState;return[typeof i=="boolean"?i:Ic(i),r]},useSyncExternalStore:t0,useId:R0,useHostTransitionStatus:Fp,useFormState:g0,useActionState:g0,useOptimistic:function(i,r){var d=bn();return Pt!==null?o0(d,Pt,i,r):(d.baseState=i,[i,d.queue.dispatch])},useMemoCache:Tp,useCacheRefresh:T0};I0.useEffectEvent=x0;function Hp(i,r,d,g){r=i.memoizedState,d=d(g,r),d=d==null?r:p({},r,d),i.memoizedState=d,i.lanes===0&&(i.updateQueue.baseState=d)}var qp={enqueueSetState:function(i,r,d){i=i._reactInternals;var g=Fa(),_=Qs(g);_.payload=r,d!=null&&(_.callback=d),r=Zs(i,_,g),r!==null&&(xa(r,i,g),Ac(r,i,g))},enqueueReplaceState:function(i,r,d){i=i._reactInternals;var g=Fa(),_=Qs(g);_.tag=1,_.payload=r,d!=null&&(_.callback=d),r=Zs(i,_,g),r!==null&&(xa(r,i,g),Ac(r,i,g))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var d=Fa(),g=Qs(d);g.tag=2,r!=null&&(g.callback=r),r=Zs(i,g,d),r!==null&&(xa(r,i,d),Ac(r,i,d))}};function z0(i,r,d,g,_,S,z){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(g,S,z):r.prototype&&r.prototype.isPureReactComponent?!qs(d,g)||!qs(_,S):!0}function B0(i,r,d,g){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(d,g),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(d,g),r.state!==i&&qp.enqueueReplaceState(r,r.state,null)}function uo(i,r){var d=r;if("ref"in r){d={};for(var g in r)g!=="ref"&&(d[g]=r[g])}if(i=i.defaultProps){d===r&&(d=p({},d));for(var _ in i)d[_]===void 0&&(d[_]=i[_])}return d}function U0(i){vd(i)}function F0(i){console.error(i)}function $0(i){vd(i)}function $d(i,r){try{var d=i.onUncaughtError;d(r.value,{componentStack:r.stack})}catch(g){setTimeout(function(){throw g})}}function P0(i,r,d){try{var g=i.onCaughtError;g(d.value,{componentStack:d.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function Vp(i,r,d){return d=Qs(d),d.tag=3,d.payload={element:null},d.callback=function(){$d(i,r)},d}function H0(i){return i=Qs(i),i.tag=3,i}function q0(i,r,d,g){var _=d.type.getDerivedStateFromError;if(typeof _=="function"){var S=g.value;i.payload=function(){return _(S)},i.callback=function(){P0(r,d,g)}}var z=d.stateNode;z!==null&&typeof z.componentDidCatch=="function"&&(i.callback=function(){P0(r,d,g),typeof _!="function"&&(ar===null?ar=new Set([this]):ar.add(this));var Y=g.stack;this.componentDidCatch(g.value,{componentStack:Y!==null?Y:""})})}function kk(i,r,d,g,_){if(d.flags|=32768,g!==null&&typeof g=="object"&&typeof g.then=="function"){if(r=d.alternate,r!==null&&rl(r,d,_,!0),d=Ia.current,d!==null){switch(d.tag){case 31:case 13:return oi===null?Wd():d.alternate===null&&hn===0&&(hn=3),d.flags&=-257,d.flags|=65536,d.lanes=_,g===jd?d.flags|=16384:(r=d.updateQueue,r===null?d.updateQueue=new Set([g]):r.add(g),gm(i,g,_)),!1;case 22:return d.flags|=65536,g===jd?d.flags|=16384:(r=d.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([g])},d.updateQueue=r):(d=r.retryQueue,d===null?r.retryQueue=new Set([g]):d.add(g)),gm(i,g,_)),!1}throw Error(a(435,d.tag))}return gm(i,g,_),Wd(),!1}if(Mt)return r=Ia.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=_,g!==up&&(i=Error(a(422),{cause:g}),Mc(ai(i,d)))):(g!==up&&(r=Error(a(423),{cause:g}),Mc(ai(r,d))),i=i.current.alternate,i.flags|=65536,_&=-_,i.lanes|=_,g=ai(g,d),_=Vp(i.stateNode,g,_),_p(i,_),hn!==4&&(hn=2)),!1;var S=Error(a(520),{cause:g});if(S=ai(S,d),Gc===null?Gc=[S]:Gc.push(S),hn!==4&&(hn=2),r===null)return!0;g=ai(g,d),d=r;do{switch(d.tag){case 3:return d.flags|=65536,i=_&-_,d.lanes|=i,i=Vp(d.stateNode,g,i),_p(d,i),!1;case 1:if(r=d.type,S=d.stateNode,(d.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(ar===null||!ar.has(S))))return d.flags|=65536,_&=-_,d.lanes|=_,_=H0(_),q0(_,i,d,g),_p(d,_),!1}d=d.return}while(d!==null);return!1}var Gp=Error(a(461)),jn=!1;function Xn(i,r,d,g){r.child=i===null?X1(r,null,d,g):lo(r,i.child,d,g)}function V0(i,r,d,g,_){d=d.render;var S=r.ref;if("ref"in g){var z={};for(var Y in g)Y!=="ref"&&(z[Y]=g[Y])}else z=g;return io(r),g=Mp(i,r,d,z,S,_),Y=jp(),i!==null&&!jn?(Ep(i,r,_),ms(i,r,_)):(Mt&&Y&&lp(r),r.flags|=1,Xn(i,r,g,_),r.child)}function G0(i,r,d,g,_){if(i===null){var S=d.type;return typeof S=="function"&&!sp(S)&&S.defaultProps===void 0&&d.compare===null?(r.tag=15,r.type=S,Y0(i,r,S,g,_)):(i=wd(d.type,null,g,r,r.mode,_),i.ref=r.ref,i.return=r,r.child=i)}if(S=i.child,!em(i,_)){var z=S.memoizedProps;if(d=d.compare,d=d!==null?d:qs,d(z,g)&&i.ref===r.ref)return ms(i,r,_)}return r.flags|=1,i=cs(S,g),i.ref=r.ref,i.return=r,r.child=i}function Y0(i,r,d,g,_){if(i!==null){var S=i.memoizedProps;if(qs(S,g)&&i.ref===r.ref)if(jn=!1,r.pendingProps=g=S,em(i,_))(i.flags&131072)!==0&&(jn=!0);else return r.lanes=i.lanes,ms(i,r,_)}return Yp(i,r,d,g,_)}function X0(i,r,d,g){var _=g.children,S=i!==null?i.memoizedState:null;if(i===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),g.mode==="hidden"){if((r.flags&128)!==0){if(S=S!==null?S.baseLanes|d:d,i!==null){for(g=r.child=i.child,_=0;g!==null;)_=_|g.lanes|g.childLanes,g=g.sibling;g=_&~S}else g=0,r.child=null;return K0(i,r,S,d,g)}if((d&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&kd(r,S!==null?S.cachePool:null),S!==null?Z1(r,S):Sp(),J1(r);else return g=r.lanes=536870912,K0(i,r,S!==null?S.baseLanes|d:d,d,g)}else S!==null?(kd(r,S.cachePool),Z1(r,S),Ws(),r.memoizedState=null):(i!==null&&kd(r,null),Sp(),Ws());return Xn(i,r,_,d),r.child}function Uc(i,r){return i!==null&&i.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function K0(i,r,d,g,_){var S=yp();return S=S===null?null:{parent:kn._currentValue,pool:S},r.memoizedState={baseLanes:d,cachePool:S},i!==null&&kd(r,null),Sp(),J1(r),i!==null&&rl(i,r,g,!0),r.childLanes=_,null}function Pd(i,r){return r=qd({mode:r.mode,children:r.children},i.mode),r.ref=i.ref,i.child=r,r.return=i,r}function Q0(i,r,d){return lo(r,i.child,null,d),i=Pd(r,r.pendingProps),i.flags|=2,za(r),r.memoizedState=null,i}function Mk(i,r,d){var g=r.pendingProps,_=(r.flags&128)!==0;if(r.flags&=-129,i===null){if(Mt){if(g.mode==="hidden")return i=Pd(r,g),r.lanes=536870912,Uc(null,i);if(Np(r),(i=Wt)?(i=lb(i,ri),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:Vs!==null?{id:Hi,overflow:qi}:null,retryLane:536870912,hydrationErrors:null},d=D1(i),d.return=r,r.child=d,Gn=r,Wt=null)):i=null,i===null)throw Ys(r);return r.lanes=536870912,null}return Pd(r,g)}var S=i.memoizedState;if(S!==null){var z=S.dehydrated;if(Np(r),_)if(r.flags&256)r.flags&=-257,r=Q0(i,r,d);else if(r.memoizedState!==null)r.child=i.child,r.flags|=128,r=null;else throw Error(a(558));else if(jn||rl(i,r,d,!1),_=(d&i.childLanes)!==0,jn||_){if(g=Gt,g!==null&&(z=xi(g,d),z!==0&&z!==S.retryLane))throw S.retryLane=z,eo(i,z),xa(g,i,z),Gp;Wd(),r=Q0(i,r,d)}else i=S.treeContext,Wt=li(z.nextSibling),Gn=r,Mt=!0,Gs=null,ri=!1,i!==null&&I1(r,i),r=Pd(r,g),r.flags|=4096;return r}return i=cs(i.child,{mode:g.mode,children:g.children}),i.ref=r.ref,r.child=i,i.return=r,i}function Hd(i,r){var d=r.ref;if(d===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(a(284));(i===null||i.ref!==d)&&(r.flags|=4194816)}}function Yp(i,r,d,g,_){return io(r),d=Mp(i,r,d,g,void 0,_),g=jp(),i!==null&&!jn?(Ep(i,r,_),ms(i,r,_)):(Mt&&g&&lp(r),r.flags|=1,Xn(i,r,d,_),r.child)}function Z0(i,r,d,g,_,S){return io(r),r.updateQueue=null,d=e0(r,g,d,_),W1(i),g=jp(),i!==null&&!jn?(Ep(i,r,S),ms(i,r,S)):(Mt&&g&&lp(r),r.flags|=1,Xn(i,r,d,S),r.child)}function J0(i,r,d,g,_){if(io(r),r.stateNode===null){var S=nl,z=d.contextType;typeof z=="object"&&z!==null&&(S=Yn(z)),S=new d(g,S),r.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=qp,r.stateNode=S,S._reactInternals=r,S=r.stateNode,S.props=g,S.state=r.memoizedState,S.refs={},xp(r),z=d.contextType,S.context=typeof z=="object"&&z!==null?Yn(z):nl,S.state=r.memoizedState,z=d.getDerivedStateFromProps,typeof z=="function"&&(Hp(r,d,z,g),S.state=r.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(z=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),z!==S.state&&qp.enqueueReplaceState(S,S.state,null),Lc(r,g,S,_),Dc(),S.state=r.memoizedState),typeof S.componentDidMount=="function"&&(r.flags|=4194308),g=!0}else if(i===null){S=r.stateNode;var Y=r.memoizedProps,ee=uo(d,Y);S.props=ee;var pe=S.context,Ce=d.contextType;z=nl,typeof Ce=="object"&&Ce!==null&&(z=Yn(Ce));var Ee=d.getDerivedStateFromProps;Ce=typeof Ee=="function"||typeof S.getSnapshotBeforeUpdate=="function",Y=r.pendingProps!==Y,Ce||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(Y||pe!==z)&&B0(r,S,g,z),Ks=!1;var ge=r.memoizedState;S.state=ge,Lc(r,g,S,_),Dc(),pe=r.memoizedState,Y||ge!==pe||Ks?(typeof Ee=="function"&&(Hp(r,d,Ee,g),pe=r.memoizedState),(ee=Ks||z0(r,d,ee,g,ge,pe,z))?(Ce||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(r.flags|=4194308)):(typeof S.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=g,r.memoizedState=pe),S.props=g,S.state=pe,S.context=z,g=ee):(typeof S.componentDidMount=="function"&&(r.flags|=4194308),g=!1)}else{S=r.stateNode,bp(i,r),z=r.memoizedProps,Ce=uo(d,z),S.props=Ce,Ee=r.pendingProps,ge=S.context,pe=d.contextType,ee=nl,typeof pe=="object"&&pe!==null&&(ee=Yn(pe)),Y=d.getDerivedStateFromProps,(pe=typeof Y=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(z!==Ee||ge!==ee)&&B0(r,S,g,ee),Ks=!1,ge=r.memoizedState,S.state=ge,Lc(r,g,S,_),Dc();var _e=r.memoizedState;z!==Ee||ge!==_e||Ks||i!==null&&i.dependencies!==null&&Cd(i.dependencies)?(typeof Y=="function"&&(Hp(r,d,Y,g),_e=r.memoizedState),(Ce=Ks||z0(r,d,Ce,g,ge,_e,ee)||i!==null&&i.dependencies!==null&&Cd(i.dependencies))?(pe||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(g,_e,ee),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(g,_e,ee)),typeof S.componentDidUpdate=="function"&&(r.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof S.componentDidUpdate!="function"||z===i.memoizedProps&&ge===i.memoizedState||(r.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||z===i.memoizedProps&&ge===i.memoizedState||(r.flags|=1024),r.memoizedProps=g,r.memoizedState=_e),S.props=g,S.state=_e,S.context=ee,g=Ce):(typeof S.componentDidUpdate!="function"||z===i.memoizedProps&&ge===i.memoizedState||(r.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||z===i.memoizedProps&&ge===i.memoizedState||(r.flags|=1024),g=!1)}return S=g,Hd(i,r),g=(r.flags&128)!==0,S||g?(S=r.stateNode,d=g&&typeof d.getDerivedStateFromError!="function"?null:S.render(),r.flags|=1,i!==null&&g?(r.child=lo(r,i.child,null,_),r.child=lo(r,null,d,_)):Xn(i,r,d,_),r.memoizedState=S.state,i=r.child):i=ms(i,r,_),i}function W0(i,r,d,g){return no(),r.flags|=256,Xn(i,r,d,g),r.child}var Xp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Kp(i){return{baseLanes:i,cachePool:P1()}}function Qp(i,r,d){return i=i!==null?i.childLanes&~d:0,r&&(i|=Ua),i}function ex(i,r,d){var g=r.pendingProps,_=!1,S=(r.flags&128)!==0,z;if((z=S)||(z=i!==null&&i.memoizedState===null?!1:(xn.current&2)!==0),z&&(_=!0,r.flags&=-129),z=(r.flags&32)!==0,r.flags&=-33,i===null){if(Mt){if(_?Js(r):Ws(),(i=Wt)?(i=lb(i,ri),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:Vs!==null?{id:Hi,overflow:qi}:null,retryLane:536870912,hydrationErrors:null},d=D1(i),d.return=r,r.child=d,Gn=r,Wt=null)):i=null,i===null)throw Ys(r);return Am(i)?r.lanes=32:r.lanes=536870912,null}var Y=g.children;return g=g.fallback,_?(Ws(),_=r.mode,Y=qd({mode:"hidden",children:Y},_),g=to(g,_,d,null),Y.return=r,g.return=r,Y.sibling=g,r.child=Y,g=r.child,g.memoizedState=Kp(d),g.childLanes=Qp(i,z,d),r.memoizedState=Xp,Uc(null,g)):(Js(r),Zp(r,Y))}var ee=i.memoizedState;if(ee!==null&&(Y=ee.dehydrated,Y!==null)){if(S)r.flags&256?(Js(r),r.flags&=-257,r=Jp(i,r,d)):r.memoizedState!==null?(Ws(),r.child=i.child,r.flags|=128,r=null):(Ws(),Y=g.fallback,_=r.mode,g=qd({mode:"visible",children:g.children},_),Y=to(Y,_,d,null),Y.flags|=2,g.return=r,Y.return=r,g.sibling=Y,r.child=g,lo(r,i.child,null,d),g=r.child,g.memoizedState=Kp(d),g.childLanes=Qp(i,z,d),r.memoizedState=Xp,r=Uc(null,g));else if(Js(r),Am(Y)){if(z=Y.nextSibling&&Y.nextSibling.dataset,z)var pe=z.dgst;z=pe,g=Error(a(419)),g.stack="",g.digest=z,Mc({value:g,source:null,stack:null}),r=Jp(i,r,d)}else if(jn||rl(i,r,d,!1),z=(d&i.childLanes)!==0,jn||z){if(z=Gt,z!==null&&(g=xi(z,d),g!==0&&g!==ee.retryLane))throw ee.retryLane=g,eo(i,g),xa(z,i,g),Gp;Tm(Y)||Wd(),r=Jp(i,r,d)}else Tm(Y)?(r.flags|=192,r.child=i.child,r=null):(i=ee.treeContext,Wt=li(Y.nextSibling),Gn=r,Mt=!0,Gs=null,ri=!1,i!==null&&I1(r,i),r=Zp(r,g.children),r.flags|=4096);return r}return _?(Ws(),Y=g.fallback,_=r.mode,ee=i.child,pe=ee.sibling,g=cs(ee,{mode:"hidden",children:g.children}),g.subtreeFlags=ee.subtreeFlags&65011712,pe!==null?Y=cs(pe,Y):(Y=to(Y,_,d,null),Y.flags|=2),Y.return=r,g.return=r,g.sibling=Y,r.child=g,Uc(null,g),g=r.child,Y=i.child.memoizedState,Y===null?Y=Kp(d):(_=Y.cachePool,_!==null?(ee=kn._currentValue,_=_.parent!==ee?{parent:ee,pool:ee}:_):_=P1(),Y={baseLanes:Y.baseLanes|d,cachePool:_}),g.memoizedState=Y,g.childLanes=Qp(i,z,d),r.memoizedState=Xp,Uc(i.child,g)):(Js(r),d=i.child,i=d.sibling,d=cs(d,{mode:"visible",children:g.children}),d.return=r,d.sibling=null,i!==null&&(z=r.deletions,z===null?(r.deletions=[i],r.flags|=16):z.push(i)),r.child=d,r.memoizedState=null,d)}function Zp(i,r){return r=qd({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function qd(i,r){return i=Oa(22,i,null,r),i.lanes=0,i}function Jp(i,r,d){return lo(r,i.child,null,d),i=Zp(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function tx(i,r,d){i.lanes|=r;var g=i.alternate;g!==null&&(g.lanes|=r),hp(i.return,r,d)}function Wp(i,r,d,g,_,S){var z=i.memoizedState;z===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:_,treeForkCount:S}:(z.isBackwards=r,z.rendering=null,z.renderingStartTime=0,z.last=g,z.tail=d,z.tailMode=_,z.treeForkCount=S)}function nx(i,r,d){var g=r.pendingProps,_=g.revealOrder,S=g.tail;g=g.children;var z=xn.current,Y=(z&2)!==0;if(Y?(z=z&1|2,r.flags|=128):z&=1,B(xn,z),Xn(i,r,g,d),g=Mt?kc:0,!Y&&i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&tx(i,d,r);else if(i.tag===19)tx(i,d,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(_){case"forwards":for(d=r.child,_=null;d!==null;)i=d.alternate,i!==null&&Ad(i)===null&&(_=d),d=d.sibling;d=_,d===null?(_=r.child,r.child=null):(_=d.sibling,d.sibling=null),Wp(r,!1,_,d,S,g);break;case"backwards":case"unstable_legacy-backwards":for(d=null,_=r.child,r.child=null;_!==null;){if(i=_.alternate,i!==null&&Ad(i)===null){r.child=_;break}i=_.sibling,_.sibling=d,d=_,_=i}Wp(r,!0,d,null,S,g);break;case"together":Wp(r,!1,null,null,void 0,g);break;default:r.memoizedState=null}return r.child}function ms(i,r,d){if(i!==null&&(r.dependencies=i.dependencies),nr|=r.lanes,(d&r.childLanes)===0)if(i!==null){if(rl(i,r,d,!1),(d&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(a(153));if(r.child!==null){for(i=r.child,d=cs(i,i.pendingProps),r.child=d,d.return=r;i.sibling!==null;)i=i.sibling,d=d.sibling=cs(i,i.pendingProps),d.return=r;d.sibling=null}return r.child}function em(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&Cd(i)))}function jk(i,r,d){switch(r.tag){case 3:be(r,r.stateNode.containerInfo),Xs(r,kn,i.memoizedState.cache),no();break;case 27:case 5:De(r);break;case 4:be(r,r.stateNode.containerInfo);break;case 10:Xs(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Np(r),null;break;case 13:var g=r.memoizedState;if(g!==null)return g.dehydrated!==null?(Js(r),r.flags|=128,null):(d&r.child.childLanes)!==0?ex(i,r,d):(Js(r),i=ms(i,r,d),i!==null?i.sibling:null);Js(r);break;case 19:var _=(i.flags&128)!==0;if(g=(d&r.childLanes)!==0,g||(rl(i,r,d,!1),g=(d&r.childLanes)!==0),_){if(g)return nx(i,r,d);r.flags|=128}if(_=r.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),B(xn,xn.current),g)break;return null;case 22:return r.lanes=0,X0(i,r,d,r.pendingProps);case 24:Xs(r,kn,i.memoizedState.cache)}return ms(i,r,d)}function ax(i,r,d){if(i!==null)if(i.memoizedProps!==r.pendingProps)jn=!0;else{if(!em(i,d)&&(r.flags&128)===0)return jn=!1,jk(i,r,d);jn=(i.flags&131072)!==0}else jn=!1,Mt&&(r.flags&1048576)!==0&&O1(r,kc,r.index);switch(r.lanes=0,r.tag){case 16:e:{var g=r.pendingProps;if(i=ro(r.elementType),r.type=i,typeof i=="function")sp(i)?(g=uo(i,g),r.tag=1,r=J0(null,r,i,g,d)):(r.tag=0,r=Yp(null,r,i,g,d));else{if(i!=null){var _=i.$$typeof;if(_===M){r.tag=11,r=V0(null,r,i,g,d);break e}else if(_===A){r.tag=14,r=G0(null,r,i,g,d);break e}}throw r=U(i)||i,Error(a(306,r,""))}}return r;case 0:return Yp(i,r,r.type,r.pendingProps,d);case 1:return g=r.type,_=uo(g,r.pendingProps),J0(i,r,g,_,d);case 3:e:{if(be(r,r.stateNode.containerInfo),i===null)throw Error(a(387));g=r.pendingProps;var S=r.memoizedState;_=S.element,bp(i,r),Lc(r,g,null,d);var z=r.memoizedState;if(g=z.cache,Xs(r,kn,g),g!==S.cache&&pp(r,[kn],d,!0),Dc(),g=z.element,S.isDehydrated)if(S={element:g,isDehydrated:!1,cache:z.cache},r.updateQueue.baseState=S,r.memoizedState=S,r.flags&256){r=W0(i,r,g,d);break e}else if(g!==_){_=ai(Error(a(424)),r),Mc(_),r=W0(i,r,g,d);break e}else{switch(i=r.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(Wt=li(i.firstChild),Gn=r,Mt=!0,Gs=null,ri=!0,d=X1(r,null,g,d),r.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(no(),g===_){r=ms(i,r,d);break e}Xn(i,r,g,d)}r=r.child}return r;case 26:return Hd(i,r),i===null?(d=pb(r.type,null,r.pendingProps,null))?r.memoizedState=d:Mt||(d=r.type,i=r.pendingProps,g=of(J.current).createElement(d),g[ce]=r,g[Ue]=i,Kn(g,d,i),Cn(g),r.stateNode=g):r.memoizedState=pb(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return De(r),i===null&&Mt&&(g=r.stateNode=db(r.type,r.pendingProps,J.current),Gn=r,ri=!0,_=Wt,or(r.type)?(Dm=_,Wt=li(g.firstChild)):Wt=_),Xn(i,r,r.pendingProps.children,d),Hd(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&Mt&&((_=g=Wt)&&(g=iM(g,r.type,r.pendingProps,ri),g!==null?(r.stateNode=g,Gn=r,Wt=li(g.firstChild),ri=!1,_=!0):_=!1),_||Ys(r)),De(r),_=r.type,S=r.pendingProps,z=i!==null?i.memoizedProps:null,g=S.children,jm(_,S)?g=null:z!==null&&jm(_,z)&&(r.flags|=32),r.memoizedState!==null&&(_=Mp(i,r,xk,null,null,d),eu._currentValue=_),Hd(i,r),Xn(i,r,g,d),r.child;case 6:return i===null&&Mt&&((i=d=Wt)&&(d=sM(d,r.pendingProps,ri),d!==null?(r.stateNode=d,Gn=r,Wt=null,i=!0):i=!1),i||Ys(r)),null;case 13:return ex(i,r,d);case 4:return be(r,r.stateNode.containerInfo),g=r.pendingProps,i===null?r.child=lo(r,null,g,d):Xn(i,r,g,d),r.child;case 11:return V0(i,r,r.type,r.pendingProps,d);case 7:return Xn(i,r,r.pendingProps,d),r.child;case 8:return Xn(i,r,r.pendingProps.children,d),r.child;case 12:return Xn(i,r,r.pendingProps.children,d),r.child;case 10:return g=r.pendingProps,Xs(r,r.type,g.value),Xn(i,r,g.children,d),r.child;case 9:return _=r.type._context,g=r.pendingProps.children,io(r),_=Yn(_),g=g(_),r.flags|=1,Xn(i,r,g,d),r.child;case 14:return G0(i,r,r.type,r.pendingProps,d);case 15:return Y0(i,r,r.type,r.pendingProps,d);case 19:return nx(i,r,d);case 31:return Mk(i,r,d);case 22:return X0(i,r,d,r.pendingProps);case 24:return io(r),g=Yn(kn),i===null?(_=yp(),_===null&&(_=Gt,S=mp(),_.pooledCache=S,S.refCount++,S!==null&&(_.pooledCacheLanes|=d),_=S),r.memoizedState={parent:g,cache:_},xp(r),Xs(r,kn,_)):((i.lanes&d)!==0&&(bp(i,r),Lc(r,null,null,d),Dc()),_=i.memoizedState,S=r.memoizedState,_.parent!==g?(_={parent:g,cache:g},r.memoizedState=_,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=_),Xs(r,kn,g)):(g=S.cache,Xs(r,kn,g),g!==_.cache&&pp(r,[kn],d,!0))),Xn(i,r,r.pendingProps.children,d),r.child;case 29:throw r.pendingProps}throw Error(a(156,r.tag))}function gs(i){i.flags|=4}function tm(i,r,d,g,_){if((r=(i.mode&32)!==0)&&(r=!1),r){if(i.flags|=16777216,(_&335544128)===_)if(i.stateNode.complete)i.flags|=8192;else if(Rx())i.flags|=8192;else throw oo=jd,vp}else i.flags&=-16777217}function ix(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!xb(r))if(Rx())i.flags|=8192;else throw oo=jd,vp}function Vd(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?ia():536870912,i.lanes|=r,vl|=r)}function Fc(i,r){if(!Mt)switch(i.tailMode){case"hidden":r=i.tail;for(var d=null;r!==null;)r.alternate!==null&&(d=r),r=r.sibling;d===null?i.tail=null:d.sibling=null;break;case"collapsed":d=i.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:g.sibling=null}}function en(i){var r=i.alternate!==null&&i.alternate.child===i.child,d=0,g=0;if(r)for(var _=i.child;_!==null;)d|=_.lanes|_.childLanes,g|=_.subtreeFlags&65011712,g|=_.flags&65011712,_.return=i,_=_.sibling;else for(_=i.child;_!==null;)d|=_.lanes|_.childLanes,g|=_.subtreeFlags,g|=_.flags,_.return=i,_=_.sibling;return i.subtreeFlags|=g,i.childLanes=d,r}function Ek(i,r,d){var g=r.pendingProps;switch(cp(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return en(r),null;case 1:return en(r),null;case 3:return d=r.stateNode,g=null,i!==null&&(g=i.memoizedState.cache),r.memoizedState.cache!==g&&(r.flags|=2048),fs(kn),je(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(i===null||i.child===null)&&(sl(r)?gs(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,dp())),en(r),null;case 26:var _=r.type,S=r.memoizedState;return i===null?(gs(r),S!==null?(en(r),ix(r,S)):(en(r),tm(r,_,null,g,d))):S?S!==i.memoizedState?(gs(r),en(r),ix(r,S)):(en(r),r.flags&=-16777217):(i=i.memoizedProps,i!==g&&gs(r),en(r),tm(r,_,i,g,d)),null;case 27:if(Ae(r),d=J.current,_=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==g&&gs(r);else{if(!g){if(r.stateNode===null)throw Error(a(166));return en(r),null}i=W.current,sl(r)?z1(r):(i=db(_,g,d),r.stateNode=i,gs(r))}return en(r),null;case 5:if(Ae(r),_=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==g&&gs(r);else{if(!g){if(r.stateNode===null)throw Error(a(166));return en(r),null}if(S=W.current,sl(r))z1(r);else{var z=of(J.current);switch(S){case 1:S=z.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:S=z.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":S=z.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":S=z.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":S=z.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof g.is=="string"?z.createElement("select",{is:g.is}):z.createElement("select"),g.multiple?S.multiple=!0:g.size&&(S.size=g.size);break;default:S=typeof g.is=="string"?z.createElement(_,{is:g.is}):z.createElement(_)}}S[ce]=r,S[Ue]=g;e:for(z=r.child;z!==null;){if(z.tag===5||z.tag===6)S.appendChild(z.stateNode);else if(z.tag!==4&&z.tag!==27&&z.child!==null){z.child.return=z,z=z.child;continue}if(z===r)break e;for(;z.sibling===null;){if(z.return===null||z.return===r)break e;z=z.return}z.sibling.return=z.return,z=z.sibling}r.stateNode=S;e:switch(Kn(S,_,g),_){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&gs(r)}}return en(r),tm(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,d),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==g&&gs(r);else{if(typeof g!="string"&&r.stateNode===null)throw Error(a(166));if(i=J.current,sl(r)){if(i=r.stateNode,d=r.memoizedProps,g=null,_=Gn,_!==null)switch(_.tag){case 27:case 5:g=_.memoizedProps}i[ce]=r,i=!!(i.nodeValue===d||g!==null&&g.suppressHydrationWarning===!0||eb(i.nodeValue,d)),i||Ys(r,!0)}else i=of(i).createTextNode(g),i[ce]=r,r.stateNode=i}return en(r),null;case 31:if(d=r.memoizedState,i===null||i.memoizedState!==null){if(g=sl(r),d!==null){if(i===null){if(!g)throw Error(a(318));if(i=r.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(557));i[ce]=r}else no(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;en(r),i=!1}else d=dp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),i=!0;if(!i)return r.flags&256?(za(r),r):(za(r),null);if((r.flags&128)!==0)throw Error(a(558))}return en(r),null;case 13:if(g=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(_=sl(r),g!==null&&g.dehydrated!==null){if(i===null){if(!_)throw Error(a(318));if(_=r.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(a(317));_[ce]=r}else no(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;en(r),_=!1}else _=dp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=_),_=!0;if(!_)return r.flags&256?(za(r),r):(za(r),null)}return za(r),(r.flags&128)!==0?(r.lanes=d,r):(d=g!==null,i=i!==null&&i.memoizedState!==null,d&&(g=r.child,_=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(_=g.alternate.memoizedState.cachePool.pool),S=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(S=g.memoizedState.cachePool.pool),S!==_&&(g.flags|=2048)),d!==i&&d&&(r.child.flags|=8192),Vd(r,r.updateQueue),en(r),null);case 4:return je(),i===null&&Sm(r.stateNode.containerInfo),en(r),null;case 10:return fs(r.type),en(r),null;case 19:if(fe(xn),g=r.memoizedState,g===null)return en(r),null;if(_=(r.flags&128)!==0,S=g.rendering,S===null)if(_)Fc(g,!1);else{if(hn!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(S=Ad(i),S!==null){for(r.flags|=128,Fc(g,!1),i=S.updateQueue,r.updateQueue=i,Vd(r,i),r.subtreeFlags=0,i=d,d=r.child;d!==null;)A1(d,i),d=d.sibling;return B(xn,xn.current&1|2),Mt&&us(r,g.treeForkCount),r.child}i=i.sibling}g.tail!==null&&Ke()>Qd&&(r.flags|=128,_=!0,Fc(g,!1),r.lanes=4194304)}else{if(!_)if(i=Ad(S),i!==null){if(r.flags|=128,_=!0,i=i.updateQueue,r.updateQueue=i,Vd(r,i),Fc(g,!0),g.tail===null&&g.tailMode==="hidden"&&!S.alternate&&!Mt)return en(r),null}else 2*Ke()-g.renderingStartTime>Qd&&d!==536870912&&(r.flags|=128,_=!0,Fc(g,!1),r.lanes=4194304);g.isBackwards?(S.sibling=r.child,r.child=S):(i=g.last,i!==null?i.sibling=S:r.child=S,g.last=S)}return g.tail!==null?(i=g.tail,g.rendering=i,g.tail=i.sibling,g.renderingStartTime=Ke(),i.sibling=null,d=xn.current,B(xn,_?d&1|2:d&1),Mt&&us(r,g.treeForkCount),i):(en(r),null);case 22:case 23:return za(r),Cp(),g=r.memoizedState!==null,i!==null?i.memoizedState!==null!==g&&(r.flags|=8192):g&&(r.flags|=8192),g?(d&536870912)!==0&&(r.flags&128)===0&&(en(r),r.subtreeFlags&6&&(r.flags|=8192)):en(r),d=r.updateQueue,d!==null&&Vd(r,d.retryQueue),d=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),g=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(g=r.memoizedState.cachePool.pool),g!==d&&(r.flags|=2048),i!==null&&fe(so),null;case 24:return d=null,i!==null&&(d=i.memoizedState.cache),r.memoizedState.cache!==d&&(r.flags|=2048),fs(kn),en(r),null;case 25:return null;case 30:return null}throw Error(a(156,r.tag))}function Rk(i,r){switch(cp(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return fs(kn),je(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return Ae(r),null;case 31:if(r.memoizedState!==null){if(za(r),r.alternate===null)throw Error(a(340));no()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(za(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(a(340));no()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return fe(xn),null;case 4:return je(),null;case 10:return fs(r.type),null;case 22:case 23:return za(r),Cp(),i!==null&&fe(so),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return fs(kn),null;case 25:return null;default:return null}}function sx(i,r){switch(cp(r),r.tag){case 3:fs(kn),je();break;case 26:case 27:case 5:Ae(r);break;case 4:je();break;case 31:r.memoizedState!==null&&za(r);break;case 13:za(r);break;case 19:fe(xn);break;case 10:fs(r.type);break;case 22:case 23:za(r),Cp(),i!==null&&fe(so);break;case 24:fs(kn)}}function $c(i,r){try{var d=r.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var _=g.next;d=_;do{if((d.tag&i)===i){g=void 0;var S=d.create,z=d.inst;g=S(),z.destroy=g}d=d.next}while(d!==_)}}catch(Y){Ft(r,r.return,Y)}}function er(i,r,d){try{var g=r.updateQueue,_=g!==null?g.lastEffect:null;if(_!==null){var S=_.next;g=S;do{if((g.tag&i)===i){var z=g.inst,Y=z.destroy;if(Y!==void 0){z.destroy=void 0,_=r;var ee=d,pe=Y;try{pe()}catch(Ce){Ft(_,ee,Ce)}}}g=g.next}while(g!==S)}}catch(Ce){Ft(r,r.return,Ce)}}function rx(i){var r=i.updateQueue;if(r!==null){var d=i.stateNode;try{Q1(r,d)}catch(g){Ft(i,i.return,g)}}}function ox(i,r,d){d.props=uo(i.type,i.memoizedProps),d.state=i.memoizedState;try{d.componentWillUnmount()}catch(g){Ft(i,r,g)}}function Pc(i,r){try{var d=i.ref;if(d!==null){switch(i.tag){case 26:case 27:case 5:var g=i.stateNode;break;case 30:g=i.stateNode;break;default:g=i.stateNode}typeof d=="function"?i.refCleanup=d(g):d.current=g}}catch(_){Ft(i,r,_)}}function Vi(i,r){var d=i.ref,g=i.refCleanup;if(d!==null)if(typeof g=="function")try{g()}catch(_){Ft(i,r,_)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(_){Ft(i,r,_)}else d.current=null}function lx(i){var r=i.type,d=i.memoizedProps,g=i.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":d.autoFocus&&g.focus();break e;case"img":d.src?g.src=d.src:d.srcSet&&(g.srcset=d.srcSet)}}catch(_){Ft(i,i.return,_)}}function nm(i,r,d){try{var g=i.stateNode;Jk(g,i.type,d,r),g[Ue]=r}catch(_){Ft(i,i.return,_)}}function cx(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&or(i.type)||i.tag===4}function am(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||cx(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&or(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function im(i,r,d){var g=i.tag;if(g===5||g===6)i=i.stateNode,r?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(i,r):(r=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,r.appendChild(i),d=d._reactRootContainer,d!=null||r.onclick!==null||(r.onclick=Bt));else if(g!==4&&(g===27&&or(i.type)&&(d=i.stateNode,r=null),i=i.child,i!==null))for(im(i,r,d),i=i.sibling;i!==null;)im(i,r,d),i=i.sibling}function Gd(i,r,d){var g=i.tag;if(g===5||g===6)i=i.stateNode,r?d.insertBefore(i,r):d.appendChild(i);else if(g!==4&&(g===27&&or(i.type)&&(d=i.stateNode),i=i.child,i!==null))for(Gd(i,r,d),i=i.sibling;i!==null;)Gd(i,r,d),i=i.sibling}function ux(i){var r=i.stateNode,d=i.memoizedProps;try{for(var g=i.type,_=r.attributes;_.length;)r.removeAttributeNode(_[0]);Kn(r,g,d),r[ce]=i,r[Ue]=d}catch(S){Ft(i,i.return,S)}}var ys=!1,En=!1,sm=!1,dx=typeof WeakSet=="function"?WeakSet:Set,Un=null;function Tk(i,r){if(i=i.containerInfo,km=pf,i=S1(i),Jh(i)){if("selectionStart"in i)var d={start:i.selectionStart,end:i.selectionEnd};else e:{d=(d=i.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var _=g.anchorOffset,S=g.focusNode;g=g.focusOffset;try{d.nodeType,S.nodeType}catch(lt){d=null;break e}var z=0,Y=-1,ee=-1,pe=0,Ce=0,Ee=i,ge=null;t:for(;;){for(var _e;Ee!==d||_!==0&&Ee.nodeType!==3||(Y=z+_),Ee!==S||g!==0&&Ee.nodeType!==3||(ee=z+g),Ee.nodeType===3&&(z+=Ee.nodeValue.length),(_e=Ee.firstChild)!==null;)ge=Ee,Ee=_e;for(;;){if(Ee===i)break t;if(ge===d&&++pe===_&&(Y=z),ge===S&&++Ce===g&&(ee=z),(_e=Ee.nextSibling)!==null)break;Ee=ge,ge=Ee.parentNode}Ee=_e}d=Y===-1||ee===-1?null:{start:Y,end:ee}}else d=null}d=d||{start:0,end:0}}else d=null;for(Mm={focusedElem:i,selectionRange:d},pf=!1,Un=r;Un!==null;)if(r=Un,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,Un=i;else for(;Un!==null;){switch(r=Un,S=r.alternate,i=r.flags,r.tag){case 0:if((i&4)!==0&&(i=r.updateQueue,i=i!==null?i.events:null,i!==null))for(d=0;d<i.length;d++)_=i[d],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&S!==null){i=void 0,d=r,_=S.memoizedProps,S=S.memoizedState,g=d.stateNode;try{var Qe=uo(d.type,_);i=g.getSnapshotBeforeUpdate(Qe,S),g.__reactInternalSnapshotBeforeUpdate=i}catch(lt){Ft(d,d.return,lt)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,d=i.nodeType,d===9)Rm(i);else if(d===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Rm(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(a(163))}if(i=r.sibling,i!==null){i.return=r.return,Un=i;break}Un=r.return}}function fx(i,r,d){var g=d.flags;switch(d.tag){case 0:case 11:case 15:xs(i,d),g&4&&$c(5,d);break;case 1:if(xs(i,d),g&4)if(i=d.stateNode,r===null)try{i.componentDidMount()}catch(z){Ft(d,d.return,z)}else{var _=uo(d.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(_,r,i.__reactInternalSnapshotBeforeUpdate)}catch(z){Ft(d,d.return,z)}}g&64&&rx(d),g&512&&Pc(d,d.return);break;case 3:if(xs(i,d),g&64&&(i=d.updateQueue,i!==null)){if(r=null,d.child!==null)switch(d.child.tag){case 27:case 5:r=d.child.stateNode;break;case 1:r=d.child.stateNode}try{Q1(i,r)}catch(z){Ft(d,d.return,z)}}break;case 27:r===null&&g&4&&ux(d);case 26:case 5:xs(i,d),r===null&&g&4&&lx(d),g&512&&Pc(d,d.return);break;case 12:xs(i,d);break;case 31:xs(i,d),g&4&&mx(i,d);break;case 13:xs(i,d),g&4&&gx(i,d),g&64&&(i=d.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(d=Fk.bind(null,d),rM(i,d))));break;case 22:if(g=d.memoizedState!==null||ys,!g){r=r!==null&&r.memoizedState!==null||En,_=ys;var S=En;ys=g,(En=r)&&!S?bs(i,d,(d.subtreeFlags&8772)!==0):xs(i,d),ys=_,En=S}break;case 30:break;default:xs(i,d)}}function hx(i){var r=i.alternate;r!==null&&(i.alternate=null,hx(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&Ta(r)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var sn=null,ma=!1;function vs(i,r,d){for(d=d.child;d!==null;)px(i,r,d),d=d.sibling}function px(i,r,d){if(qe&&typeof qe.onCommitFiberUnmount=="function")try{qe.onCommitFiberUnmount(Et,d)}catch(S){}switch(d.tag){case 26:En||Vi(d,r),vs(i,r,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:En||Vi(d,r);var g=sn,_=ma;or(d.type)&&(sn=d.stateNode,ma=!1),vs(i,r,d),Zc(d.stateNode),sn=g,ma=_;break;case 5:En||Vi(d,r);case 6:if(g=sn,_=ma,sn=null,vs(i,r,d),sn=g,ma=_,sn!==null)if(ma)try{(sn.nodeType===9?sn.body:sn.nodeName==="HTML"?sn.ownerDocument.body:sn).removeChild(d.stateNode)}catch(S){Ft(d,r,S)}else try{sn.removeChild(d.stateNode)}catch(S){Ft(d,r,S)}break;case 18:sn!==null&&(ma?(i=sn,rb(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,d.stateNode),kl(i)):rb(sn,d.stateNode));break;case 4:g=sn,_=ma,sn=d.stateNode.containerInfo,ma=!0,vs(i,r,d),sn=g,ma=_;break;case 0:case 11:case 14:case 15:er(2,d,r),En||er(4,d,r),vs(i,r,d);break;case 1:En||(Vi(d,r),g=d.stateNode,typeof g.componentWillUnmount=="function"&&ox(d,r,g)),vs(i,r,d);break;case 21:vs(i,r,d);break;case 22:En=(g=En)||d.memoizedState!==null,vs(i,r,d),En=g;break;default:vs(i,r,d)}}function mx(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{kl(i)}catch(d){Ft(r,r.return,d)}}}function gx(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{kl(i)}catch(d){Ft(r,r.return,d)}}function Ak(i){switch(i.tag){case 31:case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new dx),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new dx),r;default:throw Error(a(435,i.tag))}}function Yd(i,r){var d=Ak(i);r.forEach(function(g){if(!d.has(g)){d.add(g);var _=$k.bind(null,i,g);g.then(_,_)}})}function ga(i,r){var d=r.deletions;if(d!==null)for(var g=0;g<d.length;g++){var _=d[g],S=i,z=r,Y=z;e:for(;Y!==null;){switch(Y.tag){case 27:if(or(Y.type)){sn=Y.stateNode,ma=!1;break e}break;case 5:sn=Y.stateNode,ma=!1;break e;case 3:case 4:sn=Y.stateNode.containerInfo,ma=!0;break e}Y=Y.return}if(sn===null)throw Error(a(160));px(S,z,_),sn=null,ma=!1,S=_.alternate,S!==null&&(S.return=null),_.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)yx(r,i),r=r.sibling}var ji=null;function yx(i,r){var d=i.alternate,g=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:ga(r,i),ya(i),g&4&&(er(3,i,i.return),$c(3,i),er(5,i,i.return));break;case 1:ga(r,i),ya(i),g&512&&(En||d===null||Vi(d,d.return)),g&64&&ys&&(i=i.updateQueue,i!==null&&(g=i.callbacks,g!==null&&(d=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=d===null?g:d.concat(g))));break;case 26:var _=ji;if(ga(r,i),ya(i),g&512&&(En||d===null||Vi(d,d.return)),g&4){var S=d!==null?d.memoizedState:null;if(g=i.memoizedState,d===null)if(g===null)if(i.stateNode===null){e:{g=i.type,d=i.memoizedProps,_=_.ownerDocument||_;t:switch(g){case"title":S=_.getElementsByTagName("title")[0],(!S||S[Sn]||S[ce]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=_.createElement(g),_.head.insertBefore(S,_.querySelector("head > title"))),Kn(S,g,d),S[ce]=i,Cn(S),g=S;break e;case"link":var z=yb("link","href",_).get(g+(d.href||""));if(z){for(var Y=0;Y<z.length;Y++)if(S=z[Y],S.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&S.getAttribute("rel")===(d.rel==null?null:d.rel)&&S.getAttribute("title")===(d.title==null?null:d.title)&&S.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){z.splice(Y,1);break t}}S=_.createElement(g),Kn(S,g,d),_.head.appendChild(S);break;case"meta":if(z=yb("meta","content",_).get(g+(d.content||""))){for(Y=0;Y<z.length;Y++)if(S=z[Y],S.getAttribute("content")===(d.content==null?null:""+d.content)&&S.getAttribute("name")===(d.name==null?null:d.name)&&S.getAttribute("property")===(d.property==null?null:d.property)&&S.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&S.getAttribute("charset")===(d.charSet==null?null:d.charSet)){z.splice(Y,1);break t}}S=_.createElement(g),Kn(S,g,d),_.head.appendChild(S);break;default:throw Error(a(468,g))}S[ce]=i,Cn(S),g=S}i.stateNode=g}else vb(_,i.type,i.stateNode);else i.stateNode=gb(_,g,i.memoizedProps);else S!==g?(S===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):S.count--,g===null?vb(_,i.type,i.stateNode):gb(_,g,i.memoizedProps)):g===null&&i.stateNode!==null&&nm(i,i.memoizedProps,d.memoizedProps)}break;case 27:ga(r,i),ya(i),g&512&&(En||d===null||Vi(d,d.return)),d!==null&&g&4&&nm(i,i.memoizedProps,d.memoizedProps);break;case 5:if(ga(r,i),ya(i),g&512&&(En||d===null||Vi(d,d.return)),i.flags&32){_=i.stateNode;try{Da(_,"")}catch(Qe){Ft(i,i.return,Qe)}}g&4&&i.stateNode!=null&&(_=i.memoizedProps,nm(i,_,d!==null?d.memoizedProps:_)),g&1024&&(sm=!0);break;case 6:if(ga(r,i),ya(i),g&4){if(i.stateNode===null)throw Error(a(162));g=i.memoizedProps,d=i.stateNode;try{d.nodeValue=g}catch(Qe){Ft(i,i.return,Qe)}}break;case 3:if(uf=null,_=ji,ji=lf(r.containerInfo),ga(r,i),ji=_,ya(i),g&4&&d!==null&&d.memoizedState.isDehydrated)try{kl(r.containerInfo)}catch(Qe){Ft(i,i.return,Qe)}sm&&(sm=!1,vx(i));break;case 4:g=ji,ji=lf(i.stateNode.containerInfo),ga(r,i),ya(i),ji=g;break;case 12:ga(r,i),ya(i);break;case 31:ga(r,i),ya(i),g&4&&(g=i.updateQueue,g!==null&&(i.updateQueue=null,Yd(i,g)));break;case 13:ga(r,i),ya(i),i.child.flags&8192&&i.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(Kd=Ke()),g&4&&(g=i.updateQueue,g!==null&&(i.updateQueue=null,Yd(i,g)));break;case 22:_=i.memoizedState!==null;var ee=d!==null&&d.memoizedState!==null,pe=ys,Ce=En;if(ys=pe||_,En=Ce||ee,ga(r,i),En=Ce,ys=pe,ya(i),g&8192)e:for(r=i.stateNode,r._visibility=_?r._visibility&-2:r._visibility|1,_&&(d===null||ee||ys||En||fo(i)),d=null,r=i;;){if(r.tag===5||r.tag===26){if(d===null){ee=d=r;try{if(S=ee.stateNode,_)z=S.style,typeof z.setProperty=="function"?z.setProperty("display","none","important"):z.display="none";else{Y=ee.stateNode;var Ee=ee.memoizedProps.style,ge=Ee!=null&&Ee.hasOwnProperty("display")?Ee.display:null;Y.style.display=ge==null||typeof ge=="boolean"?"":(""+ge).trim()}}catch(Qe){Ft(ee,ee.return,Qe)}}}else if(r.tag===6){if(d===null){ee=r;try{ee.stateNode.nodeValue=_?"":ee.memoizedProps}catch(Qe){Ft(ee,ee.return,Qe)}}}else if(r.tag===18){if(d===null){ee=r;try{var _e=ee.stateNode;_?ob(_e,!0):ob(ee.stateNode,!1)}catch(Qe){Ft(ee,ee.return,Qe)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;d===r&&(d=null),r=r.return}d===r&&(d=null),r.sibling.return=r.return,r=r.sibling}g&4&&(g=i.updateQueue,g!==null&&(d=g.retryQueue,d!==null&&(g.retryQueue=null,Yd(i,d))));break;case 19:ga(r,i),ya(i),g&4&&(g=i.updateQueue,g!==null&&(i.updateQueue=null,Yd(i,g)));break;case 30:break;case 21:break;default:ga(r,i),ya(i)}}function ya(i){var r=i.flags;if(r&2){try{for(var d,g=i.return;g!==null;){if(cx(g)){d=g;break}g=g.return}if(d==null)throw Error(a(160));switch(d.tag){case 27:var _=d.stateNode,S=am(i);Gd(i,S,_);break;case 5:var z=d.stateNode;d.flags&32&&(Da(z,""),d.flags&=-33);var Y=am(i);Gd(i,Y,z);break;case 3:case 4:var ee=d.stateNode.containerInfo,pe=am(i);im(i,pe,ee);break;default:throw Error(a(161))}}catch(Ce){Ft(i,i.return,Ce)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function vx(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;vx(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function xs(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)fx(i,r.alternate,r),r=r.sibling}function fo(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:er(4,r,r.return),fo(r);break;case 1:Vi(r,r.return);var d=r.stateNode;typeof d.componentWillUnmount=="function"&&ox(r,r.return,d),fo(r);break;case 27:Zc(r.stateNode);case 26:case 5:Vi(r,r.return),fo(r);break;case 22:r.memoizedState===null&&fo(r);break;case 30:fo(r);break;default:fo(r)}i=i.sibling}}function bs(i,r,d){for(d=d&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var g=r.alternate,_=i,S=r,z=S.flags;switch(S.tag){case 0:case 11:case 15:bs(_,S,d),$c(4,S);break;case 1:if(bs(_,S,d),g=S,_=g.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(pe){Ft(g,g.return,pe)}if(g=S,_=g.updateQueue,_!==null){var Y=g.stateNode;try{var ee=_.shared.hiddenCallbacks;if(ee!==null)for(_.shared.hiddenCallbacks=null,_=0;_<ee.length;_++)K1(ee[_],Y)}catch(pe){Ft(g,g.return,pe)}}d&&z&64&&rx(S),Pc(S,S.return);break;case 27:ux(S);case 26:case 5:bs(_,S,d),d&&g===null&&z&4&&lx(S),Pc(S,S.return);break;case 12:bs(_,S,d);break;case 31:bs(_,S,d),d&&z&4&&mx(_,S);break;case 13:bs(_,S,d),d&&z&4&&gx(_,S);break;case 22:S.memoizedState===null&&bs(_,S,d),Pc(S,S.return);break;case 30:break;default:bs(_,S,d)}r=r.sibling}}function rm(i,r){var d=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==d&&(i!=null&&i.refCount++,d!=null&&jc(d))}function om(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&jc(i))}function Ei(i,r,d,g){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)xx(i,r,d,g),r=r.sibling}function xx(i,r,d,g){var _=r.flags;switch(r.tag){case 0:case 11:case 15:Ei(i,r,d,g),_&2048&&$c(9,r);break;case 1:Ei(i,r,d,g);break;case 3:Ei(i,r,d,g),_&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&jc(i)));break;case 12:if(_&2048){Ei(i,r,d,g),i=r.stateNode;try{var S=r.memoizedProps,z=S.id,Y=S.onPostCommit;typeof Y=="function"&&Y(z,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(ee){Ft(r,r.return,ee)}}else Ei(i,r,d,g);break;case 31:Ei(i,r,d,g);break;case 13:Ei(i,r,d,g);break;case 23:break;case 22:S=r.stateNode,z=r.alternate,r.memoizedState!==null?S._visibility&2?Ei(i,r,d,g):Hc(i,r):S._visibility&2?Ei(i,r,d,g):(S._visibility|=2,ml(i,r,d,g,(r.subtreeFlags&10256)!==0||!1)),_&2048&&rm(z,r);break;case 24:Ei(i,r,d,g),_&2048&&om(r.alternate,r);break;default:Ei(i,r,d,g)}}function ml(i,r,d,g,_){for(_=_&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var S=i,z=r,Y=d,ee=g,pe=z.flags;switch(z.tag){case 0:case 11:case 15:ml(S,z,Y,ee,_),$c(8,z);break;case 23:break;case 22:var Ce=z.stateNode;z.memoizedState!==null?Ce._visibility&2?ml(S,z,Y,ee,_):Hc(S,z):(Ce._visibility|=2,ml(S,z,Y,ee,_)),_&&pe&2048&&rm(z.alternate,z);break;case 24:ml(S,z,Y,ee,_),_&&pe&2048&&om(z.alternate,z);break;default:ml(S,z,Y,ee,_)}r=r.sibling}}function Hc(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var d=i,g=r,_=g.flags;switch(g.tag){case 22:Hc(d,g),_&2048&&rm(g.alternate,g);break;case 24:Hc(d,g),_&2048&&om(g.alternate,g);break;default:Hc(d,g)}r=r.sibling}}var qc=8192;function gl(i,r,d){if(i.subtreeFlags&qc)for(i=i.child;i!==null;)bx(i,r,d),i=i.sibling}function bx(i,r,d){switch(i.tag){case 26:gl(i,r,d),i.flags&qc&&i.memoizedState!==null&&vM(d,ji,i.memoizedState,i.memoizedProps);break;case 5:gl(i,r,d);break;case 3:case 4:var g=ji;ji=lf(i.stateNode.containerInfo),gl(i,r,d),ji=g;break;case 22:i.memoizedState===null&&(g=i.alternate,g!==null&&g.memoizedState!==null?(g=qc,qc=16777216,gl(i,r,d),qc=g):gl(i,r,d));break;default:gl(i,r,d)}}function _x(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function Vc(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var d=0;d<r.length;d++){var g=r[d];Un=g,Sx(g,i)}_x(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)wx(i),i=i.sibling}function wx(i){switch(i.tag){case 0:case 11:case 15:Vc(i),i.flags&2048&&er(9,i,i.return);break;case 3:Vc(i);break;case 12:Vc(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,Xd(i)):Vc(i);break;default:Vc(i)}}function Xd(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var d=0;d<r.length;d++){var g=r[d];Un=g,Sx(g,i)}_x(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:er(8,r,r.return),Xd(r);break;case 22:d=r.stateNode,d._visibility&2&&(d._visibility&=-3,Xd(r));break;default:Xd(r)}i=i.sibling}}function Sx(i,r){for(;Un!==null;){var d=Un;switch(d.tag){case 0:case 11:case 15:er(8,d,r);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var g=d.memoizedState.cachePool.pool;g!=null&&g.refCount++}break;case 24:jc(d.memoizedState.cache)}if(g=d.child,g!==null)g.return=d,Un=g;else e:for(d=i;Un!==null;){g=Un;var _=g.sibling,S=g.return;if(hx(g),g===d){Un=null;break e}if(_!==null){_.return=S,Un=_;break e}Un=S}}}var Dk={getCacheForType:function(i){var r=Yn(kn),d=r.data.get(i);return d===void 0&&(d=i(),r.data.set(i,d)),d},cacheSignal:function(){return Yn(kn).controller.signal}},Lk=typeof WeakMap=="function"?WeakMap:Map,Dt=0,Gt=null,wt=null,Nt=0,Ut=0,Ba=null,tr=!1,yl=!1,lm=!1,_s=0,hn=0,nr=0,ho=0,cm=0,Ua=0,vl=0,Gc=null,va=null,um=!1,Kd=0,Cx=0,Qd=1/0,Zd=null,ar=null,An=0,ir=null,xl=null,ws=0,dm=0,fm=null,Nx=null,Yc=0,hm=null;function Fa(){return(Dt&2)!==0&&Nt!==0?Nt&-Nt:P.T!==null?xm():Ii()}function kx(){if(Ua===0)if((Nt&536870912)===0||Mt){var i=cn;cn<<=1,(cn&3932160)===0&&(cn=262144),Ua=i}else Ua=536870912;return i=Ia.current,i!==null&&(i.flags|=32),Ua}function xa(i,r,d){(i===Gt&&(Ut===2||Ut===9)||i.cancelPendingCommit!==null)&&(bl(i,0),sr(i,Nt,Ua,!1)),nn(i,d),((Dt&2)===0||i!==Gt)&&(i===Gt&&((Dt&2)===0&&(ho|=d),hn===4&&sr(i,Nt,Ua,!1)),Gi(i))}function Mx(i,r,d){if((Dt&6)!==0)throw Error(a(327));var g=!d&&(r&127)===0&&(r&i.expiredLanes)===0||gn(i,r),_=g?zk(i,r):mm(i,r,!0),S=g;do{if(_===0){yl&&!g&&sr(i,r,0,!1);break}else{if(d=i.current.alternate,S&&!Ok(d)){_=mm(i,r,!1),S=!1;continue}if(_===2){if(S=r,i.errorRecoveryDisabledLanes&S)var z=0;else z=i.pendingLanes&-536870913,z=z!==0?z:z&536870912?536870912:0;if(z!==0){r=z;e:{var Y=i;_=Gc;var ee=Y.current.memoizedState.isDehydrated;if(ee&&(bl(Y,z).flags|=256),z=mm(Y,z,!1),z!==2){if(lm&&!ee){Y.errorRecoveryDisabledLanes|=S,ho|=S,_=4;break e}S=va,va=_,S!==null&&(va===null?va=S:va.push.apply(va,S))}_=z}if(S=!1,_!==2)continue}}if(_===1){bl(i,0),sr(i,r,0,!0);break}e:{switch(g=i,S=_,S){case 0:case 1:throw Error(a(345));case 4:if((r&4194048)!==r)break;case 6:sr(g,r,Ua,!tr);break e;case 2:va=null;break;case 3:case 5:break;default:throw Error(a(329))}if((r&62914560)===r&&(_=Kd+300-Ke(),10<_)){if(sr(g,r,Ua,!tr),Zn(g,0,!0)!==0)break e;ws=r,g.timeoutHandle=ib(jx.bind(null,g,d,va,Zd,um,r,Ua,ho,vl,tr,S,"Throttled",-0,0),_);break e}jx(g,d,va,Zd,um,r,Ua,ho,vl,tr,S,null,-0,0)}}break}while(!0);Gi(i)}function jx(i,r,d,g,_,S,z,Y,ee,pe,Ce,Ee,ge,_e){if(i.timeoutHandle=-1,Ee=r.subtreeFlags,Ee&8192||(Ee&16785408)===16785408){Ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bt},bx(r,S,Ee);var Qe=(S&62914560)===S?Kd-Ke():(S&4194048)===S?Cx-Ke():0;if(Qe=xM(Ee,Qe),Qe!==null){ws=S,i.cancelPendingCommit=Qe(Ix.bind(null,i,r,S,d,g,_,z,Y,ee,Ce,Ee,null,ge,_e)),sr(i,S,z,!pe);return}}Ix(i,r,S,d,g,_,z,Y,ee)}function Ok(i){for(var r=i;;){var d=r.tag;if((d===0||d===11||d===15)&&r.flags&16384&&(d=r.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var g=0;g<d.length;g++){var _=d[g],S=_.getSnapshot;_=_.value;try{if(!dn(S(),_))return!1}catch(z){return!1}}if(d=r.child,r.subtreeFlags&16384&&d!==null)d.return=r,r=d;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function sr(i,r,d,g){r&=~cm,r&=~ho,i.suspendedLanes|=r,i.pingedLanes&=~r,g&&(i.warmLanes|=r),g=i.expirationTimes;for(var _=r;0<_;){var S=31-ht(_),z=1<<S;g[S]=-1,_&=~z}d!==0&&an(i,d,r)}function Jd(){return(Dt&6)===0?(Xc(0),!1):!0}function pm(){if(wt!==null){if(Ut===0)var i=wt.return;else i=wt,ds=ao=null,Rp(i),ul=null,Rc=0,i=wt;for(;i!==null;)sx(i.alternate,i),i=i.return;wt=null}}function bl(i,r){var d=i.timeoutHandle;d!==-1&&(i.timeoutHandle=-1,tM(d)),d=i.cancelPendingCommit,d!==null&&(i.cancelPendingCommit=null,d()),ws=0,pm(),Gt=i,wt=d=cs(i.current,null),Nt=r,Ut=0,Ba=null,tr=!1,yl=gn(i,r),lm=!1,vl=Ua=cm=ho=nr=hn=0,va=Gc=null,um=!1,(r&8)!==0&&(r|=r&32);var g=i.entangledLanes;if(g!==0)for(i=i.entanglements,g&=r;0<g;){var _=31-ht(g),S=1<<_;r|=i[_],g&=~S}return _s=r,xd(),d}function Ex(i,r){yt=null,P.H=Bc,r===cl||r===Md?(r=V1(),Ut=3):r===vp?(r=V1(),Ut=4):Ut=r===Gp?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ba=r,wt===null&&(hn=1,$d(i,ai(r,i.current)))}function Rx(){var i=Ia.current;return i===null?!0:(Nt&4194048)===Nt?oi===null:(Nt&62914560)===Nt||(Nt&536870912)!==0?i===oi:!1}function Tx(){var i=P.H;return P.H=Bc,i===null?Bc:i}function Ax(){var i=P.A;return P.A=Dk,i}function Wd(){hn=4,tr||(Nt&4194048)!==Nt&&Ia.current!==null||(yl=!0),(nr&134217727)===0&&(ho&134217727)===0||Gt===null||sr(Gt,Nt,Ua,!1)}function mm(i,r,d){var g=Dt;Dt|=2;var _=Tx(),S=Ax();(Gt!==i||Nt!==r)&&(Zd=null,bl(i,r)),r=!1;var z=hn;e:do try{if(Ut!==0&&wt!==null){var Y=wt,ee=Ba;switch(Ut){case 8:pm(),z=6;break e;case 3:case 2:case 9:case 6:Ia.current===null&&(r=!0);var pe=Ut;if(Ut=0,Ba=null,_l(i,Y,ee,pe),d&&yl){z=0;break e}break;default:pe=Ut,Ut=0,Ba=null,_l(i,Y,ee,pe)}}Ik(),z=hn;break}catch(Ce){Ex(i,Ce)}while(!0);return r&&i.shellSuspendCounter++,ds=ao=null,Dt=g,P.H=_,P.A=S,wt===null&&(Gt=null,Nt=0,xd()),z}function Ik(){for(;wt!==null;)Dx(wt)}function zk(i,r){var d=Dt;Dt|=2;var g=Tx(),_=Ax();Gt!==i||Nt!==r?(Zd=null,Qd=Ke()+500,bl(i,r)):yl=gn(i,r);e:do try{if(Ut!==0&&wt!==null){r=wt;var S=Ba;t:switch(Ut){case 1:Ut=0,Ba=null,_l(i,r,S,1);break;case 2:case 9:if(H1(S)){Ut=0,Ba=null,Lx(r);break}r=function(){Ut!==2&&Ut!==9||Gt!==i||(Ut=7),Gi(i)},S.then(r,r);break e;case 3:Ut=7;break e;case 4:Ut=5;break e;case 7:H1(S)?(Ut=0,Ba=null,Lx(r)):(Ut=0,Ba=null,_l(i,r,S,7));break;case 5:var z=null;switch(wt.tag){case 26:z=wt.memoizedState;case 5:case 27:var Y=wt;if(z?xb(z):Y.stateNode.complete){Ut=0,Ba=null;var ee=Y.sibling;if(ee!==null)wt=ee;else{var pe=Y.return;pe!==null?(wt=pe,ef(pe)):wt=null}break t}}Ut=0,Ba=null,_l(i,r,S,5);break;case 6:Ut=0,Ba=null,_l(i,r,S,6);break;case 8:pm(),hn=6;break e;default:throw Error(a(462))}}Bk();break}catch(Ce){Ex(i,Ce)}while(!0);return ds=ao=null,P.H=g,P.A=_,Dt=d,wt!==null?0:(Gt=null,Nt=0,xd(),hn)}function Bk(){for(;wt!==null&&!$e();)Dx(wt)}function Dx(i){var r=ax(i.alternate,i,_s);i.memoizedProps=i.pendingProps,r===null?ef(i):wt=r}function Lx(i){var r=i,d=r.alternate;switch(r.tag){case 15:case 0:r=Z0(d,r,r.pendingProps,r.type,void 0,Nt);break;case 11:r=Z0(d,r,r.pendingProps,r.type.render,r.ref,Nt);break;case 5:Rp(r);default:sx(d,r),r=wt=A1(r,_s),r=ax(d,r,_s)}i.memoizedProps=i.pendingProps,r===null?ef(i):wt=r}function _l(i,r,d,g){ds=ao=null,Rp(r),ul=null,Rc=0;var _=r.return;try{if(kk(i,_,r,d,Nt)){hn=1,$d(i,ai(d,i.current)),wt=null;return}}catch(S){if(_!==null)throw wt=_,S;hn=1,$d(i,ai(d,i.current)),wt=null;return}r.flags&32768?(Mt||g===1?i=!0:yl||(Nt&536870912)!==0?i=!1:(tr=i=!0,(g===2||g===9||g===3||g===6)&&(g=Ia.current,g!==null&&g.tag===13&&(g.flags|=16384))),Ox(r,i)):ef(r)}function ef(i){var r=i;do{if((r.flags&32768)!==0){Ox(r,tr);return}i=r.return;var d=Ek(r.alternate,r,_s);if(d!==null){wt=d;return}if(r=r.sibling,r!==null){wt=r;return}wt=r=i}while(r!==null);hn===0&&(hn=5)}function Ox(i,r){do{var d=Rk(i.alternate,i);if(d!==null){d.flags&=32767,wt=d;return}if(d=i.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!r&&(i=i.sibling,i!==null)){wt=i;return}wt=i=d}while(i!==null);hn=6,wt=null}function Ix(i,r,d,g,_,S,z,Y,ee){i.cancelPendingCommit=null;do tf();while(An!==0);if((Dt&6)!==0)throw Error(a(327));if(r!==null){if(r===i.current)throw Error(a(177));if(S=r.lanes|r.childLanes,S|=ap,ja(i,d,S,z,Y,ee),i===Gt&&(wt=Gt=null,Nt=0),xl=r,ir=i,ws=d,dm=S,fm=_,Nx=g,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,Pk(Be,function(){return $x(),null})):(i.callbackNode=null,i.callbackPriority=0),g=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||g){g=P.T,P.T=null,_=G.p,G.p=2,z=Dt,Dt|=4;try{Tk(i,r,d)}finally{Dt=z,G.p=_,P.T=g}}An=1,zx(),Bx(),Ux()}}function zx(){if(An===1){An=0;var i=ir,r=xl,d=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||d){d=P.T,P.T=null;var g=G.p;G.p=2;var _=Dt;Dt|=4;try{yx(r,i);var S=Mm,z=S1(i.containerInfo),Y=S.focusedElem,ee=S.selectionRange;if(z!==Y&&Y&&Y.ownerDocument&&w1(Y.ownerDocument.documentElement,Y)){if(ee!==null&&Jh(Y)){var pe=ee.start,Ce=ee.end;if(Ce===void 0&&(Ce=pe),"selectionStart"in Y)Y.selectionStart=pe,Y.selectionEnd=Math.min(Ce,Y.value.length);else{var Ee=Y.ownerDocument||document,ge=Ee&&Ee.defaultView||window;if(ge.getSelection){var _e=ge.getSelection(),Qe=Y.textContent.length,lt=Math.min(ee.start,Qe),qt=ee.end===void 0?lt:Math.min(ee.end,Qe);!_e.extend&<>qt&&(z=qt,qt=lt,lt=z);var oe=_1(Y,lt),ne=_1(Y,qt);if(oe&&ne&&(_e.rangeCount!==1||_e.anchorNode!==oe.node||_e.anchorOffset!==oe.offset||_e.focusNode!==ne.node||_e.focusOffset!==ne.offset)){var he=Ee.createRange();he.setStart(oe.node,oe.offset),_e.removeAllRanges(),lt>qt?(_e.addRange(he),_e.extend(ne.node,ne.offset)):(he.setEnd(ne.node,ne.offset),_e.addRange(he))}}}}for(Ee=[],_e=Y;_e=_e.parentNode;)_e.nodeType===1&&Ee.push({element:_e,left:_e.scrollLeft,top:_e.scrollTop});for(typeof Y.focus=="function"&&Y.focus(),Y=0;Y<Ee.length;Y++){var Ne=Ee[Y];Ne.element.scrollLeft=Ne.left,Ne.element.scrollTop=Ne.top}}pf=!!km,Mm=km=null}finally{Dt=_,G.p=g,P.T=d}}i.current=r,An=2}}function Bx(){if(An===2){An=0;var i=ir,r=xl,d=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||d){d=P.T,P.T=null;var g=G.p;G.p=2;var _=Dt;Dt|=4;try{fx(i,r.alternate,r)}finally{Dt=_,G.p=g,P.T=d}}An=3}}function Ux(){if(An===4||An===3){An=0,tt();var i=ir,r=xl,d=ws,g=Nx;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?An=5:(An=0,xl=ir=null,Fx(i,i.pendingLanes));var _=i.pendingLanes;if(_===0&&(ar=null),Oi(d),r=r.stateNode,qe&&typeof qe.onCommitFiberRoot=="function")try{qe.onCommitFiberRoot(Et,r,void 0,(r.current.flags&128)===128)}catch(ee){}if(g!==null){r=P.T,_=G.p,G.p=2,P.T=null;try{for(var S=i.onRecoverableError,z=0;z<g.length;z++){var Y=g[z];S(Y.value,{componentStack:Y.stack})}}finally{P.T=r,G.p=_}}(ws&3)!==0&&tf(),Gi(i),_=i.pendingLanes,(d&261930)!==0&&(_&42)!==0?i===hm?Yc++:(Yc=0,hm=i):Yc=0,Xc(0)}}function Fx(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,jc(r)))}function tf(){return zx(),Bx(),Ux(),$x()}function $x(){if(An!==5)return!1;var i=ir,r=dm;dm=0;var d=Oi(ws),g=P.T,_=G.p;try{G.p=32>d?32:d,P.T=null,d=fm,fm=null;var S=ir,z=ws;if(An=0,xl=ir=null,ws=0,(Dt&6)!==0)throw Error(a(331));var Y=Dt;if(Dt|=4,wx(S.current),xx(S,S.current,z,d),Dt=Y,Xc(0,!1),qe&&typeof qe.onPostCommitFiberRoot=="function")try{qe.onPostCommitFiberRoot(Et,S)}catch(ee){}return!0}finally{G.p=_,P.T=g,Fx(i,r)}}function Px(i,r,d){r=ai(d,r),r=Vp(i.stateNode,r,2),i=Zs(i,r,2),i!==null&&(nn(i,2),Gi(i))}function Ft(i,r,d){if(i.tag===3)Px(i,i,d);else for(;r!==null;){if(r.tag===3){Px(r,i,d);break}else if(r.tag===1){var g=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(ar===null||!ar.has(g))){i=ai(d,i),d=H0(2),g=Zs(r,d,2),g!==null&&(q0(d,g,r,i),nn(g,2),Gi(g));break}}r=r.return}}function gm(i,r,d){var g=i.pingCache;if(g===null){g=i.pingCache=new Lk;var _=new Set;g.set(r,_)}else _=g.get(r),_===void 0&&(_=new Set,g.set(r,_));_.has(d)||(lm=!0,_.add(d),i=Uk.bind(null,i,r,d),r.then(i,i))}function Uk(i,r,d){var g=i.pingCache;g!==null&&g.delete(r),i.pingedLanes|=i.suspendedLanes&d,i.warmLanes&=~d,Gt===i&&(Nt&d)===d&&(hn===4||hn===3&&(Nt&62914560)===Nt&&300>Ke()-Kd?(Dt&2)===0&&bl(i,0):cm|=d,vl===Nt&&(vl=0)),Gi(i)}function Hx(i,r){r===0&&(r=ia()),i=eo(i,r),i!==null&&(nn(i,r),Gi(i))}function Fk(i){var r=i.memoizedState,d=0;r!==null&&(d=r.retryLane),Hx(i,d)}function $k(i,r){var d=0;switch(i.tag){case 31:case 13:var g=i.stateNode,_=i.memoizedState;_!==null&&(d=_.retryLane);break;case 19:g=i.stateNode;break;case 22:g=i.stateNode._retryCache;break;default:throw Error(a(314))}g!==null&&g.delete(r),Hx(i,d)}function Pk(i,r){return ke(i,r)}var nf=null,wl=null,ym=!1,af=!1,vm=!1,rr=0;function Gi(i){i!==wl&&i.next===null&&(wl===null?nf=wl=i:wl=wl.next=i),af=!0,ym||(ym=!0,qk())}function Xc(i,r){if(!vm&&af){vm=!0;do for(var d=!1,g=nf;g!==null;){if(i!==0){var _=g.pendingLanes;if(_===0)var S=0;else{var z=g.suspendedLanes,Y=g.pingedLanes;S=(1<<31-ht(42|i)+1)-1,S&=_&~(z&~Y),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(d=!0,Yx(g,S))}else S=Nt,S=Zn(g,g===Gt?S:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(S&3)===0||gn(g,S)||(d=!0,Yx(g,S));g=g.next}while(d);vm=!1}}function Hk(){qx()}function qx(){af=ym=!1;var i=0;rr!==0&&eM()&&(i=rr);for(var r=Ke(),d=null,g=nf;g!==null;){var _=g.next,S=Vx(g,r);S===0?(g.next=null,d===null?nf=_:d.next=_,_===null&&(wl=d)):(d=g,(i!==0||(S&3)!==0)&&(af=!0)),g=_}An!==0&&An!==5||Xc(i),rr!==0&&(rr=0)}function Vx(i,r){for(var d=i.suspendedLanes,g=i.pingedLanes,_=i.expirationTimes,S=i.pendingLanes&-62914561;0<S;){var z=31-ht(S),Y=1<<z,ee=_[z];ee===-1?((Y&d)===0||(Y&g)!==0)&&(_[z]=Ln(Y,r)):ee<=r&&(i.expiredLanes|=Y),S&=~Y}if(r=Gt,d=Nt,d=Zn(i,i===r?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),g=i.callbackNode,d===0||i===r&&(Ut===2||Ut===9)||i.cancelPendingCommit!==null)return g!==null&&g!==null&&we(g),i.callbackNode=null,i.callbackPriority=0;if((d&3)===0||gn(i,d)){if(r=d&-d,r===i.callbackPriority)return r;switch(g!==null&&we(g),Oi(d)){case 2:case 8:d=Se;break;case 32:d=Be;break;case 268435456:d=Pe;break;default:d=Be}return g=Gx.bind(null,i),d=ke(d,g),i.callbackPriority=r,i.callbackNode=d,r}return g!==null&&g!==null&&we(g),i.callbackPriority=2,i.callbackNode=null,2}function Gx(i,r){if(An!==0&&An!==5)return i.callbackNode=null,i.callbackPriority=0,null;var d=i.callbackNode;if(tf()&&i.callbackNode!==d)return null;var g=Nt;return g=Zn(i,i===Gt?g:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),g===0?null:(Mx(i,g,r),Vx(i,Ke()),i.callbackNode!=null&&i.callbackNode===d?Gx.bind(null,i):null)}function Yx(i,r){if(tf())return null;Mx(i,r,!0)}function qk(){nM(function(){(Dt&6)!==0?ke(ye,Hk):qx()})}function xm(){if(rr===0){var i=ol;i===0&&(i=ln,ln<<=1,(ln&261888)===0&&(ln=256)),rr=i}return rr}function Xx(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:La(""+i)}function Kx(i,r){var d=r.ownerDocument.createElement("input");return d.name=r.name,d.value=r.value,i.id&&d.setAttribute("form",i.id),r.parentNode.insertBefore(d,r),i=new FormData(i),d.parentNode.removeChild(d),i}function Vk(i,r,d,g,_){if(r==="submit"&&d&&d.stateNode===_){var S=Xx((_[Ue]||null).action),z=g.submitter;z&&(r=(r=z[Ue]||null)?Xx(r.formAction):z.getAttribute("formAction"),r!==null&&(S=r,z=null));var Y=new zn("action","action",null,g,_);i.push({event:Y,listeners:[{instance:null,listener:function(){if(g.defaultPrevented){if(rr!==0){var ee=z?Kx(_,z):new FormData(_);Up(d,{pending:!0,data:ee,method:_.method,action:S},null,ee)}}else typeof S=="function"&&(Y.preventDefault(),ee=z?Kx(_,z):new FormData(_),Up(d,{pending:!0,data:ee,method:_.method,action:S},S,ee))},currentTarget:_}]})}}for(var bm=0;bm<np.length;bm++){var _m=np[bm],Gk=_m.toLowerCase(),Yk=_m[0].toUpperCase()+_m.slice(1);Mi(Gk,"on"+Yk)}Mi(k1,"onAnimationEnd"),Mi(M1,"onAnimationIteration"),Mi(j1,"onAnimationStart"),Mi("dblclick","onDoubleClick"),Mi("focusin","onFocus"),Mi("focusout","onBlur"),Mi(ck,"onTransitionRun"),Mi(uk,"onTransitionStart"),Mi(dk,"onTransitionCancel"),Mi(E1,"onTransitionEnd"),as("onMouseEnter",["mouseout","mouseover"]),as("onMouseLeave",["mouseout","mouseover"]),as("onPointerEnter",["pointerout","pointerover"]),as("onPointerLeave",["pointerout","pointerover"]),ha("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ha("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ha("onBeforeInput",["compositionend","keypress","textInput","paste"]),ha("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ha("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ha("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Kc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Xk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Kc));function Qx(i,r){r=(r&4)!==0;for(var d=0;d<i.length;d++){var g=i[d],_=g.event;g=g.listeners;e:{var S=void 0;if(r)for(var z=g.length-1;0<=z;z--){var Y=g[z],ee=Y.instance,pe=Y.currentTarget;if(Y=Y.listener,ee!==S&&_.isPropagationStopped())break e;S=Y,_.currentTarget=pe;try{S(_)}catch(Ce){vd(Ce)}_.currentTarget=null,S=ee}else for(z=0;z<g.length;z++){if(Y=g[z],ee=Y.instance,pe=Y.currentTarget,Y=Y.listener,ee!==S&&_.isPropagationStopped())break e;S=Y,_.currentTarget=pe;try{S(_)}catch(Ce){vd(Ce)}_.currentTarget=null,S=ee}}}}function St(i,r){var d=r[ft];d===void 0&&(d=r[ft]=new Set);var g=i+"__bubble";d.has(g)||(Zx(r,i,2,!1),d.add(g))}function wm(i,r,d){var g=0;r&&(g|=4),Zx(d,i,g,r)}var sf="_reactListening"+Math.random().toString(36).slice(2);function Sm(i){if(!i[sf]){i[sf]=!0,pc.forEach(function(d){d!=="selectionchange"&&(Xk.has(d)||wm(d,!1,i),wm(d,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[sf]||(r[sf]=!0,wm("selectionchange",!1,r))}}function Zx(i,r,d,g){switch(kb(r)){case 2:var _=wM;break;case 8:_=SM;break;default:_=Bm}d=_.bind(null,r,d,i),_=void 0,!vc||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(_=!0),g?_!==void 0?i.addEventListener(r,d,{capture:!0,passive:_}):i.addEventListener(r,d,!0):_!==void 0?i.addEventListener(r,d,{passive:_}):i.addEventListener(r,d,!1)}function Cm(i,r,d,g,_){var S=g;if((r&1)===0&&(r&2)===0&&g!==null)e:for(;;){if(g===null)return;var z=g.tag;if(z===3||z===4){var Y=g.stateNode.containerInfo;if(Y===_)break;if(z===4)for(z=g.return;z!==null;){var ee=z.tag;if((ee===3||ee===4)&&z.stateNode.containerInfo===_)return;z=z.return}for(;Y!==null;){if(z=Ja(Y),z===null)return;if(ee=z.tag,ee===5||ee===6||ee===26||ee===27){g=S=z;continue e}Y=Y.parentNode}}g=g.return}yc(function(){var pe=S,Ce=Bs(d),Ee=[];e:{var ge=R1.get(i);if(ge!==void 0){var _e=zn,Qe=i;switch(i){case"keypress":if(Ni(d)===0)break e;case"keydown":case"keyup":_e=Zo;break;case"focusin":Qe="focus",_e=_c;break;case"focusout":Qe="blur",_e=_c;break;case"beforeblur":case"afterblur":_e=_c;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_e=Xr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_e=od;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_e=ra;break;case k1:case M1:case j1:_e=Ph;break;case E1:_e=Kr;break;case"scroll":case"scrollend":_e=Ko;break;case"wheel":_e=Cc;break;case"copy":case"cut":case"paste":_e=ud;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_e=hd;break;case"toggle":case"beforetoggle":_e=Xh}var lt=(r&4)!==0,qt=!lt&&(i==="scroll"||i==="scrollend"),oe=lt?ge!==null?ge+"Capture":null:ge;lt=[];for(var ne=pe,he;ne!==null;){var Ne=ne;if(he=Ne.stateNode,Ne=Ne.tag,Ne!==5&&Ne!==26&&Ne!==27||he===null||oe===null||(Ne=rs(ne,oe),Ne!=null&<.push(Qc(ne,Ne,he))),qt)break;ne=ne.return}0<lt.length&&(ge=new _e(ge,Qe,null,d,Ce),Ee.push({event:ge,listeners:lt}))}}if((r&7)===0){e:{if(ge=i==="mouseover"||i==="pointerover",_e=i==="mouseout"||i==="pointerout",ge&&d!==Ui&&(Qe=d.relatedTarget||d.fromElement)&&(Ja(Qe)||Qe[Je]))break e;if((_e||ge)&&(ge=Ce.window===Ce?Ce:(ge=Ce.ownerDocument)?ge.defaultView||ge.parentWindow:window,_e?(Qe=d.relatedTarget||d.toElement,_e=pe,Qe=Qe?Ja(Qe):null,Qe!==null&&(qt=o(Qe),lt=Qe.tag,Qe!==qt||lt!==5&<!==27&<!==6)&&(Qe=null)):(_e=null,Qe=pe),_e!==Qe)){if(lt=Xr,Ne="onMouseLeave",oe="onMouseEnter",ne="mouse",(i==="pointerout"||i==="pointerover")&&(lt=hd,Ne="onPointerLeave",oe="onPointerEnter",ne="pointer"),qt=_e==null?ge:Wa(_e),he=Qe==null?ge:Wa(Qe),ge=new lt(Ne,ne+"leave",_e,d,Ce),ge.target=qt,ge.relatedTarget=he,Ne=null,Ja(Ce)===pe&&(lt=new lt(oe,ne+"enter",Qe,d,Ce),lt.target=he,lt.relatedTarget=qt,Ne=lt),qt=Ne,_e&&Qe)t:{for(lt=Kk,oe=_e,ne=Qe,he=0,Ne=oe;Ne;Ne=lt(Ne))he++;Ne=0;for(var it=ne;it;it=lt(it))Ne++;for(;0<he-Ne;)oe=lt(oe),he--;for(;0<Ne-he;)ne=lt(ne),Ne--;for(;he--;){if(oe===ne||ne!==null&&oe===ne.alternate){lt=oe;break t}oe=lt(oe),ne=lt(ne)}lt=null}else lt=null;_e!==null&&Jx(Ee,ge,_e,lt,!1),Qe!==null&&qt!==null&&Jx(Ee,qt,Qe,lt,!0)}}e:{if(ge=pe?Wa(pe):window,_e=ge.nodeName&&ge.nodeName.toLowerCase(),_e==="select"||_e==="input"&&ge.type==="file")var Tt=vn;else if(Jt(ge))if($s)Tt=Jo;else{Tt=yd;var We=gd}else _e=ge.nodeName,!_e||_e.toLowerCase()!=="input"||ge.type!=="checkbox"&&ge.type!=="radio"?pe&&Bi(pe.elementType)&&(Tt=vn):Tt=Zh;if(Tt&&(Tt=Tt(i,pe))){Nn(Ee,Tt,d,Ce);break e}We&&We(i,ge,pe),i==="focusout"&&pe&&ge.type==="number"&&pe.memoizedProps.value!=null&&Vr(ge,"number",ge.value)}switch(We=pe?Wa(pe):window,i){case"focusin":(Jt(We)||We.contentEditable==="true")&&(Wo=We,Wh=pe,Nc=null);break;case"focusout":Nc=Wh=Wo=null;break;case"mousedown":ep=!0;break;case"contextmenu":case"mouseup":case"dragend":ep=!1,C1(Ee,d,Ce);break;case"selectionchange":if(lk)break;case"keydown":case"keyup":C1(Ee,d,Ce)}var bt;if(ti)e:{switch(i){case"compositionstart":var kt="onCompositionStart";break e;case"compositionend":kt="onCompositionEnd";break e;case"compositionupdate":kt="onCompositionUpdate";break e}kt=void 0}else Ie?Le(i,d)&&(kt="onCompositionEnd"):i==="keydown"&&d.keyCode===229&&(kt="onCompositionStart");kt&&(q&&d.locale!=="ko"&&(Ie||kt!=="onCompositionStart"?kt==="onCompositionEnd"&&Ie&&(bt=Xo()):(Fi=Ce,xc="value"in Fi?Fi.value:Fi.textContent,Ie=!0)),We=rf(pe,kt),0<We.length&&(kt=new Vn(kt,i,null,d,Ce),Ee.push({event:kt,listeners:We}),bt?kt.data=bt:(bt=et(d),bt!==null&&(kt.data=bt)))),(bt=Qh?Ge(i,d):Ye(i,d))&&(kt=rf(pe,"onBeforeInput"),0<kt.length&&(We=new Vn("onBeforeInput","beforeinput",null,d,Ce),Ee.push({event:We,listeners:kt}),We.data=bt)),Vk(Ee,i,pe,d,Ce)}Qx(Ee,r)})}function Qc(i,r,d){return{instance:i,listener:r,currentTarget:d}}function rf(i,r){for(var d=r+"Capture",g=[];i!==null;){var _=i,S=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||S===null||(_=rs(i,d),_!=null&&g.unshift(Qc(i,_,S)),_=rs(i,r),_!=null&&g.push(Qc(i,_,S))),i.tag===3)return g;i=i.return}return[]}function Kk(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Jx(i,r,d,g,_){for(var S=r._reactName,z=[];d!==null&&d!==g;){var Y=d,ee=Y.alternate,pe=Y.stateNode;if(Y=Y.tag,ee!==null&&ee===g)break;Y!==5&&Y!==26&&Y!==27||pe===null||(ee=pe,_?(pe=rs(d,S),pe!=null&&z.unshift(Qc(d,pe,ee))):_||(pe=rs(d,S),pe!=null&&z.push(Qc(d,pe,ee)))),d=d.return}z.length!==0&&i.push({event:r,listeners:z})}var Qk=/\r\n?/g,Zk=/\u0000|\uFFFD/g;function Wx(i){return(typeof i=="string"?i:""+i).replace(Qk,`
|
|
33
|
+
`).replace(Zk,"")}function eb(i,r){return r=Wx(r),Wx(i)===r}function Ht(i,r,d,g,_,S){switch(d){case"children":typeof g=="string"?r==="body"||r==="textarea"&&g===""||Da(i,g):(typeof g=="number"||typeof g=="bigint")&&r!=="body"&&Da(i,""+g);break;case"className":Ur(i,"class",g);break;case"tabIndex":Ur(i,"tabindex",g);break;case"dir":case"role":case"viewBox":case"width":case"height":Ur(i,d,g);break;case"style":pt(i,g,S);break;case"data":if(r!=="object"){Ur(i,"data",g);break}case"src":case"href":if(g===""&&(r!=="a"||d!=="href")){i.removeAttribute(d);break}if(g==null||typeof g=="function"||typeof g=="symbol"||typeof g=="boolean"){i.removeAttribute(d);break}g=La(""+g),i.setAttribute(d,g);break;case"action":case"formAction":if(typeof g=="function"){i.setAttribute(d,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof S=="function"&&(d==="formAction"?(r!=="input"&&Ht(i,r,"name",_.name,_,null),Ht(i,r,"formEncType",_.formEncType,_,null),Ht(i,r,"formMethod",_.formMethod,_,null),Ht(i,r,"formTarget",_.formTarget,_,null)):(Ht(i,r,"encType",_.encType,_,null),Ht(i,r,"method",_.method,_,null),Ht(i,r,"target",_.target,_,null)));if(g==null||typeof g=="symbol"||typeof g=="boolean"){i.removeAttribute(d);break}g=La(""+g),i.setAttribute(d,g);break;case"onClick":g!=null&&(i.onclick=Bt);break;case"onScroll":g!=null&&St("scroll",i);break;case"onScrollEnd":g!=null&&St("scrollend",i);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(a(61));if(d=g.__html,d!=null){if(_.children!=null)throw Error(a(60));i.innerHTML=d}}break;case"multiple":i.multiple=g&&typeof g!="function"&&typeof g!="symbol";break;case"muted":i.muted=g&&typeof g!="function"&&typeof g!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(g==null||typeof g=="function"||typeof g=="boolean"||typeof g=="symbol"){i.removeAttribute("xlink:href");break}d=La(""+g),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":g!=null&&typeof g!="function"&&typeof g!="symbol"?i.setAttribute(d,""+g):i.removeAttribute(d);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":g&&typeof g!="function"&&typeof g!="symbol"?i.setAttribute(d,""):i.removeAttribute(d);break;case"capture":case"download":g===!0?i.setAttribute(d,""):g!==!1&&g!=null&&typeof g!="function"&&typeof g!="symbol"?i.setAttribute(d,g):i.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":g!=null&&typeof g!="function"&&typeof g!="symbol"&&!isNaN(g)&&1<=g?i.setAttribute(d,g):i.removeAttribute(d);break;case"rowSpan":case"start":g==null||typeof g=="function"||typeof g=="symbol"||isNaN(g)?i.removeAttribute(d):i.setAttribute(d,g);break;case"popover":St("beforetoggle",i),St("toggle",i),Ho(i,"popover",g);break;case"xlinkActuate":On(i,"http://www.w3.org/1999/xlink","xlink:actuate",g);break;case"xlinkArcrole":On(i,"http://www.w3.org/1999/xlink","xlink:arcrole",g);break;case"xlinkRole":On(i,"http://www.w3.org/1999/xlink","xlink:role",g);break;case"xlinkShow":On(i,"http://www.w3.org/1999/xlink","xlink:show",g);break;case"xlinkTitle":On(i,"http://www.w3.org/1999/xlink","xlink:title",g);break;case"xlinkType":On(i,"http://www.w3.org/1999/xlink","xlink:type",g);break;case"xmlBase":On(i,"http://www.w3.org/XML/1998/namespace","xml:base",g);break;case"xmlLang":On(i,"http://www.w3.org/XML/1998/namespace","xml:lang",g);break;case"xmlSpace":On(i,"http://www.w3.org/XML/1998/namespace","xml:space",g);break;case"is":Ho(i,"is",g);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=qn.get(d)||d,Ho(i,d,g))}}function Nm(i,r,d,g,_,S){switch(d){case"style":pt(i,g,S);break;case"dangerouslySetInnerHTML":if(g!=null){if(typeof g!="object"||!("__html"in g))throw Error(a(61));if(d=g.__html,d!=null){if(_.children!=null)throw Error(a(60));i.innerHTML=d}}break;case"children":typeof g=="string"?Da(i,g):(typeof g=="number"||typeof g=="bigint")&&Da(i,""+g);break;case"onScroll":g!=null&&St("scroll",i);break;case"onScrollEnd":g!=null&&St("scrollend",i);break;case"onClick":g!=null&&(i.onclick=Bt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!nd.hasOwnProperty(d))e:{if(d[0]==="o"&&d[1]==="n"&&(_=d.endsWith("Capture"),r=d.slice(2,_?d.length-7:void 0),S=i[Ue]||null,S=S!=null?S[d]:null,typeof S=="function"&&i.removeEventListener(r,S,_),typeof g=="function")){typeof S!="function"&&S!==null&&(d in i?i[d]=null:i.hasAttribute(d)&&i.removeAttribute(d)),i.addEventListener(r,g,_);break e}d in i?i[d]=g:g===!0?i.setAttribute(d,""):Ho(i,d,g)}}}function Kn(i,r,d){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":St("error",i),St("load",i);var g=!1,_=!1,S;for(S in d)if(d.hasOwnProperty(S)){var z=d[S];if(z!=null)switch(S){case"src":g=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,r));default:Ht(i,r,S,z,d,null)}}_&&Ht(i,r,"srcSet",d.srcSet,d,null),g&&Ht(i,r,"src",d.src,d,null);return;case"input":St("invalid",i);var Y=S=z=_=null,ee=null,pe=null;for(g in d)if(d.hasOwnProperty(g)){var Ce=d[g];if(Ce!=null)switch(g){case"name":_=Ce;break;case"type":z=Ce;break;case"checked":ee=Ce;break;case"defaultChecked":pe=Ce;break;case"value":S=Ce;break;case"defaultValue":Y=Ce;break;case"children":case"dangerouslySetInnerHTML":if(Ce!=null)throw Error(a(137,r));break;default:Ht(i,r,g,Ce,d,null)}}qr(i,S,Y,ee,pe,z,_,!1);return;case"select":St("invalid",i),g=z=S=null;for(_ in d)if(d.hasOwnProperty(_)&&(Y=d[_],Y!=null))switch(_){case"value":S=Y;break;case"defaultValue":z=Y;break;case"multiple":g=Y;default:Ht(i,r,_,Y,d,null)}r=S,d=z,i.multiple=!!g,r!=null?is(i,!!g,r,!1):d!=null&&is(i,!!g,d,!0);return;case"textarea":St("invalid",i),S=_=g=null;for(z in d)if(d.hasOwnProperty(z)&&(Y=d[z],Y!=null))switch(z){case"value":g=Y;break;case"defaultValue":_=Y;break;case"children":S=Y;break;case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(91));break;default:Ht(i,r,z,Y,d,null)}ss(i,g,_,S);return;case"option":for(ee in d)if(d.hasOwnProperty(ee)&&(g=d[ee],g!=null))switch(ee){case"selected":i.selected=g&&typeof g!="function"&&typeof g!="symbol";break;default:Ht(i,r,ee,g,d,null)}return;case"dialog":St("beforetoggle",i),St("toggle",i),St("cancel",i),St("close",i);break;case"iframe":case"object":St("load",i);break;case"video":case"audio":for(g=0;g<Kc.length;g++)St(Kc[g],i);break;case"image":St("error",i),St("load",i);break;case"details":St("toggle",i);break;case"embed":case"source":case"link":St("error",i),St("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(pe in d)if(d.hasOwnProperty(pe)&&(g=d[pe],g!=null))switch(pe){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,r));default:Ht(i,r,pe,g,d,null)}return;default:if(Bi(r)){for(Ce in d)d.hasOwnProperty(Ce)&&(g=d[Ce],g!==void 0&&Nm(i,r,Ce,g,d,void 0));return}}for(Y in d)d.hasOwnProperty(Y)&&(g=d[Y],g!=null&&Ht(i,r,Y,g,d,null))}function Jk(i,r,d,g){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,S=null,z=null,Y=null,ee=null,pe=null,Ce=null;for(_e in d){var Ee=d[_e];if(d.hasOwnProperty(_e)&&Ee!=null)switch(_e){case"checked":break;case"value":break;case"defaultValue":ee=Ee;default:g.hasOwnProperty(_e)||Ht(i,r,_e,null,g,Ee)}}for(var ge in g){var _e=g[ge];if(Ee=d[ge],g.hasOwnProperty(ge)&&(_e!=null||Ee!=null))switch(ge){case"type":S=_e;break;case"name":_=_e;break;case"checked":pe=_e;break;case"defaultChecked":Ce=_e;break;case"value":z=_e;break;case"defaultValue":Y=_e;break;case"children":case"dangerouslySetInnerHTML":if(_e!=null)throw Error(a(137,r));break;default:_e!==Ee&&Ht(i,r,ge,_e,g,Ee)}}zi(i,z,Y,ee,pe,Ce,S,_);return;case"select":_e=z=Y=ge=null;for(S in d)if(ee=d[S],d.hasOwnProperty(S)&&ee!=null)switch(S){case"value":break;case"multiple":_e=ee;default:g.hasOwnProperty(S)||Ht(i,r,S,null,g,ee)}for(_ in g)if(S=g[_],ee=d[_],g.hasOwnProperty(_)&&(S!=null||ee!=null))switch(_){case"value":ge=S;break;case"defaultValue":Y=S;break;case"multiple":z=S;default:S!==ee&&Ht(i,r,_,S,g,ee)}r=Y,d=z,g=_e,ge!=null?is(i,!!d,ge,!1):!!g!=!!d&&(r!=null?is(i,!!d,r,!0):is(i,!!d,d?[]:"",!1));return;case"textarea":_e=ge=null;for(Y in d)if(_=d[Y],d.hasOwnProperty(Y)&&_!=null&&!g.hasOwnProperty(Y))switch(Y){case"value":break;case"children":break;default:Ht(i,r,Y,null,g,_)}for(z in g)if(_=g[z],S=d[z],g.hasOwnProperty(z)&&(_!=null||S!=null))switch(z){case"value":ge=_;break;case"defaultValue":_e=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(a(91));break;default:_!==S&&Ht(i,r,z,_,g,S)}zs(i,ge,_e);return;case"option":for(var Qe in d)if(ge=d[Qe],d.hasOwnProperty(Qe)&&ge!=null&&!g.hasOwnProperty(Qe))switch(Qe){case"selected":i.selected=!1;break;default:Ht(i,r,Qe,null,g,ge)}for(ee in g)if(ge=g[ee],_e=d[ee],g.hasOwnProperty(ee)&&ge!==_e&&(ge!=null||_e!=null))switch(ee){case"selected":i.selected=ge&&typeof ge!="function"&&typeof ge!="symbol";break;default:Ht(i,r,ee,ge,g,_e)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var lt in d)ge=d[lt],d.hasOwnProperty(lt)&&ge!=null&&!g.hasOwnProperty(lt)&&Ht(i,r,lt,null,g,ge);for(pe in g)if(ge=g[pe],_e=d[pe],g.hasOwnProperty(pe)&&ge!==_e&&(ge!=null||_e!=null))switch(pe){case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(a(137,r));break;default:Ht(i,r,pe,ge,g,_e)}return;default:if(Bi(r)){for(var qt in d)ge=d[qt],d.hasOwnProperty(qt)&&ge!==void 0&&!g.hasOwnProperty(qt)&&Nm(i,r,qt,void 0,g,ge);for(Ce in g)ge=g[Ce],_e=d[Ce],!g.hasOwnProperty(Ce)||ge===_e||ge===void 0&&_e===void 0||Nm(i,r,Ce,ge,g,_e);return}}for(var oe in d)ge=d[oe],d.hasOwnProperty(oe)&&ge!=null&&!g.hasOwnProperty(oe)&&Ht(i,r,oe,null,g,ge);for(Ee in g)ge=g[Ee],_e=d[Ee],!g.hasOwnProperty(Ee)||ge===_e||ge==null&&_e==null||Ht(i,r,Ee,ge,g,_e)}function tb(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Wk(){if(typeof performance.getEntriesByType=="function"){for(var i=0,r=0,d=performance.getEntriesByType("resource"),g=0;g<d.length;g++){var _=d[g],S=_.transferSize,z=_.initiatorType,Y=_.duration;if(S&&Y&&tb(z)){for(z=0,Y=_.responseEnd,g+=1;g<d.length;g++){var ee=d[g],pe=ee.startTime;if(pe>Y)break;var Ce=ee.transferSize,Ee=ee.initiatorType;Ce&&tb(Ee)&&(ee=ee.responseEnd,z+=Ce*(ee<Y?1:(Y-pe)/(ee-pe)))}if(--g,r+=8*(S+z)/(_.duration/1e3),i++,10<i)break}}if(0<i)return r/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var km=null,Mm=null;function of(i){return i.nodeType===9?i:i.ownerDocument}function nb(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ab(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function jm(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Em=null;function eM(){var i=window.event;return i&&i.type==="popstate"?i===Em?!1:(Em=i,!0):(Em=null,!1)}var ib=typeof setTimeout=="function"?setTimeout:void 0,tM=typeof clearTimeout=="function"?clearTimeout:void 0,sb=typeof Promise=="function"?Promise:void 0,nM=typeof queueMicrotask=="function"?queueMicrotask:typeof sb!="undefined"?function(i){return sb.resolve(null).then(i).catch(aM)}:ib;function aM(i){setTimeout(function(){throw i})}function or(i){return i==="head"}function rb(i,r){var d=r,g=0;do{var _=d.nextSibling;if(i.removeChild(d),_&&_.nodeType===8)if(d=_.data,d==="/$"||d==="/&"){if(g===0){i.removeChild(_),kl(r);return}g--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")g++;else if(d==="html")Zc(i.ownerDocument.documentElement);else if(d==="head"){d=i.ownerDocument.head,Zc(d);for(var S=d.firstChild;S;){var z=S.nextSibling,Y=S.nodeName;S[Sn]||Y==="SCRIPT"||Y==="STYLE"||Y==="LINK"&&S.rel.toLowerCase()==="stylesheet"||d.removeChild(S),S=z}}else d==="body"&&Zc(i.ownerDocument.body);d=_}while(d);kl(r)}function ob(i,r){var d=i;i=0;do{var g=d.nextSibling;if(d.nodeType===1?r?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(r?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),g&&g.nodeType===8)if(d=g.data,d==="/$"){if(i===0)break;i--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||i++;d=g}while(d)}function Rm(i){var r=i.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var d=r;switch(r=r.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":Rm(d),Ta(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}i.removeChild(d)}}function iM(i,r,d,g){for(;i.nodeType===1;){var _=d;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!g&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(g){if(!i[Sn])switch(r){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(S=i.getAttribute("rel"),S==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(S!==_.rel||i.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||i.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||i.getAttribute("title")!==(_.title==null?null:_.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(S=i.getAttribute("src"),(S!==(_.src==null?null:_.src)||i.getAttribute("type")!==(_.type==null?null:_.type)||i.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&S&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(r==="input"&&i.type==="hidden"){var S=_.name==null?null:""+_.name;if(_.type==="hidden"&&i.getAttribute("name")===S)return i}else return i;if(i=li(i.nextSibling),i===null)break}return null}function sM(i,r,d){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!d||(i=li(i.nextSibling),i===null))return null;return i}function lb(i,r){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=li(i.nextSibling),i===null))return null;return i}function Tm(i){return i.data==="$?"||i.data==="$~"}function Am(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function rM(i,r){var d=i.ownerDocument;if(i.data==="$~")i._reactRetry=r;else if(i.data!=="$?"||d.readyState!=="loading")r();else{var g=function(){r(),d.removeEventListener("DOMContentLoaded",g)};d.addEventListener("DOMContentLoaded",g),i._reactRetry=g}}function li(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return i}var Dm=null;function cb(i){i=i.nextSibling;for(var r=0;i;){if(i.nodeType===8){var d=i.data;if(d==="/$"||d==="/&"){if(r===0)return li(i.nextSibling);r--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||r++}i=i.nextSibling}return null}function ub(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var d=i.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(r===0)return i;r--}else d!=="/$"&&d!=="/&"||r++}i=i.previousSibling}return null}function db(i,r,d){switch(r=of(d),i){case"html":if(i=r.documentElement,!i)throw Error(a(452));return i;case"head":if(i=r.head,!i)throw Error(a(453));return i;case"body":if(i=r.body,!i)throw Error(a(454));return i;default:throw Error(a(451))}}function Zc(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);Ta(i)}var ci=new Map,fb=new Set;function lf(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Ss=G.d;G.d={f:oM,r:lM,D:cM,C:uM,L:dM,m:fM,X:pM,S:hM,M:mM};function oM(){var i=Ss.f(),r=Jd();return i||r}function lM(i){var r=Aa(i);r!==null&&r.tag===5&&r.type==="form"?E0(r):Ss.r(i)}var Sl=typeof document=="undefined"?null:document;function hb(i,r,d){var g=Sl;if(g&&typeof r=="string"&&r){var _=Hn(r);_='link[rel="'+i+'"][href="'+_+'"]',typeof d=="string"&&(_+='[crossorigin="'+d+'"]'),fb.has(_)||(fb.add(_),i={rel:i,crossOrigin:d,href:r},g.querySelector(_)===null&&(r=g.createElement("link"),Kn(r,"link",i),Cn(r),g.head.appendChild(r)))}}function cM(i){Ss.D(i),hb("dns-prefetch",i,null)}function uM(i,r){Ss.C(i,r),hb("preconnect",i,r)}function dM(i,r,d){Ss.L(i,r,d);var g=Sl;if(g&&i&&r){var _='link[rel="preload"][as="'+Hn(r)+'"]';r==="image"&&d&&d.imageSrcSet?(_+='[imagesrcset="'+Hn(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(_+='[imagesizes="'+Hn(d.imageSizes)+'"]')):_+='[href="'+Hn(i)+'"]';var S=_;switch(r){case"style":S=Cl(i);break;case"script":S=Nl(i)}ci.has(S)||(i=p({rel:"preload",href:r==="image"&&d&&d.imageSrcSet?void 0:i,as:r},d),ci.set(S,i),g.querySelector(_)!==null||r==="style"&&g.querySelector(Jc(S))||r==="script"&&g.querySelector(Wc(S))||(r=g.createElement("link"),Kn(r,"link",i),Cn(r),g.head.appendChild(r)))}}function fM(i,r){Ss.m(i,r);var d=Sl;if(d&&i){var g=r&&typeof r.as=="string"?r.as:"script",_='link[rel="modulepreload"][as="'+Hn(g)+'"][href="'+Hn(i)+'"]',S=_;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Nl(i)}if(!ci.has(S)&&(i=p({rel:"modulepreload",href:i},r),ci.set(S,i),d.querySelector(_)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Wc(S)))return}g=d.createElement("link"),Kn(g,"link",i),Cn(g),d.head.appendChild(g)}}}function hM(i,r,d){Ss.S(i,r,d);var g=Sl;if(g&&i){var _=Is(g).hoistableStyles,S=Cl(i);r=r||"default";var z=_.get(S);if(!z){var Y={loading:0,preload:null};if(z=g.querySelector(Jc(S)))Y.loading=5;else{i=p({rel:"stylesheet",href:i,"data-precedence":r},d),(d=ci.get(S))&&Lm(i,d);var ee=z=g.createElement("link");Cn(ee),Kn(ee,"link",i),ee._p=new Promise(function(pe,Ce){ee.onload=pe,ee.onerror=Ce}),ee.addEventListener("load",function(){Y.loading|=1}),ee.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,cf(z,r,g)}z={type:"stylesheet",instance:z,count:1,state:Y},_.set(S,z)}}}function pM(i,r){Ss.X(i,r);var d=Sl;if(d&&i){var g=Is(d).hoistableScripts,_=Nl(i),S=g.get(_);S||(S=d.querySelector(Wc(_)),S||(i=p({src:i,async:!0},r),(r=ci.get(_))&&Om(i,r),S=d.createElement("script"),Cn(S),Kn(S,"link",i),d.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(_,S))}}function mM(i,r){Ss.M(i,r);var d=Sl;if(d&&i){var g=Is(d).hoistableScripts,_=Nl(i),S=g.get(_);S||(S=d.querySelector(Wc(_)),S||(i=p({src:i,async:!0,type:"module"},r),(r=ci.get(_))&&Om(i,r),S=d.createElement("script"),Cn(S),Kn(S,"link",i),d.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},g.set(_,S))}}function pb(i,r,d,g){var _=(_=J.current)?lf(_):null;if(!_)throw Error(a(446));switch(i){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(r=Cl(d.href),d=Is(_).hoistableStyles,g=d.get(r),g||(g={type:"style",instance:null,count:0,state:null},d.set(r,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){i=Cl(d.href);var S=Is(_).hoistableStyles,z=S.get(i);if(z||(_=_.ownerDocument||_,z={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(i,z),(S=_.querySelector(Jc(i)))&&!S._p&&(z.instance=S,z.state.loading=5),ci.has(i)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},ci.set(i,d),S||gM(_,i,d,z.state))),r&&g===null)throw Error(a(528,""));return z}if(r&&g!==null)throw Error(a(529,""));return null;case"script":return r=d.async,d=d.src,typeof d=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Nl(d),d=Is(_).hoistableScripts,g=d.get(r),g||(g={type:"script",instance:null,count:0,state:null},d.set(r,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,i))}}function Cl(i){return'href="'+Hn(i)+'"'}function Jc(i){return'link[rel="stylesheet"]['+i+"]"}function mb(i){return p({},i,{"data-precedence":i.precedence,precedence:null})}function gM(i,r,d,g){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?g.loading=1:(r=i.createElement("link"),g.preload=r,r.addEventListener("load",function(){return g.loading|=1}),r.addEventListener("error",function(){return g.loading|=2}),Kn(r,"link",d),Cn(r),i.head.appendChild(r))}function Nl(i){return'[src="'+Hn(i)+'"]'}function Wc(i){return"script[async]"+i}function gb(i,r,d){if(r.count++,r.instance===null)switch(r.type){case"style":var g=i.querySelector('style[data-href~="'+Hn(d.href)+'"]');if(g)return r.instance=g,Cn(g),g;var _=p({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return g=(i.ownerDocument||i).createElement("style"),Cn(g),Kn(g,"style",_),cf(g,d.precedence,i),r.instance=g;case"stylesheet":_=Cl(d.href);var S=i.querySelector(Jc(_));if(S)return r.state.loading|=4,r.instance=S,Cn(S),S;g=mb(d),(_=ci.get(_))&&Lm(g,_),S=(i.ownerDocument||i).createElement("link"),Cn(S);var z=S;return z._p=new Promise(function(Y,ee){z.onload=Y,z.onerror=ee}),Kn(S,"link",g),r.state.loading|=4,cf(S,d.precedence,i),r.instance=S;case"script":return S=Nl(d.src),(_=i.querySelector(Wc(S)))?(r.instance=_,Cn(_),_):(g=d,(_=ci.get(S))&&(g=p({},d),Om(g,_)),i=i.ownerDocument||i,_=i.createElement("script"),Cn(_),Kn(_,"link",g),i.head.appendChild(_),r.instance=_);case"void":return null;default:throw Error(a(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(g=r.instance,r.state.loading|=4,cf(g,d.precedence,i));return r.instance}function cf(i,r,d){for(var g=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=g.length?g[g.length-1]:null,S=_,z=0;z<g.length;z++){var Y=g[z];if(Y.dataset.precedence===r)S=Y;else if(S!==_)break}S?S.parentNode.insertBefore(i,S.nextSibling):(r=d.nodeType===9?d.head:d,r.insertBefore(i,r.firstChild))}function Lm(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function Om(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var uf=null;function yb(i,r,d){if(uf===null){var g=new Map,_=uf=new Map;_.set(d,g)}else _=uf,g=_.get(d),g||(g=new Map,_.set(d,g));if(g.has(i))return g;for(g.set(i,null),d=d.getElementsByTagName(i),_=0;_<d.length;_++){var S=d[_];if(!(S[Sn]||S[ce]||i==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var z=S.getAttribute(r)||"";z=i+z;var Y=g.get(z);Y?Y.push(S):g.set(z,[S])}}return g}function vb(i,r,d){i=i.ownerDocument||i,i.head.insertBefore(d,r==="title"?i.querySelector("head > title"):null)}function yM(i,r,d){if(d===1||r.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return i=r.disabled,typeof r.precedence=="string"&&i==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function xb(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function vM(i,r,d,g){if(d.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var _=Cl(g.href),S=r.querySelector(Jc(_));if(S){r=S._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=df.bind(i),r.then(i,i)),d.state.loading|=4,d.instance=S,Cn(S);return}S=r.ownerDocument||r,g=mb(g),(_=ci.get(_))&&Lm(g,_),S=S.createElement("link"),Cn(S);var z=S;z._p=new Promise(function(Y,ee){z.onload=Y,z.onerror=ee}),Kn(S,"link",g),d.instance=S}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(d,r),(r=d.state.preload)&&(d.state.loading&3)===0&&(i.count++,d=df.bind(i),r.addEventListener("load",d),r.addEventListener("error",d))}}var Im=0;function xM(i,r){return i.stylesheets&&i.count===0&&hf(i,i.stylesheets),0<i.count||0<i.imgCount?function(d){var g=setTimeout(function(){if(i.stylesheets&&hf(i,i.stylesheets),i.unsuspend){var S=i.unsuspend;i.unsuspend=null,S()}},6e4+r);0<i.imgBytes&&Im===0&&(Im=62500*Wk());var _=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&hf(i,i.stylesheets),i.unsuspend)){var S=i.unsuspend;i.unsuspend=null,S()}},(i.imgBytes>Im?50:800)+r);return i.unsuspend=d,function(){i.unsuspend=null,clearTimeout(g),clearTimeout(_)}}:null}function df(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hf(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var ff=null;function hf(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,ff=new Map,r.forEach(bM,i),ff=null,df.call(i))}function bM(i,r){if(!(r.state.loading&4)){var d=ff.get(i);if(d)var g=d.get(null);else{d=new Map,ff.set(i,d);for(var _=i.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<_.length;S++){var z=_[S];(z.nodeName==="LINK"||z.getAttribute("media")!=="not all")&&(d.set(z.dataset.precedence,z),g=z)}g&&d.set(null,g)}_=r.instance,z=_.getAttribute("data-precedence"),S=d.get(z)||g,S===g&&d.set(null,_),d.set(z,_),this.count++,g=df.bind(this),_.addEventListener("load",g),_.addEventListener("error",g),S?S.parentNode.insertBefore(_,S.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(_,i.firstChild)),r.state.loading|=4}}var eu={$$typeof:k,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function _M(i,r,d,g,_,S,z,Y,ee){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Li(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Li(0),this.hiddenUpdates=Li(null),this.identifierPrefix=g,this.onUncaughtError=_,this.onCaughtError=S,this.onRecoverableError=z,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ee,this.incompleteTransitions=new Map}function bb(i,r,d,g,_,S,z,Y,ee,pe,Ce,Ee){return i=new _M(i,r,d,z,ee,pe,Ce,Ee,Y),r=1,S===!0&&(r|=24),S=Oa(3,null,null,r),i.current=S,S.stateNode=i,r=mp(),r.refCount++,i.pooledCache=r,r.refCount++,S.memoizedState={element:g,isDehydrated:d,cache:r},xp(S),i}function _b(i){return i?(i=nl,i):nl}function wb(i,r,d,g,_,S){_=_b(_),g.context===null?g.context=_:g.pendingContext=_,g=Qs(r),g.payload={element:d},S=S===void 0?null:S,S!==null&&(g.callback=S),d=Zs(i,g,r),d!==null&&(xa(d,i,r),Ac(d,i,r))}function Sb(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d<r?d:r}}function zm(i,r){Sb(i,r),(i=i.alternate)&&Sb(i,r)}function Cb(i){if(i.tag===13||i.tag===31){var r=eo(i,67108864);r!==null&&xa(r,i,67108864),zm(i,67108864)}}function Nb(i){if(i.tag===13||i.tag===31){var r=Fa();r=wn(r);var d=eo(i,r);d!==null&&xa(d,i,r),zm(i,r)}}var pf=!0;function wM(i,r,d,g){var _=P.T;P.T=null;var S=G.p;try{G.p=2,Bm(i,r,d,g)}finally{G.p=S,P.T=_}}function SM(i,r,d,g){var _=P.T;P.T=null;var S=G.p;try{G.p=8,Bm(i,r,d,g)}finally{G.p=S,P.T=_}}function Bm(i,r,d,g){if(pf){var _=Um(g);if(_===null)Cm(i,r,g,mf,d),Mb(i,g);else if(NM(_,i,r,d,g))g.stopPropagation();else if(Mb(i,g),r&4&&-1<CM.indexOf(i)){for(;_!==null;){var S=Aa(_);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var z=rn(S.pendingLanes);if(z!==0){var Y=S;for(Y.pendingLanes|=2,Y.entangledLanes|=2;z;){var ee=1<<31-ht(z);Y.entanglements[1]|=ee,z&=~ee}Gi(S),(Dt&6)===0&&(Qd=Ke()+500,Xc(0))}}break;case 31:case 13:Y=eo(S,2),Y!==null&&xa(Y,S,2),Jd(),zm(S,2)}if(S=Um(g),S===null&&Cm(i,r,g,mf,d),S===_)break;_=S}_!==null&&g.stopPropagation()}else Cm(i,r,g,null,d)}}function Um(i){return i=Bs(i),Fm(i)}var mf=null;function Fm(i){if(mf=null,i=Ja(i),i!==null){var r=o(i);if(r===null)i=null;else{var d=r.tag;if(d===13){if(i=l(r),i!==null)return i;i=null}else if(d===31){if(i=c(r),i!==null)return i;i=null}else if(d===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return mf=i,null}function kb(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(dt()){case ye:return 2;case Se:return 8;case Be:case at:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var $m=!1,lr=null,cr=null,ur=null,tu=new Map,nu=new Map,dr=[],CM="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Mb(i,r){switch(i){case"focusin":case"focusout":lr=null;break;case"dragenter":case"dragleave":cr=null;break;case"mouseover":case"mouseout":ur=null;break;case"pointerover":case"pointerout":tu.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":nu.delete(r.pointerId)}}function au(i,r,d,g,_,S){return i===null||i.nativeEvent!==S?(i={blockedOn:r,domEventName:d,eventSystemFlags:g,nativeEvent:S,targetContainers:[_]},r!==null&&(r=Aa(r),r!==null&&Cb(r)),i):(i.eventSystemFlags|=g,r=i.targetContainers,_!==null&&r.indexOf(_)===-1&&r.push(_),i)}function NM(i,r,d,g,_){switch(r){case"focusin":return lr=au(lr,i,r,d,g,_),!0;case"dragenter":return cr=au(cr,i,r,d,g,_),!0;case"mouseover":return ur=au(ur,i,r,d,g,_),!0;case"pointerover":var S=_.pointerId;return tu.set(S,au(tu.get(S)||null,i,r,d,g,_)),!0;case"gotpointercapture":return S=_.pointerId,nu.set(S,au(nu.get(S)||null,i,r,d,g,_)),!0}return!1}function jb(i){var r=Ja(i.target);if(r!==null){var d=o(r);if(d!==null){if(r=d.tag,r===13){if(r=l(d),r!==null){i.blockedOn=r,bi(i.priority,function(){Nb(d)});return}}else if(r===31){if(r=c(d),r!==null){i.blockedOn=r,bi(i.priority,function(){Nb(d)});return}}else if(r===3&&d.stateNode.current.memoizedState.isDehydrated){i.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}i.blockedOn=null}function gf(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var d=Um(i.nativeEvent);if(d===null){d=i.nativeEvent;var g=new d.constructor(d.type,d);Ui=g,d.target.dispatchEvent(g),Ui=null}else return r=Aa(d),r!==null&&Cb(r),i.blockedOn=d,!1;r.shift()}return!0}function Eb(i,r,d){gf(i)&&d.delete(r)}function kM(){$m=!1,lr!==null&&gf(lr)&&(lr=null),cr!==null&&gf(cr)&&(cr=null),ur!==null&&gf(ur)&&(ur=null),tu.forEach(Eb),nu.forEach(Eb)}function yf(i,r){i.blockedOn===r&&(i.blockedOn=null,$m||($m=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,kM)))}var vf=null;function Rb(i){vf!==i&&(vf=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){vf===i&&(vf=null);for(var r=0;r<i.length;r+=3){var d=i[r],g=i[r+1],_=i[r+2];if(typeof g!="function"){if(Fm(g||d)===null)continue;break}var S=Aa(d);S!==null&&(i.splice(r,3),r-=3,Up(S,{pending:!0,data:_,method:d.method,action:g},g,_))}}))}function kl(i){function r(ee){return yf(ee,i)}lr!==null&&yf(lr,i),cr!==null&&yf(cr,i),ur!==null&&yf(ur,i),tu.forEach(r),nu.forEach(r);for(var d=0;d<dr.length;d++){var g=dr[d];g.blockedOn===i&&(g.blockedOn=null)}for(;0<dr.length&&(d=dr[0],d.blockedOn===null);)jb(d),d.blockedOn===null&&dr.shift();if(d=(i.ownerDocument||i).$$reactFormReplay,d!=null)for(g=0;g<d.length;g+=3){var _=d[g],S=d[g+1],z=_[Ue]||null;if(typeof S=="function")z||Rb(d);else if(z){var Y=null;if(S&&S.hasAttribute("formAction")){if(_=S,z=S[Ue]||null)Y=z.formAction;else if(Fm(_)!==null)continue}else Y=z.action;typeof Y=="function"?d[g+1]=Y:(d.splice(g,3),g-=3),Rb(d)}}}function Tb(){function i(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(z){return _=z})},focusReset:"manual",scroll:"manual"})}function r(){_!==null&&(_(),_=null),g||setTimeout(d,20)}function d(){if(!g&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var g=!1,_=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(d,100),function(){g=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),_!==null&&(_(),_=null)}}}function Pm(i){this._internalRoot=i}xf.prototype.render=Pm.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(a(409));var d=r.current,g=Fa();wb(d,g,i,r,null,null)},xf.prototype.unmount=Pm.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;wb(i.current,2,null,i,null,null),Jd(),r[Je]=null}};function xf(i){this._internalRoot=i}xf.prototype.unstable_scheduleHydration=function(i){if(i){var r=Ii();i={blockedOn:null,target:i,priority:r};for(var d=0;d<dr.length&&r!==0&&r<dr[d].priority;d++);dr.splice(d,0,i),d===0&&jb(i)}};var Ab=t.version;if(Ab!=="19.2.4")throw Error(a(527,Ab,"19.2.4"));G.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(a(188)):(i=Object.keys(i).join(","),Error(a(268,i)));return i=f(r),i=i!==null?m(i):null,i=i===null?null:i.stateNode,i};var MM={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var bf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bf.isDisabled&&bf.supportsFiber)try{Et=bf.inject(MM),qe=bf}catch(i){}}return su.createRoot=function(i,r){if(!s(i))throw Error(a(299));var d=!1,g="",_=U0,S=F0,z=$0;return r!=null&&(r.unstable_strictMode===!0&&(d=!0),r.identifierPrefix!==void 0&&(g=r.identifierPrefix),r.onUncaughtError!==void 0&&(_=r.onUncaughtError),r.onCaughtError!==void 0&&(S=r.onCaughtError),r.onRecoverableError!==void 0&&(z=r.onRecoverableError)),r=bb(i,1,!1,null,null,d,g,null,_,S,z,Tb),i[Je]=r.current,Sm(i),new Pm(r)},su.hydrateRoot=function(i,r,d){if(!s(i))throw Error(a(299));var g=!1,_="",S=U0,z=F0,Y=$0,ee=null;return d!=null&&(d.unstable_strictMode===!0&&(g=!0),d.identifierPrefix!==void 0&&(_=d.identifierPrefix),d.onUncaughtError!==void 0&&(S=d.onUncaughtError),d.onCaughtError!==void 0&&(z=d.onCaughtError),d.onRecoverableError!==void 0&&(Y=d.onRecoverableError),d.formState!==void 0&&(ee=d.formState)),r=bb(i,1,!0,r,d!=null?d:null,g,_,ee,S,z,Y,Tb),r.context=_b(null),d=r.current,g=Fa(),g=wn(g),_=Qs(g),_.callback=null,Zs(d,_,g),d=g,r.current.lanes=d,nn(r,d),Gi(r),i[Je]=r.current,Sm(i),new xf(r)},su.version="19.2.4",su}var $b;function UM(){if($b)return Gm.exports;$b=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Gm.exports=BM(),Gm.exports}var FM=UM();const $M=DM(FM),ty=new WeakMap,PM=new WeakMap,eh={current:[]};let Km=!1,Su=0;const gu=new Set,Sf=new Map;function TS(e){for(const t of e){if(eh.current.includes(t))continue;eh.current.push(t),t.recompute();const n=PM.get(t);if(n)for(const a of n){const s=ty.get(a);s!=null&&s.length&&TS(s)}}}function HM(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function qM(e){const t={prevVal:e.prevState,currentVal:e.state};for(const n of e.listeners)n(t)}function AS(e){var t;if(Su>0&&!Sf.has(e)&&Sf.set(e,e.prevState),gu.add(e),!(Su>0)&&!Km)try{for(Km=!0;gu.size>0;){const n=Array.from(gu);gu.clear();for(const a of n){const s=(t=Sf.get(a))!=null?t:a.prevState;a.prevState=s,HM(a)}for(const a of n){const s=ty.get(a);s&&(eh.current.push(a),TS(s))}for(const a of n){const s=ty.get(a);if(s)for(const o of s)qM(o)}}}finally{Km=!1,eh.current=[],Sf.clear()}}function VM(e){Su++;try{e()}finally{if(Su--,Su===0){const t=gu.values().next().value;t&&AS(t)}}}function GM(e){return typeof e=="function"}class YM{constructor(t,n){this.listeners=new Set,this.subscribe=a=>{var s,o;this.listeners.add(a);const l=(o=(s=this.options)==null?void 0:s.onSubscribe)==null?void 0:o.call(s,a,this);return()=>{this.listeners.delete(a),l==null||l()}},this.prevState=t,this.state=t,this.options=n}setState(t){var n,a,s;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(t):GM(t)?this.state=t(this.prevState):this.state=t,(s=(a=this.options)==null?void 0:a.onUpdate)==null||s.call(a),AS(this)}}const Tr="__TSR_index",Pb="popstate",Hb="beforeunload";function XM(e){let t=e.getLocation();const n=new Set,a=l=>{t=e.getLocation(),n.forEach(c=>c({location:t,action:l}))},s=l=>{var c;(c=e.notifyOnIndexChange)==null||c?a(l):t=e.getLocation()},o=f=>ut(null,null,function*(){var m=f,{task:l,navigateOpts:c}=m,u=Me(m,["task","navigateOpts"]);var x,b,w,C;if((x=c==null?void 0:c.ignoreBlocker)!=null?x:!1){l();return}const y=(w=(b=e.getBlockers)==null?void 0:b.call(e))!=null?w:[],v=u.type==="PUSH"||u.type==="REPLACE";if(typeof document!="undefined"&&y.length&&v)for(const N of y){const k=Eu(u.path,u.state);if(yield N.blockerFn({currentLocation:t,nextLocation:k,action:u.type})){(C=e.onBlocked)==null||C.call(e);return}}l()});return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:l=>(n.add(l),()=>{n.delete(l)}),push:(l,c,u)=>{const f=t.state[Tr];c=qb(f+1,c),o({task:()=>{e.pushState(l,c),a({type:"PUSH"})},navigateOpts:u,type:"PUSH",path:l,state:c})},replace:(l,c,u)=>{const f=t.state[Tr];c=qb(f,c),o({task:()=>{e.replaceState(l,c),a({type:"REPLACE"})},navigateOpts:u,type:"REPLACE",path:l,state:c})},go:(l,c)=>{o({task:()=>{e.go(l),s({type:"GO",index:l})},navigateOpts:c,type:"GO"})},back:l=>{o({task:()=>{var c;e.back((c=l==null?void 0:l.ignoreBlocker)!=null?c:!1),s({type:"BACK"})},navigateOpts:l,type:"BACK"})},forward:l=>{o({task:()=>{var c;e.forward((c=l==null?void 0:l.ignoreBlocker)!=null?c:!1),s({type:"FORWARD"})},navigateOpts:l,type:"FORWARD"})},canGoBack:()=>t.state[Tr]!==0,createHref:l=>e.createHref(l),block:l=>{var u,f;if(!e.setBlockers)return()=>{};const c=(f=(u=e.getBlockers)==null?void 0:u.call(e))!=null?f:[];return e.setBlockers([...c,l]),()=>{var p,y,v;const m=(y=(p=e.getBlockers)==null?void 0:p.call(e))!=null?y:[];(v=e.setBlockers)==null||v.call(e,m.filter(x=>x!==l))}},flush:()=>{var l;return(l=e.flush)==null?void 0:l.call(e)},destroy:()=>{var l;return(l=e.destroy)==null?void 0:l.call(e)},notify:a}}function qb(e,t){t||(t={});const n=iv();return Z(F({},t),{key:n,__TSR_key:n,[Tr]:e})}function DS(e){var O,R,E,I,L;const t=(O=e==null?void 0:e.window)!=null?O:typeof document!="undefined"?window:void 0,n=t.history.pushState,a=t.history.replaceState;let s=[];const o=()=>s,l=H=>s=H,c=(R=e==null?void 0:e.createHref)!=null?R:(H=>H),u=(E=e==null?void 0:e.parseLocation)!=null?E:(()=>Eu(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((I=t.history.state)!=null&&I.__TSR_key)&&!((L=t.history.state)!=null&&L.key)){const H=iv();t.history.replaceState({[Tr]:0,key:H,__TSR_key:H},"")}let f=u(),m,p=!1,y=!1,v=!1,x=!1;const b=()=>f;let w,C;const N=()=>{w&&(A._ignoreSubscribers=!0,(w.isPush?t.history.pushState:t.history.replaceState)(w.state,"",w.href),A._ignoreSubscribers=!1,w=void 0,C=void 0,m=void 0)},k=(H,U,$)=>{const P=c(U);C||(m=f),f=Eu(U,$),w={href:P,state:$,isPush:(w==null?void 0:w.isPush)||H==="push"},C||(C=Promise.resolve().then(()=>N()))},M=H=>{f=u(),A.notify({type:H})},D=()=>ut(null,null,function*(){if(y){y=!1;return}const H=u(),U=H.state[Tr]-f.state[Tr],$=U===1,P=U===-1,G=!$&&!P||p;p=!1;const K=G?"GO":P?"BACK":"FORWARD",se=G?{type:"GO",index:U}:{type:P?"BACK":"FORWARD"};if(v)v=!1;else{const V=o();if(typeof document!="undefined"&&V.length){for(const re of V)if(yield re.blockerFn({currentLocation:f,nextLocation:H,action:K})){y=!0,t.history.go(1),A.notify(se);return}}}f=u(),A.notify(se)}),j=H=>{var P;if(x){x=!1;return}let U=!1;const $=o();if(typeof document!="undefined"&&$.length)for(const G of $){const K=(P=G.enableBeforeUnload)!=null?P:!0;if(K===!0){U=!0;break}if(typeof K=="function"&&K()===!0){U=!0;break}}if(U)return H.preventDefault(),H.returnValue=""},A=XM({getLocation:b,getLength:()=>t.history.length,pushState:(H,U)=>k("push",H,U),replaceState:(H,U)=>k("replace",H,U),back:H=>(H&&(v=!0),x=!0,t.history.back()),forward:H=>{H&&(v=!0),x=!0,t.history.forward()},go:H=>{p=!0,t.history.go(H)},createHref:H=>c(H),flush:N,destroy:()=>{t.history.pushState=n,t.history.replaceState=a,t.removeEventListener(Hb,j,{capture:!0}),t.removeEventListener(Pb,D)},onBlocked:()=>{m&&f!==m&&(f=m)},getBlockers:o,setBlockers:l,notifyOnIndexChange:!1});return t.addEventListener(Hb,j,{capture:!0}),t.addEventListener(Pb,D),t.history.pushState=function(...H){const U=n.apply(t.history,H);return A._ignoreSubscribers||M("PUSH"),U},t.history.replaceState=function(...H){const U=a.apply(t.history,H);return A._ignoreSubscribers||M("REPLACE"),U},A}function KM(e){const t=typeof document!="undefined"?window:void 0;return DS({window:t,parseLocation:()=>{var u;const n=t.location.hash.split("#").slice(1),a=(u=n[0])!=null?u:"/",s=t.location.search,o=n.slice(1),l=o.length===0?"":`#${o.join("#")}`,c=`${a}${s}${l}`;return Eu(c,t.history.state)},createHref:n=>`${t.location.pathname}${t.location.search}#${n}`})}function QM(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Eu(e,t){const n=QM(e),a=n.indexOf("#"),s=n.indexOf("?"),o=iv();return{href:n,pathname:n.substring(0,a>0?s>0?Math.min(a,s):a:s>0?s:n.length),hash:a>-1?n.substring(a):"",search:s>-1?n.slice(s,a===-1?void 0:a):"",state:t||{[Tr]:0,key:o,__TSR_key:o}}}function iv(){return(Math.random()+1).toString(36).substring(7)}const Qm=!1;function Cu(e){let t;return VM(()=>{t=e()}),t}function Ru(e){return e[e.length-1]}function ZM(e){return typeof e=="function"}function jr(e,t){return ZM(e)?e(t):e}const JM=Object.prototype.hasOwnProperty,Vb=Object.prototype.propertyIsEnumerable;function Ha(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=t,s=Xb(e)&&Xb(a);if(!s&&!(th(e)&&th(a)))return a;const o=s?e:Gb(e);if(!o)return a;const l=s?a:Gb(a);if(!l)return a;const c=o.length,u=l.length,f=s?new Array(u):{};let m=0;for(let p=0;p<u;p++){const y=s?p:l[p],v=e[y],x=a[y];if(v===x){f[y]=v,(s?p<c:JM.call(e,y))&&m++;continue}if(v===null||x===null||typeof v!="object"||typeof x!="object"){f[y]=x;continue}const b=Ha(v,x,n+1);f[y]=b,b===v&&m++}return c===u&&m===c?e:f}function Gb(e){const t=Object.getOwnPropertyNames(e);for(const s of t)if(!Vb.call(e,s))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const a=t;for(const s of n){if(!Vb.call(e,s))return!1;a.push(s)}return a}function th(e){if(!Yb(e))return!1;const t=e.constructor;if(typeof t=="undefined")return!0;const n=t.prototype;return!(!Yb(n)||!n.hasOwnProperty("isPrototypeOf"))}function Yb(e){return Object.prototype.toString.call(e)==="[object Object]"}function Xb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function To(e,t,n){var a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let s=0,o=e.length;s<o;s++)if(!To(e[s],t[s],n))return!1;return!0}if(th(e)&&th(t)){const s=(a=n==null?void 0:n.ignoreUndefined)!=null?a:!0;if(n!=null&&n.partial){for(const c in t)if((!s||t[c]!==void 0)&&!To(e[c],t[c],n))return!1;return!0}let o=0;if(!s)o=Object.keys(e).length;else for(const c in e)e[c]!==void 0&&o++;let l=0;for(const c in t)if((!s||t[c]!==void 0)&&(l++,l>o||!To(e[c],t[c],n)))return!1;return o===l}return!1}function Wl(e){let t,n;const a=new Promise((s,o)=>{t=s,n=o});return a.status="pending",a.resolve=s=>{a.status="resolved",a.value=s,t(s),e==null||e(s)},a.reject=s=>{a.status="rejected",n(s)},a}function Bl(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function WM(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function Kb(e){let t;try{t=decodeURI(e)}catch(n){t=e.replaceAll(/%[0-9A-F]{2}/gi,a=>{try{return decodeURI(a)}catch(s){return a}})}return WM(t)}const LS=["http:","https:","mailto:","tel:"];function nh(e){if(!e)return!1;try{const t=new URL(e);return!LS.includes(t.protocol)}catch(t){return!1}}function ru(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,a="",s;for(;(s=t.exec(e))!==null;)a+=Kb(e.slice(n,s.index))+s[0],n=t.lastIndex;a=a+Kb(n?e.slice(n):e);let o=!1;return a.startsWith("//")&&(o=!0,a="/"+a.replace(/^\/+/,"")),{path:a,handledProtocolRelativeURL:o}}function ej(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}var tj="Invariant failed";function As(e,t){if(!e)throw new Error(tj)}function ah(e){const t=new Map;let n,a;const s=o=>{o.next&&(o.prev?(o.prev.next=o.next,o.next.prev=o.prev,o.next=void 0,a&&(a.next=o,o.prev=a)):(o.next.prev=void 0,n=o.next,o.next=void 0,a&&(o.prev=a,a.next=o)),a=o)};return{get(o){const l=t.get(o);if(l)return s(l),l.value},set(o,l){if(t.size>=e&&n){const u=n;t.delete(u.key),u.next&&(n=u.next,u.next.prev=void 0),u===a&&(a=void 0)}const c=t.get(o);if(c)c.value=l,s(c);else{const u={key:o,value:l,prev:a};a&&(a.next=u),a=u,n||(n=u),t.set(o,u)}},clear(){t.clear(),n=void 0,a=void 0}}}const ec=0,Io=1,zo=2,Tu=3,vo=4,OS=5;function nj(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function sv(e,t,n=new Uint16Array(6)){const a=e.indexOf("/",t),s=a===-1?e.length:a,o=e.substring(t,s);if(!o||!o.includes("$"))return n[0]=ec,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(o==="$"){const c=e.length;return n[0]=zo,n[1]=t,n[2]=t,n[3]=c,n[4]=c,n[5]=c,n}if(o.charCodeAt(0)===36)return n[0]=Io,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const l=nj(o);if(l){const[c,u]=l,f=o.charCodeAt(c+1);if(f===45){if(c+2<o.length&&o.charCodeAt(c+2)===36){const m=c+3,p=u;if(m<p)return n[0]=Tu,n[1]=t+c,n[2]=t+m,n[3]=t+p,n[4]=t+u+1,n[5]=s,n}}else if(f===36){const m=c+1,p=c+2;return p===u?(n[0]=zo,n[1]=t+c,n[2]=t+m,n[3]=t+p,n[4]=t+u+1,n[5]=e.length,n):(n[0]=Io,n[1]=t+c,n[2]=t+p,n[3]=t+u,n[4]=t+u+1,n[5]=s,n)}}return n[0]=ec,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n}function Ch(e,t,n,a,s,o,l){var u,f,m,p,y,v,x,b,w,C,N,k,M,D,j,A,O,R,E,I,L,H,U,$,P,G,K,se,V,re,fe;l==null||l(n);let c=a;{const B=(u=n.fullPath)!=null?u:n.from,W=B.length,ae=(m=(f=n.options)==null?void 0:f.caseSensitive)!=null?m:e,J=!!((y=(p=n.options)==null?void 0:p.params)!=null&&y.parse&&((x=(v=n.options)==null?void 0:v.skipRouteOnParseError)!=null&&x.params));for(;c<W;){const be=sv(B,c,t);let je;const De=c,Ae=be[5];switch(c=Ae+1,o++,be[0]){case ec:{const Fe=B.substring(be[2],be[3]);if(ae){const me=(b=s.static)==null?void 0:b.get(Fe);if(me)je=me;else{(w=s.static)!=null||(s.static=new Map);const Q=xo((C=n.fullPath)!=null?C:n.from);Q.parent=s,Q.depth=o,je=Q,s.static.set(Fe,Q)}}else{const me=Fe.toLowerCase(),Q=(N=s.staticInsensitive)==null?void 0:N.get(me);if(Q)je=Q;else{(k=s.staticInsensitive)!=null||(s.staticInsensitive=new Map);const ue=xo((M=n.fullPath)!=null?M:n.from);ue.parent=s,ue.depth=o,je=ue,s.staticInsensitive.set(me,ue)}}break}case Io:{const Fe=B.substring(De,be[1]),me=B.substring(be[4],Ae),Q=ae&&!!(Fe||me),ue=Fe?Q?Fe:Fe.toLowerCase():void 0,xe=me?Q?me:me.toLowerCase():void 0,ze=!J&&((D=s.dynamic)==null?void 0:D.find(X=>!X.skipOnParamError&&X.caseSensitive===Q&&X.prefix===ue&&X.suffix===xe));if(ze)je=ze;else{const X=Jm(Io,(j=n.fullPath)!=null?j:n.from,Q,ue,xe);je=X,X.depth=o,X.parent=s,(A=s.dynamic)!=null||(s.dynamic=[]),s.dynamic.push(X)}break}case Tu:{const Fe=B.substring(De,be[1]),me=B.substring(be[4],Ae),Q=ae&&!!(Fe||me),ue=Fe?Q?Fe:Fe.toLowerCase():void 0,xe=me?Q?me:me.toLowerCase():void 0,ze=!J&&((O=s.optional)==null?void 0:O.find(X=>!X.skipOnParamError&&X.caseSensitive===Q&&X.prefix===ue&&X.suffix===xe));if(ze)je=ze;else{const X=Jm(Tu,(R=n.fullPath)!=null?R:n.from,Q,ue,xe);je=X,X.parent=s,X.depth=o,(E=s.optional)!=null||(s.optional=[]),s.optional.push(X)}break}case zo:{const Fe=B.substring(De,be[1]),me=B.substring(be[4],Ae),Q=ae&&!!(Fe||me),ue=Fe?Q?Fe:Fe.toLowerCase():void 0,xe=me?Q?me:me.toLowerCase():void 0,ze=Jm(zo,(I=n.fullPath)!=null?I:n.from,Q,ue,xe);je=ze,ze.parent=s,ze.depth=o,(L=s.wildcard)!=null||(s.wildcard=[]),s.wildcard.push(ze)}}s=je}if(J&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const be=xo((H=n.fullPath)!=null?H:n.from);be.kind=OS,be.parent=s,o++,be.depth=o,(U=s.pathless)!=null||(s.pathless=[]),s.pathless.push(be),s=be}const le=(n.path||!n.children)&&!n.isRoot;if(le&&B.endsWith("/")){const be=xo(($=n.fullPath)!=null?$:n.from);be.kind=vo,be.parent=s,o++,be.depth=o,s.index=be,s=be}s.parse=(K=(G=(P=n.options)==null?void 0:P.params)==null?void 0:G.parse)!=null?K:null,s.skipOnParamError=J,s.parsingPriority=(re=(V=(se=n.options)==null?void 0:se.skipRouteOnParseError)==null?void 0:V.priority)!=null?re:0,le&&!s.route&&(s.route=n,s.fullPath=(fe=n.fullPath)!=null?fe:n.from)}if(n.children)for(const B of n.children)Ch(e,t,B,c,s,o,l)}function Zm(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function vr(e){var t,n,a;if(e.pathless)for(const s of e.pathless)vr(s);if(e.static)for(const s of e.static.values())vr(s);if(e.staticInsensitive)for(const s of e.staticInsensitive.values())vr(s);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(Zm);for(const s of e.dynamic)vr(s)}if((n=e.optional)!=null&&n.length){e.optional.sort(Zm);for(const s of e.optional)vr(s)}if((a=e.wildcard)!=null&&a.length){e.wildcard.sort(Zm);for(const s of e.wildcard)vr(s)}}function xo(e){return{kind:ec,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function Jm(e,t,n,a,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:a,suffix:s}}function aj(e,t){const n=xo("/"),a=new Uint16Array(6);for(const s of e)Ch(!1,a,s,1,n,0);vr(n),t.masksTree=n,t.flatCache=ah(1e3)}function ij(e,t){e||(e="/");const n=t.flatCache.get(e);if(n)return n;const a=rv(e,t.masksTree);return t.flatCache.set(e,a),a}function sj(e,t,n,a,s){e||(e="/"),a||(a="/");const o=t?`case\0${e}`:e;let l=s.singleCache.get(o);if(!l){l=xo("/");const c=new Uint16Array(6);Ch(t,c,{from:e},1,l,0),s.singleCache.set(o,l)}return rv(a,l,n)}function rj(e,t,n=!1){const a=n?e:`nofuzz\0${e}`,s=t.matchCache.get(a);if(s!==void 0)return s;e||(e="/");let o;try{o=rv(e,t.segmentTree,n)}catch(l){if(l instanceof URIError)o=null;else throw l}return o&&(o.branch=cj(o.route)),t.matchCache.set(a,o),o}function oj(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function lj(e,t=!1,n){const a=xo(e.fullPath),s=new Uint16Array(6),o={},l={};let c=0;return Ch(t,s,e,1,a,0,f=>{if(n==null||n(f,c),As(!(f.id in o),`Duplicate routes found with id: ${String(f.id)}`),o[f.id]=f,c!==0&&f.path){const m=oj(f.fullPath);(!l[m]||f.fullPath.endsWith("/"))&&(l[m]=f)}c++}),vr(a),{processedTree:{segmentTree:a,singleCache:ah(1e3),matchCache:ah(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:l}}function rv(e,t,n=!1){const a=e.split("/"),s=dj(e,a,t,n);if(!s)return null;const[o]=IS(e,a,s);return{route:s.node.route,rawParams:o,parsedParams:s.parsedParams}}function IS(e,t,n){var m,p,y,v,x,b,w,C,N,k,M,D,j,A,O,R,E,I,L,H;const a=uj(n.node);let s=null;const o={};let l=(p=(m=n.extract)==null?void 0:m.part)!=null?p:0,c=(v=(y=n.extract)==null?void 0:y.node)!=null?v:0,u=(b=(x=n.extract)==null?void 0:x.path)!=null?b:0,f=(C=(w=n.extract)==null?void 0:w.segment)!=null?C:0;for(;c<a.length;l++,c++,u++,f++){const U=a[c];if(U.kind===vo)break;if(U.kind===OS){f--,l--,u--;continue}const $=t[l],P=u;if($&&(u+=$.length),U.kind===Io){s!=null||(s=n.node.fullPath.split("/"));const G=s[f],K=(k=(N=U.prefix)==null?void 0:N.length)!=null?k:0;if(G.charCodeAt(K)===123){const V=(D=(M=U.suffix)==null?void 0:M.length)!=null?D:0,re=G.substring(K+2,G.length-V-1),fe=$.substring(K,$.length-V);o[re]=decodeURIComponent(fe)}else{const V=G.substring(1);o[V]=decodeURIComponent($)}}else if(U.kind===Tu){if(n.skipped&1<<c){l--,u=P-1;continue}s!=null||(s=n.node.fullPath.split("/"));const G=s[f],K=(A=(j=U.prefix)==null?void 0:j.length)!=null?A:0,se=(R=(O=U.suffix)==null?void 0:O.length)!=null?R:0,V=G.substring(K+3,G.length-se-1),re=U.suffix||U.prefix?$.substring(K,$.length-se):$;re&&(o[V]=decodeURIComponent(re))}else if(U.kind===zo){const G=U,K=e.substring(P+((I=(E=G.prefix)==null?void 0:E.length)!=null?I:0),e.length-((H=(L=G.suffix)==null?void 0:L.length)!=null?H:0)),se=decodeURIComponent(K);o["*"]=se,o._splat=se;break}}return n.rawParams&&Object.assign(o,n.rawParams),[o,{part:l,node:c,path:u,segment:f}]}function cj(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function uj(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function dj(e,t,n,a){var p;if(e==="/"&&n.index)return{node:n.index,skipped:0};const s=!Ru(t),o=s&&e!=="/",l=t.length-(s?1:0),c=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let u=null,f=null,m=null;for(;c.length;){const y=c.pop(),{node:v,index:x,skipped:b,depth:w,statics:C,dynamics:N,optionals:k}=y;let{extract:M,rawParams:D,parsedParams:j}=y;if(v.skipOnParamError){if(!Wm(e,t,y))continue;D=y.rawParams,M=y.extract,j=y.parsedParams}a&&v.route&&v.kind!==vo&&ou(f,y)&&(f=y);const A=x===l;if(A&&(v.route&&!o&&ou(m,y)&&(m=y),!v.optional&&!v.wildcard&&!v.index&&!v.pathless))continue;const O=A?void 0:t[x];let R;if(A&&v.index){const E={node:v.index,index:x,skipped:b,depth:w+1,statics:C,dynamics:N,optionals:k,extract:M,rawParams:D,parsedParams:j};let I=!0;if(v.index.skipOnParamError&&(Wm(e,t,E)||(I=!1)),I){if(C===l&&!N&&!k&&!b)return E;ou(m,E)&&(m=E)}}if(v.wildcard&&ou(u,y))for(const E of v.wildcard){const{prefix:I,suffix:L}=E;if(I&&(A||!(E.caseSensitive?O:R!=null?R:R=O.toLowerCase()).startsWith(I)))continue;if(L){if(A)continue;const U=t.slice(x).join("/").slice(-L.length);if((E.caseSensitive?U:U.toLowerCase())!==L)continue}const H={node:E,index:l,skipped:b,depth:w,statics:C,dynamics:N,optionals:k,extract:M,rawParams:D,parsedParams:j};if(!(E.skipOnParamError&&!Wm(e,t,H))){u=H;break}}if(v.optional){const E=b|1<<w,I=w+1;for(let L=v.optional.length-1;L>=0;L--){const H=v.optional[L];c.push({node:H,index:x,skipped:E,depth:I,statics:C,dynamics:N,optionals:k,extract:M,rawParams:D,parsedParams:j})}if(!A)for(let L=v.optional.length-1;L>=0;L--){const H=v.optional[L],{prefix:U,suffix:$}=H;if(U||$){const P=H.caseSensitive?O:R!=null?R:R=O.toLowerCase();if(U&&!P.startsWith(U)||$&&!P.endsWith($))continue}c.push({node:H,index:x+1,skipped:b,depth:I,statics:C,dynamics:N,optionals:k+1,extract:M,rawParams:D,parsedParams:j})}}if(!A&&v.dynamic&&O)for(let E=v.dynamic.length-1;E>=0;E--){const I=v.dynamic[E],{prefix:L,suffix:H}=I;if(L||H){const U=I.caseSensitive?O:R!=null?R:R=O.toLowerCase();if(L&&!U.startsWith(L)||H&&!U.endsWith(H))continue}c.push({node:I,index:x+1,skipped:b,depth:w+1,statics:C,dynamics:N+1,optionals:k,extract:M,rawParams:D,parsedParams:j})}if(!A&&v.staticInsensitive){const E=v.staticInsensitive.get(R!=null?R:R=O.toLowerCase());E&&c.push({node:E,index:x+1,skipped:b,depth:w+1,statics:C+1,dynamics:N,optionals:k,extract:M,rawParams:D,parsedParams:j})}if(!A&&v.static){const E=v.static.get(O);E&&c.push({node:E,index:x+1,skipped:b,depth:w+1,statics:C+1,dynamics:N,optionals:k,extract:M,rawParams:D,parsedParams:j})}if(v.pathless){const E=w+1;for(let I=v.pathless.length-1;I>=0;I--){const L=v.pathless[I];c.push({node:L,index:x,skipped:b,depth:E,statics:C,dynamics:N,optionals:k,extract:M,rawParams:D,parsedParams:j})}}}if(m&&u)return ou(u,m)?m:u;if(m)return m;if(u)return u;if(a&&f){let y=f.index;for(let x=0;x<f.index;x++)y+=t[x].length;const v=y===e.length?"/":e.slice(y);return(p=f.rawParams)!=null||(f.rawParams={}),f.rawParams["**"]=decodeURIComponent(v),f}return null}function Wm(e,t,n){try{const[a,s]=IS(e,t,n);n.rawParams=a,n.extract=s;const o=n.node.parse(a);return n.parsedParams=Object.assign({},n.parsedParams,o),!0}catch(a){return null}}function ou(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===vo)>(e.node.kind===vo)||t.node.kind===vo==(e.node.kind===vo)&&t.depth>e.depth))):!0}function qf(e){return ov(e.filter(t=>t!==void 0).join("/"))}function ov(e){return e.replace(/\/{2,}/g,"/")}function zS(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Es(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function BS(e){return Es(zS(e))}function ih(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function fj(e,t,n){return ih(e,n)===ih(t,n)}function hj({base:e,to:t,trailingSlash:n="never",cache:a}){const s=t.startsWith("/"),o=!s&&t===".";let l;if(a){l=s?t:o?e:e+"\0"+t;const p=a.get(l);if(p)return p}let c;if(o)c=e.split("/");else if(s)c=t.split("/");else{for(c=e.split("/");c.length>1&&Ru(c)==="";)c.pop();const p=t.split("/");for(let y=0,v=p.length;y<v;y++){const x=p[y];x===""?y?y===v-1&&c.push(x):c=[x]:x===".."?c.pop():x==="."||c.push(x)}}c.length>1&&(Ru(c)===""?n==="never"&&c.pop():n==="always"&&c.push(""));let u,f="";for(let p=0;p<c.length;p++){p>0&&(f+="/");const y=c[p];if(!y)continue;u=sv(y,0,u);const v=u[0];if(v===ec){f+=y;continue}const x=u[5],b=y.substring(0,u[1]),w=y.substring(u[4],x),C=y.substring(u[2],u[3]);v===Io?f+=b||w?`${b}{$${C}}${w}`:`$${C}`:v===zo?f+=b||w?`${b}{$}${w}`:"$":f+=`${b}{-$${C}}${w}`}f=ov(f);const m=f||"/";return l&&a&&a.set(l,m),m}function pj(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),a=new RegExp(n,"g");return s=>s.replace(a,o=>{var l;return(l=t.get(o))!=null?l:o})}function eg(e,t,n){const a=t[e];return typeof a!="string"?a:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(a)?a:a.split("/").map(s=>Qb(s,n)).join("/"):Qb(a,n)}function tg(s){var o=s,{path:e,params:t,decoder:n}=o,a=Me(o,["path","params","decoder"]);var v,x;let l=!1;const c={};if(!e||e==="/")return{interpolatedPath:"/",usedParams:c,isMissingParams:l};if(!e.includes("$"))return{interpolatedPath:e,usedParams:c,isMissingParams:l};const u=e.length;let f=0,m,p="";for(;f<u;){const b=f;m=sv(e,b,m);const w=m[5];if(f=w+1,b===w)continue;const C=m[0];if(C===ec){p+="/"+e.substring(b,w);continue}if(C===zo){const N=t._splat;c._splat=N,c["*"]=N;const k=e.substring(b,m[1]),M=e.substring(m[4],w);if(!N){l=!0,(k||M)&&(p+="/"+k+M);continue}const D=eg("_splat",t,n);p+="/"+k+D+M;continue}if(C===Io){const N=e.substring(m[2],m[3]);!l&&!(N in t)&&(l=!0),c[N]=t[N];const k=e.substring(b,m[1]),M=e.substring(m[4],w),D=(v=eg(N,t,n))!=null?v:"undefined";p+="/"+k+D+M;continue}if(C===Tu){const N=e.substring(m[2],m[3]),k=t[N];if(k==null)continue;c[N]=k;const M=e.substring(b,m[1]),D=e.substring(m[4],w),j=(x=eg(N,t,n))!=null?x:"";p+="/"+M+j+D;continue}}return e.endsWith("/")&&(p+="/"),{usedParams:c,interpolatedPath:p||"/",isMissingParams:l}}function Qb(e,t){var a;const n=encodeURIComponent(e);return(a=t==null?void 0:t(n))!=null?a:n}function Ga(e){return!!(e!=null&&e.isNotFound)}function mj(){try{if(typeof window!="undefined"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch(e){}}const ny="tsr-scroll-restoration-v1_3",gj=(e,t)=>{let n;return(...a)=>{n||(n=setTimeout(()=>{e(...a),n=null},t))}};function yj(){const e=mj();if(!e)return null;const t=e.getItem(ny);let n=t?JSON.parse(t):{};return{state:n,set:a=>{n=jr(a,n)||n;try{e.setItem(ny,JSON.stringify(n))}catch(s){console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Cf=yj(),vj=e=>e.state.__TSR_key||e.href;function xj(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}let sh=!1;function bj({storageKey:e,key:t,behavior:n,shouldScrollRestoration:a,scrollToTopSelectors:s,location:o}){var f,m,p;let l;try{l=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(y){console.error(y);return}const c=t||((f=window.history.state)==null?void 0:f.__TSR_key),u=l[c];sh=!0;e:{if(a&&u&&Object.keys(u).length>0){for(const x in u){const b=u[x];if(x==="window")window.scrollTo({top:b.scrollY,left:b.scrollX,behavior:n});else if(x){const w=document.querySelector(x);w&&(w.scrollLeft=b.scrollX,w.scrollTop=b.scrollY)}}break e}const y=(o!=null?o:window.location).hash.split("#",2)[1];if(y){const x=(p=(m=window.history.state)==null?void 0:m.__hashScrollIntoViewOptions)!=null?p:!0;if(x){const b=document.getElementById(y);b&&b.scrollIntoView(x)}break e}const v={top:0,left:0,behavior:n};if(window.scrollTo(v),s)for(const x of s){if(x==="window")continue;const b=typeof x=="function"?x():document.querySelector(x);b&&b.scrollTo(v)}}sh=!1}function _j(e,t){var o;if(!Cf||(((o=e.options.scrollRestoration)!=null?o:!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Cf))return;e.isScrollRestorationSetup=!0,sh=!1;const a=e.options.getScrollRestorationKey||vj;window.history.scrollRestoration="manual";const s=l=>{if(sh||!e.isScrollRestoring)return;let c="";if(l.target===document||l.target===window)c="window";else{const f=l.target.getAttribute("data-scroll-restoration-id");f?c=`[data-scroll-restoration-id="${f}"]`:c=xj(l.target)}const u=a(e.state.location);Cf.set(f=>{const m=f[u]||(f[u]={}),p=m[c]||(m[c]={});if(c==="window")p.scrollX=window.scrollX||0,p.scrollY=window.scrollY||0;else if(c){const y=document.querySelector(c);y&&(p.scrollX=y.scrollLeft||0,p.scrollY=y.scrollTop||0)}return f})};typeof document!="undefined"&&document.addEventListener("scroll",gj(s,100),!0),e.subscribe("onRendered",l=>{const c=a(l.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(bj({storageKey:ny,key:c,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Cf.set(u=>(u[c]||(u[c]={}),u)))})}function wj(e){var t;if(typeof document!="undefined"&&document.querySelector){const n=(t=e.state.location.state.__hashScrollIntoViewOptions)!=null?t:!0;if(n&&e.state.location.hash!==""){const a=document.getElementById(e.state.location.hash);a&&a.scrollIntoView(n)}}}function Sj(e,t=String){const n=new URLSearchParams;for(const a in e){const s=e[a];s!==void 0&&n.set(a,t(s))}return n.toString()}function ng(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Cj(e){const t=new URLSearchParams(e),n={};for(const[a,s]of t.entries()){const o=n[a];o==null?n[a]=ng(s):Array.isArray(o)?o.push(ng(s)):n[a]=[o,ng(s)]}return n}const Nj=Mj(JSON.parse),kj=jj(JSON.stringify,JSON.parse);function Mj(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=Cj(t);for(const a in n){const s=n[a];if(typeof s=="string")try{n[a]=e(s)}catch(o){}}return n}}function jj(e,t){const n=typeof t=="function";function a(s){if(typeof s=="object"&&s!==null)try{return e(s)}catch(o){}else if(n&&typeof s=="string")try{return t(s),e(s)}catch(o){}return s}return s=>{const o=Sj(s,a);return o?`?${o}`:""}}const fi="__root__";function Ej(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&typeof e.href=="string"&&nh(e.href))throw new Error(`Redirect blocked: unsafe protocol in href "${e.href}". Only ${LS.join(", ")} protocols are allowed.`);if(!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch(a){}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function mi(e){return e instanceof Response&&!!e.options}const Vf=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},Nh=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),Ul=(e,t,n=!0)=>{var o;const a=F({},(o=e.router.options.context)!=null?o:{}),s=n?t:t-1;for(let l=0;l<=s;l++){const c=e.matches[l];if(!c)continue;const u=e.router.getMatch(c.id);u&&Object.assign(a,u.__routeContext,u.__beforeLoadContext)}return a},US=(e,t)=>{var s,o,l;const n=(o=e.router.routesById[(s=t.routeId)!=null?s:""])!=null?o:e.router.routeTree;!n.options.notFoundComponent&&((l=e.router.options)!=null&&l.defaultNotFoundComponent)&&(n.options.notFoundComponent=e.router.options.defaultNotFoundComponent),As(n.options.notFoundComponent);const a=e.matches.find(c=>c.routeId===n.id);As(a,"Could not find match for route: "+n.id),e.updateMatch(a.id,c=>Z(F({},c),{status:"notFound",error:t,isFetching:!1})),t.routerCode==="BEFORE_LOAD"&&n.parentRoute&&(t.routeId=n.parentRoute.id,US(e,t))},Er=(e,t,n)=>{var a,s,o;if(!(!mi(n)&&!Ga(n))){if(mi(n)&&n.redirectHandled&&!n.options.reloadDocument)throw n;if(t){(a=t._nonReactive.beforeLoadPromise)==null||a.resolve(),(s=t._nonReactive.loaderPromise)==null||s.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0;const l=mi(n)?"redirected":"notFound";t._nonReactive.error=n,e.updateMatch(t.id,c=>Z(F({},c),{status:l,context:Ul(e,t.index),isFetching:!1,error:n})),Ga(n)&&!n.routeId&&(n.routeId=t.routeId),(o=t._nonReactive.loadPromise)==null||o.resolve()}throw mi(n)?(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n),n):(US(e,n),n)}},FS=(e,t)=>!!e.router.getMatch(t)._nonReactive.dehydrated,lu=(e,t,n,a)=>{var c,u,f;const{id:s,routeId:o}=e.matches[t],l=e.router.looseRoutesById[o];if(n instanceof Promise)throw n;n.routerCode=a,(c=e.firstBadMatchIndex)!=null||(e.firstBadMatchIndex=t),Er(e,e.router.getMatch(s),n);try{(f=(u=l.options).onError)==null||f.call(u,n)}catch(m){n=m,Er(e,e.router.getMatch(s),n)}e.updateMatch(s,m=>{var p,y;return(p=m._nonReactive.beforeLoadPromise)==null||p.resolve(),m._nonReactive.beforeLoadPromise=void 0,(y=m._nonReactive.loadPromise)==null||y.resolve(),Z(F({},m),{error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})})},$S=(e,t,n,a)=>{var l,c,u;if(a._nonReactive.pendingTimeout!==void 0)return;const s=(l=n.options.pendingMs)!=null?l:e.router.options.defaultPendingMs;if(!!(e.onReady&&!Nh(e,t)&&(n.options.loader||n.options.beforeLoad||qS(n))&&typeof s=="number"&&s!==1/0&&((u=n.options.pendingComponent)!=null?u:(c=e.router.options)!=null&&c.defaultPendingComponent))){const f=setTimeout(()=>{Vf(e)},s);a._nonReactive.pendingTimeout=f}},Rj=(e,t,n)=>{const a=e.router.getMatch(t);if(!a._nonReactive.beforeLoadPromise&&!a._nonReactive.loaderPromise)return;$S(e,t,n,a);const s=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&Er(e,o,o.error)};return a._nonReactive.beforeLoadPromise?a._nonReactive.beforeLoadPromise.then(s):s()},Tj=(e,t,n,a)=>{const s=e.router.getMatch(t),o=s._nonReactive.loadPromise;s._nonReactive.loadPromise=Wl(()=>{o==null||o.resolve()});const{paramsError:l,searchError:c}=s;l&&lu(e,n,l,"PARSE_PARAMS"),c&&lu(e,n,c,"VALIDATE_SEARCH"),$S(e,t,a,s);const u=new AbortController;let f=!1;const m=()=>{f||(f=!0,e.updateMatch(t,M=>Z(F({},M),{isFetching:"beforeLoad",fetchCount:M.fetchCount+1,abortController:u})))},p=()=>{var M;(M=s._nonReactive.beforeLoadPromise)==null||M.resolve(),s._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,D=>Z(F({},D),{isFetching:!1}))};if(!a.options.beforeLoad){Cu(()=>{m(),p()});return}s._nonReactive.beforeLoadPromise=Wl();const y=F(F({},Ul(e,n,!1)),s.__routeContext),{search:v,params:x,cause:b}=s,w=Nh(e,t),C=F({search:v,abortController:u,params:x,preload:w,context:y,location:e.location,navigate:M=>e.router.navigate(Z(F({},M),{_fromLocation:e.location})),buildLocation:e.router.buildLocation,cause:w?"preload":b,matches:e.matches,routeId:a.id},e.router.options.additionalContext),N=M=>{if(M===void 0){Cu(()=>{m(),p()});return}(mi(M)||Ga(M))&&(m(),lu(e,n,M,"BEFORE_LOAD")),Cu(()=>{m(),e.updateMatch(t,D=>Z(F({},D),{__beforeLoadContext:M})),p()})};let k;try{if(k=a.options.beforeLoad(C),Bl(k))return m(),k.catch(M=>{lu(e,n,M,"BEFORE_LOAD")}).then(N)}catch(M){m(),lu(e,n,M,"BEFORE_LOAD")}N(k)},Aj=(e,t)=>{const{id:n,routeId:a}=e.matches[t],s=e.router.looseRoutesById[a],o=()=>c(),l=()=>Tj(e,n,t,s),c=()=>{if(FS(e,n))return;const u=Rj(e,n,s);return Bl(u)?u.then(l):l()};return o()},Dj=(e,t,n)=>{var o,l,c,u,f,m;const a=e.router.getMatch(t);if(!a||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const s={ssr:e.router.options.ssr,matches:e.matches,match:a,params:a.params,loaderData:a.loaderData};return Promise.all([(l=(o=n.options).head)==null?void 0:l.call(o,s),(u=(c=n.options).scripts)==null?void 0:u.call(c,s),(m=(f=n.options).headers)==null?void 0:m.call(f,s)]).then(([p,y,v])=>{const x=p==null?void 0:p.meta,b=p==null?void 0:p.links,w=p==null?void 0:p.scripts,C=p==null?void 0:p.styles;return{meta:x,links:b,headScripts:w,headers:v,scripts:y,styles:C}})},PS=(e,t,n,a)=>{const s=e.matchPromises[n-1],{params:o,loaderDeps:l,abortController:c,cause:u}=e.router.getMatch(t),f=Ul(e,n),m=Nh(e,t);return F({params:o,deps:l,preload:!!m,parentMatchPromise:s,abortController:c,context:f,location:e.location,navigate:p=>e.router.navigate(Z(F({},p),{_fromLocation:e.location})),cause:m?"preload":u,route:a},e.router.options.additionalContext)},Zb=(e,t,n,a)=>ut(null,null,function*(){var s,o,l,c,u,f,m;try{const p=e.router.getMatch(t);try{(!(Qm!=null?Qm:e.router.isServer)||p.ssr===!0)&&HS(a);const y=(o=(s=a.options).loader)==null?void 0:o.call(s,PS(e,t,n,a)),v=a.options.loader&&Bl(y);if(!!(v||a._lazyPromise||a._componentsPromise||a.options.head||a.options.scripts||a.options.headers||p._nonReactive.minPendingPromise)&&e.updateMatch(t,w=>Z(F({},w),{isFetching:"loader"})),a.options.loader){const w=v?yield y:y;Er(e,e.router.getMatch(t),w),w!==void 0&&e.updateMatch(t,C=>Z(F({},C),{loaderData:w}))}a._lazyPromise&&(yield a._lazyPromise);const b=p._nonReactive.minPendingPromise;b&&(yield b),a._componentsPromise&&(yield a._componentsPromise),e.updateMatch(t,w=>Z(F({},w),{error:void 0,context:Ul(e,n),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(y){let v=y;if((v==null?void 0:v.name)==="AbortError"){if(p.abortController.signal.aborted){(l=p._nonReactive.loaderPromise)==null||l.resolve(),p._nonReactive.loaderPromise=void 0;return}e.updateMatch(t,b=>Z(F({},b),{status:b.status==="pending"?"success":b.status,isFetching:!1,context:Ul(e,n)}));return}const x=p._nonReactive.minPendingPromise;x&&(yield x),Ga(y)&&(yield(u=(c=a.options.notFoundComponent)==null?void 0:c.preload)==null?void 0:u.call(c)),Er(e,e.router.getMatch(t),y);try{(m=(f=a.options).onError)==null||m.call(f,y)}catch(b){v=b,Er(e,e.router.getMatch(t),b)}e.updateMatch(t,b=>Z(F({},b),{error:v,context:Ul(e,n),status:"error",isFetching:!1}))}}catch(p){const y=e.router.getMatch(t);y&&(y._nonReactive.loaderPromise=void 0),Er(e,y,p)}}),Lj=(e,t)=>ut(null,null,function*(){var m,p;function n(y,v,x,b){return ut(this,null,function*(){var j,A,O,R;const w=Date.now()-v.updatedAt,C=y?(A=(j=b.options.preloadStaleTime)!=null?j:e.router.options.defaultPreloadStaleTime)!=null?A:3e4:(R=(O=b.options.staleTime)!=null?O:e.router.options.defaultStaleTime)!=null?R:0,N=b.options.shouldReload,k=typeof N=="function"?N(PS(e,a,t,b)):N,{status:M,invalid:D}=x;o=M==="success"&&(D||(k!=null?k:w>C)),y&&b.options.preload===!1||(o&&!e.sync?(l=!0,ut(null,null,function*(){var E,I;try{yield Zb(e,a,t,b);const L=e.router.getMatch(a);(E=L._nonReactive.loaderPromise)==null||E.resolve(),(I=L._nonReactive.loadPromise)==null||I.resolve(),L._nonReactive.loaderPromise=void 0}catch(L){mi(L)&&(yield e.router.navigate(L.options))}})):(M!=="success"||o&&e.sync)&&(yield Zb(e,a,t,b)))})}const{id:a,routeId:s}=e.matches[t];let o=!1,l=!1;const c=e.router.looseRoutesById[s];if(!FS(e,a)){const y=e.router.getMatch(a),v=Nh(e,a);if(y._nonReactive.loaderPromise){if(y.status==="success"&&!e.sync&&!y.preload)return y;yield y._nonReactive.loaderPromise;const x=e.router.getMatch(a),b=x._nonReactive.error||x.error;b&&Er(e,x,b),x.status==="pending"&&(yield n(v,y,x,c))}else{const x=v&&!e.router.state.matches.some(w=>w.id===a),b=e.router.getMatch(a);b._nonReactive.loaderPromise=Wl(),x!==b.preload&&e.updateMatch(a,w=>Z(F({},w),{preload:x})),yield n(v,y,b,c)}}const u=e.router.getMatch(a);l||((m=u._nonReactive.loaderPromise)==null||m.resolve(),(p=u._nonReactive.loadPromise)==null||p.resolve()),clearTimeout(u._nonReactive.pendingTimeout),u._nonReactive.pendingTimeout=void 0,l||(u._nonReactive.loaderPromise=void 0),u._nonReactive.dehydrated=void 0;const f=l?u.isFetching:!1;return f!==u.isFetching||u.invalid!==!1?(e.updateMatch(a,y=>Z(F({},y),{isFetching:f,invalid:!1})),e.router.getMatch(a)):u});function Jb(e){return ut(this,null,function*(){var n;const t=Object.assign(e,{matchPromises:[]});t.router.state.matches.some(a=>a._forcePending)&&Vf(t);try{for(let u=0;u<t.matches.length;u++){const f=Aj(t,u);Bl(f)&&(yield f)}const a=(n=t.firstBadMatchIndex)!=null?n:t.matches.length;for(let u=0;u<a;u++)t.matchPromises.push(Lj(t,u));const o=(yield Promise.allSettled(t.matchPromises)).filter(u=>u.status==="rejected").map(u=>u.reason);let l;for(const u of o){if(mi(u))throw u;!l&&Ga(u)&&(l=u)}for(const u of t.matches){const{id:f,routeId:m}=u,p=t.router.looseRoutesById[m];try{const y=Dj(t,f,p);if(y){const v=yield y;t.updateMatch(f,x=>F(F({},x),v))}}catch(y){console.error(`Error executing head for route ${m}:`,y)}}if(l)throw l;const c=Vf(t);Bl(c)&&(yield c)}catch(a){if(Ga(a)&&!t.preload){const s=Vf(t);throw Bl(s)&&(yield s),a}if(mi(a))throw a}return t.matches})}function HS(e){return ut(this,null,function*(){if(!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{const s=t.options,{id:n}=s,a=Me(s,["id"]);Object.assign(e.options,a),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0),!e._componentsLoaded&&e._componentsPromise===void 0){const t=()=>{var a;const n=[];for(const s of VS){const o=(a=e.options[s])==null?void 0:a.preload;o&&n.push(o())}if(n.length)return Promise.all(n).then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0});e._componentsLoaded=!0,e._componentsPromise=void 0};e._componentsPromise=e._lazyPromise?e._lazyPromise.then(t):t()}return e._componentsPromise})}function qS(e){var t;for(const n of VS)if((t=e.options[n])!=null&&t.preload)return!0;return!1}const VS=["component","errorComponent","pendingComponent","notFoundComponent"];function Oj(e){return{input:({url:t})=>{for(const n of e)t=ay(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=GS(e[n],t);return t}}}function Ij(e){const t=BS(e.basepath),n=`/${t}`,a=`${n}/`,s=e.caseSensitive?n:n.toLowerCase(),o=e.caseSensitive?a:a.toLowerCase();return{input:({url:l})=>{const c=e.caseSensitive?l.pathname:l.pathname.toLowerCase();return c===s?l.pathname="/":c.startsWith(o)&&(l.pathname=l.pathname.slice(n.length)),l},output:({url:l})=>(l.pathname=qf(["/",t,l.pathname]),l)}}function ay(e,t){var a;const n=(a=e==null?void 0:e.input)==null?void 0:a.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function GS(e,t){var a;const n=(a=e==null?void 0:e.output)==null?void 0:a.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function Ao(e){const t=e.resolvedLocation,n=e.location,a=(t==null?void 0:t.pathname)!==n.pathname,s=(t==null?void 0:t.href)!==n.href,o=(t==null?void 0:t.hash)!==n.hash;return{fromLocation:t,toLocation:n,pathChanged:a,hrefChanged:s,hashChanged:o}}class zj{constructor(t){var n,a,s,o;this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=l=>l(),this.update=l=>{var w,C,N,k,M;l.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const c=this.options,u=(C=(w=this.basepath)!=null?w:c==null?void 0:c.basepath)!=null?C:"/",f=this.basepath===void 0,m=c==null?void 0:c.rewrite;if(this.options=F(F({},c),l),this.isServer=(N=this.options.isServer)!=null?N:typeof document=="undefined",this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=pj(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=DS()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let D;this.resolvePathCache=ah(1e3),D=this.buildRouteTree(),this.setRoutes(D)}!this.__store&&this.latestLocation&&(this.__store=new YM(Uj(this.latestLocation),{onUpdate:()=>{this.__store.state=Z(F({},this.state),{cachedMatches:this.state.cachedMatches.filter(D=>!["redirected"].includes(D.status))})}}),_j(this));let p=!1;const y=(k=this.options.basepath)!=null?k:"/",v=this.options.rewrite;if(f||u!==y||m!==v){this.basepath=y;const D=[],j=BS(y);j&&j!=="/"&&D.push(Ij({basepath:y})),v&&D.push(v),this.rewrite=D.length===0?void 0:D.length===1?D[0]:Oj(D),this.history&&this.updateLatestLocation(),p=!0}p&&this.__store&&(this.__store.state=Z(F({},this.state),{location:this.latestLocation})),typeof window!="undefined"&&"CSS"in window&&typeof((M=window.CSS)==null?void 0:M.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const l=lj(this.routeTree,this.options.caseSensitive,(c,u)=>{c.init({originalIndex:u})});return this.options.routeMasks&&aj(this.options.routeMasks,l.processedTree),l},this.subscribe=(l,c)=>{const u={eventType:l,fn:c};return this.subscribers.add(u),()=>{this.subscribers.delete(u)}},this.emit=l=>{this.subscribers.forEach(c=>{c.eventType===l.type&&c.fn(l)})},this.parseLocation=(l,c)=>{const u=({pathname:y,search:v,hash:x,href:b,state:w})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(y)){const j=this.options.parseSearch(v),A=this.options.stringifySearch(j);return{href:y+A+x,publicHref:b,pathname:ru(y).path,external:!1,searchStr:A,search:Ha(c==null?void 0:c.search,j),hash:ru(x.slice(1)).path,state:Ha(c==null?void 0:c.state,w)}}const C=new URL(b,this.origin),N=ay(this.rewrite,C),k=this.options.parseSearch(N.search),M=this.options.stringifySearch(k);return N.search=M,{href:N.href.replace(N.origin,""),publicHref:b,pathname:ru(N.pathname).path,external:!!this.rewrite&&N.origin!==this.origin,searchStr:M,search:Ha(c==null?void 0:c.search,k),hash:ru(N.hash.slice(1)).path,state:Ha(c==null?void 0:c.state,w)}},f=u(l),{__tempLocation:m,__tempKey:p}=f.state;if(m&&(!p||p===this.tempLocationKey)){const y=u(m);return y.state.key=f.state.key,y.state.__TSR_key=f.state.__TSR_key,delete y.state.__tempLocation,Z(F({},y),{maskedLocation:f})}return f},this.resolvePathWithBase=(l,c)=>hj({base:l,to:ov(c),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(l,c,u)=>typeof l=="string"?this.matchRoutesInternal({pathname:l,search:c},u):this.matchRoutesInternal(l,c),this.getMatchedRoutes=l=>Fj({pathname:l,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=l=>{const c=this.getMatch(l);c&&(c.abortController.abort(),clearTimeout(c._nonReactive.pendingTimeout),c._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{var f;const l=this.state.matches.filter(m=>m.status==="pending"),c=this.state.matches.filter(m=>m.isFetching==="loader");new Set([...(f=this.state.pendingMatches)!=null?f:[],...l,...c]).forEach(m=>{this.cancelMatch(m.id)})},this.buildLocation=l=>{const c=(f={})=>{var G,K,se,V,re;const m=f._fromLocation||this.pendingBuiltLocation||this.latestLocation,p=this.matchRoutesLightweight(m);f.from;const y=f.unsafeRelative==="path"?m.pathname:(G=f.from)!=null?G:p.fullPath,v=this.resolvePathWithBase(y,"."),x=p.search,b=F({},p.params),w=f.to?this.resolvePathWithBase(v,`${f.to}`):this.resolvePathWithBase(v,"."),C=f.params===!1||f.params===null?{}:((K=f.params)!=null?K:!0)===!0?b:Object.assign(b,jr(f.params,b)),N=tg({path:w,params:C,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath,k=this.getMatchedRoutes(N);let M=k.matchedRoutes;(k.foundRoute?k.foundRoute.path!=="/"&&k.routeParams["**"]:Es(N))&&this.options.notFoundRoute&&(M=[...M,this.options.notFoundRoute]);let j=!1;if(Object.keys(C).length>0)for(const fe of M){const B=(V=(se=fe.options.params)==null?void 0:se.stringify)!=null?V:fe.options.stringifyParams;B&&(j=!0,Object.assign(C,B(C)))}const A=l.leaveParams?w:ru(j?tg({path:w,params:C,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath:N).path;let O=x;if(l._includeValidateSearch&&((re=this.options.search)!=null&&re.strict)){const fe={};M.forEach(B=>{if(B.options.validateSearch)try{Object.assign(fe,Gf(B.options.validateSearch,F(F({},fe),O)))}catch(W){}}),O=fe}O=$j({search:O,dest:f,destRoutes:M,_includeValidateSearch:l._includeValidateSearch}),O=Ha(x,O);const R=this.options.stringifySearch(O),E=f.hash===!0?m.hash:f.hash?jr(f.hash,m.hash):void 0,I=E?`#${E}`:"";let L=f.state===!0?m.state:f.state?jr(f.state,m.state):{};L=Ha(m.state,L);const H=`${A}${R}${I}`;let U,$,P=!1;if(this.rewrite){const fe=new URL(H,this.origin),B=GS(this.rewrite,fe);U=fe.href.replace(fe.origin,""),B.origin!==this.origin?($=B.href,P=!0):$=B.pathname+B.search+B.hash}else U=ej(H),$=U;return{publicHref:$,href:U,pathname:A,search:O,searchStr:R,state:L,hash:E!=null?E:"",external:P,unmaskOnReload:f.unmaskOnReload}},u=(f={},m)=>{const p=c(f);let y=m?c(m):void 0;if(!y){const x={};if(this.options.routeMasks){const b=ij(p.pathname,this.processedTree);if(b){Object.assign(x,b.rawParams);const v=b.route,{from:w,params:C}=v,N=Me(v,["from","params"]),k=C===!1||C===null?{}:(C!=null?C:!0)===!0?x:Object.assign(x,jr(C,x));m=Z(F({from:l.from},N),{params:k}),y=c(m)}}}return y&&(p.maskedLocation=y),p};return l.mask?u(l,F({from:l.from},l.mask)):u(l)},this.commitLocation=f=>ut(this,null,function*(){var m=f,{viewTransition:l,ignoreBlocker:c}=m,u=Me(m,["viewTransition","ignoreBlocker"]);var b,w,C,N;const p=()=>{const k=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];k.forEach(D=>{u.state[D]=this.latestLocation.state[D]});const M=To(u.state,this.latestLocation.state);return k.forEach(D=>{delete u.state[D]}),M},y=Es(this.latestLocation.href)===Es(u.href),v=this.commitLocationPromise;if(this.commitLocationPromise=Wl(()=>{v==null||v.resolve()}),y&&p())this.load();else{let x=u,{maskedLocation:k,hashScrollIntoView:M}=x,D=Me(x,["maskedLocation","hashScrollIntoView"]);k&&(D=Z(F({},k),{state:Z(F({},k.state),{__tempKey:void 0,__tempLocation:Z(F({},D),{search:D.searchStr,state:Z(F({},D.state),{__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0})})})}),(w=(b=D.unmaskOnReload)!=null?b:this.options.unmaskOnReload)!=null&&w&&(D.state.__tempKey=this.tempLocationKey)),D.state.__hashScrollIntoViewOptions=(C=M!=null?M:this.options.defaultHashScrollIntoView)!=null?C:!0,this.shouldViewTransition=l,this.history[u.replace?"replace":"push"](D.publicHref,D.state,{ignoreBlocker:c})}return this.resetNextScroll=(N=u.resetScroll)!=null?N:!0,this.history.subscribers.size||this.load(),this.commitLocationPromise}),this.buildAndCommitLocation=(v={})=>{var x=v,{replace:l,resetScroll:c,hashScrollIntoView:u,viewTransition:f,ignoreBlocker:m,href:p}=x,y=Me(x,["replace","resetScroll","hashScrollIntoView","viewTransition","ignoreBlocker","href"]);if(p){const C=this.history.location.state.__TSR_index,N=Eu(p,{__TSR_index:l?C:C+1}),k=new URL(N.pathname,this.origin),M=ay(this.rewrite,k);y.to=M.pathname,y.search=this.options.parseSearch(N.search),y.hash=N.hash.slice(1)}const b=this.buildLocation(Z(F({},y),{_includeValidateSearch:!0}));this.pendingBuiltLocation=b;const w=this.commitLocation(Z(F({},b),{viewTransition:f,replace:l,resetScroll:c,hashScrollIntoView:u,ignoreBlocker:m}));return Promise.resolve().then(()=>{this.pendingBuiltLocation===b&&(this.pendingBuiltLocation=void 0)}),w},this.navigate=p=>ut(this,null,function*(){var y=p,{to:l,reloadDocument:c,href:u,publicHref:f}=y,m=Me(y,["to","reloadDocument","href","publicHref"]);var x,b;let v=!1;if(u)try{new URL(`${u}`),v=!0}catch(w){}if(v&&!c&&(c=!0),c){if(l!==void 0||!u){const C=this.buildLocation(F({to:l},m));u=u!=null?u:C.publicHref,f=f!=null?f:C.publicHref}const w=!v&&f?f:u;if(nh(w))return Promise.resolve();if(!m.ignoreBlocker){const C=this.history,N=(b=(x=C.getBlockers)==null?void 0:x.call(C))!=null?b:[];for(const k of N)if(k!=null&&k.blockerFn&&(yield k.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"})))return Promise.resolve()}return m.replace?window.location.replace(w):window.location.href=w,Promise.resolve()}return this.buildAndCommitLocation(Z(F({},m),{href:u,to:l,_isNavigate:!0}))}),this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const l=this.matchRoutes(this.latestLocation);this.__store.setState(c=>Z(F({},c),{status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:l,cachedMatches:c.cachedMatches.filter(u=>!l.some(f=>f.id===u.id))}))},this.load=l=>ut(this,null,function*(){let c,u,f;for(f=new Promise(p=>{this.startTransition(()=>ut(this,null,function*(){var y;try{this.beforeLoad();const v=this.latestLocation,x=this.state.resolvedLocation;this.state.redirect||this.emit(F({type:"onBeforeNavigate"},Ao({resolvedLocation:x,location:v}))),this.emit(F({type:"onBeforeLoad"},Ao({resolvedLocation:x,location:v}))),yield Jb({router:this,sync:l==null?void 0:l.sync,matches:this.state.pendingMatches,location:v,updateMatch:this.updateMatch,onReady:()=>ut(this,null,function*(){this.startTransition(()=>{this.startViewTransition(()=>ut(this,null,function*(){let b=[],w=[],C=[];Cu(()=>{this.__store.setState(N=>{const k=N.matches,M=N.pendingMatches||N.matches;return b=k.filter(D=>!M.some(j=>j.id===D.id)),w=M.filter(D=>!k.some(j=>j.id===D.id)),C=M.filter(D=>k.some(j=>j.id===D.id)),Z(F({},N),{isLoading:!1,loadedAt:Date.now(),matches:M,pendingMatches:void 0,cachedMatches:[...N.cachedMatches,...b.filter(D=>D.status!=="error"&&D.status!=="notFound")]})}),this.clearExpiredCache()}),[[b,"onLeave"],[w,"onEnter"],[C,"onStay"]].forEach(([N,k])=>{N.forEach(M=>{var D,j;(j=(D=this.looseRoutesById[M.routeId].options)[k])==null||j.call(D,M)})})}))})})})}catch(v){mi(v)?(c=v,this.navigate(Z(F({},c.options),{replace:!0,ignoreBlocker:!0}))):Ga(v)&&(u=v),this.__store.setState(x=>Z(F({},x),{statusCode:c?c.status:u?404:x.matches.some(b=>b.status==="error")?500:200,redirect:c}))}this.latestLoadPromise===f&&((y=this.commitLocationPromise)==null||y.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),p()}))}),this.latestLoadPromise=f,yield f;this.latestLoadPromise&&f!==this.latestLoadPromise;)yield this.latestLoadPromise;let m;this.hasNotFoundMatch()?m=404:this.__store.state.matches.some(p=>p.status==="error")&&(m=500),m!==void 0&&this.__store.setState(p=>Z(F({},p),{statusCode:m}))}),this.startViewTransition=l=>{var u;const c=(u=this.shouldViewTransition)!=null?u:this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,c&&typeof document!="undefined"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let f;if(typeof c=="object"&&this.isViewTransitionTypesSupported){const m=this.latestLocation,p=this.state.resolvedLocation,y=typeof c.types=="function"?c.types(Ao({resolvedLocation:p,location:m})):c.types;if(y===!1){l();return}f={update:l,types:y}}else f=l;document.startViewTransition(f)}else l()},this.updateMatch=(l,c)=>{this.startTransition(()=>{var f;const u=(f=this.state.pendingMatches)!=null&&f.some(m=>m.id===l)?"pendingMatches":this.state.matches.some(m=>m.id===l)?"matches":this.state.cachedMatches.some(m=>m.id===l)?"cachedMatches":"";u&&this.__store.setState(m=>{var p;return Z(F({},m),{[u]:(p=m[u])==null?void 0:p.map(y=>y.id===l?c(y):y)})})})},this.getMatch=l=>{var u,f,m;const c=p=>p.id===l;return(m=(f=this.state.cachedMatches.find(c))!=null?f:(u=this.state.pendingMatches)==null?void 0:u.find(c))!=null?m:this.state.matches.find(c)},this.invalidate=l=>{const c=u=>{var f,m;return(m=(f=l==null?void 0:l.filter)==null?void 0:f.call(l,u))==null||m?F(Z(F({},u),{invalid:!0}),l!=null&&l.forcePending||u.status==="error"||u.status==="notFound"?{status:"pending",error:void 0}:void 0):u};return this.__store.setState(u=>{var f;return Z(F({},u),{matches:u.matches.map(c),cachedMatches:u.cachedMatches.map(c),pendingMatches:(f=u.pendingMatches)==null?void 0:f.map(c)})}),this.shouldViewTransition=!1,this.load({sync:l==null?void 0:l.sync})},this.getParsedLocationHref=l=>l.publicHref||"/",this.resolveRedirect=l=>{var u;const c=l.headers.get("Location");if(!l.options.href||l.options._builtLocation){const f=(u=l.options._builtLocation)!=null?u:this.buildLocation(l.options),m=this.getParsedLocationHref(f);l.options.href=m,l.headers.set("Location",m)}else if(c)try{const f=new URL(c);if(this.origin&&f.origin===this.origin){const m=f.pathname+f.search+f.hash;l.options.href=m,l.headers.set("Location",m)}}catch(f){}return l.headers.get("Location")||l.headers.set("Location",l.options.href),l},this.clearCache=l=>{const c=l==null?void 0:l.filter;c!==void 0?this.__store.setState(u=>Z(F({},u),{cachedMatches:u.cachedMatches.filter(f=>!c(f))})):this.__store.setState(u=>Z(F({},u),{cachedMatches:[]}))},this.clearExpiredCache=()=>{const l=c=>{var y,v,x;const u=this.looseRoutesById[c.routeId];if(!u.options.loader)return!0;const f=(x=c.preload?(y=u.options.preloadGcTime)!=null?y:this.options.defaultPreloadGcTime:(v=u.options.gcTime)!=null?v:this.options.defaultGcTime)!=null?x:300*1e3;return c.status==="error"?!0:Date.now()-c.updatedAt>=f};this.clearCache({filter:l})},this.loadRouteChunk=HS,this.preloadRoute=l=>ut(this,null,function*(){var p;const c=this.buildLocation(l);let u=this.matchRoutes(c,{throwOnError:!0,preload:!0,dest:l});const f=new Set([...this.state.matches,...(p=this.state.pendingMatches)!=null?p:[]].map(y=>y.id)),m=new Set([...f,...this.state.cachedMatches.map(y=>y.id)]);Cu(()=>{u.forEach(y=>{m.has(y.id)||this.__store.setState(v=>Z(F({},v),{cachedMatches:[...v.cachedMatches,y]}))})});try{return u=yield Jb({router:this,matches:u,location:c,preload:!0,updateMatch:(y,v)=>{f.has(y)?u=u.map(x=>x.id===y?v(x):x):this.updateMatch(y,v)}}),u}catch(y){if(mi(y))return y.options.reloadDocument?void 0:yield this.preloadRoute(Z(F({},y.options),{_fromLocation:c}));Ga(y)||console.error(y);return}}),this.matchRoute=(l,c)=>{var v,x,b;const u=Z(F({},l),{to:l.to?this.resolvePathWithBase(l.from||"",l.to):void 0,params:l.params||{},leaveParams:!0}),f=this.buildLocation(u);if(c!=null&&c.pending&&this.state.status!=="pending")return!1;const p=((c==null?void 0:c.pending)===void 0?!this.state.isLoading:c.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,y=sj(f.pathname,(v=c==null?void 0:c.caseSensitive)!=null?v:!1,(x=c==null?void 0:c.fuzzy)!=null?x:!1,p.pathname,this.processedTree);return!y||l.params&&!To(y.rawParams,l.params,{partial:!0})?!1:(b=c==null?void 0:c.includeSearch)==null||b?To(p.search,f.search,{partial:!0})?y.rawParams:!1:y.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(l=>l.status==="notFound"||l.globalNotFound),this.update(Z(F({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0},t),{caseSensitive:(n=t.caseSensitive)!=null?n:!1,notFoundMode:(a=t.notFoundMode)!=null?a:"fuzzy",stringifySearch:(s=t.stringifySearch)!=null?s:kj,parseSearch:(o=t.parseSearch)!=null?o:Nj})),typeof document!="undefined"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:t,routesByPath:n,processedTree:a}){this.routesById=t,this.routesByPath=n,this.processedTree=a;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}get looseRoutesById(){return this.routesById}getParentContext(t){var s,o,l;return(t==null?void 0:t.id)?(l=(o=t.context)!=null?o:this.options.context)!=null?l:void 0:(s=this.options.context)!=null?s:void 0}matchRoutesInternal(t,n){var y,v,x,b,w,C,N,k,M,D;const a=this.getMatchedRoutes(t.pathname),{foundRoute:s,routeParams:o,parsedParams:l}=a;let{matchedRoutes:c}=a,u=!1;(s?s.path!=="/"&&o["**"]:Es(t.pathname))&&(this.options.notFoundRoute?c=[...c,this.options.notFoundRoute]:u=!0);const f=u?Hj(this.options.notFoundMode,c):void 0,m=new Array(c.length),p=new Map(this.state.matches.map(j=>[j.routeId,j]));for(let j=0;j<c.length;j++){const A=c[j],O=m[j-1];let R,E,I;{const W=(y=O==null?void 0:O.search)!=null?y:t.search,ae=(v=O==null?void 0:O._strictSearch)!=null?v:void 0;try{const J=(x=Gf(A.options.validateSearch,F({},W)))!=null?x:void 0;R=F(F({},W),J),E=F(F({},ae),J),I=void 0}catch(J){let le=J;if(J instanceof rh||(le=new rh(J.message,{cause:J})),n!=null&&n.throwOnError)throw le;R=W,E={},I=le}}const L=(C=(w=(b=A.options).loaderDeps)==null?void 0:w.call(b,{search:R}))!=null?C:"",H=L?JSON.stringify(L):"",{interpolatedPath:U,usedParams:$}=tg({path:A.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),P=A.id+U+H,G=this.getMatch(P),K=p.get(A.id),se=(N=G==null?void 0:G._strictParams)!=null?N:$;let V;if(!G)try{Wb(A,$,l,se)}catch(W){if(Ga(W)||mi(W)?V=W:V=new Bj(W.message,{cause:W}),n!=null&&n.throwOnError)throw V}Object.assign(o,se);const re=K?"stay":"enter";let fe;if(G)fe=Z(F({},G),{cause:re,params:(k=K==null?void 0:K.params)!=null?k:o,_strictParams:se,search:Ha(K?K.search:G.search,R),_strictSearch:E});else{const W=A.options.loader||A.options.beforeLoad||A.lazyFn||qS(A)?"pending":"success";fe={id:P,ssr:A.options.ssr,index:j,routeId:A.id,params:(M=K==null?void 0:K.params)!=null?M:o,_strictParams:se,pathname:U,updatedAt:Date.now(),search:K?Ha(K.search,R):R,_strictSearch:E,searchError:void 0,status:W,isFetching:!1,error:void 0,paramsError:V,__routeContext:void 0,_nonReactive:{loadPromise:Wl()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:re,loaderDeps:K?Ha(K.loaderDeps,L):L,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:A.options.staticData||{},fullPath:A.fullPath}}n!=null&&n.preload||(fe.globalNotFound=f===A.id),fe.searchError=I;const B=this.getParentContext(O);fe.context=F(F(F({},B),fe.__routeContext),fe.__beforeLoadContext),m[j]=fe}for(let j=0;j<m.length;j++){const A=m[j],O=this.looseRoutesById[A.routeId],R=this.getMatch(A.id),E=p.get(A.routeId);if(A.params=E?Ha(E.params,o):o,!R){const I=m[j-1],L=this.getParentContext(I);if(O.options.context){const H={deps:A.loaderDeps,params:A.params,context:L!=null?L:{},location:t,navigate:U=>this.navigate(Z(F({},U),{_fromLocation:t})),buildLocation:this.buildLocation,cause:A.cause,abortController:A.abortController,preload:!!A.preload,matches:m,routeId:O.id};A.__routeContext=(D=O.options.context(H))!=null?D:void 0}A.context=F(F(F({},L),A.__routeContext),A.__beforeLoadContext)}}return m}matchRoutesLightweight(t){const{matchedRoutes:n,routeParams:a,parsedParams:s}=this.getMatchedRoutes(t.pathname),o=Ru(n),l=F({},t.search);for(const m of n)try{Object.assign(l,Gf(m.options.validateSearch,l))}catch(p){}const c=Ru(this.state.matches),u=c&&c.routeId===o.id&&t.pathname===this.state.location.pathname;let f;if(u)f=c.params;else{const m=F({},a);for(const p of n)try{Wb(p,a,s!=null?s:{},m)}catch(y){}f=m}return{matchedRoutes:n,fullPath:o.fullPath,search:l,params:f}}}class rh extends Error{}class Bj extends Error{}function Uj(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Gf(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new rh("Async validation not supported");if(n.issues)throw new rh(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function Fj({pathname:e,routesById:t,processedTree:n}){const a={},s=Es(e);let o,l;const c=rj(s,n,!0);return c&&(o=c.route,Object.assign(a,c.rawParams),l=Object.assign({},c.parsedParams)),{matchedRoutes:(c==null?void 0:c.branch)||[t[fi]],routeParams:a,foundRoute:o,parsedParams:l}}function $j({search:e,dest:t,destRoutes:n,_includeValidateSearch:a}){return Pj(n)(e,t,a!=null?a:!1)}function Pj(e){var s;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const o of e){if("search"in o.options)(s=o.options.search)!=null&&s.middlewares&&t.middlewares.push(...o.options.search.middlewares);else if(o.options.preSearchFilters||o.options.postSearchFilters){const l=({search:c,next:u})=>{let f=c;"preSearchFilters"in o.options&&o.options.preSearchFilters&&(f=o.options.preSearchFilters.reduce((p,y)=>y(p),c));const m=u(f);return"postSearchFilters"in o.options&&o.options.postSearchFilters?o.options.postSearchFilters.reduce((p,y)=>y(p),m):m};t.middlewares.push(l)}if(o.options.validateSearch){const l=({search:c,next:u})=>{var m;const f=u(c);if(!t._includeValidateSearch)return f;try{return F(F({},f),(m=Gf(o.options.validateSearch,f))!=null?m:void 0)}catch(p){return f}};t.middlewares.push(l)}}const n=({search:o})=>{const l=t.dest;return l.search?l.search===!0?o:jr(l.search,o):{}};t.middlewares.push(n);const a=(o,l,c)=>{if(o>=c.length)return l;const u=c[o];return u({search:l,next:m=>a(o+1,m,c)})};return function(l,c,u){return t.dest=c,t._includeValidateSearch=u,a(0,l,t.middlewares)}}function Hj(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const a=t[n];if(a.children)return a.id}return fi}function Wb(e,t,n,a){var o,l;const s=(l=(o=e.options.params)==null?void 0:o.parse)!=null?l:e.options.parseParams;if(s)if(e.options.skipRouteOnParseError)for(const c in t)c in n&&(a[c]=n[c]);else{const c=s(a);Object.assign(a,c)}}const qj="Error preloading route! ☝️";class YS{constructor(t){if(this.init=n=>{var f,m;this.originalIndex=n.originalIndex;const a=this.options,s=!(a!=null&&a.path)&&!(a!=null&&a.id);this.parentRoute=(m=(f=this.options).getParentRoute)==null?void 0:m.call(f),s?this._path=fi:this.parentRoute||As(!1);let o=s?fi:a==null?void 0:a.path;o&&o!=="/"&&(o=zS(o));const l=(a==null?void 0:a.id)||o;let c=s?fi:qf([this.parentRoute.id===fi?"":this.parentRoute.id,l]);o===fi&&(o="/"),c!==fi&&(c=qf(["/",c]));const u=c===fi?"/":qf([this.parentRoute.fullPath,o]);this._path=o,this._id=c,this._fullPath=u,this._to=Es(u)},this.addChildren=n=>this._addFileChildren(n),this._addFileChildren=n=>(Array.isArray(n)&&(this.children=n),typeof n=="object"&&n!==null&&(this.children=Object.values(n)),this),this._addFileTypes=()=>this,this.updateLoader=n=>(Object.assign(this.options,n),this),this.update=n=>(Object.assign(this.options,n),this),this.lazy=n=>(this.lazyFn=n,this),this.redirect=n=>Ej(F({from:this.fullPath},n)),this.options=t||{},this.isRoot=!(t!=null&&t.getParentRoute),t!=null&&t.id&&(t!=null&&t.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Vj extends YS{constructor(t){super(t)}}const Nf=typeof window!="undefined"?T.useLayoutEffect:T.useEffect;function ag(e){const t=T.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Gj(e,t,n={},a={}){T.useEffect(()=>{if(!e.current||a.disabled||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([o])=>{t(o)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,n,a.disabled,e])}function Yj(e){const t=T.useRef(null);return T.useImperativeHandle(e,()=>t.current,[]),t}function lv(e){var n;const t=(n=e.errorComponent)!=null?n:cv;return h.jsx(Xj,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:a,reset:s})=>a?T.createElement(t,{error:a,reset:s}):e.children})}class Xj extends T.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(t){return{resetKey:t.getResetKey()}}static getDerivedStateFromError(t){return{error:t}}reset(){this.setState({error:null})}componentDidUpdate(t,n){n.error&&n.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(t,n){this.props.onCatch&&this.props.onCatch(t,n)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function cv({error:e}){const[t,n]=T.useState(!1);return h.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[h.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),h.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(a=>!a),children:t?"Hide Error":"Show Error"})]}),h.jsx("div",{style:{height:".25rem"}}),t?h.jsx("div",{children:h.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?h.jsx("code",{children:e.message}):null})}):null]})}function Kj({children:e,fallback:t=null}){return XS()?h.jsx(ve.Fragment,{children:e}):h.jsx(ve.Fragment,{children:t})}function XS(){return ve.useSyncExternalStore(Qj,()=>!0,()=>!1)}function Qj(){return()=>{}}var ig={exports:{}},sg={},rg={exports:{}},og={};/**
|
|
34
|
+
* @license React
|
|
35
|
+
* use-sync-external-store-shim.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var e_;function Zj(){if(e_)return og;e_=1;var e=av();function t(p,y){return p===y&&(p!==0||1/p===1/y)||p!==p&&y!==y}var n=typeof Object.is=="function"?Object.is:t,a=e.useState,s=e.useEffect,o=e.useLayoutEffect,l=e.useDebugValue;function c(p,y){var v=y(),x=a({inst:{value:v,getSnapshot:y}}),b=x[0].inst,w=x[1];return o(function(){b.value=v,b.getSnapshot=y,u(b)&&w({inst:b})},[p,v,y]),s(function(){return u(b)&&w({inst:b}),p(function(){u(b)&&w({inst:b})})},[p]),l(v),v}function u(p){var y=p.getSnapshot;p=p.value;try{var v=y();return!n(p,v)}catch(x){return!0}}function f(p,y){return y()}var m=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?f:c;return og.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,og}var t_;function Jj(){return t_||(t_=1,rg.exports=Zj()),rg.exports}/**
|
|
42
|
+
* @license React
|
|
43
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
44
|
+
*
|
|
45
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
46
|
+
*
|
|
47
|
+
* This source code is licensed under the MIT license found in the
|
|
48
|
+
* LICENSE file in the root directory of this source tree.
|
|
49
|
+
*/var n_;function Wj(){if(n_)return sg;n_=1;var e=av(),t=Jj();function n(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var a=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,c=e.useMemo,u=e.useDebugValue;return sg.useSyncExternalStoreWithSelector=function(f,m,p,y,v){var x=o(null);if(x.current===null){var b={hasValue:!1,value:null};x.current=b}else b=x.current;x=c(function(){function C(j){if(!N){if(N=!0,k=j,j=y(j),v!==void 0&&b.hasValue){var A=b.value;if(v(A,j))return M=A}return M=j}if(A=M,a(k,j))return A;var O=y(j);return v!==void 0&&v(A,O)?(k=j,A):(k=j,M=O)}var N=!1,k,M,D=p===void 0?null:p;return[function(){return C(m())},D===null?void 0:function(){return C(D())}]},[m,p,y,v]);var w=s(f,x[0],x[1]);return l(function(){b.hasValue=!0,b.value=w},[w]),u(w),w},sg}var a_;function eE(){return a_||(a_=1,ig.exports=Wj()),ig.exports}var tE=eE();function nE(e,t=a=>a,n={}){var o;const a=(o=n.equal)!=null?o:aE;return tE.useSyncExternalStoreWithSelector(e.subscribe,()=>e.state,()=>e.state,t,a)}function aE(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[a,s]of e)if(!t.has(a)||!Object.is(s,t.get(a)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const a of e)if(!t.has(a))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();const n=i_(e);if(n.length!==i_(t).length)return!1;for(let a=0;a<n.length;a++)if(!Object.prototype.hasOwnProperty.call(t,n[a])||!Object.is(e[n[a]],t[n[a]]))return!1;return!0}function i_(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}const lg=T.createContext(null);function KS(){return typeof document=="undefined"?lg:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=lg,lg)}function vi(e){var n;const t=T.useContext(KS());return(n=e==null?void 0:e.warn)==null,t}function gi(e){const t=vi({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t,a=T.useRef(void 0);return nE(n.__store,s=>{var o;if(e!=null&&e.select){if((o=e.structuralSharing)!=null?o:n.options.defaultStructuralSharing){const l=Ha(a.current,e.select(s));return a.current=l,l}return e.select(s)}return s})}const kh=T.createContext(void 0),iE=T.createContext(void 0);function es(e){const t=T.useContext(e.from?iE:kh);return gi({select:a=>{var o;const s=a.matches.find(l=>e.from?e.from===l.routeId:l.id===t);if(As(!(((o=e.shouldThrow)==null||o)&&!s),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),s!==void 0)return e.select?e.select(s):s},structuralSharing:e.structuralSharing})}function uv(e){return es({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function dv(e){const a=e,{select:t}=a,n=Me(a,["select"]);return es(Z(F({},n),{select:s=>t?t(s.loaderDeps):s.loaderDeps}))}function Mh(e){return es({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Xu(e){return es({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function fv(e){const t=vi();return T.useCallback(n=>{var a;return t.navigate(Z(F({},n),{from:(a=n.from)!=null?a:e==null?void 0:e.from}))},[e==null?void 0:e.from,t])}var QS=RS();function sE(e,t){var Se,Be,at;const n=vi(),a=Yj(t),ye=e,{activeProps:s,inactiveProps:o,activeOptions:l,to:c,preload:u,preloadDelay:f,hashScrollIntoView:m,replace:p,startTransition:y,resetScroll:v,viewTransition:x,children:b,target:w,disabled:C,style:N,className:k,onClick:M,onFocus:D,onMouseEnter:j,onMouseLeave:A,onTouchStart:O,ignoreBlocker:R,params:E,search:I,hash:L,state:H,mask:U,reloadDocument:$,unsafeRelative:P,from:G,_fromLocation:K}=ye,se=Me(ye,["activeProps","inactiveProps","activeOptions","to","preload","preloadDelay","hashScrollIntoView","replace","startTransition","resetScroll","viewTransition","children","target","disabled","style","className","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","ignoreBlocker","params","search","hash","state","mask","reloadDocument","unsafeRelative","from","_fromLocation"]),V=XS(),re=gi({select:Pe=>Pe.location.search,structuralSharing:!0}),fe=e.from,B=T.useMemo(()=>Z(F({},e),{from:fe}),[n,re,fe,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),W=T.useMemo(()=>n.buildLocation(F({},B)),[n,B]),ae=W.maskedLocation?W.maskedLocation.publicHref:W.publicHref,J=W.maskedLocation?W.maskedLocation.external:W.external,le=T.useMemo(()=>dE(ae,J,n.history,C),[C,J,ae,n.history]),be=T.useMemo(()=>{if(le!=null&&le.external)return nh(le.href)?void 0:le.href;if(!fE(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{return new URL(c),nh(c)?void 0:c}catch(gt){}},[c,le]),je=gi({select:Pe=>{var gt;if(be)return!1;if(l!=null&&l.exact){if(!fj(Pe.location.pathname,W.pathname,n.basepath))return!1}else{const ct=ih(Pe.location.pathname,n.basepath),Et=ih(W.pathname,n.basepath);if(!(ct.startsWith(Et)&&(ct.length===Et.length||ct[Et.length]==="/")))return!1}return((gt=l==null?void 0:l.includeSearch)==null||gt)&&!To(Pe.location.search,W.search,{partial:!(l!=null&&l.exact),ignoreUndefined:!(l!=null&&l.explicitUndefined)})?!1:l!=null&&l.includeHash?V&&Pe.location.hash===W.hash:!0}}),De=je?(Se=jr(s,{}))!=null?Se:rE:cg,Ae=je?cg:(Be=jr(o,{}))!=null?Be:cg,Xe=[k,De.className,Ae.className].filter(Boolean).join(" "),Fe=(N||De.style||Ae.style)&&F(F(F({},N),De.style),Ae.style),[me,Q]=T.useState(!1),ue=T.useRef(!1),xe=e.reloadDocument||be?!1:u!=null?u:n.options.defaultPreload,ze=(at=f!=null?f:n.options.defaultPreloadDelay)!=null?at:0,X=T.useCallback(()=>{n.preloadRoute(F({},B)).catch(Pe=>{console.warn(Pe),console.warn(qj)})},[n,B]),ke=T.useCallback(Pe=>{Pe!=null&&Pe.isIntersecting&&X()},[X]);Gj(a,ke,uE,{disabled:!!C||xe!=="viewport"}),T.useEffect(()=>{ue.current||!C&&xe==="render"&&(X(),ue.current=!0)},[C,X,xe]);const we=Pe=>{const gt=Pe.currentTarget.getAttribute("target"),ct=w!==void 0?w:gt;if(!C&&!hE(Pe)&&!Pe.defaultPrevented&&(!ct||ct==="_self")&&Pe.button===0){Pe.preventDefault(),QS.flushSync(()=>{Q(!0)});const Et=n.subscribe("onResolved",()=>{Et(),Q(!1)});n.navigate(Z(F({},B),{replace:p,resetScroll:v,hashScrollIntoView:m,startTransition:y,viewTransition:x,ignoreBlocker:R}))}};if(be)return F(F(F(F(F(F(F(F(F(F(Z(F({},se),{ref:a,href:be}),b&&{children:b}),w&&{target:w}),C&&{disabled:C}),N&&{style:N}),k&&{className:k}),M&&{onClick:M}),D&&{onFocus:D}),j&&{onMouseEnter:j}),A&&{onMouseLeave:A}),O&&{onTouchStart:O});const $e=Pe=>{C||xe&&X()},tt=$e,Ke=Pe=>{if(!(C||!xe))if(!ze)X();else{const gt=Pe.target;if(cu.has(gt))return;const ct=setTimeout(()=>{cu.delete(gt),X()},ze);cu.set(gt,ct)}},dt=Pe=>{if(C||!xe||!ze)return;const gt=Pe.target,ct=cu.get(gt);ct&&(clearTimeout(ct),cu.delete(gt))};return F(F(F(F(F(Z(F(F(F({},se),De),Ae),{href:le==null?void 0:le.href,ref:a,onClick:uu([M,we]),onFocus:uu([D,$e]),onMouseEnter:uu([j,Ke]),onMouseLeave:uu([A,dt]),onTouchStart:uu([O,tt]),disabled:!!C,target:w}),Fe&&{style:Fe}),Xe&&{className:Xe}),C&&oE),je&&lE),V&&me&&cE)}const cg={},rE={className:"active"},oE={role:"link","aria-disabled":!0},lE={"data-status":"active","aria-current":"page"},cE={"data-transitioning":"transitioning"},cu=new WeakMap,uE={rootMargin:"100px"},uu=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function dE(e,t,n,a){if(!a)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function fE(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}const ZS=T.forwardRef((e,t)=>{const c=e,{_asChild:n}=c,a=Me(c,["_asChild"]),u=sE(a,t),{type:s}=u,o=Me(u,["type"]),l=typeof a.children=="function"?a.children({isActive:o["data-status"]==="active"}):a.children;if(!n){const f=o,{disabled:m}=f,p=Me(f,["disabled"]);return T.createElement("a",p,l)}return T.createElement(n,o,l)});function hE(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}class pE extends YS{constructor(t){super(t),this.useMatch=n=>es({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>es(Z(F({},n),{from:this.id,select:a=>n!=null&&n.select?n.select(a.context):a.context})),this.useSearch=n=>Xu({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>Mh({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>dv(Z(F({},n),{from:this.id})),this.useLoaderData=n=>uv(Z(F({},n),{from:this.id})),this.useNavigate=()=>fv({from:this.fullPath}),this.Link=ve.forwardRef((n,a)=>h.jsx(ZS,F({ref:a,from:this.fullPath},n))),this.$$typeof=Symbol.for("react.memo")}}function hv(e){return new pE(e)}class mE extends Vj{constructor(t){super(t),this.useMatch=n=>es({select:n==null?void 0:n.select,from:this.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>es(Z(F({},n),{from:this.id,select:a=>n!=null&&n.select?n.select(a.context):a.context})),this.useSearch=n=>Xu({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useParams=n=>Mh({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.id}),this.useLoaderDeps=n=>dv(Z(F({},n),{from:this.id})),this.useLoaderData=n=>uv(Z(F({},n),{from:this.id})),this.useNavigate=()=>fv({from:this.fullPath}),this.Link=ve.forwardRef((n,a)=>h.jsx(ZS,F({ref:a,from:this.fullPath},n))),this.$$typeof=Symbol.for("react.memo")}}function gE(e){return new mE(e)}function s_(e){return typeof e=="object"?new r_(e,{silent:!0}).createRoute(e):new r_(e,{silent:!0}).createRoute}class r_{constructor(t,n){this.path=t,this.createRoute=a=>{this.silent;const s=hv(a);return s.isRoot=!1,s},this.silent=n==null?void 0:n.silent}}class o_{constructor(t){this.useMatch=n=>es({select:n==null?void 0:n.select,from:this.options.id,structuralSharing:n==null?void 0:n.structuralSharing}),this.useRouteContext=n=>es({from:this.options.id,select:a=>n!=null&&n.select?n.select(a.context):a.context}),this.useSearch=n=>Xu({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.options.id}),this.useParams=n=>Mh({select:n==null?void 0:n.select,structuralSharing:n==null?void 0:n.structuralSharing,from:this.options.id}),this.useLoaderDeps=n=>dv(Z(F({},n),{from:this.options.id})),this.useLoaderData=n=>uv(Z(F({},n),{from:this.options.id})),this.useNavigate=()=>{const n=vi();return fv({from:n.routesById[this.options.id].fullPath})},this.options=t,this.$$typeof=Symbol.for("react.memo")}}function l_(e){return typeof e=="object"?new o_(e):t=>new o_(F({id:e},t))}function yE(){const e=vi(),t=T.useRef({router:e,mounted:!1}),[n,a]=T.useState(!1),{hasPendingMatches:s,isLoading:o}=gi({select:p=>({isLoading:p.isLoading,hasPendingMatches:p.matches.some(y=>y.status==="pending")}),structuralSharing:!0}),l=ag(o),c=o||n||s,u=ag(c),f=o||s,m=ag(f);return e.startTransition=p=>{a(!0),T.startTransition(()=>{p(),a(!1)})},T.useEffect(()=>{const p=e.history.subscribe(e.load),y=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Es(e.latestLocation.publicHref)!==Es(y.publicHref)&&e.commitLocation(Z(F({},y),{replace:!0})),()=>{p()}},[e,e.history]),Nf(()=>{if(typeof window!="undefined"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},ut(null,null,function*(){try{yield e.load()}catch(y){console.error(y)}})},[e]),Nf(()=>{l&&!o&&e.emit(F({type:"onLoad"},Ao(e.state)))},[l,e,o]),Nf(()=>{m&&!f&&e.emit(F({type:"onBeforeRouteMount"},Ao(e.state)))},[f,m,e]),Nf(()=>{if(u&&!c){const p=Ao(e.state);e.emit(F({type:"onResolved"},p)),e.__store.setState(y=>Z(F({},y),{status:"idle",resolvedLocation:y.location})),p.hrefChanged&&wj(e)}},[c,u,e]),null}function vE(e){const t=gi({select:n=>`not-found-${n.location.pathname}-${n.status}`});return h.jsx(lv,{getResetKey:()=>t,onCatch:(n,a)=>{var s;if(Ga(n))(s=e.onCatch)==null||s.call(e,n,a);else throw n},errorComponent:({error:n})=>{var a;if(Ga(n))return(a=e.fallback)==null?void 0:a.call(e,n);throw n},children:e.children})}function xE(){return h.jsx("p",{children:"Not Found"})}function Ol(e){return h.jsx(h.Fragment,{children:e.children})}function JS(e,t,n){return t.options.notFoundComponent?h.jsx(t.options.notFoundComponent,F({},n)):e.options.defaultNotFoundComponent?h.jsx(e.options.defaultNotFoundComponent,F({},n)):h.jsx(xE,{})}function bE(){return vi().isScrollRestoring,null}const WS=T.memo(function({matchId:t}){var b,w,C,N,k,M,D,j,A;const n=vi(),a=gi({select:O=>{var I;const R=O.matches.findIndex(L=>L.id===t),E=O.matches[R];return As(E),{routeId:E.routeId,ssr:E.ssr,_displayPending:E._displayPending,resetKey:O.loadedAt,parentRouteId:(I=O.matches[R-1])==null?void 0:I.routeId}},structuralSharing:!0}),s=n.routesById[a.routeId],o=(b=s.options.pendingComponent)!=null?b:n.options.defaultPendingComponent,l=o?h.jsx(o,{}):null,c=(w=s.options.errorComponent)!=null?w:n.options.defaultErrorComponent,u=(C=s.options.onCatch)!=null?C:n.options.defaultOnCatch,f=s.isRoot?(k=s.options.notFoundComponent)!=null?k:(N=n.options.notFoundRoute)==null?void 0:N.options.component:s.options.notFoundComponent,m=a.ssr===!1||a.ssr==="data-only",p=(!s.isRoot||s.options.wrapInSuspense||m)&&((j=(M=s.options.wrapInSuspense)!=null?M:o)!=null?j:(D=s.options.errorComponent)!=null&&D.preload||m)?T.Suspense:Ol,y=c?lv:Ol,v=f?vE:Ol,x=s.isRoot&&(A=s.options.shellComponent)!=null?A:Ol;return h.jsxs(x,{children:[h.jsx(kh.Provider,{value:t,children:h.jsx(p,{fallback:l,children:h.jsx(y,{getResetKey:()=>a.resetKey,errorComponent:c||cv,onCatch:(O,R)=>{if(Ga(O))throw O;u==null||u(O,R)},children:h.jsx(v,{fallback:O=>{if(!f||O.routeId&&O.routeId!==a.routeId||!O.routeId&&!s.isRoot)throw O;return T.createElement(f,O)},children:m||a._displayPending?h.jsx(Kj,{fallback:l,children:h.jsx(c_,{matchId:t})}):h.jsx(c_,{matchId:t})})})})}),a.parentRouteId===fi&&n.options.scrollRestoration?h.jsxs(h.Fragment,{children:[h.jsx(_E,{}),h.jsx(bE,{})]}):null]})});function _E(){const e=vi(),t=T.useRef(void 0);return h.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit(F({type:"onRendered"},Ao(e.state))),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}const c_=T.memo(function({matchId:t}){var u,f,m,p,y;const n=vi(),{match:a,key:s,routeId:o}=gi({select:v=>{var k;const x=v.matches.find(M=>M.id===t),b=x.routeId,w=(k=n.routesById[b].options.remountDeps)!=null?k:n.options.defaultRemountDeps,C=w==null?void 0:w({routeId:b,loaderDeps:x.loaderDeps,params:x._strictParams,search:x._strictSearch});return{key:C?JSON.stringify(C):void 0,routeId:b,match:{id:x.id,status:x.status,error:x.error,invalid:x.invalid,_forcePending:x._forcePending,_displayPending:x._displayPending}}},structuralSharing:!0}),l=n.routesById[o],c=T.useMemo(()=>{var x;const v=(x=l.options.component)!=null?x:n.options.defaultComponent;return v?h.jsx(v,{},s):h.jsx(e2,{})},[s,l.options.component,n.options.defaultComponent]);if(a._displayPending)throw(u=n.getMatch(a.id))==null?void 0:u._nonReactive.displayPendingPromise;if(a._forcePending)throw(f=n.getMatch(a.id))==null?void 0:f._nonReactive.minPendingPromise;if(a.status==="pending"){const v=(m=l.options.pendingMinMs)!=null?m:n.options.defaultPendingMinMs;if(v){const x=n.getMatch(a.id);if(x&&!x._nonReactive.minPendingPromise){const b=Wl();x._nonReactive.minPendingPromise=b,setTimeout(()=>{b.resolve(),x._nonReactive.minPendingPromise=void 0},v)}}throw(p=n.getMatch(a.id))==null?void 0:p._nonReactive.loadPromise}if(a.status==="notFound")return As(Ga(a.error)),JS(n,l,a.error);if(a.status==="redirected")throw As(mi(a.error)),(y=n.getMatch(a.id))==null?void 0:y._nonReactive.loadPromise;if(a.status==="error")throw a.error;return c}),e2=T.memo(function(){const t=vi(),n=T.useContext(kh),a=gi({select:f=>{var m;return(m=f.matches.find(p=>p.id===n))==null?void 0:m.routeId}}),s=t.routesById[a],o=gi({select:f=>{const p=f.matches.find(y=>y.id===n);return As(p),p.globalNotFound}}),l=gi({select:f=>{var y;const m=f.matches,p=m.findIndex(v=>v.id===n);return(y=m[p+1])==null?void 0:y.id}}),c=t.options.defaultPendingComponent?h.jsx(t.options.defaultPendingComponent,{}):null;if(o)return JS(t,s,void 0);if(!l)return null;const u=h.jsx(WS,{matchId:l});return a===fi?h.jsx(T.Suspense,{fallback:c,children:u}):u});function wE(){var l;const e=vi(),n=(l=e.routesById[fi].options.pendingComponent)!=null?l:e.options.defaultPendingComponent,a=n?h.jsx(n,{}):null,s=typeof document!="undefined"&&e.ssr?Ol:T.Suspense,o=h.jsxs(s,{fallback:a,children:[h.jsx(yE,{}),h.jsx(SE,{})]});return e.options.InnerWrap?h.jsx(e.options.InnerWrap,{children:o}):o}function SE(){const e=vi(),t=gi({select:s=>{var o;return(o=s.matches[0])==null?void 0:o.id}}),n=gi({select:s=>s.loadedAt}),a=t?h.jsx(WS,{matchId:t}):null;return h.jsx(kh.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?a:h.jsx(lv,{getResetKey:()=>n,errorComponent:cv,onCatch:s=>{s.message||s.toString()},children:a})})}const CE=e=>new NE(e);class NE extends zj{constructor(t){super(t)}}typeof globalThis!="undefined"?(globalThis.createFileRoute=s_,globalThis.createLazyFileRoute=l_):typeof window!="undefined"&&(window.createFileRoute=s_,window.createLazyFileRoute=l_);function kE(a){var s=a,{router:e,children:t}=s,n=Me(s,["router","children"]);Object.keys(n).length>0&&e.update(Z(F(F({},e.options),n),{context:F(F({},e.options.context),n.context)}));const o=KS(),l=h.jsx(o.Provider,{value:e,children:t});return e.options.Wrap?h.jsx(e.options.Wrap,{children:l}):l}function ME(n){var a=n,{router:e}=a,t=Me(a,["router"]);return h.jsx(kE,Z(F({router:e},t),{children:h.jsx(wE,{})}))}var oc=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(){}},jE={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},xr,nv,xS,EE=(xS=class{constructor(){nt(this,xr,jE);nt(this,nv,!1)}setTimeoutProvider(e){Ve(this,xr,e)}setTimeout(e,t){return te(this,xr).setTimeout(e,t)}clearTimeout(e){te(this,xr).clearTimeout(e)}setInterval(e,t){return te(this,xr).setInterval(e,t)}clearInterval(e){te(this,xr).clearInterval(e)}},xr=new WeakMap,nv=new WeakMap,xS),bo=new EE;function RE(e){setTimeout(e,0)}var Bo=typeof window=="undefined"||"Deno"in globalThis;function da(){}function TE(e,t){return typeof e=="function"?e(t):e}function iy(e){return typeof e=="number"&&e>=0&&e!==1/0}function t2(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ar(e,t){return typeof e=="function"?e(t):e}function hi(e,t){return typeof e=="function"?e(t):e}function u_(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:l,stale:c}=e;if(l){if(a){if(t.queryHash!==pv(l,t.options))return!1}else if(!Au(t.queryKey,l))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||s&&s!==t.state.fetchStatus||o&&!o(t))}function d_(e,t){const{exact:n,status:a,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Uo(t.options.mutationKey)!==Uo(o))return!1}else if(!Au(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function pv(e,t){return((t==null?void 0:t.queryKeyHashFn)||Uo)(e)}function Uo(e){return JSON.stringify(e,(t,n)=>sy(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function Au(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Au(e[n],t[n])):!1}var AE=Object.prototype.hasOwnProperty;function n2(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=f_(e)&&f_(t);if(!a&&!(sy(e)&&sy(t)))return t;const o=(a?e:Object.keys(e)).length,l=a?t:Object.keys(t),c=l.length,u=a?new Array(c):{};let f=0;for(let m=0;m<c;m++){const p=a?m:l[m],y=e[p],v=t[p];if(y===v){u[p]=y,(a?m<o:AE.call(e,p))&&f++;continue}if(y===null||v===null||typeof y!="object"||typeof v!="object"){u[p]=v;continue}const x=n2(y,v,n+1);u[p]=x,x===y&&f++}return o===c&&f===o?e:u}function oh(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function f_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function sy(e){if(!h_(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!h_(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function h_(e){return Object.prototype.toString.call(e)==="[object Object]"}function DE(e){return new Promise(t=>{bo.setTimeout(t,e)})}function ry(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?n2(e,t):t}function LE(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function OE(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var mv=Symbol();function a2(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===mv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gv(e,t){return typeof e=="function"?e(...t):!!e}function IE(e,t,n){let a=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s!=null||(s=t()),a||(a=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var wo,br,$l,bS,zE=(bS=class extends oc{constructor(){super();nt(this,wo);nt(this,br);nt(this,$l);Ve(this,$l,t=>{if(!Bo&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){te(this,br)||this.setEventListener(te(this,$l))}onUnsubscribe(){var t;this.hasListeners()||((t=te(this,br))==null||t.call(this),Ve(this,br,void 0))}setEventListener(t){var n;Ve(this,$l,t),(n=te(this,br))==null||n.call(this),Ve(this,br,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){te(this,wo)!==t&&(Ve(this,wo,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof te(this,wo)=="boolean"?te(this,wo):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},wo=new WeakMap,br=new WeakMap,$l=new WeakMap,bS),yv=new zE;function oy(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function a(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{a({status:"fulfilled",value:s}),e(s)},n.reject=s=>{a({status:"rejected",reason:s}),t(s)},n}var BE=RE;function UE(){let e=[],t=0,n=c=>{c()},a=c=>{c()},s=BE;const o=c=>{t?e.push(c):s(()=>{n(c)})},l=()=>{const c=e;e=[],c.length&&s(()=>{a(()=>{c.forEach(u=>{n(u)})})})};return{batch:c=>{let u;t++;try{u=c()}finally{t--,t||l()}return u},batchCalls:c=>(...u)=>{o(()=>{c(...u)})},schedule:o,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{a=c},setScheduler:c=>{s=c}}}var Dn=UE(),Pl,_r,Hl,_S,FE=(_S=class extends oc{constructor(){super();nt(this,Pl,!0);nt(this,_r);nt(this,Hl);Ve(this,Hl,t=>{if(!Bo&&window.addEventListener){const n=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",a)}}})}onSubscribe(){te(this,_r)||this.setEventListener(te(this,Hl))}onUnsubscribe(){var t;this.hasListeners()||((t=te(this,_r))==null||t.call(this),Ve(this,_r,void 0))}setEventListener(t){var n;Ve(this,Hl,t),(n=te(this,_r))==null||n.call(this),Ve(this,_r,t(this.setOnline.bind(this)))}setOnline(t){te(this,Pl)!==t&&(Ve(this,Pl,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return te(this,Pl)}},Pl=new WeakMap,_r=new WeakMap,Hl=new WeakMap,_S),lh=new FE;function $E(e){return Math.min(1e3*$a(2,e),3e4)}function i2(e){return(e!=null?e:"online")==="online"?lh.isOnline():!0}var ly=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function s2(e){let t=!1,n=0,a;const s=oy(),o=()=>s.status!=="pending",l=b=>{var w;if(!o()){const C=new ly(b);y(C),(w=e.onCancel)==null||w.call(e,C)}},c=()=>{t=!0},u=()=>{t=!1},f=()=>yv.isFocused()&&(e.networkMode==="always"||lh.isOnline())&&e.canRun(),m=()=>i2(e.networkMode)&&e.canRun(),p=b=>{o()||(a==null||a(),s.resolve(b))},y=b=>{o()||(a==null||a(),s.reject(b))},v=()=>new Promise(b=>{var w;a=C=>{(o()||f())&&b(C)},(w=e.onPause)==null||w.call(e)}).then(()=>{var b;a=void 0,o()||(b=e.onContinue)==null||b.call(e)}),x=()=>{if(o())return;let b;const w=n===0?e.initialPromise:void 0;try{b=w!=null?w:e.fn()}catch(C){b=Promise.reject(C)}Promise.resolve(b).then(p).catch(C=>{var j,A,O;if(o())return;const N=(j=e.retry)!=null?j:Bo?0:3,k=(A=e.retryDelay)!=null?A:$E,M=typeof k=="function"?k(n,C):k,D=N===!0||typeof N=="number"&&n<N||typeof N=="function"&&N(n,C);if(t||!D){y(C);return}n++,(O=e.onFail)==null||O.call(e,n,C),DE(M).then(()=>f()?void 0:v()).then(()=>{t?y(C):x()})})};return{promise:s,status:()=>s.status,cancel:l,continue:()=>(a==null||a(),s),cancelRetry:c,continueRetry:u,canStart:m,start:()=>(m()?x():v().then(x),s)}}var So,wS,r2=(wS=class{constructor(){nt(this,So)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),iy(this.gcTime)&&Ve(this,So,bo.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e!=null?e:Bo?1/0:300*1e3)}clearGcTimeout(){te(this,So)&&(bo.clearTimeout(te(this,So)),Ve(this,So,void 0))}},So=new WeakMap,wS),Co,ql,di,No,$n,Hu,ko,Ri,Cs,SS,PE=(SS=class extends r2{constructor(t){var n;super();nt(this,Ri);nt(this,Co);nt(this,ql);nt(this,di);nt(this,No);nt(this,$n);nt(this,Hu);nt(this,ko);Ve(this,ko,!1),Ve(this,Hu,t.defaultOptions),this.setOptions(t.options),this.observers=[],Ve(this,No,t.client),Ve(this,di,te(this,No).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ve(this,Co,m_(this.options)),this.state=(n=t.state)!=null?n:te(this,Co),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=te(this,$n))==null?void 0:t.promise}setOptions(t){if(this.options=F(F({},te(this,Hu)),t),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=m_(this.options);n.data!==void 0&&(this.setState(p_(n.data,n.dataUpdatedAt)),Ve(this,Co,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&te(this,di).remove(this)}setData(t,n){const a=ry(this.state.data,t,this.options);return _t(this,Ri,Cs).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){_t(this,Ri,Cs).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=te(this,$n))==null?void 0:a.promise;return(s=te(this,$n))==null||s.cancel(t),n?n.then(da).catch(da):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(te(this,Co))}isActive(){return this.observers.some(t=>hi(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mv||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ar(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!t2(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=te(this,$n))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=te(this,$n))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),te(this,di).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(te(this,$n)&&(te(this,ko)?te(this,$n).cancel({revert:!0}):te(this,$n).cancelRetry()),this.scheduleGc()),te(this,di).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_t(this,Ri,Cs).call(this,{type:"invalidate"})}fetch(t,n){return ut(this,null,function*(){var u,f,m,p,y,v,x,b,w,C,N,k;if(this.state.fetchStatus!=="idle"&&((u=te(this,$n))==null?void 0:u.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(te(this,$n))return te(this,$n).continueRetry(),te(this,$n).promise}if(t&&this.setOptions(t),!this.options.queryFn){const M=this.observers.find(D=>D.options.queryFn);M&&this.setOptions(M.options)}const a=new AbortController,s=M=>{Object.defineProperty(M,"signal",{enumerable:!0,get:()=>(Ve(this,ko,!0),a.signal)})},o=()=>{const M=a2(this.options,n),j=(()=>{const A={client:te(this,No),queryKey:this.queryKey,meta:this.meta};return s(A),A})();return Ve(this,ko,!1),this.options.persister?this.options.persister(M,j,this):M(j)},c=(()=>{const M={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:te(this,No),state:this.state,fetchFn:o};return s(M),M})();(f=this.options.behavior)==null||f.onFetch(c,this),Ve(this,ql,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((m=c.fetchOptions)==null?void 0:m.meta))&&_t(this,Ri,Cs).call(this,{type:"fetch",meta:(p=c.fetchOptions)==null?void 0:p.meta}),Ve(this,$n,s2({initialPromise:n==null?void 0:n.initialPromise,fn:c.fetchFn,onCancel:M=>{M instanceof ly&&M.revert&&this.setState(Z(F({},te(this,ql)),{fetchStatus:"idle"})),a.abort()},onFail:(M,D)=>{_t(this,Ri,Cs).call(this,{type:"failed",failureCount:M,error:D})},onPause:()=>{_t(this,Ri,Cs).call(this,{type:"pause"})},onContinue:()=>{_t(this,Ri,Cs).call(this,{type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0}));try{const M=yield te(this,$n).start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(v=(y=te(this,di).config).onSuccess)==null||v.call(y,M,this),(b=(x=te(this,di).config).onSettled)==null||b.call(x,M,this.state.error,this),M}catch(M){if(M instanceof ly){if(M.silent)return te(this,$n).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw _t(this,Ri,Cs).call(this,{type:"error",error:M}),(C=(w=te(this,di).config).onError)==null||C.call(w,M,this),(k=(N=te(this,di).config).onSettled)==null||k.call(N,this.state.data,M,this),M}finally{this.scheduleGc()}})}},Co=new WeakMap,ql=new WeakMap,di=new WeakMap,No=new WeakMap,$n=new WeakMap,Hu=new WeakMap,ko=new WeakMap,Ri=new WeakSet,Cs=function(t){const n=a=>{var s;switch(t.type){case"failed":return Z(F({},a),{fetchFailureCount:t.failureCount,fetchFailureReason:t.error});case"pause":return Z(F({},a),{fetchStatus:"paused"});case"continue":return Z(F({},a),{fetchStatus:"fetching"});case"fetch":return Z(F(F({},a),o2(a.data,this.options)),{fetchMeta:(s=t.meta)!=null?s:null});case"success":const o=F(Z(F(F({},a),p_(t.data,t.dataUpdatedAt)),{dataUpdateCount:a.dataUpdateCount+1}),!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null});return Ve(this,ql,t.manual?o:void 0),o;case"error":const l=t.error;return Z(F({},a),{error:l,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0});case"invalidate":return Z(F({},a),{isInvalidated:!0});case"setState":return F(F({},a),t.state)}};this.state=n(this.state),Dn.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),te(this,di).notify({query:this,type:"updated",action:t})})},SS);function o2(e,t){return F({fetchFailureCount:0,fetchFailureReason:null,fetchStatus:i2(t.networkMode)?"fetching":"paused"},e===void 0&&{error:null,status:"pending"})}function p_(e,t){return{data:e,dataUpdatedAt:t!=null?t:Date.now(),error:null,isInvalidated:!1,status:"success"}}function m_(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a!=null?a:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var wa,jt,qu,ua,Mo,Vl,Ns,wr,Vu,Gl,Yl,jo,Eo,Sr,Xl,zt,yu,cy,uy,dy,fy,hy,py,my,l2,CS,HE=(CS=class extends oc{constructor(t,n){super();nt(this,zt);nt(this,wa);nt(this,jt);nt(this,qu);nt(this,ua);nt(this,Mo);nt(this,Vl);nt(this,Ns);nt(this,wr);nt(this,Vu);nt(this,Gl);nt(this,Yl);nt(this,jo);nt(this,Eo);nt(this,Sr);nt(this,Xl,new Set);this.options=n,Ve(this,wa,t),Ve(this,wr,null),Ve(this,Ns,oy()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(te(this,jt).addObserver(this),g_(te(this,jt),this.options)?_t(this,zt,yu).call(this):this.updateResult(),_t(this,zt,fy).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return gy(te(this,jt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return gy(te(this,jt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_t(this,zt,hy).call(this),_t(this,zt,py).call(this),te(this,jt).removeObserver(this)}setOptions(t){const n=this.options,a=te(this,jt);if(this.options=te(this,wa).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof hi(this.options.enabled,te(this,jt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_t(this,zt,my).call(this),te(this,jt).setOptions(this.options),n._defaulted&&!oh(this.options,n)&&te(this,wa).getQueryCache().notify({type:"observerOptionsUpdated",query:te(this,jt),observer:this});const s=this.hasListeners();s&&y_(te(this,jt),a,this.options,n)&&_t(this,zt,yu).call(this),this.updateResult(),s&&(te(this,jt)!==a||hi(this.options.enabled,te(this,jt))!==hi(n.enabled,te(this,jt))||Ar(this.options.staleTime,te(this,jt))!==Ar(n.staleTime,te(this,jt)))&&_t(this,zt,cy).call(this);const o=_t(this,zt,uy).call(this);s&&(te(this,jt)!==a||hi(this.options.enabled,te(this,jt))!==hi(n.enabled,te(this,jt))||o!==te(this,Sr))&&_t(this,zt,dy).call(this,o)}getOptimisticResult(t){const n=te(this,wa).getQueryCache().build(te(this,wa),t),a=this.createResult(n,t);return VE(this,a)&&(Ve(this,ua,a),Ve(this,Vl,this.options),Ve(this,Mo,te(this,jt).state)),a}getCurrentResult(){return te(this,ua)}trackResult(t,n){return new Proxy(t,{get:(a,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&te(this,Ns).status==="pending"&&te(this,Ns).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){te(this,Xl).add(t)}getCurrentQuery(){return te(this,jt)}refetch(n={}){var t=Me(n,[]);return this.fetch(F({},t))}fetchOptimistic(t){const n=te(this,wa).defaultQueryOptions(t),a=te(this,wa).getQueryCache().build(te(this,wa),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){var n;return _t(this,zt,yu).call(this,Z(F({},t),{cancelRefetch:(n=t.cancelRefetch)!=null?n:!0})).then(()=>(this.updateResult(),te(this,ua)))}createResult(t,n){var R;const a=te(this,jt),s=this.options,o=te(this,ua),l=te(this,Mo),c=te(this,Vl),f=t!==a?t.state:te(this,qu),{state:m}=t;let p=F({},m),y=!1,v;if(n._optimisticResults){const E=this.hasListeners(),I=!E&&g_(t,n),L=E&&y_(t,a,n,s);(I||L)&&(p=F(F({},p),o2(m.data,t.options))),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:b,status:w}=p;v=p.data;let C=!1;if(n.placeholderData!==void 0&&v===void 0&&w==="pending"){let E;o!=null&&o.isPlaceholderData&&n.placeholderData===(c==null?void 0:c.placeholderData)?(E=o.data,C=!0):E=typeof n.placeholderData=="function"?n.placeholderData((R=te(this,Yl))==null?void 0:R.state.data,te(this,Yl)):n.placeholderData,E!==void 0&&(w="success",v=ry(o==null?void 0:o.data,E,n),y=!0)}if(n.select&&v!==void 0&&!C)if(o&&v===(l==null?void 0:l.data)&&n.select===te(this,Vu))v=te(this,Gl);else try{Ve(this,Vu,n.select),v=n.select(v),v=ry(o==null?void 0:o.data,v,n),Ve(this,Gl,v),Ve(this,wr,null)}catch(E){Ve(this,wr,E)}te(this,wr)&&(x=te(this,wr),v=te(this,Gl),b=Date.now(),w="error");const N=p.fetchStatus==="fetching",k=w==="pending",M=w==="error",D=k&&N,j=v!==void 0,O={status:w,fetchStatus:p.fetchStatus,isPending:k,isSuccess:w==="success",isError:M,isInitialLoading:D,isLoading:D,data:v,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:b,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:N,isRefetching:N&&!k,isLoadingError:M&&!j,isPaused:p.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:M&&j,isStale:vv(t,n),refetch:this.refetch,promise:te(this,Ns),isEnabled:hi(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const E=O.data!==void 0,I=O.status==="error"&&!E,L=$=>{I?$.reject(O.error):E&&$.resolve(O.data)},H=()=>{const $=Ve(this,Ns,O.promise=oy());L($)},U=te(this,Ns);switch(U.status){case"pending":t.queryHash===a.queryHash&&L(U);break;case"fulfilled":(I||O.data!==U.value)&&H();break;case"rejected":(!I||O.error!==U.reason)&&H();break}}return O}updateResult(){const t=te(this,ua),n=this.createResult(te(this,jt),this.options);if(Ve(this,Mo,te(this,jt).state),Ve(this,Vl,this.options),te(this,Mo).data!==void 0&&Ve(this,Yl,te(this,jt)),oh(n,t))return;Ve(this,ua,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!te(this,Xl).size)return!0;const l=new Set(o!=null?o:te(this,Xl));return this.options.throwOnError&&l.add("error"),Object.keys(te(this,ua)).some(c=>{const u=c;return te(this,ua)[u]!==t[u]&&l.has(u)})};_t(this,zt,l2).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_t(this,zt,fy).call(this)}},wa=new WeakMap,jt=new WeakMap,qu=new WeakMap,ua=new WeakMap,Mo=new WeakMap,Vl=new WeakMap,Ns=new WeakMap,wr=new WeakMap,Vu=new WeakMap,Gl=new WeakMap,Yl=new WeakMap,jo=new WeakMap,Eo=new WeakMap,Sr=new WeakMap,Xl=new WeakMap,zt=new WeakSet,yu=function(t){_t(this,zt,my).call(this);let n=te(this,jt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(da)),n},cy=function(){_t(this,zt,hy).call(this);const t=Ar(this.options.staleTime,te(this,jt));if(Bo||te(this,ua).isStale||!iy(t))return;const a=t2(te(this,ua).dataUpdatedAt,t)+1;Ve(this,jo,bo.setTimeout(()=>{te(this,ua).isStale||this.updateResult()},a))},uy=function(){var t;return(t=typeof this.options.refetchInterval=="function"?this.options.refetchInterval(te(this,jt)):this.options.refetchInterval)!=null?t:!1},dy=function(t){_t(this,zt,py).call(this),Ve(this,Sr,t),!(Bo||hi(this.options.enabled,te(this,jt))===!1||!iy(te(this,Sr))||te(this,Sr)===0)&&Ve(this,Eo,bo.setInterval(()=>{(this.options.refetchIntervalInBackground||yv.isFocused())&&_t(this,zt,yu).call(this)},te(this,Sr)))},fy=function(){_t(this,zt,cy).call(this),_t(this,zt,dy).call(this,_t(this,zt,uy).call(this))},hy=function(){te(this,jo)&&(bo.clearTimeout(te(this,jo)),Ve(this,jo,void 0))},py=function(){te(this,Eo)&&(bo.clearInterval(te(this,Eo)),Ve(this,Eo,void 0))},my=function(){const t=te(this,wa).getQueryCache().build(te(this,wa),this.options);if(t===te(this,jt))return;const n=te(this,jt);Ve(this,jt,t),Ve(this,qu,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},l2=function(t){Dn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(te(this,ua))}),te(this,wa).getQueryCache().notify({query:te(this,jt),type:"observerResultsUpdated"})})},CS);function qE(e,t){return hi(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function g_(e,t){return qE(e,t)||e.state.data!==void 0&&gy(e,t,t.refetchOnMount)}function gy(e,t,n){if(hi(t.enabled,e)!==!1&&Ar(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&vv(e,t)}return!1}function y_(e,t,n,a){return(e!==t||hi(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&vv(e,n)}function vv(e,t){return hi(t.enabled,e)!==!1&&e.isStaleByTime(Ar(t.staleTime,e))}function VE(e,t){return!oh(e.getCurrentResult(),t)}function v_(e){return{onFetch:(t,n)=>{var m,p,y,v,x;const a=t.options,s=(y=(p=(m=t.fetchOptions)==null?void 0:m.meta)==null?void 0:p.fetchMore)==null?void 0:y.direction,o=((v=t.state.data)==null?void 0:v.pages)||[],l=((x=t.state.data)==null?void 0:x.pageParams)||[];let c={pages:[],pageParams:[]},u=0;const f=()=>ut(null,null,function*(){var k;let b=!1;const w=M=>{IE(M,()=>t.signal,()=>b=!0)},C=a2(t.options,t.fetchOptions),N=(M,D,j)=>ut(null,null,function*(){if(b)return Promise.reject();if(D==null&&M.pages.length)return Promise.resolve(M);const O=(()=>{const L={client:t.client,queryKey:t.queryKey,pageParam:D,direction:j?"backward":"forward",meta:t.options.meta};return w(L),L})(),R=yield C(O),{maxPages:E}=t.options,I=j?OE:LE;return{pages:I(M.pages,R,E),pageParams:I(M.pageParams,D,E)}});if(s&&o.length){const M=s==="backward",D=M?GE:x_,j={pages:o,pageParams:l},A=D(a,j);c=yield N(j,A,M)}else{const M=e!=null?e:o.length;do{const D=u===0?(k=l[0])!=null?k:a.initialPageParam:x_(a,c);if(u>0&&D==null)break;c=yield N(c,D),u++}while(u<M)}return c});t.options.persister?t.fetchFn=()=>{var b,w;return(w=(b=t.options).persister)==null?void 0:w.call(b,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=f}}}function x_(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function GE(e,{pages:t,pageParams:n}){var a;return t.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,t[0],t,n[0],n):void 0}var Gu,Ki,Wn,Ro,Qi,yr,NS,YE=(NS=class extends r2{constructor(t){super();nt(this,Qi);nt(this,Gu);nt(this,Ki);nt(this,Wn);nt(this,Ro);Ve(this,Gu,t.client),this.mutationId=t.mutationId,Ve(this,Wn,t.mutationCache),Ve(this,Ki,[]),this.state=t.state||c2(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){te(this,Ki).includes(t)||(te(this,Ki).push(t),this.clearGcTimeout(),te(this,Wn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ve(this,Ki,te(this,Ki).filter(n=>n!==t)),this.scheduleGc(),te(this,Wn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){te(this,Ki).length||(this.state.status==="pending"?this.scheduleGc():te(this,Wn).remove(this))}continue(){var t,n;return(n=(t=te(this,Ro))==null?void 0:t.continue())!=null?n:this.execute(this.state.variables)}execute(t){return ut(this,null,function*(){var l,c,u,f,m,p,y,v,x,b,w,C,N,k,M,D,j,A,O;const n=()=>{_t(this,Qi,yr).call(this,{type:"continue"})},a={client:te(this,Gu),meta:this.options.meta,mutationKey:this.options.mutationKey};Ve(this,Ro,s2({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(R,E)=>{_t(this,Qi,yr).call(this,{type:"failed",failureCount:R,error:E})},onPause:()=>{_t(this,Qi,yr).call(this,{type:"pause"})},onContinue:n,retry:(l=this.options.retry)!=null?l:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>te(this,Wn).canRun(this)}));const s=this.state.status==="pending",o=!te(this,Ro).canStart();try{if(s)n();else{_t(this,Qi,yr).call(this,{type:"pending",variables:t,isPaused:o}),te(this,Wn).config.onMutate&&(yield te(this,Wn).config.onMutate(t,this,a));const E=yield(u=(c=this.options).onMutate)==null?void 0:u.call(c,t,a);E!==this.state.context&&_t(this,Qi,yr).call(this,{type:"pending",context:E,variables:t,isPaused:o})}const R=yield te(this,Ro).start();return yield(m=(f=te(this,Wn).config).onSuccess)==null?void 0:m.call(f,R,t,this.state.context,this,a),yield(y=(p=this.options).onSuccess)==null?void 0:y.call(p,R,t,this.state.context,a),yield(x=(v=te(this,Wn).config).onSettled)==null?void 0:x.call(v,R,null,this.state.variables,this.state.context,this,a),yield(w=(b=this.options).onSettled)==null?void 0:w.call(b,R,null,t,this.state.context,a),_t(this,Qi,yr).call(this,{type:"success",data:R}),R}catch(R){try{yield(N=(C=te(this,Wn).config).onError)==null?void 0:N.call(C,R,t,this.state.context,this,a)}catch(E){Promise.reject(E)}try{yield(M=(k=this.options).onError)==null?void 0:M.call(k,R,t,this.state.context,a)}catch(E){Promise.reject(E)}try{yield(j=(D=te(this,Wn).config).onSettled)==null?void 0:j.call(D,void 0,R,this.state.variables,this.state.context,this,a)}catch(E){Promise.reject(E)}try{yield(O=(A=this.options).onSettled)==null?void 0:O.call(A,void 0,R,t,this.state.context,a)}catch(E){Promise.reject(E)}throw _t(this,Qi,yr).call(this,{type:"error",error:R}),R}finally{te(this,Wn).runNext(this)}})}},Gu=new WeakMap,Ki=new WeakMap,Wn=new WeakMap,Ro=new WeakMap,Qi=new WeakSet,yr=function(t){const n=a=>{switch(t.type){case"failed":return Z(F({},a),{failureCount:t.failureCount,failureReason:t.error});case"pause":return Z(F({},a),{isPaused:!0});case"continue":return Z(F({},a),{isPaused:!1});case"pending":return Z(F({},a),{context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()});case"success":return Z(F({},a),{data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1});case"error":return Z(F({},a),{data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"})}};this.state=n(this.state),Dn.batch(()=>{te(this,Ki).forEach(a=>{a.onMutationUpdate(t)}),te(this,Wn).notify({mutation:this,type:"updated",action:t})})},NS);function c2(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ks,Ti,Yu,kS,XE=(kS=class extends oc{constructor(t={}){super();nt(this,ks);nt(this,Ti);nt(this,Yu);this.config=t,Ve(this,ks,new Set),Ve(this,Ti,new Map),Ve(this,Yu,0)}build(t,n,a){const s=new YE({client:t,mutationCache:this,mutationId:++wf(this,Yu)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){te(this,ks).add(t);const n=kf(t);if(typeof n=="string"){const a=te(this,Ti).get(n);a?a.push(t):te(this,Ti).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(te(this,ks).delete(t)){const n=kf(t);if(typeof n=="string"){const a=te(this,Ti).get(n);if(a)if(a.length>1){const s=a.indexOf(t);s!==-1&&a.splice(s,1)}else a[0]===t&&te(this,Ti).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=kf(t);if(typeof n=="string"){const a=te(this,Ti).get(n),s=a==null?void 0:a.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var a,s;const n=kf(t);if(typeof n=="string"){const o=(a=te(this,Ti).get(n))==null?void 0:a.find(l=>l!==t&&l.state.isPaused);return(s=o==null?void 0:o.continue())!=null?s:Promise.resolve()}else return Promise.resolve()}clear(){Dn.batch(()=>{te(this,ks).forEach(t=>{this.notify({type:"removed",mutation:t})}),te(this,ks).clear(),te(this,Ti).clear()})}getAll(){return Array.from(te(this,ks))}find(t){const n=F({exact:!0},t);return this.getAll().find(a=>d_(n,a))}findAll(t={}){return this.getAll().filter(n=>d_(t,n))}notify(t){Dn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Dn.batch(()=>Promise.all(t.map(n=>n.continue().catch(da))))}},ks=new WeakMap,Ti=new WeakMap,Yu=new WeakMap,kS);function kf(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ms,Cr,Sa,js,Ts,Yf,yy,MS,KE=(MS=class extends oc{constructor(n,a){super();nt(this,Ts);nt(this,Ms);nt(this,Cr);nt(this,Sa);nt(this,js);Ve(this,Ms,n),this.setOptions(a),this.bindMethods(),_t(this,Ts,Yf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const a=this.options;this.options=te(this,Ms).defaultMutationOptions(n),oh(this.options,a)||te(this,Ms).getMutationCache().notify({type:"observerOptionsUpdated",mutation:te(this,Sa),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&Uo(a.mutationKey)!==Uo(this.options.mutationKey)?this.reset():((s=te(this,Sa))==null?void 0:s.state.status)==="pending"&&te(this,Sa).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=te(this,Sa))==null||n.removeObserver(this)}onMutationUpdate(n){_t(this,Ts,Yf).call(this),_t(this,Ts,yy).call(this,n)}getCurrentResult(){return te(this,Cr)}reset(){var n;(n=te(this,Sa))==null||n.removeObserver(this),Ve(this,Sa,void 0),_t(this,Ts,Yf).call(this),_t(this,Ts,yy).call(this)}mutate(n,a){var s;return Ve(this,js,a),(s=te(this,Sa))==null||s.removeObserver(this),Ve(this,Sa,te(this,Ms).getMutationCache().build(te(this,Ms),this.options)),te(this,Sa).addObserver(this),te(this,Sa).execute(n)}},Ms=new WeakMap,Cr=new WeakMap,Sa=new WeakMap,js=new WeakMap,Ts=new WeakSet,Yf=function(){var a,s;const n=(s=(a=te(this,Sa))==null?void 0:a.state)!=null?s:c2();Ve(this,Cr,Z(F({},n),{isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset}))},yy=function(n){Dn.batch(()=>{var a,s,o,l,c,u,f,m;if(te(this,js)&&this.hasListeners()){const p=te(this,Cr).variables,y=te(this,Cr).context,v={client:te(this,Ms),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=te(this,js)).onSuccess)==null||s.call(a,n.data,p,y,v)}catch(x){Promise.reject(x)}try{(l=(o=te(this,js)).onSettled)==null||l.call(o,n.data,null,p,y,v)}catch(x){Promise.reject(x)}}else if((n==null?void 0:n.type)==="error"){try{(u=(c=te(this,js)).onError)==null||u.call(c,n.error,p,y,v)}catch(x){Promise.reject(x)}try{(m=(f=te(this,js)).onSettled)==null||m.call(f,void 0,n.error,p,y,v)}catch(x){Promise.reject(x)}}}this.listeners.forEach(p=>{p(te(this,Cr))})})},MS),Zi,jS,QE=(jS=class extends oc{constructor(t={}){super();nt(this,Zi);this.config=t,Ve(this,Zi,new Map)}build(t,n,a){var c;const s=n.queryKey,o=(c=n.queryHash)!=null?c:pv(s,n);let l=this.get(o);return l||(l=new PE({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(l)),l}add(t){te(this,Zi).has(t.queryHash)||(te(this,Zi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=te(this,Zi).get(t.queryHash);n&&(t.destroy(),n===t&&te(this,Zi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Dn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return te(this,Zi).get(t)}getAll(){return[...te(this,Zi).values()]}find(t){const n=F({exact:!0},t);return this.getAll().find(a=>u_(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>u_(t,a)):n}notify(t){Dn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Dn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Dn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Zi=new WeakMap,jS),mn,Nr,kr,Kl,Ql,Mr,Zl,Jl,ES,ZE=(ES=class{constructor(e={}){nt(this,mn);nt(this,Nr);nt(this,kr);nt(this,Kl);nt(this,Ql);nt(this,Mr);nt(this,Zl);nt(this,Jl);Ve(this,mn,e.queryCache||new QE),Ve(this,Nr,e.mutationCache||new XE),Ve(this,kr,e.defaultOptions||{}),Ve(this,Kl,new Map),Ve(this,Ql,new Map),Ve(this,Mr,0)}mount(){wf(this,Mr)._++,te(this,Mr)===1&&(Ve(this,Zl,yv.subscribe(e=>ut(this,null,function*(){e&&(yield this.resumePausedMutations(),te(this,mn).onFocus())}))),Ve(this,Jl,lh.subscribe(e=>ut(this,null,function*(){e&&(yield this.resumePausedMutations(),te(this,mn).onOnline())}))))}unmount(){var e,t;wf(this,Mr)._--,te(this,Mr)===0&&((e=te(this,Zl))==null||e.call(this),Ve(this,Zl,void 0),(t=te(this,Jl))==null||t.call(this),Ve(this,Jl,void 0))}isFetching(e){return te(this,mn).findAll(Z(F({},e),{fetchStatus:"fetching"})).length}isMutating(e){return te(this,Nr).findAll(Z(F({},e),{status:"pending"})).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=te(this,mn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=te(this,mn).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ar(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return te(this,mn).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),s=te(this,mn).get(a.queryHash),o=s==null?void 0:s.state.data,l=TE(t,o);if(l!==void 0)return te(this,mn).build(this,a).setData(l,Z(F({},n),{manual:!0}))}setQueriesData(e,t,n){return Dn.batch(()=>te(this,mn).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=te(this,mn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=te(this,mn);Dn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=te(this,mn);return Dn.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries(F({type:"active"},e),t)))}cancelQueries(e,t={}){const n=F({revert:!0},t),a=Dn.batch(()=>te(this,mn).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(da).catch(da)}invalidateQueries(e,t={}){return Dn.batch(()=>{var n,a;return te(this,mn).findAll(e).forEach(s=>{s.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries(Z(F({},e),{type:(a=(n=e==null?void 0:e.refetchType)!=null?n:e==null?void 0:e.type)!=null?a:"active"}),t)})}refetchQueries(e,t={}){var s;const n=Z(F({},t),{cancelRefetch:(s=t.cancelRefetch)!=null?s:!0}),a=Dn.batch(()=>te(this,mn).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let l=o.fetch(void 0,n);return n.throwOnError||(l=l.catch(da)),o.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(a).then(da)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=te(this,mn).build(this,t);return n.isStaleByTime(Ar(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(da).catch(da)}fetchInfiniteQuery(e){return e.behavior=v_(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(da).catch(da)}ensureInfiniteQueryData(e){return e.behavior=v_(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return lh.isOnline()?te(this,Nr).resumePausedMutations():Promise.resolve()}getQueryCache(){return te(this,mn)}getMutationCache(){return te(this,Nr)}getDefaultOptions(){return te(this,kr)}setDefaultOptions(e){Ve(this,kr,e)}setQueryDefaults(e,t){te(this,Kl).set(Uo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...te(this,Kl).values()],n={};return t.forEach(a=>{Au(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){te(this,Ql).set(Uo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...te(this,Ql).values()],n={};return t.forEach(a=>{Au(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t=Z(F(F(F({},te(this,kr).queries),this.getQueryDefaults(e.queryKey)),e),{_defaulted:!0});return t.queryHash||(t.queryHash=pv(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===mv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:Z(F(F(F({},te(this,kr).mutations),(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey)),e),{_defaulted:!0})}clear(){te(this,mn).clear(),te(this,Nr).clear()}},mn=new WeakMap,Nr=new WeakMap,kr=new WeakMap,Kl=new WeakMap,Ql=new WeakMap,Mr=new WeakMap,Zl=new WeakMap,Jl=new WeakMap,ES),u2=T.createContext(void 0),ts=e=>{const t=T.useContext(u2);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},JE=({client:e,children:t})=>(T.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),h.jsx(u2.Provider,{value:e,children:t})),d2=T.createContext(!1),WE=()=>T.useContext(d2);d2.Provider;function eR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var tR=T.createContext(eR()),nR=()=>T.useContext(tR),aR=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?gv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},iR=e=>{T.useEffect(()=>{e.clearReset()},[e])},sR=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||gv(n,[e.error,a])),rR=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s!=null?s:1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...s)=>n(a(...s)):n(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},oR=(e,t)=>e.isLoading&&e.isFetching&&!t,lR=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,b_=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function cR(e,t,n){var y,v,x,b;const a=WE(),s=nR(),o=ts(),l=o.defaultQueryOptions(e);(v=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||v.call(y,l);const c=o.getQueryCache().get(l.queryHash);l._optimisticResults=a?"isRestoring":"optimistic",rR(l),aR(l,s,c),iR(s);const u=!o.getQueryCache().get(l.queryHash),[f]=T.useState(()=>new t(o,l)),m=f.getOptimisticResult(l),p=!a&&e.subscribed!==!1;if(T.useSyncExternalStore(T.useCallback(w=>{const C=p?f.subscribe(Dn.batchCalls(w)):da;return f.updateResult(),C},[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),T.useEffect(()=>{f.setOptions(l)},[l,f]),lR(l,m))throw b_(l,f,s);if(sR({result:m,errorResetBoundary:s,throwOnError:l.throwOnError,query:c,suspense:l.suspense}))throw m.error;if((b=(x=o.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||b.call(x,l,m),l.experimental_prefetchInRender&&!Bo&&oR(m,a)){const w=u?b_(l,f,s):c==null?void 0:c.promise;w==null||w.catch(da).finally(()=>{f.updateResult()})}return l.notifyOnChangeProps?m:f.trackResult(m)}function lc(e,t){return cR(e,HE)}function cc(e,t){const n=ts(),[a]=T.useState(()=>new KE(n,e));T.useEffect(()=>{a.setOptions(e)},[a,e]);const s=T.useSyncExternalStore(T.useCallback(l=>a.subscribe(Dn.batchCalls(l)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=T.useCallback((l,c)=>{a.mutate(l,c).catch(da)},[a]);if(s.error&&gv(a.options.throwOnError,[s.error]))throw s.error;return Z(F({},s),{mutate:o,mutateAsync:s.mutate})}const uR="dr_auth_token";function dR(){const e=window.fetch;window.fetch=function(...t){const[n,a]=t,s=typeof window!="undefined"?localStorage.getItem(uR):null,o=a||{};if(s&&!o.headers)o.headers={Authorization:`Bearer ${s}`};else if(s&&o.headers){const l=o.headers;l.Authorization||(l.Authorization=`Bearer ${s}`)}return e(n,o)},console.log("[FetchInterceptor] Installed - will add Authorization header to all requests")}var fR={};class Qn extends Error{constructor(t,n,a){super(`${t} failed: ${n} ${a}`),this.request=t,this.status=n,this.body=a,this.name="ApiError"}get serverMessage(){try{const t=JSON.parse(this.body);return typeof t.error=="string"&&t.error?t.error:void 0}catch(t){return}}}class hR{constructor(t){Lt(this,"baseUrl");Lt(this,"token",null);this.baseUrl=t,this.loadToken()}loadToken(){typeof window!="undefined"&&(this.token=localStorage.getItem("dr_auth_token"))}setToken(t){this.token=t}getBaseUrl(){return this.baseUrl}getHeaders(){const t={"Content-Type":"application/json"};return this.token&&(t.Authorization=`Bearer ${this.token}`),t}gethealth(){return ut(this,null,function*(){const a=`${this.getBaseUrl()}/health`,s={method:"GET",headers:this.getHeaders(),credentials:"include"},o=yield fetch(a,s);if(!o.ok)throw new Qn("GET /health",o.status,yield o.text());return o.json()})}getapimodel(){return ut(this,null,function*(){const a=`${this.getBaseUrl()}/api/model`,s={method:"GET",headers:this.getHeaders(),credentials:"include"},o=yield fetch(a,s);if(!o.ok)throw new Qn("GET /api/model",o.status,yield o.text());return o.json()})}getapilayerslayerName(t){return ut(this,null,function*(){const n=this.getBaseUrl(),a=`/api/layers/${encodeURIComponent(t)}`,s=`${n}${a}`,o={method:"GET",headers:this.getHeaders(),credentials:"include"},l=yield fetch(s,o);if(!l.ok)throw new Qn("GET /api/layers/:layerName",l.status,yield l.text());return l.json()})}getapispec(){return ut(this,null,function*(){const a=`${this.getBaseUrl()}/api/spec`,s={method:"GET",headers:this.getHeaders(),credentials:"include"},o=yield fetch(a,s);if(!o.ok)throw new Qn("GET /api/spec",o.status,yield o.text());return o.json()})}getapiannotations(t){return ut(this,null,function*(){const n=this.getBaseUrl(),a="/api/annotations",s=new URLSearchParams;t&&Object.entries(t).forEach(([u,f])=>{f!=null&&s.append(u,f)});const o=s.toString()?`${n}${a}?${s.toString()}`:`${n}${a}`,l={method:"GET",headers:this.getHeaders(),credentials:"include"},c=yield fetch(o,l);if(!c.ok)throw new Qn("GET /api/annotations",c.status,yield c.text());return c.json()})}postapiannotations(t){return ut(this,null,function*(){const s=`${this.getBaseUrl()}/api/annotations`,o={method:"POST",headers:this.getHeaders(),credentials:"include"};t&&(o.body=JSON.stringify(t));const l=yield fetch(s,o);if(!l.ok)throw new Qn("POST /api/annotations",l.status,yield l.text());return l.json()})}getapiannotationsannotationId(t){return ut(this,null,function*(){const n=this.getBaseUrl(),a=`/api/annotations/${encodeURIComponent(t)}`,s=`${n}${a}`,o={method:"GET",headers:this.getHeaders(),credentials:"include"},l=yield fetch(s,o);if(!l.ok)throw new Qn("GET /api/annotations/:annotationId",l.status,yield l.text());return l.json()})}putapiannotationsannotationId(t,n){return ut(this,null,function*(){const a=this.getBaseUrl(),s=`/api/annotations/${encodeURIComponent(t)}`,o=`${a}${s}`,l={method:"PUT",headers:this.getHeaders(),credentials:"include"};n&&(l.body=JSON.stringify(n));const c=yield fetch(o,l);if(!c.ok)throw new Qn("PUT /api/annotations/:annotationId",c.status,yield c.text());return c.json()})}patchapiannotationsannotationId(t,n){return ut(this,null,function*(){const a=this.getBaseUrl(),s=`/api/annotations/${encodeURIComponent(t)}`,o=`${a}${s}`,l={method:"PATCH",headers:this.getHeaders(),credentials:"include"};n&&(l.body=JSON.stringify(n));const c=yield fetch(o,l);if(!c.ok)throw new Qn("PATCH /api/annotations/:annotationId",c.status,yield c.text());return c.json()})}deleteapiannotationsannotationId(t){return ut(this,null,function*(){const n=this.getBaseUrl(),a=`/api/annotations/${encodeURIComponent(t)}`,s=`${n}${a}`,o={method:"DELETE",headers:this.getHeaders(),credentials:"include"},l=yield fetch(s,o);if(!l.ok)throw new Qn("DELETE /api/annotations/:annotationId",l.status,yield l.text());if(l.status!==204)return l.json()})}getapiannotationsannotationIdreplies(t){return ut(this,null,function*(){const n=this.getBaseUrl(),a=`/api/annotations/${encodeURIComponent(t)}/replies`,s=`${n}${a}`,o={method:"GET",headers:this.getHeaders(),credentials:"include"},l=yield fetch(s,o);if(!l.ok)throw new Qn("GET /api/annotations/:annotationId/replies",l.status,yield l.text());return l.json()})}postapiannotationsannotationIdreplies(t,n){return ut(this,null,function*(){const a=this.getBaseUrl(),s=`/api/annotations/${encodeURIComponent(t)}/replies`,o=`${a}${s}`,l={method:"POST",headers:this.getHeaders(),credentials:"include"};n&&(l.body=JSON.stringify(n));const c=yield fetch(o,l);if(!c.ok)throw new Qn("POST /api/annotations/:annotationId/replies",c.status,yield c.text());return c.json()})}getapichangesets(){return ut(this,null,function*(){const a=`${this.getBaseUrl()}/api/changesets`,s={method:"GET",headers:this.getHeaders(),credentials:"include"},o=yield fetch(a,s);if(!o.ok)throw new Qn("GET /api/changesets",o.status,yield o.text());return o.json()})}getapichangesetschangesetId(t){return ut(this,null,function*(){const n=this.getBaseUrl(),a=`/api/changesets/${encodeURIComponent(t)}`,s=`${n}${a}`,o={method:"GET",headers:this.getHeaders(),credentials:"include"},l=yield fetch(s,o);if(!l.ok)throw new Qn("GET /api/changesets/:changesetId",l.status,yield l.text());return l.json()})}postapichangesetschangesetIdcommit(t){return ut(this,null,function*(){const n=this.getBaseUrl(),a=`/api/changesets/${encodeURIComponent(t)}/commit`,s=`${n}${a}`,o={method:"POST",headers:this.getHeaders(),credentials:"include"},l=yield fetch(s,o);if(!l.ok)throw new Qn("POST /api/changesets/:changesetId/commit",l.status,yield l.text());return l.json()})}postapichangesetschangesetIddiscard(t){return ut(this,null,function*(){const n=this.getBaseUrl(),a=`/api/changesets/${encodeURIComponent(t)}/discard`,s=`${n}${a}`,o={method:"POST",headers:this.getHeaders(),credentials:"include"},l=yield fetch(s,o);if(!l.ok)throw new Qn("POST /api/changesets/:changesetId/discard",l.status,yield l.text());return l.json()})}}let ug=null;function $o(e){if(!ug){const t=typeof window!="undefined"?window.location.origin:fR.API_URL||"http://localhost:8080";ug=new hR(t)}return ug}const uc=$o();function pR(e){return lc({queryKey:["getapimodel"],queryFn:()=>uc.getapimodel()})}function mR(e){return lc({queryKey:["getapispec"],queryFn:()=>uc.getapispec()})}function gR(e){return lc({queryKey:["getapichangesets"],queryFn:()=>uc.getapichangesets()})}function yR(e,t){return lc(F({queryKey:["getapichangesetschangesetId",e],queryFn:()=>uc.getapichangesetschangesetId(e)},t))}function vR(e,t){const n=ts();return cc(F({mutationFn:()=>uc.postapichangesetschangesetIdcommit(e),onSuccess:()=>{n.invalidateQueries({queryKey:["getapichangesets"]}),n.invalidateQueries({queryKey:["getapichangesetschangesetId",e]}),n.invalidateQueries({queryKey:["getapimodel"]}),n.invalidateQueries({queryKey:["getapilayerslayerName"]})}},t))}function xR(e,t){const n=ts();return cc(F({mutationFn:()=>uc.postapichangesetschangesetIddiscard(e),onSuccess:()=>{n.invalidateQueries({queryKey:["getapichangesets"]}),n.invalidateQueries({queryKey:["getapichangesetschangesetId",e]})}},t))}function bR(){return new ZE({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1e3*60*10,retry:1},mutations:{retry:0}}})}const Nu="dr_auth_token";function __(){if(typeof window=="undefined")return null;const e=localStorage.getItem(Nu);if(e)return console.log("[Auth] Token loaded from localStorage"),e;const t=_R();return t?(console.log("[Auth] Token loaded from cookie"),t):(console.log("[Auth] No token found - running in development mode"),null)}function _R(){if(typeof document=="undefined")return null;const e=document.cookie.split(";").map(t=>t.trim()).find(t=>t.startsWith(`${Nu}=`));if(!e)return null;try{return decodeURIComponent(e.split("=")[1]||"")}catch(t){return e.split("=")[1]||null}}const xv=Sh((e,t)=>({token:__(),isAuthenticated:!!__(),setToken:n=>{typeof window!="undefined"&&(n?localStorage.setItem(Nu,n):localStorage.removeItem(Nu)),e({token:n,isAuthenticated:!!n}),console.log("[Auth] Token updated:",n?"present":"cleared")},clearToken:()=>{typeof window!="undefined"&&localStorage.removeItem(Nu),e({token:null,isAuthenticated:!1}),console.log("[Auth] Token cleared from store and localStorage")},getAuthHeaders:()=>{const{token:n}=t();return n?{Authorization:`Bearer ${n}`}:{}},getAuthQueryParams:()=>{const{token:n}=t();return n?{token:n}:{}}}));function wR(){const e=Xu({strict:!1}),t=xv(n=>n.setToken);return T.useEffect(()=>{const n=e==null?void 0:e.token,a=window.location.hash.slice(1)||"/model/graph";n&&(console.log("[AuthRoute] Storing token in localStorage"),localStorage.setItem("dr_auth_token",n),t(n),console.log("[AuthRoute] Updated authStore with new token")),window.location.hash=a},[e==null?void 0:e.token,t]),h.jsx("div",{className:"flex items-center justify-center h-screen",children:h.jsx("p",{className:"text-gray-500","data-testid":"auth-loading",children:"Authenticating..."})})}var SR=Object.defineProperty,CR=(e,t,n)=>t in e?SR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ot=(e,t,n)=>CR(e,typeof t!="symbol"?t+"":t,n);const NR={dashboard:"M3 3 L10 3 L10 10 L3 10 Z M14 3 L21 3 L21 10 L14 10 Z M14 14 L21 14 L21 21 L14 21 Z M3 14 L10 14 L10 21 L3 21 Z",schema:"M3 12 L9 6 L21 6 M3 12 L9 18 L21 18 M3 12 C4.7 12 6 10.3 6 8 C6 5.7 4.7 4 3 4 C1.3 4 0 5.7 0 8 C0 10.3 1.3 12 3 12 M21 6 C22.7 6 24 4.3 24 2 C24 0.3 22.7 0 21 0 C19.3 0 18 0.3 18 2 C18 4.3 19.3 6 21 6 M21 18 C22.7 18 24 16.3 24 14 C24 12.3 22.7 11 21 11 C19.3 11 18 12.3 18 14 C18 16.3 19.3 18 21 18",data:"M12 5 C18.6 5 24 6.3 24 8 L24 8 L24 16 C24 17.7 18.6 19 12 19 C5.4 19 0 17.7 0 16 L0 8 C0 6.3 5.4 5 12 5 M3 5 L3 14 L21 14 L21 5 M3 11 L3 19 L21 19 L21 11",pipeline:"M2 12 L6 12 L6 6 L18 6 L18 12 L22 12 M8 12 L16 12 M12 9 L15 12 L12 15",graph:"M6 10 C8.8 10 11 7.8 11 5 C11 2.2 8.8 0 6 0 C3.2 0 1 2.2 1 5 C1 7.8 3.2 10 6 10 M18 10 C20.8 10 23 7.8 23 5 C23 2.2 20.8 0 18 0 C15.2 0 13 2.2 13 5 C13 7.8 15.2 10 18 10 M12 18 C14.8 18 17 15.8 17 13 C17 10.2 14.8 8 12 8 C9.2 8 7 10.2 7 13 C7 15.8 9.2 18 12 18 M8 8 L16 16 M16 8 L8 16 M12 9 L12 15",search:"M10.6 14.8 C14.2 14.8 17.2 11.5 17.2 7.4 C17.2 3 14.2 0 10.6 0 C6.9 0 3 3 3 7.4 C3 11.5 6.9 14.8 10.6 14.8 M19.8 19.2 L16.7 16.3",bell:"M6.55 9.7 C6.55 3.7 11.15 0 11.15 0 C11.15 0 15.75 3.7 15.75 9.7 C15.75 12 17.25 13.4 17.25 13.4 L4.6 13.4 C4.6 13.4 6.55 12 6.55 9.7 M9.4 19.4 C9.73 19.8 10.8 20.1 10.95 20.1 C11.1 20.1 12.18 19.8 12.5 19.4",plus:"M12 5 L12 19 M5 12 L19 12",check:"M2 12 L8 18 L22 4",x:"M3 3 L21 21 M21 3 L3 21",chevronDown:"M6 9 L12 15 L18 9",chevronUp:"M18 15 L12 9 L6 15",chevronLeft:"M15 6 L9 12 L15 18",chevronRight:"M9 6 L15 12 L9 18",menu:"M3 6 L21 6 M3 12 L21 12 M3 18 L21 18",settings:"M12 1.5 C12.4 1.5 12.7 1.8 12.7 2.2 L12.7 4 C14.2 4.4 15.6 5.3 16.7 6.6 L18 5.4 C18.4 5.1 19 5.1 19.3 5.4 C19.7 5.7 19.7 6.3 19.3 6.6 L18 7.8 C19.2 8.9 20.2 10.3 20.6 12 L22.4 12 C22.9 12 23.2 12.3 23.2 12.8 C23.2 13.3 22.9 13.6 22.4 13.6 L20.6 13.6 C20.2 15.3 19.2 16.7 18 17.8 L19.3 19 C19.7 19.3 19.7 19.9 19.3 20.2 C19 20.5 18.4 20.5 18 20.2 L16.7 19 C15.6 20.3 14.2 21.2 12.7 21.6 L12.7 23.4 C12.7 23.8 12.4 24.1 12 24.1 C11.6 24.1 11.3 23.8 11.3 23.4 L11.3 21.6 C9.8 21.2 8.4 20.3 7.3 19 L6 20.2 C5.6 20.5 5 20.5 4.7 20.2 C4.3 19.9 4.3 19.3 4.7 19 L6 17.8 C4.8 16.7 3.8 15.3 3.4 13.6 L1.6 13.6 C1.1 13.6 0.8 13.3 0.8 12.8 C0.8 12.3 1.1 12 1.6 12 L3.4 12 C3.8 10.3 4.8 8.9 6 7.8 L4.7 6.6 C4.3 6.3 4.3 5.7 4.7 5.4 C5 5.1 5.6 5.1 6 5.4 L7.3 6.6 C8.4 5.3 9.8 4.4 11.3 4 L11.3 2.2 C11.3 1.8 11.6 1.5 12 1.5 Z M12 8.5 C10.6 8.5 9.5 9.6 9.5 11 C9.5 12.4 10.6 13.5 12 13.5 C13.4 13.5 14.5 12.4 14.5 11 C14.5 9.6 13.4 8.5 12 8.5 Z",alert:"M12 2 L2 20 L22 20 Z M12 9 L12 13 M12 17 L12.01 17",trash:"M3 6 L3 20 C3 21.1 3.9 22 5 22 L19 22 C20.1 22 21 21.1 21 20 L21 6 M1 6 L23 6 M7 6 L7 4 C7 2.9 7.9 2 9 2 L15 2 C16.1 2 17 2.9 17 4 L17 6 M9 11 L9 17 M15 11 L15 17",edit:"M3 17.25 L3 21 L6.75 21 L17.81 9.94 L14.06 6.19 Z M20.71 7.04 C21.1 6.65 21.1 6.02 20.71 5.63 L18.37 3.29 C17.98 2.9 17.35 2.9 16.96 3.29 L15.12 5.12 L18.87 8.87 Z",download:"M12 2 L12 13 M5 10 L12 17 L19 10",upload:"M12 22 L12 11 M5 14 L12 7 L19 14",eye:"M12 5 C7 5 2.73 8.11 1 12.46 C2.73 16.89 7 20 12 20 C17 20 21.27 16.89 23 12.46 C21.27 8.11 17 5 12 5 Z M12 16 C14.2 16 16 14.2 16 12 C16 9.8 14.2 8 12 8 C9.8 8 8 9.8 8 12 C8 14.2 9.8 16 12 16 Z",eyeOff:"M12 5.69 C8.5 5.69 5.2 7.6 3.2 10.4 M21 19 L2 2 M9.88 9.88 C9.4 10.5 9 11.2 9 12 C9 14.21 10.79 16 13 16 C13.8 16 14.5 15.6 15.12 15.12 M18.8 10.4 C20.8 7.6 17.5 5.69 12 5.69",clock:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M12 20 C7.58 20 4 16.42 4 12 C4 7.58 7.58 4 12 4 C16.42 4 20 7.58 20 12 C20 16.42 16.42 20 12 20 Z M13 7 L11 7 L11 13 L16.25 15.85 L17 14.32 L13 12 Z",calendar:"M5 2 L5 4 L19 4 L19 2 M3 4 L3 20 C3 21.1 3.9 22 5 22 L19 22 C20.1 22 21 21.1 21 20 L21 4 M7 11 L7 13 L9 13 L9 11 L7 11 Z M12 11 L12 13 L14 13 L14 11 L12 11 Z M17 11 L17 13 L19 13 L19 11 L17 11 Z",filter:"M3 6 L21 6 L18 13 L18 20 L6 20 L6 13 Z",link:"M10 11 C10.8 10.3 12 10.2 12.7 10.2 L20 10.2 C21 10.2 21.8 11 21.8 12 L21.8 19 C21.8 20 21 20.8 20 20.8 L12.7 20.8 C11.7 20.8 10.9 20 10.9 19 L10.9 12 C10.9 11.9 10.91 11.8 10.92 11.7 M7 11 C7.8 10.3 6.5 10.2 5.8 10.2 L1 10.2 C0.1 10.2 0.2 11 0.2 12 L0.2 19 C0.2 20 0.9 20.8 1.8 20.8 L5.8 20.8 C6.8 20.8 7.6 20 7.6 19 L7.6 12 C7.6 11.9 7.59 11.8 7.58 11.7",lock:"M7 10 L7 7 C7 4.24 9.24 2 12 2 C14.76 2 17 4.24 17 7 L17 10 M5 10 L19 10 L19 20 C19 21.1 18.1 22 17 22 L7 22 C5.9 22 5 21.1 5 20 Z",unlock:"M7 10 L19 10 L19 20 C19 21.1 18.1 22 17 22 L7 22 C5.9 22 5 21.1 5 20 L5 10 L5 7 C5 4.24 7.24 2 10 2 C12.76 2 15 4.24 15 7 L13 7 C13 5.34 11.66 4 10 4 C8.34 4 7 5.34 7 7 Z",user:"M12 12 C13.66 12 15 10.66 15 9 C15 7.34 13.66 6 12 6 C10.34 6 9 7.34 9 9 C9 10.66 10.34 12 12 12 Z M12 22 C16.42 22 21 20 21 16 L21 14 C21 11.79 19.21 10 17 10 L7 10 C4.79 10 3 11.79 3 14 L3 16 C3 20 7.58 22 12 22 Z",copy:"M16 1 L4 1 C2.9 1 2 1.9 2 3 L2 17 L4 17 L4 3 L16 3 Z M20 5 L8 5 C6.9 5 6 5.9 6 7 L6 21 C6 22.1 6.9 23 8 23 L20 23 C21.1 23 22 22.1 22 21 L22 7 C22 5.9 21.1 5 20 5 Z",info:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M13 17 L11 17 L11 11 L13 11 Z M13 9 L11 9 L11 7 L13 7 Z",help:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M13 19 L11 19 L11 17 L13 17 Z M15.07 10.25 C14.29 11.29 13.5 12 13 12.9 L13 14 L11 14 L11 13 C11 11.52 11.79 10.29 12.93 9.07 C13.62 8.29 14.29 7.5 14.29 6.5 C14.29 5.42 13.47 4.6 12.4 4.6 C11.4 4.6 10.6 5.36 10.6 6.3 L8.6 6.2 C8.72 4.5 10.09 3.1 12.4 3.1 C14.84 3.1 16.3 4.5 16.3 6.42 C16.3 7.8 15.66 8.9 15.07 10.25 Z",spinner:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 M12 2 C6.48 2 2 6.48 2 12",loading:"M12 2 C6.48 2 2 6.48 2 12",moreVertical:"M12 8 C13.1 8 14 7.1 14 6 C14 4.9 13.1 4 12 4 C10.9 4 10 4.9 10 6 C10 7.1 10.9 8 12 8 Z M12 14 C13.1 14 14 13.1 14 12 C14 10.9 13.1 10 12 10 C10.9 10 10 10.9 10 12 C10 13.1 10.9 14 12 14 Z M12 20 C13.1 20 14 19.1 14 18 C14 16.9 13.1 16 12 16 C10.9 16 10 16.9 10 18 C10 19.1 10.9 20 12 20 Z",moreHorizontal:"M6 10 C4.9 10 4 10.9 4 12 C4 13.1 4.9 14 6 14 C7.1 14 8 13.1 8 12 C8 10.9 7.1 10 6 10 Z M18 10 C16.9 10 16 10.9 16 12 C16 13.1 16.9 14 18 14 C19.1 14 20 13.1 20 12 C20 10.9 19.1 10 18 10 Z M12 10 C10.9 10 10 10.9 10 12 C10 13.1 10.9 14 12 14 C13.1 14 14 13.1 14 12 C14 10.9 13.1 10 12 10 Z",reload:"M7 7 C4.24 7 2 9.24 2 12 C2 14.56 3.68 16.73 6 17.73 L6 15.95 C4.29 15.16 3 13.32 3 11.13 C3 8.82 4.82 7 7 7 Z M17 7 C19.76 7 22 9.24 22 12 C22 14.13 20.71 15.97 18.7 16.76 L18.7 18.54 C21.32 17.54 23 15.56 23 13 C23 10.24 20.76 8 18 8 Z M11.5 5 L14.5 8 L8.5 8 Z M8.5 16 L14.5 16 L11.5 19 Z",arrowRight:"M5 12 L19 12 M13 6 L19 12 L13 18",arrowLeft:"M19 12 L5 12 M11 6 L5 12 L11 18",arrowUp:"M12 19 L12 5 M6 11 L12 5 L18 11",arrowDown:"M12 5 L12 19 M6 13 L12 19 L18 13",star:"M12 2 L15.09 10.26 L24 10.26 L17.55 15.13 L19.64 23.39 L12 18.53 L4.36 23.39 L6.45 15.13 L0 10.26 L8.91 10.26 Z",heart:"M20.84 4.61 C20.02 3.78 18.98 3.37 17.93 3.37 C16.88 3.37 15.84 3.78 15.02 4.61 L12 7.63 L8.98 4.61 C7.30 2.92 4.71 2.92 3.02 4.61 C1.33 6.30 1.33 8.88 3.02 10.57 L12 19.58 L20.99 10.57 C22.68 8.88 22.68 6.30 20.84 4.61 Z",palette:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M7 12 C8.1 12 9 11.1 9 10 C9 8.9 8.1 8 7 8 C5.9 8 5 8.9 5 10 C5 11.1 5.9 12 7 12 Z M17 12 C18.1 12 19 11.1 19 10 C19 8.9 18.1 8 17 8 C15.9 8 15 8.9 15 10 C15 11.1 15.9 12 17 12 Z M12 17 C10.9 17 10 16.1 10 15 C10 13.9 10.9 13 12 13 C13.1 13 14 13.9 14 15 C14 16.1 13.1 17 12 17 Z M7 17 C5.9 17 5 16.1 5 15 C5 13.9 5.9 13 7 13 C8.1 13 9 13.9 9 15 C9 16.1 8.1 17 7 17 Z M17 17 C15.9 17 15 16.1 15 15 C15 13.9 15.9 13 17 13 C18.1 13 19 13.9 19 15 C19 16.1 18.1 17 17 17 Z",component:"M5 3 L19 3 L19 9 L5 9 Z M5 11 L19 11 L19 17 L5 17 Z M3 20 L21 20",table:"M3 4 L21 4 M3 4 L3 20 L21 20 L21 4 M3 8 L21 8 M3 12 L21 12 M3 16 L21 16 M8 4 L8 20 M13 4 L13 20 M18 4 L18 20",layout:"M3 3 L21 3 L21 21 L3 21 Z M3 8 L21 8 M3 3 L3 21 M8 8 L8 21",moon:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z",sun:"M12 3v2M12 19v2M5.64 5.64l1.42 1.42M16.95 16.95l1.41 1.41M3 12h2M19 12h2M5.64 18.36l1.41-1.41M16.95 7.05l1.41-1.41M12 7a5 5 0 1 0 0 10A5 5 0 0 0 12 7z","bar-chart":"M3 3 L3 20 L21 20 M5 16 L5 9 M12 16 L12 5 M19 16 L19 8","trending-up":"M23 6 L13.5 15.5 M23 6 L23 13 L16 13 M1 23 L6.5 17.5 L13 24 L23 6","trending-down":"M23 18 L13.5 8.5 M23 18 L23 11 L16 11 M1 1 L6.5 6.5 L13 0 L23 18",send:"M16 8 L2 5 L9.5 12 L2 19 L16 16 M7 12 L16 12",bot:"M12 2 C6.48 2 2 6.48 2 12 C2 17.52 6.48 22 12 22 C17.52 22 22 17.52 22 12 C22 6.48 17.52 2 12 2 Z M7 8 L7 10 L9 10 L9 8 Z M15 8 L15 10 L17 10 L17 8 Z M9 14 L15 14 M12 14 L12 18",paperclip:"M12.5 2 C9.46 2 7 4.46 7 7.5 C7 10.54 9.46 13 12.5 13 L18 13 C18.55 13 19 12.55 19 12 C19 11.45 18.55 11 18 11 L12.5 11 C10.57 11 9 9.43 9 7.5 C9 5.57 10.57 4 12.5 4 C14.43 4 16 5.57 16 7.5 L16 15 C16 18.31 13.31 21 10 21 C6.69 21 4 18.31 4 15 L4 7 C4 5.9 4.9 5 6 5 C7.1 5 8 5.9 8 7 L8 15 C8 16.1 8.9 17 10 17 C11.1 17 12 16.1 12 15 L12 7.5","pie-chart":"M21.21 15.89 L12 12 L12 2.69 A10 10 0 0 1 21.21 15.89 M12 12 L5.5 5.5 A10 10 0 0 0 2 12 M2 12 A10 10 0 0 0 12 22 A10 10 0 0 0 12 12",slash:"M21 3 L3 21",file:"M14 2 L6 2 C4.9 2 4 2.9 4 4 L4 20 C4 21.1 4.9 22 6 22 L18 22 C19.1 22 20 21.1 20 20 L20 8 Z M14 2 L14 8 L20 8 M16 13 L8 13 M16 17 L8 17 M10 9 L8 9",zap:"M13 2 L3 14 L12 14 L11 22 L21 10 L12 10 Z",hardDrive:"M22 12 L2 12 M2 9 C2 7.9 2.9 7 4 7 L20 7 C21.1 7 22 7.9 22 9 L22 19 C22 20.1 21.1 21 20 21 L4 21 C2.9 21 2 20.1 2 19 Z M6 17 L6.01 17",folder:"M20 20 C21.1 20 22 19.1 22 18 L22 8 C22 6.9 21.1 6 20 6 L12.1 6 C11.43 6 10.8 5.68 10.41 5.13 L9.6 3.9 C9.22 3.34 8.59 3 7.93 3 L4 3 C2.9 3 2 3.9 2 5 L2 18 C2 19.1 2.9 20 4 20 Z",tag:"M12.59 2.59 C12.21 2.21 11.7 2 11.17 2 L4 2 C2.9 2 2 2.9 2 4 L2 11.17 C2 11.7 2.21 12.21 2.59 12.59 L11.29 21.29 C12.07 22.07 13.34 22.07 14.12 21.29 L20.7 14.71 C21.48 13.93 21.48 12.66 20.7 11.88 Z M7.5 7.5 L7.51 7.5",gitBranch:"M6 3 L6 15 M6 6 C7.66 6 9 4.66 9 3 C9 1.34 7.66 0 6 0 C4.34 0 3 1.34 3 3 C3 4.66 4.34 6 6 6 Z M6 24 C7.66 24 9 22.66 9 21 C9 19.34 7.66 18 6 18 C4.34 18 3 19.34 3 21 C3 22.66 4.34 24 6 24 Z M18 9 C19.66 9 21 7.66 21 6 C21 4.34 19.66 3 18 3 C16.34 3 15 4.34 15 6 C15 7.66 16.34 9 18 9 Z M18 9 C18 13 15 15 9 15",image:"M3 3 L21 3 L21 21 L3 21 Z M8.5 10 C9.6 10 10.5 9.1 10.5 8 C10.5 6.9 9.6 6 8.5 6 C7.4 6 6.5 6.9 6.5 8 C6.5 9.1 7.4 10 8.5 10 Z M21 15 L16 10 L5 21",code:"M9 18 L3 12 L9 6 M15 6 L21 12 L15 18",map:"M9 3 L3 5 L3 19 L9 17 M9 3 L15 5 M9 3 L9 17 M15 5 L21 3 L21 17 L15 19 M15 5 L15 19 M9 17 L15 19",sparkles:"M12 2 L14 9 L21 11 L14 13 L12 20 L10 13 L3 11 L10 9 Z M19 3 L20 5.5 L22.5 6.5 L20 7.5 L19 10 L18 7.5 L15.5 6.5 L18 5.5 Z",share:"M18 8 C19.66 8 21 6.66 21 5 C21 3.34 19.66 2 18 2 C16.34 2 15 3.34 15 5 C15 6.66 16.34 8 18 8 Z M6 15 C7.66 15 9 13.66 9 12 C9 10.34 7.66 9 6 9 C4.34 9 3 10.34 3 12 C3 13.66 4.34 15 6 15 Z M18 22 C19.66 22 21 20.66 21 19 C21 17.34 19.66 16 18 16 C16.34 16 15 17.34 15 19 C15 20.66 16.34 22 18 22 Z M8.59 13.51 L15.42 17.49 M15.41 6.51 L8.59 10.49",ellipsis:"M6 12 C6 13.1 5.1 14 4 14 C2.9 14 2 13.1 2 12 C2 10.9 2.9 10 4 10 C5.1 10 6 10.9 6 12 Z M14 12 C14 13.1 13.1 14 12 14 C10.9 14 10 13.1 10 12 C10 10.9 10.9 10 12 10 C13.1 10 14 10.9 14 12 Z M22 12 C22 13.1 21.1 14 20 14 C18.9 14 18 13.1 18 12 C18 10.9 18.9 10 20 10 C21.1 10 22 10.9 22 12 Z",zoomIn:"M11 3 C15.42 3 19 6.58 19 11 C19 15.42 15.42 19 11 19 C6.58 19 3 15.42 3 11 C3 6.58 6.58 3 11 3 M21 21 L16.65 16.65 M11 8 L11 14 M8 11 L14 11",zoomOut:"M11 3 C15.42 3 19 6.58 19 11 C19 15.42 15.42 19 11 19 C6.58 19 3 15.42 3 11 C3 6.58 6.58 3 11 3 M21 21 L16.65 16.65 M8 11 L14 11",maximize:"M3 8 L3 3 L8 3 M16 3 L21 3 L21 8 M21 16 L21 21 L16 21 M8 21 L3 21 L3 16",fullscreen:"M15 3 L21 3 L21 9 M9 21 L3 21 L3 15 M21 3 L14 10 M3 21 L10 14",fullscreenExit:"M20 10 L14 10 L14 4 M4 14 L10 14 L10 20 M14 10 L21 3 M10 14 L3 21",orbit:"M21 12 C21 9.52 16.97 7.5 12 7.5 C7.03 7.5 3 9.52 3 12 C3 14.48 7.03 16.5 12 16.5 C16.97 16.5 21 14.48 21 12 M22.8 12 C22.8 13 22 13.8 21 13.8 C20 13.8 19.2 13 19.2 12 C19.2 11 20 10.2 21 10.2 C22 10.2 22.8 11 22.8 12"},He=ve.forwardRef((l,o)=>{var c=l,{name:e,size:t=24,className:n="","aria-label":a}=c,s=Me(c,["name","size","className","aria-label"]);const u=NR[e];return u?h.jsx("svg",Z(F({ref:o,viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":a?void 0:!0,"aria-label":a,className:n},s),{children:h.jsx("path",{d:u})})):(console.warn(`Icon "${e}" does not exist in ICONS map`),null)});He.displayName="Icon";function kR(e){return e.split(" ").slice(0,2).map(t=>t[0]).join("").toUpperCase()}const vu={amber:"linear-gradient(135deg, rgb(var(--accent-primary)), rgb(var(--accent-primary-deep)))",emerald:"linear-gradient(135deg, rgb(var(--status-emerald)), rgb(var(--semantic-emerald-fg)))",rose:"linear-gradient(135deg, rgb(var(--status-rose)), rgb(var(--status-rose-deep)))",cyan:"linear-gradient(135deg, rgb(var(--status-cyan)), rgb(var(--status-cyan-deep)))",violet:"linear-gradient(135deg, rgb(var(--status-violet)), rgb(var(--semantic-violet-fg)))",neutral:"linear-gradient(135deg, rgb(var(--status-neutral)), rgb(var(--semantic-neutral-fg)))"},w_=Object.keys(vu);function MR(e){let t=0;for(let n=0;n<e.length;n++){const a=e.charCodeAt(n);t=(t<<5)-t+a,t=t&t}return Math.abs(t)}function jR(e){const t=MR(e)%w_.length;return w_[t]}function ER(e,t){if(e&&e in vu)return vu[e];if(e)return e;if(t){const n=jR(t);return vu[n]}return vu.amber}const RR=ve.forwardRef((p,m)=>{var y=p,{name:e,src:t,size:n="md",shape:a="circle",status:s,color:o,decorative:l,className:c="",style:u}=y,f=Me(y,["name","src","size","shape","status","color","decorative","className","style"]);const[v,x]=T.useState(!1),b=kR(e),w=!t||v,C=["avatar",`avatar--${n}`,`avatar--${a}`,c].filter(Boolean).join(" "),N=w?{background:ER(o,e)}:{display:"none"},k=w?{display:"none"}:{};return h.jsxs("div",Z(F({ref:m,className:C,style:u,role:l?void 0:"img","aria-label":l?void 0:s?`${e} (${s})`:e,"aria-hidden":l?"true":void 0},f),{children:[h.jsx("div",{className:"avatar__initials",style:N,children:b}),t&&h.jsx("img",{className:"avatar__image",src:t,alt:"",onError:()=>x(!0),style:k}),s&&h.jsx("div",{className:`avatar__status avatar__status--${s}`,"aria-label":s})]}))});RR.displayName="Avatar";const Pn=ve.forwardRef((u,c)=>{var f=u,{variant:e="primary",size:t="md",icon:n,className:a="",disabled:s,type:o="button"}=f,l=Me(f,["variant","size","icon","className","disabled","type"]);const m=["btn",`btn--${e}`,`btn--${t}`,n?"btn--icon":"",a].filter(Boolean).join(" ");return h.jsx("button",F({ref:c,type:o,disabled:s,className:m},l))});Pn.displayName="Button";const Na=ve.forwardRef((l,o)=>{var c=l,{variant:e="neutral",form:t="default",className:n="",children:a}=c,s=Me(c,["variant","form","className","children"]);const u=["chip",`chip--${t}`,t==="default"&&`chip--${e}`,n].filter(Boolean).join(" ");return h.jsxs("span",Z(F({ref:o,className:u},s),{children:[t==="default"&&h.jsx("span",{className:"chip__dot"}),t==="env"&&h.jsx("span",{className:"chip__dot chip__dot--env"}),a]}))});Na.displayName="Chip";const bv=ve.forwardRef((o,s)=>{var l=o,{color:e="cyan",pulse:t=!1,className:n=""}=l,a=Me(l,["color","pulse","className"]);const c=["badge",`badge--${e}`,t&&"badge--pulse",n].filter(Boolean).join(" ");return h.jsx("span",F({ref:s,className:c},a))});bv.displayName="Badge";const _v=ve.forwardRef((l,o)=>{var c=l,{color:e="cyan",pulse:t=!1,className:n="",role:a="img"}=c,s=Me(c,["color","pulse","className","role"]);const u=["status-badge",`status-badge--${e}`,t&&"status-badge--pulse",n].filter(Boolean).join(" ");return h.jsx("div",F({ref:o,role:a,className:u},s))});_v.displayName="StatusBadge";const Du=ve.forwardRef((o,s)=>{var l=o,{mono:e=!1,error:t=!1,className:n=""}=l,a=Me(l,["mono","error","className"]);const c=["text-input",e&&"text-input--mono",t&&"text-input--error",n].filter(Boolean).join(" ");return h.jsx("input",F({type:"text",ref:s,className:c},a))});Du.displayName="TextInput";const wv=ve.forwardRef((o,s)=>{var l=o,{mono:e=!1,error:t=!1,className:n=""}=l,a=Me(l,["mono","error","className"]);const c=["text-area",e&&"text-area--mono",t&&"text-area--error",n].filter(Boolean).join(" ");return h.jsx("textarea",F({ref:s,className:c},a))});wv.displayName="TextArea";const TR=ve.forwardRef((o,s)=>{var l=o,{mono:e=!1,error:t=!1,className:n=""}=l,a=Me(l,["mono","error","className"]);const c=["number-input",e&&"number-input--mono",t&&"number-input--error",n].filter(Boolean).join(" ");return h.jsx("input",F({ref:s,type:"number",className:c},a))});TR.displayName="NumberInput";const AR="[data-dropdown-item]:not([data-disabled])";function jh({triggerRef:e,panelRef:t,isOpen:n,onClose:a,itemSelector:s=AR,restoreFocus:o=!0}){const[l,c]=T.useState(null),u=T.useRef(!1),f=T.useCallback(()=>{const m=t.current;return m?Array.from(m.querySelectorAll(s)).map(p=>p.getAttribute("data-dropdown-item")).filter(p=>p!==null&&p.length>0):[]},[t,s]);return T.useEffect(()=>{var m;if(n&&!u.current){u.current=!0;const p=f();c(y=>{var v;return y&&p.includes(y)?y:(v=p[0])!=null?v:null})}else!n&&u.current&&(u.current=!1,c(null),o&&((m=e.current)==null||m.focus()))},[n,f,o,e]),T.useEffect(()=>{if(!n)return;const m=y=>{const v=y.target,x=e.current,b=t.current;x!=null&&x.contains(v)||b!=null&&b.contains(v)||a()},p=y=>{y.key==="Escape"&&(y.preventDefault(),a())};return document.addEventListener("mousedown",m),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",p)}},[n,a,e,t]),T.useEffect(()=>{if(!n)return;const m=e.current,p=t.current,y=v=>{var x;const b=f();if(b.length===0)return;let w=b.indexOf(l!=null?l:"");w<0&&(w=0);const C=b.length-1,N=(x=v.target)==null?void 0:x.hasAttribute("data-dropdown-item");switch(v.key){case"ArrowDown":{v.preventDefault();const k=w<C?w+1:0;c(b[k]);break}case"ArrowUp":{v.preventDefault();const k=w>0?w-1:C;c(b[k]);break}case"Tab":{if(!N)return;v.preventDefault();const k=v.shiftKey?-1:1,M=(w+k+b.length)%b.length;c(b[M]);break}case"Home":{v.preventDefault(),c(b[0]);break}case"End":{v.preventDefault(),c(b[C]);break}}};return m==null||m.addEventListener("keydown",y),p==null||p.addEventListener("keydown",y),()=>{m==null||m.removeEventListener("keydown",y),p==null||p.removeEventListener("keydown",y)}},[n,l,f,e,t]),{focusedValue:l,setFocusedValue:c}}const Eh=(e="bottom-start")=>`dropdown-panel--placement-${e}`,f2=T.createContext(void 0);function h2(e){const t=T.useContext(f2);if(!t)throw new Error(`${e} must be used inside <Select>`);return t}const p2=ve.forwardRef((e,t)=>{var fe;const{placeholder:n="Select…",error:a=!1,disabled:s=!1,id:o,name:l,className:c="",ariaLabel:u,children:f,placement:m="bottom-start"}=e,p=e["data-testid"],y=e.multiple?"multi":"single",v=y==="single"&&e.value!==void 0,x=y==="multi"&&e.values!==void 0,[b,w]=T.useState(y==="single"&&(fe=e.defaultValue)!=null?fe:""),[C,N]=T.useState(()=>{var B;return new Set(y==="multi"?(B=e.defaultValues)!=null?B:[]:[])}),k=T.useMemo(()=>{var B,W;if(y==="single"){const ae=v?(B=e.value)!=null?B:"":b;return ae?new Set([ae]):new Set}return x?new Set((W=e.values)!=null?W:[]):C},[y,v,x,e.value,e.values,b,C]),[M,D]=T.useState(!1),j=T.useRef(null),A=T.useRef(null),O=T.useRef(null),[R,E]=T.useState(new Map),I=T.useCallback((B,W)=>(E(ae=>{if(ae.get(B)===W)return ae;const J=new Map(ae);return J.set(B,W),J}),()=>{E(ae=>{if(!ae.has(B))return ae;const J=new Map(ae);return J.delete(B),J})}),[]),L=T.useCallback(B=>{s||D(B)},[s]),H=T.useCallback(()=>D(!1),[]),{focusedValue:U,setFocusedValue:$}=jh({triggerRef:j,panelRef:A,isOpen:M,onClose:H});T.useEffect(()=>{if(M&&k.size>0&&!U){const B=k.values().next().value;B&&$(B)}},[M,k,U,$]);const P=T.useCallback(B=>{var W,ae;if(y==="single")v||w(B),(W=e.onChange)==null||W.call(e,B),D(!1);else{const J=new Set(k);J.has(B)?J.delete(B):J.add(B),x||N(J),(ae=e.onValuesChange)==null||ae.call(e,Array.from(J))}},[y,v,x,k,e]),G={mode:y,isOpen:M,onOpenChange:L,selectedValues:k,onValueChange:P,focusedValue:U,setFocusedValue:$,registerItem:I,panelRef:A},K=T.useMemo(()=>{var J,le;if(k.size===0)return h.jsx("span",{className:"select__placeholder",children:n});if(y==="single"){const be=k.values().next().value;return h.jsx("span",{className:"select__value",children:(J=R.get(be))!=null?J:be})}const B=Array.from(k),W=B[0],ae=(le=R.get(W))!=null?le:W;return B.length===1?h.jsx("span",{className:"select__value",children:ae}):h.jsxs("span",{className:"select__value",children:[ae," ",h.jsxs("span",{className:"select__value-count",children:["+",B.length-1]})]})},[k,R,y,n]),se=B=>{M||(B.key==="ArrowDown"||B.key==="ArrowUp"||B.key==="Enter"||B.key===" ")&&(B.preventDefault(),L(!0))},V=l&&k.size>0?Array.from(k).map(B=>h.jsx("input",{type:"hidden",name:l,value:B},B)):null,re=B=>{j.current=B,typeof t=="function"?t(B):t&&(t.current=B)};return h.jsx(f2.Provider,{value:G,children:h.jsxs("div",{ref:O,className:["select",a&&"select--error",s&&"select--disabled",c].filter(Boolean).join(" "),"data-testid":p,children:[h.jsxs("button",{ref:re,id:o,type:"button",className:"select__trigger","aria-haspopup":"listbox","aria-expanded":M,"aria-invalid":a||void 0,"aria-label":u,disabled:s,onClick:()=>L(!M),onKeyDown:se,children:[K,h.jsx(He,{name:"chevronDown",size:14,className:`select__chevron ${M?"select__chevron--open":""}`})]}),V,h.jsx("div",{ref:A,role:"listbox","aria-multiselectable":y==="multi"?!0:void 0,className:`dropdown-panel ${Eh(m)} select__panel`,hidden:!M,children:f})]})})});p2.displayName="Select";function DR({value:e,icon:t,description:n,disabled:a=!1,children:s}){const{selectedValues:o,onValueChange:l,focusedValue:c,setFocusedValue:u,registerItem:f,mode:m}=h2("Select.Item"),p=T.useRef(null),y=o.has(e),v=c===e;return T.useEffect(()=>f(e,s),[e,s,f]),T.useEffect(()=>{var x;v&&((x=p.current)==null||x.focus())},[v]),h.jsxs("button",{ref:p,type:"button",role:"option","aria-selected":y,tabIndex:v?0:-1,"data-dropdown-item":e,"data-disabled":a||void 0,disabled:a,onClick:()=>l(e),onMouseEnter:()=>!a&&u(e),className:["dropdown-item",y&&"dropdown-item--selected",v&&"dropdown-item--focused",a&&"dropdown-item--disabled"].filter(Boolean).join(" "),children:[t?h.jsx("span",{className:"dropdown-item__leading",children:h.jsx(He,{name:t,size:16})}):null,h.jsxs("span",{className:"dropdown-item__body",children:[h.jsx("span",{className:"dropdown-item__label",children:s}),n&&h.jsx("span",{className:"dropdown-item__description",children:n})]}),m==="single"&&y&&h.jsx("span",{className:"dropdown-item__trailing",children:h.jsx(He,{name:"check",size:14})})]})}function LR({value:e,description:t,disabled:n=!1,children:a}){const{selectedValues:s,onValueChange:o,focusedValue:l,setFocusedValue:c,registerItem:u}=h2("Select.CheckboxItem"),f=T.useRef(null),m=s.has(e),p=l===e;return T.useEffect(()=>u(e,a),[e,a,u]),T.useEffect(()=>{var y;p&&((y=f.current)==null||y.focus())},[p]),h.jsxs("button",{ref:f,type:"button",role:"option","aria-selected":m,tabIndex:p?0:-1,"data-dropdown-item":e,"data-disabled":n||void 0,disabled:n,onClick:()=>o(e),onMouseEnter:()=>!n&&c(e),className:["dropdown-item",p&&"dropdown-item--focused",n&&"dropdown-item--disabled"].filter(Boolean).join(" "),children:[h.jsx("span",{className:"dropdown-item__leading",children:h.jsx("input",{type:"checkbox",className:"dropdown-item__checkbox",checked:m,readOnly:!0,tabIndex:-1,"aria-hidden":"true"})}),h.jsxs("span",{className:"dropdown-item__body",children:[h.jsx("span",{className:"dropdown-item__label",children:a}),t&&h.jsx("span",{className:"dropdown-item__description",children:t})]})]})}function OR(){return h.jsx("div",{role:"separator",className:"dropdown-separator"})}function IR({children:e}){return h.jsx("div",{className:"dropdown-section-title",children:e})}const ch=Object.assign(p2,{Item:DR,CheckboxItem:LR,Separator:OR,SectionTitle:IR}),zR=ve.forwardRef((o,s)=>{var l=o,{indeterminate:e=!1,className:t="","aria-checked":n}=l,a=Me(l,["indeterminate","className","aria-checked"]);const c=ve.useRef(null),u=ve.useCallback(m=>{c.current=m,typeof s=="function"?s(m):s&&(s.current=m)},[s]);ve.useEffect(()=>{c.current&&(c.current.indeterminate=e)},[e]);const f=["tri-state",e&&"tri-state--indeterminate",t].filter(Boolean).join(" ");return h.jsx("input",Z(F({ref:u,type:"checkbox",className:f},a),{"aria-checked":n!=null?n:e?"mixed":a.checked!==void 0?!!a.checked:void 0}))});zR.displayName="TriState";const BR=ve.forwardRef((p,m)=>{var y=p,{label:e,htmlFor:t,required:n=!1,disabled:a=!1,error:s,errorId:o,hint:l,children:c,className:u=""}=y,f=Me(y,["label","htmlFor","required","disabled","error","errorId","hint","children","className"]);const v=["field",a?"field--disabled":"",u].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:m,className:v},f),{children:[e&&h.jsxs("label",{className:"field__label",htmlFor:t,children:[h.jsx("span",{children:e}),n&&h.jsx("span",{className:"field__required",children:"*"}),l&&h.jsx("span",{className:"field__hint",children:l})]}),h.jsx("div",{className:"field__input",children:c}),s&&h.jsx("div",{className:"field__error",id:o,children:s})]}))});BR.displayName="Field";const Lu={emerald:"rgb(16 185 129)",amber:"rgb(245 158 11)",rose:"rgb(244 63 94)",cyan:"rgb(34 211 238)",violet:"rgb(139 92 246)",neutral:"rgb(var(--canvas-fg-2))"};function UR(e){return e in Lu?Lu[e]:e}function FR(e){return e.map(([t,n],a)=>(a?"L":"M")+t.toFixed(2)+","+n.toFixed(2)).join(" ")}const Sv=ve.forwardRef((m,f)=>{var p=m,{data:e,width:t=88,height:n=28,color:a="emerald",area:s=!0,label:o,className:l="",style:c}=p,u=Me(p,["data","width","height","color","area","label","className","style"]);const y=ve.useId(),v=ve.useMemo(()=>{if(!e||e.length<2)return null;const C=Math.min(...e),N=Math.max(...e),k=e.map((j,A)=>[A/(e.length-1)*t,n-2-(j-C)/(N-C||1)*(n-4)]),M=FR(k),D=`${M} L${t},${n} L0,${n} Z`;return{line:M,fill:D}},[e,t,n]);if(!v)return null;const x=UR(String(a)),{line:b,fill:w}=v;return h.jsxs("svg",Z(F({ref:f,role:"img","aria-label":o!=null?o:"trend sparkline",width:t,height:n,viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"none",style:F({display:"block"},c),className:l},u),{children:[s&&h.jsx("defs",{children:h.jsxs("linearGradient",{id:y,x1:"0",y1:"0",x2:"0",y2:"1",children:[h.jsx("stop",{offset:"0%",stopColor:x,stopOpacity:"0.22"}),h.jsx("stop",{offset:"100%",stopColor:x,stopOpacity:"0"})]})}),s&&h.jsx("path",{d:w,fill:`url(#${y})`}),h.jsx("path",{d:b,stroke:x,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}))});Sv.displayName="Sparkline";const Xf=ve.forwardRef((y,p)=>{var v=y,{label:e="",value:t="",delta:n,color:a="cyan",icon:s,sparkData:o,meta:l,metaIcon:c,className:u="","aria-label":f}=v,m=Me(v,["label","value","delta","color","icon","sparkData","meta","metaIcon","className","aria-label"]);const x=["stat-tile",`stat-tile--${a}`,u].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:p,className:x,"aria-label":f!=null?f:`${e}: ${t}`},m),{children:[h.jsxs("div",{className:"stat-tile__header",children:[h.jsx("div",{className:"stat-tile__label",children:e}),s&&h.jsx(He,{name:s,size:14,"aria-hidden":"true"})]}),h.jsx("div",{className:"stat-tile__value",children:t}),(n||l)&&h.jsxs("div",{className:"stat-tile__footer",children:[n&&h.jsxs("span",{className:`stat-tile__delta stat-tile__delta--${n.direction||"up"}`,children:[h.jsxs("span",{className:"stat-tile__delta-value",children:[n.direction==="down"?"−":"+",Math.abs(n.value)]}),n.label&&h.jsx("span",{className:"stat-tile__delta-label",children:n.label})]}),l&&h.jsxs("div",{className:"stat-tile__meta",children:[c&&h.jsx(He,{name:c,size:12,"aria-hidden":"true"}),h.jsx("span",{className:"stat-tile__meta-text",children:l})]})]}),o&&h.jsx("div",{className:"stat-tile__sparkline",children:h.jsx(Sv,{data:o,width:88,height:28,color:a||"cyan"})})]}))});Xf.displayName="StatTile";const $R=ve.forwardRef((o,s)=>{var l=o,{columns:e=4,className:t="",children:n}=l,a=Me(l,["columns","className","children"]);const c=["stat-grid",`stat-grid--cols-${e}`,t].filter(Boolean).join(" ");return h.jsx("div",Z(F({ref:s,className:c},a),{children:n}))});$R.displayName="StatGrid";const Ya=ve.forwardRef((o,s)=>{var l=o,{className:e="",children:t,tone:n="amber"}=l,a=Me(l,["className","children","tone"]);const c=["version-pill",`version-pill--${n}`,e].filter(Boolean).join(" ");return h.jsx("span",Z(F({ref:s,className:c},a),{children:t}))});Ya.displayName="VersionPill";const Wi=ve.forwardRef((c,l)=>{var u=c,{value:e,onChange:t,options:n,disabled:a=!1,className:s=""}=u,o=Me(u,["value","onChange","options","disabled","className"]);const f=["segmented-control",a?"segmented-control--disabled":"",s].filter(Boolean).join(" "),m=T.useRef([]),p=T.useCallback((x,b)=>{var w;const C=n.map((M,D)=>M.disabled?null:D).filter(M=>M!==null),N=C.indexOf(b);let k;x.key==="ArrowRight"||x.key==="ArrowDown"?(x.preventDefault(),k=C[(N+1)%C.length]):(x.key==="ArrowLeft"||x.key==="ArrowUp")&&(x.preventDefault(),k=C[(N-1+C.length)%C.length]),k!==void 0&&((w=m.current[k])==null||w.focus(),t(n[k].value))},[n,t]),y=n.some(x=>x.value===e),v=n.findIndex(x=>!x.disabled);return h.jsx("div",Z(F({ref:l,className:f,role:"radiogroup"},o),{children:n.map((x,b)=>{const w=e===x.value,C=w||!y&&b===v?0:-1;return h.jsx("button",{ref:N=>{m.current[b]=N},className:`segmented-control__segment ${w?"segmented-control__segment--active":""}`,onClick:()=>!a&&!x.disabled&&t(x.value),onKeyDown:N=>p(N,b),type:"button",role:"radio","aria-checked":w,disabled:a||x.disabled,tabIndex:C,children:x.label},x.value)})}))});Wi.displayName="SegmentedControl";const PR=ve.forwardRef((y,p)=>{var v=y,{columns:e,data:t,rowKey:n,selectable:a=!1,selectedRows:s=[],onSelectRows:o,onRowClick:l,onSort:c,emptyState:u,className:f=""}=v,m=Me(v,["columns","data","rowKey","selectable","selectedRows","onSelectRows","onRowClick","onSort","emptyState","className"]);const[x,b]=T.useState(null),[w,C]=T.useState("asc"),N=T.useRef(null),k=t.length>0&&s.length===t.length,M=s.length>0&&s.length<t.length;T.useEffect(()=>{N.current&&(N.current.indeterminate=M)},[M]);const D=(I,L)=>typeof n=="function"?n(I,L):I[n],j=()=>{k?o==null||o([]):o==null||o(t.map((I,L)=>D(I,L)))},A=I=>{s.includes(I)?o==null||o(s.filter(L=>L!==I)):o==null||o([...s,I])},O=I=>{x===I?w==="asc"?(C("desc"),c==null||c(I,"desc")):(b(null),c==null||c(I,null)):(b(I),C("asc"),c==null||c(I,"asc"))},R=(I,L)=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),O(L))},E=["table",f].filter(Boolean).join(" ");return h.jsxs("table",Z(F({ref:p,className:E},m),{children:[h.jsx("thead",{className:"table__head",children:h.jsxs("tr",{className:"table__row",children:[a&&h.jsx("th",{className:"table__header table__header--checkbox",style:{width:"30px"},children:h.jsx("input",{ref:N,type:"checkbox",className:"table__checkbox",checked:k,onChange:j,"aria-label":"Select all rows"})}),e.map(I=>{const L=String(I.key),H=x===L,U=H?w==="asc"?"ascending":"descending":I.sortable?"none":void 0;return h.jsx("th",{className:`table__header ${I.sortable?"table__header--sortable":""}`,style:{width:I.width},"aria-sort":U,tabIndex:I.sortable?0:void 0,onClick:()=>I.sortable&&O(L),onKeyDown:I.sortable?$=>R($,L):void 0,children:h.jsxs("div",{className:"table__header-content",children:[I.label,H&&h.jsx(He,{name:w==="asc"?"chevronUp":"chevronDown",size:14,className:"table__sort-icon"})]})},L)})]})}),h.jsx("tbody",{className:"table__body",children:t.length===0&&u?h.jsx("tr",{className:"table__row",children:h.jsx("td",{className:"table__cell table__cell--empty",colSpan:e.length+(a?1:0),children:u})}):t.map((I,L)=>{const H=D(I,L),U=s.includes(H),$=!!l;return h.jsxs("tr",{"data-row-key":H,className:["table__row",U?"table__row--selected":"",$?"table__row--clickable":""].filter(Boolean).join(" "),onClick:$?()=>l(I,H):void 0,onKeyDown:$?P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),l(I,H))}:void 0,tabIndex:$?0:void 0,children:[a&&h.jsx("td",{className:"table__cell table__cell--checkbox",children:h.jsx("input",{type:"checkbox",className:"table__checkbox",checked:U,"aria-label":`Select row ${H}`,onChange:()=>A(H),onClick:P=>P.stopPropagation()})}),e.map(P=>h.jsx("td",{className:"table__cell",children:P.render?P.render(I[P.key],I,L):I[P.key]},`${H}-${String(P.key)}`))]},H)})})]}))});PR.displayName="Table";const Ou=ve.forwardRef((m,f)=>{var p=m,{icon:e,label:t,count:n,active:a=!1,depth:s=0,onClick:o,className:l="",type:c="button"}=p,u=Me(p,["icon","label","count","active","depth","onClick","className","type"]);const y=["nav-item",a&&"nav-item--active",s===1&&"nav-item--depth-1",l].filter(Boolean).join(" ");return h.jsxs("button",Z(F({ref:f,type:c,className:y,onClick:o,"aria-current":a?"page":void 0},u),{children:[s===0&&e&&h.jsx(He,{name:e,size:16,className:"nav-item__icon"}),h.jsx("span",{className:"nav-item__label",children:t}),n!==void 0&&h.jsx("span",{className:"nav-item__count",children:n})]}))});Ou.displayName="NavItem";const Cv=ve.forwardRef((u,c)=>{var f=u,{title:e,version:t,collapsed:n=!1,action:a,className:s="","aria-label":o}=f,l=Me(f,["title","version","collapsed","action","className","aria-label"]);const m=["app-title",n&&"app-title--collapsed",s].filter(Boolean).join(" "),p=o!=null?o:t?`${e} ${t}`:e;return h.jsxs("div",Z(F({ref:c,className:m,"aria-label":p,role:"banner"},l),{children:[h.jsx("div",{className:"app-title__mark","aria-hidden":"true"}),!n&&h.jsxs("div",{className:"app-title__text",children:[h.jsx("div",{className:"app-title__name",children:e}),t&&h.jsx("span",{className:"app-title__version",children:t})]}),a&&h.jsx("div",{className:"app-title__action",children:a})]}))});Cv.displayName="AppTitle";const vy=ve.forwardRef((x,v)=>{var b=x,{sections:e,activeItemId:t,collapsed:n=!1,onCollapse:a,onSelectItem:s,defaultExpandedIds:o,expandedIds:l,onExpandedChange:c,showCollapseToggle:u=!0,appTitle:f,footer:m,className:p=""}=b,y=Me(b,["sections","activeItemId","collapsed","onCollapse","onSelectItem","defaultExpandedIds","expandedIds","onExpandedChange","showCollapseToggle","appTitle","footer","className"]);var A;const w=l!==void 0,[C,N]=T.useState(()=>new Set(o)),k=w?new Set(l):C,M=O=>{const R=new Set(k);R.has(O)?R.delete(O):R.add(O),w||N(R),c==null||c(Array.from(R))},D=["sidebar",n&&"sidebar--collapsed",p].filter(Boolean).join(" "),j=h.jsx("button",{type:"button",className:"sidebar__toggle",onClick:()=>a==null?void 0:a(!n),"aria-label":n?"Expand sidebar":"Collapse sidebar",children:h.jsx(He,{name:n?"chevronRight":"chevronLeft",size:16})});return h.jsxs("div",Z(F({ref:v,className:D},y),{children:[f?h.jsxs(h.Fragment,{children:[h.jsx(Cv,Z(F({},f),{collapsed:n,action:n?f.action:(A=f.action)!=null?A:j})),n&&j]}):u&&j,h.jsx("nav",{className:"sidebar__nav","aria-label":"Sidebar navigation",children:e.map(O=>h.jsxs("div",{className:"sidebar__section",children:[!n&&h.jsx("div",{className:"sidebar__section-title",children:O.title}),h.jsx("div",{className:"sidebar__items",children:O.items.map(R=>{const E=R.children&&R.children.length>0,I=k.has(R.id),L=t===R.id;return h.jsxs(ve.Fragment,{children:[h.jsxs("button",{type:"button",className:`sidebar__item ${L?"sidebar__item--active":""}`,onClick:()=>{E?M(R.id):s==null||s(R.id)},title:n?R.label:void 0,"aria-current":L?"page":void 0,"aria-expanded":E?I:void 0,children:[R.icon&&h.jsx(He,{name:R.icon,size:18,className:"sidebar__item-icon"}),!n&&h.jsx("span",{className:"sidebar__item-label",children:R.label}),!n&&R.count!==void 0&&h.jsx("span",{className:"sidebar__item-count",children:R.count}),!n&&E&&h.jsx(He,{name:"chevronRight",size:14,className:`sidebar__item-chevron ${I?"sidebar__item-chevron--open":""}`})]}),!n&&E&&I&&R.children.map(H=>h.jsxs("button",{type:"button",className:`sidebar__item sidebar__item--child ${t===H.id?"sidebar__item--active":""}`,onClick:()=>s==null?void 0:s(H.id),"aria-current":t===H.id?"page":void 0,children:[h.jsx("span",{className:"sidebar__item-label",children:H.label}),H.count!==void 0&&h.jsx("span",{className:"sidebar__item-count",children:H.count})]},H.id))]},R.id)})})]},O.title))}),m&&h.jsx("div",{className:"sidebar__footer",children:m})]}))});vy.displayName="Sidebar";function Nv(e){const[t,n]=T.useState(()=>typeof window<"u"?window.matchMedia(e).matches:!1);return T.useEffect(()=>{if(typeof window>"u")return;const a=window.matchMedia(e);n(a.matches);const s=o=>{n(o.matches)};return a.addEventListener("change",s),()=>{a.removeEventListener("change",s)}},[e]),t}const m2=ve.forwardRef((m,f)=>{var p=m,{breadcrumbs:e,searchPlaceholder:t="Search…",onSearch:n,leadingContent:a,searchHint:s,children:o,className:l="",mobileBreakpoint:c=768}=p,u=Me(p,["breadcrumbs","searchPlaceholder","onSearch","leadingContent","searchHint","children","className","mobileBreakpoint"]);const y=Nv(c!==!1?`(max-width: ${c}px)`:"(max-width: 0px)"),v=["topbar",l].filter(Boolean).join(" "),x=e?e.length-1:-1;return h.jsxs("div",Z(F({ref:f,className:v,"data-mobile":y},u),{children:[a&&h.jsx("div",{className:"topbar__leading",children:a}),h.jsx("div",{className:"topbar__breadcrumbs",children:e&&e.length>0&&h.jsx("nav",{className:"breadcrumbs","aria-label":"Breadcrumb",children:e.map((b,w)=>h.jsxs(ve.Fragment,{children:[w>0&&h.jsx("span",{className:"breadcrumbs__separator","aria-hidden":"true",children:"/"}),b.href?h.jsx("a",{href:b.href,className:"breadcrumbs__link","aria-current":w===x?"page":void 0,children:b.label}):b.onClick?h.jsx("button",{type:"button",className:"breadcrumbs__link breadcrumbs__link--button",onClick:b.onClick,"aria-current":w===x?"page":void 0,children:b.label}):h.jsx("span",{className:"breadcrumbs__link breadcrumbs__link--static","aria-current":w===x?"page":void 0,children:b.label})]},w))})}),h.jsxs("div",{className:"topbar__actions",children:[n&&!y&&h.jsxs("div",{className:"topbar__search-wrap",children:[h.jsx("input",{type:"search",placeholder:t,"aria-label":t,className:"topbar__search",onChange:b=>n(b.target.value)}),s&&h.jsx("span",{className:"topbar__search-hint",children:s})]}),o]})]}))});m2.displayName="Topbar";const HR=ve.forwardRef((l,o)=>{var c=l,{tabs:e=[],activeTabId:t="",onSelectTab:n,className:a=""}=c,s=Me(c,["tabs","activeTabId","onSelectTab","className"]);const u=["tab-bar",a].filter(Boolean).join(" "),f=T.useRef([]),m=T.useCallback((p,y)=>{var v;const x=e.map((C,N)=>C.disabled?-1:N).filter(C=>C!==-1),b=x.indexOf(y);let w;p.key==="ArrowRight"?w=x[(b+1)%x.length]:p.key==="ArrowLeft"?w=x[(b-1+x.length)%x.length]:p.key==="Home"?w=x[0]:p.key==="End"&&(w=x[x.length-1]),w!==void 0&&(p.preventDefault(),(v=f.current[w])==null||v.focus(),n==null||n(e[w].id))},[e,n]);return h.jsx("div",Z(F({ref:o,className:u,role:"tablist"},s),{children:h.jsx("div",{className:"tab-bar__tabs",children:e.map((p,y)=>h.jsxs("button",{type:"button",ref:v=>{f.current[y]=v},role:"tab","aria-selected":t===p.id,"aria-disabled":p.disabled,tabIndex:p.disabled?-1:t===p.id?0:-1,className:["tab-bar__tab",t===p.id?"tab-bar__tab--active":"",p.disabled?"tab-bar__tab--disabled":""].filter(Boolean).join(" "),onClick:()=>!p.disabled&&(n==null?void 0:n(p.id)),onKeyDown:v=>m(v,y),children:[h.jsx("span",{className:"tab-bar__tab-label",children:p.label}),p.count!==void 0&&h.jsx(Na,{form:"id-tag",children:p.count})]},p.id))})}))});HR.displayName="TabBar";const g2=ve.forwardRef((u,c)=>{var f=u,{left:e,center:t,right:n,className:a="",role:s="banner","aria-label":o="Application titlebar"}=f,l=Me(f,["left","center","right","className","role","aria-label"]);const m=["titlebar",a].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:c,className:m,role:s,"aria-label":o},l),{children:[e&&h.jsx("div",{className:"titlebar__slot titlebar__slot--left",children:e}),t&&h.jsx("div",{className:"titlebar__slot titlebar__slot--center",children:t}),n&&h.jsx("div",{className:"titlebar__slot titlebar__slot--right",children:n})]}))});g2.displayName="Titlebar";const qR=e=>typeof e=="object"&&e!==null&&"kind"in e,VR=e=>e.map((t,n)=>{switch(t.kind){case"divider":return h.jsx("div",{className:"statusbar__divider"},n);case"pulse":return h.jsxs("div",{className:"statusbar__item statusbar__item--pulse",children:[h.jsx("div",{className:`statusbar__pulse statusbar__pulse--${t.tone}`}),t.mono?h.jsx("span",{className:"statusbar__label statusbar__label--mono",children:t.label}):h.jsx("span",{className:"statusbar__label",children:t.label})]},n);case"icon":return h.jsxs("div",{className:`statusbar__item ${t.mono?"statusbar__item--mono":""}`,"aria-label":t.label,children:[h.jsx(He,{name:t.icon,size:14}),t.label&&h.jsx("span",{className:"statusbar__label",children:t.label})]},n);default:return t}}),kv=ve.forwardRef((c,l)=>{var u=c,{left:e,center:t,right:n,className:a="",mobileBreakpoint:s=768}=u,o=Me(u,["left","center","right","className","mobileBreakpoint"]);const f=Nv(s!==!1?`(max-width: ${s}px)`:"(max-width: 0px)"),m=["statusbar",a].filter(Boolean).join(" "),p=y=>y?Array.isArray(y)&&y.length>0&&qR(y[0])?VR(y):y:null;return h.jsxs("div",Z(F({ref:l,role:"status",className:m,"data-mobile":f},o),{children:[e&&h.jsx("div",{className:"statusbar__slot statusbar__slot--left statusbar__left",children:p(e)}),t&&h.jsx("div",{className:"statusbar__slot statusbar__slot--center",children:p(t)}),n&&h.jsx("div",{className:"statusbar__slot statusbar__slot--right statusbar__right",children:p(n)})]}))});kv.displayName="Statusbar";const GR=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'];function Ku(e,t,n){var l,c;const a=T.useRef(null),s=(l=n==null?void 0:n.mode)!=null?l:"modal",o=(c=n==null?void 0:n.initialFocus)!=null?c:s==="modal";T.useEffect(()=>{if(!t||!e.current)return;a.current=document.activeElement;const u=()=>e.current?Array.from(e.current.querySelectorAll(GR.join(","))):[],f=p=>{if(p.key!=="Tab")return;const y=u();if(y.length===0)return;const v=y[0],x=y[y.length-1];p.shiftKey?document.activeElement===v&&(p.preventDefault(),x.focus()):document.activeElement===x&&(p.preventDefault(),v.focus())},m=u();return m.length>0&&o&&m[0].focus(),e.current.addEventListener("keydown",f),()=>{var p;(p=e.current)==null||p.removeEventListener("keydown",f);const y=a.current;y&&document.body.contains(y)&&y.focus()}},[e,t,s,o])}let Mf=0,jf=null;function Mv(e){T.useEffect(()=>{if(e)return Mf===0&&(jf=document.body.style.overflow,document.body.style.overflow="hidden"),Mf++,()=>{Mf--,Mf===0&&jf!==null&&(document.body.style.overflow=jf,jf=null)}},[e])}const y2=ve.forwardRef((m,f)=>{var p=m,{isOpen:e,onClose:t,title:n,position:a="right",width:s="320px",children:o,className:l="",keepMounted:c=!1}=p,u=Me(p,["isOpen","onClose","title","position","width","children","className","keepMounted"]);const y=ve.useId(),v=T.useRef(null);T.useImperativeHandle(f,()=>v.current),Ku(v,e),Mv(e),T.useEffect(()=>{const b=w=>{w.key==="Escape"&&e&&t()};if(e)return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[e,t]);const x=b=>{b.target===b.currentTarget&&t()};return!c&&!e?null:h.jsx("div",{className:"drawer-backdrop",onClick:e?x:void 0,style:{display:e?"block":"none"},children:h.jsxs("div",Z(F({ref:v,className:["drawer",`drawer--${a}`,l].filter(Boolean).join(" "),style:{width:s},role:"dialog","aria-modal":e,"aria-labelledby":n?y:void 0,"data-open":e?"true":"false"},u),{children:[h.jsxs("div",{className:["drawer__header",n?"":"drawer__header--no-title"].filter(Boolean).join(" "),children:[n&&h.jsx("h2",{id:y,className:"drawer__title",children:n}),h.jsx("button",{type:"button",className:"drawer__close",onClick:t,"aria-label":"Close drawer",children:h.jsx(He,{name:"x",size:14})})]}),h.jsx("div",{className:"drawer__body",children:o})]}))})});y2.displayName="Drawer";const YR=ve.forwardRef((m,f)=>{var p=m,{titlebar:e,appTitle:t,topbar:n,sidebar:a,statusbar:s,children:o,className:l="",mobileBreakpoint:c=768}=p,u=Me(p,["titlebar","appTitle","topbar","sidebar","statusbar","children","className","mobileBreakpoint"]);var K,W;const[y,v]=T.useState(!1),x=Nv(c!==!1?`(max-width: ${c}px)`:"(max-width: 0px)");T.useEffect(()=>{x||v(!1)},[x]);const b=["shell-layout",l].filter(Boolean).join(" "),se=e!=null?e:{},{hide:w}=se,C=Me(se,["hide"]),N=e&&!e.hide,V=t!=null?t:{},{hide:k}=V,M=Me(V,["hide"]),D=t&&!t.hide,re=n!=null?n:{},{hide:j}=re,A=Me(re,["hide"]),O=n&&!n.hide,fe=a!=null?a:{},{hide:R}=fe,E=Me(fe,["hide"]),I=a&&!a.hide,B=s!=null?s:{},{hide:L}=B,H=Me(B,["hide"]),U=s&&!s.hide,$=x?Z(F({},E),{collapsed:!1,showCollapseToggle:!1,onSelectItem:ae=>{var J;try{(J=E==null?void 0:E.onSelectItem)==null||J.call(E,ae)}finally{v(!1)}}}):E,P=x&&I&&h.jsx("button",{type:"button",className:"shell-layout__mobile-menu-toggle",onClick:()=>v(!0),"aria-label":"Open sidebar menu",children:h.jsx(He,{name:"menu",size:20})}),G=O?Z(F({},A),{mobileBreakpoint:(K=A.mobileBreakpoint)!=null?K:c,leadingContent:h.jsxs(h.Fragment,{children:[x&&P,A==null?void 0:A.leadingContent]})}):A;return h.jsxs("div",Z(F({ref:f,className:b,"data-mobile":x},u),{children:[N&&h.jsx(g2,F({},C)),h.jsxs("div",{className:"shell-layout__main",children:[I?!x&&h.jsx("div",{className:"shell-layout__sidebar-col",children:h.jsx(vy,Z(F({},$),{appTitle:D?M:$.appTitle}))}):D?h.jsx(Cv,F({},M)):null,h.jsxs("div",{className:"shell-layout__content",children:[O&&h.jsx(m2,F({},G)),!O&&x&&P&&h.jsx("div",{className:"shell-layout__mobile-header",children:P}),h.jsx("main",{className:"shell-layout__canvas",children:o})]})]}),U&&h.jsx(kv,Z(F({},H),{mobileBreakpoint:(W=H.mobileBreakpoint)!=null?W:c})),x&&I&&h.jsx(y2,{isOpen:y,onClose:()=>v(!1),position:"left",width:"280px",keepMounted:!0,children:h.jsx(vy,Z(F({},$),{appTitle:D?M:$.appTitle}))})]}))});YR.displayName="ShellLayout";const jv=ve.forwardRef((p,m)=>{var y=p,{isOpen:e,onClose:t,title:n,subtitle:a,children:s,footer:o,hintFooter:l,size:c="md",className:u=""}=y,f=Me(y,["isOpen","onClose","title","subtitle","children","footer","hintFooter","size","className"]);const v=ve.useId(),x=T.useRef(null),b=T.useRef(null);T.useImperativeHandle(m,()=>b.current),Ku(b,e),Mv(e),T.useEffect(()=>{const C=N=>{N.key==="Escape"&&e&&t()};if(e)return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[e,t]);const w=C=>{C.target===x.current&&t()};return e?h.jsx("div",{ref:x,className:"modal-backdrop",onClick:w,children:h.jsxs("div",Z(F({ref:b,className:["modal",`modal--${c}`,u].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-labelledby":n?v:void 0},f),{children:[n&&h.jsxs("div",{className:"modal__header",children:[h.jsxs("div",{className:"modal__header-text",children:[h.jsx("div",{id:v,className:"modal__title",children:n}),a&&h.jsx("div",{className:"modal__subtitle",children:a})]}),h.jsx("button",{type:"button",className:"modal__close",onClick:t,"aria-label":"Close dialog",children:h.jsx(He,{name:"x",size:14})})]}),h.jsx("div",{className:"modal__body",children:s}),o&&h.jsx("div",{className:"modal__footer",children:o}),l&&h.jsx("div",{className:"modal__foot-hint",children:l})]}))}):null});jv.displayName="Modal";const uh=ve.forwardRef(({isOpen:e,onClose:t,onConfirm:n,title:a,subtitle:s,message:o,confirmLabel:l="Confirm",cancelLabel:c="Cancel",variant:u="danger"},f)=>h.jsxs(jv,{ref:f,isOpen:e,onClose:t,title:a,subtitle:s,children:[h.jsx("div",{className:"confirm-dialog__message",children:o}),h.jsxs("div",{className:"confirm-dialog__footer",children:[h.jsx(Pn,{variant:"ghost",size:"sm",onClick:t,children:c}),h.jsx(Pn,{variant:u,size:"sm",onClick:n,children:l})]})]}));uh.displayName="ConfirmDialog";function dg({icon:e,title:t,description:n,onClick:a}){return h.jsxs("button",{type:"button",className:"workspace-switcher-dialog__action-tile",onClick:a,children:[h.jsx("div",{className:"workspace-switcher-dialog__action-icon",children:h.jsx(He,{name:e,size:20})}),h.jsx("div",{className:"workspace-switcher-dialog__action-title",children:t}),h.jsx("div",{className:"workspace-switcher-dialog__action-desc",children:n})]})}const XR=ve.forwardRef(({isOpen:e,onClose:t,title:n="Switch Workspace",current:a,recent:s=[],onOpenFolder:o,onNewWorkspace:l,onCloneFromGit:c,onPickRecent:u},f)=>h.jsx(jv,{ref:f,isOpen:e,onClose:t,title:n,size:"lg",children:h.jsxs("div",{className:"workspace-switcher-dialog__content",children:[(o||l||c)&&h.jsxs("div",{className:"workspace-switcher-dialog__tiles",children:[o&&h.jsx(dg,{icon:"folder",title:"Open folder…",description:"Point to an existing workspace directory",onClick:o}),l&&h.jsx(dg,{icon:"plus",title:"New workspace…",description:"Initialize a fresh local workspace",onClick:l}),c&&h.jsx(dg,{icon:"gitBranch",title:"Clone from git…",description:"Pull a workspace from a remote repository",onClick:c})]}),s.length>0&&h.jsxs("div",{className:"workspace-switcher-dialog__recent",children:[h.jsx("div",{className:"workspace-switcher-dialog__recent-header",children:"Recent"}),h.jsx("div",{className:"workspace-switcher-dialog__recent-list",children:s.map(m=>{const p=(a==null?void 0:a.id)===m.id;return h.jsxs("button",{type:"button",className:`workspace-switcher-dialog__recent-item ${p?"workspace-switcher-dialog__recent-item--current":""}`,"aria-current":p?!0:void 0,onClick:()=>u(m),children:[h.jsxs("div",{className:"workspace-switcher-dialog__recent-main",children:[h.jsx("span",{className:"workspace-switcher-dialog__recent-name",children:m.name}),p&&h.jsx("span",{className:"workspace-switcher-dialog__open-badge",children:"open"})]}),h.jsxs("div",{className:"workspace-switcher-dialog__recent-meta",children:[m.path&&h.jsx("span",{className:"workspace-switcher-dialog__recent-path",children:m.path}),(m.classCount!=null||m.individualCount!=null)&&h.jsxs("span",{className:"workspace-switcher-dialog__recent-stats",children:[m.classCount!=null&&`${m.classCount} cls`,m.classCount!=null&&m.individualCount!=null&&" · ",m.individualCount!=null&&`${m.individualCount} ind`]})]})]},m.id)})})]})]})}));XR.displayName="WorkspaceSwitcherDialog";const v2=T.createContext(void 0);function Rh(){const e=T.useContext(v2);if(!e)throw new Error("FilterDropdown components must be used within FilterDropdown");return e}const x2=ve.forwardRef(({mode:e="checkbox",children:t,onChange:n,className:a="",defaultValue:s,value:o,placement:l="bottom-start"},c)=>{const[u,f]=T.useState(!1),m=o!==void 0,[p,y]=T.useState(new Set(s!=null?s:[])),v=m?new Set(o):p,x=T.useRef(null),b=T.useRef(null),w=T.useRef(null),C=T.useCallback(()=>f(!1),[]),{focusedValue:N,setFocusedValue:k}=jh({triggerRef:x,panelRef:b,isOpen:u,onClose:C}),M=T.useCallback(A=>{f(A)},[]),D=T.useCallback((A,O)=>{const R=new Set(v);O?(e==="radio"&&R.clear(),R.add(A)):R.delete(A),m||y(R),n==null||n(Array.from(R)),e==="radio"&&O&&f(!1)},[v,e,n,m]),j={isOpen:u,onOpenChange:M,mode:e,selectedValues:v,onValueChange:D,focusedValue:N,setFocusedValue:k,triggerRef:x,panelRef:b,placement:l};return h.jsx(v2.Provider,{value:j,children:h.jsx("div",{ref:A=>{w.current=A,typeof c=="function"?c(A):c&&(c.current=A)},className:`filter-dropdown ${a}`.trim(),children:t})})});x2.displayName="FilterDropdown";function KR(a){var s=a,{label:e,summary:t}=s,n=Me(s,["label","summary"]);const{isOpen:o,onOpenChange:l,triggerRef:c,mode:u}=Rh();return h.jsxs("button",Z(F({ref:c,type:"button"},n),{className:"filter-dropdown__trigger",onClick:()=>l(!o),"aria-haspopup":u==="radio"?"dialog":"listbox","aria-expanded":o,children:[h.jsx("span",{className:"filter-dropdown__label",children:e}),h.jsx("span",{className:"filter-dropdown__summary",children:t}),h.jsx(He,{name:"chevronDown",size:14,className:`filter-dropdown__chevron ${o?"filter-dropdown__chevron--open":""}`})]}))}function QR(s){var o=s,{children:e,className:t="",style:n}=o,a=Me(o,["children","className","style"]);const{isOpen:l,mode:c,panelRef:u,placement:f}=Rh();return h.jsx("div",Z(F({ref:u,className:`dropdown-panel ${Eh(f)} filter-dropdown__panel ${t}`.trim(),role:c==="checkbox"?"listbox":"radiogroup","aria-multiselectable":c==="checkbox"?!0:void 0,hidden:!l,style:l?n:void 0},a),{children:e}))}function ZR({title:e,children:t}){return h.jsxs("div",{className:"dropdown-section",children:[e&&h.jsx("div",{className:"dropdown-section-title",children:e}),h.jsx("div",{className:"filter-dropdown__section-content",children:t})]})}function JR({value:e,label:t,description:n}){const{selectedValues:a,onValueChange:s,focusedValue:o,setFocusedValue:l,mode:c}=Rh(),u=T.useRef(null),f=a.has(e),m=o===e;return T.useEffect(()=>{var p;m&&((p=u.current)==null||p.focus())},[m]),h.jsxs("button",{ref:u,type:"button",role:c==="checkbox"?"option":void 0,"aria-selected":f,tabIndex:m?0:-1,"data-dropdown-item":e,onClick:()=>s(e,!f),onMouseEnter:()=>l(e),className:["dropdown-item",m&&"dropdown-item--focused"].filter(Boolean).join(" "),children:[h.jsx("span",{className:"dropdown-item__leading",children:h.jsx("input",{type:"checkbox",className:"dropdown-item__checkbox",checked:f,readOnly:!0,tabIndex:-1,"aria-hidden":"true"})}),h.jsxs("span",{className:"dropdown-item__body",children:[h.jsx("span",{className:"dropdown-item__label",children:t}),n&&h.jsx("span",{className:"dropdown-item__description",children:n})]})]})}function WR({value:e,label:t,description:n}){const{selectedValues:a,onValueChange:s,focusedValue:o,setFocusedValue:l}=Rh(),c=T.useRef(null),u=a.has(e),f=o===e;return T.useEffect(()=>{var m;f&&((m=c.current)==null||m.focus())},[f]),h.jsxs("button",{ref:c,type:"button",role:"radio","aria-checked":u,tabIndex:f?0:-1,"data-dropdown-item":e,onClick:()=>s(e,!0),onMouseEnter:()=>l(e),className:["dropdown-item",f&&"dropdown-item--focused"].filter(Boolean).join(" "),children:[h.jsx("span",{className:"dropdown-item__leading",children:h.jsx("input",{type:"radio",className:"dropdown-item__radio",checked:u,readOnly:!0,tabIndex:-1,"aria-hidden":"true"})}),h.jsxs("span",{className:"dropdown-item__body",children:[h.jsx("span",{className:"dropdown-item__label",children:t}),n&&h.jsx("span",{className:"dropdown-item__description",children:n})]})]})}Object.assign(x2,{Trigger:KR,Panel:QR,Section:ZR,Checkbox:JR,Radio:WR});const eT={success:"check",error:"x",warning:"alert",info:"info"},tT={success:"emerald",error:"rose",warning:"amber",info:"cyan"},Ev=ve.forwardRef((m,f)=>{var p=m,{isOpen:e,onClose:t,title:n,subtitle:a,variant:s="info",icon:o,duration:l=4e3,className:c=""}=p,u=Me(p,["isOpen","onClose","title","subtitle","variant","icon","duration","className"]);if(T.useEffect(()=>{if(e&&l){const x=setTimeout(t,l);return()=>clearTimeout(x)}},[e,l,t]),!e)return null;const y=o||eT[s],v=tT[s];return h.jsxs("div",Z(F({ref:f,className:["toast",`toast--${s}`,c].filter(Boolean).join(" "),role:s==="error"||s==="warning"?"alert":"status","aria-live":s==="error"||s==="warning"?"assertive":"polite","aria-atomic":"true"},u),{children:[h.jsx("div",{className:`toast__icon toast__icon--${v}`,children:h.jsx(He,{name:y,size:12})}),h.jsxs("div",{className:"toast__content",children:[n&&h.jsx("div",{className:"toast__title",children:n}),a&&h.jsx("div",{className:"toast__subtitle",children:a})]}),h.jsx("button",{type:"button",className:"toast__close",onClick:t,"aria-label":"Dismiss notification",children:h.jsx(He,{name:"x",size:14})})]}))});Ev.displayName="Toast";const b2=({content:e,children:t,placement:n="top",delay:a=200,offset:s=6,className:o="",disabled:l=!1,open:c,id:u})=>{const f=c!==void 0,[m,p]=T.useState(!1),y=f?c:m,[v,x]=T.useState(n),b=T.useRef(),w=T.useRef(null),C=T.useId(),N=u!=null?u:C;T.useEffect(()=>()=>clearTimeout(b.current),[]),T.useEffect(()=>{l&&(clearTimeout(b.current),f||p(!1))},[l,f]),T.useEffect(()=>{y||x(n)},[y,n]),T.useLayoutEffect(()=>{if(!y)return;const j=w.current;if(!j)return;const A=j.getBoundingClientRect();n==="top"&&A.top<0?x("bottom"):n==="bottom"&&A.bottom>window.innerHeight?x("top"):n==="left"&&A.left<0?x("right"):n==="right"&&A.right>window.innerWidth&&x("left")},[y,n]);const k=()=>{l||f||(clearTimeout(b.current),b.current=setTimeout(()=>{x(n),p(!0)},a))},M=()=>{f||(clearTimeout(b.current),p(!1))},D=y&&!l&&e!=null;return h.jsxs("span",{className:"tooltip-wrapper",onPointerEnter:k,onPointerLeave:M,onFocus:k,onBlur:M,children:[ve.cloneElement(t,D?{"aria-describedby":N}:{}),D&&h.jsx("div",{ref:w,role:"tooltip",id:N,className:["tooltip",`tooltip--${v}`,o].filter(Boolean).join(" "),style:{"--tooltip-offset":`${s}px`},children:e})]})};b2.displayName="Tooltip";const _2=T.createContext(void 0);function w2(){const e=T.useContext(_2);if(!e)throw new Error("Popover subcomponents must be used within Popover");return e}function nT(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})}}const S2=ve.forwardRef(({open:e,onOpenChange:t,placement:n="bottom",offset:a=8,disableOutsideClick:s=!1,panelId:o,autoFocus:l=!1,children:c},u)=>{const f=e!==void 0,[m,p]=T.useState(!1),y=f?e:m,[v,x]=T.useState(n),b=T.useId(),w=o||b,C=T.useId(),N=T.useRef(null),k=T.useRef(null),M=T.useRef(null);Ku(k,y,{mode:"popup",initialFocus:l}),T.useEffect(()=>{f&&!t&&console.warn("[Popover] Controlled mode detected (open prop provided) but onOpenChange handler is missing. The popover will not respond to user interactions and will remain stuck in its current state. Either: (1) provide onOpenChange callback, or (2) remove open prop to use uncontrolled mode.")},[f,t]),T.useEffect(()=>{y||x(n)},[y,n]),T.useLayoutEffect(()=>{if(!y)return;const A=k.current;if(!A)return;const O=A.getBoundingClientRect();n==="top"&&O.top<0?x("bottom"):n==="bottom"&&O.bottom>window.innerHeight?x("top"):n==="left"&&O.left<0?x("right"):n==="right"&&O.right>window.innerWidth&&x("left")},[y,n]);const D=T.useCallback(A=>{f?t==null||t(A):p(A)},[f,t]);T.useEffect(()=>{if(!y)return;const A=M.current;if(!A)return;const O=R=>{R.key==="Escape"&&(R.preventDefault(),R.stopPropagation(),D(!1),requestAnimationFrame(()=>{const E=N.current;E&&E.offsetWidth>0&&E.offsetHeight>0&&E.focus()}))};return A.addEventListener("keydown",O),()=>A.removeEventListener("keydown",O)},[y,D]),T.useEffect(()=>{if(!y||s)return;const A=O=>{const R=O.target;M.current&&!M.current.contains(R)&&D(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[y,s,D]);const j={isOpen:y,onOpenChange:D,panelId:w,triggerId:C,placement:v,offset:a,triggerRef:N,panelRef:k};return h.jsx(_2.Provider,{value:j,children:h.jsx("div",{ref:A=>{M.current=A,typeof u=="function"?u(A):u&&(u.current=A)},className:"popover-wrapper",children:c})})});S2.displayName="Popover";function aT({children:e}){const{isOpen:t,onOpenChange:n,triggerId:a,panelId:s,triggerRef:o}=w2(),l=u=>{u.stopPropagation(),n(!t)},c=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),n(!t))};return ve.cloneElement(e,F({ref:nT([o,e.ref]),id:a,onClick:u=>{var f,m;l(u),(m=(f=e.props).onClick)==null||m.call(f,u)},onKeyDown:u=>{var f,m;c(u),(m=(f=e.props).onKeyDown)==null||m.call(f,u)},"aria-haspopup":"dialog","aria-expanded":t},t&&{"aria-controls":s}))}function iT({"aria-label":e,"aria-labelledby":t,className:n="",children:a}){const{isOpen:s,panelId:o,placement:l,offset:c,panelRef:u}=w2();return s?h.jsx("div",{ref:u,id:o,role:"dialog","aria-modal":"false","aria-label":e,"aria-labelledby":t,className:["popover-panel",`popover-panel--${l}`,n].filter(Boolean).join(" "),style:{"--popover-offset":`${c}px`},children:a}):null}const fg=Object.assign(S2,{Trigger:aT,Panel:iT}),sT=ve.forwardRef(({isOpen:e,onClose:t,commands:n=[],placeholder:a="Search commands…",emptyMessage:s="No commands found"},o)=>{const[l,c]=T.useState(""),[u,f]=T.useState(0),m=T.useRef(null),p=T.useRef(null),y=ve.useId(),v=ve.useId();T.useImperativeHandle(o,()=>p.current),Ku(p,e),Mv(e);const x=T.useMemo(()=>{const C=l.toLowerCase();return n.filter(N=>{var M;var k;return N.label.toLowerCase().includes(C)||((M=(k=N.description)==null?void 0:k.toLowerCase().includes(C))!=null?M:!1)})},[n,l]),b=T.useMemo(()=>{const C=[],N=new Map;return x.forEach((k,M)=>{N.has(k.group)||(N.set(k.group,[]),C.push(k.group)),N.get(k.group).push({cmd:k,index:M})}),C.map(k=>({name:k,items:N.get(k)}))},[x]);T.useEffect(()=>{e?setTimeout(()=>{var C;return(C=m.current)==null?void 0:C.focus()},0):(c(""),f(0))},[e]),T.useEffect(()=>{const C=N=>{e&&(N.key==="Escape"?t():N.key==="ArrowDown"?(N.preventDefault(),x.length>0&&f(k=>(k+1)%x.length)):N.key==="ArrowUp"?(N.preventDefault(),x.length>0&&f(k=>(k-1+x.length)%x.length)):N.key==="Enter"&&(N.preventDefault(),x[u]&&(x[u].onSelect(),t(),c(""))))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[e,t,x,u]);const w=C=>{C.target===C.currentTarget&&t()};return e?h.jsx("div",{ref:p,className:"command-palette-backdrop",onClick:w,children:h.jsxs("div",{className:"command-palette",role:"dialog","aria-modal":"true","aria-labelledby":v,children:[h.jsx("span",{id:v,className:"command-palette__sr-title",children:"Command palette"}),h.jsxs("div",{className:"command-palette__header",children:[h.jsx(He,{name:"search",size:16}),h.jsx("input",{ref:m,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":!0,"aria-controls":y,"aria-activedescendant":x[u]?`${y}-${x[u].id}`:void 0,"aria-label":a,className:"command-palette__input",placeholder:a,value:l,onChange:C=>{c(C.target.value),f(0)}})]}),h.jsx("div",{id:y,role:"listbox",className:"command-palette__list",children:x.length===0?h.jsx("div",{className:"command-palette__empty",children:s}):b.map(C=>{var N;return h.jsxs("div",{className:"command-palette__group",role:"group",children:[C.name&&h.jsx("div",{className:"command-palette__group-header","aria-hidden":"true",children:C.name}),C.items.map(({cmd:k,index:M})=>h.jsxs("button",{type:"button",id:`${y}-${k.id}`,role:"option","aria-selected":M===u,className:["command-palette__item",M===u&&"command-palette__item--selected"].filter(Boolean).join(" "),onClick:()=>{k.onSelect(),t(),c("")},children:[k.icon&&h.jsx(He,{name:k.icon,size:16}),h.jsxs("div",{className:"command-palette__item-content",children:[h.jsx("div",{className:"command-palette__item-label",children:k.label}),k.description&&h.jsx("div",{className:"command-palette__item-description",children:k.description})]})]},k.id))]},(N=C.name)!=null?N:"__ungrouped")})})]})}):null});sT.displayName="CommandPalette";const C2=ve.forwardRef((m,f)=>{var p=m,{title:e,subtitle:t,headerAction:n,footer:a,bordered:s=!0,noPadding:o=!1,className:l="",children:c}=p,u=Me(p,["title","subtitle","headerAction","footer","bordered","noPadding","className","children"]);const y=["panel",!s&&"panel--no-border",l].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:f,className:y},u),{children:[(e||t||n)&&h.jsxs("div",{className:"panel__header",children:[h.jsxs("div",{className:"panel__header-left",children:[e&&h.jsx("div",{className:"panel__title",children:e}),t&&h.jsx("div",{className:"panel__subtitle",children:t})]}),n&&h.jsx("div",{className:"panel__header-action",children:n})]}),c!=null&&h.jsx("div",{className:o?"panel__body panel__body--no-padding":"panel__body",children:c}),a&&h.jsx("div",{className:"panel__footer",children:a})]}))});C2.displayName="Panel";const rT=ve.forwardRef((y,p)=>{var v=y,{direction:e="horizontal",initialSplitPercent:t=50,splitPercent:n,onSplitChange:a,minSize:s=200,maxSize:o=800,first:l,second:c,dividerLabel:u,className:f=""}=v,m=Me(v,["direction","initialSplitPercent","splitPercent","onSplitChange","minSize","maxSize","first","second","dividerLabel","className"]);const[x,b]=T.useState(t),w=T.useRef(null),C=n!==void 0,N=C?n:x,k=T.useCallback((R,E)=>{const I=s/E*100,L=o/E*100;return Math.max(I,Math.min(R,L))},[s,o]),M=T.useCallback(R=>{C||b(R),a==null||a(R)},[C,a]),D=T.useCallback(R=>E=>{R.forEach(I=>{typeof I=="function"?I(E):I&&(I.current=E)})},[]),j=T.useCallback(()=>{const R=I=>{if(!w.current)return;const L=w.current.getBoundingClientRect(),H=e==="horizontal",U=H?I.clientX-L.left:I.clientY-L.top,$=H?L.width:L.height,P=U/$*100;M(k(P,$))},E=()=>{document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",E)};document.addEventListener("mousemove",R),document.addEventListener("mouseup",E)},[e,k,M]),A=T.useCallback(R=>{if(!w.current)return;const E=R.shiftKey?10:2,I=e==="horizontal",L=w.current.getBoundingClientRect(),H=I?L.width:L.height;R.key==="ArrowLeft"||R.key==="ArrowUp"?(R.preventDefault(),M(k(N-E,H))):(R.key==="ArrowRight"||R.key==="ArrowDown")&&(R.preventDefault(),M(k(N+E,H)))},[e,N,k,M]),O=["split-pane",`split-pane--${e}`,f].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:D([w,p]),className:O},m),{children:[h.jsx("div",{className:"split-pane__first",style:e==="horizontal"?{width:`${N}%`}:{height:`${N}%`},children:l}),h.jsx("div",{role:"separator","aria-orientation":e==="horizontal"?"vertical":"horizontal","aria-valuenow":Math.round(N),"aria-valuemin":0,"aria-valuemax":100,"aria-label":u!=null?u:e==="horizontal"?"Horizontal divider":"Vertical divider",tabIndex:0,className:`split-pane__divider split-pane__divider--${e}`,onMouseDown:j,onKeyDown:A}),h.jsx("div",{className:"split-pane__second",style:e==="horizontal"?{width:`${100-N}%`}:{height:`${100-N}%`},children:c})]}))});rT.displayName="SplitPane";const N2=T.createContext(void 0),k2=()=>{const e=T.useContext(N2);if(!e)throw new Error("InspectorPanel.Section must be used within an InspectorPanel");return e},M2=ve.forwardRef((c,l)=>{var u=c,{title:e,count:t,actions:n,children:a,className:s=""}=u,o=Me(u,["title","count","actions","children","className"]);k2();const f=["inspector-panel__section",s].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:l,className:f},o),{children:[h.jsxs("div",{className:"inspector-panel__section-header",children:[h.jsxs("div",{className:"inspector-panel__section-title",children:[h.jsx("span",{children:e}),t!==void 0&&h.jsxs("span",{className:"inspector-panel__section-count",children:["· ",t]})]}),n&&h.jsx("div",{className:"inspector-panel__section-actions",children:n})]}),a&&h.jsx("div",{className:"inspector-panel__section-content",children:a})]}))});M2.displayName="InspectorPanel.Section";const j2=ve.forwardRef((f,u)=>{var m=f,{title:e,count:t,actionIcon:n,actionLabel:a,onAction:s,rows:o,className:l=""}=m,c=Me(m,["title","count","actionIcon","actionLabel","onAction","rows","className"]);k2();const p=["inspector-panel__property-section",l].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:u,className:p},c),{children:[h.jsxs("div",{className:"inspector-panel__property-section-header",children:[h.jsx("span",{className:"inspector-panel__property-section-title",children:e}),t!==void 0&&h.jsx("span",{className:"inspector-panel__property-section-count",children:t}),s&&h.jsx("button",{className:"inspector-panel__property-section-action",onClick:s,type:"button","aria-label":a,children:n})]}),o.length>0&&h.jsx("div",{className:"inspector-panel__property-rows",children:o.map(y=>h.jsxs("div",{className:"inspector-panel__property-row",children:[h.jsx("span",{className:"inspector-panel__property-key",children:y.key}),h.jsx("span",{className:"inspector-panel__property-value",children:y.value}),y.usageCount!==void 0&&h.jsxs("span",{className:"inspector-panel__property-usage",children:["used ",y.usageCount]})]},y.key))})]}))});j2.displayName="InspectorPanel.PropertySection";const E2=ve.forwardRef((f,u)=>{var m=f,{eyebrow:e="",title:t,id:n,version:a,actions:s,children:o,className:l=""}=m,c=Me(m,["eyebrow","title","id","version","actions","children","className"]);const p=["inspector-panel",l].filter(Boolean).join(" ");return h.jsx(N2.Provider,{value:!0,children:h.jsxs("div",Z(F({ref:u,className:p},c),{children:[h.jsxs("div",{className:"inspector-panel__head",children:[e&&h.jsx("div",{className:"inspector-panel__eyebrow",children:e}),h.jsx("div",{className:"inspector-panel__title",children:t}),h.jsxs("div",{className:"inspector-panel__id-version",children:[h.jsx("span",{className:"inspector-panel__id",children:n}),a!==void 0&&h.jsx(Ya,{children:a})]}),s&&h.jsx("div",{className:"inspector-panel__actions",children:s})]}),h.jsx("div",{className:"inspector-panel__body",children:o})]}))})});E2.displayName="InspectorPanel";Object.assign(E2,{Section:M2,PropertySection:j2});const oT=ve.forwardRef((l,o)=>{var c=l,{rows:e=[],keyWidth:t,className:n="",style:a}=c,s=Me(c,["rows","keyWidth","className","style"]);const u=["kv-grid",n].filter(Boolean).join(" "),f=t?Z(F({},a),{gridTemplateColumns:`${typeof t=="number"?`${t}px`:t} 1fr`}):a;return h.jsx("dl",Z(F({ref:o,className:u,style:f},s),{children:e.map(m=>h.jsxs(ve.Fragment,{children:[h.jsx("dt",{className:"kv-grid__key",children:m.key}),h.jsx("dd",{className:"kv-grid__value",children:m.value})]},m.key))}))});oT.displayName="KVGrid";const lT=ve.forwardRef((u,c)=>{var f=u,{label:e,width:t,height:n,viewBox:a,className:s="",children:o}=f,l=Me(f,["label","width","height","viewBox","className","children"]);return h.jsx("svg",Z(F({ref:c,role:"img","aria-label":e,width:t,height:n,viewBox:a,className:s,style:{display:"block"}},l),{children:o}))});lT.displayName="ChartWrapper";const tc=["#22D3EE","#10B981","#F59E0B","#818CF8","#8B5CF6","#F43F5E"],S_=tc,Ir={light:{fg1:"#0B1220",fg2:"#475569",fg3:"#64748B",fg4:"#94A3B8",grid:"#EEF1F4",border:"#E5E9EE",card:"#FFFFFF",inset:"#F7F9FB"},dark:{fg1:"#E2E8F0",fg2:"#94A3B8",fg3:"#64748B",fg4:"#475569",grid:"#1B2949",border:"#243763",card:"#1B2949",inset:"#13203A"}};function Lr(e){return Math.abs(e)>=1e3?(e/1e3).toFixed(1)+"k":Number.isInteger(e)?String(e):e.toFixed(1)}const C_="#F59E0B",cT="#B45309",uT="#1B2949",dT="#2A3A5C",fT="#E6EDF3",hT="#A6B1BD",pT=ve.forwardRef((N,C)=>{var k=N,{series:e,colors:t,xLabels:n,width:a=480,height:s=200,area:o=!1,axes:l=!1,grid:c=!1,ticks:u=4,threshold:f,markers:m,tooltip:p=!1,tone:y="light",padding:v,className:x="",style:b}=k,w=Me(k,["series","colors","xLabels","width","height","area","axes","grid","ticks","threshold","markers","tooltip","tone","padding","className","style"]);var B;const M=Ir[y],D=ve.useId(),[j,A]=ve.useState(null),O=t!=null?t:e.length===1?[tc[0]]:tc,R=F({top:8,right:p?12:8,bottom:l?22:6,left:l?30:6},v),E=a-R.left-R.right,I=s-R.top-R.bottom,L=e.flat();if(L.length===0)return null;let H=Math.min(...L),U=Math.max(...L);const $=U-H||1;H-=$*.08,U+=$*.08,f&&(H=Math.min(H,f.value),U=Math.max(U,f.value));const P=Math.max(...e.map(W=>W.length)),G=W=>R.left+(P<=1?E/2:W/(P-1)*E),K=W=>R.top+I-(W-H)/(U-H)*I,se=[];for(let W=0;W<=u;W++)se.push(H+W/u*(U-H));function V(W){const ae=W.currentTarget.getBoundingClientRect(),J=(W.clientX-ae.left)/ae.width*a,le=Math.max(0,Math.min(P-1,Math.round((J-R.left)/E*(P-1))));A(le)}function re(W){return W.map(([ae,J],le)=>(le?"L":"M")+ae.toFixed(2)+","+J.toFixed(2)).join(" ")}const fe=e.map(W=>W.map((ae,J)=>[G(J),K(ae)]));return h.jsxs("svg",Z(F({ref:C,width:a,height:s,viewBox:`0 0 ${a} ${s}`,className:x,role:"img","aria-label":(B=w["aria-label"])!=null?B:"Line chart",style:F({display:"block",cursor:p?"crosshair":"default"},b),onMouseMove:p?V:void 0,onMouseLeave:p?()=>A(null):void 0},w),{children:[c&&se.map((W,ae)=>h.jsx("line",{x1:R.left,x2:a-R.right,y1:K(W),y2:K(W),stroke:M.grid,strokeWidth:"1"},"g"+ae)),l&&h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:R.left,x2:R.left,y1:R.top,y2:R.top+I,stroke:M.border,strokeWidth:"1"}),h.jsx("line",{x1:R.left,x2:a-R.right,y1:R.top+I,y2:R.top+I,stroke:M.border,strokeWidth:"1"}),se.map((W,ae)=>h.jsx("text",{x:R.left-6,y:K(W)+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:M.fg3,children:Lr(W)},"yt"+ae)),n&&n.map((W,ae)=>h.jsx("text",{x:G(ae),y:R.top+I+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:M.fg3,children:W},"xt"+ae))]}),f&&h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:R.left,x2:a-R.right,y1:K(f.value),y2:K(f.value),stroke:M.fg3,strokeWidth:"1",strokeDasharray:"3 3"}),f.label&&h.jsx("text",{x:a-R.right-4,y:K(f.value)-4,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:M.fg3,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:f.label})]}),m&&m.map((W,ae)=>h.jsxs("g",{children:[h.jsx("line",{x1:G(W.x),x2:G(W.x),y1:R.top-2,y2:R.top+I,stroke:C_,strokeWidth:"1",strokeDasharray:"2 2"}),h.jsx("circle",{cx:G(W.x),cy:R.top+4,r:"3",fill:C_}),W.label&&h.jsx("text",{x:G(W.x)+6,y:R.top+7,fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:cT,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:W.label})]},"mk"+ae)),fe.map((W,ae)=>{const J=O[ae%O.length],le=re(W),be=`${le} L${W[W.length-1][0].toFixed(2)},${R.top+I} L${W[0][0].toFixed(2)},${R.top+I} Z`,je=`${D}-lg${ae}`;return h.jsxs("g",{children:[o&&h.jsxs(h.Fragment,{children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:je,x1:"0",y1:"0",x2:"0",y2:"1",children:[h.jsx("stop",{offset:"0%",stopColor:J,stopOpacity:"0.22"}),h.jsx("stop",{offset:"100%",stopColor:J,stopOpacity:"0"})]})}),h.jsx("path",{d:be,fill:`url(#${je})`})]}),h.jsx("path",{d:le,stroke:J,strokeWidth:p?1.75:1.5,fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]},"s"+ae)}),p&&j!==null&&(()=>{const W=18+e.length*16;let ae=G(j)+10;ae+132>a-4&&(ae=G(j)-132-10);const J=R.top+4;return h.jsxs("g",{children:[h.jsx("line",{x1:G(j),x2:G(j),y1:R.top,y2:R.top+I,stroke:M.fg3,strokeWidth:"1",strokeDasharray:"2 3"}),e.map((le,be)=>le[j]!=null&&h.jsx("circle",{cx:G(j),cy:K(le[j]),r:"3",fill:M.card,stroke:O[be%O.length],strokeWidth:"1.75"},"h"+be)),h.jsx("rect",{x:ae,y:J,width:132,height:W,rx:"6",fill:uT,stroke:dT}),h.jsx("text",{x:ae+9,y:J+13,fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:hT,style:{textTransform:"uppercase",letterSpacing:"0.10em"},children:n?n[j]:`t${j}`}),e.map((le,be)=>h.jsxs("g",{children:[h.jsx("rect",{x:ae+9,y:J+22+be*16,width:"6",height:"6",rx:"1",fill:O[be%O.length]}),h.jsx("text",{x:ae+20,y:J+28+be*16,fontFamily:"JetBrains Mono, monospace",fontSize:"10.5",fill:fT,children:le[j]!=null?Lr(le[j]):"—"})]},"tt"+be))]})})()]}))});pT.displayName="LineChart";const mT=ve.forwardRef((v,y)=>{var x=v,{series:e,xLabels:t=[],yMin:n,yMax:a,yTickCount:s=5,legend:o=!1,width:l=400,height:c=200,tone:u="light",ariaLabel:f,className:m=""}=x,p=Me(x,["series","xLabels","yMin","yMax","yTickCount","legend","width","height","tone","ariaLabel","className"]);const b=Ir[u],w=G=>h.jsx("div",Z(F({ref:y,className:m,style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center",color:b.fg3,fontSize:"12px"}},p),{children:G}));if(!e||e.length===0)return w("No data");let C=1/0,N=-1/0,k=0;if(e.forEach(G=>{if(G.data&&G.data.length>0){G.data.length>k&&(k=G.data.length);for(let K=0;K<G.data.length;K++){const se=G.data[K];se<C&&(C=se),se>N&&(N=se)}}}),k===0)return w("No data");const M=isFinite(C)&&isFinite(N),D=n!==void 0?n:M?Math.min(0,C):0,j=(a!==void 0?a:M?N:1)-D||1,A={top:8,right:10,bottom:22,left:36},O=l-A.left-A.right,R=c-A.top-A.bottom,E=G=>A.top+R-(G-D)/j*R,I=E(Math.max(D,0)),L=Array.from({length:s},(G,K)=>{const se=s===1?1:s-1,V=D+j*K/se;return{value:V,y:E(V)}}),H=O/k,U=H*.18,$=Math.max(1,(H-U*2)/e.length),P=(G,K)=>G.color?Lu[G.color]:S_[K%S_.length];return h.jsxs("div",Z(F({ref:y,style:{display:"flex",flexDirection:"column",gap:"8px"},className:m},p),{children:[h.jsxs("svg",{role:"img","aria-label":f!=null?f:e.map(G=>G.name).join(", "),width:l,height:c,viewBox:`0 0 ${l} ${c}`,style:{display:"block"},children:[f&&h.jsx("title",{children:f}),L.map((G,K)=>h.jsxs("g",{children:[h.jsx("line",{x1:A.left,x2:l-A.right,y1:G.y,y2:G.y,stroke:b.grid,strokeWidth:"1"}),h.jsx("text",{x:A.left-6,y:G.y+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:b.fg3,children:Lr(G.value)})]},`y-${K}`)),h.jsx("line",{x1:A.left,x2:A.left,y1:A.top,y2:A.top+R,stroke:b.border,strokeWidth:"1"}),h.jsx("line",{x1:A.left,x2:l-A.right,y1:A.top+R,y2:A.top+R,stroke:b.border,strokeWidth:"1"}),e.map((G,K)=>{const se=P(G,K);return h.jsx("g",{children:G.data.map((V,re)=>{const fe=A.left+re*H+U+K*$,B=E(V),W=Math.min(B,I),ae=Math.abs(I-B);return h.jsx("rect",{x:fe,y:W,width:Math.max(1,$-1),height:Math.max(0,ae),fill:se,rx:"1"},`bar-${K}-${re}`)})},`series-${K}`)}),t.map((G,K)=>h.jsx("text",{x:A.left+(K+.5)*H,y:A.top+R+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:b.fg3,children:G},`x-${K}`))]}),o&&h.jsx("div",{style:{display:"flex",gap:"12px",fontSize:"12px",flexWrap:"wrap",color:b.fg2},children:e.map((G,K)=>h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[h.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"1px",backgroundColor:P(G,K)}}),h.jsx("span",{children:G.name})]},`legend-${K}`))})]}))});mT.displayName="BarChart";const gT=ve.forwardRef((b,x)=>{var w=b,{values:e,xLabels:t,color:n,width:a=480,height:s=200,axes:o=!1,grid:l=!1,ticks:c=4,threshold:u,tone:f="light",label:m,className:p="",style:y}=w,v=Me(w,["values","xLabels","color","width","height","axes","grid","ticks","threshold","tone","label","className","style"]);const C=Ir[f],N=n!=null?n:tc[2],k={top:8,right:8,bottom:o?22:6,left:o?30:6},M=a-k.left-k.right,D=s-k.top-k.bottom;if(!e||e.length===0)return null;const j=Math.max(...e,u?u.value:0),A=e.length,O=Math.max(2,M/A*.22),R=(M-O*(A-1))/A,E=L=>k.top+D-L/(j||1)*D,I=[];for(let L=0;L<=c;L++)I.push(L/c*j);return h.jsxs("svg",Z(F({ref:x,role:"img","aria-label":m,width:a,height:s,viewBox:`0 0 ${a} ${s}`,className:p,style:F({display:"block"},y)},v),{children:[l&&I.map((L,H)=>h.jsx("line",{x1:k.left,x2:a-k.right,y1:E(L),y2:E(L),stroke:C.grid,strokeWidth:"1"},"g"+H)),o&&h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:k.left,x2:k.left,y1:k.top,y2:k.top+D,stroke:C.border,strokeWidth:"1"}),h.jsx("line",{x1:k.left,x2:a-k.right,y1:k.top+D,y2:k.top+D,stroke:C.border,strokeWidth:"1"}),I.map((L,H)=>h.jsx("text",{x:k.left-6,y:E(L)+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:C.fg3,children:Lr(L)},"yt"+H))]}),e.map((L,H)=>{const U=k.left+H*(R+O),$=E(L);return h.jsxs("g",{children:[h.jsx("rect",{x:U,y:$,width:R,height:k.top+D-$,fill:N,rx:"1"}),o&&t&&t[H]!==void 0&&h.jsx("text",{x:U+R/2,y:k.top+D+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:C.fg3,children:t[H]})]},H)}),u&&h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:k.left,x2:a-k.right,y1:E(u.value),y2:E(u.value),stroke:C.fg3,strokeWidth:"1",strokeDasharray:"3 3"}),u.label&&h.jsx("text",{x:a-k.right-4,y:E(u.value)-4,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:C.fg3,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:u.label})]})]}))});gT.displayName="BarV";const yT="#22D3EE",vT=ve.forwardRef((y,p)=>{var v=y,{items:e,width:t=320,height:n=200,tone:a="light",showValues:s=!0,valueFormat:o,maxValue:l,label:c,className:u="",style:f}=v,m=Me(v,["items","width","height","tone","showValues","valueFormat","maxValue","label","className","style"]);const x=Ir[a],b={top:4,right:36,bottom:4,left:92},w=t-b.left-b.right,C=n-b.top-b.bottom;if(!e||e.length===0)return null;const N=l!=null?l:Math.max(...e.map(j=>j.value)),k=C/e.length,M=Math.min(k*.62,14),D=o!=null?o:Lr;return h.jsx("svg",Z(F({ref:p,role:"img","aria-label":c!=null?c:"Horizontal bar chart",width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:u,style:F({display:"block"},f)},m),{children:e.map((j,A)=>{var I;const O=b.top+A*k+(k-M)/2,R=j.value/(N||1)*w,E=(I=j.color)!=null?I:yT;return h.jsxs("g",{children:[h.jsx("text",{x:b.left-10,y:O+M*.78,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"11",fill:x.fg2,children:j.label}),h.jsx("rect",{x:b.left,y:O,width:w,height:M,fill:x.inset,rx:"2"}),h.jsx("rect",{x:b.left,y:O,width:R,height:M,fill:E,rx:"2"}),s&&h.jsx("text",{x:b.left+R+6,y:O+M*.78,fontFamily:"JetBrains Mono, monospace",fontSize:"11",fill:x.fg2,fontWeight:"500",children:D(j.value)})]},j.label)})}))});vT.displayName="BarH";const xT=ve.forwardRef((b,x)=>{var w=b,{stacks:e,colors:t,width:n=480,height:a=200,axes:s=!1,grid:o=!1,ticks:l=4,normalized:c=!1,tone:u="light",label:f="Stacked bar chart",stackLabel:m,className:p="",style:y}=w,v=Me(w,["stacks","colors","width","height","axes","grid","ticks","normalized","tone","label","stackLabel","className","style"]);const C=Ir[u],N=t!=null?t:tc,k={top:m?24:8,right:8,bottom:s?22:6,left:s?30:6},M=n-k.left-k.right,D=a-k.top-k.bottom;if(!e||e.length===0)return null;const j=e.map(U=>U.parts.reduce(($,P)=>isNaN($)||isNaN(P)?NaN:$+P,0)),A=j.filter(U=>!isNaN(U)),O=c?1:A.length>0?Math.max(...A):1,R=e.length,E=Math.max(2,M/R*.22),I=(M-E*(R-1))/R,L=[];for(let U=0;U<=l;U++)L.push(U/l*O);const H=U=>k.top+D-U/(O||1)*D;return h.jsxs("svg",Z(F({ref:x,role:"img","aria-label":f,width:n,height:a,viewBox:`0 0 ${n} ${a}`,className:p,style:F({display:"block"},y)},v),{children:[o&&L.map((U,$)=>h.jsx("line",{x1:k.left,x2:n-k.right,y1:H(U),y2:H(U),stroke:C.grid,strokeWidth:"1"},"g"+$)),s&&h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:k.left,x2:k.left,y1:k.top,y2:k.top+D,stroke:C.border,strokeWidth:"1"}),h.jsx("line",{x1:k.left,x2:n-k.right,y1:k.top+D,y2:k.top+D,stroke:C.border,strokeWidth:"1"}),L.map((U,$)=>h.jsx("text",{x:k.left-6,y:H(U)+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:C.fg3,children:c?`${Math.round(U*100)}%`:Lr(U)},"yt"+$))]}),e.map((U,$)=>{const P=k.left+$*(I+E),G=!isNaN(j[$])&&j[$]>0?j[$]:Math.max(...A,1);let K=0;return h.jsxs("g",{children:[U.parts.map((se,V)=>{if(isNaN(se))return null;const re=(c?se/G:se)/(O||1)*D,fe=k.top+D-K-re;return K+=re,h.jsx("rect",{x:P,y:fe,width:I,height:re,fill:N[V%N.length]},V)}),m&&!isNaN(j[$])&&h.jsx("text",{x:P+I/2,y:k.top+D-K-6,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:C.fg3,children:m==="total"?Lr(j[$]):m(U)}),s&&h.jsx("text",{x:P+I/2,y:k.top+D+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:C.fg3,children:U.label})]},$)})]}))});xT.displayName="StackedBar";const bT=ve.forwardRef((x,v)=>{var b=x,{slices:e,colors:t,width:n=160,height:a=160,thickness:s=14,gap:o=.03,centerValue:l,centerLabel:c,"aria-label":u,tone:f="light",className:m="",style:p}=b,y=Me(b,["slices","colors","width","height","thickness","gap","centerValue","centerLabel","aria-label","tone","className","style"]);const w=Ir[f],C=t!=null?t:tc;if(!e||e.length===0)return null;const N=n/2,k=a/2,M=Math.min(n,a)/2-4,D=M-s,j=e.reduce((H,U)=>H+U.value,0)||1;function A(H,U){const $=Math.cos(H),P=Math.sin(H),G=Math.cos(U),K=Math.sin(U),se=U-H>Math.PI?1:0;return[`M ${N+M*$} ${k+M*P}`,`A ${M} ${M} 0 ${se} 1 ${N+M*G} ${k+M*K}`,`L ${N+D*G} ${k+D*K}`,`A ${D} ${D} 0 ${se} 0 ${N+D*$} ${k+D*P}`,"Z"].join(" ")}const O=e.length>1?o:0;let R=-Math.PI/2;const E=e.map((H,U)=>{var K;const $=H.value/j*Math.PI*2,P=R+O/2;let G=R+$-O/2;return G-P>=Math.PI*2-1e-6&&(G=P+Math.PI*2-1e-6),G<=P&&(G=P+1e-4),R+=$,{d:A(P,G),color:(K=H.color)!=null?K:C[U%C.length]}}),I=Math.min(n,a)*.22,L=k+Math.min(n,a)*.18;return h.jsxs("svg",Z(F({ref:v,role:"img","aria-label":u!=null?u:"Donut chart",width:n,height:a,viewBox:`0 0 ${n} ${a}`,className:m,style:F({display:"block"},p)},y),{children:[E.map((H,U)=>h.jsx("path",{d:H.d,fill:H.color},U)),l!=null&&h.jsx("text",{x:N,y:k+1,textAnchor:"middle",fontFamily:"Inter, sans-serif",fontSize:I,fontWeight:"700",fill:w.fg1,style:{letterSpacing:"-0.02em",fontVariantNumeric:"tabular-nums"},children:l}),c!=null&&h.jsx("text",{x:N,y:L,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:w.fg3,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:c})]}))});bT.displayName="Donut";const _T=ve.forwardRef((w,b)=>{var C=w,{data:e,baseColor:t="#10B981",xLabels:n,yLabels:a,width:s=480,height:o=120,axes:l=!1,tone:c="light",showValues:u=!1,valueFormat:f,cellMark:m,ariaLabel:p,className:y="",style:v}=C,x=Me(C,["data","baseColor","xLabels","yLabels","width","height","axes","tone","showValues","valueFormat","cellMark","ariaLabel","className","style"]);const N=Ir[c];if(!e||e.length===0)return null;const k=e.length,M=e[0].length,D={top:4,right:8,bottom:l?18:4,left:l?28:4},j=(s-D.left-D.right)/M,A=(o-D.top-D.bottom)/k,O=e.flat().filter($=>$!=null&&!isNaN($)),R=O.length?Math.min(...O):0,E=O.length?Math.max(...O):1,I=t.replace("#",""),L=f!=null?f:Lr;function H($){if($==null||isNaN($))return N.inset;const P=($-R)/(E-R||1),G=Math.round((.12+P*.88)*255).toString(16).padStart(2,"0");return`#${I}${G}`}function U($){return($-R)/(E-R||1)>.55?"#FFFFFF":N.fg1}return h.jsxs("svg",Z(F({ref:b,role:"img","aria-label":p!=null?p:"Heatmap",width:s,height:o,viewBox:`0 0 ${s} ${o}`,className:y,style:F({display:"block"},v)},x),{children:[p&&h.jsx("title",{children:p}),e.map(($,P)=>$.map((G,K)=>{const se=D.left+K*j+1,V=D.top+P*A+1,re=se+(j-2)/2,fe=V+(A-2)/2,B=m==null?void 0:m(P,K,G!=null&&!isNaN(G)?G:null);return h.jsxs("g",{children:[h.jsx("rect",{x:se,y:V,width:Math.max(0,j-2),height:Math.max(0,A-2),fill:H(G),rx:"2"}),u&&G!=null&&!isNaN(G)&&h.jsx("text",{x:re,y:fe+3.5,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:U(G),children:L(G)}),B&&h.jsx("g",{transform:`translate(${re}, ${fe})`,children:B})]},`${P}-${K}`)})),l&&a&&a.map(($,P)=>h.jsx("text",{x:D.left-6,y:D.top+P*A+A/2+3,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:N.fg3,children:$},"y"+P)),l&&n&&n.map(($,P)=>h.jsx("text",{x:D.left+P*j+j/2,y:o-D.bottom+12,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:N.fg3,children:$},"x"+P))]}))});_T.displayName="Heatmap";const wT="#B45309",hg={ok:"#10B981",warn:"#F59E0B",error:"#F43F5E",idle:"",info:"#22D3EE"},ST=ve.forwardRef((v,y)=>{var x=v,{tracks:e,range:t=[0,100],width:n=480,height:a=160,axes:s=!1,xLabels:o,marker:l,tone:c="light","aria-label":u,className:f="",style:m}=x,p=Me(x,["tracks","range","width","height","axes","xLabels","marker","tone","aria-label","className","style"]);const b=Ir[c];if(!e||e.length===0)return null;const w={top:6,right:8,bottom:s?22:6,left:92},C=n-w.left-w.right,N=a-w.top-w.bottom,k=N/e.length,M=Math.min(k*.6,14),D=A=>w.left+(A-t[0])/(t[1]-t[0]||1)*C;function j(A){var O;return A==="idle"?b.border:(O=hg[A])!=null?O:A}return h.jsxs("svg",Z(F({ref:y,role:"img","aria-label":u,width:n,height:a,viewBox:`0 0 ${n} ${a}`,className:f,style:F({display:"block"},m)},p),{children:[e.map((A,O)=>{const R=w.top+O*k+(k-M)/2;return h.jsxs("g",{children:[h.jsx("text",{x:w.left-10,y:R+M*.78,textAnchor:"end",fontFamily:"JetBrains Mono, monospace",fontSize:"11",fill:b.fg2,children:A.label}),h.jsx("rect",{x:w.left,y:R,width:C,height:M,fill:b.inset,rx:"2"}),A.segments.map((E,I)=>h.jsx("rect",{x:D(E.start),y:R,width:Math.max(2,D(E.end)-D(E.start)),height:M,fill:j(E.kind),rx:"2"},I))]},O)}),s&&o&&o.map((A,O)=>h.jsx("text",{x:w.left+O/(o.length-1)*C,y:w.top+N+14,textAnchor:"middle",fontFamily:"JetBrains Mono, monospace",fontSize:"10",fill:b.fg3,children:A},"x"+O)),l&&h.jsxs(h.Fragment,{children:[h.jsx("line",{x1:D(l.x),x2:D(l.x),y1:w.top-2,y2:w.top+N+2,stroke:hg.warn,strokeWidth:"1",strokeDasharray:"2 2"}),h.jsx("circle",{cx:D(l.x),cy:w.top-2,r:"3",fill:hg.warn}),l.label&&h.jsx("text",{x:D(l.x)+6,y:w.top+2,fontFamily:"JetBrains Mono, monospace",fontSize:"9.5",fill:wT,style:{textTransform:"uppercase",letterSpacing:"0.08em"},children:l.label})]})]}))});ST.displayName="StatusTimeline";const Rv=ve.forwardRef((c,l)=>{var u=c,{percent:e,color:t="emerald",height:n=6,label:a,className:s=""}=u,o=Me(u,["percent","color","height","label","className"]);const f=Number.isNaN(e)?0:Math.min(Math.max(e,0),100),m=`progress-bar--${t}`;return h.jsx("div",Z(F({ref:l,className:`progress-bar ${m} ${s}`.trim(),style:{height:`${n}px`},role:"progressbar","aria-valuenow":f,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},o),{children:h.jsx("div",{className:"progress-bar__fill",style:{width:`${f}%`}})}))});Rv.displayName="ProgressBar";const CT=ve.forwardRef((p,m)=>{var y=p,{label:e,value:t,unit:n,percent:a,sparklineData:s=[],color:o="emerald",progressLabel:l,className:c="","aria-label":u}=y,f=Me(y,["label","value","unit","percent","sparklineData","color","progressLabel","className","aria-label"]);return h.jsxs("div",Z(F({ref:m,role:"row","aria-label":u!=null?u:e,className:`metric-row ${c}`.trim()},f),{children:[h.jsx("div",{className:"metric-row__label",children:e}),h.jsx("div",{className:"metric-row__progress",children:h.jsx(Rv,{percent:a,color:o,height:6,label:l!=null?l:e})}),h.jsx("div",{className:"metric-row__sparkline",children:h.jsx(Sv,{data:s,width:60,height:18,color:o})}),h.jsxs("div",{className:"metric-row__value",children:[t,n&&h.jsx("span",{className:"metric-row__unit",children:n})]})]}))});CT.displayName="MetricRow";const Tv=ve.forwardRef((u,c)=>{var f=u,{eyebrow:e,title:t,idChip:n,subtitle:a,actions:s,className:o=""}=f,l=Me(f,["eyebrow","title","idChip","subtitle","actions","className"]);const m=["page-header",o].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:c,className:m,role:"banner"},l),{children:[h.jsxs("div",{className:"page-header__text",children:[e&&h.jsx("div",{className:"page-header__eyebrow","data-testid":"page-header-eyebrow",children:e}),h.jsxs("h1",{className:"page-header__title","data-testid":"page-header-title",children:[t,n&&h.jsx(Na,{form:"id-tag",className:"page-header__id-chip","data-testid":"page-header-id-chip",children:n})]}),a&&h.jsx("div",{className:"page-header__subtitle","data-testid":"page-header-subtitle",children:a})]}),s&&h.jsx("div",{className:"page-header__actions","data-testid":"page-header-actions",children:s})]}))});Tv.displayName="PageHeader";const NT=ve.forwardRef((v,y)=>{var x=v,{filters:e=[],value:t,defaultValue:n="",onSearchChange:a,onFilterRemove:s,onClearAll:o,searchPlaceholder:l="Search...",children:c,showingCount:u,totalCount:f,className:m=""}=x,p=Me(x,["filters","value","defaultValue","onSearchChange","onFilterRemove","onClearAll","searchPlaceholder","children","showingCount","totalCount","className"]);const b=t!==void 0,[w,C]=T.useState(n),N=b?t:w,k=A=>{const O=A.target.value;b||C(O),a==null||a(O)},M=()=>{b||C(""),o==null||o()},D=["filter-bar",m].filter(Boolean).join(" "),j=ve.Children.count(c)>0;return h.jsxs("div",Z(F({ref:y,className:D,"data-testid":"filter-bar"},p),{children:[h.jsxs("div",{className:"filter-bar__controls",children:[h.jsxs("div",{className:"filter-bar__search-wrapper",role:"search",children:[h.jsx(He,{name:"search",size:16,className:"filter-bar__search-icon"}),h.jsx("input",{type:"text","aria-label":"Search",placeholder:l,value:N,onChange:k,className:"filter-bar__search-input","data-testid":"filter-bar-search"})]}),j&&h.jsx("div",{className:"filter-bar__children",children:c}),u!==void 0&&f!==void 0&&h.jsxs("div",{className:"filter-bar__caption",children:["Showing ",u," of ",f]})]}),e.length>0&&h.jsxs("div",{className:"filter-bar__chips","data-testid":"filter-bar-chips",children:[o&&h.jsx("button",{type:"button",className:"filter-bar__clear-all",onClick:M,"data-testid":"filter-bar-clear-all",children:"Clear all"}),e.map(A=>h.jsxs(Na,{variant:"neutral",className:"filter-bar__chip","data-testid":`filter-chip-${A.id}`,children:[h.jsx("span",{className:"filter-bar__chip-label",children:A.label}),h.jsx("button",{type:"button",className:"filter-bar__chip-close",onClick:()=>s==null?void 0:s(A.id),"aria-label":`Remove ${A.label} filter`,"data-testid":`filter-chip-close-${A.id}`,children:h.jsx(He,{name:"x",size:14})})]},A.id))]})]}))});NT.displayName="FilterBar";const R2=e=>{const t=typeof e=="string"?new Date(e):e,n=new Date().getTime()-t.getTime();if(Number.isNaN(n))return"";const a=Math.floor(n/6e4),s=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"just now":a<60?`${a}m ago`:s<24?`${s}h ago`:o<7?`${o}d ago`:t.toLocaleDateString()},kT=e=>{const t=typeof e=="string"?new Date(e):e;if(Number.isNaN(t.getTime()))return"";const n=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0");return`${n}:${a}:${s}`},nc=(e,t)=>{const n=typeof e=="string"?new Date(e):e,a=typeof t=="string"?new Date(t):t;return n.getFullYear()===a.getFullYear()&&n.getMonth()===a.getMonth()&&n.getDate()===a.getDate()},T2=e=>nc(e,new Date),ac=(e,t=0)=>{const n=typeof e=="string"?new Date(e):new Date(e);let a=n.getDay()-t;a<0&&(a+=7);const s=new Date(n);s.setDate(n.getDate()-a);const o=[];for(let l=0;l<7;l++){const c=new Date(s);c.setDate(s.getDate()+l),o.push(c)}return o},MT=8,A2=(e,t=0)=>{const n=typeof e=="string"?new Date(e):e;if(Number.isNaN(n.getTime()))return[];const a=new Date(n.getFullYear(),n.getMonth(),1),s=ac(a,t),o=[];let l=new Date(s[0]);for(;o.length<MT;){const c=ac(l,t);o.push(c);const u=c[c.length-1];if(u.getMonth()>n.getMonth()||u.getFullYear()>n.getFullYear())break;l=new Date(u),l.setDate(l.getDate()+1)}return o},jT=e=>(typeof e=="string"?new Date(e):new Date(e)).toLocaleDateString("en-US",{month:"long",year:"numeric"}),xy=e=>(typeof e=="string"?new Date(e):new Date(e)).toLocaleDateString("en-US",{month:"short",day:"numeric"}),ET=(e,t)=>{const n=ac(e,t),a=xy(n[0]),s=xy(n[6]);return`${a} – ${s}`},RT={create:"emerald",update:"cyan",delete:"rose",run:"amber"},TT=ve.forwardRef((o,s)=>{var l=o,{events:e=[],emptyState:t="No activity recorded",className:n=""}=l,a=Me(l,["events","emptyState","className"]);const c=["activity-timeline",n].filter(Boolean).join(" ");return e.length===0?h.jsx("div",Z(F({ref:s,className:c,"data-testid":"activity-timeline"},a),{children:h.jsx("div",{className:"activity-timeline__empty","data-testid":"activity-timeline-empty",children:t})})):h.jsx("div",Z(F({ref:s,className:c,"data-testid":"activity-timeline"},a),{children:h.jsx("div",{className:"activity-timeline__list",children:e.map(u=>h.jsxs("div",Z(F(F({className:["activity-timeline__event",u.onClick?"activity-timeline__event--clickable":""].filter(Boolean).join(" "),"data-testid":`activity-event-${u.id}`},u.kind&&{"data-kind":u.kind}),u.onClick&&{role:"button",tabIndex:0,onClick:()=>u.onClick(u),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u.onClick(u))}}),{children:[h.jsx("div",{className:"activity-timeline__dot-container",children:u.dotColor?h.jsx("div",{className:"activity-timeline__dot--custom",style:{backgroundColor:Lu[u.dotColor]},"data-testid":`activity-dot-custom-${u.id}`}):h.jsx(bv,{color:RT[u.type],className:"activity-timeline__dot","data-testid":`activity-dot-${u.type}`})}),h.jsxs("div",{className:"activity-timeline__content",children:[h.jsxs("div",{className:"activity-timeline__header",children:[u.kind&&h.jsx("span",{className:"activity-timeline__kind-label","data-testid":`activity-kind-tag-${u.id}`,children:u.kindLabel||u.kind}),h.jsx("div",{className:"activity-timeline__subject","data-testid":"activity-subject",children:u.headline||u.subject})]}),u.meta&&h.jsx("div",{className:"activity-timeline__meta","data-testid":"activity-meta",children:u.meta})]}),h.jsx("div",{className:"activity-timeline__timestamp","data-testid":"activity-timestamp",children:R2(u.timestamp)})]}),u.id))})}))});TT.displayName="ActivityTimeline";const AT=ve.forwardRef((u,c)=>{var f=u,{entries:e=[],selectedId:t,onSelect:n,order:a="newest-first",emptyState:s="No versions available",className:o=""}=f,l=Me(f,["entries","selectedId","onSelect","order","emptyState","className"]);const m=T.useRef(null),p=ve.useMemo(()=>{const w=[...e];return a==="oldest-first"?w.reverse():w},[e,a]),y=p.findIndex(w=>w.id===t),v=w=>{n&&(w.key==="ArrowUp"?(w.preventDefault(),y>0&&n(p[y-1].id)):w.key==="ArrowDown"?(w.preventDefault(),y<p.length-1&&n(p[y+1].id)):(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),y>=0&&n(p[y].id)))};T.useEffect(()=>{if(y>=0&&m.current&&t){const w=m.current.querySelector(`[data-version-id="${CSS.escape(t)}"]`);w&&w.scrollIntoView({block:"nearest"})}},[t,y]);const x=["version-timeline",o].filter(Boolean).join(" ");if(p.length===0)return h.jsx("div",Z(F({ref:c,className:x,"data-testid":"version-timeline"},l),{children:h.jsx("div",{className:"version-timeline__empty","data-testid":"version-timeline-empty",children:s})}));const b=p.length>1;return h.jsx("div",Z(F({ref:c,className:x,"data-testid":"version-timeline",role:"listbox",tabIndex:0,onKeyDown:v},l),{children:h.jsx("div",{className:"version-timeline__list",ref:m,children:p.map((w,C)=>h.jsxs("div",Z(F({className:["version-timeline__entry",t===w.id?"version-timeline__entry--selected":"",n?"version-timeline__entry--clickable":""].filter(Boolean).join(" "),"data-version-id":w.id,"data-testid":`version-entry-${w.id}`,role:"option","aria-selected":t===w.id},n&&{onClick:()=>n(w.id),tabIndex:0}),{children:[h.jsxs("div",{className:"version-timeline__rail",children:[b&&C<p.length-1&&h.jsx("div",{className:"version-timeline__connector"}),h.jsx("div",{className:["version-timeline__dot",w.head?"version-timeline__dot--head":"version-timeline__dot--hollow"].filter(Boolean).join(" "),"data-testid":`version-dot-${w.id}`})]}),h.jsxs("div",{className:"version-timeline__content",children:[h.jsxs("div",{className:"version-timeline__header",children:[h.jsx(Ya,{tone:"amber",className:"version-timeline__pill",children:w.label}),w.head&&h.jsx(Na,{variant:"amber",form:"default",className:"version-timeline__head-chip","data-testid":`version-head-${w.id}`,children:"head"})]}),w.headline&&h.jsx("div",{className:"version-timeline__headline","data-testid":`version-headline-${w.id}`,children:w.headline}),w.transition?h.jsxs("div",{className:"version-timeline__transition","data-testid":`version-transition-${w.id}`,children:[h.jsx("span",{className:"version-timeline__transition-label",children:w.transition.from}),h.jsx("span",{className:"version-timeline__transition-arrow",children:"→"}),h.jsx("span",{className:"version-timeline__transition-label",children:w.transition.to})]}):w.stats?h.jsxs("div",{className:"version-timeline__stats","data-testid":`version-stats-${w.id}`,children:[w.stats.added!==void 0&&h.jsxs("span",{className:"version-timeline__stat version-timeline__stat--added",children:[h.jsxs("span",{className:"version-timeline__stat-symbol",children:["+",w.stats.added]}),h.jsxs("span",{className:"version-timeline__stat-label","aria-label":`${w.stats.added} added`,children:[w.stats.added," added"]})]}),w.stats.removed!==void 0&&h.jsxs("span",{className:"version-timeline__stat version-timeline__stat--removed",children:[h.jsxs("span",{className:"version-timeline__stat-symbol",children:["−",w.stats.removed]}),h.jsxs("span",{className:"version-timeline__stat-label","aria-label":`${w.stats.removed} removed`,children:[w.stats.removed," removed"]})]}),w.stats.kept!==void 0&&h.jsxs("span",{className:"version-timeline__stat version-timeline__stat--kept",children:[h.jsxs("span",{className:"version-timeline__stat-symbol",children:["∩",w.stats.kept]}),h.jsxs("span",{className:"version-timeline__stat-label","aria-label":`${w.stats.kept} kept`,children:[w.stats.kept," kept"]})]})]}):null]}),h.jsx("div",{className:"version-timeline__timestamp","data-testid":`version-timestamp-${w.id}`,children:R2(w.timestamp)})]}),w.id))})}))});AT.displayName="VersionTimeline";const Av=({itemCount:e,itemHeight:t,containerHeight:n,overscan:a=5})=>{const s=T.useRef(null),o=T.useRef(null),[l,c]=T.useState([0,Math.ceil(n/t)]);return T.useEffect(()=>{const u=s.current,f=o.current;if(!u||!f)return;const m=()=>{const p=f.getBoundingClientRect(),y=u.getBoundingClientRect().top-p.top,v=Math.max(0,Math.floor(y/t)-a),x=Math.min(e,Math.ceil((y+n)/t)+a);c(b=>b[0]===v&&b[1]===x?b:[v,x])};return u.addEventListener("scroll",m,{passive:!0}),m(),()=>{u.removeEventListener("scroll",m)}},[e,t,n,a]),{visibleRange:l,containerRef:s,sentinelRef:o}},Ml=28,DT=400,D2=ve.forwardRef((c,l)=>{var u=c,{added:e=[],removed:t=[],kept:n=[],maxVisible:a=10,className:s=""}=u,o=Me(u,["added","removed","kept","maxVisible","className"]);const[f,m]=T.useState(!1),p=e.length>0||t.length>0||n.length>0,y=n.length>a&&!f,v=f?n:n.slice(0,a),x=n.length-v.length,b=Math.max(e.length,t.length,y?a+1:n.length),{visibleRange:w,containerRef:C,sentinelRef:N}=Av({itemCount:b,itemHeight:Ml,containerHeight:DT}),[k,M]=w,D=["hash-set-diff",s].filter(Boolean).join(" ");return p?h.jsxs("div",Z(F({ref:l,className:D,role:"table"},o),{children:[h.jsxs("div",{className:"hash-set-diff__header",role:"row",children:[h.jsxs("div",{className:"hash-set-diff__column hash-set-diff__column--added",role:"cell",children:[h.jsx(Ya,{tone:"emerald",className:"hash-set-diff__pill",children:"Added"}),h.jsx("span",{className:"hash-set-diff__count",children:e.length})]}),h.jsxs("div",{className:"hash-set-diff__column hash-set-diff__column--removed",role:"cell",children:[h.jsx(Ya,{tone:"rose",className:"hash-set-diff__pill",children:"Removed"}),h.jsx("span",{className:"hash-set-diff__count",children:t.length})]}),h.jsxs("div",{className:"hash-set-diff__column hash-set-diff__column--kept",role:"cell",children:[h.jsx(Ya,{className:"hash-set-diff__pill",children:"Kept"}),h.jsx("span",{className:"hash-set-diff__count",children:n.length})]})]}),h.jsx("div",{className:"hash-set-diff__viewport",ref:C,children:h.jsxs("div",{className:"hash-set-diff__content",style:{height:b*Ml,position:"relative"},children:[h.jsx("div",{ref:N,style:{position:"absolute",top:0,left:0,width:"1px",height:`${b*Ml}px`,visibility:"hidden",pointerEvents:"none"}}),h.jsx("div",{style:{height:k*Ml}}),Array.from({length:Math.min(M-k,b-k)}).map((j,A)=>{const O=k+A,R=O<e.length?e[O]:null,E=O<t.length?t[O]:null;let I=null,L=!1;return y&&O===a?L=!0:O<v.length&&(I=v[O]),h.jsxs("div",{className:"hash-set-diff__row",style:{height:Ml},role:"row",children:[h.jsx("div",{className:"hash-set-diff__cell hash-set-diff__cell--added",role:"cell",children:R&&h.jsx("div",{className:"hash-set-diff__item",children:R})}),h.jsx("div",{className:"hash-set-diff__cell hash-set-diff__cell--removed",role:"cell",children:E&&h.jsx("div",{className:"hash-set-diff__item",children:E})}),h.jsx("div",{className:"hash-set-diff__cell hash-set-diff__cell--kept",role:"cell",children:L?h.jsxs("button",{type:"button",className:"hash-set-diff__expand-button",onClick:()=>m(!0),"aria-label":`Show ${x} more kept items`,children:["… ",x," more carried forward"]}):I&&h.jsx("div",{className:"hash-set-diff__item",children:I})})]},O)}),h.jsx("div",{style:{height:Math.max(0,(b-M)*Ml)}})]})})]})):h.jsx("div",Z(F({ref:l,className:D},o),{children:h.jsx("div",{className:"hash-set-diff__empty",children:"No changes between these versions"})}))});D2.displayName="HashSetDiff";const jl=24,LT=500,Dv=ve.forwardRef((s,a)=>{var o=s,{lines:e=[],className:t=""}=o,n=Me(o,["lines","className"]);const{visibleRange:l,containerRef:c,sentinelRef:u}=Av({itemCount:e.length,itemHeight:jl,containerHeight:LT}),[f,m]=l,p=["side-by-side-diff",t].filter(Boolean).join(" ");return e.length>0?h.jsxs("div",Z(F({ref:a,className:p,role:"table"},n),{children:[h.jsxs("div",{className:"side-by-side-diff__header",role:"row",children:[h.jsx("div",{className:"side-by-side-diff__gutter",role:"cell"}),h.jsx("div",{role:"cell",className:"side-by-side-diff__header-cell",children:h.jsx(Ya,{tone:"emerald",className:"side-by-side-diff__pill side-by-side-diff__pill--added",children:"Version 2 (Added)"})}),h.jsx("div",{role:"cell",className:"side-by-side-diff__header-cell",children:h.jsx(Ya,{tone:"rose",className:"side-by-side-diff__pill side-by-side-diff__pill--removed",children:"Version 1 (Removed)"})})]}),h.jsx("div",{className:"side-by-side-diff__viewport",ref:c,children:h.jsxs("div",{className:"side-by-side-diff__content",style:{height:e.length*jl,position:"relative"},children:[h.jsx("div",{ref:u,style:{position:"absolute",top:0,left:0,width:"1px",height:`${e.length*jl}px`,visibility:"hidden",pointerEvents:"none"}}),h.jsx("div",{style:{height:f*jl}}),e.slice(f,m).map((y,v)=>{const x=f+v,b=y.type==="hunk",w=y.type==="added",C=y.type==="removed";return h.jsx("div",{className:["side-by-side-diff__row",`side-by-side-diff__row--${y.type}`].filter(Boolean).join(" "),style:{height:jl},role:"row",children:b?h.jsx("div",{className:"side-by-side-diff__hunk",role:"cell",children:y.content}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:["side-by-side-diff__gutter",w&&"side-by-side-diff__gutter--added",C&&"side-by-side-diff__gutter--removed"].filter(Boolean).join(" "),role:"cell",children:h.jsx("span",{className:"sr-only",children:w?"added":C?"removed":""})}),h.jsx("div",{className:["side-by-side-diff__line",w&&"side-by-side-diff__line--added",C&&"side-by-side-diff__line--removed"].filter(Boolean).join(" "),role:"cell",children:h.jsx("span",{className:"side-by-side-diff__content",children:y.content})})]})},x)}),h.jsx("div",{style:{height:Math.max(0,(e.length-m)*jl)}})]})})]})):h.jsx("div",Z(F({ref:a,className:p},n),{children:h.jsx("div",{className:"side-by-side-diff__empty",children:"No changes between these versions"})}))});Dv.displayName="SideBySideDiff";const Lv=T.createContext(null),L2=ve.forwardRef((l,o)=>{var c=l,{mode:e="hash-set",onModeChange:t,children:n,className:a=""}=c,s=Me(c,["mode","onModeChange","children","className"]);const[u,f]=T.useState(e);T.useEffect(()=>{f(e)},[e]);const m=v=>{f(v),t==null||t(v)},p=v=>{var x,b,w,C,N;const k=Array.from(((x=v.currentTarget.closest('[role="tablist"]'))==null?void 0:x.querySelectorAll('[role="tab"]'))||[]),M=k.indexOf(v.currentTarget);if(v.key==="ArrowLeft"){v.preventDefault();const D=M>0?M-1:k.length-1;(b=k[D])==null||b.focus()}else if(v.key==="ArrowRight"){v.preventDefault();const D=M<k.length-1?M+1:0;(w=k[D])==null||w.focus()}else v.key==="Home"?(v.preventDefault(),(C=k[0])==null||C.focus()):v.key==="End"&&(v.preventDefault(),(N=k[k.length-1])==null||N.focus())},y=["diff-viewer",a].filter(Boolean).join(" ");return h.jsx(Lv.Provider,{value:u,children:h.jsxs("div",Z(F({ref:o,className:y,role:"region","aria-label":"Diff Viewer","data-testid":"diff-viewer"},s),{children:[h.jsxs("div",{className:"diff-viewer__header",role:"tablist",children:[h.jsx("button",{type:"button",id:"diff-viewer-hash-set-tab",role:"tab","aria-selected":u==="hash-set","aria-controls":"diff-viewer-hash-set-panel",className:["diff-viewer__tab",u==="hash-set"&&"diff-viewer__tab--active"].filter(Boolean).join(" "),onClick:()=>m("hash-set"),onKeyDown:p,children:"Hash Set"}),h.jsx("button",{type:"button",id:"diff-viewer-side-by-side-tab",role:"tab","aria-selected":u==="side-by-side","aria-controls":"diff-viewer-side-by-side-panel",className:["diff-viewer__tab",u==="side-by-side"&&"diff-viewer__tab--active"].filter(Boolean).join(" "),onClick:()=>m("side-by-side"),onKeyDown:p,children:"Side by Side"})]}),h.jsxs("div",{className:"diff-viewer__content","data-testid":"diff-viewer-content",children:[u==="hash-set"&&h.jsx("div",{id:"diff-viewer-hash-set-panel",role:"tabpanel","aria-labelledby":"diff-viewer-hash-set-tab",className:"diff-viewer__panel diff-viewer__panel--hash-set",children:n}),u==="side-by-side"&&h.jsx("div",{id:"diff-viewer-side-by-side-panel",role:"tabpanel","aria-labelledby":"diff-viewer-side-by-side-tab",className:"diff-viewer__panel diff-viewer__panel--side-by-side",children:n})]})]}))})});L2.displayName="DiffViewer";function O2(u){var f=u,{added:e,removed:t,kept:n,maxVisible:a,label:s="Changes",labelTone:o="amber",className:l=""}=f,c=Me(f,["added","removed","kept","maxVisible","label","labelTone","className"]);return T.useContext(Lv)!=="hash-set"?null:h.jsxs("div",Z(F({className:["diff-viewer-hash-set",l].filter(Boolean).join(" ")},c),{children:[s&&h.jsx("div",{className:"diff-viewer-hash-set__header",children:h.jsx(Ya,{tone:o,className:"diff-viewer-hash-set__label",children:s})}),h.jsx(D2,{added:e,removed:t,kept:n,maxVisible:a})]}))}O2.displayName="DiffViewerHashSet";function I2(c){var u=c,{lines:e,addedLabel:t="Version 2 (Added)",removedLabel:n="Version 1 (Removed)",addedLabelTone:a="emerald",removedLabelTone:s="rose",className:o=""}=u,l=Me(u,["lines","addedLabel","removedLabel","addedLabelTone","removedLabelTone","className"]);return T.useContext(Lv)!=="side-by-side"?null:h.jsxs("div",Z(F({className:["diff-viewer-side-by-side",o].filter(Boolean).join(" ")},l),{children:[(t||n)&&h.jsx("div",{className:"diff-viewer-side-by-side__header",children:h.jsxs("div",{className:"diff-viewer-side-by-side__labels",children:[t&&h.jsx(Ya,{tone:a,className:"diff-viewer-side-by-side__label",children:t}),n&&h.jsx(Ya,{tone:s,className:"diff-viewer-side-by-side__label",children:n})]})}),h.jsx(Dv,{lines:e})]}))}I2.displayName="DiffViewerSideBySide";Object.assign(L2,{HashSet:O2,SideBySide:I2});const OT={error:"rose",warn:"amber",info:"cyan",success:"emerald"},IT=ve.forwardRef((o,s)=>{var l=o,{alerts:e=[],onDismiss:t,className:n=""}=l,a=Me(l,["alerts","onDismiss","className"]);const c=["alert-strip",n].filter(Boolean).join(" ");return e.length===0?null:h.jsx("div",Z(F({ref:s,className:c,"data-testid":"alert-strip"},a),{children:e.map(u=>h.jsxs("div",{className:"alert-strip__alert","data-testid":`alert-${u.id}`,children:[h.jsx(bv,{color:OT[u.severity],"data-testid":`alert-severity-${u.severity}`}),h.jsx("div",{className:"alert-strip__message","data-testid":"alert-message",children:u.message}),t&&h.jsx("button",{type:"button",className:"alert-strip__dismiss",onClick:()=>t(u.id),"aria-label":`Dismiss alert: ${u.message}`,"data-testid":`alert-dismiss-${u.id}`,children:h.jsx(He,{name:"x",size:16})})]},u.id))}))});IT.displayName="AlertStrip";const z2=ve.forwardRef((l,o)=>{var c=l,{icon:e,title:t,description:n,className:a=""}=c,s=Me(c,["icon","title","description","className"]);const u=["quick-access-tile",a].filter(Boolean).join(" ");return h.jsxs("button",Z(F({ref:o,type:"button",className:u,"data-testid":"quick-access-tile"},s),{children:[h.jsx("div",{className:"quick-access-tile__icon",children:h.jsx(He,{name:e,size:16})}),h.jsxs("div",{className:"quick-access-tile__body",children:[h.jsx("div",{className:"quick-access-tile__title",children:t}),n&&h.jsx("div",{className:"quick-access-tile__description",children:n})]}),h.jsx(He,{name:"chevronRight",size:13,className:"quick-access-tile__chev"})]}))});z2.displayName="QuickAccessTile";const zT=ve.forwardRef((l,o)=>{var c=l,{tiles:e,onAction:t,columns:n=4,className:a=""}=c,s=Me(c,["tiles","onAction","columns","className"]);const u=["quick-access-grid",a].filter(Boolean).join(" ");return h.jsx("div",Z(F({ref:o,className:u,style:{"--qa-columns":n},"data-testid":"quick-access-grid"},s),{children:e.map(f=>h.jsx(z2,{icon:f.icon,title:f.title,description:f.description,onClick:()=>t==null?void 0:t(f.id),"data-testid":`quick-access-tile-${f.id}`},f.id))}))});zT.displayName="QuickAccessGrid";const BT=ve.forwardRef((m,f)=>{var p=m,{icon:e,title:t,description:n,summary:a=[],onClick:s,className:o="",disabled:l,type:c="button"}=p,u=Me(p,["icon","title","description","summary","onClick","className","disabled","type"]);const y=["config-tile",l&&"config-tile--disabled",o].filter(Boolean).join(" ");return h.jsxs("button",Z(F({ref:f,type:c,className:y,onClick:s,disabled:l,"data-testid":"config-tile"},u),{children:[h.jsx("div",{className:"config-tile__icon",children:h.jsx(He,{name:e,size:24})}),h.jsxs("div",{className:"config-tile__content",children:[h.jsx("div",{className:"config-tile__title",children:t}),n&&h.jsx("div",{className:"config-tile__description",children:n}),a.length>0&&h.jsx("div",{className:"config-tile__summary",children:a.map((v,x)=>h.jsxs(ve.Fragment,{children:[h.jsx("div",{className:"config-tile__summary-key",children:v.label}),h.jsx("div",{className:"config-tile__summary-value",children:v.value})]},x))})]}),h.jsx("div",{className:"config-tile__chevron",children:h.jsx(He,{name:"chevronRight",size:16})})]}))});BT.displayName="ConfigTile";const UT=e=>/^https?:\/\//.test(e)||e.startsWith("/"),B2=ve.forwardRef((p,m)=>{var y=p,{role:e,senderName:t,timestamp:n,body:a,avatar:s,badge:o,toolBlock:l,thinkingBlock:c,className:u=""}=y,f=Me(y,["role","senderName","timestamp","body","avatar","badge","toolBlock","thinkingBlock","className"]);const v=s&&UT(s)?h.jsx("img",{src:s,alt:t,className:"chat-message__avatar-img"}):s||t.slice(0,2).toUpperCase();return h.jsxs("div",Z(F({ref:m,className:["chat-message",`chat-message--${e}`,u].filter(Boolean).join(" "),"data-testid":`chat-message-${e}`},f),{children:[h.jsx("div",{className:"chat-message__avatar",children:v}),h.jsxs("div",{className:"chat-message__content",children:[h.jsxs("div",{className:"chat-message__meta",children:[h.jsx("span",{className:"chat-message__sender",children:t}),o&&h.jsx("span",{className:"chat-message__badge",children:o}),h.jsx("span",{className:"chat-message__timestamp",children:n})]}),h.jsx("div",{className:"chat-message__body",children:a}),c&&h.jsx(F2,{content:c.content}),l&&h.jsx(U2,{name:l.name,status:l.status,output:l.output})]})]}))});B2.displayName="ChatMessage";const U2=ve.forwardRef((u,c)=>{var f=u,{name:e,status:t,output:n=[],defaultCollapsed:a=!1,onToggleCollapsed:s,className:o=""}=f,l=Me(f,["name","status","output","defaultCollapsed","onToggleCollapsed","className"]);const[m,p]=ve.useState(a),y=ve.useId(),v=ve.useCallback(()=>{const b=!m;p(b),s==null||s(b)},[m,s]),x=t==="running"?"amber":t==="success"?"emerald":"rose";return h.jsxs("div",Z(F({ref:c,className:["tool-block",o].filter(Boolean).join(" "),"data-testid":"tool-block"},l),{children:[h.jsxs("button",{type:"button",className:"tool-block__header",onClick:v,"aria-expanded":!m,"aria-controls":n.length>0?y:void 0,children:[h.jsx(He,{name:m?"chevronRight":"chevronDown",size:12,className:"tool-block__toggle-icon"}),h.jsx("span",{className:"tool-block__name",children:e}),h.jsx("span",{className:`tool-block__status tool-block__status--${x}`,children:t==="running"?"running":t==="success"?"success":"error"})]}),!m&&n.length>0&&h.jsx("div",{id:y,className:"tool-block__output",children:n.map((b,w)=>h.jsxs("div",{className:"tool-block__output-row",children:[b.key&&h.jsx("span",{className:"tool-block__key",children:b.key}),h.jsx("span",{className:"tool-block__value",children:b.value})]},w))})]}))});U2.displayName="ToolBlock";const F2=ve.forwardRef((c,l)=>{var u=c,{content:e,label:t="thinking",defaultCollapsed:n=!1,onToggleCollapsed:a,className:s=""}=u,o=Me(u,["content","label","defaultCollapsed","onToggleCollapsed","className"]);const[f,m]=ve.useState(n),p=ve.useId(),y=ve.useCallback(()=>{const v=!f;m(v),a==null||a(v)},[f,a]);return h.jsxs("div",Z(F({ref:l,className:["thinking-block",s].filter(Boolean).join(" "),"data-testid":"thinking-block"},o),{children:[h.jsxs("button",{type:"button",className:"thinking-block__header",onClick:y,"aria-expanded":!f,"aria-controls":f?void 0:p,children:[h.jsx(He,{name:f?"chevronRight":"chevronDown",size:12,className:"thinking-block__toggle-icon"}),h.jsx("span",{className:"thinking-block__label",children:t})]}),!f&&h.jsx("div",{id:p,className:"thinking-block__content",children:e})]}))});F2.displayName="ThinkingBlock";const FT=ve.forwardRef((s,a)=>{var o=s,{label:e,className:t=""}=o,n=Me(o,["label","className"]);return h.jsxs("div",Z(F({ref:a,role:"separator","aria-label":e,className:["chat-divider",t].filter(Boolean).join(" "),"data-testid":"chat-divider"},n),{children:[h.jsx("span",{className:"chat-divider__line"}),h.jsx("span",{className:"chat-divider__label","aria-hidden":"true",children:e}),h.jsx("span",{className:"chat-divider__line"})]}))});FT.displayName="ChatDivider";const $2=ve.forwardRef((c,l)=>{var u=c,{suggestions:e,onSelect:t,selected:n,className:a="","aria-label":s="Suggestions"}=u,o=Me(u,["suggestions","onSelect","selected","className","aria-label"]);if(!e||e.length===0)return null;const f=n!==void 0;return h.jsx("div",Z(F({ref:l,role:"group","aria-label":s,className:["chat-suggestions",a].filter(Boolean).join(" "),"data-testid":"chat-suggestions"},o),{children:e.map(m=>{const p=m===n,y=f&&!p;return h.jsx("button",{className:["chat-suggestions__pill",p?"chat-suggestions__pill--selected":"",y?"chat-suggestions__pill--disabled":""].filter(Boolean).join(" "),onClick:()=>!y&&t(m),type:"button",disabled:y,"aria-pressed":p,children:m},m)})}))});$2.displayName="ChatSuggestions";const $T=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`id-${Math.random().toString(36).slice(2,11)}-${Date.now()}`,P2=ve.forwardRef((C,w)=>{var N=C,{placeholder:e="Type a message...",value:t,onChange:n,onSubmit:a,onContextChange:s,onAttachmentChange:o,scopeLabel:l,contextItems:c=[],attachments:u=[],disabled:f=!1,loading:m=!1,label:p="Message",accept:y,enterBehavior:v="send",className:x}=N,b=Me(N,["placeholder","value","onChange","onSubmit","onContextChange","onAttachmentChange","scopeLabel","contextItems","attachments","disabled","loading","label","accept","enterBehavior","className"]);const k=T.useRef(null),M=T.useRef(null);T.useEffect(()=>{if(k.current){k.current.style.height="auto";const E=Math.min(k.current.scrollHeight,200);k.current.style.height=`${E}px`}},[t]);const D=E=>{E.key==="Enter"&&!E.shiftKey&&v==="send"&&(E.preventDefault(),t.trim()&&!f&&!m&&a(t,c))},j=()=>{t.trim()&&!f&&!m&&a(t,c)},A=E=>{const I=c.filter(L=>L.id!==E);s==null||s(I)},O=E=>{if(!E.target.files)return;const I=Array.from(E.target.files).map(H=>({id:$T(),name:H.name,size:H.size})),L=[...u,...I];o==null||o(L),M.current&&(M.current.value="")},R=E=>{const I=u.filter(L=>L.id!==E);o==null||o(I)};return h.jsxs("div",Z(F({ref:w,className:["chat-composer",f&&"chat-composer--disabled",x].filter(Boolean).join(" ")},b),{children:[h.jsxs("div",{className:"chat-composer__tools",children:[l&&h.jsxs("span",{className:"chat-composer__scope",children:["talking to ",h.jsx("b",{children:l})]}),c.map(E=>h.jsxs("div",{className:"chat-composer__context-pill",children:[h.jsx("span",{className:"chat-composer__context-label",children:E.label}),h.jsx("button",{className:"chat-composer__context-remove",onClick:()=>A(E.id),"aria-label":`Remove ${E.label}`,type:"button",children:h.jsx(He,{name:"x",size:10})})]},E.id)),u.map(E=>h.jsxs("div",{className:"chat-composer__attachment-pill",children:[h.jsx(He,{name:"paperclip",size:10}),h.jsx("span",{className:"chat-composer__attachment-label",children:E.name}),h.jsx("button",{className:"chat-composer__attachment-remove",onClick:()=>R(E.id),"aria-label":`Remove ${E.name}`,type:"button",children:h.jsx(He,{name:"x",size:10})})]},E.id))]}),h.jsxs("div",{className:"chat-composer__input-wrapper",children:[h.jsx("textarea",{ref:k,className:"chat-composer__input",placeholder:e,value:t,onChange:E=>n(E.target.value),onKeyDown:D,rows:2,disabled:f,"aria-label":p}),h.jsxs("div",{className:"chat-composer__footer",children:[h.jsx("div",{className:"chat-composer__footer-start",children:v==="send"&&h.jsxs("span",{className:"chat-composer__hint",children:[h.jsx("b",{children:"↵"})," send · ",h.jsx("b",{children:"⇧↵"})," newline"]})}),h.jsxs("div",{className:"chat-composer__footer-end",children:[h.jsx("input",{ref:M,type:"file",multiple:!0,accept:y,onChange:O,className:"chat-composer__file-input","aria-label":"Attach files"}),h.jsx("button",{className:"chat-composer__attach-button",onClick:()=>{var E;return(E=M.current)==null?void 0:E.click()},type:"button","aria-label":"Attach files",disabled:f,children:h.jsx(He,{name:"paperclip",size:12})}),h.jsxs(Pn,{variant:"primary",size:"sm",onClick:j,disabled:!t.trim()||f||m,children:[h.jsx(He,{name:"send",size:12}),"send"]})]})]})]})]}))});P2.displayName="ChatComposer";const H2=ve.forwardRef((f,u)=>{var m=f,{children:e,bots:t=[],activeBotId:n,onBotChange:a,autoScroll:s=!0,composer:o,className:l=""}=m,c=Me(m,["children","bots","activeBotId","onBotChange","autoScroll","composer","className"]);const p=T.useRef(null);return T.useEffect(()=>{s&&p.current&&(p.current.scrollTop=p.current.scrollHeight)},[e,s]),h.jsxs("div",Z(F({ref:u,className:["chat-container",l].filter(Boolean).join(" ")},c),{children:[t&&t.length>0&&h.jsx("div",{className:"chat-container__bot-tabs",role:"group","aria-label":"Bot tabs",children:t.map(y=>h.jsxs("button",{type:"button",className:["chat-container__bot-tab",n===y.id&&"chat-container__bot-tab--active"].filter(Boolean).join(" "),onClick:()=>a==null?void 0:a(y.id),"aria-pressed":n===y.id,"aria-label":`${y.label} — ${y.role}`,children:[h.jsxs("span",{className:"chat-container__bot-label",children:[h.jsx("span",{className:["chat-container__bot-status",`chat-container__bot-status--${y.status}`].filter(Boolean).join(" ")}),y.label]}),h.jsx("span",{className:"chat-container__bot-role",children:y.role})]},y.id))}),h.jsx("div",{ref:p,className:"chat-container__thread",role:"log","aria-live":"polite","aria-atomic":"false",children:h.jsx("div",{className:"chat-container__messages",children:e})}),o]}))});H2.displayName="ChatContainer";function PT(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const HT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qT=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VT={};function N_(e,t){return(VT.jsx?qT:HT).test(e)}const GT=/[ \t\n\f\r]/g;function YT(e){return typeof e=="object"?e.type==="text"?k_(e.value):!1:k_(e)}function k_(e){return e.replace(GT,"")===""}class Qu{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Qu.prototype.normal={};Qu.prototype.property={};Qu.prototype.space=void 0;function q2(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Qu(n,a,t)}function by(e){return e.toLowerCase()}class ka{constructor(t,n){this.attribute=n,this.property=t}}ka.prototype.attribute="";ka.prototype.booleanish=!1;ka.prototype.boolean=!1;ka.prototype.commaOrSpaceSeparated=!1;ka.prototype.commaSeparated=!1;ka.prototype.defined=!1;ka.prototype.mustUseProperty=!1;ka.prototype.number=!1;ka.prototype.overloadedBoolean=!1;ka.prototype.property="";ka.prototype.spaceSeparated=!1;ka.prototype.space=void 0;let XT=0;const mt=Po(),Rn=Po(),_y=Po(),Oe=Po(),Yt=Po(),Do=Po(),Pa=Po();function Po(){return $a(2,++XT)}const wy=Object.freeze(Object.defineProperty({__proto__:null,boolean:mt,booleanish:Rn,commaOrSpaceSeparated:Pa,commaSeparated:Do,number:Oe,overloadedBoolean:_y,spaceSeparated:Yt},Symbol.toStringTag,{value:"Module"})),pg=Object.keys(wy);class Ov extends ka{constructor(t,n,a,s){let o=-1;if(super(t,n),M_(this,"space",s),typeof a=="number")for(;++o<pg.length;){const l=pg[o];M_(this,pg[o],(a&wy[l])===wy[l])}}}Ov.prototype.defined=!0;function M_(e,t,n){n&&(e[t]=n)}function dc(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new Ov(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[by(a)]=a,n[by(o.attribute)]=a}return new Qu(t,n,e.space)}const V2=dc({properties:{ariaActiveDescendant:null,ariaAtomic:Rn,ariaAutoComplete:null,ariaBusy:Rn,ariaChecked:Rn,ariaColCount:Oe,ariaColIndex:Oe,ariaColSpan:Oe,ariaControls:Yt,ariaCurrent:null,ariaDescribedBy:Yt,ariaDetails:null,ariaDisabled:Rn,ariaDropEffect:Yt,ariaErrorMessage:null,ariaExpanded:Rn,ariaFlowTo:Yt,ariaGrabbed:Rn,ariaHasPopup:null,ariaHidden:Rn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Yt,ariaLevel:Oe,ariaLive:null,ariaModal:Rn,ariaMultiLine:Rn,ariaMultiSelectable:Rn,ariaOrientation:null,ariaOwns:Yt,ariaPlaceholder:null,ariaPosInSet:Oe,ariaPressed:Rn,ariaReadOnly:Rn,ariaRelevant:null,ariaRequired:Rn,ariaRoleDescription:Yt,ariaRowCount:Oe,ariaRowIndex:Oe,ariaRowSpan:Oe,ariaSelected:Rn,ariaSetSize:Oe,ariaSort:null,ariaValueMax:Oe,ariaValueMin:Oe,ariaValueNow:Oe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function G2(e,t){return t in e?e[t]:t}function Y2(e,t){return G2(e,t.toLowerCase())}const KT=dc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Do,acceptCharset:Yt,accessKey:Yt,action:null,allow:null,allowFullScreen:mt,allowPaymentRequest:mt,allowUserMedia:mt,alpha:mt,alt:null,as:null,async:mt,autoCapitalize:null,autoComplete:Yt,autoFocus:mt,autoPlay:mt,blocking:Yt,capture:null,charSet:null,checked:mt,cite:null,className:Yt,closedBy:null,colorSpace:null,cols:Oe,colSpan:Oe,command:null,commandFor:null,content:null,contentEditable:Rn,controls:mt,controlsList:Yt,coords:Oe|Do,crossOrigin:null,data:null,dateTime:null,decoding:null,default:mt,defer:mt,dir:null,dirName:null,disabled:mt,download:_y,draggable:Rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:mt,formTarget:null,headers:Yt,height:Oe,hidden:_y,high:Oe,href:null,hrefLang:null,htmlFor:Yt,httpEquiv:Yt,id:null,imageSizes:null,imageSrcSet:null,inert:mt,inputMode:null,integrity:null,is:null,isMap:mt,itemId:null,itemProp:Yt,itemRef:Yt,itemScope:mt,itemType:Yt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:mt,low:Oe,manifest:null,max:null,maxLength:Oe,media:null,method:null,min:null,minLength:Oe,multiple:mt,muted:mt,name:null,nonce:null,noModule:mt,noValidate:mt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:mt,optimum:Oe,pattern:null,ping:Yt,placeholder:null,playsInline:mt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:mt,referrerPolicy:null,rel:Yt,required:mt,reversed:mt,rows:Oe,rowSpan:Oe,sandbox:Yt,scope:null,scoped:mt,seamless:mt,selected:mt,shadowRootClonable:mt,shadowRootCustomElementRegistry:mt,shadowRootDelegatesFocus:mt,shadowRootMode:null,shadowRootSerializable:mt,shape:null,size:Oe,sizes:null,slot:null,span:Oe,spellCheck:Rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Oe,step:null,style:null,tabIndex:Oe,target:null,title:null,translate:null,type:null,typeMustMatch:mt,useMap:null,value:Rn,width:Oe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Yt,axis:null,background:null,bgColor:null,border:Oe,borderColor:null,bottomMargin:Oe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:mt,declare:mt,event:null,face:null,frame:null,frameBorder:null,hSpace:Oe,leftMargin:Oe,link:null,longDesc:null,lowSrc:null,marginHeight:Oe,marginWidth:Oe,noResize:mt,noHref:mt,noShade:mt,noWrap:mt,object:null,profile:null,prompt:null,rev:null,rightMargin:Oe,rules:null,scheme:null,scrolling:Rn,standby:null,summary:null,text:null,topMargin:Oe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Oe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:mt,disablePictureInPicture:mt,disableRemotePlayback:mt,exportParts:Do,part:Yt,prefix:null,property:null,results:Oe,security:null,unselectable:null},space:"html",transform:Y2}),QT=dc({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Pa,accentHeight:Oe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Oe,amplitude:Oe,arabicForm:null,ascent:Oe,attributeName:null,attributeType:null,azimuth:Oe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Oe,by:null,calcMode:null,capHeight:Oe,className:Yt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Oe,diffuseConstant:Oe,direction:null,display:null,dur:null,divisor:Oe,dominantBaseline:null,download:mt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Oe,enableBackground:null,end:null,event:null,exponent:Oe,externalResourcesRequired:null,fill:null,fillOpacity:Oe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Do,g2:Do,glyphName:Do,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Oe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Oe,horizOriginX:Oe,horizOriginY:Oe,id:null,ideographic:Oe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Oe,k:Oe,k1:Oe,k2:Oe,k3:Oe,k4:Oe,kernelMatrix:Pa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Oe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Oe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Oe,overlineThickness:Oe,paintOrder:null,panose1:null,path:null,pathLength:Oe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Oe,pointsAtY:Oe,pointsAtZ:Oe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Pa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Pa,rev:Pa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Pa,requiredFeatures:Pa,requiredFonts:Pa,requiredFormats:Pa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Oe,specularExponent:Oe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Oe,strikethroughThickness:Oe,string:null,stroke:null,strokeDashArray:Pa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Oe,strokeOpacity:Oe,strokeWidth:null,style:null,surfaceScale:Oe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Pa,tabIndex:Oe,tableValues:null,target:null,targetX:Oe,targetY:Oe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Pa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Oe,underlineThickness:Oe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Oe,values:null,vAlphabetic:Oe,vMathematical:Oe,vectorEffect:null,vHanging:Oe,vIdeographic:Oe,version:null,vertAdvY:Oe,vertOriginX:Oe,vertOriginY:Oe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Oe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:G2}),X2=dc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),K2=dc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Y2}),Q2=dc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),ZT={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},JT=/[A-Z]/g,j_=/-[a-z]/g,WT=/^data[-\w.:]+$/i;function eA(e,t){const n=by(t);let a=t,s=ka;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&WT.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(j_,nA);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!j_.test(o)){let l=o.replace(JT,tA);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}s=Ov}return new s(a,t)}function tA(e){return"-"+e.toLowerCase()}function nA(e){return e.charAt(1).toUpperCase()}const aA=q2([V2,KT,X2,K2,Q2],"html"),Iv=q2([V2,QT,X2,K2,Q2],"svg");function iA(e){return e.join(" ").trim()}function Z2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var El={},mg,E_;function sA(){if(E_)return mg;E_=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,u=`
|
|
50
|
+
`,f="/",m="*",p="",y="comment",v="declaration";function x(w,C){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];C=C||{};var N=1,k=1;function M(U){var $=U.match(t);$&&(N+=$.length);var P=U.lastIndexOf(u);k=~P?U.length-P:k+U.length}function D(){var U={line:N,column:k};return function($){return $.position=new j(U),R(),$}}function j(U){this.start=U,this.end={line:N,column:k},this.source=C.source}j.prototype.content=w;function A(U){var $=new Error(C.source+":"+N+":"+k+": "+U);if($.reason=U,$.filename=C.source,$.line=N,$.column=k,$.source=w,!C.silent)throw $}function O(U){var $=U.exec(w);if($){var P=$[0];return M(P),w=w.slice(P.length),$}}function R(){O(n)}function E(U){var $;for(U=U||[];$=I();)$!==!1&&U.push($);return U}function I(){var U=D();if(!(f!=w.charAt(0)||m!=w.charAt(1))){for(var $=2;p!=w.charAt($)&&(m!=w.charAt($)||f!=w.charAt($+1));)++$;if($+=2,p===w.charAt($-1))return A("End of comment missing");var P=w.slice(2,$-2);return k+=2,M(P),w=w.slice($),k+=2,U({type:y,comment:P})}}function L(){var U=D(),$=O(a);if($){if(I(),!O(s))return A("property missing ':'");var P=O(o),G=U({type:v,property:b($[0].replace(e,p)),value:P?b(P[0].replace(e,p)):p});return O(l),G}}function H(){var U=[];E(U);for(var $;$=L();)$!==!1&&(U.push($),E(U));return U}return R(),H()}function b(w){return w?w.replace(c,p):p}return mg=x,mg}var R_;function rA(){if(R_)return El;R_=1;var e=El&&El.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(El,"__esModule",{value:!0}),El.default=n;const t=e(sA());function n(a,s){let o=null;if(!a||typeof a!="string")return o;const l=(0,t.default)(a),c=typeof s=="function";return l.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:m}=u;c?s(f,m,u):m&&(o=o||{},o[f]=m)}),o}return El}var du={},T_;function oA(){if(T_)return du;T_=1,Object.defineProperty(du,"__esModule",{value:!0}),du.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(f){return!f||n.test(f)||e.test(f)},l=function(f,m){return m.toUpperCase()},c=function(f,m){return"".concat(m,"-")},u=function(f,m){return m===void 0&&(m={}),o(f)?f:(f=f.toLowerCase(),m.reactCompat?f=f.replace(s,c):f=f.replace(a,c),f.replace(t,l))};return du.camelCase=u,du}var fu,A_;function lA(){if(A_)return fu;A_=1;var e=fu&&fu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(rA()),n=oA();function a(s,o){var l={};return!s||typeof s!="string"||(0,t.default)(s,function(c,u){c&&u&&(l[(0,n.camelCase)(c,o)]=u)}),l}return a.default=a,fu=a,fu}var cA=lA();const uA=Z2(cA),J2=W2("end"),zv=W2("start");function W2(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function dA(e){const t=zv(e),n=J2(e);if(t&&n)return{start:t,end:n}}function ku(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?D_(e.position):"start"in e||"end"in e?D_(e):"line"in e||"column"in e?Sy(e):""}function Sy(e){return L_(e&&e.line)+":"+L_(e&&e.column)}function D_(e){return Sy(e&&e.start)+"-"+Sy(e&&e.end)}function L_(e){return e&&typeof e=="number"?e:1}class na extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",o={},l=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o=F({},n)),typeof t=="string"?s=t:!o.cause&&t&&(l=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const u=a.indexOf(":");u===-1?o.ruleId=a:(o.source=a.slice(0,u),o.ruleId=a.slice(u+1))}if(!o.place&&o.ancestors&&o.ancestors){const u=o.ancestors[o.ancestors.length-1];u&&(o.place=u.position)}const c=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=c?c.line:void 0,this.name=ku(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=l&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}na.prototype.file="";na.prototype.name="";na.prototype.reason="";na.prototype.message="";na.prototype.stack="";na.prototype.column=void 0;na.prototype.line=void 0;na.prototype.ancestors=void 0;na.prototype.cause=void 0;na.prototype.fatal=void 0;na.prototype.place=void 0;na.prototype.ruleId=void 0;na.prototype.source=void 0;const Bv={}.hasOwnProperty,fA=new Map,hA=/[A-Z]/g,pA=new Set(["table","tbody","thead","tfoot","tr"]),mA=new Set(["td","th"]),eC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function gA(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=CA(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=SA(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Iv:aA,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=tC(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function tC(e,t,n){if(t.type==="element")return yA(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return vA(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return bA(e,t,n);if(t.type==="mdxjsEsm")return xA(e,t);if(t.type==="root")return _A(e,t,n);if(t.type==="text")return wA(e,t)}function yA(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=Iv,e.schema=s),e.ancestors.push(t);const o=aC(e,t.tagName,!1),l=NA(e,t);let c=Fv(e,t);return pA.has(t.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!YT(u):!0})),nC(e,l,o,t),Uv(l,c),e.ancestors.pop(),e.schema=a,e.create(t,o,l,n)}function vA(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Iu(e,t.position)}function xA(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Iu(e,t.position)}function bA(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=Iv,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:aC(e,t.name,!0),l=kA(e,t),c=Fv(e,t);return nC(e,l,o,t),Uv(l,c),e.ancestors.pop(),e.schema=a,e.create(t,o,l,n)}function _A(e,t,n){const a={};return Uv(a,Fv(e,t)),e.create(t,e.Fragment,a,n)}function wA(e,t){return t.value}function nC(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function Uv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function SA(e,t,n){return a;function a(s,o,l,c){const u=Array.isArray(l.children)?n:t;return c?u(o,l,c):u(o,l)}}function CA(e,t){return n;function n(a,s,o,l){const c=Array.isArray(o.children),u=zv(a);return t(s,o,l,c,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function NA(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&Bv.call(t.properties,s)){const o=MA(e,s,t.properties[s]);if(o){const[l,c]=o;e.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&mA.has(t.tagName)?a=c:n[l]=c}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function kA(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const s=a.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Iu(e,t.position);else{const s=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const l=a.value.data.estree.body[0];l.type,o=e.evaluater.evaluateExpression(l.expression)}else Iu(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function Fv(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:fA;for(;++a<t.children.length;){const o=t.children[a];let l;if(e.passKeys){const u=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(u){const f=s.get(u)||0;l=u+"-"+f,s.set(u,f+1)}}const c=tC(e,o,l);c!==void 0&&n.push(c)}return n}function MA(e,t,n){const a=eA(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?PT(n):iA(n)),a.property==="style"){let s=typeof n=="object"?n:jA(e,String(n));return e.stylePropertyNameCase==="css"&&(s=EA(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?ZT[a.property]||a.property:a.attribute,n]}}function jA(e,t){try{return uA(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new na("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=eC+"#cannot-parse-style-attribute",s}}function aC(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,l;for(;++o<s.length;){const c=N_(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(o&&c.type==="Literal"),optional:!1}:c}a=l}else a=N_(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return Bv.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);Iu(e)}function Iu(e,t){const n=new na("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=eC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function EA(e){const t={};let n;for(n in e)Bv.call(e,n)&&(t[RA(n)]=e[n]);return t}function RA(e){let t=e.replace(hA,TA);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function TA(e){return"-"+e.toLowerCase()}const gg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},AA={};function $v(e,t){const n=AA,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return iC(e,a,s)}function iC(e,t,n){if(DA(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return O_(e.children,t,n)}return Array.isArray(e)?O_(e,t,n):""}function O_(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=iC(e[s],t,n);return a.join("")}function DA(e){return!!(e&&typeof e=="object")}const I_=document.createElement("i");function Pv(e){const t="&"+e+";";I_.innerHTML=t;const n=I_.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Xa(e,t,n,a){const s=e.length;let o=0,l;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,a.length<1e4)l=Array.from(a),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);o<a.length;)l=a.slice(o,o+1e4),l.unshift(t,0),e.splice(...l),o+=1e4,t+=1e4}function pi(e,t){return e.length>0?(Xa(e,e.length,0,t),e):t}const z_={}.hasOwnProperty;function sC(e){const t={};let n=-1;for(;++n<e.length;)LA(t,e[n]);return t}function LA(e,t){let n;for(n in t){const a=(z_.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){z_.call(a,o)||(a[o]=[]);const l=s[o];OA(a[o],Array.isArray(l)?l:l?[l]:[])}}}function OA(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);Xa(e,0,0,a)}function rC(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ai(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const fa=zr(/[A-Za-z]/),ta=zr(/[\dA-Za-z]/),IA=zr(/[#-'*+\--9=?A-Z^-~]/);function dh(e){return e!==null&&(e<32||e===127)}const Cy=zr(/\d/),zA=zr(/[\dA-Fa-f]/),BA=zr(/[!-/:-@[-`{-~]/);function ot(e){return e!==null&&e<-2}function Xt(e){return e!==null&&(e<0||e===32)}function Ct(e){return e===-2||e===-1||e===32}const Th=zr(new RegExp("\\p{P}|\\p{S}","u")),Fo=zr(/\s/);function zr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function fc(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let l="";if(o===37&&ta(e.charCodeAt(n+1))&&ta(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(l=String.fromCharCode(o));else if(o>55295&&o<57344){const c=e.charCodeAt(n+1);o<56320&&c>56319&&c<57344?(l=String.fromCharCode(o,c),s=1):l="�"}else l=String.fromCharCode(o);l&&(t.push(e.slice(a,n),encodeURIComponent(l)),a=n+s+1,l=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function Rt(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let o=0;return l;function l(u){return Ct(u)?(e.enter(n),c(u)):t(u)}function c(u){return Ct(u)&&o++<s?(e.consume(u),c):(e.exit(n),t(u))}}const UA={tokenize:FA};function FA(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Rt(e,t,"linePrefix")}function s(c){return e.enter("paragraph"),o(c)}function o(c){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return ot(c)?(e.consume(c),e.exit("chunkText"),o):(e.consume(c),l)}}const $A={tokenize:PA},B_={tokenize:HA};function PA(e){const t=this,n=[];let a=0,s,o,l;return c;function c(k){if(a<n.length){const M=n[a];return t.containerState=M[1],e.attempt(M[0].continuation,u,f)(k)}return f(k)}function u(k){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&N();const M=t.events.length;let D=M,j;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){j=t.events[D][1].end;break}C(a);let A=M;for(;A<t.events.length;)t.events[A][1].end=F({},j),A++;return Xa(t.events,D+1,0,t.events.slice(M)),t.events.length=A,f(k)}return c(k)}function f(k){if(a===n.length){if(!s)return y(k);if(s.currentConstruct&&s.currentConstruct.concrete)return x(k);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(B_,m,p)(k)}function m(k){return s&&N(),C(a),y(k)}function p(k){return t.parser.lazy[t.now().line]=a!==n.length,l=t.now().offset,x(k)}function y(k){return t.containerState={},e.attempt(B_,v,x)(k)}function v(k){return a++,n.push([t.currentConstruct,t.containerState]),y(k)}function x(k){if(k===null){s&&N(),C(0),e.consume(k);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),b(k)}function b(k){if(k===null){w(e.exit("chunkFlow"),!0),C(0),e.consume(k);return}return ot(k)?(e.consume(k),w(e.exit("chunkFlow")),a=0,t.interrupt=void 0,c):(e.consume(k),b)}function w(k,M){const D=t.sliceStream(k);if(M&&D.push(null),k.previous=o,o&&(o.next=k),o=k,s.defineSkip(k.start),s.write(D),t.parser.lazy[k.start.line]){let j=s.events.length;for(;j--;)if(s.events[j][1].start.offset<l&&(!s.events[j][1].end||s.events[j][1].end.offset>l))return;const A=t.events.length;let O=A,R,E;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(R){E=t.events[O][1].end;break}R=!0}for(C(a),j=A;j<t.events.length;)t.events[j][1].end=F({},E),j++;Xa(t.events,O+1,0,t.events.slice(A)),t.events.length=j}}function C(k){let M=n.length;for(;M-- >k;){const D=n[M];t.containerState=D[1],D[0].exit.call(t,e)}n.length=k}function N(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function HA(e,t,n){return Rt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ic(e){if(e===null||Xt(e)||Fo(e))return 1;if(Th(e))return 2}function Ah(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!a.includes(o)&&(t=o(t,n),a.push(o))}return t}const Ny={name:"attention",resolveAll:qA,tokenize:VA};function qA(e,t){let n=-1,a,s,o,l,c,u,f,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p=F({},e[a][1].end),y=F({},e[n][1].start);U_(p,-u),U_(y,u),l={type:u>1?"strongSequence":"emphasisSequence",start:p,end:F({},e[a][1].end)},c={type:u>1?"strongSequence":"emphasisSequence",start:F({},e[n][1].start),end:y},o={type:u>1?"strongText":"emphasisText",start:F({},e[a][1].end),end:F({},e[n][1].start)},s={type:u>1?"strong":"emphasis",start:F({},l.start),end:F({},c.end)},e[a][1].end=F({},l.start),e[n][1].start=F({},c.end),f=[],e[a][1].end.offset-e[a][1].start.offset&&(f=pi(f,[["enter",e[a][1],t],["exit",e[a][1],t]])),f=pi(f,[["enter",s,t],["enter",l,t],["exit",l,t],["enter",o,t]]),f=pi(f,Ah(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),f=pi(f,[["exit",o,t],["enter",c,t],["exit",c,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,f=pi(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,Xa(e,a-1,n-a+3,f),n=a+f.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function VA(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=ic(a);let o;return l;function l(u){return o=u,e.enter("attentionSequence"),c(u)}function c(u){if(u===o)return e.consume(u),c;const f=e.exit("attentionSequence"),m=ic(u),p=!m||m===2&&s||n.includes(u),y=!s||s===2&&m||n.includes(a);return f._open=!!(o===42?p:p&&(s||!y)),f._close=!!(o===42?y:y&&(m||!p)),t(u)}}function U_(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const GA={name:"autolink",tokenize:YA};function YA(e,t,n){let a=0;return s;function s(v){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(v){return fa(v)?(e.consume(v),l):v===64?n(v):f(v)}function l(v){return v===43||v===45||v===46||ta(v)?(a=1,c(v)):f(v)}function c(v){return v===58?(e.consume(v),a=0,u):(v===43||v===45||v===46||ta(v))&&a++<32?(e.consume(v),c):(a=0,f(v))}function u(v){return v===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):v===null||v===32||v===60||dh(v)?n(v):(e.consume(v),u)}function f(v){return v===64?(e.consume(v),m):IA(v)?(e.consume(v),f):n(v)}function m(v){return ta(v)?p(v):n(v)}function p(v){return v===46?(e.consume(v),a=0,m):v===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(v),e.exit("autolinkMarker"),e.exit("autolink"),t):y(v)}function y(v){if((v===45||ta(v))&&a++<63){const x=v===45?y:p;return e.consume(v),x}return n(v)}}const Zu={partial:!0,tokenize:XA};function XA(e,t,n){return a;function a(o){return Ct(o)?Rt(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||ot(o)?t(o):n(o)}}const oC={continuation:{tokenize:QA},exit:ZA,name:"blockQuote",tokenize:KA};function KA(e,t,n){const a=this;return s;function s(l){if(l===62){const c=a.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),o}return n(l)}function o(l){return Ct(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function QA(e,t,n){const a=this;return s;function s(l){return Ct(l)?Rt(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):o(l)}function o(l){return e.attempt(oC,t,n)(l)}}function ZA(e){e.exit("blockQuote")}const lC={name:"characterEscape",tokenize:JA};function JA(e,t,n){return a;function a(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return BA(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const cC={name:"characterReference",tokenize:WA};function WA(e,t,n){const a=this;let s=0,o,l;return c;function c(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),u}function u(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),o=31,l=ta,m(p))}function f(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,l=zA,m):(e.enter("characterReferenceValue"),o=7,l=Cy,m(p))}function m(p){if(p===59&&s){const y=e.exit("characterReferenceValue");return l===ta&&!Pv(a.sliceSerialize(y))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(p)&&s++<o?(e.consume(p),m):n(p)}}const F_={partial:!0,tokenize:tD},$_={concrete:!0,name:"codeFenced",tokenize:eD};function eD(e,t,n){const a=this,s={partial:!0,tokenize:D};let o=0,l=0,c;return u;function u(j){return f(j)}function f(j){const A=a.events[a.events.length-1];return o=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,c=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(j)}function m(j){return j===c?(l++,e.consume(j),m):l<3?n(j):(e.exit("codeFencedFenceSequence"),Ct(j)?Rt(e,p,"whitespace")(j):p(j))}function p(j){return j===null||ot(j)?(e.exit("codeFencedFence"),a.interrupt?t(j):e.check(F_,b,M)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||ot(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(j)):Ct(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Rt(e,v,"whitespace")(j)):j===96&&j===c?n(j):(e.consume(j),y)}function v(j){return j===null||ot(j)?p(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(j))}function x(j){return j===null||ot(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(j)):j===96&&j===c?n(j):(e.consume(j),x)}function b(j){return e.attempt(s,M,w)(j)}function w(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),C}function C(j){return o>0&&Ct(j)?Rt(e,N,"linePrefix",o+1)(j):N(j)}function N(j){return j===null||ot(j)?e.check(F_,b,M)(j):(e.enter("codeFlowValue"),k(j))}function k(j){return j===null||ot(j)?(e.exit("codeFlowValue"),N(j)):(e.consume(j),k)}function M(j){return e.exit("codeFenced"),t(j)}function D(j,A,O){let R=0;return E;function E($){return j.enter("lineEnding"),j.consume($),j.exit("lineEnding"),I}function I($){return j.enter("codeFencedFence"),Ct($)?Rt(j,L,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):L($)}function L($){return $===c?(j.enter("codeFencedFenceSequence"),H($)):O($)}function H($){return $===c?(R++,j.consume($),H):R>=l?(j.exit("codeFencedFenceSequence"),Ct($)?Rt(j,U,"whitespace")($):U($)):O($)}function U($){return $===null||ot($)?(j.exit("codeFencedFence"),A($)):O($)}}}function tD(e,t,n){const a=this;return s;function s(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o)}function o(l){return a.parser.lazy[a.now().line]?n(l):t(l)}}const yg={name:"codeIndented",tokenize:aD},nD={partial:!0,tokenize:iD};function aD(e,t,n){const a=this;return s;function s(f){return e.enter("codeIndented"),Rt(e,o,"linePrefix",5)(f)}function o(f){const m=a.events[a.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(f):n(f)}function l(f){return f===null?u(f):ot(f)?e.attempt(nD,l,u)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||ot(f)?(e.exit("codeFlowValue"),l(f)):(e.consume(f),c)}function u(f){return e.exit("codeIndented"),t(f)}}function iD(e,t,n){const a=this;return s;function s(l){return a.parser.lazy[a.now().line]?n(l):ot(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):Rt(e,o,"linePrefix",5)(l)}function o(l){const c=a.events[a.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):ot(l)?s(l):n(l)}}const sD={name:"codeText",previous:oD,resolve:rD,tokenize:lD};function rD(e){let t=e.length-4,n=3,a,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a<t;)if(e[a][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(a=n-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="codeTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function oD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lD(e,t,n){let a=0,s,o;return l;function l(p){return e.enter("codeText"),e.enter("codeTextSequence"),c(p)}function c(p){return p===96?(e.consume(p),a++,c):(e.exit("codeTextSequence"),u(p))}function u(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),u):p===96?(o=e.enter("codeTextSequence"),s=0,m(p)):ot(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("codeTextData"),f(p))}function f(p){return p===null||p===32||p===96||ot(p)?(e.exit("codeTextData"),u(p)):(e.consume(p),f)}function m(p){return p===96?(e.consume(p),s++,m):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",f(p))}}class cD{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const a=n!=null?n:Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&hu(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),hu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),hu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);hu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);hu(this.left,n.reverse())}}}function hu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function uC(e){const t={};let n=-1,a,s,o,l,c,u,f;const m=new cD(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(a=m.get(n),n&&a[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(u=a[1]._tokenizer.events,o=0,o<u.length&&u[o][1].type==="lineEndingBlank"&&(o+=2),o<u.length&&u[o][1].type==="content"))for(;++o<u.length&&u[o][1].type!=="content";)u[o][1].type==="chunkText"&&(u[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,uD(m,n)),n=t[n],f=!0);else if(a[1]._container){for(o=n,s=void 0;o--;)if(l=m.get(o),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(s&&(m.get(s)[1].type="lineEndingBlank"),l[1].type="lineEnding",s=o);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;s&&(a[1].end=F({},m.get(s)[1].start),c=m.slice(s,n),c.unshift(a),m.splice(s,n-s+1,c))}}return Xa(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!f}function uD(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const o=[];let l=n._tokenizer;l||(l=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,u=[],f={};let m,p,y=-1,v=n,x=0,b=0;const w=[b];for(;v;){for(;e.get(++s)[1]!==v;);o.push(s),v._tokenizer||(m=a.sliceStream(v),v.next||m.push(null),p&&l.defineSkip(v.start),v._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(m),v._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),p=v,v=v.next}for(v=n;++y<c.length;)c[y][0]==="exit"&&c[y-1][0]==="enter"&&c[y][1].type===c[y-1][1].type&&c[y][1].start.line!==c[y][1].end.line&&(b=y+1,w.push(b),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(l.events=[],v?(v._tokenizer=void 0,v.previous=void 0):w.pop(),y=w.length;y--;){const C=c.slice(w[y],w[y+1]),N=o.pop();u.push([N,N+C.length-1]),e.splice(N,2,C)}for(u.reverse(),y=-1;++y<u.length;)f[x+u[y][0]]=x+u[y][1],x+=u[y][1]-u[y][0]-1;return f}const dD={resolve:hD,tokenize:pD},fD={partial:!0,tokenize:mD};function hD(e){return uC(e),e}function pD(e,t){let n;return a;function a(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(c)}function s(c){return c===null?o(c):ot(c)?e.check(fD,l,o)(c):(e.consume(c),s)}function o(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function mD(e,t,n){const a=this;return s;function s(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Rt(e,o,"linePrefix")}function o(l){if(l===null||ot(l))return n(l);const c=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(a.parser.constructs.flow,n,t)(l)}}function dC(e,t,n,a,s,o,l,c,u){const f=u||Number.POSITIVE_INFINITY;let m=0;return p;function p(C){return C===60?(e.enter(a),e.enter(s),e.enter(o),e.consume(C),e.exit(o),y):C===null||C===32||C===41||dh(C)?n(C):(e.enter(a),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),b(C))}function y(C){return C===62?(e.enter(o),e.consume(C),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),v(C))}function v(C){return C===62?(e.exit("chunkString"),e.exit(c),y(C)):C===null||C===60||ot(C)?n(C):(e.consume(C),C===92?x:v)}function x(C){return C===60||C===62||C===92?(e.consume(C),v):v(C)}function b(C){return!m&&(C===null||C===41||Xt(C))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(a),t(C)):m<f&&C===40?(e.consume(C),m++,b):C===41?(e.consume(C),m--,b):C===null||C===32||C===40||dh(C)?n(C):(e.consume(C),C===92?w:b)}function w(C){return C===40||C===41||C===92?(e.consume(C),b):b(C)}}function fC(e,t,n,a,s,o){const l=this;let c=0,u;return f;function f(v){return e.enter(a),e.enter(s),e.consume(v),e.exit(s),e.enter(o),m}function m(v){return c>999||v===null||v===91||v===93&&!u||v===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(v):v===93?(e.exit(o),e.enter(s),e.consume(v),e.exit(s),e.exit(a),t):ot(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===null||v===91||v===93||ot(v)||c++>999?(e.exit("chunkString"),m(v)):(e.consume(v),u||(u=!Ct(v)),v===92?y:p)}function y(v){return v===91||v===92||v===93?(e.consume(v),c++,p):p(v)}}function hC(e,t,n,a,s,o){let l;return c;function c(y){return y===34||y===39||y===40?(e.enter(a),e.enter(s),e.consume(y),e.exit(s),l=y===40?41:y,u):n(y)}function u(y){return y===l?(e.enter(s),e.consume(y),e.exit(s),e.exit(a),t):(e.enter(o),f(y))}function f(y){return y===l?(e.exit(o),u(l)):y===null?n(y):ot(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Rt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===l||y===null||ot(y)?(e.exit("chunkString"),f(y)):(e.consume(y),y===92?p:m)}function p(y){return y===l||y===92?(e.consume(y),m):m(y)}}function Mu(e,t){let n;return a;function a(s){return ot(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):Ct(s)?Rt(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const gD={name:"definition",tokenize:vD},yD={partial:!0,tokenize:xD};function vD(e,t,n){const a=this;let s;return o;function o(v){return e.enter("definition"),l(v)}function l(v){return fC.call(a,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function c(v){return s=Ai(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),v===58?(e.enter("definitionMarker"),e.consume(v),e.exit("definitionMarker"),u):n(v)}function u(v){return Xt(v)?Mu(e,f)(v):f(v)}function f(v){return dC(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return e.attempt(yD,p,p)(v)}function p(v){return Ct(v)?Rt(e,y,"whitespace")(v):y(v)}function y(v){return v===null||ot(v)?(e.exit("definition"),a.parser.defined.push(s),t(v)):n(v)}}function xD(e,t,n){return a;function a(c){return Xt(c)?Mu(e,s)(c):n(c)}function s(c){return hC(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function o(c){return Ct(c)?Rt(e,l,"whitespace")(c):l(c)}function l(c){return c===null||ot(c)?t(c):n(c)}}const bD={name:"hardBreakEscape",tokenize:_D};function _D(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return ot(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const wD={name:"headingAtx",resolve:SD,tokenize:CD};function SD(e,t){let n=e.length-2,a=3,s,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},Xa(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function CD(e,t,n){let a=0;return s;function s(m){return e.enter("atxHeading"),o(m)}function o(m){return e.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&a++<6?(e.consume(m),l):m===null||Xt(m)?(e.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(e.enter("atxHeadingSequence"),u(m)):m===null||ot(m)?(e.exit("atxHeading"),t(m)):Ct(m)?Rt(e,c,"whitespace")(m):(e.enter("atxHeadingText"),f(m))}function u(m){return m===35?(e.consume(m),u):(e.exit("atxHeadingSequence"),c(m))}function f(m){return m===null||m===35||Xt(m)?(e.exit("atxHeadingText"),c(m)):(e.consume(m),f)}}const ND=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],P_=["pre","script","style","textarea"],kD={concrete:!0,name:"htmlFlow",resolveTo:ED,tokenize:RD},MD={partial:!0,tokenize:AD},jD={partial:!0,tokenize:TD};function ED(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function RD(e,t,n){const a=this;let s,o,l,c,u;return f;function f(B){return m(B)}function m(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),p}function p(B){return B===33?(e.consume(B),y):B===47?(e.consume(B),o=!0,b):B===63?(e.consume(B),s=3,a.interrupt?t:V):fa(B)?(e.consume(B),l=String.fromCharCode(B),w):n(B)}function y(B){return B===45?(e.consume(B),s=2,v):B===91?(e.consume(B),s=5,c=0,x):fa(B)?(e.consume(B),s=4,a.interrupt?t:V):n(B)}function v(B){return B===45?(e.consume(B),a.interrupt?t:V):n(B)}function x(B){const W="CDATA[";return B===W.charCodeAt(c++)?(e.consume(B),c===W.length?a.interrupt?t:L:x):n(B)}function b(B){return fa(B)?(e.consume(B),l=String.fromCharCode(B),w):n(B)}function w(B){if(B===null||B===47||B===62||Xt(B)){const W=B===47,ae=l.toLowerCase();return!W&&!o&&P_.includes(ae)?(s=1,a.interrupt?t(B):L(B)):ND.includes(l.toLowerCase())?(s=6,W?(e.consume(B),C):a.interrupt?t(B):L(B)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(B):o?N(B):k(B))}return B===45||ta(B)?(e.consume(B),l+=String.fromCharCode(B),w):n(B)}function C(B){return B===62?(e.consume(B),a.interrupt?t:L):n(B)}function N(B){return Ct(B)?(e.consume(B),N):E(B)}function k(B){return B===47?(e.consume(B),E):B===58||B===95||fa(B)?(e.consume(B),M):Ct(B)?(e.consume(B),k):E(B)}function M(B){return B===45||B===46||B===58||B===95||ta(B)?(e.consume(B),M):D(B)}function D(B){return B===61?(e.consume(B),j):Ct(B)?(e.consume(B),D):k(B)}function j(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),u=B,A):Ct(B)?(e.consume(B),j):O(B)}function A(B){return B===u?(e.consume(B),u=null,R):B===null||ot(B)?n(B):(e.consume(B),A)}function O(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Xt(B)?D(B):(e.consume(B),O)}function R(B){return B===47||B===62||Ct(B)?k(B):n(B)}function E(B){return B===62?(e.consume(B),I):n(B)}function I(B){return B===null||ot(B)?L(B):Ct(B)?(e.consume(B),I):n(B)}function L(B){return B===45&&s===2?(e.consume(B),P):B===60&&s===1?(e.consume(B),G):B===62&&s===4?(e.consume(B),re):B===63&&s===3?(e.consume(B),V):B===93&&s===5?(e.consume(B),se):ot(B)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(MD,fe,H)(B)):B===null||ot(B)?(e.exit("htmlFlowData"),H(B)):(e.consume(B),L)}function H(B){return e.check(jD,U,fe)(B)}function U(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),$}function $(B){return B===null||ot(B)?H(B):(e.enter("htmlFlowData"),L(B))}function P(B){return B===45?(e.consume(B),V):L(B)}function G(B){return B===47?(e.consume(B),l="",K):L(B)}function K(B){if(B===62){const W=l.toLowerCase();return P_.includes(W)?(e.consume(B),re):L(B)}return fa(B)&&l.length<8?(e.consume(B),l+=String.fromCharCode(B),K):L(B)}function se(B){return B===93?(e.consume(B),V):L(B)}function V(B){return B===62?(e.consume(B),re):B===45&&s===2?(e.consume(B),V):L(B)}function re(B){return B===null||ot(B)?(e.exit("htmlFlowData"),fe(B)):(e.consume(B),re)}function fe(B){return e.exit("htmlFlow"),t(B)}}function TD(e,t,n){const a=this;return s;function s(l){return ot(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):n(l)}function o(l){return a.parser.lazy[a.now().line]?n(l):t(l)}}function AD(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Zu,t,n)}}const DD={name:"htmlText",tokenize:LD};function LD(e,t,n){const a=this;let s,o,l;return c;function c(V){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(V),u}function u(V){return V===33?(e.consume(V),f):V===47?(e.consume(V),D):V===63?(e.consume(V),k):fa(V)?(e.consume(V),O):n(V)}function f(V){return V===45?(e.consume(V),m):V===91?(e.consume(V),o=0,x):fa(V)?(e.consume(V),N):n(V)}function m(V){return V===45?(e.consume(V),v):n(V)}function p(V){return V===null?n(V):V===45?(e.consume(V),y):ot(V)?(l=p,G(V)):(e.consume(V),p)}function y(V){return V===45?(e.consume(V),v):p(V)}function v(V){return V===62?P(V):V===45?y(V):p(V)}function x(V){const re="CDATA[";return V===re.charCodeAt(o++)?(e.consume(V),o===re.length?b:x):n(V)}function b(V){return V===null?n(V):V===93?(e.consume(V),w):ot(V)?(l=b,G(V)):(e.consume(V),b)}function w(V){return V===93?(e.consume(V),C):b(V)}function C(V){return V===62?P(V):V===93?(e.consume(V),C):b(V)}function N(V){return V===null||V===62?P(V):ot(V)?(l=N,G(V)):(e.consume(V),N)}function k(V){return V===null?n(V):V===63?(e.consume(V),M):ot(V)?(l=k,G(V)):(e.consume(V),k)}function M(V){return V===62?P(V):k(V)}function D(V){return fa(V)?(e.consume(V),j):n(V)}function j(V){return V===45||ta(V)?(e.consume(V),j):A(V)}function A(V){return ot(V)?(l=A,G(V)):Ct(V)?(e.consume(V),A):P(V)}function O(V){return V===45||ta(V)?(e.consume(V),O):V===47||V===62||Xt(V)?R(V):n(V)}function R(V){return V===47?(e.consume(V),P):V===58||V===95||fa(V)?(e.consume(V),E):ot(V)?(l=R,G(V)):Ct(V)?(e.consume(V),R):P(V)}function E(V){return V===45||V===46||V===58||V===95||ta(V)?(e.consume(V),E):I(V)}function I(V){return V===61?(e.consume(V),L):ot(V)?(l=I,G(V)):Ct(V)?(e.consume(V),I):R(V)}function L(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(e.consume(V),s=V,H):ot(V)?(l=L,G(V)):Ct(V)?(e.consume(V),L):(e.consume(V),U)}function H(V){return V===s?(e.consume(V),s=void 0,$):V===null?n(V):ot(V)?(l=H,G(V)):(e.consume(V),H)}function U(V){return V===null||V===34||V===39||V===60||V===61||V===96?n(V):V===47||V===62||Xt(V)?R(V):(e.consume(V),U)}function $(V){return V===47||V===62||Xt(V)?R(V):n(V)}function P(V){return V===62?(e.consume(V),e.exit("htmlTextData"),e.exit("htmlText"),t):n(V)}function G(V){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),K}function K(V){return Ct(V)?Rt(e,se,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):se(V)}function se(V){return e.enter("htmlTextData"),l(V)}}const Hv={name:"labelEnd",resolveAll:BD,resolveTo:UD,tokenize:FD},OD={tokenize:$D},ID={tokenize:PD},zD={tokenize:HD};function BD(e){let t=-1;const n=[];for(;++t<e.length;){const a=e[t][1];if(n.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const s=a.type==="labelImage"?4:2;a.type="data",t+=s}}return e.length!==n.length&&Xa(e,0,e.length,n),e}function UD(e,t){let n=e.length,a=0,s,o,l,c;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(l=n);const u={type:e[o][1].type==="labelLink"?"link":"image",start:F({},e[o][1].start),end:F({},e[e.length-1][1].end)},f={type:"label",start:F({},e[o][1].start),end:F({},e[l][1].end)},m={type:"labelText",start:F({},e[o+a+2][1].end),end:F({},e[l-2][1].start)};return c=[["enter",u,t],["enter",f,t]],c=pi(c,e.slice(o+1,o+a+3)),c=pi(c,[["enter",m,t]]),c=pi(c,Ah(t.parser.constructs.insideSpan.null,e.slice(o+a+4,l-3),t)),c=pi(c,[["exit",m,t],e[l-2],e[l-1],["exit",f,t]]),c=pi(c,e.slice(l+1)),c=pi(c,[["exit",u,t]]),Xa(e,o,e.length,c),e}function FD(e,t,n){const a=this;let s=a.events.length,o,l;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){o=a.events[s][1];break}return c;function c(y){return o?o._inactive?p(y):(l=a.parser.defined.includes(Ai(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),u):n(y)}function u(y){return y===40?e.attempt(OD,m,l?m:p)(y):y===91?e.attempt(ID,m,l?f:p)(y):l?m(y):p(y)}function f(y){return e.attempt(zD,m,p)(y)}function m(y){return t(y)}function p(y){return o._balanced=!0,n(y)}}function $D(e,t,n){return a;function a(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return Xt(p)?Mu(e,o)(p):o(p)}function o(p){return p===41?m(p):dC(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function l(p){return Xt(p)?Mu(e,u)(p):m(p)}function c(p){return n(p)}function u(p){return p===34||p===39||p===40?hC(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):m(p)}function f(p){return Xt(p)?Mu(e,m)(p):m(p)}function m(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function PD(e,t,n){const a=this;return s;function s(c){return fC.call(a,e,o,l,"reference","referenceMarker","referenceString")(c)}function o(c){return a.parser.defined.includes(Ai(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function HD(e,t,n){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const qD={name:"labelStartImage",resolveAll:Hv.resolveAll,tokenize:VD};function VD(e,t,n){const a=this;return s;function s(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),o}function o(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const GD={name:"labelStartLink",resolveAll:Hv.resolveAll,tokenize:YD};function YD(e,t,n){const a=this;return s;function s(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),o}function o(l){return l===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(l):t(l)}}const vg={name:"lineEnding",tokenize:XD};function XD(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Rt(e,t,"linePrefix")}}const Kf={name:"thematicBreak",tokenize:KD};function KD(e,t,n){let a=0,s;return o;function o(f){return e.enter("thematicBreak"),l(f)}function l(f){return s=f,c(f)}function c(f){return f===s?(e.enter("thematicBreakSequence"),u(f)):a>=3&&(f===null||ot(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===s?(e.consume(f),a++,u):(e.exit("thematicBreakSequence"),Ct(f)?Rt(e,c,"whitespace")(f):c(f))}}const _a={continuation:{tokenize:WD},exit:tL,name:"list",tokenize:JD},QD={partial:!0,tokenize:nL},ZD={partial:!0,tokenize:eL};function JD(e,t,n){const a=this,s=a.events[a.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return c;function c(v){const x=a.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!a.containerState.marker||v===a.containerState.marker:Cy(v)){if(a.containerState.type||(a.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),v===42||v===45?e.check(Kf,n,f)(v):f(v);if(!a.interrupt||v===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(v)}return n(v)}function u(v){return Cy(v)&&++l<10?(e.consume(v),u):(!a.interrupt||l<2)&&(a.containerState.marker?v===a.containerState.marker:v===41||v===46)?(e.exit("listItemValue"),f(v)):n(v)}function f(v){return e.enter("listItemMarker"),e.consume(v),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||v,e.check(Zu,a.interrupt?n:m,e.attempt(QD,y,p))}function m(v){return a.containerState.initialBlankLine=!0,o++,y(v)}function p(v){return Ct(v)?(e.enter("listItemPrefixWhitespace"),e.consume(v),e.exit("listItemPrefixWhitespace"),y):n(v)}function y(v){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(v)}}function WD(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Zu,s,o);function s(c){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,Rt(e,t,"listItemIndent",a.containerState.size+1)(c)}function o(c){return a.containerState.furtherBlankLines||!Ct(c)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,l(c)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(ZD,t,l)(c))}function l(c){return a.containerState._closeFlow=!0,a.interrupt=void 0,Rt(e,e.attempt(_a,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function eL(e,t,n){const a=this;return Rt(e,s,"listItemIndent",a.containerState.size+1);function s(o){const l=a.events[a.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===a.containerState.size?t(o):n(o)}}function tL(e){e.exit(this.containerState.type)}function nL(e,t,n){const a=this;return Rt(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const l=a.events[a.events.length-1];return!Ct(o)&&l&&l[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const H_={name:"setextUnderline",resolveTo:aL,tokenize:iL};function aL(e,t){let n=e.length,a,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const l={type:"setextHeading",start:F({},e[a][1].start),end:F({},e[e.length-1][1].end)};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",l,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end=F({},e[o][1].end)):e[a][1]=l,e.push(["exit",l,t]),e}function iL(e,t,n){const a=this;let s;return o;function o(f){let m=a.events.length,p;for(;m--;)if(a.events[m][1].type!=="lineEnding"&&a.events[m][1].type!=="linePrefix"&&a.events[m][1].type!=="content"){p=a.events[m][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(e.enter("setextHeadingLine"),s=f,l(f)):n(f)}function l(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===s?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),Ct(f)?Rt(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||ot(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const sL={tokenize:rL};function rL(e){const t=this,n=e.attempt(Zu,a,e.attempt(this.parser.constructs.flowInitial,s,Rt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(dD,s)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const oL={resolveAll:mC()},lL=pC("string"),cL=pC("text");function pC(e){return{resolveAll:mC(e==="text"?uL:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],o=n.attempt(s,l,c);return l;function l(m){return f(m)?o(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),u}function u(m){return f(m)?(n.exit("data"),o(m)):(n.consume(m),u)}function f(m){if(m===null)return!0;const p=s[m];let y=-1;if(p)for(;++y<p.length;){const v=p[y];if(!v.previous||v.previous.call(a,a.previous))return!0}return!1}}}function mC(e){return t;function t(n,a){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,a):n}}function uL(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let o=s.length,l=-1,c=0,u;for(;o--;){const f=s[o];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(f===-2)u=!0,c++;else if(f!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const f={type:n===e.length||u||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?l:a.start._bufferIndex+l,_index:a.start._index+o,line:a.end.line,column:a.end.column-c,offset:a.end.offset-c},end:F({},a.end)};a.end=F({},f.start),a.start.offset===a.end.offset?Object.assign(a,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const dL={42:_a,43:_a,45:_a,48:_a,49:_a,50:_a,51:_a,52:_a,53:_a,54:_a,55:_a,56:_a,57:_a,62:oC},fL={91:gD},hL={[-2]:yg,[-1]:yg,32:yg},pL={35:wD,42:Kf,45:[H_,Kf],60:kD,61:H_,95:Kf,96:$_,126:$_},mL={38:cC,92:lC},gL={[-5]:vg,[-4]:vg,[-3]:vg,33:qD,38:cC,42:Ny,60:[GA,DD],91:GD,92:[bD,lC],93:Hv,95:Ny,96:sD},yL={null:[Ny,oL]},vL={null:[42,95]},xL={null:[]},bL=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vL,contentInitial:fL,disable:xL,document:dL,flow:pL,flowInitial:hL,insideSpan:yL,string:mL,text:gL},Symbol.toStringTag,{value:"Module"}));function _L(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},o=[];let l=[],c=[];const u={attempt:A(D),check:A(j),consume:N,enter:k,exit:M,interrupt:A(j,{interrupt:!0})},f={code:null,containerState:{},defineSkip:b,events:[],now:x,parser:e,previous:null,sliceSerialize:y,sliceStream:v,write:p};let m=t.tokenize.call(f,u);return t.resolveAll&&o.push(t),f;function p(I){return l=pi(l,I),w(),l[l.length-1]!==null?[]:(O(t,0),f.events=Ah(o,f.events,f),f.events)}function y(I,L){return SL(v(I),L)}function v(I){return wL(l,I)}function x(){const{_bufferIndex:I,_index:L,line:H,column:U,offset:$}=a;return{_bufferIndex:I,_index:L,line:H,column:U,offset:$}}function b(I){s[I.line]=I.column,E()}function w(){let I;for(;a._index<l.length;){const L=l[a._index];if(typeof L=="string")for(I=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===I&&a._bufferIndex<L.length;)C(L.charCodeAt(a._bufferIndex));else C(L)}}function C(I){m=m(I)}function N(I){ot(I)?(a.line++,a.column=1,a.offset+=I===-3?2:1,E()):I!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===l[a._index].length&&(a._bufferIndex=-1,a._index++)),f.previous=I}function k(I,L){const H=L||{};return H.type=I,H.start=x(),f.events.push(["enter",H,f]),c.push(H),H}function M(I){const L=c.pop();return L.end=x(),f.events.push(["exit",L,f]),L}function D(I,L){O(I,L.from)}function j(I,L){L.restore()}function A(I,L){return H;function H(U,$,P){let G,K,se,V;return Array.isArray(U)?fe(U):"tokenize"in U?fe([U]):re(U);function re(J){return le;function le(be){const je=be!==null&&J[be],De=be!==null&&J.null,Ae=[...Array.isArray(je)?je:je?[je]:[],...Array.isArray(De)?De:De?[De]:[]];return fe(Ae)(be)}}function fe(J){return G=J,K=0,J.length===0?P:B(J[K])}function B(J){return le;function le(be){return V=R(),se=J,J.partial||(f.currentConstruct=J),J.name&&f.parser.constructs.disable.null.includes(J.name)?ae():J.tokenize.call(L?Object.assign(Object.create(f),L):f,u,W,ae)(be)}}function W(J){return I(se,V),$}function ae(J){return V.restore(),++K<G.length?B(G[K]):P}}}function O(I,L){I.resolveAll&&!o.includes(I)&&o.push(I),I.resolve&&Xa(f.events,L,f.events.length-L,I.resolve(f.events.slice(L),f)),I.resolveTo&&(f.events=I.resolveTo(f.events,f))}function R(){const I=x(),L=f.previous,H=f.currentConstruct,U=f.events.length,$=Array.from(c);return{from:U,restore:P};function P(){a=I,f.previous=L,f.currentConstruct=H,f.events.length=U,c=$,E()}}function E(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function wL(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let l;if(n===s)l=[e[n].slice(a,o)];else{if(l=e.slice(n,s),a>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(a):l.shift()}o>0&&l.push(e[s].slice(0,o))}return l}function SL(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const o=e[n];let l;if(typeof o=="string")l=o;else switch(o){case-5:{l="\r";break}case-4:{l=`
|
|
51
|
+
`;break}case-3:{l=`\r
|
|
52
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&s)continue;l=" ";break}default:l=String.fromCharCode(o)}s=o===-2,a.push(l)}return a.join("")}function CL(e){const t={constructs:sC([bL,...(e||{}).extensions||[]]),content:n(UA),defined:[],document:n($A),flow:n(sL),lazy:{},string:n(lL),text:n(cL)};return t;function n(a){return s;function s(o){return _L(t,a,o)}}}function NL(e){for(;!uC(e););return e}const q_=/[\0\t\n\r]/g;function kL(){let e=1,t="",n=!0,a;return s;function s(o,l,c){const u=[];let f,m,p,y,v;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(l||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(q_.lastIndex=p,f=q_.exec(o),y=f&&f.index!==void 0?f.index:o.length,v=o.charCodeAt(y),!f){t=o.slice(p);break}if(v===10&&p===y&&a)u.push(-3),a=void 0;else switch(a&&(u.push(-5),a=void 0),p<y&&(u.push(o.slice(p,y)),e+=y-p),v){case 0:{u.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,u.push(-2);e++<m;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:a=!0,e=1}p=y+1}return c&&(a&&u.push(-5),t&&u.push(t),u.push(null)),u}}const ML=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jL(e){return e.replace(ML,EL)}function EL(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),s=a===120||a===88;return rC(n.slice(s?2:1),s?16:10)}return Pv(n)||e}const gC={}.hasOwnProperty;function RL(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),TL(n)(NL(CL(n).document().write(kL()(e,t,!0))))}function TL(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(X),autolinkProtocol:R,autolinkEmail:R,atxHeading:o(Q),blockQuote:o(De),characterEscape:R,characterReference:R,codeFenced:o(Ae),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:o(Ae,l),codeText:o(Xe,l),codeTextData:R,data:R,codeFlowValue:R,definition:o(Fe),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:o(me),hardBreakEscape:o(ue),hardBreakTrailing:o(ue),htmlFlow:o(xe,l),htmlFlowData:R,htmlText:o(xe,l),htmlTextData:R,image:o(ze),label:l,link:o(X),listItem:o(we),listItemValue:y,listOrdered:o(ke,p),listUnordered:o(ke),paragraph:o($e),reference:B,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:o(Q),strong:o(tt),thematicBreak:o(dt)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:je,autolinkProtocol:be,blockQuote:u(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:J,characterReference:le,codeFenced:u(w),codeFencedFence:b,codeFencedFenceInfo:v,codeFencedFenceMeta:x,codeFlowValue:E,codeIndented:u(C),codeText:u($),codeTextData:E,data:E,definition:u(),definitionDestinationString:M,definitionLabelString:N,definitionTitleString:k,emphasis:u(),hardBreakEscape:u(L),hardBreakTrailing:u(L),htmlFlow:u(H),htmlFlowData:E,htmlText:u(U),htmlTextData:E,image:u(G),label:se,labelText:K,lineEnding:I,link:u(P),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:W,resourceDestinationString:V,resourceTitleString:re,resource:fe,setextHeading:u(O),setextHeadingLineSequence:A,setextHeadingText:j,strong:u(),thematicBreak:u()}};yC(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(ye){let Se={type:"root",children:[]};const Be={stack:[Se],tokenStack:[],config:t,enter:c,exit:f,buffer:l,resume:m,data:n},at=[];let Pe=-1;for(;++Pe<ye.length;)if(ye[Pe][1].type==="listOrdered"||ye[Pe][1].type==="listUnordered")if(ye[Pe][0]==="enter")at.push(Pe);else{const gt=at.pop();Pe=s(ye,gt,Pe)}for(Pe=-1;++Pe<ye.length;){const gt=t[ye[Pe][0]];gC.call(gt,ye[Pe][1].type)&>[ye[Pe][1].type].call(Object.assign({sliceSerialize:ye[Pe][2].sliceSerialize},Be),ye[Pe][1])}if(Be.tokenStack.length>0){const gt=Be.tokenStack[Be.tokenStack.length-1];(gt[1]||V_).call(Be,void 0,gt[0])}for(Se.position={start:hr(ye.length>0?ye[0][1].start:{line:1,column:1,offset:0}),end:hr(ye.length>0?ye[ye.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)Se=t.transforms[Pe](Se)||Se;return Se}function s(ye,Se,Be){let at=Se-1,Pe=-1,gt=!1,ct,Et,qe,vt;for(;++at<=Be;){const ht=ye[at];switch(ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ht[0]==="enter"?Pe++:Pe--,vt=void 0;break}case"lineEndingBlank":{ht[0]==="enter"&&(ct&&!vt&&!Pe&&!qe&&(qe=at),vt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:vt=void 0}if(!Pe&&ht[0]==="enter"&&ht[1].type==="listItemPrefix"||Pe===-1&&ht[0]==="exit"&&(ht[1].type==="listUnordered"||ht[1].type==="listOrdered")){if(ct){let Vt=at;for(Et=void 0;Vt--;){const Zt=ye[Vt];if(Zt[1].type==="lineEnding"||Zt[1].type==="lineEndingBlank"){if(Zt[0]==="exit")continue;Et&&(ye[Et][1].type="lineEndingBlank",gt=!0),Zt[1].type="lineEnding",Et=Vt}else if(!(Zt[1].type==="linePrefix"||Zt[1].type==="blockQuotePrefix"||Zt[1].type==="blockQuotePrefixWhitespace"||Zt[1].type==="blockQuoteMarker"||Zt[1].type==="listItemIndent"))break}qe&&(!Et||qe<Et)&&(ct._spread=!0),ct.end=Object.assign({},Et?ye[Et][1].start:ht[1].end),ye.splice(Et||at,0,["exit",ct,ht[2]]),at++,Be++}if(ht[1].type==="listItemPrefix"){const Vt={type:"listItem",_spread:!1,start:Object.assign({},ht[1].start),end:void 0};ct=Vt,ye.splice(at,0,["enter",Vt,ht[2]]),at++,Be++,qe=void 0,vt=!0}}}return ye[Se][1]._spread=gt,Be}function o(ye,Se){return Be;function Be(at){c.call(this,ye(at),at),Se&&Se.call(this,at)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(ye,Se,Be){this.stack[this.stack.length-1].children.push(ye),this.stack.push(ye),this.tokenStack.push([Se,Be||void 0]),ye.position={start:hr(Se.start),end:void 0}}function u(ye){return Se;function Se(Be){ye&&ye.call(this,Be),f.call(this,Be)}}function f(ye,Se){const Be=this.stack.pop(),at=this.tokenStack.pop();if(at)at[0].type!==ye.type&&(Se?Se.call(this,ye,at[0]):(at[1]||V_).call(this,ye,at[0]));else throw new Error("Cannot close `"+ye.type+"` ("+ku({start:ye.start,end:ye.end})+"): it’s not open");Be.position.end=hr(ye.end)}function m(){return $v(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function y(ye){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(ye),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=ye}function x(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=ye}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ye.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ye.replace(/(\r?\n|\r)$/g,"")}function N(ye){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.label=Se,Be.identifier=Ai(this.sliceSerialize(ye)).toLowerCase()}function k(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ye}function M(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ye}function D(ye){const Se=this.stack[this.stack.length-1];if(!Se.depth){const Be=this.sliceSerialize(ye).length;Se.depth=Be}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function A(ye){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(ye).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function R(ye){const Se=this.stack[this.stack.length-1].children;let Be=Se[Se.length-1];(!Be||Be.type!=="text")&&(Be=Ke(),Be.position={start:hr(ye.start),end:void 0},Se.push(Be)),this.stack.push(Be)}function E(ye){const Se=this.stack.pop();Se.value+=this.sliceSerialize(ye),Se.position.end=hr(ye.end)}function I(ye){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Be=Se.children[Se.children.length-1];Be.position.end=hr(ye.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Se.type)&&(R.call(this,ye),E.call(this,ye))}function L(){this.data.atHardBreak=!0}function H(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ye}function U(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ye}function $(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ye}function P(){const ye=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ye.type+="Reference",ye.referenceType=Se,delete ye.url,delete ye.title}else delete ye.identifier,delete ye.label;this.data.referenceType=void 0}function G(){const ye=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ye.type+="Reference",ye.referenceType=Se,delete ye.url,delete ye.title}else delete ye.identifier,delete ye.label;this.data.referenceType=void 0}function K(ye){const Se=this.sliceSerialize(ye),Be=this.stack[this.stack.length-2];Be.label=jL(Se),Be.identifier=Ai(Se).toLowerCase()}function se(){const ye=this.stack[this.stack.length-1],Se=this.resume(),Be=this.stack[this.stack.length-1];if(this.data.inReference=!0,Be.type==="link"){const at=ye.children;Be.children=at}else Be.alt=Se}function V(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ye}function re(){const ye=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ye}function fe(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function W(ye){const Se=this.resume(),Be=this.stack[this.stack.length-1];Be.label=Se,Be.identifier=Ai(this.sliceSerialize(ye)).toLowerCase(),this.data.referenceType="full"}function ae(ye){this.data.characterReferenceType=ye.type}function J(ye){const Se=this.sliceSerialize(ye),Be=this.data.characterReferenceType;let at;Be?(at=rC(Se,Be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):at=Pv(Se);const Pe=this.stack[this.stack.length-1];Pe.value+=at}function le(ye){const Se=this.stack.pop();Se.position.end=hr(ye.end)}function be(ye){E.call(this,ye);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(ye)}function je(ye){E.call(this,ye);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(ye)}function De(){return{type:"blockquote",children:[]}}function Ae(){return{type:"code",lang:null,meta:null,value:""}}function Xe(){return{type:"inlineCode",value:""}}function Fe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function me(){return{type:"emphasis",children:[]}}function Q(){return{type:"heading",depth:0,children:[]}}function ue(){return{type:"break"}}function xe(){return{type:"html",value:""}}function ze(){return{type:"image",title:null,url:"",alt:null}}function X(){return{type:"link",title:null,url:"",children:[]}}function ke(ye){return{type:"list",ordered:ye.type==="listOrdered",start:null,spread:ye._spread,children:[]}}function we(ye){return{type:"listItem",spread:ye._spread,checked:null,children:[]}}function $e(){return{type:"paragraph",children:[]}}function tt(){return{type:"strong",children:[]}}function Ke(){return{type:"text",value:""}}function dt(){return{type:"thematicBreak"}}}function hr(e){return{line:e.line,column:e.column,offset:e.offset}}function yC(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?yC(e,a):AL(e,a)}}function AL(e,t){let n;for(n in t)if(gC.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function V_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ku({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ku({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ku({start:t.start,end:t.end})+") is still open")}function DL(e){const t=this;t.parser=n;function n(a){return RL(a,Z(F(F({},t.data("settings")),e),{extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]}))}}function LL(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function OL(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
53
|
+
`}]}function IL(e,t){const n=t.value?t.value+`
|
|
54
|
+
`:"",a={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(a.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function zL(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function BL(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function UL(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=fc(a.toLowerCase()),o=e.footnoteOrder.indexOf(a);let l,c=e.footnoteCounts.get(a);c===void 0?(c=0,e.footnoteOrder.push(a),l=e.footnoteOrder.length):l=o+1,c+=1,e.footnoteCounts.set(a,c);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,u);const f={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,f),e.applyData(t,f)}function FL(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $L(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function vC(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const s=e.all(t),o=s[0];o&&o.type==="text"?o.value="["+o.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=a:s.push({type:"text",value:a}),s}function PL(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return vC(e,t);const s={src:fc(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function HL(e,t){const n={src:fc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function qL(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function VL(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return vC(e,t);const s={href:fc(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function GL(e,t){const n={href:fc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function YL(e,t,n){const a=e.all(t),s=n?XL(n):xC(t),o={},l=[];if(typeof t.checked=="boolean"){const m=a[0];let p;m&&m.type==="element"&&m.tagName==="p"?p=m:(p={type:"element",tagName:"p",properties:{},children:[]},a.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let c=-1;for(;++c<a.length;){const m=a[c];(s||c!==0||m.type!=="element"||m.tagName!=="p")&&l.push({type:"text",value:`
|
|
55
|
+
`}),m.type==="element"&&m.tagName==="p"&&!s?l.push(...m.children):l.push(m)}const u=a[a.length-1];u&&(s||u.type!=="element"||u.tagName!=="p")&&l.push({type:"text",value:`
|
|
56
|
+
`});const f={type:"element",tagName:"li",properties:o,children:l};return e.patch(t,f),e.applyData(t,f)}function XL(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let a=-1;for(;!t&&++a<n.length;)t=xC(n[a])}return t}function xC(e){const t=e.spread;return t!=null?t:e.children.length>1}function KL(e,t){const n={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<a.length;){const l=a[s];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function QL(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZL(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function JL(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function WL(e,t){const n=e.all(t),a=n.shift(),s=[];if(a){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],l),s.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},c=zv(t.children[1]),u=J2(t.children[t.children.length-1]);c&&u&&(l.position={start:c,end:u}),s.push(l)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function e3(e,t,n){const a=n?n.children:void 0,s=(a?a.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const m=t.children[c],p={},y=o?o[c]:void 0;y&&(p.align=y);let v={type:"element",tagName:s,properties:p,children:[]};m&&(v.children=e.all(m),e.patch(m,v),v=e.applyData(m,v)),u.push(v)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,f),e.applyData(t,f)}function t3(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const G_=9,Y_=32;function n3(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(X_(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(X_(t.slice(s),s>0,!1)),o.join("")}function X_(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===G_||o===Y_;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===G_||o===Y_;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function a3(e,t){const n={type:"text",value:n3(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function i3(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const s3={blockquote:LL,break:OL,code:IL,delete:zL,emphasis:BL,footnoteReference:UL,heading:FL,html:$L,imageReference:PL,image:HL,inlineCode:qL,linkReference:VL,link:GL,listItem:YL,list:KL,paragraph:QL,root:ZL,strong:JL,table:WL,tableCell:t3,tableRow:e3,text:a3,thematicBreak:i3,toml:Ef,yaml:Ef,definition:Ef,footnoteDefinition:Ef};function Ef(){}const bC=-1,Dh=0,ju=1,fh=2,qv=3,Vv=4,Gv=5,Yv=6,_C=7,wC=8,{defineProperty:r3}=Object,SC=typeof self=="object"?self:globalThis,K_=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new SC[e](t)},o3=(e,t)=>{const n=(s,o)=>(e.set(o,s),s),a=s=>{if(e.has(s))return e.get(s);const[o,l]=t[s];switch(o){case Dh:case bC:return n(l,s);case ju:{const c=n([],s);for(const u of l)c.push(a(u));return c}case fh:{const c=n({},s);for(const[u,f]of l){const m=a(u),p=a(f);m==="__proto__"?r3(c,m,{value:p,configurable:!0,enumerable:!0,writable:!0}):c[m]=p}return c}case qv:return n(new Date(l),s);case Vv:{const{source:c,flags:u}=l;return n(new RegExp(c,u),s)}case Gv:{const c=n(new Map,s);for(const[u,f]of l)c.set(a(u),a(f));return c}case Yv:{const c=n(new Set,s);for(const u of l)c.add(a(u));return c}case _C:{const{name:c,message:u}=l;return n(typeof SC[c]=="function"?K_(c,u):new Error(u),s)}case wC:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:c}=new Uint8Array(l);return n(new DataView(c),l)}case"-0":return-0}return n(K_(o,l),s)};return a},Q_=e=>o3(new Map,e)(0),go="",{toString:l3}={},{keys:c3,is:u3}=Object,pu=e=>{const t=typeof e;if(t!=="object"||!e)return[Dh,t];const n=l3.call(e).slice(8,-1);switch(n){case"Array":return[ju,go];case"Object":return[fh,go];case"Date":return[qv,go];case"RegExp":return[Vv,go];case"Map":return[Gv,go];case"Set":return[Yv,go];case"DataView":return[ju,n]}return n.includes("Array")?[ju,n]:e instanceof Error?[_C,e.name||"Error"]:[fh,n]},Rf=([e,t])=>e===Dh&&(t==="function"||t==="symbol"),d3=(e,t,n,a)=>{const s=(l,c)=>{const u=a.push(l)-1;return n.set(c,u),u},o=l=>{if(n.has(l))return n.get(l);let[c,u]=pu(l);switch(c){case Dh:{let m=l;switch(u){case"bigint":c=wC,m=l.toString();break;case"number":if(!l&&u3(l,-0))return a.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);m=null;break;case"undefined":return s([bC],l)}return s([c,m],l)}case ju:{if(u){let y=l;return u==="DataView"?y=new Uint8Array(l.buffer):u==="ArrayBuffer"&&(y=new Uint8Array(l)),s([u,[...y]],l)}const m=[],p=s([c,m],l);for(const y of l)m.push(o(y));return p}case fh:{if(u)switch(u){case"BigInt":return s([u,l.toString()],l);case"Boolean":case"Number":case"String":return s([u,l.valueOf()],l)}if(t&&"toJSON"in l)return o(l.toJSON());const m=[],p=s([c,m],l);for(const y of c3(l))(e||!Rf(pu(l[y])))&&m.push([o(y),o(l[y])]);return p}case qv:return s([c,isNaN(l.getTime())?go:l.toISOString()],l);case Vv:{const{source:m,flags:p}=l;return s([c,{source:m,flags:p}],l)}case Gv:{const m=[],p=s([c,m],l);for(const[y,v]of l)(e||!(Rf(pu(y))||Rf(pu(v))))&&m.push([o(y),o(v)]);return p}case Yv:{const m=[],p=s([c,m],l);for(const y of l)(e||!Rf(pu(y)))&&m.push(o(y));return p}}const{message:f}=l;return s([c,{name:u,message:f}],l)};return o},Z_=(e,{json:t,lossy:n}={})=>{const a=[];return d3(!(t||n),!!t,new Map,a)(e),a},hh=typeof structuredClone=="function"?((e,t)=>t&&("json"in t||"lossy"in t)?Q_(Z_(e,t)):structuredClone(e)):(e,t)=>Q_(Z_(e,t));function f3(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function h3(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function p3(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||f3,a=e.options.footnoteBackLabel||h3,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let u=-1;for(;++u<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[u]);if(!f)continue;const m=e.all(f),p=String(f.identifier).toUpperCase(),y=fc(p.toLowerCase());let v=0;const x=[],b=e.footnoteCounts.get(p);for(;b!==void 0&&++v<=b;){x.length>0&&x.push({type:"text",value:" "});let N=typeof n=="string"?n:n(u,v);typeof N=="string"&&(N={type:"text",value:N}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(u,v),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const w=m[m.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const N=w.children[w.children.length-1];N&&N.type==="text"?N.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...x)}else m.push(...x);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(m,!0)};e.patch(f,C),c.push(C)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:Z(F({},hh(l)),{id:"footnote-label"}),children:[{type:"text",value:s}]},{type:"text",value:`
|
|
57
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:`
|
|
58
|
+
`}]}}const Lh=(function(e){if(e==null)return v3;if(typeof e=="function")return Oh(e);if(typeof e=="object")return Array.isArray(e)?m3(e):g3(e);if(typeof e=="string")return y3(e);throw new Error("Expected function, string, or object as test")});function m3(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Lh(e[n]);return Oh(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function g3(e){const t=e;return Oh(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function y3(e){return Oh(t);function t(n){return n&&n.type===e}}function Oh(e){return t;function t(n,a,s){return!!(x3(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function v3(){return!0}function x3(e){return e!==null&&typeof e=="object"&&"type"in e}const CC=[],b3=!0,ky=!1,_3="skip";function NC(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Lh(s),l=a?-1:1;c(e,void 0,[])();function c(u,f,m){const p=u&&typeof u=="object"?u:{};if(typeof p.type=="string"){const v=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(u.type+(v?"<"+v+">":""))+")"})}return y;function y(){let v=CC,x,b,w;if((!t||o(u,f,m[m.length-1]||void 0))&&(v=w3(n(u,m)),v[0]===ky))return v;if("children"in u&&u.children){const C=u;if(C.children&&v[0]!==_3)for(b=(a?C.children.length:-1)+l,w=m.concat(C);b>-1&&b<C.children.length;){const N=C.children[b];if(x=c(N,b,w)(),x[0]===ky)return x;b=typeof x[1]=="number"?x[1]:b+l}}return v}}}function w3(e){return Array.isArray(e)?e:typeof e=="number"?[b3,e]:e==null?CC:[e]}function Xv(e,t,n,a){let s,o,l;typeof t=="function"&&typeof n!="function"?(o=void 0,l=t,s=n):(o=t,l=n,s=a),NC(e,o,c,s);function c(u,f){const m=f[f.length-1],p=m?m.children.indexOf(u):void 0;return l(u,p,m)}}const My={}.hasOwnProperty,S3={};function C3(e,t){const n=t||S3,a=new Map,s=new Map,o=new Map,l=F(F({},s3),n.handlers),c={all:f,applyData:k3,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:l,one:u,options:n,patch:N3,wrap:j3};return Xv(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const p=m.type==="definition"?a:s,y=String(m.identifier).toUpperCase();p.has(y)||p.set(y,m)}}),c;function u(m,p){const y=m.type,v=c.handlers[y];if(My.call(c.handlers,y)&&v)return v(c,m,p);if(c.options.passThrough&&c.options.passThrough.includes(y)){if("children"in m){const x=m,{children:b}=x,w=Me(x,["children"]),C=hh(w);return C.children=c.all(m),C}return hh(m)}return(c.options.unknownHandler||M3)(c,m,p)}function f(m){const p=[];if("children"in m){const y=m.children;let v=-1;for(;++v<y.length;){const x=c.one(y[v],m);if(x){if(v&&y[v-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=J_(x.value)),!Array.isArray(x)&&x.type==="element")){const b=x.children[0];b&&b.type==="text"&&(b.value=J_(b.value))}Array.isArray(x)?p.push(...x):p.push(x)}}}return p}}function N3(e,t){e.position&&(t.position=dA(e))}function k3(e,t){let n=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,o=e.data.hProperties;if(typeof a=="string")if(n.type==="element")n.tagName=a;else{const l="children"in n?n.children:[n];n={type:"element",tagName:a,properties:{},children:l}}n.type==="element"&&o&&Object.assign(n.properties,hh(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function M3(e,t){const n=t.data||{},a="value"in t&&!(My.call(n,"hProperties")||My.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function j3(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
|
|
59
|
+
`});++a<e.length;)a&&n.push({type:"text",value:`
|
|
60
|
+
`}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
61
|
+
`}),n}function J_(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function W_(e,t){const n=C3(e,t),a=n.one(e,void 0),s=p3(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
|
|
62
|
+
`},s),o}function E3(e,t){return e&&"run"in e?function(n,a){return ut(this,null,function*(){const s=W_(n,F({file:a},t));yield e.run(s,a)})}:function(n,a){return W_(n,F({file:a},e||t))}}function ew(e){if(e)throw e}var xg,tw;function R3(){if(tw)return xg;tw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},o=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var f=e.call(u,"constructor"),m=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!f&&!m)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},l=function(u,f){n&&f.name==="__proto__"?n(u,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):u[f.name]=f.newValue},c=function(u,f){if(f==="__proto__")if(e.call(u,f)){if(a)return a(u,f).value}else return;return u[f]};return xg=function u(){var f,m,p,y,v,x,b=arguments[0],w=1,C=arguments.length,N=!1;for(typeof b=="boolean"&&(N=b,b=arguments[1]||{},w=2),(b==null||typeof b!="object"&&typeof b!="function")&&(b={});w<C;++w)if(f=arguments[w],f!=null)for(m in f)p=c(b,m),y=c(f,m),b!==y&&(N&&y&&(o(y)||(v=s(y)))?(v?(v=!1,x=p&&s(p)?p:[]):x=p&&o(p)?p:{},l(b,{name:m,newValue:u(N,x,y)})):typeof y<"u"&&l(b,{name:m,newValue:y}));return b},xg}var T3=R3();const bg=Z2(T3);function jy(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function A3(){const e=[],t={run:n,use:a};return t;function n(...s){let o=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...s);function c(u,...f){const m=e[++o];let p=-1;if(u){l(u);return}for(;++p<s.length;)(f[p]===null||f[p]===void 0)&&(f[p]=s[p]);s=f,m?D3(m,c)(...f):l(null,...f)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function D3(e,t){let n;return a;function a(...l){const c=e.length>l.length;let u;c&&l.push(s);try{u=e.apply(this,l)}catch(f){const m=f;if(c&&n)throw m;return s(m)}c||(u&&u.then&&typeof u.then=="function"?u.then(o,s):u instanceof Error?s(u):o(u))}function s(l,...c){n||(n=!0,t(l,...c))}function o(l){s(null,l)}}const Xi={basename:L3,dirname:O3,extname:I3,join:z3,sep:"/"};function L3(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ju(e);let n=0,a=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else a<0&&(o=!0,a=s+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let l=-1,c=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else l<0&&(o=!0,l=s+1),c>-1&&(e.codePointAt(s)===t.codePointAt(c--)?c<0&&(a=s):(c=-1,a=l));return n===a?a=l:a<0&&(a=e.length),e.slice(n,a)}function O3(e){if(Ju(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function I3(e){Ju(e);let t=e.length,n=-1,a=0,s=-1,o=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){a=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function z3(...e){let t=-1,n;for(;++t<e.length;)Ju(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":B3(n)}function B3(e){Ju(e);const t=e.codePointAt(0)===47;let n=U3(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function U3(e,t){let n="",a=0,s=-1,o=0,l=-1,c,u;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(s===l-1||o===1))if(s!==l-1&&o===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",a=0):(n=n.slice(0,u),a=n.length-1-n.lastIndexOf("/")),s=l,o=0;continue}}else if(n.length>0){n="",a=0,s=l,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(s+1,l):n=e.slice(s+1,l),a=l-s-1;s=l,o=0}else c===46&&o>-1?o++:o=-1}return n}function Ju(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const F3={cwd:$3};function $3(){return"/"}function Ey(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function P3(e){if(typeof e=="string")e=new URL(e);else if(!Ey(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return H3(e)}function H3(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const _g=["history","path","basename","stem","extname","dirname"];class kC{constructor(t){let n;t?Ey(t)?n={path:t}:typeof t=="string"||q3(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":F3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<_g.length;){const o=_g[a];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)_g.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Xi.basename(this.path):void 0}set basename(t){Sg(t,"basename"),wg(t,"basename"),this.path=Xi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Xi.dirname(this.path):void 0}set dirname(t){nw(this.basename,"dirname"),this.path=Xi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Xi.extname(this.path):void 0}set extname(t){if(wg(t,"extname"),nw(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Xi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ey(t)&&(t=P3(t)),Sg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Xi.basename(this.path,this.extname):void 0}set stem(t){Sg(t,"stem"),wg(t,"stem"),this.path=Xi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const s=this.message(t,n,a);throw s.fatal=!0,s}info(t,n,a){const s=this.message(t,n,a);return s.fatal=void 0,s}message(t,n,a){const s=new na(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function wg(e,t){if(e&&e.includes(Xi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Xi.sep+"`")}function Sg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function nw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function q3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const V3=(function(e){const t=this.constructor.prototype,n=t[e],a=function(){return n.apply(a,arguments)};return Object.setPrototypeOf(a,t),a}),G3={}.hasOwnProperty;class Kv extends V3{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=A3()}copy(){const t=new Kv;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(bg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(kg("data",this.frozen),this.namespace[t]=n,this):G3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(kg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Tf(t),a=this.parser||this.Parser;return Cg("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Cg("process",this.parser||this.Parser),Ng("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,l){const c=Tf(t),u=a.parse(c);a.run(u,c,function(m,p,y){if(m||!p||!y)return f(m);const v=p,x=a.stringify(v,y);K3(x)?y.value=x:y.result=x,f(m,y)});function f(m,p){m||!p?l(m):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,a;return this.freeze(),Cg("processSync",this.parser||this.Parser),Ng("processSync",this.compiler||this.Compiler),this.process(t,s),iw("processSync","process",n),a;function s(o,l){n=!0,ew(o),a=l}}run(t,n,a){aw(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?o(void 0,a):new Promise(o);function o(l,c){const u=Tf(n);s.run(t,u,f);function f(m,p,y){const v=p||t;m?c(m):l?l(v):a(void 0,v,y)}}}runSync(t,n){let a=!1,s;return this.run(t,n,o),iw("runSync","run",a),s;function o(l,c){ew(l),s=c,a=!0}}stringify(t,n){this.freeze();const a=Tf(n),s=this.compiler||this.Compiler;return Ng("stringify",s),aw(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(kg("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(f){if(typeof f=="function")u(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[m,...p]=f;u(m,p)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(f.plugins),f.settings&&(s.settings=bg(!0,s.settings,f.settings))}function c(f){let m=-1;if(f!=null)if(Array.isArray(f))for(;++m<f.length;){const p=f[m];o(p)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function u(f,m){let p=-1,y=-1;for(;++p<a.length;)if(a[p][0]===f){y=p;break}if(y===-1)a.push([f,...m]);else if(m.length>0){let[v,...x]=m;const b=a[y][1];jy(b)&&jy(v)&&(v=bg(!0,b,v)),a[y]=[f,v,...x]}}}}const Y3=new Kv().freeze();function Cg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ng(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function kg(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function aw(e){if(!jy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function iw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Tf(e){return X3(e)?e:new kC(e)}function X3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function K3(e){return typeof e=="string"||Q3(e)}function Q3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Z3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",sw=[],rw={allowDangerousHtml:!0},J3=/^(https?|ircs?|mailto|xmpp)$/i,W3=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function eO(e){const t=tO(e),n=nO(e);return aO(t.runSync(t.parse(n),n),e)}function tO(e){const t=e.rehypePlugins||sw,n=e.remarkPlugins||sw,a=e.remarkRehypeOptions?F(F({},e.remarkRehypeOptions),rw):rw;return Y3().use(DL).use(n).use(E3,a).use(t)}function nO(e){const t=e.children||"",n=new kC;return typeof t=="string"&&(n.value=t),n}function aO(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,u=t.urlTransform||iO;for(const m of W3)Object.hasOwn(t,m.from)&&""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+Z3+m.id;return Xv(e,f),gA(e,{Fragment:h.Fragment,components:s,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function f(m,p,y){if(m.type==="raw"&&y&&typeof p=="number")return l?y.children.splice(p,1):y.children[p]={type:"text",value:m.value},p;if(m.type==="element"){let v;for(v in gg)if(Object.hasOwn(gg,v)&&Object.hasOwn(m.properties,v)){const x=m.properties[v],b=gg[v];(b===null||b.includes(m.tagName))&&(m.properties[v]=u(String(x||""),v,m))}}if(m.type==="element"){let v=n?!n.includes(m.tagName):o?o.includes(m.tagName):!1;if(!v&&a&&typeof p=="number"&&(v=!a(m,p,y)),v&&y&&typeof p=="number")return c&&m.children?y.children.splice(p,1,...m.children):y.children.splice(p,1),p}}}function iO(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||a!==-1&&t>a||J3.test(e.slice(0,t))?e:""}function ow(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}function sO(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function rO(e,t,n){const a=Lh((n||{}).ignore||[]),s=oO(t);let o=-1;for(;++o<s.length;)NC(e,"text",l);function l(u,f){let m=-1,p;for(;++m<f.length;){const y=f[m],v=p?p.children:void 0;if(a(y,v?v.indexOf(y):void 0,p))return;p=y}if(p)return c(u,f)}function c(u,f){const m=f[f.length-1],p=s[o][0],y=s[o][1];let v=0;const x=m.children.indexOf(u);let b=!1,w=[];p.lastIndex=0;let C=p.exec(u.value);for(;C;){const N=C.index,k={index:C.index,input:C.input,stack:[...f,u]};let M=y(...C,k);if(typeof M=="string"&&(M=M.length>0?{type:"text",value:M}:void 0),M===!1?p.lastIndex=N+1:(v!==N&&w.push({type:"text",value:u.value.slice(v,N)}),Array.isArray(M)?w.push(...M):M&&w.push(M),v=N+C[0].length,b=!0),!p.global)break;C=p.exec(u.value)}return b?(v<u.value.length&&w.push({type:"text",value:u.value.slice(v)}),m.children.splice(x,1,...w)):w=[u],x+w.length}}function oO(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<n.length;){const s=n[a];t.push([lO(s[0]),cO(s[1])])}return t}function lO(e){return typeof e=="string"?new RegExp(sO(e),"g"):e}function cO(e){return typeof e=="function"?e:function(){return e}}const Mg="phrasing",jg=["autolink","link","image","label"];function uO(){return{transforms:[yO],enter:{literalAutolink:fO,literalAutolinkEmail:Eg,literalAutolinkHttp:Eg,literalAutolinkWww:Eg},exit:{literalAutolink:gO,literalAutolinkEmail:mO,literalAutolinkHttp:hO,literalAutolinkWww:pO}}}function dO(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Mg,notInConstruct:jg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Mg,notInConstruct:jg},{character:":",before:"[ps]",after:"\\/",inConstruct:Mg,notInConstruct:jg}]}}function fO(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Eg(e){this.config.enter.autolinkProtocol.call(this,e)}function hO(e){this.config.exit.autolinkProtocol.call(this,e)}function pO(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function mO(e){this.config.exit.autolinkEmail.call(this,e)}function gO(e){this.exit(e)}function yO(e){rO(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,vO],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),xO]],{ignore:["link","linkReference"]})}function vO(e,t,n,a,s){let o="";if(!MC(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!bO(n)))return!1;const l=_O(n+a);if(!l[0])return!1;const c={type:"link",title:null,url:o+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[c,{type:"text",value:l[1]}]:c}function xO(e,t,n,a){return!MC(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function bO(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function _O(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const s=ow(e,"(");let o=ow(e,")");for(;a!==-1&&s>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function MC(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Fo(n)||Th(n))&&(!t||n!==47)}jC.peek=RO;function wO(){this.buffer()}function SO(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function CO(){this.buffer()}function NO(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function kO(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ai(this.sliceSerialize(e)).toLowerCase(),n.label=t}function MO(e){this.exit(e)}function jO(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ai(this.sliceSerialize(e)).toLowerCase(),n.label=t}function EO(e){this.exit(e)}function RO(){return"["}function jC(e,t,n,a){const s=n.createTracker(a);let o=s.move("[^");const l=n.enter("footnoteReference"),c=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),c(),l(),o+=s.move("]"),o}function TO(){return{enter:{gfmFootnoteCallString:wO,gfmFootnoteCall:SO,gfmFootnoteDefinitionLabelString:CO,gfmFootnoteDefinition:NO},exit:{gfmFootnoteCallString:kO,gfmFootnoteCall:MO,gfmFootnoteDefinitionLabelString:jO,gfmFootnoteDefinition:EO}}}function AO(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:jC},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,o,l){const c=o.createTracker(l);let u=c.move("[^");const f=o.enter("footnoteDefinition"),m=o.enter("label");return u+=c.move(o.safe(o.associationId(a),{before:u,after:"]"})),m(),u+=c.move("]:"),a.children&&a.children.length>0&&(c.shift(4),u+=c.move((t?`
|
|
63
|
+
`:" ")+o.indentLines(o.containerFlow(a,c.current()),t?EC:DO))),f(),u}}function DO(e,t,n){return t===0?e:EC(e,t,n)}function EC(e,t,n){return(n?"":" ")+e}const LO=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];RC.peek=UO;function OO(){return{canContainEols:["delete"],enter:{strikethrough:zO},exit:{strikethrough:BO}}}function IO(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:LO}],handlers:{delete:RC}}}function zO(e){this.enter({type:"delete",children:[]},e)}function BO(e){this.exit(e)}function RC(e,t,n,a){const s=n.createTracker(a),o=n.enter("strikethrough");let l=s.move("~~");return l+=n.containerPhrasing(e,Z(F({},s.current()),{before:l,after:"~"})),l+=s.move("~~"),o(),l}function UO(){return"~"}function FO(e){return e.length}function $O(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||FO,o=[],l=[],c=[],u=[];let f=0,m=-1;for(;++m<e.length;){const b=[],w=[];let C=-1;for(e[m].length>f&&(f=e[m].length);++C<e[m].length;){const N=PO(e[m][C]);if(n.alignDelimiters!==!1){const k=s(N);w[C]=k,(u[C]===void 0||k>u[C])&&(u[C]=k)}b.push(N)}l[m]=b,c[m]=w}let p=-1;if(typeof a=="object"&&"length"in a)for(;++p<f;)o[p]=lw(a[p]);else{const b=lw(a);for(;++p<f;)o[p]=b}p=-1;const y=[],v=[];for(;++p<f;){const b=o[p];let w="",C="";b===99?(w=":",C=":"):b===108?w=":":b===114&&(C=":");let N=n.alignDelimiters===!1?1:Math.max(1,u[p]-w.length-C.length);const k=w+"-".repeat(N)+C;n.alignDelimiters!==!1&&(N=w.length+N+C.length,N>u[p]&&(u[p]=N),v[p]=N),y[p]=k}l.splice(1,0,y),c.splice(1,0,v),m=-1;const x=[];for(;++m<l.length;){const b=l[m],w=c[m];p=-1;const C=[];for(;++p<f;){const N=b[p]||"";let k="",M="";if(n.alignDelimiters!==!1){const D=u[p]-(w[p]||0),j=o[p];j===114?k=" ".repeat(D):j===99?D%2?(k=" ".repeat(D/2+.5),M=" ".repeat(D/2-.5)):(k=" ".repeat(D/2),M=k):M=" ".repeat(D)}n.delimiterStart!==!1&&!p&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||p)&&C.push(" "),n.alignDelimiters!==!1&&C.push(k),C.push(N),n.alignDelimiters!==!1&&C.push(M),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||p!==f-1)&&C.push("|")}x.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return x.join(`
|
|
64
|
+
`)}function PO(e){return e==null?"":String(e)}function lw(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function HO(e,t,n,a){const s=n.enter("blockquote"),o=n.createTracker(a);o.move("> "),o.shift(2);const l=n.indentLines(n.containerFlow(e,o.current()),qO);return s(),l}function qO(e,t,n){return">"+(n?"":" ")+e}function VO(e,t){return cw(e,t.inConstruct,!0)&&!cw(e,t.notInConstruct,!1)}function cw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function uw(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
65
|
+
`&&VO(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
66
|
+
`}function GO(e,t){const n=String(e);let a=n.indexOf(t),s=a,o=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++o>l&&(l=o):o=1,s=a+t.length,a=n.indexOf(t,s);return l}function YO(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function XO(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function KO(e,t,n,a){const s=XO(n),o=e.value||"",l=s==="`"?"GraveAccent":"Tilde";if(YO(e,n)){const p=n.enter("codeIndented"),y=n.indentLines(o,QO);return p(),y}const c=n.createTracker(a),u=s.repeat(Math.max(GO(o,s)+1,3)),f=n.enter("codeFenced");let m=c.move(u);if(e.lang){const p=n.enter(`codeFencedLang${l}`);m+=c.move(n.safe(e.lang,F({before:m,after:" ",encode:["`"]},c.current()))),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${l}`);m+=c.move(" "),m+=c.move(n.safe(e.meta,F({before:m,after:`
|
|
67
|
+
`,encode:["`"]},c.current()))),p()}return m+=c.move(`
|
|
68
|
+
`),o&&(m+=c.move(o+`
|
|
69
|
+
`)),m+=c.move(u),f(),m}function QO(e,t,n){return(n?"":" ")+e}function Qv(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ZO(e,t,n,a){const s=Qv(n),o=s==='"'?"Quote":"Apostrophe",l=n.enter("definition");let c=n.enter("label");const u=n.createTracker(a);let f=u.move("[");return f+=u.move(n.safe(n.associationId(e),F({before:f,after:"]"},u.current()))),f+=u.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,F({before:f,after:">"},u.current()))),f+=u.move(">")):(c=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,F({before:f,after:e.title?" ":`
|
|
70
|
+
`},u.current())))),c(),e.title&&(c=n.enter(`title${o}`),f+=u.move(" "+s),f+=u.move(n.safe(e.title,F({before:f,after:s},u.current()))),f+=u.move(s),c()),l(),f}function JO(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function zu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ph(e,t,n){const a=ic(e),s=ic(t);return a===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}TC.peek=WO;function TC(e,t,n,a){const s=JO(n),o=n.enter("emphasis"),l=n.createTracker(a),c=l.move(s);let u=l.move(n.containerPhrasing(e,F({after:s,before:c},l.current())));const f=u.charCodeAt(0),m=ph(a.before.charCodeAt(a.before.length-1),f,s);m.inside&&(u=zu(f)+u.slice(1));const p=u.charCodeAt(u.length-1),y=ph(a.after.charCodeAt(0),p,s);y.inside&&(u=u.slice(0,-1)+zu(p));const v=l.move(s);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},c+u+v}function WO(e,t,n){return n.options.emphasis||"*"}function e4(e,t){let n=!1;return Xv(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,ky}),!!((!e.depth||e.depth<3)&&$v(e)&&(t.options.setext||n))}function t4(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(e4(e,n)){const m=n.enter("headingSetext"),p=n.enter("phrasing"),y=n.containerPhrasing(e,Z(F({},o.current()),{before:`
|
|
71
|
+
`,after:`
|
|
72
|
+
`}));return p(),m(),y+`
|
|
73
|
+
`+(s===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
|
|
74
|
+
`))+1))}const l="#".repeat(s),c=n.enter("headingAtx"),u=n.enter("phrasing");o.move(l+" ");let f=n.containerPhrasing(e,F({before:"# ",after:`
|
|
75
|
+
`},o.current()));return/^[\t ]/.test(f)&&(f=zu(f.charCodeAt(0))+f.slice(1)),f=f?l+" "+f:l,n.options.closeAtx&&(f+=" "+l),u(),c(),f}AC.peek=n4;function AC(e){return e.value||""}function n4(){return"<"}DC.peek=a4;function DC(e,t,n,a){const s=Qv(n),o=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let c=n.enter("label");const u=n.createTracker(a);let f=u.move("![");return f+=u.move(n.safe(e.alt,F({before:f,after:"]"},u.current()))),f+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(n.safe(e.url,F({before:f,after:">"},u.current()))),f+=u.move(">")):(c=n.enter("destinationRaw"),f+=u.move(n.safe(e.url,F({before:f,after:e.title?" ":")"},u.current())))),c(),e.title&&(c=n.enter(`title${o}`),f+=u.move(" "+s),f+=u.move(n.safe(e.title,F({before:f,after:s},u.current()))),f+=u.move(s),c()),f+=u.move(")"),l(),f}function a4(){return"!"}LC.peek=i4;function LC(e,t,n,a){const s=e.referenceType,o=n.enter("imageReference");let l=n.enter("label");const c=n.createTracker(a);let u=c.move("![");const f=n.safe(e.alt,F({before:u,after:"]"},c.current()));u+=c.move(f+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),F({before:u,after:"]"},c.current()));return l(),n.stack=m,o(),s==="full"||!f||f!==p?u+=c.move(p+"]"):s==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function i4(){return"!"}OC.peek=s4;function OC(e,t,n){let a=e.value||"",s="`",o=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o<n.unsafe.length;){const l=n.unsafe[o],c=n.compilePattern(l);let u;if(l.atBreak)for(;u=c.exec(a);){let f=u.index;a.charCodeAt(f)===10&&a.charCodeAt(f-1)===13&&f--,a=a.slice(0,f)+" "+a.slice(u.index+1)}}return s+a+s}function s4(){return"`"}function IC(e,t){const n=$v(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}zC.peek=r4;function zC(e,t,n,a){const s=Qv(n),o=s==='"'?"Quote":"Apostrophe",l=n.createTracker(a);let c,u;if(IC(e,n)){const m=n.stack;n.stack=[],c=n.enter("autolink");let p=l.move("<");return p+=l.move(n.containerPhrasing(e,F({before:p,after:">"},l.current()))),p+=l.move(">"),c(),n.stack=m,p}c=n.enter("link"),u=n.enter("label");let f=l.move("[");return f+=l.move(n.containerPhrasing(e,F({before:f,after:"]("},l.current()))),f+=l.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),f+=l.move("<"),f+=l.move(n.safe(e.url,F({before:f,after:">"},l.current()))),f+=l.move(">")):(u=n.enter("destinationRaw"),f+=l.move(n.safe(e.url,F({before:f,after:e.title?" ":")"},l.current())))),u(),e.title&&(u=n.enter(`title${o}`),f+=l.move(" "+s),f+=l.move(n.safe(e.title,F({before:f,after:s},l.current()))),f+=l.move(s),u()),f+=l.move(")"),c(),f}function r4(e,t,n){return IC(e,n)?"<":"["}BC.peek=o4;function BC(e,t,n,a){const s=e.referenceType,o=n.enter("linkReference");let l=n.enter("label");const c=n.createTracker(a);let u=c.move("[");const f=n.containerPhrasing(e,F({before:u,after:"]"},c.current()));u+=c.move(f+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const p=n.safe(n.associationId(e),F({before:u,after:"]"},c.current()));return l(),n.stack=m,o(),s==="full"||!f||f!==p?u+=c.move(p+"]"):s==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function o4(){return"["}function Zv(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function l4(e){const t=Zv(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function c4(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function UC(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function u4(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let l=e.ordered?c4(n):Zv(n);const c=e.ordered?l==="."?")":".":l4(n);let u=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(u=!0),UC(n)===l&&m){let p=-1;for(;++p<e.children.length;){const y=e.children[p];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(l=c),n.bulletCurrent=l;const f=n.containerFlow(e,a);return n.bulletLastUsed=l,n.bulletCurrent=o,s(),f}function d4(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function f4(e,t,n,a){const s=d4(n);let o=n.bulletCurrent||Zv(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let l=o.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const c=n.createTracker(a);c.move(o+" ".repeat(l-o.length)),c.shift(l);const u=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,c.current()),m);return u(),f;function m(p,y,v){return y?(v?"":" ".repeat(l))+p:(v?o:o+" ".repeat(l-o.length))+p}}function h4(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),l=n.containerPhrasing(e,a);return o(),s(),l}const p4=Lh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function m4(e,t,n,a){return(e.children.some(function(s){return p4(s)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function g4(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}FC.peek=y4;function FC(e,t,n,a){const s=g4(n),o=n.enter("strong"),l=n.createTracker(a),c=l.move(s+s);let u=l.move(n.containerPhrasing(e,F({after:s,before:c},l.current())));const f=u.charCodeAt(0),m=ph(a.before.charCodeAt(a.before.length-1),f,s);m.inside&&(u=zu(f)+u.slice(1));const p=u.charCodeAt(u.length-1),y=ph(a.after.charCodeAt(0),p,s);y.inside&&(u=u.slice(0,-1)+zu(p));const v=l.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:y.outside,before:m.outside},c+u+v}function y4(e,t,n){return n.options.strong||"*"}function v4(e,t,n,a){return n.safe(e.value,a)}function x4(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function b4(e,t,n){const a=(UC(n)+(n.options.ruleSpaces?" ":"")).repeat(x4(n));return n.options.ruleSpaces?a.slice(0,-1):a}const $C={blockquote:HO,break:uw,code:KO,definition:ZO,emphasis:TC,hardBreak:uw,heading:t4,html:AC,image:DC,imageReference:LC,inlineCode:OC,link:zC,linkReference:BC,list:u4,listItem:f4,paragraph:h4,root:m4,strong:FC,text:v4,thematicBreak:b4};function _4(){return{enter:{table:w4,tableData:dw,tableHeader:dw,tableRow:C4},exit:{codeText:N4,table:S4,tableData:Rg,tableHeader:Rg,tableRow:Rg}}}function w4(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function S4(e){this.exit(e),this.data.inTable=void 0}function C4(e){this.enter({type:"tableRow",children:[]},e)}function Rg(e){this.exit(e)}function dw(e){this.enter({type:"tableCell",children:[]},e)}function N4(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,k4));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function k4(e,t){return t==="|"?t:e}function M4(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
76
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:l,tableCell:u,tableRow:c}};function l(v,x,b,w){return f(m(v,b,w),v.align)}function c(v,x,b,w){const C=p(v,b,w),N=f([C]);return N.slice(0,N.indexOf(`
|
|
77
|
+
`))}function u(v,x,b,w){const C=b.enter("tableCell"),N=b.enter("phrasing"),k=b.containerPhrasing(v,Z(F({},w),{before:o,after:o}));return N(),C(),k}function f(v,x){return $O(v,{align:x,alignDelimiters:a,padding:n,stringLength:s})}function m(v,x,b){const w=v.children;let C=-1;const N=[],k=x.enter("table");for(;++C<w.length;)N[C]=p(w[C],x,b);return k(),N}function p(v,x,b){const w=v.children;let C=-1;const N=[],k=x.enter("tableRow");for(;++C<w.length;)N[C]=u(w[C],v,x,b);return k(),N}function y(v,x,b){let w=$C.inlineCode(v,x,b);return b.stack.includes("tableCell")&&(w=w.replace(/\|/g,"\\$&")),w}}function j4(){return{exit:{taskListCheckValueChecked:fw,taskListCheckValueUnchecked:fw,paragraph:R4}}}function E4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:T4}}}function fw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function R4(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const s=t.children;let o=-1,l;for(;++o<s.length;){const c=s[o];if(c.type==="paragraph"){l=c;break}}l===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function T4(e,t,n,a){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",c=n.createTracker(a);o&&c.move(l);let u=$C.listItem(e,t,n,F(F({},a),c.current()));return o&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),u;function f(m){return m+l}}function A4(){return[uO(),TO(),OO(),_4(),j4()]}function D4(e){return{extensions:[dO(),AO(e),IO(),M4(e),E4()]}}const L4={tokenize:F4,partial:!0},PC={tokenize:$4,partial:!0},HC={tokenize:P4,partial:!0},qC={tokenize:H4,partial:!0},O4={tokenize:q4,partial:!0},VC={name:"wwwAutolink",tokenize:B4,previous:YC},GC={name:"protocolAutolink",tokenize:U4,previous:XC},Ds={name:"emailAutolink",tokenize:z4,previous:KC},ns={};function I4(){return{text:ns}}let po=48;for(;po<123;)ns[po]=Ds,po++,po===58?po=65:po===91&&(po=97);ns[43]=Ds;ns[45]=Ds;ns[46]=Ds;ns[95]=Ds;ns[72]=[Ds,GC];ns[104]=[Ds,GC];ns[87]=[Ds,VC];ns[119]=[Ds,VC];function z4(e,t,n){const a=this;let s,o;return l;function l(p){return!Ry(p)||!KC.call(a,a.previous)||Jv(a.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(p))}function c(p){return Ry(p)?(e.consume(p),c):p===64?(e.consume(p),u):n(p)}function u(p){return p===46?e.check(O4,m,f)(p):p===45||p===95||ta(p)?(o=!0,e.consume(p),u):m(p)}function f(p){return e.consume(p),s=!0,u}function m(p){return o&&s&&fa(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function B4(e,t,n){const a=this;return s;function s(l){return l!==87&&l!==119||!YC.call(a,a.previous)||Jv(a.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(L4,e.attempt(PC,e.attempt(HC,o),n),n)(l))}function o(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function U4(e,t,n){const a=this;let s="",o=!1;return l;function l(p){return(p===72||p===104)&&XC.call(a,a.previous)&&!Jv(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),c):n(p)}function c(p){if(fa(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),c;if(p===58){const y=s.toLowerCase();if(y==="http"||y==="https")return e.consume(p),u}return n(p)}function u(p){return p===47?(e.consume(p),o?f:(o=!0,u)):n(p)}function f(p){return p===null||dh(p)||Xt(p)||Fo(p)||Th(p)?n(p):e.attempt(PC,e.attempt(HC,m),n)(p)}function m(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function F4(e,t,n){let a=0;return s;function s(l){return(l===87||l===119)&&a<3?(a++,e.consume(l),s):l===46&&a===3?(e.consume(l),o):n(l)}function o(l){return l===null?n(l):t(l)}}function $4(e,t,n){let a,s,o;return l;function l(f){return f===46||f===95?e.check(qC,u,c)(f):f===null||Xt(f)||Fo(f)||f!==45&&Th(f)?u(f):(o=!0,e.consume(f),l)}function c(f){return f===95?a=!0:(s=a,a=void 0),e.consume(f),l}function u(f){return s||a||!o?n(f):t(f)}}function P4(e,t){let n=0,a=0;return s;function s(l){return l===40?(n++,e.consume(l),s):l===41&&a<n?o(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(qC,t,o)(l):l===null||Xt(l)||Fo(l)?t(l):(e.consume(l),s)}function o(l){return l===41&&a++,e.consume(l),s}}function H4(e,t,n){return a;function a(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),a):c===38?(e.consume(c),o):c===93?(e.consume(c),s):c===60||c===null||Xt(c)||Fo(c)?t(c):n(c)}function s(c){return c===null||c===40||c===91||Xt(c)||Fo(c)?t(c):a(c)}function o(c){return fa(c)?l(c):n(c)}function l(c){return c===59?(e.consume(c),a):fa(c)?(e.consume(c),l):n(c)}}function q4(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return ta(o)?n(o):t(o)}}function YC(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Xt(e)}function XC(e){return!fa(e)}function KC(e){return!(e===47||Ry(e))}function Ry(e){return e===43||e===45||e===46||e===95||ta(e)}function Jv(e){let t=e.length,n=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const V4={tokenize:W4,partial:!0};function G4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Q4,continuation:{tokenize:Z4},exit:J4}},text:{91:{name:"gfmFootnoteCall",tokenize:K4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Y4,resolveTo:X4}}}}function Y4(e,t,n){const a=this;let s=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let l;for(;s--;){const u=a.events[s][1];if(u.type==="labelImage"){l=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return c;function c(u){if(!l||!l._balanced)return n(u);const f=Ai(a.sliceSerialize({start:l.end,end:a.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),t(u))}}function X4(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",l,t],["exit",l,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...c),e}function K4(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,l;return c;function c(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),u}function u(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(p){if(o>999||p===93&&!l||p===null||p===91||Xt(p))return n(p);if(p===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return s.includes(Ai(a.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Xt(p)||(l=!0),o++,e.consume(p),p===92?m:f}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function Q4(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,l=0,c;return u;function u(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(x)}function m(x){if(l>999||x===93&&!c||x===null||x===91||Xt(x))return n(x);if(x===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return o=Ai(a.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Xt(x)||(c=!0),l++,e.consume(x),x===92?p:m}function p(x){return x===91||x===92||x===93?(e.consume(x),l++,m):m(x)}function y(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),s.includes(o)||s.push(o),Rt(e,v,"gfmFootnoteDefinitionWhitespace")):n(x)}function v(x){return t(x)}}function Z4(e,t,n){return e.check(Zu,t,e.attempt(V4,t,n))}function J4(e){e.exit("gfmFootnoteDefinition")}function W4(e,t,n){const a=this;return Rt(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const l=a.events[a.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(o):n(o)}}function eI(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:s,resolveAll:a};return t==null&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function a(o,l){let c=-1;for(;++c<o.length;)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let u=c;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[c][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[c][1].end)},m={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[c][1].start)},p=[["enter",f,l],["enter",o[u][1],l],["exit",o[u][1],l],["enter",m,l]],y=l.parser.constructs.insideSpan.null;y&&Xa(p,p.length,0,Ah(y,o.slice(u+1,c),l)),Xa(p,p.length,0,[["exit",m,l],["enter",o[c][1],l],["exit",o[c][1],l],["exit",f,l]]),Xa(o,u-1,c-u+3,p),c=u+p.length-2;break}}for(c=-1;++c<o.length;)o[c][1].type==="strikethroughSequenceTemporary"&&(o[c][1].type="data");return o}function s(o,l,c){const u=this.previous,f=this.events;let m=0;return p;function p(v){return u===126&&f[f.length-1][1].type!=="characterEscape"?c(v):(o.enter("strikethroughSequenceTemporary"),y(v))}function y(v){const x=ic(u);if(v===126)return m>1?c(v):(o.consume(v),m++,y);if(m<2&&!t)return c(v);const b=o.exit("strikethroughSequenceTemporary"),w=ic(v);return b._open=!w||w===2&&!!x,b._close=!x||x===2&&!!w,l(v)}}}class tI{constructor(){this.map=[],this.index=new Map}add(t,n,a){nI(this,t,n,a)}consume(t){if(this.map.sort(function(o,l){return o[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let s=a.pop();for(;s;){for(const o of s)t.push(o);s=a.pop()}this.map.length=0,this.index.clear()}}function nI(e,t,n,a){if(n===0&&a.length===0)return;const s=e.index.get(t);if(s){s[1]+=n,s[2].push(...a);return}const o=[t,n,a];e.map.push(o),e.index.set(t,o)}function aI(e,t){let n=!1;const a=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=a.length-1;a[o]=a[o]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function iI(){return{flow:{null:{name:"table",tokenize:sI,resolveAll:rI}}}}function sI(e,t,n){const a=this;let s=0,o=0,l;return c;function c(E){let I=a.events.length-1;for(;I>-1;){const{type:U}=a.events[I][1];if(U==="lineEnding"||U==="linePrefix")I--;else break}const L=I>-1?a.events[I][1].type:null,H=L==="tableHead"||L==="tableRow"?j:u;return H===j&&a.parser.lazy[a.now().line]?n(E):H(E)}function u(E){return e.enter("tableHead"),e.enter("tableRow"),f(E)}function f(E){return E===124||(l=!0,o+=1),m(E)}function m(E){return E===null?n(E):ot(E)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),v):n(E):Ct(E)?Rt(e,m,"whitespace")(E):(o+=1,l&&(l=!1,s+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),l=!0,m):(e.enter("data"),p(E)))}function p(E){return E===null||E===124||Xt(E)?(e.exit("data"),m(E)):(e.consume(E),E===92?y:p)}function y(E){return E===92||E===124?(e.consume(E),p):p(E)}function v(E){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(E):(e.enter("tableDelimiterRow"),l=!1,Ct(E)?Rt(e,x,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):x(E))}function x(E){return E===45||E===58?w(E):E===124?(l=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),b):D(E)}function b(E){return Ct(E)?Rt(e,w,"whitespace")(E):w(E)}function w(E){return E===58?(o+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),C):E===45?(o+=1,C(E)):E===null||ot(E)?M(E):D(E)}function C(E){return E===45?(e.enter("tableDelimiterFiller"),N(E)):D(E)}function N(E){return E===45?(e.consume(E),N):E===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(E))}function k(E){return Ct(E)?Rt(e,M,"whitespace")(E):M(E)}function M(E){return E===124?x(E):E===null||ot(E)?!l||s!==o?D(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(E)):D(E)}function D(E){return n(E)}function j(E){return e.enter("tableRow"),A(E)}function A(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),A):E===null||ot(E)?(e.exit("tableRow"),t(E)):Ct(E)?Rt(e,A,"whitespace")(E):(e.enter("data"),O(E))}function O(E){return E===null||E===124||Xt(E)?(e.exit("data"),A(E)):(e.consume(E),E===92?R:O)}function R(E){return E===92||E===124?(e.consume(E),O):O(E)}}function rI(e,t){let n=-1,a=!0,s=0,o=[0,0,0,0],l=[0,0,0,0],c=!1,u=0,f,m,p;const y=new tI;for(;++n<e.length;){const v=e[n],x=v[1];v[0]==="enter"?x.type==="tableHead"?(c=!1,u!==0&&(hw(y,t,u,f,m),m=void 0,u=0),f={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},y.add(n,0,[["enter",f,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(a=!0,p=void 0,o=[0,0,0,0],l=[0,n+1,0,0],c&&(c=!1,m={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},y.add(n,0,[["enter",m,t]])),s=x.type==="tableDelimiterRow"?2:m?3:1):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(a=!1,l[2]===0&&(o[1]!==0&&(l[0]=l[1],p=Af(y,t,o,s,void 0,p),o=[0,0,0,0]),l[2]=n)):x.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(l[0]=l[1],p=Af(y,t,o,s,void 0,p)),o=l,l=[o[1],n,0,0])):x.type==="tableHead"?(c=!0,u=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(u=n,o[1]!==0?(l[0]=l[1],p=Af(y,t,o,s,n,p)):l[1]!==0&&(p=Af(y,t,l,s,n,p)),s=0):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(l[3]=n)}for(u!==0&&hw(y,t,u,f,m),y.consume(t.events),n=-1;++n<t.events.length;){const v=t.events[n];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=aI(t.events,n))}return e}function Af(e,t,n,a,s,o){const l=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",c="tableContent";n[0]!==0&&(o.end=Object.assign({},Il(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const u=Il(t.events,n[1]);if(o={type:l,start:Object.assign({},u),end:Object.assign({},u)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const f=Il(t.events,n[2]),m=Il(t.events,n[3]),p={type:c,start:Object.assign({},f),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",p,t]]),a!==2){const y=t.events[n[2]],v=t.events[n[3]];if(y[1].end=Object.assign({},v[1].end),y[1].type="chunkText",y[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,b=n[3]-n[2]-1;e.add(x,b,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return s!==void 0&&(o.end=Object.assign({},Il(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function hw(e,t,n,a,s){const o=[],l=Il(t.events,n);s&&(s.end=Object.assign({},l),o.push(["exit",s,t])),a.end=Object.assign({},l),o.push(["exit",a,t]),e.add(n+1,0,o)}function Il(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const oI={name:"tasklistCheck",tokenize:cI};function lI(){return{text:{91:oI}}}function cI(e,t,n){const a=this;return s;function s(u){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),o)}function o(u){return Xt(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),l):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),l):n(u)}function l(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):n(u)}function c(u){return ot(u)?t(u):Ct(u)?e.check({tokenize:uI},t,n)(u):n(u)}}function uI(e,t,n){return Rt(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function dI(e){return sC([I4(),G4(),eI(e),iI(),lI()])}const fI={};function hI(e){const t=this,n=e||fI,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),l=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(dI(n)),o.push(A4()),l.push(D4(n))}const QC=T.memo(({content:e,isStreaming:t=!1,className:n,syntaxHighlighter:a})=>{const s=T.useMemo(()=>({p:({children:l})=>h.jsx("p",{className:"chat-markdown__p",children:l}),h1:({children:l})=>h.jsx("h1",{className:"chat-markdown__h1",children:l}),h2:({children:l})=>h.jsx("h2",{className:"chat-markdown__h2",children:l}),h3:({children:l})=>h.jsx("h3",{className:"chat-markdown__h3",children:l}),ul:({children:l})=>h.jsx("ul",{className:"chat-markdown__ul",children:l}),ol:({children:l})=>h.jsx("ol",{className:"chat-markdown__ol",children:l}),li:({children:l})=>h.jsx("li",{className:"chat-markdown__li",children:l}),blockquote:({children:l})=>h.jsx("blockquote",{className:"chat-markdown__blockquote",children:l}),a:({children:l,href:c})=>h.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"chat-markdown__link",children:l}),table:({children:l})=>h.jsx("div",{className:"chat-markdown__table-wrapper",children:h.jsx("table",{className:"chat-markdown__table",children:l})}),thead:({children:l})=>h.jsx("thead",{className:"chat-markdown__thead",children:l}),tbody:({children:l})=>h.jsx("tbody",{className:"chat-markdown__tbody",children:l}),tr:({children:l})=>h.jsx("tr",{className:"chat-markdown__tr",children:l}),th:({children:l})=>h.jsx("th",{className:"chat-markdown__th",children:l}),td:({children:l})=>h.jsx("td",{className:"chat-markdown__td",children:l}),pre:({children:l})=>h.jsx(h.Fragment,{children:l}),code:({children:l,className:c})=>{const u=/language-(\w+)/.exec(c!=null?c:"");if(!u)return h.jsx("code",{className:"chat-markdown__code-inline",children:l});const f=u[1],m=String(l).replace(/\n$/,"");return a?h.jsx(h.Fragment,{children:a(m,f)}):h.jsx("pre",{className:"chat-markdown__pre",children:h.jsx("code",{className:"chat-markdown__code-block",children:l})})},hr:()=>h.jsx("hr",{className:"chat-markdown__hr"}),strong:({children:l})=>h.jsx("strong",{className:"chat-markdown__strong",children:l}),em:({children:l})=>h.jsx("em",{className:"chat-markdown__em",children:l})}),[a]),o=["chat-markdown",t&&"chat-markdown--streaming",n].filter(Boolean).join(" ");return h.jsx("div",{className:o,"aria-busy":t||void 0,children:h.jsx(eO,{remarkPlugins:[hI],components:s,children:e})})});QC.displayName="ChatMarkdownContent";const Ty=ve.forwardRef((y,p)=>{var v=y,{query:e,onQueryChange:t,results:n=[],onSelect:a,onClear:s,placeholder:o="Search entities...",disabled:l=!1,inputId:c,placement:u="bottom-start",className:f}=v,m=Me(v,["query","onQueryChange","results","onSelect","onClear","placeholder","disabled","inputId","placement","className"]);const[x,b]=T.useState(!1),w=T.useRef(null),C=T.useRef(null),N=T.useRef(null),k=ve.useId(),M=U=>`${k}-option-${U}`,D=T.useCallback(()=>b(!1),[]),{focusedValue:j,setFocusedValue:A}=jh({triggerRef:w,panelRef:N,isOpen:x,onClose:D,restoreFocus:!1});T.useEffect(()=>{n.length===0?A(null):n.some(U=>U.id===j)||A(n[0].id)},[n,j,A]),T.useEffect(()=>{if(!x)return;const U=$=>{var P;if($.key!=="Enter"||!((P=w.current)!=null&&P.contains($.target)))return;const G=n.find(K=>K.id===j);G&&($.preventDefault(),a(G),b(!1))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[x,n,j,a]),T.useImperativeHandle(p,()=>C.current);const O=U=>{l||(t(U.target.value),b(!0))},R=()=>{l||e.length>0&&n.length>0&&b(!0)},E=()=>{var U;s(),b(!1),(U=w.current)==null||U.focus()},I=U=>{a(U),b(!1)},L=x&&n.length>0,H=L&&j?M(j):void 0;return h.jsxs("div",Z(F({ref:C,className:["entity-picker",l&&"entity-picker--disabled",f].filter(Boolean).join(" ")},m),{children:[h.jsxs("div",{className:"entity-picker__input-wrapper",children:[h.jsx("input",{ref:w,id:c,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":L,"aria-controls":k,"aria-activedescendant":H,className:"entity-picker__input",placeholder:o,value:e,disabled:l,onChange:O,onFocus:R,"data-testid":"entity-picker-input"}),e&&!l&&h.jsx("button",{type:"button",className:"entity-picker__clear",onClick:E,"aria-label":"Clear search","data-testid":"entity-picker-clear",children:h.jsx(He,{name:"x",size:16})})]}),L&&h.jsx("div",{ref:N,id:k,role:"listbox",className:`dropdown-panel ${Eh(u)} entity-picker__dropdown`,"data-testid":"entity-picker-dropdown",children:n.map(U=>{const $=U.id===j;return h.jsxs("div",{id:M(U.id),role:"option","aria-selected":$,"data-dropdown-item":U.id,className:["dropdown-item","entity-picker__result",$&&"dropdown-item--focused"].filter(Boolean).join(" "),onMouseEnter:()=>A(U.id),onMouseDown:P=>{P.preventDefault(),I(U)},"data-testid":`entity-picker-result-${U.id}`,children:[U.domain&&U.domainColor&&h.jsx(Na,{variant:U.domainColor,className:"entity-picker__badge",children:U.domain}),h.jsx("span",{className:"dropdown-item__label entity-picker__label",children:U.label})]},U.id)})})]}))});Ty.displayName="EntityPicker";const pI=ve.forwardRef((p,m)=>{var y=p,{rows:e,onChange:t,datatypeColumn:n=!1,datatypes:a=["string","number","boolean"],disabled:s=!1,keyPlaceholder:o="Key",valuePlaceholder:l="Value",addLabel:c="Add row",className:u}=y,f=Me(y,["rows","onChange","datatypeColumn","datatypes","disabled","keyPlaceholder","valuePlaceholder","addLabel","className"]);const v=ve.useId(),x=ve.useRef(0),b=(M,D)=>{t(e.map(j=>j.id===M?Z(F({},j),{key:D}):j))},w=(M,D)=>{t(e.map(j=>j.id===M?Z(F({},j),{value:D}):j))},C=(M,D)=>{t(e.map(j=>j.id===M?Z(F({},j),{datatype:D}):j))},N=M=>{t(e.filter(D=>D.id!==M))},k=()=>{const M=F({id:`${v}-${x.current++}`,key:"",value:""},n&&{datatype:"string"});t([...e,M])};return h.jsxs("div",Z(F({ref:m,className:["key-value-editor",n&&"key-value-editor--has-datatype",s&&"key-value-editor--disabled",u].filter(Boolean).join(" "),"data-testid":"key-value-editor"},f),{children:[h.jsxs("div",{className:"key-value-editor__table",children:[h.jsxs("div",{className:"key-value-editor__header",children:[h.jsx("div",{className:"key-value-editor__col key-value-editor__col--key",children:"Key"}),h.jsx("div",{className:"key-value-editor__col key-value-editor__col--value",children:"Value"}),n&&h.jsx("div",{className:"key-value-editor__col key-value-editor__col--datatype",children:"Type"}),h.jsx("div",{className:"key-value-editor__col key-value-editor__col--actions"})]}),e.map(M=>h.jsxs("div",{className:"key-value-editor__row","data-testid":`key-value-row-${M.id}`,children:[h.jsx(Du,{className:"key-value-editor__input",placeholder:o,value:M.key,onChange:D=>b(M.id,D.target.value),disabled:s,"data-testid":`key-input-${M.id}`}),h.jsx(Du,{className:"key-value-editor__input",placeholder:l,value:M.value,onChange:D=>w(M.id,D.target.value),disabled:s,"data-testid":`value-input-${M.id}`}),n&&h.jsx(ch,{className:"key-value-editor__input key-value-editor__select",value:M.datatype||"string",onChange:D=>C(M.id,D),disabled:s,"data-testid":`datatype-select-${M.id}`,children:a.map(D=>h.jsx(ch.Item,{value:D,children:D},D))}),h.jsx("button",{type:"button",className:"key-value-editor__remove-btn",onClick:()=>N(M.id),"aria-label":"Remove row",disabled:s,"data-testid":`remove-row-${M.id}`,children:h.jsx(He,{name:"trash",size:16})})]},M.id))]}),h.jsxs(Pn,{variant:"ghost",size:"sm",className:"key-value-editor__add-btn",onClick:k,disabled:s,"data-testid":"add-row-btn",children:[h.jsx(He,{name:"plus",size:16}),c]})]}))});pI.displayName="KeyValueEditor";const mI=ve.forwardRef((c,l)=>{var u=c,{items:e,onChange:t,primaryItemId:n,disabled:a=!1,className:s}=u,o=Me(u,["items","onChange","primaryItemId","disabled","className"]);const f=T.useCallback(p=>{if(p>0){const y=[...e];[y[p-1],y[p]]=[y[p],y[p-1]],t(y)}},[e,t]),m=T.useCallback(p=>{if(p<e.length-1){const y=[...e];[y[p],y[p+1]]=[y[p+1],y[p]],t(y)}},[e,t]);return h.jsx("div",Z(F({ref:l,className:["ordered-list",a&&"ordered-list--disabled",s].filter(Boolean).join(" "),role:"list","aria-disabled":a||void 0,"data-testid":"ordered-list"},o),{children:e.map((p,y)=>h.jsxs("div",{className:["ordered-list__item",n===p.id&&"ordered-list__item--primary"].filter(Boolean).join(" "),role:"listitem","data-testid":`ordered-item-${p.id}`,children:[h.jsxs("div",{className:"ordered-list__rank",children:[n===p.id&&h.jsx("div",{className:"ordered-list__primary-badge",title:"Primary item",children:h.jsx(He,{name:"star",size:10})}),h.jsx("div",{className:"ordered-list__index",children:y+1})]}),h.jsx("span",{className:"ordered-list__label",children:p.label}),h.jsxs("div",{className:"ordered-list__controls",children:[h.jsx(Pn,{variant:"ghost",size:"sm",disabled:a||y===0,onClick:()=>f(y),"aria-label":"Move up","data-testid":`move-up-${p.id}`,children:h.jsx(He,{name:"arrowUp",size:16})}),h.jsx(Pn,{variant:"ghost",size:"sm",disabled:a||y===e.length-1,onClick:()=>m(y),"aria-label":"Move down","data-testid":`move-down-${p.id}`,children:h.jsx(He,{name:"arrowDown",size:16})})]})]},p.id))}))});mI.displayName="OrderedList";const gI=ve.forwardRef((b,x)=>{var w=b,{value:e,onChange:t,sourceResults:n=[],targetResults:a=[],sourceQuery:s,onSourceQueryChange:o,targetQuery:l,onTargetQueryChange:c,predicates:u=["contains","relates to","depends on","is used by"],onSourceClear:f,onTargetClear:m,disabled:p=!1,className:y}=w,v=Me(w,["value","onChange","sourceResults","targetResults","sourceQuery","onSourceQueryChange","targetQuery","onTargetQueryChange","predicates","onSourceClear","onTargetClear","disabled","className"]);const C=ve.useId(),N=`${C}-source`,k=`${C}-predicate`,M=`${C}-target`,D=ve.useCallback(O=>{t(Z(F({},e),{source:O})),o("")},[t,o,e]),j=ve.useCallback(O=>{t(Z(F({},e),{target:O})),c("")},[t,c,e]),A=ve.useCallback(O=>{t(Z(F({},e),{predicate:O}))},[t,e]);return h.jsxs("div",Z(F({ref:x,className:["relationship-builder",y].filter(Boolean).join(" "),"data-testid":"relationship-builder"},v),{children:[h.jsxs("div",{className:"relationship-builder__column",children:[h.jsx("label",{htmlFor:N,className:"relationship-builder__label",children:"Source"}),h.jsx(Ty,{inputId:N,query:s,onQueryChange:o,results:n,onSelect:D,onClear:f,placeholder:"Search source entity...",disabled:p}),e.source&&h.jsxs("div",{className:"relationship-builder__selected","data-testid":"source-selected",children:[e.source.domain&&h.jsx("span",{className:"relationship-builder__domain",children:e.source.domain}),h.jsx("span",{children:e.source.label})]})]}),h.jsxs("div",{className:"relationship-builder__column",children:[h.jsx("label",{htmlFor:k,className:"relationship-builder__label",children:"Predicate"}),h.jsx(ch,{id:k,value:e.predicate,placeholder:"Select relation type...",onChange:A,disabled:p,"data-testid":"predicate-select",children:u.map(O=>h.jsx(ch.Item,{value:O,children:O},O))})]}),h.jsxs("div",{className:"relationship-builder__column",children:[h.jsx("label",{htmlFor:M,className:"relationship-builder__label",children:"Target"}),h.jsx(Ty,{inputId:M,query:l,onQueryChange:c,results:a,onSelect:j,onClear:m,placeholder:"Search target entity...",disabled:p}),e.target&&h.jsxs("div",{className:"relationship-builder__selected","data-testid":"target-selected",children:[e.target.domain&&h.jsx("span",{className:"relationship-builder__domain",children:e.target.domain}),h.jsx("span",{children:e.target.label})]})]})]}))});gI.displayName="RelationshipBuilder";const yI=e=>"type"in e&&e.type==="separator",ZC=ve.forwardRef((f,u)=>{var m=f,{actions:e,onAction:t,trigger:n,triggerIcon:a="moreVertical",triggerLabel:s="Menu",placement:o="bottom-start",className:l}=m,c=Me(m,["actions","onAction","trigger","triggerIcon","triggerLabel","placement","className"]);const[p,y]=T.useState(!1),v=T.useRef(null),x=T.useRef(null),b=T.useRef(null),w=T.useCallback(()=>y(!1),[]),{focusedValue:C,setFocusedValue:N}=jh({triggerRef:b,panelRef:x,isOpen:p,onClose:w});T.useImperativeHandle(u,()=>v.current);const k=T.useCallback(M=>{t(M),y(!1)},[t]);return h.jsxs("div",Z(F({ref:v,className:["row-menu",l].filter(Boolean).join(" "),"data-testid":"row-menu"},c),{children:[h.jsx("button",{ref:b,type:"button",className:"row-menu__trigger",onClick:()=>y(M=>!M),"aria-label":s,"aria-haspopup":"menu","aria-expanded":p,"data-testid":"row-menu-trigger",children:n||h.jsx(He,{name:a,size:16})}),p&&h.jsx("div",{ref:x,role:"menu","aria-label":s,className:`dropdown-panel ${Eh(o)} row-menu__dropdown`,"data-testid":"row-menu-dropdown",children:e.map((M,D)=>yI(M)?h.jsx("div",{role:"separator",className:"dropdown-separator","data-testid":`row-menu-separator-${D}`},`separator-${D}`):h.jsx(vI,{action:M,isFocused:C===M.id,onFocus:()=>N(M.id),onClick:()=>k(M.id)},M.id))})]}))});ZC.displayName="RowMenu";function vI({action:e,isFocused:t,onFocus:n,onClick:a}){const s=T.useRef(null);return T.useEffect(()=>{var o;t&&((o=s.current)==null||o.focus())},[t]),h.jsxs("button",{ref:s,type:"button",role:"menuitem",tabIndex:t?0:-1,disabled:e.disabled,"data-dropdown-item":e.id,"data-disabled":e.disabled||void 0,onClick:a,onMouseEnter:()=>!e.disabled&&n(),className:["dropdown-item",e.danger&&"dropdown-item--danger",t&&"dropdown-item--focused",e.disabled&&"dropdown-item--disabled"].filter(Boolean).join(" "),"data-testid":`row-menu-action-${e.id}`,children:[e.icon&&h.jsx("span",{className:"dropdown-item__leading",children:h.jsx(He,{name:e.icon,size:16})}),h.jsx("span",{className:"dropdown-item__label",children:e.label})]})}const xI={running:"cyan",success:"emerald",idle:"neutral",failed:"rose"},bI=ve.forwardRef((y,p)=>{var v=y,{pipeline:e,onRun:t,onCancel:n,onOptions:a,compact:s=!1,selected:o=!1,headerAction:l,footerContent:c,flowLayout:u="fill",className:f}=v,m=Me(v,["pipeline","onRun","onCancel","onOptions","compact","selected","headerAction","footerContent","flowLayout","className"]);const x=xI[e.status];return h.jsxs("div",Z(F({ref:p,className:["pipeline-card",s&&"pipeline-card--compact",o&&"pipeline-card--selected",f].filter(Boolean).join(" "),"data-testid":"pipeline-card"},m),{children:[h.jsxs("div",{className:"pipeline-card__head",children:[h.jsxs("div",{className:"pipeline-card__head-top",children:[h.jsxs("div",{className:"pipeline-card__title-group",children:[h.jsx("div",{className:"pipeline-card__name-mono",children:e.name}),e.id&&h.jsx("div",{className:"pipeline-card__id-mono",children:e.id})]}),h.jsxs("div",{className:"pipeline-card__head-right",children:[h.jsxs("div",{className:"pipeline-card__head-chips",children:[h.jsx(Na,{variant:x,children:e.status}),e.target&&h.jsx(Na,{variant:"neutral",children:e.target}),e.tags&&e.tags.length>0&&h.jsx("div",{className:"pipeline-card__tags",children:e.tags.map(b=>h.jsx(Na,{variant:"neutral",children:b},b))})]}),h.jsxs("div",{className:"pipeline-card__head-actions",children:[l,t&&e.status!=="running"&&h.jsx("button",{type:"button",className:"pipeline-card__action-btn",onClick:t,"data-testid":"pipeline-run-btn",children:"Run"}),n&&e.status==="running"&&h.jsx("button",{type:"button",className:"pipeline-card__action-btn pipeline-card__action-btn--cancel",onClick:n,"data-testid":"pipeline-cancel-btn",children:"Cancel"}),a&&h.jsx("button",{type:"button","aria-label":"Pipeline options",className:"pipeline-card__kebab-btn",onClick:a,"data-testid":"pipeline-kebab-btn",children:h.jsx(He,{name:"moreVertical",size:16})})]})]})]}),e.description&&h.jsx("p",{className:"pipeline-card__description",children:e.description})]}),h.jsx("div",{className:"pipeline-card__flow","data-layout":u,children:e.flow.map((b,w)=>h.jsxs(ve.Fragment,{children:[h.jsxs("div",{className:"pipeline-card__node","data-color":b.color,children:[h.jsx("div",{className:"pipeline-card__icon-tile",children:typeof b.icon=="string"?h.jsx(He,{name:b.icon,size:16}):b.icon}),h.jsxs("div",{className:"pipeline-card__node-content",children:[h.jsx("div",{className:"pipeline-card__node-name",children:b.name}),b.label&&h.jsx("div",{className:"pipeline-card__node-label",children:b.label})]})]}),w<e.flow.length-1&&h.jsx("div",{className:"pipeline-card__arrow"})]},b.id))}),h.jsx("div",{className:"pipeline-card__foot",children:c!=null?c:h.jsxs("div",{className:"pipeline-card__foot-row",children:[h.jsxs("div",{className:"pipeline-card__foot-col",children:[h.jsx("div",{className:"pipeline-card__foot-label",children:"LAST RUN"}),h.jsx("div",{className:"pipeline-card__foot-value",children:e.lastRun||"—"})]}),h.jsxs("div",{className:"pipeline-card__foot-col",children:[h.jsx("div",{className:"pipeline-card__foot-label",children:"INGESTED"}),h.jsx("div",{className:"pipeline-card__foot-value",children:e.recent.ingested})]}),h.jsxs("div",{className:"pipeline-card__foot-col",children:[h.jsx("div",{className:"pipeline-card__foot-label",children:"CREATED"}),h.jsx("div",{className:"pipeline-card__foot-value",children:e.recent.created})]}),h.jsxs("div",{className:"pipeline-card__foot-col",children:[h.jsx("div",{className:"pipeline-card__foot-label",children:"UPDATED"}),h.jsx("div",{className:"pipeline-card__foot-value",children:e.recent.updated})]}),h.jsxs("div",{className:["pipeline-card__foot-col",Number(e.recent.errors)>0&&"pipeline-card__foot-col--error"].filter(Boolean).join(" "),children:[h.jsx("div",{className:"pipeline-card__foot-label",children:"ERRORS"}),h.jsx("div",{className:"pipeline-card__foot-value",children:e.recent.errors})]})]})})]}))});bI.displayName="PipelineCard";const _I=e=>{const t=[];let n=0;const a=/`([^`]+)`/g;let s;for(;(s=a.exec(e))!==null;)s.index>n&&t.push(e.substring(n,s.index)),t.push(h.jsx("code",{className:"form-callout__code",children:s[1]},`code-${s.index}`)),n=a.lastIndex;return n<e.length&&t.push(e.substring(n)),t.length>0?t:[e]},wI=ve.forwardRef((c,l)=>{var u=c,{variant:e="info",icon:t,children:n,className:a="",role:s}=u,o=Me(u,["variant","icon","children","className","role"]);const f=typeof n=="string"?_I(n):n,m=s!=null?s:e==="error"||e==="warn"?"alert":"note";return h.jsxs("div",Z(F({ref:l,className:["form-callout",`form-callout--${e}`,a].filter(Boolean).join(" "),"data-testid":"form-callout",role:m},o),{children:[t&&h.jsx("div",{className:"form-callout__icon",children:h.jsx(He,{name:t,size:16})}),h.jsx("div",{className:"form-callout__body",children:f})]}))});wI.displayName="FormCallout";function Wv(e,t,n){const a=`${t} to ${n}`;return e?`${e}: ${a}`:a}function SI(e,t,n,a,s,o){const l=s-e,c=o-t;if(l===0&&c===0)return{x:e,y:t};const u=Math.abs(l),f=Math.abs(c),m=n/2,p=a/2;if(u*p>f*m){const y=l>0?1:-1;return{x:e+y*m,y:t+c*m/u}}else{const y=c>0?1:-1;return{x:e+l*p/f,y:t+y*p}}}function Tg(e,t){let{minX:n,maxX:a,minY:s,maxY:o}=e,l=!1;for(const c of t)!Number.isFinite(c.x)||!Number.isFinite(c.y)||!Number.isFinite(c.r)||(n=Math.min(n,c.x-c.r),a=Math.max(a,c.x+c.r),s=Math.min(s,c.y-c.r),o=Math.max(o,c.y+c.r),l=!0);return l?{minX:n,maxX:a,minY:s,maxY:o}:e}function Ag(e,t,n,a,s,o){const l=e.maxX-e.minX,c=e.maxY-e.minY,u=Math.min(o,Math.max(s,Math.min((t-2*a)/(l||1),(n-2*a)/(c||1)))),f=(e.minX+e.maxX)/2,m=(e.minY+e.maxY)/2;return{zoom:u,panX:t/2-f*u,panY:n/2-m*u}}const Ih=.22;function CI(e,t,n=Ih){const a=t.x-e.x,s=t.y-e.y,o=Math.hypot(a,s),l=-s/(o||1),c=a/(o||1),u=Math.min(80,o*n),f=(e.x+t.x)/2+l*u,m=(e.y+t.y)/2+c*u;return{d:`M ${e.x} ${e.y} Q ${f} ${m} ${t.x} ${t.y}`,mid:{x:(e.x+2*f+t.x)/4,y:(e.y+2*m+t.y)/4},angle:Math.atan2(t.y-m,t.x-f),points:[e,{x:f,y:m},t]}}const pw={left:{x:-1,y:0},right:{x:1,y:0},top:{x:0,y:-1},bottom:{x:0,y:1}};function mw(e,t,n,a,s,o){const l=s-e,c=o-t;if(l===0&&c===0)return{x:0,y:0};const u=Math.abs(l),f=Math.abs(c),m=n/2,p=a/2;return u*p>f*m?{x:l>0?1:-1,y:0}:{x:0,y:c>0?1:-1}}function NI(e,t,n,a,s,o,l){switch(s){case"left":return{x:e-n/2,y:t};case"right":return{x:e+n/2,y:t};case"top":return{x:e,y:t-a/2};case"bottom":return{x:e,y:t+a/2};default:return SI(e,t,n,a,o,l)}}function gw(e,t,n,a){if(t==="auto"&&e.radius!==void 0&&e.radius>0){const s=n-e.x,o=a-e.y,l=Math.hypot(s,o);return l===0?{x:e.x,y:e.y}:{x:e.x+s/l*e.radius,y:e.y+o/l*e.radius}}return NI(e.x,e.y,e.width,e.height,t,n,a)}const JC=.22;function kI(e,t,n="auto",a="auto",s=JC,o,l){const c=t.x-e.x,u=t.y-e.y,f=Math.hypot(c,u)||1,m=Math.min(120,f*s),p=-u/f,y=c/f,v=o!=null?o:n==="auto"?{x:p,y}:pw[n],x=l!=null?l:a==="auto"?{x:p,y}:pw[a],b={x:e.x+v.x*m,y:e.y+v.y*m},w={x:t.x+x.x*m,y:t.y+x.y*m},C={x:(e.x+b.x)/2,y:(e.y+b.y)/2},N={x:(b.x+w.x)/2,y:(b.y+w.y)/2},k={x:(w.x+t.x)/2,y:(w.y+t.y)/2},M={x:(C.x+N.x)/2,y:(C.y+N.y)/2},D={x:(N.x+k.x)/2,y:(N.y+k.y)/2},j={x:(M.x+D.x)/2,y:(M.y+D.y)/2};return{d:`M ${e.x} ${e.y} C ${b.x} ${b.y} ${w.x} ${w.y} ${t.x} ${t.y}`,mid:j,angle:Math.atan2(D.y-M.y,D.x-M.x),points:[e,b,w,t]}}function mh(e,t,n={}){var f,m,p,y;const a=(f=n.sourceAnchor)!=null?f:"auto",s=(m=n.targetAnchor)!=null?m:"auto",o=gw(e,a,t.x,t.y),l=gw(t,s,e.x,e.y);if(a==="auto"&&s==="auto")return CI(o,l,(p=n.curvature)!=null?p:Ih);const c=a==="auto"?mw(e.x,e.y,e.width,e.height,t.x,t.y):void 0,u=s==="auto"?mw(t.x,t.y,t.width,t.height,e.x,e.y):void 0;return kI(o,l,a,s,(y=n.curvature)!=null?y:JC,c,u)}const MI=6.6,jI=14,EI=18;function sc(e){return{width:e.length*MI+jI,height:EI}}function RI(e,t,n,a){const s=1-a;return{x:s*s*e.x+2*s*a*t.x+a*a*n.x,y:s*s*e.y+2*s*a*t.y+a*a*n.y}}function TI(e,t,n,a,s){const o=1-s;return{x:o*o*o*e.x+3*o*o*s*t.x+3*o*s*s*n.x+s*s*s*a.x,y:o*o*o*e.y+3*o*o*s*t.y+3*o*s*s*n.y+s*s*s*a.y}}function AI(e,t){const n=e.length-1,a=Math.floor(t*n),s=t*n-a,o=e[Math.min(a,e.length-1)],l=e[Math.min(a+1,e.length-1)];return{x:o.x+(l.x-o.x)*s,y:o.y+(l.y-o.y)*s}}const DI=[.5,.38,.62,.26,.74,.15,.85];function Ay(e,t,n,a=6,s){const o=s?u=>AI(e,u):e.length===4?u=>TI(e[0],e[1],e[2],e[3],u):u=>RI(e[0],e[1],e[2],u),l=t.width/2+a,c=t.height/2+a;for(const u of DI){const f=o(u);if(n.every(m=>{const p=m.width/2,y=m.height/2;return Math.abs(f.x-m.x)>=l+p||Math.abs(f.y-m.y)>=c+y}))return f}return o(.5)}const e1=16,LI=20,yw=2;function OI(e){if(e.length<2)return null;const t=e.map(l=>({x:l.x,y:l.y})),n=iN(t),a=t.slice(1).map((l,c)=>({len:Math.abs(l.x-t[c].x)+Math.abs(l.y-t[c].y),a:t[c],b:l,i:c})).sort((l,c)=>c.len-l.len||l.i-c.i).flatMap(l=>[.5,.3,.7].map(c=>({x:l.a.x+(l.b.x-l.a.x)*c,y:l.a.y+(l.b.y-l.a.y)*c}))),s=a[0],o=Math.atan2(t[t.length-1].y-t[t.length-2].y,t[t.length-1].x-t[t.length-2].x);return{d:n,mid:s,angle:o,points:t,isPolyline:!0,labelAnchors:a}}function II(e,t,n=[]){const a=aN(e,t,t1(n,e,t));return WC(a)}function zI(e,t=[],n=e1){const a=new Map,s=new Map;for(const o of e){const l=aN(o.source,o.target,t1(t,o.source,o.target));a.set(o.id,WC(l)),s.set(o.id,{source:o.source,target:o.target})}return BI(a,s,t,n),a}function WC(e){const t={d:"",mid:e[0],angle:0,points:e,isPolyline:!0};return eN(t),t}function vw(e,t){return e===t||e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function t1(e,t,n){return e.filter(a=>!vw(a,t)&&!vw(a,n))}function BI(e,t,n,a=e1){const s=new Map,o=new Map;for(const[l,c]of e)for(let u=0;u<c.points.length-1;u++){const f=c.points[u],m=c.points[u+1];if(!(f.x===m.x&&f.y===m.y)){if(f.y===m.y){const p=Math.round(f.y);s.has(p)||s.set(p,[]),s.get(p).push({id:l,segmentIndex:u,lo:Math.min(f.x,m.x),hi:Math.max(f.x,m.x)})}else if(f.x===m.x){const p=Math.round(f.x);o.has(p)||o.set(p,[]),o.get(p).push({id:l,segmentIndex:u,lo:Math.min(f.y,m.y),hi:Math.max(f.y,m.y)})}}}for(const[l,c]of[["y",s],["x",o]])for(const u of c.values()){const f=[...u].sort((v,x)=>v.lo-x.lo||v.id.localeCompare(x.id));let m=[],p=-1/0;const y=[];for(const v of f)m.length>0&&v.lo<p?(m.push(v),p=Math.max(p,v.hi)):(m.length>1&&y.push(m),m=[v],p=v.hi);m.length>1&&y.push(m);for(const v of y){const x=[...new Set(v.map(w=>w.id))];if(x.length<2)continue;const b=new Set;x.forEach((w,C)=>{const N=(C-(x.length-1)/2)*a,k=e.get(w),M=t.get(w),D=t1(n,M.source,M.target),j=[N,-N];for(let A=Math.ceil(x.length/2);A<=x.length;A++)j.push(A*a,-A*a);for(const A of j){if(b.has(A))continue;if(A===0){b.add(A);break}const O=v.filter(E=>E.id===w);if(!O.every(E=>UI(k,E.segmentIndex,l,A,M)))continue;let R=k.points;for(const E of O)R=FI(R,E.segmentIndex,l,A);if(!(Dy(R,D,0)>Dy(k.points,D,0))){k.points=R,eN(k),b.add(A);break}}})}}}function UI(e,t,n,a,s){const o=e.points.length-2;return!(t===0&&!xw(e.points[0],s.source,n,a)||t===o&&!xw(e.points[o+1],s.target,n,a))}function xw(e,t,n,a){const s=Math.abs(Math.abs(e.x-t.x)-t.width/2)<.01,o=Math.abs(Math.abs(e.y-t.y)-t.height/2)<.01;return n==="y"?s?Math.abs(e.y+a-t.y)<=t.height/2-yw:!1:o?Math.abs(e.x+a-t.x)<=t.width/2-yw:!1}function FI(e,t,n,a){return e.map((s,o)=>o===t||o===t+1?n==="y"?{x:s.x,y:s.y+a}:{x:s.x+a,y:s.y}:s)}function eN(e){e.d=iN(e.points),e.mid=e.points[Math.floor(e.points.length/2)];const t=e.points.length;e.angle=t>=2?Math.atan2(e.points[t-1].y-e.points[t-2].y,e.points[t-1].x-e.points[t-2].x):0}function pn(e,t){switch(t){case"left":return{x:e.x-e.width/2,y:e.y};case"right":return{x:e.x+e.width/2,y:e.y};case"top":return{x:e.x,y:e.y-e.height/2};case"bottom":return{x:e.x,y:e.y+e.height/2}}}function tN(e,t,n,a,s=0){const o=a.x-a.width/2-s,l=a.x+a.width/2+s,c=a.y-a.height/2-s,u=a.y+a.height/2+s;return n>c&&n<u&&Math.min(e,t)<l&&Math.max(e,t)>o}function nN(e,t,n,a,s=0){const o=a.x-a.width/2-s,l=a.x+a.width/2+s,c=a.y-a.height/2-s,u=a.y+a.height/2+s;return e>o&&e<l&&Math.min(t,n)<u&&Math.max(t,n)>c}function Dy(e,t,n){let a=0;for(let s=0;s<e.length-1;s++){const o=e[s],l=e[s+1];if(!(o.x===l.x&&o.y===l.y))for(const c of t)(o.y===l.y?tN(o.x,l.x,o.y,c,n):nN(o.x,o.y,l.y,c,n))&&a++}return a}function $I(e){const t=[];for(const n of e){const a=t[t.length-1];(!a||a.x!==n.x||a.y!==n.y)&&t.push(n)}return t}function aN(e,t,n){const a=LI,s=t.x-e.x,o=t.y-e.y,l=(j,A)=>A.x>=j.x?"right":"left",c=(j,A)=>A.y>=j.y?"bottom":"top",u=j=>({left:"right",right:"left",top:"bottom",bottom:"top"})[j];if(s===0&&o===0)return[pn(e,"right"),pn(t,"right")];const f=[];if(o===0&&f.push([pn(e,l(e,t)),pn(t,u(l(e,t)))]),s===0&&f.push([pn(e,c(e,t)),pn(t,u(c(e,t)))]),s!==0&&o!==0){const j=pn(e,l(e,t)),A=pn(t,u(c(e,t)));f.push([j,{x:A.x,y:j.y},A]);const O=pn(e,c(e,t)),R=pn(t,u(l(e,t)));f.push([O,{x:O.x,y:R.y},R])}const m=j=>{if(j.length===0)return[];const A=Math.min(...j.map(R=>R.y-R.height/2))-a,O=Math.max(...j.map(R=>R.y+R.height/2))+a;return Math.abs(A-e.y)<=Math.abs(O-e.y)?[A,O]:[O,A]},p=j=>{if(j.length===0)return[];const A=Math.min(...j.map(R=>R.x-R.width/2))-a,O=Math.max(...j.map(R=>R.x+R.width/2))+a;return Math.abs(O-e.x)<=Math.abs(A-e.x)?[O,A]:[A,O]},y=j=>{const A=pn(e,c(e,{x:e.x,y:j})),O=pn(t,c(t,{x:t.x,y:j}));return[A,{x:A.x,y:j},{x:O.x,y:j},O]},v=j=>{const A=pn(e,l(e,{x:j,y:e.y})),O=pn(t,l(t,{x:j,y:t.y}));return[A,{x:j,y:A.y},{x:j,y:O.y},O]},x=pn(e,l(e,t)),b=n.filter(j=>tN(x.x,t.x,e.y,j,a)),w=pn(e,c(e,t)),C=n.filter(j=>nN(e.x,w.y,t.y,j,a));for(const j of m(b))f.push(y(j));for(const j of p(C))f.push(v(j));for(const j of m(n))f.push(y(j));for(const j of p(n))f.push(v(j));const N=[...new Set([...m(b),...m(n)])],k=[...new Set([...p(C),...p(n)])];for(const j of N)for(const A of k){const O=pn(e,c(e,{x:e.x,y:j})),R=pn(t,l(t,{x:A,y:t.y}));f.push([O,{x:O.x,y:j},{x:A,y:j},{x:A,y:R.y},R]);const E=pn(e,l(e,{x:A,y:e.y})),I=pn(t,c(t,{x:t.x,y:j}));f.push([E,{x:A,y:E.y},{x:A,y:j},{x:I.x,y:j},I])}let M=null,D=1/0;for(const j of f){const A=$I(j),O=Dy(A,n,a);if(O===0)return A;O<D&&(M=A,D=O)}return M!=null?M:[pn(e,"right"),pn(t,"left")]}function iN(e){return e.length===0?"":[`M ${Math.round(e[0].x)} ${Math.round(e[0].y)}`,...e.slice(1).map(t=>`L ${Math.round(t.x)} ${Math.round(t.y)}`)].join(" ")}const PI=10,HI=100;function qI(e,t){var o,l,c;const n=new Map(e.map((u,f)=>[u,f])),a=e.map(()=>new Map),s=e.map(()=>0);for(const u of t){const f=n.get(u.source),m=n.get(u.target);if(f===void 0||m===void 0)continue;const p=(o=u.weight)!=null?o:1;if(f===m){s[f]+=p;continue}a[f].set(m,((l=a[f].get(m))!=null?l:0)+p),a[m].set(f,((c=a[m].get(f))!=null?c:0)+p)}return{id:[...e],adj:a,selfLoop:s}}function VI(e,t){var u;const n=e.id.length,a=e.adj.map((f,m)=>{let p=2*e.selfLoop[m];for(const y of f.values())p+=y;return p}),s=a.reduce((f,m)=>f+m,0),o=Array.from({length:n},(f,m)=>m),l=[...a];let c=!1;if(s===0)return{comm:o,moved:!1};for(let f=0;f<t;f++){let m=!1;for(let p=0;p<n;p++){const y=o[p];l[y]-=a[p];const v=new Map([[y,0]]);for(const[w,C]of e.adj[p]){const N=o[w];v.set(N,((u=v.get(N))!=null?u:0)+C)}let x=y,b=-1/0;for(const[w,C]of v){const N=C-l[w]*a[p]/s;(N>b||N===b&&w<x)&&(b=N,x=w)}o[p]=x,l[x]+=a[p],x!==y&&(m=!0)}if(m)c=!0;else break}return{comm:o,moved:c}}function GI(e,t,n){var f,m;const a=new Map;for(let p=0;p<e.id.length;p++){const y=t[p];a.has(y)||a.set(y,[]),a.get(y).push(e.id[p])}const s=new Map,o=new Map;for(const[p,y]of a){y.sort();const v=`cluster-L${n}-${y[0]}`;s.set(p,v),o.set(v,y)}const l=[...a.keys()].sort((p,y)=>{const v=s.get(p),x=s.get(y);return v<x?-1:v>x?1:0}),c=new Map(l.map((p,y)=>[p,y])),u={id:l.map(p=>s.get(p)),adj:l.map(()=>new Map),selfLoop:l.map(()=>0)};for(let p=0;p<e.id.length;p++){const y=c.get(t[p]);u.selfLoop[y]+=e.selfLoop[p];for(const[v,x]of e.adj[p]){if(v<=p)continue;const b=c.get(t[v]);y===b?u.selfLoop[y]+=x:(u.adj[y].set(b,((f=u.adj[y].get(b))!=null?f:0)+x),u.adj[b].set(y,((m=u.adj[b].get(y))!=null?m:0)+x))}}return{coarse:u,membersOf:o}}function YI(e,t,n={}){var p,y;const a=(p=n.maxLevels)!=null?p:PI,s=(y=n.maxLocalPasses)!=null?y:HI,o="cluster-root";if(e.length===0)return{id:o,children:[]};let l=new Map,c=qI(e,t),u=0,f=[...e];for(;u<a;){const{comm:v,moved:x}=VI(c,s);if(!x)break;const{coarse:b,membersOf:w}=GI(c,v,u);if(b.id.length===c.id.length)break;const C=new Map;for(const[N,k]of w){const M=k.map(D=>{var j;return(j=l.get(D))!=null?j:{id:D}});C.set(N,{id:N,children:M})}l=C,f=b.id,c=b,u++}const m=f.map(v=>{var x;return(x=l.get(v))!=null?x:{id:v}});return{id:o,children:m}}function XI(e){var t=0,n=e.children,a=n&&n.length;if(!a)t=1;else for(;--a>=0;)t+=n[a].value;e.value=t}function KI(){return this.eachAfter(XI)}function QI(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function ZI(e,t){for(var n=this,a=[n],s,o,l=-1;n=a.pop();)if(e.call(t,n,++l,this),s=n.children)for(o=s.length-1;o>=0;--o)a.push(s[o]);return this}function JI(e,t){for(var n=this,a=[n],s=[],o,l,c,u=-1;n=a.pop();)if(s.push(n),o=n.children)for(l=0,c=o.length;l<c;++l)a.push(o[l]);for(;n=s.pop();)e.call(t,n,++u,this);return this}function WI(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function e6(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,a=t.children,s=a&&a.length;--s>=0;)n+=a[s].value;t.value=n})}function t6(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function n6(e){for(var t=this,n=a6(t,e),a=[t];t!==n;)t=t.parent,a.push(t);for(var s=a.length;e!==n;)a.splice(s,0,e),e=e.parent;return a}function a6(e,t){if(e===t)return e;var n=e.ancestors(),a=t.ancestors(),s=null;for(e=n.pop(),t=a.pop();e===t;)s=e,e=n.pop(),t=a.pop();return s}function i6(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function s6(){return Array.from(this)}function r6(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function o6(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*l6(){var e=this,t,n=[e],a,s,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,a=e.children)for(s=0,o=a.length;s<o;++s)n.push(a[s]);while(n.length)}function Wu(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=d6)):t===void 0&&(t=u6);for(var n=new Bu(e),a,s=[n],o,l,c,u;a=s.pop();)if((l=t(a.data))&&(u=(l=Array.from(l)).length))for(a.children=l,c=u-1;c>=0;--c)s.push(o=l[c]=new Bu(l[c])),o.parent=a,o.depth=a.depth+1;return n.eachBefore(h6)}function c6(){return Wu(this).eachBefore(f6)}function u6(e){return e.children}function d6(e){return Array.isArray(e)?e[1]:null}function f6(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function h6(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Bu(e){this.data=e,this.depth=this.height=0,this.parent=null}Bu.prototype=Wu.prototype={constructor:Bu,count:KI,each:QI,eachAfter:JI,eachBefore:ZI,find:WI,sum:e6,sort:t6,path:n6,ancestors:i6,descendants:s6,leaves:r6,links:o6,copy:c6,[Symbol.iterator]:l6};function p6(e){return e==null?null:m6(e)}function m6(e){if(typeof e!="function")throw new Error;return e}function bw(){return 0}function g6(e){return function(){return e}}const y6=1664525,v6=1013904223,_w=4294967296;function n1(){let e=1;return()=>(e=(y6*e+v6)%_w)/_w}function x6(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function b6(e,t){let n=e.length,a,s;for(;n;)s=t()*n--|0,a=e[n],e[n]=e[s],e[s]=a;return e}function sN(e){return rN(e,n1())}function rN(e,t){for(var n=0,a=(e=b6(Array.from(e),t)).length,s=[],o,l;n<a;)o=e[n],l&&oN(l,o)?++n:(l=w6(s=_6(s,o)),n=0);return l}function _6(e,t){var n,a;if(Dg(t,e))return[t];for(n=0;n<e.length;++n)if(Df(t,e[n])&&Dg(xu(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(a=n+1;a<e.length;++a)if(Df(xu(e[n],e[a]),t)&&Df(xu(e[n],t),e[a])&&Df(xu(e[a],t),e[n])&&Dg(lN(e[n],e[a],t),e))return[e[n],e[a],t];throw new Error}function Df(e,t){var n=e.r-t.r,a=t.x-e.x,s=t.y-e.y;return n<0||n*n<a*a+s*s}function oN(e,t){var n=e.r-t.r+Math.max(e.r,t.r,1)*1e-9,a=t.x-e.x,s=t.y-e.y;return n>0&&n*n>a*a+s*s}function Dg(e,t){for(var n=0;n<t.length;++n)if(!oN(e,t[n]))return!1;return!0}function w6(e){switch(e.length){case 1:return S6(e[0]);case 2:return xu(e[0],e[1]);case 3:return lN(e[0],e[1],e[2])}}function S6(e){return{x:e.x,y:e.y,r:e.r}}function xu(e,t){var n=e.x,a=e.y,s=e.r,o=t.x,l=t.y,c=t.r,u=o-n,f=l-a,m=c-s,p=Math.sqrt(u*u+f*f);return{x:(n+o+u/p*m)/2,y:(a+l+f/p*m)/2,r:(p+s+c)/2}}function lN(e,t,n){var a=e.x,s=e.y,o=e.r,l=t.x,c=t.y,u=t.r,f=n.x,m=n.y,p=n.r,y=a-l,v=a-f,x=s-c,b=s-m,w=u-o,C=p-o,N=a*a+s*s-o*o,k=N-l*l-c*c+u*u,M=N-f*f-m*m+p*p,D=v*x-y*b,j=(x*M-b*k)/(D*2)-a,A=(b*w-x*C)/D,O=(v*k-y*M)/(D*2)-s,R=(y*C-v*w)/D,E=A*A+R*R-1,I=2*(o+j*A+O*R),L=j*j+O*O-o*o,H=-(Math.abs(E)>1e-6?(I+Math.sqrt(I*I-4*E*L))/(2*E):L/I);return{x:a+j+A*H,y:s+O+R*H,r:H}}function ww(e,t,n){var a=e.x-t.x,s,o,l=e.y-t.y,c,u,f=a*a+l*l;f?(o=t.r+n.r,o*=o,u=e.r+n.r,u*=u,o>u?(s=(f+u-o)/(2*f),c=Math.sqrt(Math.max(0,u/f-s*s)),n.x=e.x-s*a-c*l,n.y=e.y-s*l+c*a):(s=(f+o-u)/(2*f),c=Math.sqrt(Math.max(0,o/f-s*s)),n.x=t.x+s*a-c*l,n.y=t.y+s*l+c*a)):(n.x=t.x+n.r,n.y=t.y)}function Sw(e,t){var n=e.r+t.r-1e-6,a=t.x-e.x,s=t.y-e.y;return n>0&&n*n>a*a+s*s}function Cw(e){var t=e._,n=e.next._,a=t.r+n.r,s=(t.x*n.r+n.x*t.r)/a,o=(t.y*n.r+n.y*t.r)/a;return s*s+o*o}function Lf(e){this._=e,this.next=null,this.previous=null}function cN(e,t){if(!(o=(e=x6(e)).length))return 0;var n,a,s,o,l,c,u,f,m,p,y;if(n=e[0],n.x=0,n.y=0,!(o>1))return n.r;if(a=e[1],n.x=-a.r,a.x=n.r,a.y=0,!(o>2))return n.r+a.r;ww(a,n,s=e[2]),n=new Lf(n),a=new Lf(a),s=new Lf(s),n.next=s.previous=a,a.next=n.previous=s,s.next=a.previous=n;e:for(u=3;u<o;++u){ww(n._,a._,s=e[u]),s=new Lf(s),f=a.next,m=n.previous,p=a._.r,y=n._.r;do if(p<=y){if(Sw(f._,s._)){a=f,n.next=a,a.previous=n,--u;continue e}p+=f._.r,f=f.next}else{if(Sw(m._,s._)){n=m,n.next=a,a.previous=n,--u;continue e}y+=m._.r,m=m.previous}while(f!==m.next);for(s.previous=n,s.next=a,n.next=a.previous=a=s,l=Cw(n);(s=s.next)!==a;)(c=Cw(s))<l&&(n=s,l=c);a=n.next}for(n=[a._],s=a;(s=s.next)!==a;)n.push(s._);for(s=rN(n,t),u=0;u<o;++u)n=e[u],n.x-=s.x,n.y-=s.y;return s.r}function Ly(e){return cN(e,n1()),e}function C6(e){return Math.sqrt(e.value)}function N6(){var e=null,t=1,n=1,a=bw;function s(o){const l=n1();return o.x=t/2,o.y=n/2,e?o.eachBefore(Nw(e)).eachAfter(Lg(a,.5,l)).eachBefore(kw(1)):o.eachBefore(Nw(C6)).eachAfter(Lg(bw,1,l)).eachAfter(Lg(a,o.r/Math.min(t,n),l)).eachBefore(kw(Math.min(t,n)/(2*o.r))),o}return s.radius=function(o){return arguments.length?(e=p6(o),s):e},s.size=function(o){return arguments.length?(t=+o[0],n=+o[1],s):[t,n]},s.padding=function(o){return arguments.length?(a=typeof o=="function"?o:g6(+o),s):a},s}function Nw(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function Lg(e,t,n){return function(a){if(s=a.children){var s,o,l=s.length,c=e(a)*t||0,u;if(c)for(o=0;o<l;++o)s[o].r+=c;if(u=cN(s,n),c)for(o=0;o<l;++o)s[o].r-=c;a.r=u+c}}}function kw(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function k6(e,t){return e.parent===t.parent?1:2}function Og(e){var t=e.children;return t?t[0]:e.t}function Ig(e){var t=e.children;return t?t[t.length-1]:e.t}function M6(e,t,n){var a=n/(t.i-e.i);t.c-=a,t.s+=n,e.c+=a,t.z+=n,t.m+=n}function j6(e){for(var t=0,n=0,a=e.children,s=a.length,o;--s>=0;)o=a[s],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function E6(e,t,n){return e.a.parent===t.parent?e.a:n}function Qf(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Qf.prototype=Object.create(Bu.prototype);function R6(e){for(var t=new Qf(e,0),n,a=[t],s,o,l,c;n=a.pop();)if(o=n._.children)for(n.children=new Array(c=o.length),l=c-1;l>=0;--l)a.push(s=n.children[l]=new Qf(o[l],l)),s.parent=n;return(t.parent=new Qf(null,0)).children=[t],t}function uN(){var e=k6,t=1,n=1,a=null;function s(f){var m=R6(f);if(m.eachAfter(o),m.parent.m=-m.z,m.eachBefore(l),a)f.eachBefore(u);else{var p=f,y=f,v=f;f.eachBefore(function(N){N.x<p.x&&(p=N),N.x>y.x&&(y=N),N.depth>v.depth&&(v=N)});var x=p===y?1:e(p,y)/2,b=x-p.x,w=t/(y.x+x+b),C=n/(v.depth||1);f.eachBefore(function(N){N.x=(N.x+b)*w,N.y=N.depth*C})}return f}function o(f){var m=f.children,p=f.parent.children,y=f.i?p[f.i-1]:null;if(m){j6(f);var v=(m[0].z+m[m.length-1].z)/2;y?(f.z=y.z+e(f._,y._),f.m=f.z-v):f.z=v}else y&&(f.z=y.z+e(f._,y._));f.parent.A=c(f,y,f.parent.A||p[0])}function l(f){f._.x=f.z+f.parent.m,f.m+=f.parent.m}function c(f,m,p){if(m){for(var y=f,v=f,x=m,b=y.parent.children[0],w=y.m,C=v.m,N=x.m,k=b.m,M;x=Ig(x),y=Og(y),x&&y;)b=Og(b),v=Ig(v),v.a=f,M=x.z+N-y.z-w+e(x._,y._),M>0&&(M6(E6(x,f,p),f,M),w+=M,C+=M),N+=x.m,w+=y.m,k+=b.m,C+=v.m;x&&!Ig(v)&&(v.t=x,v.m+=N-C),y&&!Og(b)&&(b.t=y,b.m+=w-k,p=f)}return p}function u(f){f.x*=t,f.y=f.depth*n}return s.separation=function(f){return arguments.length?(e=f,s):e},s.size=function(f){return arguments.length?(a=!1,t=+f[0],n=+f[1],s):a?null:[t,n]},s.nodeSize=function(f){return arguments.length?(a=!0,t=+f[0],n=+f[1],s):a?[t,n]:null},s}const T6=6;function A6(e,t){const{radiusOf:n,padding:a=T6}=t,s=N6().radius(c=>c.children?0:n(c.data.id));typeof a=="function"?s.padding(c=>a(c.depth)):s.padding(a);const o=s(Wu(e)),l=new Map;return o.each(c=>{l.set(c.data.id,{x:c.x,y:c.y,r:c.r})}),l}function Oy(e,t,n={}){var k,M,D;var a,s;const{iterations:o=300,springLength:l=160,springStrength:c=.04,repulsion:u=8e3,damping:f=.85,centerStrength:m=.005,collisionStrength:p=.3,nodeMargin:y}=n;if(e.length===0)return new Map;const v=j=>y!=null?y:j.width,x=(j,A)=>Math.max(l,(Math.hypot(j.width,j.height)+Math.hypot(A.width,A.height))/2*1.1+(v(j)+v(A))/2),b=new Map(e.map(j=>[j.id,0])),w=new Map(e.map(j=>[j.id,0])),C=new Map(e.map(j=>[j.id,{x:j.x,y:j.y}])),N=new Map(e.map(j=>[j.id,j]));for(let j=0;j<o;j++){for(let A=0;A<e.length;A++)for(let O=A+1;O<e.length;O++){const R=e[A],E=e[O];if(R.pinned&&E.pinned)continue;const I=C.get(R.id),L=C.get(E.id),H=L.x-I.x||.1,U=L.y-I.y||.1,$=Math.max(Math.hypot(H,U),1),P=u/($*$),G=H/$*P,K=U/$*P;R.pinned||(b.set(R.id,b.get(R.id)-G),w.set(R.id,w.get(R.id)-K)),E.pinned||(b.set(E.id,b.get(E.id)+G),w.set(E.id,w.get(E.id)+K));const se=R.width+v(R),V=E.width+v(E),re=R.height+v(R),fe=E.height+v(E),B=(se+V)/2-Math.abs(H),W=(re+fe)/2-Math.abs(U);if(B>0&&W>0){const ae=Math.min(B,W)*p,J=H/$*ae,le=U/$*ae;R.pinned||(b.set(R.id,b.get(R.id)-J),w.set(R.id,w.get(R.id)-le)),E.pinned||(b.set(E.id,b.get(E.id)+J),w.set(E.id,w.get(E.id)+le))}}for(const A of t){const O=N.get(A.source),R=N.get(A.target);if(!O||!R||O.pinned&&R.pinned)continue;const E=C.get(O.id),I=C.get(R.id),L=I.x-E.x||.1,H=I.y-E.y||.1,U=Math.max(Math.hypot(L,H),1),$=c*(U-x(O,R)),P=L/U*$,G=H/U*$;O.pinned||(b.set(O.id,b.get(O.id)+P),w.set(O.id,w.get(O.id)+G)),R.pinned||(b.set(R.id,b.get(R.id)-P),w.set(R.id,w.get(R.id)-G))}for(const A of e){if(A.pinned)continue;const O=C.get(A.id),R=(k=(a=A.gravityTarget)==null?void 0:a.x)!=null?k:0,E=(M=(s=A.gravityTarget)==null?void 0:s.y)!=null?M:0,I=(D=A.gravityStrength)!=null?D:1,L=(b.get(A.id)-(O.x-R)*m*I)*f,H=(w.get(A.id)-(O.y-E)*m*I)*f;b.set(A.id,L),w.set(A.id,H),C.set(A.id,{x:O.x+L,y:O.y+H})}}return O6(e,t,C,b,w,N,{restLength:x,springStrength:c,damping:f}),C}const D6=40,L6=3,a1=400,gh=6;function O6(e,t,n,a,s,o,l){for(let c=0;c<D6;c++){Uu(e,n);for(let u=0;u<L6;u++)U6(e,t,n,a,s,o,l)}for(let c=0;c<a1&&Uu(e,n);c++);}function Uu(e,t){let n=!1;const a=new Map(e.map(s=>[s.id,{x:0,y:0}]));for(let s=0;s<e.length;s++)for(let o=s+1;o<e.length;o++){const l=e[s],c=e[o];if(l.pinned&&c.pinned)continue;const u=t.get(l.id),f=t.get(c.id),m=f.x-u.x,p=f.y-u.y,y=(l.width+c.width)/2-Math.abs(m),v=(l.height+c.height)/2-Math.abs(p);if(y<=0||v<=0)continue;n=!0;let x=0,b=0;y<v?x=(m>=0?1:-1)*y:b=(p>=0?1:-1)*v;let w=x/2,C=b/2;const N=Math.hypot(w,C);if(N>gh){const k=gh/N;w*=k,C*=k}l.pinned?(a.get(c.id).x+=w*2,a.get(c.id).y+=C*2):c.pinned?(a.get(l.id).x-=w*2,a.get(l.id).y-=C*2):(a.get(l.id).x-=w,a.get(l.id).y-=C,a.get(c.id).x+=w,a.get(c.id).y+=C)}for(const s of e){if(s.pinned)continue;const o=a.get(s.id);if(o.x===0&&o.y===0)continue;const l=t.get(s.id);t.set(s.id,{x:l.x+o.x,y:l.y+o.y})}return n}const Mw=$a(2,14),I6=$a(2,15),bu=$a(2,25),z6=2*bu+1;class B6{constructor(t,n,a){Ot(this,"stats",{passes:0,pairChecks:0}),Ot(this,"finished",!1),Ot(this,"plain",!1),Ot(this,"n"),Ot(this,"px"),Ot(this,"py"),Ot(this,"w"),Ot(this,"h"),Ot(this,"isPinned"),Ot(this,"cellX"),Ot(this,"cellY"),Ot(this,"cellW"),Ot(this,"cellH"),Ot(this,"originX",0),Ot(this,"originY",0),Ot(this,"wide",!1),Ot(this,"grid",new Map),Ot(this,"hits",new Float64Array(1024)),Ot(this,"hitCount",0),Ot(this,"isMover"),Ot(this,"mx"),Ot(this,"my"),Ot(this,"overlapping",[]),Ot(this,"moved"),Ot(this,"nodes"),Ot(this,"pos"),Ot(this,"maxPasses"),this.nodes=t,this.pos=n,this.maxPasses=a;const s=this.n=t.length;this.px=new Float64Array(s),this.py=new Float64Array(s),this.w=new Float64Array(s),this.h=new Float64Array(s),this.isPinned=new Uint8Array(s),this.cellX=new Float64Array(s),this.cellY=new Float64Array(s),this.mx=new Float64Array(s),this.my=new Float64Array(s),this.isMover=new Uint8Array(s);let o=0,l=0;const c=new Set;for(let u=0;u<s;u++){const f=t[u],m=n.get(f.id);if(!(m!==void 0&&!c.has(f.id)&&Number.isFinite(m.x)&&Number.isFinite(m.y)&&Number.isFinite(f.width)&&Number.isFinite(f.height)&&f.width>=0&&f.height>=0)){this.plain=!0;break}c.add(f.id),this.px[u]=m.x,this.py[u]=m.y,this.w[u]=f.width,this.h[u]=f.height,this.isPinned[u]=f.pinned?1:0,o=Math.max(o,f.width),l=Math.max(l,f.height)}if(this.cellW=o*1.01+1,this.cellH=l*1.01+1,!this.plain&&s>0){this.originX=Math.floor(this.px[0]/this.cellW),this.originY=Math.floor(this.py[0]/this.cellH);for(let u=0;u<s&&!this.plain;u++)this.locate(u)||(this.plain=!0);if(!this.plain)for(let u=0;u<s;u++)this.insert(u)}}get done(){return this.finished}run(t=1/0){const n=this.stats.pairChecks;for(;!this.finished&&this.stats.pairChecks-n<t;){if(this.stats.passes>=this.maxPasses){this.finished=!0;break}if(this.stats.passes++,this.plain){this.stats.pairChecks+=this.n*(this.n-1)/2,Uu(this.nodes,this.pos)||(this.finished=!0);continue}this.pass()}return this.finished}keyOf(t,n){return this.wide?(t+bu)*z6+(n+bu):(t-this.originX)*I6+(n-this.originY)}locate(t){const n=Math.floor(this.px[t]/this.cellW),a=Math.floor(this.py[t]/this.cellH);return Math.abs(n)<bu-1&&Math.abs(a)<bu-1?((Math.abs(n-this.originX)>=Mw-1||Math.abs(a-this.originY)>=Mw-1)&&(this.wide=!0),this.cellX[t]=n,this.cellY[t]=a,!0):!1}insert(t){const n=this.keyOf(this.cellX[t],this.cellY[t]),a=this.grid.get(n);a?a.push(t):this.grid.set(n,[t])}remove(t){const n=this.grid.get(this.keyOf(this.cellX[t],this.cellY[t]));n.splice(n.indexOf(t),1)}test(t,n){if(this.isPinned[t]&&this.isPinned[n])return;this.stats.pairChecks++;const{px:a,py:s,w:o,h:l}=this;if(!((o[t]+o[n])/2-Math.abs(a[n]-a[t])<=0||(l[t]+l[n])/2-Math.abs(s[n]-s[t])<=0)){if(this.hitCount===this.hits.length){const c=new Float64Array(this.hits.length*2);c.set(this.hits),this.hits=c}this.hits[this.hitCount++]=t*this.n+n}}testNeighbours(t,n){const a=this.cellX[t],s=this.cellY[t];for(let o=a-1;o<=a+1;o++)for(let l=s-1;l<=s+1;l++){const c=this.grid.get(this.keyOf(o,l));if(c)for(const u of c)u===t||n(u)||(t<u?this.test(t,u):this.test(u,t))}}pass(){const{n:t,px:n,py:a,w:s,h:o,isPinned:l,mx:c,my:u}=this;this.hitCount=0;const f=this.moved;if(f){const b=this.isMover;for(const w of f)b[w]=1;for(const w of this.overlapping){let C=Math.floor(w/t);C*t>w&&C--;const N=w-C*t;!b[C]&&!b[N]&&this.test(C,N)}for(const w of f)this.testNeighbours(w,C=>b[C]===1&&C<w);for(const w of f)b[w]=0}else for(let b=0;b<t;b++)this.testNeighbours(b,w=>w<b);const m=this.hits.subarray(0,this.hitCount).sort(),p=[],y=[];for(let b=0;b<m.length;b++){const w=m[b];let C=Math.floor(w/t);C*t>w&&C--;const N=w-C*t;p.push(w);const k=n[N]-n[C],M=a[N]-a[C],D=(s[C]+s[N])/2-Math.abs(k),j=(o[C]+o[N])/2-Math.abs(M);let A=0,O=0;D<j?A=(k>=0?1:-1)*D:O=(M>=0?1:-1)*j;let R=A/2,E=O/2;const I=Math.hypot(R,E);if(I>gh){const L=gh/I;R*=L,E*=L}y.push(C,N),l[C]?(c[N]+=R*2,u[N]+=E*2):l[N]?(c[C]-=R*2,u[C]-=E*2):(c[C]-=R,u[C]-=E,c[N]+=R,u[N]+=E)}const v=[];for(const b of y){if(l[b]||c[b]===0&&u[b]===0)continue;const w=n[b]+c[b],C=a[b]+u[b];c[b]=0,u[b]=0,this.pos.set(this.nodes[b].id,{x:w,y:C}),!(w===n[b]&&C===a[b])&&(n[b]=w,a[b]=C,v.push(b))}for(const b of y)c[b]=0,u[b]=0;if(this.overlapping=p,this.moved=v,p.length===0||v.length===0){this.finished=!0;return}for(const b of v)this.remove(b);const x=this.wide;for(const b of v)if(!this.locate(b)){this.plain=!0;return}if(this.wide===x)for(const b of v)this.insert(b);else{this.grid.clear();for(let b=0;b<t;b++)this.insert(b)}}}function U6(e,t,n,a,s,o,{restLength:l,springStrength:c,damping:u}){for(const f of t){const m=o.get(f.source),p=o.get(f.target);if(!m||!p||m.pinned&&p.pinned)continue;const y=n.get(m.id),v=n.get(p.id),x=v.x-y.x||.1,b=v.y-y.y||.1,w=Math.max(Math.hypot(x,b),1),C=c*(w-l(m,p)),N=x/w*C,k=b/w*C;m.pinned||(a.set(m.id,a.get(m.id)+N),s.set(m.id,s.get(m.id)+k)),p.pinned||(a.set(p.id,a.get(p.id)-N),s.set(p.id,s.get(p.id)-k))}for(const f of e){if(f.pinned)continue;const m=n.get(f.id),p=a.get(f.id)*u,y=s.get(f.id)*u;a.set(f.id,p),s.set(f.id,y),n.set(f.id,{x:m.x+p,y:m.y+y})}}const F6=1.2,$6=160,P6=160,H6=8e3,q6=8,V6=60;function G6(e){const t=new Map,n=(a,s)=>{if(!a.children){t.set(a.id,s);return}for(const o of a.children)n(o,s)};for(const a of e)n(a,a.id);return t}function Y6(e,t,n={}){var $,P,G,K,se,V,re,fe,B,W;var a,s,o,l,c,u,f;if(e.length===0)return{positions:new Map,clusterBoundaries:new Map};const m=new Map(e.map(ae=>[ae.id,ae])),p=YI(e.map(ae=>ae.id),t),y=ae=>{const J=m.get(ae);return J?Math.hypot(J.width,J.height)/2:20},v=A6(p,{radiusOf:y,padding:n.clusterPadding}),x=($=p.children)!=null?$:[],b=G6(x),w=ae=>{var J;return(J=b.get(ae))!=null?J:ae},C=new Map;for(const ae of e){const J=w(ae.id);C.has(J)||C.set(J,[]),C.get(J).push(ae)}const N=new Map;for(const ae of t){if(!m.has(ae.source)||!m.has(ae.target))continue;const J=w(ae.source);J===w(ae.target)&&(N.has(J)||N.set(J,[]),N.get(J).push(ae))}const k=new Map,M=new Map;for(const[ae,J]of C){const le=v.get(ae),be=J.map(xe=>{const ze=v.get(xe.id);return Z(F({},xe),{pinned:!1,gravityTarget:void 0,gravityStrength:void 0,x:ze&&le&&ze!==le?ze.x-le.x:0,y:ze&&le&&ze!==le?ze.y-le.y:0})}),je=Oy(be,(P=N.get(ae))!=null?P:[],n);let De=1/0,Ae=-1/0,Xe=1/0,Fe=-1/0;for(const xe of J){const ze=je.get(xe.id);De=Math.min(De,ze.x-xe.width/2),Ae=Math.max(Ae,ze.x+xe.width/2),Xe=Math.min(Xe,ze.y-xe.height/2),Fe=Math.max(Fe,ze.y+xe.height/2)}const me=(De+Ae)/2,Q=(Xe+Fe)/2;let ue=0;for(const xe of J){const ze=je.get(xe.id),X={x:ze.x-me,y:ze.y-Q};je.set(xe.id,X),ue=Math.max(ue,Math.hypot(X.x,X.y)+y(xe.id))}k.set(ae,je),M.set(ae,ue)}const D=[...C.keys()].map(ae=>{var be;const J=(be=v.get(ae))!=null?be:{x:0,y:0},le=M.get(ae);return{id:ae,x:J.x,y:J.y,width:le*2,height:le*2}}),j=new Map,A=[];for(const ae of t){if(!m.has(ae.source)||!m.has(ae.target))continue;const J=w(ae.source),le=w(ae.target);if(J===le)continue;const be=J<le?`${J}\0${le}`:`${le}\0${J}`,je=(G=j.get(be))!=null?G:0;je>=q6||(j.set(be,je+1),A.push({source:J,target:le}))}const O=D.reduce((ae,J)=>Math.max(ae,J.width),0),R=(K=(a=n.macro)==null?void 0:a.springLength)!=null?K:Math.max(O*F6,$6),E=$a(R/P6,2),I={iterations:(se=(s=n.macro)==null?void 0:s.iterations)!=null?se:300,springLength:R,springStrength:(V=(o=n.macro)==null?void 0:o.springStrength)!=null?V:.04,repulsion:(re=(l=n.macro)==null?void 0:l.repulsion)!=null?re:H6*E,damping:(fe=(c=n.macro)==null?void 0:c.damping)!=null?fe:.85,centerStrength:(B=(u=n.macro)==null?void 0:u.centerStrength)!=null?B:.005,nodeMargin:(W=(f=n.macro)==null?void 0:f.nodeMargin)!=null?W:V6},L=Oy(D,A,I);K6(k,L,t,w,m);const H=new Map;for(const[ae,J]of k){const le=L.get(ae);for(const[be,je]of J)H.set(be,{x:le.x+je.x,y:le.y+je.y})}for(const ae of e)ae.pinned&&H.set(ae.id,{x:ae.x,y:ae.y});for(let ae=0;ae<a1&&Uu(e,H);ae++);const U=Q6(e,H,b,y);return{positions:H,clusterBoundaries:U}}const jw=24,X6=2;function K6(e,t,n,a,s){const o=new Map;for(const c of n){if(!s.has(c.source)||!s.has(c.target))continue;const u=a(c.source),f=a(c.target);u!==f&&(o.has(u)||o.set(u,[]),o.has(f)||o.set(f,[]),o.get(u).push([c.source,c.target,f]),o.get(f).push([c.target,c.source,u]))}const l=(c,u)=>{const f=t.get(c),m=e.get(c).get(u);return{x:f.x+m.x,y:f.y+m.y}};for(let c=0;c<X6;c++)for(const[u,f]of o){const m=e.get(u);if(m.size<2)continue;const p=t.get(u),y=f.map(([x,b,w])=>({own:x,at:l(w,b)}));let v={cos:1,sin:0,mirror:1,cost:1/0};for(const x of[1,-1])for(let b=0;b<jw;b++){const w=2*Math.PI*b/jw,C=Math.cos(w),N=Math.sin(w);let k=0;for(const{own:M,at:D}of y){const j=m.get(M),A=j.x*x;k+=Math.hypot(p.x+A*C-j.y*N-D.x,p.y+A*N+j.y*C-D.y)}k<v.cost-1e-6&&(v={cos:C,sin:N,mirror:x,cost:k})}if(!(v.cos===1&&v.mirror===1))for(const[x,b]of m){const w=b.x*v.mirror;m.set(x,{x:w*v.cos-b.y*v.sin,y:w*v.sin+b.y*v.cos})}}}function Q6(e,t,n,a,s=!1){const o=new Map;for(const c of e){const u=n.get(c.id);u&&(o.has(u)||o.set(u,[]),o.get(u).push(c))}const l=new Map;for(const[c,u]of o){let f,m;const p=s?t.get(c):void 0;if(p)f=p.x,m=p.y;else{f=0,m=0;for(const v of u){const x=t.get(v.id);x&&(f+=x.x,m+=x.y)}f/=u.length,m/=u.length}let y=0;for(const v of u){const x=t.get(v.id);x&&(y=Math.max(y,Math.hypot(x.x-f,x.y-m)+a(v.id)))}l.set(c,{x:f,y:m,r:y})}return l}const Rs=11102230246251565e-32,Jn=134217729,Z6=(3+8*Rs)*Rs;function zg(e,t,n,a,s){let o,l,c,u,f=t[0],m=a[0],p=0,y=0;m>f==m>-f?(o=f,f=t[++p]):(o=m,m=a[++y]);let v=0;if(p<e&&y<n)for(m>f==m>-f?(l=f+o,c=o-(l-f),f=t[++p]):(l=m+o,c=o-(l-m),m=a[++y]),o=l,c!==0&&(s[v++]=c);p<e&&y<n;)m>f==m>-f?(l=o+f,u=l-o,c=o-(l-u)+(f-u),f=t[++p]):(l=o+m,u=l-o,c=o-(l-u)+(m-u),m=a[++y]),o=l,c!==0&&(s[v++]=c);for(;p<e;)l=o+f,u=l-o,c=o-(l-u)+(f-u),f=t[++p],o=l,c!==0&&(s[v++]=c);for(;y<n;)l=o+m,u=l-o,c=o-(l-u)+(m-u),m=a[++y],o=l,c!==0&&(s[v++]=c);return(o!==0||v===0)&&(s[v++]=o),v}function J6(e,t){let n=t[0];for(let a=1;a<e;a++)n+=t[a];return n}function ed(e){return new Float64Array(e)}const W6=(3+16*Rs)*Rs,e5=(2+12*Rs)*Rs,t5=(9+64*Rs)*Rs*Rs,Rl=ed(4),Ew=ed(8),Rw=ed(12),Tw=ed(16),ca=ed(4);function n5(e,t,n,a,s,o,l){let c,u,f,m,p,y,v,x,b,w,C,N,k,M,D,j,A,O;const R=e-s,E=n-s,I=t-o,L=a-o;M=R*L,y=Jn*R,v=y-(y-R),x=R-v,y=Jn*L,b=y-(y-L),w=L-b,D=x*w-(M-v*b-x*b-v*w),j=I*E,y=Jn*I,v=y-(y-I),x=I-v,y=Jn*E,b=y-(y-E),w=E-b,A=x*w-(j-v*b-x*b-v*w),C=D-A,p=D-C,Rl[0]=D-(C+p)+(p-A),N=M+C,p=N-M,k=M-(N-p)+(C-p),C=k-j,p=k-C,Rl[1]=k-(C+p)+(p-j),O=N+C,p=O-N,Rl[2]=N-(O-p)+(C-p),Rl[3]=O;let H=J6(4,Rl),U=e5*l;if(H>=U||-H>=U||(p=e-R,c=e-(R+p)+(p-s),p=n-E,f=n-(E+p)+(p-s),p=t-I,u=t-(I+p)+(p-o),p=a-L,m=a-(L+p)+(p-o),c===0&&u===0&&f===0&&m===0)||(U=t5*l+Z6*Math.abs(H),H+=R*m+L*c-(I*f+E*u),H>=U||-H>=U))return H;M=c*L,y=Jn*c,v=y-(y-c),x=c-v,y=Jn*L,b=y-(y-L),w=L-b,D=x*w-(M-v*b-x*b-v*w),j=u*E,y=Jn*u,v=y-(y-u),x=u-v,y=Jn*E,b=y-(y-E),w=E-b,A=x*w-(j-v*b-x*b-v*w),C=D-A,p=D-C,ca[0]=D-(C+p)+(p-A),N=M+C,p=N-M,k=M-(N-p)+(C-p),C=k-j,p=k-C,ca[1]=k-(C+p)+(p-j),O=N+C,p=O-N,ca[2]=N-(O-p)+(C-p),ca[3]=O;const $=zg(4,Rl,4,ca,Ew);M=R*m,y=Jn*R,v=y-(y-R),x=R-v,y=Jn*m,b=y-(y-m),w=m-b,D=x*w-(M-v*b-x*b-v*w),j=I*f,y=Jn*I,v=y-(y-I),x=I-v,y=Jn*f,b=y-(y-f),w=f-b,A=x*w-(j-v*b-x*b-v*w),C=D-A,p=D-C,ca[0]=D-(C+p)+(p-A),N=M+C,p=N-M,k=M-(N-p)+(C-p),C=k-j,p=k-C,ca[1]=k-(C+p)+(p-j),O=N+C,p=O-N,ca[2]=N-(O-p)+(C-p),ca[3]=O;const P=zg($,Ew,4,ca,Rw);M=c*m,y=Jn*c,v=y-(y-c),x=c-v,y=Jn*m,b=y-(y-m),w=m-b,D=x*w-(M-v*b-x*b-v*w),j=u*f,y=Jn*u,v=y-(y-u),x=u-v,y=Jn*f,b=y-(y-f),w=f-b,A=x*w-(j-v*b-x*b-v*w),C=D-A,p=D-C,ca[0]=D-(C+p)+(p-A),N=M+C,p=N-M,k=M-(N-p)+(C-p),C=k-j,p=k-C,ca[1]=k-(C+p)+(p-j),O=N+C,p=O-N,ca[2]=N-(O-p)+(C-p),ca[3]=O;const G=zg(P,Rw,4,ca,Tw);return Tw[G-1]}function Of(e,t,n,a,s,o){const l=(t-o)*(n-s),c=(e-s)*(a-o),u=l-c,f=Math.abs(l+c);return Math.abs(u)>=W6*f?u:-n5(e,t,n,a,s,o,f)}const Aw=Math.pow(2,-52),If=new Uint32Array(512);class yh{static from(t,n=o5,a=l5){const s=t.length,o=new Float64Array(s*2);for(let l=0;l<s;l++){const c=t[l];o[2*l]=n(c),o[2*l+1]=a(c)}return new yh(o)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const a=Math.max(2*n-5,0);this._triangles=new Uint32Array(a*3),this._halfedges=new Int32Array(a*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:a,_hullTri:s,_hullHash:o}=this,l=t.length>>1;let c=1/0,u=1/0,f=-1/0,m=-1/0;for(let R=0;R<l;R++){const E=t[2*R],I=t[2*R+1];E<c&&(c=E),I<u&&(u=I),E>f&&(f=E),I>m&&(m=I),this._ids[R]=R}const p=(c+f)/2,y=(u+m)/2;let v=0,x=0,b=0;for(let R=0,E=1/0;R<l;R++){const I=Bg(p,y,t[2*R],t[2*R+1]);I<E&&(v=R,E=I)}const w=t[2*v],C=t[2*v+1];for(let R=0,E=1/0;R<l;R++){if(R===v)continue;const I=Bg(w,C,t[2*R],t[2*R+1]);I<E&&I>0&&(x=R,E=I)}let N=t[2*x],k=t[2*x+1],M=1/0;for(let R=0;R<l;R++){if(R===v||R===x)continue;const E=s5(w,C,N,k,t[2*R],t[2*R+1]);E<M&&(b=R,M=E)}let D=t[2*b],j=t[2*b+1];if(M===1/0){for(let I=0;I<l;I++)this._dists[I]=t[2*I]-t[0]||t[2*I+1]-t[1];zl(this._ids,this._dists,0,l-1);const R=new Uint32Array(l);let E=0;for(let I=0,L=-1/0;I<l;I++){const H=this._ids[I],U=this._dists[H];U>L&&(R[E++]=H,L=U)}this.hull=R.subarray(0,E),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Of(w,C,N,k,D,j)<0){const R=x,E=N,I=k;x=b,N=D,k=j,b=R,D=E,j=I}const A=r5(w,C,N,k,D,j);this._cx=A.x,this._cy=A.y;for(let R=0;R<l;R++)this._dists[R]=Bg(t[2*R],t[2*R+1],A.x,A.y);zl(this._ids,this._dists,0,l-1),this._hullStart=v;let O=3;a[v]=n[b]=x,a[x]=n[v]=b,a[b]=n[x]=v,s[v]=0,s[x]=1,s[b]=2,o.fill(-1),o[this._hashKey(w,C)]=v,o[this._hashKey(N,k)]=x,o[this._hashKey(D,j)]=b,this.trianglesLen=0,this._addTriangle(v,x,b,-1,-1,-1);for(let R=0,E=0,I=0;R<this._ids.length;R++){const L=this._ids[R],H=t[2*L],U=t[2*L+1];if(R>0&&Math.abs(H-E)<=Aw&&Math.abs(U-I)<=Aw||(E=H,I=U,L===v||L===x||L===b))continue;let $=0;for(let V=0,re=this._hashKey(H,U);V<this._hashSize&&($=o[(re+V)%this._hashSize],!($!==-1&&$!==a[$]));V++);$=n[$];let P=$,G;for(;G=a[P],Of(H,U,t[2*P],t[2*P+1],t[2*G],t[2*G+1])>=0;)if(P=G,P===$){P=-1;break}if(P===-1)continue;let K=this._addTriangle(P,L,a[P],-1,-1,s[P]);s[L]=this._legalize(K+2),s[P]=K,O++;let se=a[P];for(;G=a[se],Of(H,U,t[2*se],t[2*se+1],t[2*G],t[2*G+1])<0;)K=this._addTriangle(se,L,G,s[L],-1,s[se]),s[L]=this._legalize(K+2),a[se]=se,O--,se=G;if(P===$)for(;G=n[P],Of(H,U,t[2*G],t[2*G+1],t[2*P],t[2*P+1])<0;)K=this._addTriangle(G,L,P,-1,s[P],s[G]),this._legalize(K+2),s[G]=K,a[P]=P,O--,P=G;this._hullStart=n[L]=P,a[P]=n[se]=L,a[L]=se,o[this._hashKey(H,U)]=L,o[this._hashKey(t[2*P],t[2*P+1])]=P}this.hull=new Uint32Array(O);for(let R=0,E=this._hullStart;R<O;R++)this.hull[R]=E,E=a[E];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(a5(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:a,coords:s}=this;let o=0,l=0;for(;;){const c=a[t],u=t-t%3;if(l=u+(t+2)%3,c===-1){if(o===0)break;t=If[--o];continue}const f=c-c%3,m=u+(t+1)%3,p=f+(c+2)%3,y=n[l],v=n[t],x=n[m],b=n[p];if(i5(s[2*y],s[2*y+1],s[2*v],s[2*v+1],s[2*x],s[2*x+1],s[2*b],s[2*b+1])){n[t]=b,n[c]=y;const w=a[p];if(w===-1){let N=this._hullStart;do{if(this._hullTri[N]===p){this._hullTri[N]=t;break}N=this._hullPrev[N]}while(N!==this._hullStart)}this._link(t,w),this._link(c,a[l]),this._link(l,p);const C=f+(c+1)%3;o<If.length&&(If[o++]=C)}else{if(o===0)break;t=If[--o]}}return l}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,a,s,o,l){const c=this.trianglesLen;return this._triangles[c]=t,this._triangles[c+1]=n,this._triangles[c+2]=a,this._link(c,s),this._link(c+1,o),this._link(c+2,l),this.trianglesLen+=3,c}}function a5(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function Bg(e,t,n,a){const s=e-n,o=t-a;return s*s+o*o}function i5(e,t,n,a,s,o,l,c){const u=e-l,f=t-c,m=n-l,p=a-c,y=s-l,v=o-c,x=u*u+f*f,b=m*m+p*p,w=y*y+v*v;return u*(p*w-b*v)-f*(m*w-b*y)+x*(m*v-p*y)<0}function s5(e,t,n,a,s,o){const l=n-e,c=a-t,u=s-e,f=o-t,m=l*l+c*c,p=u*u+f*f,y=.5/(l*f-c*u),v=(f*m-c*p)*y,x=(l*p-u*m)*y;return v*v+x*x}function r5(e,t,n,a,s,o){const l=n-e,c=a-t,u=s-e,f=o-t,m=l*l+c*c,p=u*u+f*f,y=.5/(l*f-c*u),v=e+(f*m-c*p)*y,x=t+(l*p-u*m)*y;return{x:v,y:x}}function zl(e,t,n,a){if(a-n<=20)for(let s=n+1;s<=a;s++){const o=e[s],l=t[o];let c=s-1;for(;c>=n&&t[e[c]]>l;)e[c+1]=e[c--];e[c+1]=o}else{const s=n+a>>1;let o=n+1,l=a;mu(e,s,o),t[e[n]]>t[e[a]]&&mu(e,n,a),t[e[o]]>t[e[a]]&&mu(e,o,a),t[e[n]]>t[e[o]]&&mu(e,n,o);const c=e[o],u=t[c];for(;;){do o++;while(t[e[o]]<u);do l--;while(t[e[l]]>u);if(l<o)break;mu(e,o,l)}e[n+1]=e[l],e[l]=c,a-o+1>=l-n?(zl(e,t,o,a),zl(e,t,n,l-1)):(zl(e,t,n,l-1),zl(e,t,o,a))}}function mu(e,t,n){const a=e[t];e[t]=e[n],e[n]=a}function o5(e){return e[0]}function l5(e){return e[1]}const Dw=1e-6;class _o{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,a){t=+t,n=+n,a=+a;const s=t+a,o=n;if(a<0)throw new Error("negative radius");this._x1===null?this._+=`M${s},${o}`:(Math.abs(this._x1-s)>Dw||Math.abs(this._y1-o)>Dw)&&(this._+="L"+s+","+o),a&&(this._+=`A${a},${a},0,1,1,${t-a},${n}A${a},${a},0,1,1,${this._x1=s},${this._y1=o}`)}rect(t,n,a,s){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+a}v${+s}h${-a}Z`}value(){return this._||null}}class Iy{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class c5{constructor(t,[n,a,s,o]=[0,0,960,500]){if(!((s=+s)>=(n=+n))||!((o=+o)>=(a=+a)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=s,this.xmin=n,this.ymax=o,this.ymin=a,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:a},vectors:s}=this;let o,l;const c=this.circumcenters=this._circumcenters.subarray(0,a.length/3*2);for(let b=0,w=0,C=a.length,N,k;b<C;b+=3,w+=2){const M=a[b]*2,D=a[b+1]*2,j=a[b+2]*2,A=t[M],O=t[M+1],R=t[D],E=t[D+1],I=t[j],L=t[j+1],H=R-A,U=E-O,$=I-A,P=L-O,G=(H*P-U*$)*2;if(Math.abs(G)<1e-9){if(o===void 0){o=l=0;for(const se of n)o+=t[se*2],l+=t[se*2+1];o/=n.length,l/=n.length}const K=1e9*Math.sign((o-A)*P-(l-O)*$);N=(A+I)/2-K*P,k=(O+L)/2+K*$}else{const K=1/G,se=H*H+U*U,V=$*$+P*P;N=A+(P*se-U*V)*K,k=O+(H*V-$*se)*K}c[w]=N,c[w+1]=k}let u=n[n.length-1],f,m=u*4,p,y=t[2*u],v,x=t[2*u+1];s.fill(0);for(let b=0;b<n.length;++b)u=n[b],f=m,p=y,v=x,m=u*4,y=t[2*u],x=t[2*u+1],s[f+2]=s[m]=v-x,s[f+3]=s[m+1]=y-p}render(t){const n=t==null?t=new _o:void 0,{delaunay:{halfedges:a,inedges:s,hull:o},circumcenters:l,vectors:c}=this;if(o.length<=1)return null;for(let m=0,p=a.length;m<p;++m){const y=a[m];if(y<m)continue;const v=Math.floor(m/3)*2,x=Math.floor(y/3)*2,b=l[v],w=l[v+1],C=l[x],N=l[x+1];this._renderSegment(b,w,C,N,t)}let u,f=o[o.length-1];for(let m=0;m<o.length;++m){u=f,f=o[m];const p=Math.floor(s[f]/3)*2,y=l[p],v=l[p+1],x=u*4,b=this._project(y,v,c[x+2],c[x+3]);b&&this._renderSegment(y,v,b[0],b[1],t)}return n&&n.value()}renderBounds(t){const n=t==null?t=new _o:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const a=n==null?n=new _o:void 0,s=this._clip(t);if(s===null||!s.length)return;n.moveTo(s[0],s[1]);let o=s.length;for(;s[0]===s[o-2]&&s[1]===s[o-1]&&o>1;)o-=2;for(let l=2;l<o;l+=2)(s[l]!==s[l-2]||s[l+1]!==s[l-1])&&n.lineTo(s[l],s[l+1]);return n.closePath(),a&&a.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,a=t.length/2;n<a;++n){const s=this.cellPolygon(n);s&&(s.index=n,yield s)}}cellPolygon(t){const n=new Iy;return this.renderCell(t,n),n.value()}_renderSegment(t,n,a,s,o){let l;const c=this._regioncode(t,n),u=this._regioncode(a,s);c===0&&u===0?(o.moveTo(t,n),o.lineTo(a,s)):(l=this._clipSegment(t,n,a,s,c,u))&&(o.moveTo(l[0],l[1]),o.lineTo(l[2],l[3]))}contains(t,n,a){return n=+n,n!==n||(a=+a,a!==a)?!1:this.delaunay._step(t,n,a)===t}*neighbors(t){const n=this._clip(t);if(n)for(const a of this.delaunay.neighbors(t)){const s=this._clip(a);if(s){e:for(let o=0,l=n.length;o<l;o+=2)for(let c=0,u=s.length;c<u;c+=2)if(n[o]===s[c]&&n[o+1]===s[c+1]&&n[(o+2)%l]===s[(c+u-2)%u]&&n[(o+3)%l]===s[(c+u-1)%u]){yield a;break e}}}}_cell(t){const{circumcenters:n,delaunay:{inedges:a,halfedges:s,triangles:o}}=this,l=a[t];if(l===-1)return null;const c=[];let u=l;do{const f=Math.floor(u/3);if(c.push(n[f*2],n[f*2+1]),u=u%3===2?u-2:u+1,o[u]!==t)break;u=s[u]}while(u!==l&&u!==-1);return c}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(n===null)return null;const{vectors:a}=this,s=t*4;return this._simplify(a[s]||a[s+1]?this._clipInfinite(t,n,a[s],a[s+1],a[s+2],a[s+3]):this._clipFinite(t,n))}_clipFinite(t,n){const a=n.length;let s=null,o,l,c=n[a-2],u=n[a-1],f,m=this._regioncode(c,u),p,y=0;for(let v=0;v<a;v+=2)if(o=c,l=u,c=n[v],u=n[v+1],f=m,m=this._regioncode(c,u),f===0&&m===0)p=y,y=0,s?s.push(c,u):s=[c,u];else{let x,b,w,C,N;if(f===0){if((x=this._clipSegment(o,l,c,u,f,m))===null)continue;[b,w,C,N]=x}else{if((x=this._clipSegment(c,u,o,l,m,f))===null)continue;[C,N,b,w]=x,p=y,y=this._edgecode(b,w),p&&y&&this._edge(t,p,y,s,s.length),s?s.push(b,w):s=[b,w]}p=y,y=this._edgecode(C,N),p&&y&&this._edge(t,p,y,s,s.length),s?s.push(C,N):s=[C,N]}if(s)p=y,y=this._edgecode(s[0],s[1]),p&&y&&this._edge(t,p,y,s,s.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(t,n,a,s,o,l){const c=o<l;for(c&&([t,n,a,s,o,l]=[a,s,t,n,l,o]);;){if(o===0&&l===0)return c?[a,s,t,n]:[t,n,a,s];if(o&l)return null;let u,f,m=o||l;m&8?(u=t+(a-t)*(this.ymax-n)/(s-n),f=this.ymax):m&4?(u=t+(a-t)*(this.ymin-n)/(s-n),f=this.ymin):m&2?(f=n+(s-n)*(this.xmax-t)/(a-t),u=this.xmax):(f=n+(s-n)*(this.xmin-t)/(a-t),u=this.xmin),o?(t=u,n=f,o=this._regioncode(t,n)):(a=u,s=f,l=this._regioncode(a,s))}}_clipInfinite(t,n,a,s,o,l){let c=Array.from(n),u;if((u=this._project(c[0],c[1],a,s))&&c.unshift(u[0],u[1]),(u=this._project(c[c.length-2],c[c.length-1],o,l))&&c.push(u[0],u[1]),c=this._clipFinite(t,c))for(let f=0,m=c.length,p,y=this._edgecode(c[m-2],c[m-1]);f<m;f+=2)p=y,y=this._edgecode(c[f],c[f+1]),p&&y&&(f=this._edge(t,p,y,c,f),m=c.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(c=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return c}_edge(t,n,a,s,o){for(;n!==a;){let l,c;switch(n){case 5:n=4;continue;case 4:n=6,l=this.xmax,c=this.ymin;break;case 6:n=2;continue;case 2:n=10,l=this.xmax,c=this.ymax;break;case 10:n=8;continue;case 8:n=9,l=this.xmin,c=this.ymax;break;case 9:n=1;continue;case 1:n=5,l=this.xmin,c=this.ymin;break}(s[o]!==l||s[o+1]!==c)&&this.contains(t,l,c)&&(s.splice(o,0,l,c),o+=2)}return o}_project(t,n,a,s){let o=1/0,l,c,u;if(s<0){if(n<=this.ymin)return null;(l=(this.ymin-n)/s)<o&&(u=this.ymin,c=t+(o=l)*a)}else if(s>0){if(n>=this.ymax)return null;(l=(this.ymax-n)/s)<o&&(u=this.ymax,c=t+(o=l)*a)}if(a>0){if(t>=this.xmax)return null;(l=(this.xmax-t)/a)<o&&(c=this.xmax,u=n+(o=l)*s)}else if(a<0){if(t<=this.xmin)return null;(l=(this.xmin-t)/a)<o&&(c=this.xmin,u=n+(o=l)*s)}return[c,u]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const a=(n+2)%t.length,s=(n+4)%t.length;(t[n]===t[a]&&t[a]===t[s]||t[n+1]===t[a+1]&&t[a+1]===t[s+1])&&(t.splice(a,2),n-=2)}t.length||(t=null)}return t}}const u5=2*Math.PI,Tl=Math.pow;function d5(e){return e[0]}function f5(e){return e[1]}function h5(e){const{triangles:t,coords:n}=e;for(let a=0;a<t.length;a+=3){const s=2*t[a],o=2*t[a+1],l=2*t[a+2];if((n[l]-n[s])*(n[o+1]-n[s+1])-(n[o]-n[s])*(n[l+1]-n[s+1])>1e-10)return!1}return!0}function p5(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class i1{static from(t,n=d5,a=f5,s){return new i1("length"in t?m5(t,n,a,s):Float64Array.from(g5(t,n,a,s)))}constructor(t){this._delaunator=new yh(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&h5(t)){this.collinear=Int32Array.from({length:n.length/2},(y,v)=>v).sort((y,v)=>n[2*y]-n[2*v]||n[2*y+1]-n[2*v+1]);const u=this.collinear[0],f=this.collinear[this.collinear.length-1],m=[n[2*u],n[2*u+1],n[2*f],n[2*f+1]],p=1e-8*Math.hypot(m[3]-m[1],m[2]-m[0]);for(let y=0,v=n.length/2;y<v;++y){const x=p5(n[2*y],n[2*y+1],p);n[2*y]=x[0],n[2*y+1]=x[1]}this._delaunator=new yh(n)}else delete this.collinear;const a=this.halfedges=this._delaunator.halfedges,s=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,l=this.inedges.fill(-1),c=this._hullIndex.fill(-1);for(let u=0,f=a.length;u<f;++u){const m=o[u%3===2?u-2:u+1];(a[u]===-1||l[m]===-1)&&(l[m]=u)}for(let u=0,f=s.length;u<f;++u)c[s[u]]=u;s.length<=2&&s.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=s[0],l[s[0]]=1,s.length===2&&(l[s[1]]=0,this.triangles[1]=s[1],this.triangles[2]=s[1]))}voronoi(t){return new c5(this,t)}*neighbors(t){const{inedges:n,hull:a,_hullIndex:s,halfedges:o,triangles:l,collinear:c}=this;if(c){const p=c.indexOf(t);p>0&&(yield c[p-1]),p<c.length-1&&(yield c[p+1]);return}const u=n[t];if(u===-1)return;let f=u,m=-1;do{if(yield m=l[f],f=f%3===2?f-2:f+1,l[f]!==t)return;if(f=o[f],f===-1){const p=a[(s[t]+1)%a.length];p!==m&&(yield p);return}}while(f!==u)}find(t,n,a=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;const s=a;let o;for(;(o=this._step(a,t,n))>=0&&o!==a&&o!==s;)a=o;return o}_step(t,n,a){const{inedges:s,hull:o,_hullIndex:l,halfedges:c,triangles:u,points:f}=this;if(s[t]===-1||!f.length)return(t+1)%(f.length>>1);let m=t,p=Tl(n-f[t*2],2)+Tl(a-f[t*2+1],2);const y=s[t];let v=y;do{let x=u[v];const b=Tl(n-f[x*2],2)+Tl(a-f[x*2+1],2);if(b<p&&(p=b,m=x),v=v%3===2?v-2:v+1,u[v]!==t)break;if(v=c[v],v===-1){if(v=o[(l[t]+1)%o.length],v!==x&&Tl(n-f[v*2],2)+Tl(a-f[v*2+1],2)<p)return v;break}}while(v!==y);return m}render(t){const n=t==null?t=new _o:void 0,{points:a,halfedges:s,triangles:o}=this;for(let l=0,c=s.length;l<c;++l){const u=s[l];if(u<l)continue;const f=o[l]*2,m=o[u]*2;t.moveTo(a[f],a[f+1]),t.lineTo(a[m],a[m+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;const a=t==null?t=new _o:void 0,{points:s}=this;for(let o=0,l=s.length;o<l;o+=2){const c=s[o],u=s[o+1];t.moveTo(c+n,u),t.arc(c,u,n,0,u5)}return a&&a.value()}renderHull(t){const n=t==null?t=new _o:void 0,{hull:a,points:s}=this,o=a[0]*2,l=a.length;t.moveTo(s[o],s[o+1]);for(let c=1;c<l;++c){const u=2*a[c];t.lineTo(s[u],s[u+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new Iy;return this.renderHull(t),t.value()}renderTriangle(t,n){const a=n==null?n=new _o:void 0,{points:s,triangles:o}=this,l=o[t*=3]*2,c=o[t+1]*2,u=o[t+2]*2;return n.moveTo(s[l],s[l+1]),n.lineTo(s[c],s[c+1]),n.lineTo(s[u],s[u+1]),n.closePath(),a&&a.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,a=t.length/3;n<a;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new Iy;return this.renderTriangle(t,n),n.value()}}function m5(e,t,n,a){const s=e.length,o=new Float64Array(s*2);for(let l=0;l<s;++l){const c=e[l];o[l*2]=t.call(a,c,l,e),o[l*2+1]=n.call(a,c,l,e)}return o}function*g5(e,t,n,a){let s=0;for(const o of e)yield t.call(a,o,s,e),yield n.call(a,o,s,e),++s}const y5=600,v5=50,x5=120,b5=50,_5=20,w5=1.001,S5=50,C5=25,N5=4;function k5(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0)/4294967296}const vh=e=>{const t=k5(e)*2*Math.PI;return{x:Math.cos(t),y:Math.sin(t)}};function Fu(e,t,n){return Math.abs(e.x-t.x)<(e.w+t.w)/2+n&&Math.abs(e.y-t.y)<(e.h+t.h)/2+n}function xh(e,t,n){const a=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y),o=a>1e-9?((e.w+t.w)/2+n)/a:1/0,l=s>1e-9?((e.h+t.h)/2+n)/s:1/0;return o>1&&l>1?Math.min(Math.min(o,l)*w5,S5):1}function M5(e,t,n={}){var re,fe,B,W,ae,J,le,be,je,De,Ae,Xe,Fe,me;const a=((re=n.preferredEdgeLength)!=null?re:160)*(1.25-.5*Math.min(1,Math.max(0,(fe=n.compactness)!=null?fe:.5))),s=(B=n.minimumNodeDistance)!=null?B:24,o=(W=n.maxIterations)!=null?W:300,l=(ae=n.tolerance)!=null?ae:1e-4,c=(J=n.componentSpacing)!=null?J:40,u=[...e].sort((Q,ue)=>Q.id<ue.id?-1:Q.id>ue.id?1:0),f=u.length,m=new Map;u.forEach((Q,ue)=>m.set(Q.id,ue));const p=u.map(()=>[]),y=new Set,v=new Map,x=new Map;for(const Q of t){const ue=m.get(Q.source),xe=m.get(Q.target);if(ue===void 0||xe===void 0||ue===xe)continue;const ze=ue<xe?`${ue}|${xe}`:`${xe}|${ue}`;if(Number.isFinite(Q.length)&&Q.length>0&&v.set(ze,Math.max((le=v.get(ze))!=null?le:0,Q.length)),Q.label&&Q.label.width>0&&Q.label.height>0){const X=x.get(`${ue}>${xe}`);x.set(`${ue}>${xe}`,{a:ue,b:xe,w:Math.max((be=X==null?void 0:X.w)!=null?be:0,Q.label.width),h:Math.max((je=X==null?void 0:X.h)!=null?je:0,Q.label.height),offset:Math.max((De=X==null?void 0:X.offset)!=null?De:0,(Ae=Q.label.offset)!=null?Ae:0)})}y.has(ze)||(y.add(ze),p[ue].push(xe),p[xe].push(ue))}for(const Q of p)Q.sort((ue,xe)=>ue-xe);const b=u.map(Q=>({x:Q.x,y:Q.y})),w=u.map((Q,ue)=>({x:b[ue].x,y:b[ue].y,w:Q.width,h:Q.height})),C=()=>w.forEach((Q,ue)=>{Q.x=b[ue].x,Q.y=b[ue].y}),N=b.map(Q=>Number.isFinite(Q.x)&&Number.isFinite(Q.y)),k=N.filter(Boolean).length,M=f>0&&k>=2&&k>=.7*f,D=new Int32Array(f).fill(-1),j=[];for(let Q=0;Q<f;Q++){if(D[Q]!==-1)continue;const ue=j.length,xe=[],ze=[Q];for(D[Q]=ue;ze.length;){const X=ze.pop();xe.push(X);for(const ke of p[X])D[ke]===-1&&(D[ke]=ue,ze.push(ke))}xe.sort((X,ke)=>X-ke),j.push(xe)}const A=(Xe=n.scope)!=null?Xe:"auto",O=[...x.values()].sort((Q,ue)=>Q.a-ue.a||Q.b-ue.b),R=O.filter(Q=>N[Q.a]&&N[Q.b]),E=M&&!Lw(w.filter((Q,ue)=>N[ue]),s)&&bh(R,w,b).length===0,I=M&&(A==="auto"?E:!0),L={iterations:0,overlapIterations:0,scaledUp:0,components:j.length,warmStart:I,solvedNodes:0},H=u.map((Q,ue)=>!!Q.pinned&&N[ue]),U=b.map(Q=>F({},Q)),$=N.slice(),P=new Uint8Array(f);if(!I||A==="all")for(let Q=0;Q<f;Q++)P[Q]=H[Q]?0:1;else{const Q=new Set;for(let ue=0;ue<f;ue++)N[ue]||Q.add(ue);for(const ue of(Fe=n.affectedIds)!=null?Fe:[]){const xe=m.get(ue);xe!==void 0&&Q.add(xe)}for(const ue of[...Q])for(const xe of p[ue])Q.add(xe);for(const ue of Q)H[ue]||(P[ue]=1)}L.solvedNodes=P.reduce((Q,ue)=>Q+ue,0);const G=j.filter(Q=>Q.length>1).map(Q=>j5(Q,p,u,b,P,a,s,v));if(I)for(let Q=0;Q<f;Q++){if(N[Q])continue;const ue=p[Q].filter(X=>N[X]),xe=ue.length?ue:j[D[Q]].filter(X=>N[X]),ze=vh(u[Q].id);if(xe.length){const X=xe.reduce((we,$e)=>we+b[$e].x,0)/xe.length,ke=xe.reduce((we,$e)=>we+b[$e].y,0)/xe.length;b[Q]={x:X+ze.x*a,y:ke+ze.y*a}}else{const X=Zf(w.filter((ke,we)=>N[we]));b[Q]={x:X.cx+ze.x*(X.w/2+a),y:X.cy+ze.y*(X.h/2+a)}}w[Q].x=b[Q].x,w[Q].y=b[Q].y,N[Q]=!0}else{for(const Q of G)Q.initFromMds();for(const Q of j)Q.length===1&&(b[Q[0]]=H[Q[0]]?F({},U[Q[0]]):{x:0,y:0});for(const Q of j){const ue=Q.filter(xe=>H[xe]);if(ue.length){Iw(b,ue,U,Q);for(const xe of ue)b[xe]=F({},U[xe])}}}const K=[];if(G.length&&L.solvedNodes>0){let Q=G.reduce((ue,xe)=>ue+xe.stress(),0);K.push(Q);for(let ue=0;ue<o;ue++){let xe=0;for(const X of G)xe=Math.max(xe,X.sweep());const ze=G.reduce((X,ke)=>X+ke.stress(),0);if(K.push(ze),L.iterations=ue+1,Q-ze<=l*Math.max(Q,1e-12)||xe<.01)break;Q=ze}}else G.length&&K.push(G.reduce((Q,ue)=>Q+ue.stress(),0));if(I&&A==="all"){const Q=u.map((ue,xe)=>xe).filter(ue=>$[ue]);Iw(b,Q,U,u.map((ue,xe)=>xe));for(let ue=0;ue<f;ue++)H[ue]&&(b[ue]=F({},U[ue]))}C();const se=new Map;for(const Q of O){const ue=D[Q.a];((me=se.get(ue))!=null?me:se.set(ue,[]).get(ue)).push(Q)}j.forEach((Q,ue)=>{var xe;Q.length<2||Ow(Q,w,b,u,H,s,L,(xe=se.get(ue))!=null?xe:[],!I)}),C(),I||O5(j,w,b,H,s,c),(I||j.some(Q=>Q.some(ue=>H[ue])))&&(C(),(Lw(w,s)||bh(O,w,b).length)&&Ow(j.flat(),w,b,u,H,s,L,O));const V=new Map;return u.forEach((Q,ue)=>V.set(Q.id,{x:b[ue].x,y:b[ue].y})),{positions:V,stressHistory:K,stats:L}}function j5(e,t,n,a,s,o,l,c){const u=e.length,f=new Map;e.forEach((N,k)=>f.set(N,k));const m=e.map(N=>t[N].map(k=>f.get(k))),p=new Float64Array(u*u),y=new Float64Array(u*u),v=new Int32Array(u),x=new Int32Array(u);for(let N=0;N<u;N++){x.fill(-1),x[N]=0;let k=0,M=0;for(v[M++]=N;k<M;){const D=v[k++];for(const j of m[D])x[j]===-1&&(x[j]=x[D]+1,v[M++]=j)}for(let D=0;D<u;D++)D!==N&&(p[N*u+D]=x[D]*o)}const b=(N,k)=>{const M=n[e[N]],D=n[e[k]];return Math.hypot((M.width+D.width)/2,(M.height+D.height)/2)+l},w=(N,k)=>{var j;const M=e[N],D=e[k];return(j=c.get(M<D?`${M}|${D}`:`${D}|${M}`))!=null?j:0};for(let N=0;N<u;N++)for(const k of m[N])if(N<k){const M=Math.max(p[N*u+k],b(N,k),w(N,k));p[N*u+k]=M,p[k*u+N]=M}for(let N=0;N<u;N++){const k=m[N].filter(O=>m[O].length===1);if(k.length<3)continue;const M=Math.max(o,...k.map(O=>w(N,O))),D=Math.min(...k.map(O=>b(N,O))),j=Math.floor(2*Math.PI*M/D);if(k.length>N5*j){const O=E5(k.length,[N,...k].map(E=>n[e[E]]),l),R=[N,...k];for(let E=0;E<R.length;E++)for(let I=E+1;I<R.length;I++){const L=Math.hypot(O[E].x-O[I].x,O[E].y-O[I].y);p[R[E]*u+R[I]]=L,p[R[I]*u+R[E]]=L}continue}const A=Math.max(0,Math.min(2*M,2*M*Math.sin(Math.PI/k.length)));for(let O=0;O<k.length;O++)for(let R=O+1;R<k.length;R++){const E=k[O],I=k[R],L=Math.max(A,b(E,I));p[E*u+I]=L,p[I*u+E]=L}}for(let N=0;N<u*u;N++)y[N]=p[N]>0?1/(p[N]*p[N]):0;const C=()=>e.map(N=>a[N]);return{initFromMds(){const N=u<=y5?R5(p,u):T5(p,u);for(let k=0;k<u;k++){const M=vh(n[e[k]].id);a[e[k]]={x:N[2*k]+M.x*.01*o,y:N[2*k+1]+M.y*.01*o}}},sweep(){const N=C();let k=0;for(let M=0;M<u;M++){if(!s[e[M]])continue;let D=0,j=0,A=0;const O=N[M];for(let R=0;R<u;R++){if(R===M)continue;const E=y[M*u+R];if(E===0)continue;const I=N[R];let L=O.x-I.x,H=O.y-I.y,U=Math.hypot(L,H);if(U<1e-9){const P=vh(n[e[M]].id);L=P.x,H=P.y,U=1}const $=p[M*u+R];D+=E*(I.x+$*L/U),j+=E*(I.y+$*H/U),A+=E}if(A>0){const R=D/A,E=j/A;k=Math.max(k,Math.hypot(R-O.x,E-O.y)),O.x=R,O.y=E}}return k},stress(){const N=C();let k=0;for(let M=0;M<u;M++)for(let D=M+1;D<u;D++){const j=y[M*u+D];if(j===0)continue;const A=Math.hypot(N[M].x-N[D].x,N[M].y-N[D].y)-p[M*u+D];k+=j*A*A}return k}}}function E5(e,t,n){const a=Math.max(...t.map(c=>c.width))+n+.5,s=Math.max(...t.map(c=>c.height))+n+.5,o=Math.ceil(2*Math.sqrt(e))+2,l=[];for(let c=-o;c<=o;c++)for(let u=-o;u<=o;u++){if(c===0&&u===0)continue;const f=c*a,m=u*s;l.push({x:f,y:m,d:$a(f/Jf,2)+m*m,a:Math.atan2(m,f)})}return l.sort((c,u)=>c.d-u.d||c.a-u.a),[{x:0,y:0},...l.slice(0,e).map(c=>({x:c.x,y:c.y}))]}function dN(e,t){const n=u=>{const f=new Float64Array(t);for(let m=0;m<t;m++)f[m]=Math.sin((m+1)*(u+1)*.7)+.5;return f},a=u=>{let f=0;for(let m=0;m<t;m++)f+=u[m]*u[m];f=Math.sqrt(f)||1;for(let m=0;m<t;m++)u[m]/=f},s=(u,f)=>{let m=0;for(let p=0;p<t;p++)m+=u[p]*f[p];return m},o=(u,f)=>{let m=n(u);a(m);let p=new Float64Array(t),y=0;for(let v=0;v<x5;v++){if(e(m,p),f){const b=f.l*s(f.v,m);for(let w=0;w<t;w++)p[w]-=b*f.v[w]}y=s(m,p),a(p);const x=m;m=p,p=x}return{v:m,l:y}},l=o(0),c=o(1,l);return{v1:l.v,l1:l.l,v2:c.v,l2:c.l}}function R5(e,t){const n=new Float64Array(t*t);for(let v=0;v<t*t;v++)n[v]=e[v]*e[v];const a=new Float64Array(t);let s=0;for(let v=0;v<t;v++){let x=0;for(let b=0;b<t;b++)x+=n[v*t+b];a[v]=x/t,s+=x}s/=t*t;const o=new Float64Array(t*t);for(let v=0;v<t;v++)for(let x=0;x<t;x++)o[v*t+x]=-.5*(n[v*t+x]-a[v]-a[x]+s);const{v1:l,l1:c,v2:u,l2:f}=dN((v,x)=>{for(let b=0;b<t;b++){let w=0;for(let C=0;C<t;C++)w+=o[b*t+C]*v[C];x[b]=w}},t),m=new Float64Array(2*t),p=Math.sqrt(Math.max(c,0)),y=Math.sqrt(Math.max(f,0));for(let v=0;v<t;v++)m[2*v]=l[v]*p,m[2*v+1]=u[v]*y;return m}function T5(e,t){const n=Math.min(v5,t),a=[0],s=new Float64Array(t).fill(1/0);for(;a.length<n;){const b=a[a.length-1];let w=-1,C=-1;for(let N=0;N<t;N++)s[N]=Math.min(s[N],e[b*t+N]),s[N]>C&&(C=s[N],w=N);a.push(w)}const o=new Float64Array(t*n),l=new Float64Array(n),c=new Float64Array(t);let u=0;for(let b=0;b<t;b++)for(let w=0;w<n;w++){const C=$a(e[b*t+a[w]],2);o[b*n+w]=C,l[w]+=C/t,c[b]+=C/n,u+=C/(t*n)}for(let b=0;b<t;b++)for(let w=0;w<n;w++)o[b*n+w]=-.5*(o[b*n+w]-c[b]-l[w]+u);const{v1:f,v2:m}=dN((b,w)=>{const C=new Float64Array(t);for(let N=0;N<t;N++){let k=0;for(let M=0;M<n;M++)k+=o[N*n+M]*b[M];C[N]=k}for(let N=0;N<n;N++){let k=0;for(let M=0;M<t;M++)k+=o[M*n+N]*C[M];w[N]=k}},n),p=new Float64Array(2*t);for(let b=0;b<t;b++){let w=0,C=0;for(let N=0;N<n;N++)w+=o[b*n+N]*f[N],C+=o[b*n+N]*m[N];p[2*b]=w,p[2*b+1]=C}let y=0,v=0;for(let b=0;b<t;b++)for(let w=0;w<n;w++){const C=a[w];if(C===b)continue;const N=Math.hypot(p[2*b]-p[2*C],p[2*b+1]-p[2*C+1]);y+=e[b*t+C]*N,v+=N*N}const x=v>0?y/v:1;for(let b=0;b<2*t;b++)p[b]*=x;return p}function Lw(e,t){for(let n=0;n<e.length;n++)for(let a=n+1;a<e.length;a++)if(Fu(e[n],e[a],t))return!0;return!1}function A5(e,t){const n=[],a=new Set,s=(o,l)=>{const c=o<l?`${o}|${l}`:`${l}|${o}`;a.has(c)||(a.add(c),n.push(o<l?[o,l]:[l,o]))};if(e.length>=3){const o=new Float64Array(e.length*2);e.forEach((u,f)=>{o[2*f]=t[u].x,o[2*f+1]=t[u].y});const l=new i1(o),c=l.triangles;for(let u=0;u<c.length;u+=3)s(e[c[u]],e[c[u+1]]),s(e[c[u+1]],e[c[u+2]]),s(e[c[u+2]],e[c[u]]);if(c.length===0){const u=l.hull;for(let f=0;f+1<u.length;f++)s(e[u[f]],e[u[f+1]])}}if(e.length<3||n.length===0)for(let o=0;o<e.length;o++)for(let l=o+1;l<e.length;l++)s(e[o],e[l]);return n}function fN(e,t){const n=t[e.b].x-t[e.a].x,a=t[e.b].y-t[e.a].y,s=Math.hypot(n,a)||1;return{x:(t[e.a].x+t[e.b].x)/2-a/s*e.offset,y:(t[e.a].y+t[e.b].y)/2+n/s*e.offset,w:e.w,h:e.h}}function bh(e,t,n){const a=[],s=e.map(c=>fN(c,n)),o=new Map,l=(c,u,f)=>a.push({a:Math.min(c,u),b:Math.max(c,u),t:f});e.forEach((c,u)=>{var f;for(const m of[c.a,c.b])Fu(t[m],s[u],0)&&l(c.a,c.b,xh(t[m],s[u],0)),((f=o.get(m))!=null?f:o.set(m,[]).get(m)).push(u)});for(const[c,u]of o)for(let f=0;f<u.length;f++)for(let m=f+1;m<u.length;m++){const p=e[u[f]],y=e[u[m]],v=p.a===c?p.b:p.a,x=y.a===c?y.b:y.a;v===x||!Fu(s[u[f]],s[u[m]],0)||l(v,x,xh(s[u[f]],s[u[m]],0))}return a}function D5(e,t,n,a,s){let o=0;for(const l of e){const c=fN(l,a);for(const u of t){if(u===l.a||u===l.b||s[u]||!Fu(n[u],c,0))continue;const f=(n[u].w+c.w)/2-Math.abs(n[u].x-c.x)+.5,m=(n[u].h+c.h)/2-Math.abs(n[u].y-c.y)+.5;f<m?a[u].x+=n[u].x>=c.x?f:-f:a[u].y+=n[u].y>=c.y?m:-m,n[u].x=a[u].x,n[u].y=a[u].y,o++}}return o}function Ow(e,t,n,a,s,o,l,c=[],u=!1){var p;const f=()=>e.forEach(y=>{t[y].x=n[y].x,t[y].y=n[y].y}),m=()=>{for(let y=0;y<e.length;y++)for(let v=y+1;v<e.length;v++){const x=e[y],b=e[v];if(Math.abs(n[x].x-n[b].x)<1e-6&&Math.abs(n[x].y-n[b].y)<1e-6){const w=s[b]&&!s[x]?x:b,C=vh(a[w].id);n[w].x+=C.x,n[w].y+=C.y}}f()};for(let y=0;y<b5;y++){m();const v=u&&y<C5?D5(c,e,t,n,s):0,x=[];for(let $=0;$<e.length;$++)for(let P=$+1;P<e.length;P++)Fu(t[e[$]],t[e[P]],o)&&x.push([e[$],e[P]]);const b=bh(c,t,n);if(x.length===0&&b.length===0){if(v===0)return;continue}l.overlapIterations++;const w=A5(e,t),C=new Set(w.map(([$,P])=>`${$}|${P}`));for(const[$,P]of x)C.has(`${$}|${P}`)||(C.add(`${$}|${P}`),w.push([$,P]));for(const{a:$,b:P}of b)C.has(`${$}|${P}`)||(C.add(`${$}|${P}`),w.push([$,P]));const N=new Map;for(const{a:$,b:P,t:G}of b)N.set(`${$}|${P}`,Math.max((p=N.get(`${$}|${P}`))!=null?p:1,G));const k=w.map(([$,P])=>{var G;return{a:$,b:P,t:Math.max(xh(t[$],t[P],o),(G=N.get(`${$}|${P}`))!=null?G:1)}});k.sort(($,P)=>P.t-$.t||$.a-P.a||$.b-P.b);const M=new Map(e.map($=>[$,$])),D=$=>{for(;M.get($)!==$;)M.set($,M.get(M.get($))),$=M.get($);return $},j=new Map(e.map($=>[$,[]]));for(const $ of k){const P=D($.a),G=D($.b);P!==G&&(M.set(P,G),j.get($.a).push({to:$.b,t:$.t}),j.get($.b).push({to:$.a,t:$.t}))}let A=0,O=0;for(const $ of e)A+=n[$].x,O+=n[$].y;A/=e.length,O/=e.length;let R=e[0],E=1/0;for(const $ of e){const P=Math.hypot(n[$].x-A,n[$].y-O);P<E&&(E=P,R=$)}const I=e.find($=>s[$]);I!==void 0&&(R=I);const L=new Map([[R,F({},n[R])]]),H=[R],U=new Set([R]);for(;H.length;){const $=H.pop(),P=L.get($);for(const{to:G,t:K}of j.get($))U.has(G)||(U.add(G),L.set(G,{x:P.x+(n[G].x-n[$].x)*K,y:P.y+(n[G].y-n[$].y)*K}),H.push(G))}for(const $ of e){const P=L.get($);P&&(n[$].x=P.x,n[$].y=P.y)}f()}for(let y=0;y<_5;y++){m();let v=1;for(let C=0;C<e.length;C++)for(let N=C+1;N<e.length;N++)v=Math.max(v,xh(t[e[C]],t[e[N]],o));for(const C of bh(c,t,n))v=Math.max(v,C.t);if(v<=1)return;l.scaledUp++;const x=e.find(C=>s[C]);let b=0,w=0;if(x!==void 0)b=n[x].x,w=n[x].y;else{for(const C of e)b+=n[C].x,w+=n[C].y;b/=e.length,w/=e.length}for(const C of e)n[C].x=b+(n[C].x-b)*v,n[C].y=w+(n[C].y-w)*v;f()}}function Zf(e){if(e.length===0)return{cx:0,cy:0,w:0,h:0};let t=1/0,n=1/0,a=-1/0,s=-1/0;for(const o of e)t=Math.min(t,o.x-o.w/2),a=Math.max(a,o.x+o.w/2),n=Math.min(n,o.y-o.h/2),s=Math.max(s,o.y+o.h/2);return{cx:(t+a)/2,cy:(n+s)/2,w:a-t,h:s-n}}const Jf=1.6;function L5(e,t,n){const a=e.map(()=>({x:0,y:0})),s=[];e.forEach((c,u)=>{const f=s[s.length-1];f&&f.w+n+c.w<=t?(a[u]={x:f.w+n,y:0},f.items.push(u),f.w+=n+c.w,f.h=Math.max(f.h,c.h)):(s.push({items:[u],w:c.w,h:c.h}),a[u]={x:0,y:0})});const o=Math.max(...s.map(c=>c.w));let l=0;for(const c of s){const u=(o-c.w)/2;for(const f of c.items)a[f].x+=u,a[f].y=l+(c.h-e[f].h)/2;l+=c.h+n}return{offsets:a,w:o,h:l-n}}function O5(e,t,n,a,s,o){const l=e.filter(M=>M.some(D=>a[D])),c=e.filter(M=>!M.some(D=>a[D]));if(c.length===0)return;const u=Math.max(s,o),f=c.filter(M=>M.length>1),m=c.filter(M=>M.length===1).map(M=>M[0]),p=(M,D,j,A)=>{for(const O of M)n[O].x+=j-D.cx,n[O].y+=A-D.cy},y=f.map((M,D)=>{const j=Zf(M.map(A=>t[A]));return{i:D,m:M,bb:j,w:j.w,h:j.h}});y.sort((M,D)=>D.h-M.h||D.w-M.w||M.i-D.i);let v=0,x=0;if(y.length){const M=y.reduce((I,L)=>I+(L.w+u)*(L.h+u),0),D=Math.max(...y.map(I=>I.w));let j,A=-1/0;for(const I of[.75,1,1.25,1.5,2]){const L=L5(y,Math.max(D,Math.sqrt(M*Jf)*I),u),H=Math.min(Jf/L.w,1/L.h);H>A+1e-12&&(A=H,j=L)}const{offsets:O,w:R,h:E}=j;y.forEach((I,L)=>p(I.m,I.bb,O[L].x+I.w/2,O[L].y+I.h/2)),v=R,x=E}if(m.length){const M=Math.max(...m.map(E=>t[E].w))+u,D=Math.max(...m.map(E=>t[E].h))+u,j=y.length?Math.max(1,Math.min(m.length,Math.floor((v+u)/M))):Math.max(1,Math.min(m.length,Math.ceil(Math.sqrt(m.length*Jf*D/M)))),A=Math.ceil(m.length/j),O=j*M-u,R=y.length?x+u:0;m.forEach((E,I)=>{const L=I%j,H=Math.floor(I/j);n[E].x=(v-O)/2+L*M+(M-u)/2,n[E].y=R+H*D+(D-u)/2}),v=Math.max(v,O),x=R+A*D-u}const b=c.flat();for(const M of b)n[M].x-=v/2,n[M].y-=x/2;if(l.length===0)return;const w=Zf(l.flat().map(M=>t[M])),C=Zf(b.map(M=>Z(F({},t[M]),{x:n[M].x,y:n[M].y}))),N=Math.abs(C.cx-w.cx)<(C.w+w.w)/2+u,k=Math.abs(C.cy-w.cy)<(C.h+w.h)/2+u;if(N&&k){const M=w.cx+w.w/2+u+C.w/2-C.cx;for(const D of b)n[D].x+=M}}function Iw(e,t,n,a){const s=t.length;if(s===0)return;const o={x:0,y:0},l={x:0,y:0};for(const p of t)o.x+=e[p].x/s,o.y+=e[p].y/s,l.x+=n[p].x/s,l.y+=n[p].y/s;const c=p=>{let y=0,v=0,x=0,b=0;for(const D of t){const j=e[D].x-o.x,A=(e[D].y-o.y)*(p?-1:1),O=n[D].x-l.x,R=n[D].y-l.y;y+=j*O,v+=j*R,x+=A*O,b+=A*R}const w=s>=2?Math.atan2(v-x,y+b):0,C=Math.cos(w),N=Math.sin(w),k=D=>{const j=D.x-o.x,A=(D.y-o.y)*(p?-1:1);return{x:C*j-N*A+l.x,y:N*j+C*A+l.y}};let M=0;for(const D of t){const j=k(e[D]);M+=$a(j.x-n[D].x,2)+$a(j.y-n[D].y,2)}return{err:M,map:k}},u=c(!1),f=s>=3?(()=>{const p=c(!0);return p.err<u.err?p:u})():u,m=a.map(p=>f.map(e[p]));a.forEach((p,y)=>{e[p].x=m[y].x,e[p].y=m[y].y})}function zh(e,t){const n=Array.from(new Set(e)),a=new Set(n),s=new Map,o=new Map,l=new Set;for(const p of t){if(!p.structural||p.source===p.target||!a.has(p.source)||!a.has(p.target)||s.has(p.target))continue;const y=`${p.source}->${p.target}`;if(l.has(y))continue;l.add(y),s.set(p.target,p.source);const v=o.get(p.source);v?v.push(p.target):o.set(p.source,[p.target])}const c=new Set(n.filter(p=>!s.has(p))),u=Array.from(c),f=new Set,m=p=>{var y;if(!f.has(p)){f.add(p);for(const v of(y=o.get(p))!=null?y:[])m(v)}};u.forEach(m);for(const p of n){if(f.has(p))continue;const y=s.get(p);if(y!==void 0){s.delete(p);const v=o.get(y);v&&o.set(y,v.filter(x=>x!==p))}u.push(p),m(p)}return{parentOf:s,childrenOf:o,roots:u}}function I5(e,t){return e.flatMap(n=>{const a=t.get(n);return a&&a.length>1?a:[n]})}function zy(e,t){var o,l;const n=new Set,a=[...(o=t.get(e))!=null?o:[]];let s=0;for(;s<a.length;){const c=a[s++];n.has(c)||(n.add(c),a.push(...(l=t.get(c))!=null?l:[]))}return n}function z5(e,t){var n;const a=I5(e,t),s=new Map;for(const o of a){s.set(o,o);for(const l of zy(o,t))s.set(l,o)}for(const o of e){if(s.has(o))continue;const l=(n=t.get(o))==null?void 0:n[0],c=l!==void 0?s.get(l):void 0;c!==void 0&&s.set(o,c)}return{groupHeads:a,leafToGroup:s}}const B5=2,zw=[{dx:1,dy:0},{dx:0,dy:1},{dx:-1,dy:0},{dx:0,dy:-1}];function U5(e,t,n={}){var J,le,be,je,De,Ae,Xe,Fe;const a=(J=n.clearance)!=null?J:10,s=(le=n.laneSpacing)!=null?le:16,o=Math.max(1,Math.floor((be=n.lanes)!=null?be:4)),l=Math.max(0,Math.floor((je=n.componentGap)!=null?je:1)),c=(De=n.orderingSweeps)!=null?De:6,u=[...e].sort((me,Q)=>me.id<Q.id?-1:me.id>Q.id?1:0),f=u.length,m=new Map;u.forEach((me,Q)=>m.set(me.id,Q));const p=u.map(()=>[]),y=[],v=new Set;let x=0;t.forEach(me=>{const Q=m.get(me.source),ue=m.get(me.target);if(Q===void 0||ue===void 0||Q===ue){y.push(null),x++;return}y.push([Q,ue]);const xe=Q<ue?`${Q}|${ue}`:`${ue}|${Q}`;v.has(xe)||(v.add(xe),p[Q].push(ue),p[ue].push(Q))});for(const me of p)me.sort((Q,ue)=>Q-ue);const b=f?Math.max(...u.map(me=>me.width)):0,w=f?Math.max(...u.map(me=>me.height)):0,C=o*s,N=b+2*a+C,k=w+2*a+C,M=t.some(me=>me.structural)?zh(u.map(me=>me.id),t.filter(me=>me.structural).map(me=>({source:me.source,target:me.target,structural:!0}))):null,D=n.isPageNode,j=me=>D?F5(D,u[me].id):!0,A=new Int32Array(f),O=new Int32Array(f),R=u.map(me=>!!me.pinned&&Number.isFinite(me.x)&&Number.isFinite(me.y)),E=u.map(me=>Number.isFinite(me.x)&&Number.isFinite(me.y)),I=R.findIndex(Boolean),L=I>=0?{x:u[I].x-Math.round(u[I].x/N)*N,y:u[I].y-Math.round(u[I].y/k)*k}:{x:0,y:0},H=me=>[Math.round((u[me].x-L.x)/N),Math.round((u[me].y-L.y)/k)],U=(Ae=n.scope)!=null?Ae:"auto",$=E.filter(Boolean).length;let P=U==="sketch";if(U==="auto"&&f>0&&$>=2&&$>=.7*f){const me=new Set;let Q=!0;for(let ue=0;ue<f&&Q;ue++)if(E[ue]){const xe=H(ue).join(",");me.has(xe)&&(Q=!1),me.add(xe)}P=Q}let G,K;if(P)({components:G,isolates:K}=$5(f,p,u,E,R,H,A,O));else{({components:G,isolates:K}=P5(f,p,A,O,l,c,M,m,j,u));const me=new Map;for(let Q=0;Q<f;Q++)me.set(`${A[Q]},${O[Q]}`,Q);for(let Q=0;Q<f;Q++){if(!R[Q])continue;const[ue,xe]=H(Q),ze=`${ue},${xe}`;me.delete(`${A[Q]},${O[Q]}`);const X=me.get(ze);if(A[Q]=ue,O[Q]=xe,me.set(ze,Q),X!==void 0&&X!==Q&&!R[X]){const ke=By(ue,xe,me);A[X]=ke[0],O[X]=ke[1],me.set(`${ke[0]},${ke[1]}`,X)}}}const se=new Map,V=u.map((me,Q)=>{const ue={x:L.x+A[Q]*N,y:L.y+O[Q]*k};return se.set(me.id,ue),ue}),re=t.map(me=>me.navigationRoute?2:me.structural?0:1),fe=t.map(()=>{});if(n.busTreeEdges){const me=new Map;t.forEach((ue,xe)=>{var we;const ze=y[xe];if(!ze||!ue.structural)return;const[X,ke]=ze;O[ke]===O[X]+1&&me.set(X,[...(we=me.get(X))!=null?we:[],xe])});let Q=0;for(const[,ue]of[...me.entries()].sort((xe,ze)=>xe[0]-ze[0]))if(!(ue.length<2)){for(const xe of ue)fe[xe]=Q;Q++}}const B=G5(u,V,y,A,O,N,k,L,re,fe,{clearance:a,laneSpacing:s,lanes:o,bendPenalty:(Xe=n.bendPenalty)!=null?Xe:Math.max(N,k),crossingPenalty:(Fe=n.crossingPenalty)!=null?Fe:3*Math.max(N,k)}),W=f?Math.max(...Array.from(A))-Math.min(...Array.from(A))+1:0,ae=f?Math.max(...Array.from(O))-Math.min(...Array.from(O))+1:0;return{positions:se,routes:B.points,groups:fe,cell:{w:N,h:k},origin:L,stats:{components:G+(K?1:0),rows:ae,cols:W,fallbackRoutes:B.fallbacks,droppedEdges:x,sketch:P,pinnedNodes:R.filter(Boolean).length,busEdges:fe.filter(me=>me!==void 0).length}}}function F5(e,t){try{return!!e(t)}catch(n){return!0}}function By(e,t,n){for(let a=1;a<1e4;a++){const s=[];for(let o=-a;o<=a;o++){const l=a-Math.abs(o);s.push([e+o,t+l]),l!==0&&s.push([e+o,t-l])}s.sort((o,l)=>o[0]-l[0]||o[1]-l[1]);for(const[o,l]of s)if(!n.has(`${o},${l}`))return[o,l]}return[e,t]}function $5(e,t,n,a,s,o,l,c){const u=new Map,f=[...Array(e).keys()].filter(v=>a[v]).sort((v,x)=>(s[x]?1:0)-(s[v]?1:0)||v-x);for(const v of f){let[x,b]=o(v);u.has(`${x},${b}`)&&([x,b]=By(x,b,u)),l[v]=x,c[v]=b,u.set(`${x},${b}`,v)}for(let v=0;v<e;v++){if(a[v])continue;const x=t[v].filter(C=>u.has(`${l[C]},${c[C]}`)&&(a[C]||C<v));let b=0,w=0;if(x.length)b=Math.round(x.reduce((C,N)=>C+l[N],0)/x.length),w=Math.round(x.reduce((C,N)=>C+c[N],0)/x.length)+1;else if(u.size){let C=-1/0,N=1/0;for(const k of u.keys()){const[M,D]=k.split(",").map(Number);C=Math.max(C,D),N=Math.min(N,M)}b=N,w=C+1}u.has(`${b},${w}`)&&([b,w]=By(b,w,u)),l[v]=b,c[v]=w,u.set(`${b},${w}`,v)}const m=new Uint8Array(e);let p=0,y=0;for(let v=0;v<e;v++){if(m[v])continue;if(t[v].length===0){y++,m[v]=1;continue}p++;const x=[v];for(m[v]=1;x.length;){const b=x.pop();for(const w of t[b])m[w]||(m[w]=1,x.push(w))}}return{components:p,isolates:y}}function P5(e,t,n,a,s,o,l,c,u,f){const m=new Int32Array(e).fill(-1),p=[];for(let j=0;j<e;j++){if(m[j]!==-1)continue;const A=[],O=[j];for(m[j]=p.length;O.length;){const R=O.pop();A.push(R);for(const E of t[R])m[E]===-1&&(m[E]=p.length,O.push(E))}A.sort((R,E)=>R-E),p.push(A)}const y=p.filter(j=>j.length>1),v=p.filter(j=>j.length===1).map(j=>j[0]);y.sort((j,A)=>A.length-j.length||j[0]-A[0]);const x=y.map(j=>{const A=H5(j,t,o,l,c,u,f);let O=0,R=0;for(const E of j)O=Math.max(O,A.col.get(E)+1),R=Math.max(R,A.row.get(E)+1);return{m:j,local:A,width:O,height:R}}),b=Math.max(Math.ceil(Math.sqrt(e*1.6)),...x.map(j=>j.width));let w=0,C=0,N=0,k=0;for(const{m:j,local:A,width:O,height:R}of x){w>0&&w+O>b&&(C+=N+s,w=0,N=0);for(const E of j)n[E]=w+A.col.get(E),a[E]=C+A.row.get(E);k=Math.max(k,w+O),w+=O+s,N=Math.max(N,R)}const M=x.length?C+N:0,D=Math.max(1,k,Math.ceil(Math.sqrt(v.length*1.6)));return v.forEach((j,A)=>{n[j]=A%D,a[j]=M+Math.floor(A/D)}),{components:y.length,isolates:v.length}}function H5(e,t,n,a,s,o,l){var R,E,I;const c=new Map,u=new Set;if(a){const L=new Set(e);for(const H of e)if(o(H))for(const U of(R=a.childrenOf.get(l[H].id))!=null?R:[]){const $=s.get(U);$===void 0||!L.has($)||o($)||(c.set(H,[...(E=c.get(H))!=null?E:[],$]),u.add($))}}const f=e.filter(L=>!u.has(L)),m=t.map(()=>[]);for(const L of f)m[L]=t[L].filter(H=>!u.has(H));const p=L=>{var P;const H=new Map([[L,0]]),U=[L];for(let G=0;G<U.length;G++){const K=U[G];for(const se of m[K])H.has(se)||(H.set(se,H.get(K)+1),U.push(se))}for(const G of f)H.has(G)||(H.set(G,0),U.push(G));const $=new Map;for(const G of H.values())$.set(G,((P=$.get(G))!=null?P:0)+1);return{root:L,depth:H,order:U,widest:Math.max(...$.values()),rows:$.size}};let y;if(a){const L=new Set(f),H=G=>{const K=a.parentOf.get(l[G].id),se=K===void 0?void 0:s.get(K);return se!==void 0&&L.has(se)?se:void 0},U=f.filter(G=>H(G)===void 0),$=[...U];for(let G=0;G<$.length;G++)for(const K of(I=a.childrenOf.get(l[$[G]].id))!=null?I:[]){const se=s.get(K);se!==void 0&&L.has(se)&&H(se)===$[G]&&$.push(se)}const P=G=>{var fe;const K=p(G);for(const B of $){const W=H(B);W!==void 0&&K.depth.get(B)<=K.depth.get(W)&&K.depth.set(B,K.depth.get(W)+1)}const se=[...new Set(K.depth.values())].sort((B,W)=>B-W),V=new Map(se.map((B,W)=>[B,W]));for(const[B,W]of K.depth)K.depth.set(B,V.get(W));const re=new Map;for(const B of K.depth.values())re.set(B,((fe=re.get(B))!=null?fe:0)+1);return Z(F({},K),{widest:Math.max(...re.values()),rows:re.size})};y=(U.length?U:f).map(P)}else y=f.map(p);const v=Math.min(...y.map(L=>L.widest));let x=null;for(const L of y){if(L.widest>v+B5)continue;const H=q5(L.depth,L.order,L.rows,m,n);(!x||H.crossings<x.crossings||H.crossings===x.crossings&&(L.widest<x.widest||L.widest===x.widest&&L.rows<x.rows))&&(x={crossings:H.crossings,widest:L.widest,rows:L.rows,root:L.root,layers:H.layers,depth:L.depth})}const{layers:b,depth:w}=x,C=b.length,N=new Map,k=L=>{var U;var H;return 1+((U=(H=c.get(L))==null?void 0:H.length)!=null?U:0)};{let L=0;for(const H of b[0])N.set(H,L),L+=k(H)}const M=(L,H)=>{const U=b[L].map(P=>{const G=m[P].filter(K=>w.get(K)===H);return G.length?G.reduce((K,se)=>K+N.get(se),0)/G.length:NaN});for(let P=0;P<U.length;P++)Number.isFinite(U[P])||(U[P]=P>0?U[P-1]+k(b[L][P-1]):0);const $=V5(U,b[L].map(k));b[L].forEach((P,G)=>N.set(P,$[G]))};for(let L=1;L<C;L++)M(L,L-1);for(let L=C-2;L>=0;L--)M(L,L+1);for(let L=1;L<C;L++)M(L,L-1);for(const[L,H]of c)H.forEach((U,$)=>N.set(U,N.get(L)+1+$));const D=[...new Set(N.values())].sort((L,H)=>L-H),j=new Map(D.map((L,H)=>[L,H])),A=new Map,O=new Map;for(const L of f)A.set(L,j.get(N.get(L))),O.set(L,w.get(L));for(const[L,H]of c)for(const U of H)A.set(U,j.get(N.get(U))),O.set(U,w.get(L));return{col:A,row:O}}function q5(e,t,n,a,s){const o=Array.from({length:n},()=>[]);for(const y of t)o[e.get(y)].push(y);const l=new Map,c=()=>o.forEach(y=>y.forEach((v,x)=>l.set(v,x)));c();const u=(y,v)=>{const x=e.get(y);let b=0,w=0;for(const C of a[y]){const N=e.get(C);N===v?(b+=l.get(C),w+=1):N===x&&(b+=.5*l.get(C),w+=.5)}return w?b/w:l.get(y)};for(let y=0;y<s;y++){const v=y%2===0,x=v?o.keys():[...o.keys()].reverse();for(const b of x){const w=v?b-1:b+1;if(w<0||w>=n)continue;const C=o[b].map(N=>({g:N,b:u(N,w),i:l.get(N)}));C.sort((N,k)=>N.b-k.b||N.i-k.i),o[b]=C.map(N=>N.g),c()}}const f=()=>{let y=0;for(let v=0;v+1<n;v++){const x=[];for(const b of o[v])for(const w of a[b])e.get(w)===v+1&&x.push([l.get(b),l.get(w)]);for(let b=0;b<x.length;b++)for(let w=b+1;w<x.length;w++)(x[b][0]-x[w][0])*(x[b][1]-x[w][1])<0&&y++}for(let v=0;v<n;v++)for(const x of o[v])for(const b of a[x])b>x&&e.get(b)===v&&(y+=Math.abs(l.get(x)-l.get(b))-1);return y};let m=f();const p=8;for(let y=0;y<4;y++){let v=!1;for(let x=0;x<n;x++){const b=o[x];if(b.length<2||b.length>p)continue;const w=b.slice();let C=w.slice(),N=m;const k=w.slice(),M=new Array(k.length).fill(0);let D=1;const j=()=>{o[x]=k.slice(),c();const A=f();A<N&&(N=A,C=k.slice())};for(j();D<k.length;)if(M[D]<D){const A=D%2===0?0:M[D];[k[A],k[D]]=[k[D],k[A]],j(),M[D]++,D=1}else M[D]=0,D++;o[x]=C,c(),N<m&&(m=N,v=!0)}if(!v)break}for(let y=0;y<6;y++){let v=!1;for(let x=0;x<n;x++){const b=o[x];if(!(b.length<=p))for(let w=0;w<b.length;w++)for(let C=0;C<b.length;C++){if(C===w)continue;const N=b.splice(w,1)[0];b.splice(C,0,N),c();const k=f();if(k<m){m=k,v=!0;break}b.splice(C,1),b.splice(w,0,N),c()}}if(!v)break}return{layers:o,crossings:m}}function V5(e,t){const n=[];let a=0;for(let c=0;c<e.length;c++)n.push(a),a+=t?t[c]:1;const s=[];for(let c=0;c<e.length;c++)for(s.push({start:c,end:c,sum:e[c]-n[c]});s.length>1;){const u=s[s.length-1],f=s[s.length-2],m=f.sum/(f.end-f.start+1),p=u.sum/(u.end-u.start+1);if(m<=p)break;s.pop(),s.pop(),s.push({start:f.start,end:u.end,sum:f.sum+u.sum})}const o=new Array(e.length);let l=-1/0;for(const c of s){const u=c.sum/(c.end-c.start+1);for(let f=c.start;f<=c.end;f++)o[f]=Math.max(Math.round(u+n[f]),l),l=o[f]+(t?t[f]:1)}return o}function G5(e,t,n,a,s,o,l,c,u,f,m){const p=e.length,y=n.map(()=>[]);if(p===0)return{points:y,fallbacks:0};const v=e.map((X,ke)=>({x:t[ke].x,y:t[ke].y,hw:X.width/2,hh:X.height/2})),x=v.map(X=>({x:X.x,y:X.y,hw:X.hw+m.clearance,hh:X.hh+m.clearance})),b=Math.min(...Array.from(a)),w=Math.max(...Array.from(a)),C=Math.min(...Array.from(s)),N=Math.max(...Array.from(s)),k=Array.from({length:m.lanes},(X,ke)=>(ke-(m.lanes-1)/2)*m.laneSpacing),M=(X,ke,we)=>{const $e=[0];for(let tt=1;tt<=we;tt++)tt*ke<=X-3&&($e.push(-tt*ke),$e.push(tt*ke));return $e.sort((tt,Ke)=>tt-Ke)},D=Math.max(...v.map(X=>X.hw)),j=Math.max(...v.map(X=>X.hh)),A=M(D,m.laneSpacing,3),O=M(j,Math.max(8,Math.round(m.laneSpacing/2)),3),R=new Set,E=new Set;for(let X=b-1;X<=w;X++)for(const ke of k)R.add(c.x+X*o+o/2+ke);for(let X=C-1;X<=N;X++)for(const ke of k)E.add(c.y+X*l+l/2+ke);for(let X=b;X<=w;X++)for(const ke of A)R.add(c.x+X*o+ke);for(let X=C;X<=N;X++)for(const ke of O)E.add(c.y+X*l+ke);const I=[...R].sort((X,ke)=>X-ke),L=[...E].sort((X,ke)=>X-ke),H=new Map(I.map((X,ke)=>[X,ke])),U=new Map(L.map((X,ke)=>[X,ke])),$=I.length,P=L.length,G=(X,ke)=>ke*$+X,K=new Uint8Array($*P),se=new Uint8Array($*P),V=new Int32Array($*P).fill(-1),re=new Int32Array($*P).fill(-1),fe=X=>f[X]!==void 0?f[X]:1e6+X,B=(X,ke,we,$e,tt)=>{const Ke=Math.min(X,we),dt=Math.max(X,we),ye=Math.min(ke,$e),Se=Math.max(ke,$e);return Ke<tt.x+tt.hw-1e-9&&dt>tt.x-tt.hw+1e-9&&ye<tt.y+tt.hh-1e-9&&Se>tt.y-tt.hh+1e-9};for(const X of x){const ke=zf(I,X.x-X.hw),we=Bf(I,X.x+X.hw),$e=zf(L,X.y-X.hh),tt=Bf(L,X.y+X.hh);for(let Ke=Math.max(0,$e-1);Ke<=Math.min(P-1,tt);Ke++)for(let dt=Math.max(0,ke-1);dt<=Math.min($-1,we);dt++)dt+1<$&&B(I[dt],L[Ke],I[dt+1],L[Ke],X)&&(K[G(dt,Ke)]=1),Ke+1<P&&B(I[dt],L[Ke],I[dt],L[Ke+1],X)&&(se[G(dt,Ke)]=1)}const W=new Uint16Array($*P),ae=new Uint16Array($*P),J=e.map((X,ke)=>{const we=v[ke],$e=x[ke],tt=[];for(const Ke of A){const dt=we.x+Ke;if(Math.abs(Ke)>we.hw-3||!H.has(dt))continue;const ye=H.get(dt),Se=L[Bf(L,$e.y-$e.hh)-1],Be=L[zf(L,$e.y+$e.hh)];Se!==void 0&&Se<$e.y-$e.hh+1e-9&&tt.push({side:3,port:{x:dt,y:we.y-we.hh},vertex:G(ye,U.get(Se)),used:!1}),Be!==void 0&&Be>$e.y+$e.hh-1e-9&&tt.push({side:1,port:{x:dt,y:we.y+we.hh},vertex:G(ye,U.get(Be)),used:!1})}for(const Ke of O){const dt=we.y+Ke;if(Math.abs(Ke)>we.hh-3||!U.has(dt))continue;const ye=U.get(dt),Se=I[Bf(I,$e.x-$e.hw)-1],Be=I[zf(I,$e.x+$e.hw)];Se!==void 0&&Se<$e.x-$e.hw+1e-9&&tt.push({side:2,port:{x:we.x-we.hw,y:dt},vertex:G(H.get(Se),ye),used:!1}),Be!==void 0&&Be>$e.x+$e.hw-1e-9&&tt.push({side:0,port:{x:we.x+we.hw,y:dt},vertex:G(H.get(Be),ye),used:!1})}return tt}),le=n.map((X,ke)=>({i:ke,cls:u[ke],d:X?Math.abs(t[X[0]].x-t[X[1]].x)+Math.abs(t[X[0]].y-t[X[1]].y):-1})).filter(X=>X.d>=0).sort((X,ke)=>{var we,$e;return X.cls-ke.cls||((we=f[X.i])!=null?we:-1)-(($e=f[ke.i])!=null?$e:-1)||ke.d-X.d||X.i-ke.i});let be=0;const je=new X5,De=new Float64Array($*P*4),Ae=new Int32Array($*P*4),Xe=new Uint8Array($*P*4),Fe=n.map(()=>null),me=(X,ke,we)=>{const{states:$e}=ke;for(let dt=1;dt<$e.length;dt++){const ye=Math.floor($e[dt-1]/4),Se=$e[dt]%4,Be=ye%$,at=Math.floor(ye/$),Pe=Se===0?G(Be,at):Se===2?G(Be-1,at):Se===1?G(Be,at):G(Be,at-1),gt=fe(X);Se===0||Se===2?we>0?V[Pe]=gt:V[Pe]===gt&&f[X]===void 0&&(V[Pe]=-1):we>0?re[Pe]=gt:re[Pe]===gt&&f[X]===void 0&&(re[Pe]=-1),$e[dt-1]%4===Se&&(Se===0||Se===2?W[ye]+=we:ae[ye]+=we)}const tt=$e[$e.length-1],Ke=Math.floor(tt/4);tt%4===0||tt%4===2?W[Ke]+=we:ae[Ke]+=we,f[X]===void 0?ke.startSlot.used=we>0:we>0&&(ke.startSlot.used=!0),ke.endSlot.used=we>0},Q=new Map,ue=X=>{const[ke,we]=n[X],$e=f[X],tt=$e!==void 0?Q.get($e):void 0,Ke=tt?[tt]:J[ke].filter(qe=>!qe.used),dt=J[we].filter(qe=>!qe.used),ye=fe(X),Se=u[X]===2?2*m.crossingPenalty:m.crossingPenalty,Be=new Map;for(const qe of dt)Be.set(qe.vertex,qe);const at=v[we],Pe=qe=>Math.abs(I[qe%$]-at.x)+Math.abs(L[Math.floor(qe/$)]-at.y)-at.hw-at.hh;De.fill(1/0),Xe.fill(0),je.clear();const gt=new Map;for(const qe of Ke){const vt=qe.side,ht=Math.hypot(qe.port.x-I[qe.vertex%$],qe.port.y-L[Math.floor(qe.vertex/$)]),Vt=qe.vertex*4+vt;ht<De[Vt]&&(De[Vt]=ht,Ae[Vt]=-1,gt.set(Vt,qe),je.push(ht+Pe(qe.vertex),ht,Vt))}let ct=-1;for(;je.size;){const{state:qe}=je.pop();if(Xe[qe])continue;Xe[qe]=1;const vt=Math.floor(qe/4),ht=qe%4,Vt=Be.get(vt);if(Vt&&ht===(Vt.side+2)%4){ct=qe;break}const Zt=vt%$,Qa=Math.floor(vt/$);for(let ln=0;ln<4;ln++){if(ln===(ht+2)%4)continue;const cn=Zt+zw[ln].dx,aa=Qa+zw[ln].dy;if(cn<0||aa<0||cn>=$||aa>=P)continue;const rn=ln===0?G(Zt,Qa):ln===2?G(cn,Qa):ln===1?G(Zt,Qa):G(Zt,aa),Zn=ln===0||ln===2,gn=Zn?V[rn]:re[rn];if((Zn?K[rn]:se[rn])||gn>=0&&gn!==ye)continue;const Ln=ln===ht;let ia=Math.abs(Zn?I[cn]-I[Zt]:L[aa]-L[Qa]);Ln||(ia+=m.bendPenalty),Ln&&(Zn?ae[vt]:W[vt])&&(ia+=Se),!Ln&&(ae[vt]||W[vt])&&(ia+=m.bendPenalty/2);const Li=G(cn,aa),nn=Li*4+ln,ja=De[qe]+ia;ja<De[nn]&&(De[nn]=ja,Ae[nn]=qe,je.push(ja+Pe(Li),ja,nn))}}if(ct<0)return null;const Et=[];for(let qe=ct;qe>=0&&(Et.push(qe),Ae[qe]!==-1);qe=Ae[qe]);return Et.reverse(),{states:Et,startSlot:gt.get(Et[0]),endSlot:Be.get(Math.floor(ct/4)),fallback:!1}},xe=X=>{const ke=[X.startSlot.port];for(const we of X.states){const $e=Math.floor(we/4);ke.push({x:I[$e%$],y:L[Math.floor($e/$)]})}return ke.push(X.endSlot.port),Uy(ke)};for(const{i:X}of le){const ke=ue(X);if(!ke){be++;const[we,$e]=n[X];y[X]=Y5(v[we],v[$e]);continue}Fe[X]=ke,me(X,ke,1),f[X]!==void 0&&!Q.has(f[X])&&Q.set(f[X],ke.startSlot)}const ze=X=>{let ke=0;const{states:we}=X;for(let $e=1;$e<we.length;$e++){const tt=Math.floor(we[$e-1]/4),Ke=we[$e]%4;we[$e-1]%4===Ke&&(Ke===0||Ke===2?ke+=ae[tt]:ke+=W[tt])}return ke};for(let X=0;X<2;X++){let ke=!1;for(const{i:we}of le){const $e=Fe[we];if(!$e||f[we]!==void 0)continue;me(we,$e,-1);const tt=ze($e);if(tt===0){me(we,$e,1);continue}const Ke=ue(we);Ke&&ze(Ke)<tt?(Fe[we]=Ke,me(we,Ke,1),ke=!0):me(we,$e,1)}if(!ke)break}return Fe.forEach((X,ke)=>{X&&(y[ke]=xe(X))}),n.forEach((X,ke)=>{X||(y[ke]=[{x:0,y:0},{x:0,y:0}])}),{points:y,fallbacks:be}}function Y5(e,t){const n=t.x-e.x,a=t.y-e.y;if(Math.abs(n)>=Math.abs(a)){const l=e.x+Math.sign(n)*e.hw,c=t.x-Math.sign(n)*t.hw;return Uy([{x:l,y:e.y},{x:(l+c)/2,y:e.y},{x:(l+c)/2,y:t.y},{x:c,y:t.y}])}const s=e.y+Math.sign(a)*e.hh,o=t.y-Math.sign(a)*t.hh;return Uy([{x:e.x,y:s},{x:e.x,y:(s+o)/2},{x:t.x,y:(s+o)/2},{x:t.x,y:o}])}function Uy(e){const t=[];for(const a of e){const s=t[t.length-1];s&&Math.abs(s.x-a.x)<1e-9&&Math.abs(s.y-a.y)<1e-9||t.push({x:a.x,y:a.y})}let n=1;for(;n<t.length-1;){const a=t[n-1],s=t[n],o=t[n+1],l=Math.abs(a.x-s.x)<1e-9&&Math.abs(s.x-o.x)<1e-9||Math.abs(a.y-s.y)<1e-9&&Math.abs(s.y-o.y)<1e-9,c=(s.x-a.x)*(o.x-s.x)+(s.y-a.y)*(o.y-s.y)>=0;l&&c?t.splice(n,1):n++}return t}function zf(e,t){let n=0,a=e.length;for(;n<a;){const s=n+a>>1;e[s]<t-1e-9?n=s+1:a=s}return n}function Bf(e,t){let n=0,a=e.length;for(;n<a;){const s=n+a>>1;e[s]<=t+1e-9?n=s+1:a=s}return n}class X5{constructor(){Ot(this,"f",[]),Ot(this,"g",[]),Ot(this,"s",[])}get size(){return this.f.length}clear(){this.f.length=0,this.g.length=0,this.s.length=0}less(t,n){return this.f[t]<this.f[n]||this.f[t]===this.f[n]&&(this.g[t]>this.g[n]||this.g[t]===this.g[n]&&this.s[t]<this.s[n])}swap(t,n){[this.f[t],this.f[n]]=[this.f[n],this.f[t]],[this.g[t],this.g[n]]=[this.g[n],this.g[t]],[this.s[t],this.s[n]]=[this.s[n],this.s[t]]}push(t,n,a){this.f.push(t),this.g.push(n),this.s.push(a);let s=this.f.length-1;for(;s>0;){const o=s-1>>1;if(this.less(s,o))this.swap(s,o),s=o;else break}}pop(){const t={f:this.f[0],g:this.g[0],state:this.s[0]},n=this.f.pop(),a=this.g.pop(),s=this.s.pop();if(this.f.length){this.f[0]=n,this.g[0]=a,this.s[0]=s;let o=0;for(;;){const l=2*o+1,c=l+1;let u=o;if(l<this.f.length&&this.less(l,u)&&(u=l),c<this.f.length&&this.less(c,u)&&(u=c),u===o)break;this.swap(o,u),o=u}}return t}}function Bw(e){return e.radius!==void 0&&Number.isFinite(e.radius)&&e.radius>0?e.radius:Math.hypot(e.width,e.height)/2}function hN(e,t,n){var l;const a=new Map;for(const c of e){const u=n(c);u!==void 0&&Number.isFinite(u)&&u>=0&&a.set(c,u)}const s=a.size>0,o=new Map;for(const c of K5(e,t)){const u=a.get(c),f=(l=t.get(c))!=null?l:[];o.set(c,u!==void 0?u:f.length?f.reduce((m,p)=>{var y;return m+((y=o.get(p))!=null?y:0)},0):s?0:1)}return o}function _h(e,t){var s;const n=[],a=new Set;for(const o of e){if(a.has(o))continue;const l=[{id:o,depth:0,hasParent:!1}];for(;l.length;){const c=l.pop();if(a.has(c.id))continue;a.add(c.id),n.push(c);const u=(s=t.get(c.id))!=null?s:[];for(let f=u.length-1;f>=0;f--)l.push({id:u[f],depth:c.depth+1,hasParent:!0})}}return n}function K5(e,t){return _h(e,t).map(n=>n.id).reverse()}const Q5=8,Z5=64,J5=15;function W5(e,{minRadius:t=Q5,maxRadius:n=Z5}={}){const a=new Map([...e].map(([m,p])=>[m,Math.sqrt(Math.max(0,p))])),s=[...a.values()],o=Math.min(...s),l=Math.max(...s),c=$a(t,2),u=$a(n,2),f=new Map;for(const[m,p]of a){const y=l>o?(p-o)/(l-o):.5;f.set(m,Math.sqrt(c+y*(u-c)))}return f}function pN(e,t){return e.map((n,a)=>{var s;return{id:n,i:a,w:(s=t.get(n))!=null?s:0}}).sort((n,a)=>a.w-n.w||n.i-a.i).map(n=>n.id)}const ez=150,tz=12;function mN(e,t,n){var p,y;const a=new Map(e.map(v=>[v.id,v])),{childrenOf:s,roots:o}=zh(e.map(v=>v.id),t),l=hN(e.map(v=>v.id),s,v=>{var x;return(x=a.get(v))==null?void 0:x.weight}),c=v=>{const x=a.get(v);return x?Bw(x):20},u=e.map(v=>Bw(v)).sort((v,x)=>v-x),f=u.length?u[u.length>>1]:20,m=(y=n.nodeMargin)!=null?y:Math.max(tz,((p=n.nodeSpread)!=null?p:.6)*f);return{childrenOf:s,roots:[...o],weightOf:l,radiusOf:c,gap:m}}const Uw=[.5,1.5],Ug=.5,nz=.7;function az(e){const t=e.length,n=2*Math.PI/t,[a,s]=[Uw[0]*n,Uw[1]*n],o=new Map;for(let c=0;c<=2*t;c++){const u=e.map((x,b)=>b).filter(x=>!o.has(x));if(u.length===0)break;const f=2*Math.PI-[...o.values()].reduce((x,b)=>x+b,0),m=u.reduce((x,b)=>x+e[b],0),p=x=>m>0?f*e[x]/m:f/u.length,y=u.filter(x=>p(x)>s);if(y.length){for(const x of y)o.set(x,s);continue}const v=u.filter(x=>p(x)<a);if(v.length){for(const x of v)o.set(x,a);continue}for(const x of u)o.set(x,p(x));break}let l=2*Math.PI-[...o.values()].reduce((c,u)=>c+u,0);if(Math.abs(l)>1e-9){const c=e.map((f,m)=>m).filter(f=>l>0?o.get(f)<=a+1e-12:o.get(f)>=s-1e-12),u=c.length?c:e.map((f,m)=>m);for(const f of u)o.set(f,o.get(f)+l/u.length);l=0}return e.map((c,u)=>o.get(u))}function iz(e,t,n,a){const s=e+a+t;return n>=Math.PI?s:Math.max(s,(t+a/2)/Math.sin(n/2))}function Fw(e,t,n,a,s,o){const l=a/2,c=a<2*Math.PI-1e-9,u=c?[{x:Math.cos(l),y:Math.sin(l)},{x:Math.cos(l),y:-Math.sin(l)}]:[],f=[...t.pts].map(([v,x])=>({p:x,rho:o(v)})),m=v=>{for(const{p:x,rho:b}of f){const w=v+x.x,C=x.y;if(Math.hypot(w,C)<e+s+b*(1+Ug))return!1;if(c){if(Math.abs(Math.atan2(C,w))>l)return!1;for(const N of u){const k=Math.max(0,w*N.x+C*N.y);if(Math.hypot(w-k*N.x,C-k*N.y)<b+s/2)return!1}}}return!0};let p=e+s+n*(1+Ug),y=Math.max(p,iz(e,t.R*(1+Ug),a,s));if(m(p))return p;for(let v=0;v<28&&y-p>.5;v++){const x=(p+y)/2;m(x)?y=x:p=x}return y}function sz(e){var u;const{childrenOf:t,roots:n,weightOf:a,radiusOf:s,gap:o}=e,l=new Map,c=_h(n,t).reverse();for(const{id:f,depth:m,hasParent:p}of c){const y=s(f),v=new Map([[f,{x:0,y:0}]]),x=pN(((u=t.get(f))!=null?u:[]).filter(M=>l.has(M)),a),b=x.map(M=>l.get(M)),w=x.length;let C=[],N=[];if(w===1)C=[p?nz:0],N=[Fw(y,b[0],s(x[0]),2*Math.PI,o,s)];else if(w>1){const M=az(b.map(j=>j.R));let D=-M[0]/2;for(const j of M)C.push(D+j/2),D+=j;if(p){const j=m%2===0?1:-1;let A=1/0,O=1/0,R=-M[0]/2;for(const I of M){const L=Math.atan2(Math.sin(Math.PI-R),Math.cos(Math.PI-R));Math.abs(L)<Math.abs(A)&&(A=L),Math.sign(L)===j&&Math.abs(L)<Math.abs(O)&&(O=L),R+=I}const E=Math.abs(O)<=M[0]?O:A;C=C.map(I=>I+E)}N=b.map((j,A)=>Fw(y,j,s(x[A]),M[A],o,s))}let k=y;x.forEach((M,D)=>{const j=C[D],A=Math.cos(j),O=Math.sin(j),R=N[D]*A,E=N[D]*O;for(const[I,L]of b[D].pts){const H={x:R+L.x*A-L.y*O,y:E+L.x*O+L.y*A};v.set(I,H),k=Math.max(k,Math.hypot(H.x,H.y)+s(I))}}),l.set(f,{pts:v,R:k})}return l}function rz(e,t){const n=Math.min(8,Math.max(.125,t)),a=()=>({w:Math.max(...e.map(c=>c.x+c.r))-Math.min(...e.map(c=>c.x-c.r)),h:Math.max(...e.map(c=>c.y+c.r))-Math.min(...e.map(c=>c.y-c.r))}),s=()=>{const{w:c,h:u}=a();return Math.min(n/c,1/u)};let o={fit:s(),at:e.map(c=>({x:c.x,y:c.y}))};const l=n>=1;for(let c=0;c<80;c++){const{w:u,h:f}=a();if(l?u/f>=n:u/f<=n)break;for(const p of e)l?p.y*=.94:p.x*=.94;for(let p=0;p<60;p++){let y=!1;for(let v=0;v<e.length;v++)for(let x=v+1;x<e.length;x++){const b=e[v],w=e[x];let C=w.x-b.x,N=w.y-b.y,k=Math.hypot(C,N);const M=b.r+w.r-k;M<=1e-6||(k<1e-9&&(C=l?1:0,N=l?0:1,k=1),b.x-=C/k*M/2,b.y-=N/k*M/2,w.x+=C/k*M/2,w.y+=N/k*M/2,y=!0)}if(!y)break}const m=s();m>o.fit&&(o={fit:m,at:e.map(p=>({x:p.x,y:p.y}))})}e.forEach((c,u)=>{c.x=o.at[u].x,c.y=o.at[u].y})}function oz(e,t,n){const{childrenOf:a,roots:s,weightOf:o,gap:l}=e,c=sz(e),u=new Map,f=pN(s,o),m=f.filter(N=>{var k;return((k=a.get(N))!=null?k:[]).length===0}),p=f.filter(N=>{var k;return((k=a.get(N))!=null?k:[]).length>0}),y=p.map(N=>({id:N,r:c.get(N).R+l/2,x:0,y:0}));let v=[],x;if(m.length&&p.length){v=m.map(k=>({id:k,r:c.get(k).R+l/2,x:0,y:0})),Ly(v);const N=sN(v);x={id:"\0lone",r:N.r+2*l,x:0,y:0},v=v.map(k=>Z(F({},k),{x:k.x-N.x,y:k.y-N.y})),y.push(x)}else y.push(...m.map(N=>({id:N,r:c.get(N).R+l/2,x:0,y:0})));Ly(y),n!==void 0&&Number.isFinite(n)&&y.length>1&&y.length<=ez&&rz(y,n);const b=Math.cos(t),w=Math.sin(t),C=(N,k,M)=>{for(const[D,j]of c.get(N).pts)u.set(D,{x:k+j.x*b-j.y*w,y:M+j.x*w+j.y*b})};for(const N of y)if(N===x)for(const k of v)C(k.id,N.x+k.x,N.y+k.y);else C(N.id,N.x,N.y);return u}function lz(e,t,n){const{childrenOf:a,roots:s}=t,o=new Map(n),l=f=>_h([f],a).slice(1).map(m=>m.id),c=new Map(_h(s,a).map(f=>[f.id,f.depth])),u=e.filter(f=>f.pinned&&f.x!==void 0&&f.y!==void 0&&o.has(f.id)).sort((f,m)=>{var p,y;return((p=c.get(f.id))!=null?p:0)-((y=c.get(m.id))!=null?y:0)});for(const f of u){const m=o.get(f.id),p=f.x-m.x,y=f.y-m.y;if(!(p===0&&y===0))for(const v of[f.id,...l(f.id)]){const x=o.get(v);o.set(v,{x:x.x+p,y:x.y+y})}}return o}let Al,pr;const cz=5e4;let Fy={pending:!1};function uz(){return Fy.pending}function dz(e,t,n){var s,o,l;const a=e.map(c=>{var u,f;return`${c.id}|${c.width}|${c.height}|${(u=c.radius)!=null?u:""}|${(f=c.weight)!=null?f:""}`});return`${n}|${(s=t.aspectRatio)!=null?s:""}|${(o=t.nodeMargin)!=null?o:""}|${(l=t.nodeSpread)!=null?l:""}#${a.join(";")}`}function gN(e,t,n,a,s,o=1/0){Fy={passes:0,pairChecks:0,pending:!1};const l=dz(e,a,s);(!Al||Al.key!==l||Al.edges!==t)&&(Al={key:l,edges:t,home:oz(n,s,a.aspectRatio)},pr=void 0);const c=e.filter(m=>m.pinned&&m.x!==void 0&&m.y!==void 0);if(c.length===0)return new Map(Al.home);const u=c.map(m=>`${m.id}@${m.x},${m.y}`).join(";");if(!pr||pr.key!==u||pr.edges!==t){const m=lz(e,n,Al.home),p=n.gap/2,y=e.map(v=>({id:v.id,width:v.width+p,height:v.height+p,pinned:v.pinned,x:0,y:0}));pr={key:u,edges:t,home:m,job:new B6(y,m,a1)}}const f=pr.job;if(f){const m=F({},f.stats),p=f.run(o);p&&(pr.job=void 0),Fy={passes:f.stats.passes-m.passes,pairChecks:f.stats.pairChecks-m.pairChecks,pending:!p}}return new Map(pr.home)}function fz(e,t,n,a={}){var f;const{startAngle:s=Math.PI,homeStrength:o=.18}=a;if(e.length===0)return new Map;const l=mN(e,t,a),c=gN(e,t,l,a,s,cz),u=new Map;for(const m of e){const p=c.get(m.id);if(m.pinned&&m.x!==void 0&&m.y!==void 0){u.set(m.id,{x:m.x,y:m.y});continue}const y=(f=n==null?void 0:n.get(m.id))!=null?f:p;u.set(m.id,{x:y.x+(p.x-y.x)*o,y:y.y+(p.y-y.y)*o})}return u}function $w(e,t,n={}){const{startAngle:a=Math.PI}=n;if(e.length===0)return new Map;const s=mN(e,t,n);return gN(e,t,s,n,a)}function Fg(e,t,n){const a=new Map;for(const[o,l]of t){const c=e.get(o);c&&(a.has(l)||a.set(l,[]),a.get(l).push({x:c.x,y:c.y,r:n(o)}))}const s=new Map;for(const[o,l]of a){const c=sN(l);c&&s.set(o,{x:c.x,y:c.y,r:c.r})}return s}const hz=1.6;function pz(e,t,n,a,s={}){var se,V;const{rowSpacing:o=80,columnSpacing:l=60,viewFanGap:c=40,viewSpacing:u=20,trunkSpacing:f=120,maxRowWidth:m=1024}=s,p=new Map;if(e.length===0)return p;const y=zh(e.map(re=>re.id),t),v=new Set(e.map(re=>re.id)),x=new Set(e.filter(re=>a(re)).map(re=>re.id)),b=new Set(e.filter(re=>!a(re)).map(re=>re.id)),w=y.roots.filter(re=>x.has(re)),C=new Map;for(const[re,fe]of y.childrenOf){if(!x.has(re))continue;const B=fe.filter(W=>x.has(W));B.length>0&&C.set(re,B)}const N=re=>{var W,ae;var fe,B;return{width:(W=(fe=n.get(re))==null?void 0:fe.width)!=null?W:138,height:(ae=(B=n.get(re))==null?void 0:B.height)!=null?ae:30}},k=new Map;for(const re of t){if(!re.structural||re.source===re.target||!v.has(re.source)||!v.has(re.target))continue;const fe=(se=k.get(re.source))!=null?se:[];fe.includes(re.target)||fe.push(re.target),k.set(re.source,fe)}const M=re=>{var W;let fe=0;const B=((W=k.get(re))!=null?W:[]).filter(ae=>b.has(ae));if(B.length===0)return 0;fe+=c;for(let ae=0;ae<B.length;ae++)ae>0&&(fe+=u),fe+=N(B[ae]).width;return fe},D=new Map,j=[];for(const re of w){const fe=Fe=>{var Q;const me=(Q=C.get(Fe))!=null?Q:[];return{id:Fe,children:me.map(fe)}},B=fe(re),W=Wu(B),ae=100+o,J=200+l,le=new Map;W.eachBefore(Fe=>le.set(Fe.data.id,le.size)),uN().nodeSize([J,ae]).separation((Fe,me)=>{const[Q,ue]=le.get(Fe.data.id)<le.get(me.data.id)?[Fe,me]:[me,Fe],xe=N(Q.data.id).width/2+M(Q.data.id),ze=N(ue.data.id).width/2;return(xe+ze+l)/J})(W);const be=new Map;let je=1/0,De=-1/0,Ae=1/0,Xe=-1/0;W.each(Fe=>{const me=Fe.data.id,Q=Fe.x,ue=Fe.y;be.set(me,{x:Q,y:ue}),je=Math.min(je,Q),De=Math.max(De,Q),Ae=Math.min(Ae,ue),Xe=Math.max(Xe,ue)}),j.push({minX:je,maxX:De,minY:Ae,maxY:Xe});for(const[Fe,me]of be)D.set(Fe,me)}const A=[];for(let re=0;re<w.length;re++){const fe=w[re],B=j[re];if(!B)continue;const W=new Set,ae=De=>{var Ae;W.add(De);for(const Xe of(Ae=C.get(De))!=null?Ae:[])ae(Xe)};ae(fe);let J=B.minX,le=B.maxX,be=B.minY,je=B.maxY;for(const De of W){const Ae=D.get(De);if(Ae){const Xe=N(De),Fe=M(De);J=Math.min(J,Ae.x-Xe.width/2),le=Math.max(le,Ae.x+Xe.width/2+Fe),be=Math.min(be,Ae.y-Xe.height/2),je=Math.max(je,Ae.y+Xe.height/2)}}A.push({width:le-J,height:je-be,place:(De,Ae)=>{const Xe=De-J,Fe=Ae-be,me=Q=>{var ue;if(D.has(Q)){const xe=D.get(Q);D.set(Q,{x:xe.x+Xe,y:xe.y+Fe})}for(const xe of(ue=C.get(Q))!=null?ue:[])me(xe)};me(fe)}})}const O=new Set;for(const[re,fe]of k)if(x.has(re))for(const B of fe)b.has(B)&&O.add(B);const R=Array.from(b).filter(re=>!O.has(re));if(R.length>0){const re=A.reduce((le,be)=>Math.max(le,be.height),0),fe=Math.max(...R.map(le=>N(le).height)),B=Math.floor((re+u)/(fe+u)),W=Math.max(1,Math.min(R.length,A.length>0?B:Math.ceil(Math.sqrt(R.length)))),ae=[];for(let le=0;le<R.length;le+=W)ae.push(R.slice(le,le+W));const J=ae.map(le=>Math.max(...le.map(be=>N(be).width)));A.push({width:J.reduce((le,be)=>le+be,0)+(ae.length-1)*u,height:W*fe+(W-1)*u,place:(le,be)=>{let je=le;ae.forEach((De,Ae)=>{De.forEach((Xe,Fe)=>{p.set(Xe,{x:je+J[Ae]/2,y:be+fe/2+Fe*(fe+u)})}),je+=J[Ae]+u})}})}const E=A.reduce((re,fe)=>re+fe.width*fe.height,0),I=A.reduce((re,fe)=>Math.max(re,fe.width),0),L=Math.max(I,m,Math.sqrt(E*hz));let H=0,U=0,$=0;for(const re of A)H>0&&H+re.width>L&&(H=0,U+=$+f,$=0),re.place(H,U),H+=re.width+f,$=Math.max($,re.height);const P=new Map;for(const[re,fe]of k)for(const B of fe)if(b.has(B)){const W=(V=P.get(B))!=null?V:new Set;W.add(re),P.set(B,W)}const G=new Set(Array.from(P.entries()).filter(([re,fe])=>fe.size>1).map(([re])=>re)),K=new Map;for(const[re,fe]of k){if(!x.has(re))continue;const B=D.get(re);if(!B)continue;const W=N(re),ae=fe.filter(J=>b.has(J));if(ae.length!==0)for(let J=0;J<ae.length;J++){const le=ae[J],be=N(le).width;let je=B.x+W.width/2+c;for(let Ae=0;Ae<J;Ae++){const Xe=ae[Ae],Fe=N(Xe).width;je+=Fe+u}const De={x:je+be/2,y:B.y};if(G.has(le)){const Ae=`${le}:${re}`;p.set(Ae,De),K.has(le)||K.set(le,De)}else p.set(le,De)}}for(const[re,fe]of K)p.set(re,fe);for(const[re,fe]of D)p.set(re,fe);return p}const mz=100;function gz(e){let t=!1,n=!1,a=null,s=null,o=null;const l=()=>{t||n||(n=!0,a!==null&&cancelAnimationFrame(a),s!==null&&clearTimeout(s),o=setTimeout(()=>{t||e()},0))};return typeof requestAnimationFrame=="function"?(a=requestAnimationFrame(l),s=setTimeout(l,mz)):l(),()=>{t=!0,a!==null&&cancelAnimationFrame(a),s!==null&&clearTimeout(s),o!==null&&clearTimeout(o)}}const yz=1.5;function vz(e,t,n,a,s={}){const{ringSpacing:o=80,nodeSeparationGap:l=12,trunkPadding:c=6}=s,u={positions:new Map,trunkBoundaries:new Map,ringGeometry:[]};if(e.length===0)return u;const f=a,m=new Set(e.map(O=>O.id));let p={width:40,height:40};if(n.size>0){let O=0,R=0;for(const E of n.values())O=Math.max(O,E.width),R=Math.max(R,E.height);p={width:O,height:R}}const y=O=>{var R;return(R=n.get(O))!=null?R:p},v=O=>{const R=y(O);return Math.hypot(R.width,R.height)/2},x=(O,R,E,I)=>{const L=y(O),H=y(E),U=Math.abs(Math.cos(I)-Math.cos(R)),$=Math.abs(Math.sin(I)-Math.sin(R)),P=(L.width+H.width)/2+l,G=(L.height+H.height)/2+l;return Math.min(U>1e-9?P/U:1/0,$>1e-9?G/$:1/0)},b=O=>{const R=new Set,E=K=>{var V;R.add(K);const se=((V=f.childrenOf.get(K))!=null?V:[]).filter(re=>!R.has(re));return{id:K,children:se.length>0?se.map(E):void 0}},I=Wu(E(O));uN().size([2*Math.PI,1]).separation((K,se)=>{const V=(y(K.data.id).width+y(se.data.id).width)/2+l,re=K.parent===se.parent?1:yz;return V*re/Math.max(K.depth,1)})(I);const L=[],H=new Map;I.each(K=>{var V,re;var se;H.set(K.data.id,K.depth),((V=L[se=K.depth])!=null?V:L[se]=[]).push({id:K.data.id,angle:(re=K.x)!=null?re:0})});const U=[0],$=K=>Math.max(...L[K].map(se=>v(se.id)));for(let K=1;K<L.length;K++){let se=U[K-1]+$(K-1)+$(K)+o;const V=[...L[K]].sort((re,fe)=>re.angle-fe.angle);if(V.length>1)for(let re=0;re<V.length;re++){const fe=V[re],B=V[(re+1)%V.length];se=Math.max(se,x(fe.id,fe.angle,B.id,B.angle))}U.push(se)}const P=new Map;let G=v(O)+10;return L.forEach((K,se)=>{const V=U[se];for(const{id:re,angle:fe}of K)P.set(re,{x:V*Math.cos(fe),y:V*Math.sin(fe)}),G=Math.max(G,V+v(re))}),{positions:P,depthOf:H,ringRadii:U,bubbleRadius:G}},w=f.roots,C=w.map(O=>b(O)),N=C.map(O=>({radius:O.bubbleRadius})),k=Ly(N.map(O=>({r:O.radius+c}))),M=new Map;for(let O=0;O<w.length;O++)M.set(w[O],{x:k[O].x,y:k[O].y});const D=new Map,j=new Map;for(let O=0;O<w.length;O++){const R=w[O],E=C[O],I=M.get(R),L=new Set;for(const[H,U]of E.positions)m.has(H)&&(D.set(H,{x:U.x+I.x,y:U.y+I.y}),j.set(H,R),L.add(E.depthOf.get(H)));for(const H of[...L].sort((U,$)=>U-$))H!==0&&u.ringGeometry.push({trunkId:R,cx:I.x,cy:I.y,r:E.ringRadii[H],depth:H})}const A=e.filter(O=>D.has(O.id));Uu(A,D),u.positions=D;for(let O=0;O<w.length;O++){const R=w[O],E=M.get(R);let I=N[O].radius;for(const[L,H]of D){if(j.get(L)!==R)continue;const U=y(L),$=Math.hypot(U.width,U.height)/2,P=Math.hypot(H.x-E.x,H.y-E.y)+$;I=Math.max(I,P)}u.trunkBoundaries.set(R,{x:E.x,y:E.y,r:I})}return u}function xz(e,t,n,a,s,o){const l=new Set;if(!t)return l;const c=bz(t,n,s,o);for(const u of e)a(u)&&(c.has(u.sourceId)||c.has(u.targetId))&&l.add(u.id);return l}function bz(e,t,n,a){var l,c;const s=new Set;if(s.add(e),!t(e)||!((l=a==null?void 0:a.has(e))!=null&&l))return s;const o=(c=n.childrenOf.get(e))!=null?c:[];for(const u of o)t(u)||s.add(u);return s}const _z=.25,wz=4,Pw=1.2,Uf=20,Hw=.95,qw=.1,Sz=.002,Cz=.05,Nz=1,kz=10;function Mz(e){const t=e.deltaMode===1?Cz:e.deltaMode===2?Nz:Sz,n=e.ctrlKey?kz:1;return Math.pow(2,-e.deltaY*t*n)}function $g(e,t,n,a,s){const o=a/n;return{x:e-o*(e-s.x),y:t-o*(t-s.y)}}function jz(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function yN({minZoom:e=_z,maxZoom:t=wz,bounds:n,onViewportChange:a,containerRef:s,locked:o=!1,onUserGesture:l}){const[c,u]=T.useState(1),[f,m]=T.useState({x:0,y:0}),p=T.useRef(1),y=T.useRef({x:0,y:0}),v=T.useRef(o);T.useEffect(()=>{v.current=o},[o]);const x=T.useRef(null),b=T.useRef(!1),w=T.useRef(),C=T.useRef(),N=T.useRef(null),k=T.useRef(null),M=T.useRef(null),D=T.useCallback(J=>{p.current=J,u(J)},[]),j=T.useCallback(J=>{y.current=J,m(J)},[]),A=T.useCallback(()=>{k.current===null&&(k.current=requestAnimationFrame(()=>{k.current=null,u(p.current),m(y.current)}))},[]),O=T.useCallback(()=>{M.current!==null&&(cancelAnimationFrame(M.current),M.current=null)},[]),R=T.useRef(a);R.current=a;const E=T.useRef(l);E.current=l;const I=T.useCallback(J=>{var le;(le=E.current)==null||le.call(E,J)},[]);T.useEffect(()=>{var J;(J=R.current)==null||J.call(R,{x:f.x,y:f.y,zoom:c})},[f,c]);const L=T.useCallback((J,le)=>{if(!n)return{x:J,y:le};const be=-n.maxX*p.current,je=-n.minX*p.current,De=-n.maxY*p.current,Ae=-n.minY*p.current;return{x:Math.max(be,Math.min(je,J)),y:Math.max(De,Math.min(Ae,le))}},[n]),H=T.useCallback(J=>{var le;(le=w.current)==null||le.call(w,J)},[]),U=T.useCallback(()=>{var J;(J=C.current)==null||J.call(C)},[]),$=T.useCallback(()=>{b.current||(document.addEventListener("pointermove",H),document.addEventListener("pointerup",U),b.current=!0)},[H,U]),P=T.useCallback(()=>{b.current&&(document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",U),b.current=!1)},[H,U]),G=T.useCallback(J=>{if(!x.current)return;const le=J.clientX-x.current.lastX,be=J.clientY-x.current.lastY,je=performance.now(),De=Math.max(1,je-x.current.time)/1e3;x.current.vx=le/De,x.current.vy=be/De,x.current.time=je,x.current.lastX=J.clientX,x.current.lastY=J.clientY,N.current!==null&&cancelAnimationFrame(N.current),N.current=requestAnimationFrame(()=>{if(!x.current)return;const Ae=L(x.current.panX+(J.clientX-x.current.x),x.current.panY+(J.clientY-x.current.y));j(Ae),N.current=null,I("change")})},[L,j,I]),K=T.useCallback(()=>{if(!x.current){P();return}const J=jz(),le=x.current.vx,be=x.current.vy,je=Math.sqrt(le*le+be*be);if(x.current=null,P(),J||je<qw){I("end");return}let De=le,Ae=be,Xe=performance.now();const Fe=()=>{const me=performance.now(),Q=(me-Xe)/1e3;if(Xe=me,De*=Math.pow(Hw,Q*60),Ae*=Math.pow(Hw,Q*60),Math.sqrt(De*De+Ae*Ae)<qw){M.current=null,I("end");return}j(L(y.current.x+De*Q,y.current.y+Ae*Q)),I("change"),M.current=requestAnimationFrame(Fe)};M.current=requestAnimationFrame(Fe)},[P,L,j,I]),se=T.useCallback(J=>{v.current||(O(),x.current={x:J.clientX,y:J.clientY,lastX:J.clientX,lastY:J.clientY,panX:y.current.x,panY:y.current.y,vx:0,vy:0,time:performance.now()},$(),I("start"))},[$,O,I]);T.useEffect(()=>{w.current=G},[G]),T.useEffect(()=>{C.current=K},[K]),T.useEffect(()=>()=>{P(),N.current!==null&&cancelAnimationFrame(N.current),k.current!==null&&cancelAnimationFrame(k.current),O()},[P,O]);const V=T.useCallback(J=>{if(v.current)return;J.preventDefault();const le=J.currentTarget.getBoundingClientRect(),be=J.clientX-le.left,je=J.clientY-le.top;if(!Number.isFinite(be)||!Number.isFinite(je))return;O();const De=p.current,Ae=Math.min(t,Math.max(e,De*Mz(J))),Xe=$g(be,je,De,Ae,y.current);p.current=Ae,y.current=L(Xe.x,Xe.y),A(),I("change"),I("end")},[L,e,t,O,A,I]);T.useEffect(()=>{const J=s.current;if(J)return J.addEventListener("wheel",V,{passive:!1}),()=>J.removeEventListener("wheel",V)},[s,V]);const re=T.useCallback(J=>{if(v.current)return;const le=J.key;let be=null,je=null;if(le==="+"||le==="=")be=Math.min(t,p.current*Pw);else if(le==="-"||le==="_")be=Math.max(e,p.current/Pw);else if(le==="ArrowUp")je={x:y.current.x,y:y.current.y+Uf};else if(le==="ArrowDown")je={x:y.current.x,y:y.current.y-Uf};else if(le==="ArrowLeft")je={x:y.current.x+Uf,y:y.current.y};else if(le==="ArrowRight")je={x:y.current.x-Uf,y:y.current.y};else return;if(J.preventDefault(),O(),be!==null){const De=s.current,Ae=De?De.clientWidth/2:0,Xe=De?De.clientHeight/2:0;je=$g(Ae,Xe,p.current,be,y.current),p.current=be}je!==null&&(y.current=L(je.x,je.y)),A(),I("change"),I("end")},[L,e,t,s,O,A,I]),fe=T.useCallback((J,le,be)=>{O();const je=Math.min(t,Math.max(e,J)),De=p.current;if(D(je),le!==void 0&&be!==void 0){const Ae=$g(le,be,De,je,y.current);j(L(Ae.x,Ae.y))}},[L,e,t,O,D,j]),B=T.useCallback((J,le)=>{O(),j(L(J,le))},[L,O,j]),W=T.useCallback(()=>{O(),D(1),j({x:0,y:0})},[O,D,j]),ae=T.useCallback(()=>({x:y.current.x,y:y.current.y,zoom:p.current}),[]);return{transform:`matrix(${c}, 0, 0, ${c}, ${f.x}, ${f.y})`,viewport:{x:f.x,y:f.y,zoom:c},bind:{onPointerDown:se,onKeyDown:re,tabIndex:0,role:"region"},zoomTo:fe,panTo:B,reset:W,getViewport:ae}}const Ez=.15,Rz=30;function Tz({active:e,nodes:t,edges:n,options:a,onTick:s,initialPositions:o,onRunningChange:l}){const c=T.useRef({nodes:t,edges:n,options:a}),u=T.useRef(s),f=T.useRef(void 0),m=T.useRef(null),p=T.useRef(0),y=T.useRef(l);y.current=l;const v=T.useRef(!1),x=T.useCallback(N=>{var k;v.current!==N&&(v.current=N,(k=y.current)==null||k.call(y,N))},[]);T.useEffect(()=>{c.current={nodes:t,edges:n,options:a}},[t,n,a]),T.useEffect(()=>{u.current=s},[s]);const b=T.useCallback(()=>{const{nodes:N,edges:k,options:M}=c.current,D=f.current,j=fz(N,k,D,M);let A=0;if(D)for(const[O,R]of j){const E=D.get(O);if(!E)continue;const I=Math.hypot(R.x-E.x,R.y-E.y);I>A&&(A=I)}else A=1/0;if(f.current=j,u.current(j),p.current=A<Ez&&!uz()?p.current+1:0,p.current>=Rz){m.current=null,x(!1);return}m.current=requestAnimationFrame(b)},[x]),w=T.useCallback(()=>{p.current=0,m.current===null&&e&&(m.current=requestAnimationFrame(b),x(!0))},[e,b,x]),C=T.useRef(null);return T.useEffect(()=>{const N=t.map(M=>M.id).sort().join(" "),k=C.current!==null&&C.current!==N;C.current=N,k&&w()},[t,w]),T.useEffect(()=>{if(!e){m.current!==null&&(cancelAnimationFrame(m.current),m.current=null),x(!1);return}return f.current=o&&o.size>0?new Map(o):void 0,p.current=0,m.current=requestAnimationFrame(b),x(!0),()=>{m.current!==null&&(cancelAnimationFrame(m.current),m.current=null)}},[e]),{wake:w}}const vN=T.createContext(null),xN=T.createContext(null);function s1(){const e=T.useContext(vN);if(!e)throw new Error("useGraphCanvas must be used within a GraphCanvas");return e}const Az=44,bN=ve.forwardRef((D,M)=>{var j=D,{id:e,label:t,kind:n,domainColor:a="default",selected:s=!1,onSelect:o,hasChildren:l=!1,collapsed:c=!1,hiddenDescendantCount:u=0,onToggleCollapse:f,onPopoverOpen:m,popoverOpen:p=!1,popoverPanelId:y,tooltipId:v,onFocus:x,onBlur:b,className:w="",style:C,bodyRadius:N}=j,k=Me(j,["id","label","kind","domainColor","selected","onSelect","hasChildren","collapsed","hiddenDescendantCount","onToggleCollapse","onPopoverOpen","popoverOpen","popoverPanelId","tooltipId","onFocus","onBlur","className","style","bodyRadius"]);const A=N!==void 0&&Number.isFinite(N)&&N>0,O=A?2*N:void 0,R=["graph-node",A&&"graph-node--body",A&&O<Az&&"graph-node--body-unlabeled",s&&"selected",w].filter(Boolean).join(" ");return h.jsxs("div",Z(F(F(F(F(F({ref:M,className:R,"data-domain":a,"data-kind":n,onClick:E=>{E.stopPropagation();try{o==null||o(e)}catch(I){console.error("onSelect failed:",I)}try{m==null||m(E.currentTarget)}catch(I){console.error("onPopoverOpen failed:",I)}},onFocus:x,onBlur:b,onKeyDown:E=>{if(E.target===E.currentTarget){if((E.key==="Enter"||E.key===" ")&&!E.shiftKey){E.preventDefault(),E.stopPropagation();try{o==null||o(e)}catch(I){console.error("onSelect failed:",I)}try{m==null||m(E.currentTarget)}catch(I){console.error("onPopoverOpen failed:",I)}}else if(E.key==="Enter"&&E.shiftKey&&l&&f){E.preventDefault(),E.stopPropagation();try{f()}catch(I){console.error("onToggleCollapse failed:",I)}}}},role:o||m||l&&f?"button":void 0,tabIndex:o||m||l&&f?0:void 0,"aria-pressed":o?s:void 0,"aria-haspopup":m?"dialog":void 0},m&&{"aria-expanded":p}),m&&y&&{"aria-controls":y}),v&&{"aria-describedby":v}),A&&{style:{width:O,height:O},title:t}),k),{children:[h.jsx("span",{className:"graph-node__swatch"}),h.jsx("span",{className:"graph-node__label",children:t}),n&&h.jsx("span",{className:"graph-node__kind",children:n}),l&&f&&h.jsxs("button",{className:"graph-node__collapse-toggle",onClick:E=>{E.preventDefault(),E.stopPropagation();try{f()}catch(I){console.error("onToggleCollapse failed:",I)}},onKeyDown:E=>{if((E.key==="Enter"||E.key===" ")&&E.target===E.currentTarget){E.preventDefault(),E.stopPropagation();try{f()}catch(I){console.error("onToggleCollapse failed:",I)}}},type:"button","aria-label":c?`Expand ${t}`:`Collapse ${t}`,"aria-expanded":!c,children:[h.jsx("svg",{className:"graph-node__toggle-icon",viewBox:"0 0 24 24",width:"12",height:"12",children:c?h.jsx("polyline",{points:"9 6 15 12 9 18",strokeWidth:"1.75",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"}):h.jsx("polyline",{points:"6 9 12 15 18 9",strokeWidth:"1.75",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}),c&&u>0&&h.jsx("span",{className:"graph-node__hidden-badge",children:u})]})]}))});bN.displayName="GraphNode";const Vw=1,Dz=8,Lz=20,Oz={default:1.25,hot:1.75,irrelevant:1.25},Pg={default:7,hot:8,irrelevant:7};function Iz(e){const t=Number.isFinite(e)?e:0,n=Math.min(100,Math.max(0,t)),a=Dz-Vw;return Vw+a*Math.sqrt(n/100)}function zz(e,t,n){return Math.min(e*(n/t),Lz)}function Bz(e){return Array.isArray(e)?`${e[0]} ${e[1]}`:`${e} ${e}`}function r1({id:e,d:t,mid:n,label:a,variant:s,weight:o,opacity:l,strokeDash:c,detailedTestIds:u=!1,onSelect:f}){const m=`arrow-${e}`,p=`arrow-rose-${e}`,y=`arrow-cyan-${e}`,v=s==="hot"?`url(#${y})`:s==="irrelevant"?`url(#${p})`:`url(#${m})`,x=o!==void 0?Iz(o):void 0,b=Oz[s],w=R=>x!==void 0?zz(R,b,x):R,C=x!==void 0?"userSpaceOnUse":void 0,N={};x!==void 0&&(N.strokeWidth=x),l!==void 0&&(N.opacity=l),c!==void 0&&(N.strokeDasharray=Bz(c));const k=l!==void 0?{opacity:l}:void 0,M=w(Pg.default),D=w(Pg.irrelevant),j=w(Pg.hot),A=f?R=>{R.stopPropagation(),f(e)}:void 0,O=a?sc(a):null;return h.jsxs(h.Fragment,{children:[h.jsxs("defs",{children:[h.jsx("marker",{id:m,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:M,markerHeight:M,markerUnits:C,orient:"auto-start-reverse",children:h.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--graph-edge-strong, #94a3b8)",style:k})}),h.jsx("marker",{id:p,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:D,markerHeight:D,markerUnits:C,orient:"auto-start-reverse",children:h.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"rgb(var(--status-rose))",style:k})}),h.jsx("marker",{id:y,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:j,markerHeight:j,markerUnits:C,orient:"auto-start-reverse",children:h.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"rgb(var(--accent-primary))",style:k})})]}),h.jsx("path",{className:"graph-edge__hit",d:t,onClick:A,"data-testid":u?`graph-edge-hit-${e}`:void 0}),h.jsx("path",{className:"graph-edge__line",d:t,markerEnd:v,style:Object.keys(N).length?N:void 0,"data-testid":u?`graph-edge-line-${e}`:void 0}),a&&O&&h.jsxs("g",{className:f?"graph-edge__label graph-edge__label--clickable":"graph-edge__label",transform:`translate(${n.x-O.width/2}, ${n.y-O.height/2})`,onClick:A,children:[h.jsx("rect",{width:O.width,height:O.height,rx:"3",className:"graph-edge__label-bg","data-testid":u?`graph-edge-label-bg-${e}`:void 0}),h.jsx("text",{x:O.width/2,y:O.height/2+3,className:"graph-edge__label-text","data-testid":u?`graph-edge-label-text-${e}`:void 0,children:a})]})]})}r1.displayName="GraphEdgeShape";const Gw=1.3,_N=ve.forwardRef((s,a)=>{var o=s,{position:e="bottom-right",className:t=""}=o,n=Me(o,["position","className"]);var O,R;const{zoomBy:l,zoomToFit:c,locked:u,setLocked:f,isFullscreen:m,toggleFullscreen:p,layout:y,liveSimulation:v,setLiveSimulation:x}=s1(),b=T.useContext(xN),w=(O=b==null?void 0:b.zoomBy)!=null?O:l,C=(R=b==null?void 0:b.zoomToFit)!=null?R:c,N=T.useCallback(()=>w(Gw),[w]),k=T.useCallback(()=>w(1/Gw),[w]),M=T.useCallback(()=>C(),[C]),D=T.useCallback(()=>f(E=>!E),[f]),j=T.useCallback(()=>x(E=>!E),[x]),A=["graph-toolbar",`graph-toolbar--${e}`,t].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:a,className:A,"data-no-drag":!0},n),{children:[h.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:N,"aria-label":"Zoom in",children:h.jsx(He,{name:"zoomIn",size:16})}),h.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:k,"aria-label":"Zoom out",children:h.jsx(He,{name:"zoomOut",size:16})}),h.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:M,"aria-label":"Zoom to fit",children:h.jsx(He,{name:"maximize",size:16})}),h.jsx("div",{className:"graph-toolbar__divider"}),h.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:D,"aria-pressed":u,"aria-label":u?"Unlock pan and zoom":"Lock pan and zoom",children:h.jsx(He,{name:u?"lock":"unlock",size:16})}),h.jsx("div",{className:"graph-toolbar__divider"}),h.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:p,"aria-pressed":m,"aria-label":m?"Exit fullscreen":"Fullscreen",children:h.jsx(He,{name:m?"fullscreenExit":"fullscreen",size:16})}),y==="galaxy"&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"graph-toolbar__divider"}),h.jsx("button",{type:"button",className:"graph-toolbar__btn",onClick:j,"aria-pressed":v,"aria-label":v?"Disable live simulation":"Enable live simulation",children:h.jsx(He,{name:"orbit",size:16})})]})]}))});_N.displayName="GraphToolbar";const Hg=24,Uz=4,wN=ve.forwardRef(({nodeId:e,label:t,collapsed:n,hiddenDescendantCount:a,onToggleCollapse:s,x:o,y:l,nodeWidth:c},u)=>{const f=T.useCallback(b=>{b.stopPropagation(),b.preventDefault();try{s()}catch(w){console.error("onToggleCollapse failed:",w)}},[s]),m=T.useCallback(b=>{b.stopPropagation(),b.preventDefault()},[]),p=T.useCallback(b=>{if(b.key==="Enter"||b.key===" "){b.preventDefault(),b.stopPropagation();try{s()}catch(w){console.error("onToggleCollapse failed:",w)}}},[s]),y=`${n?"Expand":"Collapse"} ${t}`,v=o+c/2+Uz,x=l-Hg/2;return h.jsx("foreignObject",{x:v,y:x,width:Hg,height:Hg,overflow:"visible",className:"graph-collapse-control-container",children:h.jsxs("button",{ref:u,type:"button",className:"graph-collapse-control","aria-label":y,"aria-expanded":!n,onClick:f,onPointerDown:m,onKeyDown:p,"data-testid":`graph-collapse-control-${e}`,children:[n&&a>0&&h.jsx("span",{className:"graph-collapse-control__badge",children:a}),h.jsx(He,{name:n?"chevronRight":"chevronDown",size:12})]})})});wN.displayName="GraphCollapseControl";const Yw=200,Fz=150,Xw=e=>e==="force"||e==="organic"||e==="orthogonal"||e==="galaxy"||e==="force-clustered"||e==="ux-navigation"||e==="radial-tree",SN=e=>e.replace(/[^\w:.-]/g,"_"),$z=e=>`tooltip-node-${SN(e)}`,Pz=e=>`tooltip-edge-${SN(e)}`,qa=138,Va=30,Hz=.05,qz=8,Kw=3;function Vz(e,t,n){try{return e(t,n)}catch(a){return console.error("Error in renderEdge callback:",a),null}}function Gz(e,t,n,a,s){try{return e(t,n,a,s)}catch(o){return console.error("Error in renderNode callback:",o),null}}function qg(e,t){const{groupHeads:n,leafToGroup:a}=z5(e,t),s=new Set(n);for(const o of e)s.has(o)||a.delete(o);return a}function Yi(e,t,n){if(!e)return n!=="ux-navigation";try{return e(t)}catch(a){return console.error("Error in isStructuralEdge callback:",a),n!=="ux-navigation"}}function Vg(e,t){if(!e)return!0;try{return e(t)}catch(n){return console.error("Error in isPageNode callback:",n),!0}}function Gg(e,t){if(!e)return!1;try{return e(t)}catch(n){return console.error("Error in isNavigationRoute callback:",n),!1}}const Rr=6;function Yz(e,t,n){var v,x,b,w;const{width:a,height:s}=sc(e),o=(v=t==null?void 0:t.width)!=null?v:qa,l=(x=t==null?void 0:t.height)!=null?x:Va,c=(b=n==null?void 0:n.width)!=null?b:qa,u=(w=n==null?void 0:n.height)!=null?w:Va,f=(o+c)/2+a,m=(l+u)/2+s,p=2/Math.PI,y=p*f+(1-p)*m+2*Rr;return{length:y,label:{width:a+2*Rr,height:s+2*Rr,offset:Math.min(80,y*Ih)/2}}}function Xz({id:e,sourceId:t,targetId:n,sourceLabel:a,targetLabel:s,label:o,variant:l="default",weight:c,opacity:u,strokeDash:f,sourceAnchor:m,targetAnchor:p,curvature:y,selected:v,hovered:x,onSelect:b,onHoverStart:w,onHoverEnd:C,renderEdge:N,onPopoverOpen:k,hasPopover:M,popoverOpen:D,popoverPanelId:j,tooltipId:A,isNavigationRoute:O=!1,preRoutedEdge:R}){const{getNodeRect:E,nodeRects:I}=s1(),L=T.useMemo(()=>{var fe,B;if(R){let W=R.mid;if(o){const ae=sc(o),J=ae.width/2+Rr,le=ae.height/2+Rr;W=(B=((fe=R.labelAnchors)!=null?fe:[]).find(be=>I.every(je=>Math.abs(be.x-je.x)>=J+je.width/2||Math.abs(be.y-je.y)>=le+je.height/2)))!=null?B:Ay(R.points,ae,I,Rr,R.isPolyline)}return Z(F({},R),{labelPos:W})}const G=E(t),K=E(n);if(!G||!K)return null;const se=I.filter(W=>!(W.x===G.x&&W.y===G.y&&W.width===G.width&&W.height===G.height)&&!(W.x===K.x&&W.y===K.y&&W.width===K.width&&W.height===K.height)),V=O?II(G,K,se):mh(G,K,{sourceAnchor:m,targetAnchor:p,curvature:y}),re=o?Ay(V.points,sc(o),I,Rr,V.isPolyline):V.mid;return Z(F({},V),{labelPos:re})},[R,o,I,E,t,n,m,p,y,O]);if(!L)return null;const H=["graph-edge",l!=="default"&&`graph-edge--${l}`,O&&"graph-edge--navigation",v&&"selected"].filter(Boolean).join(" "),U=!!b||!!M||!!A,$={id:e,sourceId:t,targetId:n,label:o,variant:l,weight:c,opacity:u,strokeDash:f,sourceAnchor:m,targetAnchor:p,curvature:y},P=U?G=>{G.stopPropagation(),M&&k&&k(e,G.currentTarget),b&&b(e)}:void 0;return h.jsx("g",Z(F(F(F({className:H,role:U?"button":"presentation","aria-hidden":U?void 0:!0,"aria-pressed":U?!!v:void 0,"aria-haspopup":M?"dialog":void 0},M&&{"aria-expanded":!!D}),M&&j&&{"aria-controls":j}),U&&A&&{"aria-describedby":A}),{"aria-label":U?Wv(o,a||t,s||n):void 0,tabIndex:U?0:void 0,onClick:P,onKeyDown:U?G=>{(G.key==="Enter"||G.key===" ")&&(G.preventDefault(),M&&k&&k(e,G.currentTarget),b&&b(e))}:void 0,onPointerEnter:w?()=>w(e):void 0,onPointerLeave:C?()=>C(e):void 0,"data-testid":`graph-edge-${e}`,children:N?h.jsxs(h.Fragment,{children:[Vz(N,$,{path:L.d,mid:L.mid,labelPos:L.labelPos,angle:L.angle,selected:!!v,hovered:!!x}),h.jsx("path",{className:"graph-edge__hit",d:L.d,onClick:P})]}):h.jsx(r1,{id:e,d:L.d,mid:L.labelPos,label:o,variant:l,weight:c,opacity:u,strokeDash:f,onSelect:b})}))}const Kz=1500,Qz=150;function Zz(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}const o1=ve.forwardRef((Xe,Ae)=>{var Fe=Xe,{nodes:e=[],edges:t=[],selectedNodeId:n,onNodeSelect:a,onNodeHover:s,nodeTooltip:o,nodeTooltipTrigger:l="hover",edgeTooltip:c,edgeTooltipTrigger:u="hover",nodePopover:f,edgePopover:m,centerOnSelect:p=!1,renderNode:y,renderEdge:v,layout:x="manual",nodeMargin:b,showClusterBoundaries:w,showHierarchyRings:C=!1,isStructuralEdge:N,structuralEdgeCurvature:k=Ih,isPageNode:M,isNavigationRoute:D,showAllRelations:j=!1,collapsedNodeIds:A,onToggleCollapse:O,fitView:R=!1,fitPadding:E=40,minZoom:I=Hz,maxZoom:L=qz,selectedEdgeId:H,onEdgeSelect:U,onEdgeHover:$,onBackgroundClick:P,onLayoutStateChange:G,showLayoutIndicator:K=!0,draggable:se=!0,onNodeDragEnd:V,showToolbar:re=!0,toolbarPosition:fe="bottom-right",fullscreenContainerRef:B,onViewportDwell:W,dwellMs:ae=Kz,onViewportNavigate:J,initialViewport:le,viewportRef:be,className:je=""}=Fe,De=Me(Fe,["nodes","edges","selectedNodeId","onNodeSelect","onNodeHover","nodeTooltip","nodeTooltipTrigger","edgeTooltip","edgeTooltipTrigger","nodePopover","edgePopover","centerOnSelect","renderNode","renderEdge","layout","nodeMargin","showClusterBoundaries","showHierarchyRings","isStructuralEdge","structuralEdgeCurvature","isPageNode","isNavigationRoute","showAllRelations","collapsedNodeIds","onToggleCollapse","fitView","fitPadding","minZoom","maxZoom","selectedEdgeId","onEdgeSelect","onEdgeHover","onBackgroundClick","onLayoutStateChange","showLayoutIndicator","draggable","onNodeDragEnd","showToolbar","toolbarPosition","fullscreenContainerRef","onViewportDwell","dwellMs","onViewportNavigate","initialViewport","viewportRef","className"]);const me=w!=null?w:x!=="galaxy",[Q,ue]=T.useState(new Map),[xe,ze]=T.useState(new Map),[X,ke]=T.useState(),[we,$e]=T.useState(),[tt,Ke]=T.useState(),[dt,ye]=T.useState(),[Se,Be]=T.useState(),[at,Pe]=T.useState(),gt=T.useRef(!1),ct=T.useRef({}),Et=T.useRef(null);T.useEffect(()=>{try{s==null||s(X)}catch(q){console.error("Error in onNodeHover callback:",q)}},[X,s]),T.useEffect(()=>{try{$==null||$(we)}catch(q){console.error("Error in onEdgeHover callback:",q)}},[we,$]),T.useEffect(()=>{we&&((t!=null?t:[]).some(q=>q.id===we)||($e(void 0),ct.current.edgeTimer&&clearTimeout(ct.current.edgeTimer),ye(void 0)))},[we,t]),T.useEffect(()=>()=>{ct.current.nodeTimer&&clearTimeout(ct.current.nodeTimer),ct.current.edgeTimer&&clearTimeout(ct.current.edgeTimer)},[]);const[qe,vt]=T.useState(new Map),ht=T.useRef(null),Vt=T.useCallback(q=>{var de;const ie=ht.current;if(ie)try{if(ie.dragging){if(q){const et=ie.target,Ie=Ge=>{Ge.stopPropagation(),Ge.preventDefault()};et.addEventListener("click",Ie,{capture:!0,once:!0})}const Le=(de=qe.get(ie.id))!=null?de:{x:ie.startX,y:ie.startY};V==null||V(ie.id,Le)}}finally{ht.current=null}},[qe,V]),Zt=T.useRef(Vt);T.useEffect(()=>{Zt.current=Vt},[Vt]);const Qa=T.useMemo(()=>e.map(q=>q.id).sort().join(" "),[e]),ln=T.useRef(!1);T.useEffect(()=>{if(!ln.current){ln.current=!0;return}const q=ht.current;if(q!=null&&q.dragging)try{q.target.releasePointerCapture(q.pointerId)}catch(ie){ie instanceof DOMException||console.warn("GraphCanvas: releasePointerCapture failed",ie)}Zt.current(!1),vt(new Map)},[Qa]);const[cn,aa]=T.useState(!1),[rn,Zn]=T.useState(!1),gn=T.useRef(!1),Ln=T.useRef(null),[ia,Li]=T.useState(!1),nn=ia&&x==="galaxy",ja=T.useRef(nn);T.useEffect(()=>{ja.current=nn},[nn]);const an=T.useMemo(()=>{const q=t.map(ie=>({source:ie.sourceId,target:ie.targetId,structural:Yi(N,ie,x)}));return zh(e.map(ie=>ie.id),q)},[e,t,N,x]),Za=T.useMemo(()=>{if(x!=="galaxy")return null;const q=new Map(e.map(ie=>[ie.id,ie.weight]));return hN(e.map(ie=>ie.id),an.childrenOf,ie=>q.get(ie))},[x,e,an]),xi=T.useMemo(()=>e.some(q=>q.weight!==void 0&&Number.isFinite(q.weight)&&q.weight>=0),[e]),wn=T.useMemo(()=>Za&&!y?W5(Za,xi?{}:{minRadius:J5}):null,[Za,y,xi]),Oi=T.useCallback(q=>({weight:Za==null?void 0:Za.get(q),radius:wn==null?void 0:wn.get(q)}),[Za,wn]),Ii=T.useCallback(q=>{const ie=wn==null?void 0:wn.get(q);if(ie!==void 0)return ie;const de=Q.get(q);return de?Math.hypot(de.width,de.height)/2:20},[wn,Q]),bi=T.useMemo(()=>{if(!A||A.size===0)return new Set;const q=new Set;for(const ie of A)for(const de of zy(ie,an.childrenOf))q.add(de);return q},[A,an]),Ea=T.useMemo(()=>{if(x!=="ux-navigation"||!D)return new Set;const q=new Map(e.map(ie=>[ie.id,ie]));return xz(t,X,ie=>{const de=q.get(ie);return de?Vg(M,de):!1},ie=>Gg(D,ie),an,A)},[x,D,t,X,an,A,M,e]),ce=T.useMemo(()=>{const q=new Set,ie=[];for(const de of e)q.has(de.id)||(q.add(de.id),bi.has(de.id)||ie.push(de));return ie},[e,bi]);T.useEffect(()=>{X&&(ce.some(q=>q.id===X)||(ke(void 0),ct.current.nodeTimer&&clearTimeout(ct.current.nodeTimer),Ke(void 0)))},[X,ce]);const[Ue,Je]=T.useState(new Map),[ft,on]=T.useState([]),[Ra,_i]=T.useState(null),[Sn,Ta]=T.useState(new Map),[Ja,Aa]=T.useState(()=>Xw(x)&&e.length>0),Wa=T.useRef(null),[Is,Cn]=T.useState(0),[pc,nd]=T.useState(null);if(pc)throw pc;const ha=T.useRef(null),as=T.useRef({}),Br=T.useRef(!1),[mc,ad]=T.useState(!1),[xt,Ho]=T.useState(null),Ur=T.useRef(null),On=T.useMemo(()=>{if(!(x!=="galaxy"||!xt||xt.height===0))return Math.round(xt.width/xt.height*20)/20},[x,xt]),sa=T.useRef(On);T.useEffect(()=>{sa.current=On});const Fr=T.useRef(W);Fr.current=W;const qo=T.useRef(J);qo.current=J;const Vo=T.useRef(ae);Vo.current=ae;const $r=T.useRef(xt);$r.current=xt;const Pr=T.useRef(()=>({x:0,y:0,zoom:1})),Hr=T.useRef(null),Hn=T.useRef(!1),zi=T.useRef(null),qr=T.useRef(null),Vr=T.useRef(le?{viewport:le,silent:!0}:null),is=T.useRef(!1),zs=T.useCallback(q=>{const ie=$r.current;if(!ie)return null;const de=-q.x/q.zoom,Le=-q.y/q.zoom,et=(ie.width-q.x)/q.zoom,Ie=(ie.height-q.y)/q.zoom;return{center:{x:(de+et)/2,y:(Le+Ie)/2},zoom:q.zoom,bounds:{minX:de,minY:Le,maxX:et,maxY:Ie}}},[]),ss=T.useCallback(()=>{Hr.current!==null&&(clearTimeout(Hr.current),Hr.current=null)},[]),Da=T.useCallback(()=>{zi.current!==null&&(cancelAnimationFrame(zi.current),zi.current=null)},[]),Go=T.useCallback(q=>{q!=="end"&&Da(),Fr.current&&(ss(),q==="change"?Hn.current=!0:q==="end"&&Hn.current&&(Hr.current=setTimeout(()=>{var ie;Hr.current=null,Hn.current=!1;const de=zs(Pr.current());if(de)try{(ie=Fr.current)==null||ie.call(Fr,de)}catch(Le){console.error("Error in onViewportDwell callback:",Le)}},Vo.current)))},[Da,ss,zs]),{transform:id,viewport:pt,bind:Bi,panTo:qn,zoomTo:pa,getViewport:La}=yN({minZoom:I,maxZoom:L,containerRef:ha,locked:cn,onUserGesture:Go});Pr.current=La;const Bt=T.useCallback(q=>{Da(),ss(),Hn.current=!1,qr.current=q&&qo.current?{cause:q,target:La()}:null},[Da,ss,La]);T.useEffect(()=>{var q;const ie=qr.current;if(!ie)return;const{target:de}=ie,Le=La();if(Le.x!==de.x||Le.y!==de.y||Le.zoom!==de.zoom){qr.current=null;return}if(pt.x!==de.x||pt.y!==de.y||pt.zoom!==de.zoom)return;qr.current=null;const et=zs(de);if(et)try{(q=qo.current)==null||q.call(qo,et,ie.cause)}catch(Ie){console.error("Error in onViewportNavigate callback:",Ie)}}),T.useEffect(()=>()=>{ss(),Da()},[ss,Da]);const Ui=T.useCallback(q=>{const ie=$r.current;if(!ie)return!1;const de=Math.min(L,Math.max(I,q.zoom));return pa(de),qn(ie.width/2-q.center.x*de,ie.height/2-q.center.y*de),!0},[I,L,pa,qn]),Bs=T.useCallback((q,ie={})=>{var un;var de,Le;if(!Number.isFinite((de=q==null?void 0:q.center)==null?void 0:de.x)||!Number.isFinite((Le=q==null?void 0:q.center)==null?void 0:Le.y)||!Number.isFinite(q==null?void 0:q.zoom)||q.zoom<=0){console.warn("GraphCanvas: setViewport() ignored an invalid viewport",q);return}const et=(un=ie.silent)!=null?un:!1,Ie=$r.current;if(!Br.current||!Ie){Vr.current={viewport:q,silent:et};return}const Ge=et?null:{kind:"imperative"};if(!ie.animate||Zz()){Ui(q),Bt(Ge);return}Bt(null);const Ye=La(),Ze={x:(Ie.width/2-Ye.x)/Ye.zoom,y:(Ie.height/2-Ye.y)/Ye.zoom},Jt=Math.min(L,Math.max(I,q.zoom)),Nn=performance.now(),yn=Kt=>{const rt=Math.min(1,(Kt-Nn)/Qz);if(rt>=1){zi.current=null,Ui(q),Bt(Ge);return}const vn=1-Math.pow(1-rt,3);Ui({center:{x:Ze.x+(q.center.x-Ze.x)*vn,y:Ze.y+(q.center.y-Ze.y)*vn},zoom:Ye.zoom*Math.pow(Jt/Ye.zoom,vn)}),zi.current=requestAnimationFrame(yn)};zi.current=requestAnimationFrame(yn)},[Ui,Bt,La,I,L]),wi=T.useCallback(()=>zs(La()),[zs,La]);T.useImperativeHandle(be,()=>({setViewport:Bs,getViewport:wi}),[Bs,wi]);const Si=T.useRef(null),sd=T.useCallback(q=>{if(q.target instanceof Element&&q.target.closest(".graph-node, .graph-edge, [data-no-drag]")){Si.current=null;return}Si.current={x:q.clientX,y:q.clientY},Bi.onPointerDown(q)},[Bi]),gc=T.useCallback(q=>{const ie=Si.current;Si.current=null,ie&&Math.hypot(q.clientX-ie.x,q.clientY-ie.y)<Kw&&(Be(void 0),Pe(void 0),P==null||P())},[P]),yc=`grid${T.useId().replace(/:/g,"")}`;T.useLayoutEffect(()=>{const q=new Map;for(const ie of ce){const de=as.current[ie.id];q.set(ie.id,{width:(de==null?void 0:de.offsetWidth)||qa,height:(de==null?void 0:de.offsetHeight)||Va})}ue(q)},[ce,y,wn]),T.useEffect(()=>{if(!Xw(x)||ce.length===0){Aa(!1);return}if(Q.size===0)return;if(x==="galaxy"&&ja.current){Aa(!1);return}const q=()=>{if(x==="galaxy"&&ja.current){Aa(!1);return}let ie,de=new Map,Le=new Map,et=[];try{const Ie=ce.map((Ge,Ye)=>{var Nn,yn,un,Kt;var Ze,Jt;return{id:Ge.id,x:(Nn=Ge.x)!=null?Nn:Math.cos(2*Math.PI*Ye/ce.length)*120,y:(yn=Ge.y)!=null?yn:Math.sin(2*Math.PI*Ye/ce.length)*120,width:(un=(Ze=Q.get(Ge.id))==null?void 0:Ze.width)!=null?un:qa,height:(Kt=(Jt=Q.get(Ge.id))==null?void 0:Jt.height)!=null?Kt:Va,pinned:Ge.x!==void 0&&Ge.y!==void 0}});if(x==="force"){const Ge=(t!=null?t:[]).map(Ye=>({source:Ye.sourceId,target:Ye.targetId}));ie=Oy(Ie,Ge,{nodeMargin:b})}else if(x==="organic"){const Ge=(t!=null?t:[]).map(Ze=>F({source:Ze.sourceId,target:Ze.targetId},Ze.label?Yz(Ze.label,Q.get(Ze.sourceId),Q.get(Ze.targetId)):{})),Ye=ce.map(Ze=>{var yn,un,Kt,rt;var Jt,Nn;return{id:Ze.id,x:(yn=Ze.x)!=null?yn:NaN,y:(un=Ze.y)!=null?un:NaN,width:(Kt=(Jt=Q.get(Ze.id))==null?void 0:Jt.width)!=null?Kt:qa,height:(rt=(Nn=Q.get(Ze.id))==null?void 0:Nn.height)!=null?rt:Va,pinned:Ze.x!==void 0&&Ze.y!==void 0}});ie=M5(Ye,Ge,{minimumNodeDistance:b}).positions}else if(x==="orthogonal"){const Ge=new Set(ce.map(rt=>rt.id)),Ye=(t!=null?t:[]).filter(rt=>Ge.has(rt.sourceId)&&Ge.has(rt.targetId)),Ze=ce.map(rt=>{var oa,ls,Ps,Hs;var vn,$s;return{id:rt.id,x:(oa=rt.x)!=null?oa:NaN,y:(ls=rt.y)!=null?ls:NaN,width:(Ps=(vn=Q.get(rt.id))==null?void 0:vn.width)!=null?Ps:qa,height:(Hs=($s=Q.get(rt.id))==null?void 0:$s.height)!=null?Hs:Va,pinned:rt.x!==void 0&&rt.y!==void 0}}),Jt=new Map(e.map(rt=>[rt.id,rt])),Nn=U5(Ze,Ye.map(rt=>({source:rt.sourceId,target:rt.targetId,structural:N?Yi(N,rt,x):void 0,navigationRoute:D?Gg(D,rt):void 0})),M?{isPageNode:rt=>{const vn=Jt.get(rt);return vn?Vg(M,vn):!0}}:{}),yn=new Map,un=[];ie=Nn.positions;const Kt=Ze.map(rt=>Z(F({},Nn.positions.get(rt.id)),{w:rt.width,h:rt.height}));Ye.forEach((rt,vn)=>{var ls,Ps,Hs;var $s;const oa=OI((ls=Nn.routes[vn])!=null?ls:[]);if(oa){if(rt.label&&($s=oa.labelAnchors)!=null&&$s.length){const Zr=sc(rt.label),gd=(ki,dn,qs)=>Math.abs(ki.x-dn.x)>=(Zr.width+dn.w)/2+qs||Math.abs(ki.y-dn.y)>=(Zr.height+dn.h)/2+qs,yd=ki=>Kt.every(dn=>gd(ki,dn,Rr)),Zh=ki=>yd(ki)&&un.every(dn=>gd(ki,dn,2)),Jo=(Hs=(Ps=oa.labelAnchors.find(Zh))!=null?Ps:oa.labelAnchors.find(yd))!=null?Hs:oa.labelAnchors[0];oa.labelAnchors=[Jo,...oa.labelAnchors.filter(ki=>ki!==Jo)],un.push({x:Jo.x,y:Jo.y,w:Zr.width,h:Zr.height})}yn.set(rt.id,oa)}}),de=yn}else if(x==="force-clustered"){const Ge=(t!=null?t:[]).map(Ze=>({source:Ze.sourceId,target:Ze.targetId})),Ye=Y6(Ie,Ge,{nodeMargin:b});ie=Ye.positions,Le=Ye.clusterBoundaries}else if(x==="ux-navigation"){const Ge=(t!=null?t:[]).map(Ze=>({source:Ze.sourceId,target:Ze.targetId,structural:Yi(N,Ze,x)})),Ye=new Map(e.map(Ze=>[Ze.id,Ze]));ie=pz(Ie,Ge,Q,Ze=>{const Jt=Ye.get(Ze.id);return Jt?Vg(M,Jt):!0})}else if(x==="radial-tree"){const Ge=(t!=null?t:[]).map(Ze=>({source:Ze.sourceId,target:Ze.targetId,structural:Yi(N,Ze,x)})),Ye=vz(Ie,Ge,Q,an);ie=Ye.positions,Le=Ye.trunkBoundaries,et=Ye.ringGeometry}else{const Ge=(t!=null?t:[]).map(Ze=>({source:Ze.sourceId,target:Ze.targetId,structural:Yi(N,Ze,x)}));ie=$w(Ie.map(Ze=>F(F({},Ze),Oi(Ze.id))),Ge,{nodeMargin:b,aspectRatio:sa.current});const Ye=qg(an.roots,an.childrenOf);Le=Fg(ie,Ye,Ii)}}catch(Ie){Aa(!1),nd(Ie);return}ze(ie),Ta(de),Je(Le),on(et),_i(x),Aa(!1)};return Wa.current=q,Aa(!0),Cn(ie=>ie+1),()=>{Wa.current===q&&(Wa.current=null)}},[ce,t,Q,x,b,N,M,D,an,e,A,Oi,Ii]),T.useEffect(()=>{const q=Wa.current;if(q)return gz(()=>{Wa.current===q&&(Wa.current=null,q())})},[Is]);const rs=T.useCallback(()=>ce.map(q=>{var Ge,Ye,Ze,Jt;var ie,de;const Le=qe.get(q.id),et=(Ge=Le==null?void 0:Le.x)!=null?Ge:q.x,Ie=(Ye=Le==null?void 0:Le.y)!=null?Ye:q.y;return F({id:q.id,width:(Ze=(ie=Q.get(q.id))==null?void 0:ie.width)!=null?Ze:qa,height:(Jt=(de=Q.get(q.id))==null?void 0:de.height)!=null?Jt:Va,x:et,y:Ie,pinned:et!==void 0&&Ie!==void 0},Oi(q.id))}),[ce,Q,qe,Oi]),Ci=T.useMemo(()=>nn?rs():[],[nn,rs]),vc=T.useMemo(()=>nn?(t!=null?t:[]).map(q=>({source:q.sourceId,target:q.targetId,structural:Yi(N,q,x)})):[],[nn,t,N,x]),os=T.useMemo(()=>nn?qg(an.roots,an.childrenOf):null,[nn,an]),Fi=T.useCallback(q=>{ze(q),!(!me||!os)&&Je(Fg(q,os,Ii))},[me,os,Ii]),[xc,Yo]=T.useState(!1),{wake:Xo}=Tz({active:nn,nodes:Ci,edges:vc,options:{nodeMargin:b,aspectRatio:On},onTick:Fi,initialPositions:xe,onRunningChange:Yo}),Ni=Ja?"computing":nn&&xc?"simulating":"idle",Us=T.useRef(G);Us.current=G;const bc=T.useRef("idle");T.useEffect(()=>{var q;if(bc.current!==Ni){bc.current=Ni;try{(q=Us.current)==null||q.call(Us,Ni)}catch(ie){console.error("Error in onLayoutStateChange callback:",ie)}}},[Ni]);const In=T.useMemo(()=>{const q=new Set;if(!Ja)return q;for(const ie of ce)ie.x!==void 0&&ie.y!==void 0||qe.has(ie.id)||xe.has(ie.id)||q.add(ie.id);return q},[Ja,ce,qe,xe]);T.useEffect(()=>{const q=ha.current;if(!q)return;const ie=new ResizeObserver(de=>{const{width:Le,height:et}=de[0].contentRect;Le>0&&et>0&&Ho({width:Le,height:et})});return ie.observe(q),()=>ie.disconnect()},[]),T.useEffect(()=>{const q=()=>{var Le;const ie=(Le=B==null?void 0:B.current)!=null?Le:ha.current,de=document.fullscreenElement===ie;Zn(de),Ln.current!==null&&(clearTimeout(Ln.current),Ln.current=null),de?(gn.current=!0,Ln.current=setTimeout(()=>{gn.current=!1,Ln.current=null},500)):gn.current=!1};return document.addEventListener("fullscreenchange",q),()=>{document.removeEventListener("fullscreenchange",q),Ln.current!==null&&clearTimeout(Ln.current)}},[B]);const $i=T.useCallback(()=>{var Ie;var q,ie,de,Le;const et=(Ie=B==null?void 0:B.current)!=null?Ie:ha.current;document.fullscreenElement===et?(ie=(q=document.exitFullscreen)==null?void 0:q.call(document))==null||ie.catch(Ge=>{console.warn("GraphCanvas: exitFullscreen() was rejected",Ge)}):(Le=(de=et==null?void 0:et.requestFullscreen)==null?void 0:de.call(et))==null||Le.catch(Ge=>{console.warn("GraphCanvas: requestFullscreen() was rejected for the fullscreenContainerRef (or default root) target",Ge)})},[B]),zn=T.useCallback(q=>{var de;return qe.get(q.id)||(q.x!==void 0&&q.y!==void 0?{x:q.x,y:q.y}:(de=xe.get(q.id))!=null?de:{x:0,y:0})},[qe,xe]),Pi=T.useCallback(()=>{var et;let q=1/0,ie=-1/0,de=1/0,Le=-1/0;for(const Ie of ce){const Ge=zn(Ie),Ye=(et=Q.get(Ie.id))!=null?et:{width:qa,height:Va};q=Math.min(q,Ge.x-Ye.width/2),ie=Math.max(ie,Ge.x+Ye.width/2),de=Math.min(de,Ge.y-Ye.height/2),Le=Math.max(Le,Ge.y+Ye.height/2)}return Number.isFinite(q)?{minX:q,maxX:ie,minY:de,maxY:Le}:null},[ce,Q,zn]),Ko=T.useMemo(()=>{const q=[];if(me&&q.push(...Ue.values()),C)for(const ie of ft)q.push({x:ie.cx,y:ie.cy,r:ie.r});return q},[me,Ue,C,ft]);T.useEffect(()=>{if(Br.current||!xt||Q.size===0||ce.length===0||(x==="force"||x==="organic"||x==="orthogonal"||x==="galaxy"||x==="force-clustered"||x==="ux-navigation"||x==="radial-tree")&&(xe.size===0||Ra!==x))return;const q=Pi();if(!q)return;Br.current=!0,ad(!0);const ie=Vr.current;if(Vr.current=null,ie&&Ui(ie.viewport))is.current=!0,Fs.current=n,Bt(ie.silent?null:{kind:"imperative"});else if(R){const de=Ag(Tg(q,Ko),xt.width,xt.height,E,I,L);pa(de.zoom),qn(de.panX,de.panY),Bt({kind:"fit",reason:"mount"})}else{const de=(q.minX+q.maxX)/2,Le=(q.minY+q.maxY)/2;qn(xt.width/2-de*pt.zoom,xt.height/2-Le*pt.zoom),Bt({kind:"fit",reason:"mount"})}},[xt,Q,xe,ce,x,pt.zoom,qn,pa,Ui,Bt,n,R,E,Pi,Ra,Ko]);const Fs=T.useRef(void 0);T.useEffect(()=>{if(!p||!mc||cn||n===Fs.current)return;if(!n){Fs.current=void 0;return}if(!xt)return;const q=ce.find(de=>de.id===n);if(!q)return;Fs.current=n;const ie=zn(q);qn(xt.width/2-ie.x*pt.zoom,xt.height/2-ie.y*pt.zoom),Bt({kind:"center-on-select",nodeId:n})},[p,mc,n,cn,xt,ce,zn,pt.zoom,qn,Bt]),T.useEffect(()=>{const q=Ur.current;if(Ur.current=xt,!Br.current||!q||!xt||q.width===xt.width&&q.height===xt.height)return;const ie=(q.width/2-pt.x)/pt.zoom,de=(q.height/2-pt.y)/pt.zoom;qn(xt.width/2-ie*pt.zoom,xt.height/2-de*pt.zoom)},[xt,pt.x,pt.y,pt.zoom,qn]);const Gr=T.useRef(void 0);T.useEffect(()=>{var Nn,yn,un;if(x!=="galaxy"||On===void 0||Gr.current===On||cn||Q.size===0)return;const q=Gr.current===void 0;if(Gr.current=On,ja.current){Xo();return}const ie=rs(),de=(t!=null?t:[]).map(Kt=>({source:Kt.sourceId,target:Kt.targetId,structural:Yi(N,Kt)})),Le=$w(ie,de,{nodeMargin:b,aspectRatio:On});ze(Le);const et=qg(an.roots,an.childrenOf),Ie=Fg(Le,et,Ii);Je(Ie);let Ge=1/0,Ye=-1/0,Ze=1/0,Jt=-1/0;for(const Kt of ce){const rt=(yn=(Nn=qe.get(Kt.id))!=null?Nn:Le.get(Kt.id))!=null?yn:{x:0,y:0},vn=(un=Q.get(Kt.id))!=null?un:{width:qa,height:Va};Ge=Math.min(Ge,rt.x-vn.width/2),Ye=Math.max(Ye,rt.x+vn.width/2),Ze=Math.min(Ze,rt.y-vn.height/2),Jt=Math.max(Jt,rt.y+vn.height/2)}if(Number.isFinite(Ge)&&xt&&!(q&&is.current)){const Kt={minX:Ge,maxX:Ye,minY:Ze,maxY:Jt};if(R){const rt=Ag(me?Tg(Kt,Ie.values()):Kt,xt.width,xt.height,E,I,L);pa(rt.zoom),qn(rt.panX,rt.panY)}else{const rt=(Kt.minX+Kt.maxX)/2,vn=(Kt.minY+Kt.maxY)/2;qn(xt.width/2-rt*pt.zoom,xt.height/2-vn*pt.zoom)}Bt(Br.current?{kind:"fit",reason:q?"mount":"resize"}:null)}},[On,x,cn]);const ei=T.useCallback((q,ie)=>{const de=Pi();if(!de||!xt)return;const Le=Ag(Tg(de,Ko),xt.width,xt.height,q!=null?q:E,I,L);pa(Le.zoom),qn(Le.panX,Le.panY),Bt(ie)},[Pi,Ko,xt,E,I,L,pa,qn,Bt]),Yr=T.useCallback(q=>ei(q,{kind:"imperative"}),[ei]);T.useEffect(()=>{!gn.current||!xt||(gn.current=!1,!cn&&ei(void 0,{kind:"fit",reason:"fullscreen"}))},[xt,ei,cn]);const Xr=T.useCallback(q=>{if(!xt){pa(pt.zoom*q);return}pa(pt.zoom*q,xt.width/2,xt.height/2)},[xt,pt.zoom,pa]),rd=T.useCallback(q=>{Xr(q),Bt({kind:"imperative"})},[Xr,Bt]),od=T.useCallback(q=>{pa(q),Bt({kind:"imperative"})},[pa,Bt]),ld=T.useCallback((q,ie)=>{qn(q,ie),Bt({kind:"imperative"})},[qn,Bt]),_c=T.useMemo(()=>({zoomBy:q=>{Xr(q),Go("change"),Go("end")},zoomToFit:()=>ei(void 0,{kind:"fit",reason:"toolbar"})}),[Xr,Go,ei]),cd=T.useCallback(q=>{$e(ie=>ie===q?void 0:ie)},[]),Ph=T.useCallback(q=>{$e(q),c&&(ct.current.edgeTimer&&clearTimeout(ct.current.edgeTimer),ct.current.edgeTimer=setTimeout(()=>{ye(q)},Yw))},[c]),Hh=T.useCallback(q=>{cd(q),ct.current.edgeTimer&&clearTimeout(ct.current.edgeTimer),ye(void 0)},[cd]),ud=T.useCallback(q=>{ke(q),o&&(ct.current.nodeTimer&&clearTimeout(ct.current.nodeTimer),ct.current.nodeTimer=setTimeout(()=>{Ke(q)},Yw))},[o]),dd=T.useCallback(q=>{ke(ie=>ie===q?void 0:ie),ct.current.nodeTimer&&clearTimeout(ct.current.nodeTimer),Ke(void 0)},[]),Vn=T.useCallback(q=>{var Ie;const ie=ce.find(Ge=>Ge.id===q);if(!ie)return e.some(Ge=>Ge.id===q)||console.warn(`GraphCanvas: node "${q}" not found`),null;const de=zn(ie),Le=(Ie=Q.get(q))!=null?Ie:{width:qa,height:Va},et=wn==null?void 0:wn.get(q);return F({x:de.x,y:de.y,width:Le.width,height:Le.height},et!==void 0?{radius:et}:{})},[e,ce,Q,zn,wn]),qh=T.useCallback((q,ie)=>{if(!se)return;q.stopPropagation();const de=zn(ie);ht.current={id:ie.id,pointerId:q.pointerId,startClientX:q.clientX,startClientY:q.clientY,startX:de.x,startY:de.y,dragging:!1,target:q.currentTarget}},[se,zn]),Vh=T.useCallback(q=>{const ie=ht.current;if(!ie||ie.pointerId!==q.pointerId)return;const de=q.clientX-ie.startClientX,Le=q.clientY-ie.startClientY;if(!ie.dragging&&Math.hypot(de,Le)<Kw)return;const et=de/pt.zoom,Ie=Le/pt.zoom;ie.dragging||q.currentTarget.setPointerCapture(q.pointerId),ie.dragging=!0;const Ge={x:ie.startX+et,y:ie.startY+Ie};vt(Ye=>{const Ze=new Map(Ye);return Ze.set(ie.id,Ge),Ze}),Xo()},[pt.zoom,Xo]),fd=T.useCallback(q=>{const ie=ht.current;!ie||ie.pointerId!==q.pointerId||Vt(q.type==="pointerup")},[Vt]);T.useEffect(()=>{if(se)return;const q=ht.current;if(q){if(q.dragging)try{q.target.releasePointerCapture(q.pointerId)}catch(ie){ie instanceof DOMException||console.warn("GraphCanvas: releasePointerCapture failed",ie)}Vt(!1)}},[se,Vt]);const Qo=T.useMemo(()=>ce.map(q=>Vn(q.id)).filter(q=>q!==null),[ce,Vn]),wc=T.useMemo(()=>{if(x!=="orthogonal"||Sn.size===0)return new Map;if(qe.size===0)return Sn;const q=new Map;for(const ie of t!=null?t:[]){const de=Sn.get(ie.id);de&&!qe.has(ie.sourceId)&&!qe.has(ie.targetId)&&q.set(ie.id,de)}return q},[x,Sn,qe,t]),Gh=T.useMemo(()=>{if(x!=="ux-navigation"||!D)return new Map;const q=t.filter(de=>{try{return D(de)}catch(Le){return!1}});if(q.length===0)return new Map;const ie=q.map(de=>{const Le=Vn(de.sourceId),et=Vn(de.targetId);return!Le||!et?null:{id:de.id,source:Le,target:et}}).filter(de=>de!==null);return ie.length===0?new Map:zI(ie,Qo,e1)},[x,D,t,Vn,Qo,N,k]),Zo=T.useCallback(q=>{var Ie,Ge;var ie;const de=((Ie=(ie=an.childrenOf.get(q))==null?void 0:ie.length)!=null?Ie:0)>0,Le=(Ge=A==null?void 0:A.has(q))!=null?Ge:!1,et=Le?zy(q,an.childrenOf).size:0;return{hasChildren:de,collapsed:Le,hiddenDescendantCount:et,onToggleCollapse:O?()=>O(q):void 0}},[an,A,O]),Sc=T.useCallback((q,ie)=>{Et.current=ie;try{(f?f(q):l==="click"&&o?o(q):null)!=null&&(Be(q.id),Pe(void 0))}catch(de){console.error("Error in nodePopover/nodeTooltip callback:",de),gt.current=!0,Be(q.id),Pe(void 0)}},[f,o,l]),hd=T.useCallback((q,ie)=>{Et.current=ie;try{(m?m(q):u==="click"&&c?c(q):null)!=null&&(Pe(q.id),Be(void 0))}catch(de){console.error("Error in edgePopover/edgeTooltip callback:",de),gt.current=!0,Pe(q.id),Be(void 0)}},[m,c,u]),pd=T.useCallback((q,ie,de)=>{const Le=Zo(q.id),et=Se===q.id,Ie=f||l==="click"&&o,Ge={nodeId:q.id,tooltipId:de,onSelect:a,onPopoverOpen:Ie?Ye=>Sc(q,Ye):void 0};return y?Gz(y,q,ie,Le,Ge):h.jsx(bN,{bodyRadius:wn==null?void 0:wn.get(q.id),id:q.id,label:q.label,kind:q.kind,domainColor:q.domainColor,selected:ie,onSelect:a,onPopoverOpen:Ie?Ye=>Sc(q,Ye):void 0,hasChildren:Le.hasChildren,collapsed:Le.collapsed,hiddenDescendantCount:Le.hiddenDescendantCount,onToggleCollapse:Le.onToggleCollapse,popoverOpen:et,popoverPanelId:et?`popover-node-${q.id}`:void 0,tooltipId:de})},[y,a,Zo,f,o,l,Sc,Se,wn]),ra=T.useMemo(()=>{var q,ie;if(o&&l==="hover"&&tt&&tt!==Se){const de=ce.find(Le=>Le.id===tt);if(de){const Le=zn(de),et=(q=Q.get(de.id))!=null?q:{width:qa,height:Va};try{const Ie=o(de);return{type:"node",nodeId:tt,tooltipId:$z(tt),content:Ie,worldX:Le.x,worldY:Le.y-et.height/2}}catch(Ie){return console.error("Error in nodeTooltip callback:",Ie),null}}}if(c&&u==="hover"&&dt&&dt!==at){const de=t.find(Ie=>Ie.id===dt),Le=de&&Vn(de.sourceId),et=de&&Vn(de.targetId);if(de&&Le&&et){const Ie=(ie=de.curvature)!=null?ie:Yi(N,de)?k:void 0,Ge=mh(Le,et,{sourceAnchor:de.sourceAnchor,targetAnchor:de.targetAnchor,curvature:Ie});try{const Ye=c(de);return{type:"edge",edgeId:dt,tooltipId:Pz(dt),content:Ye,worldX:Ge.mid.x,worldY:Ge.mid.y}}catch(Ye){return console.error("Error in edgeTooltip callback:",Ye),null}}}return null},[o,l,c,u,tt,dt,Se,at,ce,Q,zn,t,Vn,N,k]),md=T.useMemo(()=>{const q=new Map;for(const ie of e)q.has(ie.id)||q.set(ie.id,ie.label);return q},[e]),Kr=T.useCallback(q=>md.get(q)||q,[md]),Bn=T.useMemo(()=>{var q,ie;if(gt.current=!1,Se){const de=ce.find(Le=>Le.id===Se);if(de){const Le=zn(de),et=(q=Q.get(de.id))!=null?q:{width:qa,height:Va};try{const Ie=f?f(de):l==="click"&&o?o(de):null;return Ie!=null?{type:"node",nodeId:Se,ariaLabel:`Details for ${de.label||de.id}`,content:Ie,worldX:Le.x,worldY:Le.y-et.height/2}:null}catch(Ie){return console.error("Error in nodePopover/nodeTooltip callback:",Ie),gt.current=!0,null}}}if(at){const de=t.find(Ie=>Ie.id===at),Le=de&&Vn(de.sourceId),et=de&&Vn(de.targetId);if(de&&Le&&et){const Ie=(ie=de.curvature)!=null?ie:Yi(N,de)?k:void 0,Ge=mh(Le,et,{sourceAnchor:de.sourceAnchor,targetAnchor:de.targetAnchor,curvature:Ie});try{const Ye=m?m(de):u==="click"&&c?c(de):null;return Ye!=null?{type:"edge",edgeId:at,ariaLabel:`Details for ${Wv(de.label,Kr(de.sourceId),Kr(de.targetId))}`,content:Ye,worldX:Ge.mid.x,worldY:Ge.mid.y}:null}catch(Ye){return console.error("Error in edgePopover/edgeTooltip callback:",Ye),gt.current=!0,null}}}return null},[f,o,l,m,c,u,Se,at,ce,Q,zn,t,Vn,N,k,Kr]);T.useEffect(()=>{gt.current&&(Se||at)&&(Be(void 0),Pe(void 0),gt.current=!1)},[Bn,Se,at]);const Cc=T.useCallback(()=>{const q=Et.current;q&&document.body.contains(q)&&q.focus(),Be(void 0),Pe(void 0),Et.current=null},[]),Yh=T.useCallback(q=>{if(q.key==="Escape"&&Bn){q.preventDefault(),Cc();return}Bi.onKeyDown(q)},[Bn,Cc,Bi]);T.useEffect(()=>{if(!Bn)return;const q=ie=>{const de=ha.current;de&&!de.contains(ie.target)&&(Be(void 0),Pe(void 0))};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[Bn]);const Xh=T.useMemo(()=>({getNodeRect:Vn,nodeRects:Qo,zoom:pt.zoom,pan:{x:pt.x,y:pt.y},selectedNodeId:n,zoomToFit:Yr,setZoom:od,zoomBy:rd,setPan:ld,setViewport:Bs,getViewport:wi,locked:cn,setLocked:aa,isFullscreen:rn,toggleFullscreen:$i,layout:x,liveSimulation:ia,setLiveSimulation:Li,hoveredNodeId:X,hoveredEdgeId:we}),[Vn,Qo,pt,n,Yr,od,rd,ld,Bs,wi,cn,rn,$i,x,ia,X,we]),Kh=q=>{typeof Ae=="function"?Ae(q):Ae&&(Ae.current=q),ha.current=q},ti=18*pt.zoom,Qr=(pt.x%ti+ti)%ti,Qh=(pt.y%ti+ti)%ti;return h.jsxs("div",Z(F({ref:Kh,"aria-label":"Graph canvas",className:["graph-canvas",je].filter(Boolean).join(" "),"data-layout-state":Ni,onPointerDown:sd,onPointerUp:gc,onKeyDown:Yh,tabIndex:Bi.tabIndex,role:Bi.role},De),{children:[h.jsx("div",{className:"graph-measure","aria-hidden":"true",children:ce.map(q=>h.jsx("div",{ref:ie=>{as.current[q.id]=ie},style:{display:"inline-block"},children:pd(q,!1)},q.id))}),h.jsx(vN.Provider,{value:Xh,children:h.jsxs(xN.Provider,{value:_c,children:[h.jsxs("svg",{className:"graph-svg",width:"100%",height:"100%",style:{position:"absolute",inset:0,overflow:"visible"},children:[h.jsx("defs",{children:h.jsx("pattern",{id:yc,x:Qr,y:Qh,width:ti,height:ti,patternUnits:"userSpaceOnUse",children:h.jsx("circle",{cx:"0",cy:"0",r:Math.min(1,.5*pt.zoom),className:"graph-grid-dot"})})}),h.jsx("rect",{width:"100%",height:"100%",fill:`url(#${yc})`,className:"graph-grid"}),h.jsxs("g",{className:"graph-viewport","data-testid":"graph-viewport",transform:id,children:[me&&Ue.size>0&&h.jsx("g",{className:"graph-clusters","aria-hidden":"true",children:[...Ue.entries()].map(([q,ie])=>h.jsx("circle",{className:"graph-cluster-boundary",cx:ie.x,cy:ie.y,r:ie.r},q))}),C&&ft.length>0&&h.jsx("g",{className:"graph-hierarchy-rings","aria-hidden":"true",children:ft.map((q,ie)=>h.jsx("circle",{className:"graph-hierarchy-ring",cx:q.cx,cy:q.cy,r:q.r},`${q.trunkId}-depth-${q.depth}-${ie}`))}),h.jsx("g",{className:"graph-edges",children:t==null?void 0:t.map(q=>{var Jt,Nn;const ie=Yi(N,q,x),de=x==="ux-navigation"?Gg(D,q):!1,Le=q.sourceId===X||q.targetId===X||q.id===we||q.sourceId===n||q.targetId===n||q.id===H,et=Ea.has(q.id);if(!ie&&!j&&!Le&&!et||In.has(q.sourceId)||In.has(q.targetId))return null;const Ie=at===q.id,Ge=(ra==null?void 0:ra.type)==="edge"&&ra.edgeId===q.id?ra.tooltipId:void 0,Ye=(Jt=q.curvature)!=null?Jt:ie?k:void 0,Ze=(x==="galaxy"&&ie||x==="ux-navigation"&&(ie||de))&&!Le?void 0:q.label;return h.jsx(Xz,{id:q.id,sourceId:q.sourceId,targetId:q.targetId,sourceLabel:Kr(q.sourceId),targetLabel:Kr(q.targetId),label:Ze,variant:q.variant,weight:q.weight,opacity:q.opacity,strokeDash:q.strokeDash,sourceAnchor:q.sourceAnchor,targetAnchor:q.targetAnchor,curvature:Ye,selected:q.id===H,hovered:q.id===we,onSelect:U,onHoverStart:Ph,onHoverEnd:Hh,renderEdge:v,hasPopover:!!m||u==="click"&&!!c,onPopoverOpen:(yn,un)=>hd(q,un),popoverOpen:Ie,popoverPanelId:Ie?`popover-edge-${q.id}`:void 0,tooltipId:Ge,isNavigationRoute:de,preRoutedEdge:(Nn=Gh.get(q.id))!=null?Nn:wc.get(q.id)},q.id)})}),h.jsx("g",{className:"graph-nodes",children:ce.map(q=>{var Ge;const ie=zn(q),de=(Ge=Q.get(q.id))!=null?Ge:{width:qa,height:Va},Le=q.id===n,et=(ra==null?void 0:ra.type)==="node"&&ra.nodeId===q.id?ra.tooltipId:void 0,Ie=Zo(q.id);return h.jsx("g",{transform:`translate(${ie.x} ${ie.y})`,visibility:In.has(q.id)?"hidden":void 0,"data-node-id":q.id,"data-testid":`graph-node-${q.id}`,"data-domain":q.domainColor,className:["graph-canvas-node",se&&"draggable",Le&&"selected"].filter(Boolean).join(" "),tabIndex:y&&Ie.hasChildren&&Ie.onToggleCollapse?0:-1,role:y&&Ie.hasChildren&&Ie.onToggleCollapse?"group":void 0,"aria-expanded":y&&Ie.hasChildren&&Ie.onToggleCollapse?!Ie.collapsed:void 0,"aria-label":y&&Ie.hasChildren&&Ie.onToggleCollapse?q.label:void 0,onPointerEnter:()=>ud(q.id),onPointerLeave:()=>dd(q.id),onFocus:y?()=>{Ie.hasChildren&&Ie.onToggleCollapse&&ud(q.id)}:void 0,onBlur:y?Ye=>{Ie.hasChildren&&Ie.onToggleCollapse&&(Ye.currentTarget.contains(Ye.relatedTarget)||dd(q.id))}:void 0,onKeyDown:y?Ye=>{if(Ye.key==="Enter"&&Ye.shiftKey&&Ie.hasChildren&&Ie.onToggleCollapse){Ye.preventDefault(),Ye.stopPropagation();try{Ie.onToggleCollapse()}catch(Ze){console.error("onToggleCollapse failed:",Ze)}}}:void 0,onPointerDown:se?Ye=>qh(Ye,q):void 0,onPointerMove:se?Vh:void 0,onPointerUp:se?fd:void 0,onPointerCancel:se?fd:void 0,children:h.jsx("foreignObject",{x:-de.width/2,y:-de.height/2,width:de.width,height:de.height,overflow:"visible",children:pd(q,Le,et)})},q.id)})}),X&&h.jsx("g",{className:"graph-collapse-controls",children:(()=>{var q;const ie=Vn(X);if(!ie)return null;const de=Zo(X);return!de.hasChildren||!de.onToggleCollapse?null:h.jsx(wN,{nodeId:X,label:((q=ce.find(Le=>Le.id===X))==null?void 0:q.label)||X,collapsed:de.collapsed,hiddenDescendantCount:de.hiddenDescendantCount,onToggleCollapse:de.onToggleCollapse,x:ie.x,y:ie.y,nodeWidth:ie.width},X)})()})]})]}),re&&h.jsx(_N,{position:fe}),K&&h.jsx("div",{className:["graph-layout-indicator",re&&fe.startsWith("top-")&&"graph-layout-indicator--bottom"].filter(Boolean).join(" "),role:"status","aria-live":"polite",children:Ni!=="idle"&&h.jsxs("span",{className:"graph-layout-indicator__chip","data-testid":"graph-layout-indicator",style:{animationDelay:`${Fz}ms`},children:[h.jsx(_v,{color:"cyan",pulse:!0,"aria-hidden":"true"}),"Laying out…"]})}),ra&&h.jsx("div",{className:"graph-tooltip-layer",children:h.jsx("div",{className:"graph-tooltip-anchor",style:{left:ra.worldX*pt.zoom+pt.x,top:ra.worldY*pt.zoom+pt.y},children:h.jsx(b2,{open:!0,content:ra.content,placement:"top",id:ra.tooltipId,children:h.jsx("span",{})})})}),Bn&&h.jsx("div",{className:"graph-popover-layer",children:h.jsx("div",{className:"graph-popover-anchor",style:{left:Bn.worldX*pt.zoom+pt.x,top:Bn.worldY*pt.zoom+pt.y},children:h.jsxs(fg,{open:!0,onOpenChange:q=>{q||Cc()},autoFocus:!0,placement:"top",disableOutsideClick:!0,panelId:Bn.type==="node"?`popover-node-${Bn.nodeId}`:`popover-edge-${Bn.edgeId}`,children:[h.jsx(fg.Trigger,{children:h.jsx("div",{style:{width:0,height:0}})}),h.jsx(fg.Panel,{"aria-label":Bn.ariaLabel,children:Bn.content})]},Bn.type==="node"?Bn.nodeId:Bn.edgeId)})})]})})]}))});o1.displayName="GraphCanvas";const Jz=ve.forwardRef((N,C)=>{var k=N,{id:e,sourceId:t,targetId:n,sourceLabel:a,targetLabel:s,label:o,variant:l="default",weight:c,opacity:u,strokeDash:f,sourceAnchor:m,targetAnchor:p,curvature:y,selected:v=!1,onSelect:x,className:b=""}=k,w=Me(k,["id","sourceId","targetId","sourceLabel","targetLabel","label","variant","weight","opacity","strokeDash","sourceAnchor","targetAnchor","curvature","selected","onSelect","className"]);const{getNodeRect:M,nodeRects:D}=s1(),j=T.useMemo(()=>{const R=M(t),E=M(n);if(!R)return console.warn(`GraphEdge: source node "${t}" not found`),null;if(!E)return console.warn(`GraphEdge: target node "${n}" not found`),null;const I=mh(R,E,{sourceAnchor:m,targetAnchor:p,curvature:y}),L=o?Ay(I.points,sc(o),D,6):I.mid;return Z(F({},I),{labelPos:L})},[M,t,n,m,p,y,o,D]);if(!j)return null;const A=["graph-edge",l!=="default"&&`graph-edge--${l}`,v&&"selected",b].filter(Boolean).join(" "),O=!!x;return h.jsx("g",Z(F({ref:C,className:A,role:O?"button":"presentation","aria-hidden":O?void 0:!0,"aria-pressed":O?v:void 0,"aria-label":O?Wv(o,a||t,s||n):void 0,tabIndex:O?0:void 0,onKeyDown:O?R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),x(e))}:void 0,"data-testid":`graph-edge-${e}`},w),{children:h.jsx(r1,{id:e,d:j.d,mid:j.labelPos,label:o,variant:l,weight:c,opacity:u,strokeDash:f,onSelect:x,detailedTestIds:!0})}))});Jz.displayName="GraphEdge";const Wz=360,e8=260,t8=640,CN=ve.forwardRef((f,u)=>{var m=f,{open:e,width:t=Wz,onWidthChange:n,minWidth:a=e8,maxWidth:s=t8,children:o,className:l=""}=m,c=Me(m,["open","width","onWidthChange","minWidth","maxWidth","children","className"]);const[p,y]=T.useState(t),[v,x]=T.useState(!1),b=!!n,w=b?p:t,C=T.useRef(null),N=T.useCallback(R=>E=>{R.forEach(I=>{typeof I=="function"?I(E):I&&(I.current=E)})},[]);T.useEffect(()=>{C.current&&(C.current.inert=!e)},[e]);const k=T.useRef(null),M=T.useRef(null),D=T.useCallback(R=>{const E=k.current;if(!E)return;const I=Math.min(s,Math.max(a,E.startWidth-(R.clientX-E.startX)));y(I),n==null||n(I)},[a,s,n]),j=T.useCallback(()=>{k.current=null,x(!1);const R=M.current;R&&(document.removeEventListener("mousemove",R.move),document.removeEventListener("mouseup",R.up),M.current=null)},[]),A=T.useCallback(R=>{R.preventDefault(),k.current={startX:R.clientX,startWidth:w},x(!0),M.current={move:D,up:j},document.addEventListener("mousemove",D),document.addEventListener("mouseup",j)},[w,D,j]);T.useEffect(()=>()=>{const R=M.current;R&&(document.removeEventListener("mousemove",R.move),document.removeEventListener("mouseup",R.up))},[]);const O=T.useCallback(R=>{const E=R.shiftKey?40:10;if(R.key==="ArrowLeft"){R.preventDefault();const I=Math.min(s,w+E);y(I),n==null||n(I)}else if(R.key==="ArrowRight"){R.preventDefault();const I=Math.max(a,w-E);y(I),n==null||n(I)}},[w,a,s,n]);return h.jsxs("div",Z(F({ref:N([C,u]),className:["detail-drawer",e&&"detail-drawer--open",l].filter(Boolean).join(" "),style:{width:e?w:0},"aria-hidden":!e},c),{children:[b&&h.jsx("div",{className:["detail-drawer__resize-handle",v&&"detail-drawer__resize-handle--active"].filter(Boolean).join(" "),role:"separator","aria-orientation":"vertical","aria-label":"Resize detail panel","aria-valuenow":Math.round(w),"aria-valuemin":a,"aria-valuemax":s,tabIndex:e?0:-1,onMouseDown:A,onKeyDown:O}),h.jsx("div",{className:"detail-drawer__content",style:{width:w},children:o})]}))});CN.displayName="DetailDrawer";const $u=ve.forwardRef((c,l)=>{var u=c,{node:e,relationships:t=[],onNodeSelect:n,emptyStateText:a="Select a node to inspect.",className:s=""}=u,o=Me(u,["node","relationships","onNodeSelect","emptyStateText","className"]);const f=["graph-inspector",s].filter(Boolean).join(" ");if(!e)return h.jsx("div",Z(F({ref:l,className:f},o),{children:h.jsx("div",{className:"graph-inspector__empty","data-testid":"inspector-empty",children:a})}));const m=t.filter(y=>y.direction==="out"),p=t.filter(y=>y.direction==="in");return h.jsxs("div",Z(F({ref:l,className:f},o),{children:[h.jsxs("div",{className:"graph-inspector__head",children:[h.jsxs("div",{className:"graph-inspector__head-eyebrow",children:[e.kind&&h.jsx("span",{className:"graph-inspector__badge",children:e.kind}),e.domain&&h.jsx("span",{className:`graph-inspector__badge graph-inspector__badge--${e.domain}`,children:e.domain})]}),h.jsx("div",{className:"graph-inspector__title","data-testid":"inspector-title",children:e.title}),h.jsx("div",{className:"graph-inspector__id","data-testid":"inspector-id",children:e.id})]}),h.jsxs("div",{className:"graph-inspector__body",children:[e.description&&h.jsx("p",{className:"graph-inspector__description","data-testid":"inspector-description",children:e.description}),e.metadata&&Object.keys(e.metadata).length>0&&h.jsx("dl",{className:"graph-inspector__kv","data-testid":"inspector-metadata",children:Object.entries(e.metadata).map(([y,v])=>h.jsxs(ve.Fragment,{children:[h.jsx("dt",{children:y}),h.jsx("dd",{children:String(v)})]},y))}),m.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"graph-inspector__section-label",children:["Outgoing · ",m.length]}),h.jsx("ul",{className:"graph-inspector__rels","data-testid":"inspector-outgoing",children:m.map(y=>h.jsxs("li",{className:"graph-inspector__rel",children:[h.jsx("span",{className:"graph-inspector__rel-dir graph-inspector__rel-dir--out",children:"→"}),h.jsx("span",{className:"graph-inspector__rel-pred",children:y.predicate}),h.jsxs("button",{type:"button",className:"graph-inspector__rel-target","data-domain":y.targetDomain,onClick:()=>n==null?void 0:n(y.target),"aria-label":`Navigate to ${y.targetTitle}`,"data-testid":`inspector-rel-${y.id}`,children:[h.jsx("span",{className:"graph-inspector__rel-swatch"}),h.jsx("span",{children:y.targetTitle})]})]},y.id))})]}),p.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"graph-inspector__section-label",children:["Incoming · ",p.length]}),h.jsx("ul",{className:"graph-inspector__rels","data-testid":"inspector-incoming",children:p.map(y=>h.jsxs("li",{className:"graph-inspector__rel",children:[h.jsx("span",{className:"graph-inspector__rel-dir graph-inspector__rel-dir--in",children:"←"}),h.jsx("span",{className:"graph-inspector__rel-pred",children:y.predicate}),h.jsxs("button",{type:"button",className:"graph-inspector__rel-target","data-domain":y.targetDomain,onClick:()=>n==null?void 0:n(y.target),"aria-label":`Navigate to ${y.targetTitle}`,"data-testid":`inspector-rel-${y.id}`,children:[h.jsx("span",{className:"graph-inspector__rel-swatch"}),h.jsx("span",{children:y.targetTitle})]})]},y.id))})]}),t.length===0&&h.jsx("div",{className:"graph-inspector__empty-mini",children:"No relationships yet."})]})]}))});$u.displayName="GraphInspector";const NN=ve.forwardRef((l,o)=>{var c=l,{edge:e,onNodeSelect:t,emptyStateText:n="Select an edge to inspect.",className:a=""}=c,s=Me(c,["edge","onNodeSelect","emptyStateText","className"]);const u=["graph-edge-inspector",a].filter(Boolean).join(" ");if(!e)return h.jsx("div",Z(F({ref:o,className:u},s),{children:h.jsx("div",{className:"graph-edge-inspector__empty","data-testid":"edge-inspector-empty",children:n})}));const f=e.metadata?Object.entries(e.metadata):[],m=(p,y,v,x)=>{const b=h.jsx("span",{className:"graph-edge-inspector__endpoint-swatch"});return t?h.jsxs("button",{type:"button",className:"graph-edge-inspector__endpoint graph-edge-inspector__endpoint--button","data-domain":v,onClick:()=>t(p),"aria-label":`Inspect ${y}`,"data-testid":x,children:[b,h.jsx("span",{children:y})]}):h.jsxs("span",{className:"graph-edge-inspector__endpoint","data-domain":v,"data-testid":x,children:[b,h.jsx("span",{children:y})]})};return h.jsxs("div",Z(F({ref:o,className:u},s),{children:[h.jsxs("div",{className:"graph-edge-inspector__head",children:[h.jsx("div",{className:"graph-edge-inspector__head-eyebrow",children:e.variant&&e.variant!=="default"&&h.jsx("span",{className:`graph-edge-inspector__badge graph-edge-inspector__badge--${e.variant}`,children:e.variant})}),h.jsx("div",{className:"graph-edge-inspector__title","data-testid":"edge-inspector-title",children:e.predicate}),h.jsx("div",{className:"graph-edge-inspector__id","data-testid":"edge-inspector-id",children:e.id})]}),h.jsxs("div",{className:"graph-edge-inspector__body",children:[h.jsxs("div",{className:"graph-edge-inspector__endpoints","data-testid":"edge-inspector-endpoints",children:[m(e.sourceId,e.sourceTitle,e.sourceDomain,"edge-inspector-source"),h.jsx(He,{name:"arrowRight",size:14,className:"graph-edge-inspector__arrow"}),m(e.targetId,e.targetTitle,e.targetDomain,"edge-inspector-target")]}),(e.weight!==void 0||f.length>0)&&h.jsxs("dl",{className:"graph-edge-inspector__kv","data-testid":"edge-inspector-metadata",children:[e.weight!==void 0&&h.jsxs(ve.Fragment,{children:[h.jsx("dt",{children:"weight"}),h.jsx("dd",{children:e.weight})]}),f.map(([p,y])=>h.jsxs(ve.Fragment,{children:[h.jsx("dt",{children:p}),h.jsx("dd",{children:String(y)})]},p))]})]})]}))});NN.displayName="GraphEdgeInspector";const n8={ok:"rgb(var(--status-emerald))",warning:"rgb(var(--status-amber))",error:"rgb(var(--status-rose))",idle:"rgb(var(--status-neutral))"},a8=ve.forwardRef((y,p)=>{var v=y,{title:e,nodeRole:t="",status:n="idle",metrics:a=[],selected:s=!1,x:o,y:l,onSelect:c,className:u="",style:f}=v,m=Me(v,["title","nodeRole","status","metrics","selected","x","y","onSelect","className","style"]);const x=["topology-node",`topology-node--${n}`,s?"topology-node--selected":"",c?"topology-node--interactive":"",u].filter(Boolean).join(" "),b=F(F({},o!==void 0&&l!==void 0?{position:"absolute",left:`${o}px`,top:`${l}px`}:{}),f),w=e.replace(/\s+/g,"-").toLowerCase(),C=N=>{c&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),c())};return h.jsxs("div",Z(F({ref:p,className:x,style:b,"data-testid":`topology-node-${w}`,onClick:c,onKeyDown:C,tabIndex:c?0:void 0,"aria-selected":s,role:c?"button":void 0},m),{children:[h.jsxs("div",{className:"topology-node__head",children:[h.jsx("div",{className:"topology-node__title",children:e}),h.jsx("div",{className:"topology-node__status-dot",style:{backgroundColor:n8[n]},"data-testid":`topology-status-${w}`,"aria-label":`Status: ${n}`})]}),h.jsx("div",{className:"topology-node__role","data-testid":`topology-role-${w}`,children:t}),a.length>0&&h.jsx("div",{className:"topology-node__metrics","data-testid":`topology-metrics-${w}`,children:a.map((N,k)=>h.jsxs("div",{className:"topology-node__metric-row",children:[h.jsx("div",{className:"topology-node__metric-label",children:N.label}),h.jsxs("div",{className:"topology-node__metric-value",children:[N.value,N.unit&&h.jsx("span",{className:"topology-node__metric-unit",children:N.unit})]}),h.jsx("div",{className:"topology-node__metric-bar",children:h.jsx("div",{className:"topology-node__metric-fill",style:{width:`${Number.isFinite(N.percent)?Math.max(0,Math.min(100,N.percent)):0}%`,backgroundColor:N.color?`rgb(var(--status-${N.color}))`:"rgb(var(--accent-primary))"}})})]},k))})]}))});a8.displayName="TopologyNode";const Qw={life:"var(--dom-life)",climate:"var(--dom-climate)",software:"var(--dom-software)",default:"var(--dom-default)"},i8=ve.forwardRef((y,p)=>{var v=y,{depth:e=0,domain:t,kind:n,label:a,meta:s,description:o,selected:l=!1,onSelect:c,showKind:u=!0,className:f=""}=v,m=Me(v,["depth","domain","kind","label","meta","description","selected","onSelect","showKind","className"]);const x=Qw[t]||Qw.default,b=["hierarchy-row",l&&"selected",c&&"interactive",f].filter(Boolean).join(" "),w=ve.useCallback(C=>{(C.key==="Enter"||C.key===" ")&&c&&(C.preventDefault(),c())},[c]);return h.jsxs("div",Z(F({ref:p,className:b,role:c?"button":void 0,tabIndex:c?0:void 0,"aria-pressed":c?l:void 0,onClick:c,onKeyDown:c?w:void 0,style:{"--hierarchy-depth":e,"--domain-color":x}},m),{children:[h.jsxs("div",{className:"hierarchy-row__left",children:[e>0&&h.jsx("div",{className:"hierarchy-row__connector"}),h.jsxs("div",{className:"hierarchy-row__pill",children:[h.jsx("div",{className:"hierarchy-row__swatch"}),u&&h.jsx("span",{className:"hierarchy-row__kind",children:n}),h.jsx("span",{className:"hierarchy-row__label",children:a}),s&&h.jsx("span",{className:"hierarchy-row__meta",children:s})]})]}),o&&h.jsx("div",{className:"hierarchy-row__right",children:h.jsx("span",{className:"hierarchy-row__description",children:o})})]}))});i8.displayName="HierarchyRow";const s8=ve.forwardRef((s,a)=>{var o=s,{className:e="",children:t}=o,n=Me(o,["className","children"]);const l=["hierarchy-tree",e].filter(Boolean).join(" ");return h.jsx("div",Z(F({ref:a,className:l},n),{children:t}))});s8.displayName="HierarchyTree";const r8=ve.forwardRef((l,o)=>{var c=l,{nodes:e,wrap:t=!1,className:n="","aria-label":a}=c,s=Me(c,["nodes","wrap","className","aria-label"]);if(e.length===0)return null;const u=["lineage-rail",t&&"lineage-rail--wrap",n].filter(Boolean).join(" "),f=a||`Lineage: ${e.map(m=>m.label).join(" → ")}`;return h.jsx("div",Z(F({ref:o,className:u,role:"list","aria-label":f},s),{children:e.map((m,p)=>{const y=p===0;return h.jsxs(ve.Fragment,{children:[p>0&&h.jsx("span",{className:"lineage-rail__arrow","aria-hidden":"true",children:"→"}),h.jsx(o8,{node:m,isHead:y})]},`${m.label}-${p}`)})}))});r8.displayName="LineageRail";const o8=({node:e,isHead:t})=>{const n=["lineage-rail__node",e.onClick&&"lineage-rail__node--interactive",t&&"lineage-rail__node--head"].filter(Boolean).join(" "),a=s=>{(s.key==="Enter"||s.key===" ")&&e.onClick&&(s.preventDefault(),e.onClick())};return h.jsxs(Na,{className:n,role:"listitem","aria-current":t?"step":void 0,onClick:e.onClick,onKeyDown:e.onClick?a:void 0,tabIndex:e.onClick?0:void 0,children:[e.icon&&h.jsx(He,{name:e.icon,size:14}),h.jsx("span",{className:"lineage-rail__label",children:e.label})]})},l8=ve.forwardRef((f,u)=>{var m=f,{thumb:e,title:t,subtitle:n,meta:a,badge:s,selected:o=!1,className:l=""}=m,c=Me(m,["thumb","title","subtitle","meta","badge","selected","className"]);const[p,y]=ve.useState(!1),[v,x]=ve.useState(!1);ve.useEffect(()=>{y(!1),x(!1)},[e.kind==="image"?e.src:null]);const b=["asset-card",o&&"asset-card--selected",l].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:u,className:b,"aria-selected":o},c),{children:[h.jsxs("div",{className:"asset-card__thumb-wrapper",children:[(()=>{if(e.kind==="doc")return h.jsxs("div",{className:"asset-card__thumb asset-card__thumb--doc",children:[h.jsx("div",{className:"asset-card__doc-page"}),h.jsx("div",{className:`asset-card__doc-tab asset-card__doc-tab--${e.ext.toLowerCase()}`,children:e.ext.toUpperCase()})]});if(e.kind==="cover")return h.jsx("div",{className:"asset-card__thumb asset-card__thumb--cover",style:{"--cover-gradient":e.gradient},children:h.jsx(He,{name:e.glyph,size:32,className:"asset-card__cover-glyph"})});if(e.kind==="image")return(p||!v&&!e.src)&&e.fallbackGlyph?h.jsx("div",{className:"asset-card__thumb asset-card__thumb--image-fallback",children:h.jsx(He,{name:e.fallbackGlyph,size:32,className:"asset-card__image-glyph"})}):h.jsx("div",{className:"asset-card__thumb asset-card__thumb--image",children:h.jsx("img",{src:e.src,alt:"",className:"asset-card__image",onLoad:()=>x(!0),onError:()=>y(!0),"aria-hidden":"true"})})})(),s&&h.jsx("div",{className:"asset-card__badge",children:s})]}),h.jsxs("div",{className:"asset-card__body",children:[h.jsx("div",{className:"asset-card__title",children:t}),n&&h.jsx("div",{className:"asset-card__subtitle",children:n}),a&&h.jsx("div",{className:"asset-card__meta",children:a})]})]}))});l8.displayName="AssetCard";const c8=ve.forwardRef((l,o)=>{var c=l,{columns:e=3,gap:t=14,className:n="",children:a}=c,s=Me(c,["columns","gap","className","children"]);const u=["asset-grid",n].filter(Boolean).join(" ");return h.jsx("div",Z(F({ref:o,className:u,style:{"--asset-columns":e,"--asset-gap":`${t}px`}},s),{children:a}))});c8.displayName="AssetGrid";const l1=(e,t=[])=>t.filter(n=>{const a=typeof n.startDate=="string"?new Date(n.startDate):new Date(n.startDate);return nc(e,a)}),u8=({focusedDate:e,selectedDate:t,grid:n,events:a,calendarColors:s,weekStartsOn:o,onSelectDate:l,onSelectEvent:c,renderEvent:u,onKeyDown:f})=>{const m=typeof e=="string"?new Date(e):e,p=t?typeof t=="string"?new Date(t):t:null;let y=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];return o===1&&(y=y.slice(1).concat(y.slice(0,1))),h.jsxs("div",{className:"calendar-month",role:"grid",onKeyDown:f,tabIndex:0,children:[h.jsx("div",{className:"calendar-month__header",role:"row",children:y.map(v=>h.jsx("div",{className:"calendar-month__weekday",role:"columnheader",children:v.slice(0,3).toUpperCase()},v))}),n.map((v,x)=>h.jsx("div",{className:"calendar-month__week",role:"row",children:v.map((b,w)=>{const C=b.getMonth()!==m.getMonth(),N=nc(b,m),k=p?nc(b,p):!1,M=T2(b),D=l1(b,a),j=3,A=D.length-j;return h.jsxs("div",{className:`calendar-month__cell ${C?"calendar-month__cell--out-of-month":""} ${N?"calendar-month__cell--focused":""} ${k?"calendar-month__cell--selected":""}`,role:"gridcell",onClick:()=>!C&&(l==null?void 0:l(b)),onKeyDown:O=>{(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),!C&&(l==null||l(b)))},children:[h.jsx("div",{className:"calendar-month__date-number","aria-current":M?"date":void 0,children:M?h.jsx(Na,{variant:"amber",form:"default",children:b.getDate()}):h.jsx("span",{children:b.getDate()})}),h.jsxs("div",{className:"calendar-month__events",children:[D.slice(0,j).map(O=>{const R=(s==null?void 0:s[O.calendarId])||"rgb(var(--status-cyan))";return h.jsx("div",{className:"calendar-month__event-bar",style:{borderLeftColor:R},onClick:E=>{E.stopPropagation(),c==null||c(O.id)},role:"button",tabIndex:0,onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),E.stopPropagation(),c==null||c(O.id))},children:u?u(O,R):h.jsx("span",{className:"calendar-month__event-title",children:O.title||"Event"})},O.id)}),A>0&&h.jsxs("div",{className:"calendar-month__event-overflow",children:["+",A," more"]})]})]},`${x}-${w}`)})},x))]})},d8=({focusedDate:e,weekStartsOn:t,events:n,calendarColors:a,onSelectDate:s,onSelectEvent:o,renderEvent:l})=>{const c=ac(e,t);return h.jsx("div",{className:"calendar-week",children:h.jsx("div",{className:"calendar-week__days",children:c.map(u=>{const f=l1(u,n);return h.jsxs("div",{className:"calendar-week__day",role:"button",tabIndex:0,onClick:()=>s==null?void 0:s(u),onKeyDown:m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),s==null||s(u))},children:[h.jsx("div",{className:"calendar-week__header",children:u.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}),h.jsx("div",{className:"calendar-week__events",children:f.map(m=>{const p=(a==null?void 0:a[m.calendarId])||"rgb(var(--status-cyan))";return h.jsx("div",{className:"calendar-week__event",style:{borderLeftColor:p},role:"button",tabIndex:0,onClick:y=>{y.stopPropagation(),o==null||o(m.id)},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),y.stopPropagation(),o==null||o(m.id))},children:l?l(m,p):h.jsx("span",{children:m.title||"Event"})},m.id)})})]},u.toISOString())})})})},f8=({focusedDate:e,events:t,calendarColors:n,onSelectEvent:a,renderEvent:s})=>{const o=l1(e,t);return h.jsxs("div",{className:"calendar-day",children:[h.jsx("div",{className:"calendar-day__title",children:typeof e=="string"?new Date(e).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"}):e.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"})}),h.jsx("div",{className:"calendar-day__events",children:o.length===0?h.jsx("div",{className:"calendar-day__empty",children:"No events scheduled"}):o.map(l=>{const c=(n==null?void 0:n[l.calendarId])||"rgb(var(--status-cyan))";return h.jsx("div",{className:"calendar-day__event",style:{borderLeftColor:c},role:"button",tabIndex:0,onClick:()=>a==null?void 0:a(l.id),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),a==null||a(l.id))},children:s?s(l,c):h.jsx("span",{children:l.title||"Event"})},l.id)})})]})},h8=({focusedDate:e,events:t=[],calendarColors:n,onSelectEvent:a,renderEvent:s})=>{const o=typeof e=="string"?new Date(e):e,l=t.filter(c=>(typeof c.startDate=="string"?new Date(c.startDate):new Date(c.startDate))>=o).sort((c,u)=>{const f=typeof c.startDate=="string"?new Date(c.startDate):new Date(c.startDate),m=typeof u.startDate=="string"?new Date(u.startDate):new Date(u.startDate);return f.getTime()-m.getTime()});return h.jsx("div",{className:"calendar-agenda",children:l.length===0?h.jsx("div",{className:"calendar-agenda__empty",children:"No upcoming events"}):h.jsx("div",{className:"calendar-agenda__list",children:l.map(c=>{const u=(n==null?void 0:n[c.calendarId])||"rgb(var(--status-cyan))";return h.jsxs("div",{className:"calendar-agenda__item",role:"button",tabIndex:0,onClick:()=>a==null?void 0:a(c.id),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),a==null||a(c.id))},children:[h.jsx("div",{className:"calendar-agenda__date",style:{color:u},children:typeof c.startDate=="string"?new Date(c.startDate).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}):c.startDate.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}),h.jsx("div",{className:"calendar-agenda__content",children:s?s(c,u):h.jsx("span",{children:c.title||"Event"})})]},c.id)})})})},p8=ve.forwardRef((x,v)=>{var b=x,{view:e,focusedDate:t,selectedDate:n,events:a,calendarColors:s,weekStartsOn:o=0,onChangeView:l,onNavigate:c,onSelectDate:u,onSelectEvent:f,renderEvent:m,className:p=""}=b,y=Me(b,["view","focusedDate","selectedDate","events","calendarColors","weekStartsOn","onChangeView","onNavigate","onSelectDate","onSelectEvent","renderEvent","className"]);const w=typeof t=="string"?new Date(t):t,C=T.useMemo(()=>A2(w,o),[w.getTime(),o]),N=[{value:"month",label:"Month"},{value:"week",label:"Week"},{value:"day",label:"Day"},{value:"agenda",label:"Agenda"}],k=T.useCallback(A=>{if(e!=="month")return;const O=new Date(w);if(A.key==="ArrowLeft"||A.key==="ArrowRight"||A.key==="ArrowUp"||A.key==="ArrowDown"){A.preventDefault();const R=A.key==="ArrowLeft"?-1:A.key==="ArrowRight"?1:A.key==="ArrowUp"?-7:7;O.setDate(O.getDate()+R),c==null||c(O)}else if(A.key==="PageUp")A.preventDefault(),O.setMonth(O.getMonth()-1),c==null||c(O);else if(A.key==="PageDown")A.preventDefault(),O.setMonth(O.getMonth()+1),c==null||c(O);else if(A.key==="Home"){A.preventDefault();const R=ac(O,o);c==null||c(R[0])}else if(A.key==="End"){A.preventDefault();const R=ac(O,o);c==null||c(R[6])}},[w.getTime(),c,e,o]),M=T.useCallback(()=>{const A=new Date(w);e==="month"?A.setMonth(A.getMonth()-1):e==="week"?A.setDate(A.getDate()-7):(e==="day"||e==="agenda")&&A.setDate(A.getDate()-1),c==null||c(A)},[w.getTime(),c,e]),D=T.useCallback(()=>{const A=new Date(w);e==="month"?A.setMonth(A.getMonth()+1):e==="week"?A.setDate(A.getDate()+7):(e==="day"||e==="agenda")&&A.setDate(A.getDate()+1),c==null||c(A)},[w.getTime(),c,e]),j=T.useCallback(()=>{c==null||c(new Date)},[c]);return h.jsxs("div",Z(F({ref:v,className:`calendar ${p}`.trim()},y),{children:[h.jsxs("div",{className:"calendar__header",children:[h.jsxs("div",{className:"calendar__title",children:[e==="month"&&jT(w),e==="week"&&ET(w,o),e==="day"&&xy(w),e==="agenda"&&"Agenda"]}),h.jsxs("div",{className:"calendar__controls",children:[h.jsx(Pn,{variant:"secondary",size:"sm",onClick:M,"aria-label":"Previous",children:h.jsx(He,{name:"chevronLeft",size:16})}),h.jsx(Pn,{variant:"secondary",size:"sm",onClick:j,children:"Today"}),h.jsx(Pn,{variant:"secondary",size:"sm",onClick:D,"aria-label":"Next",children:h.jsx(He,{name:"chevronRight",size:16})})]})]}),h.jsx("div",{className:"calendar__view-selector",children:h.jsx(Wi,{value:e,onChange:A=>l==null?void 0:l(A),options:N})}),h.jsxs("div",{className:"calendar__content",children:[e==="month"&&h.jsx(u8,{focusedDate:w,selectedDate:n,grid:C,events:a,calendarColors:s,weekStartsOn:o,onSelectDate:u,onSelectEvent:f,renderEvent:m,onKeyDown:k}),e==="week"&&h.jsx(d8,{focusedDate:w,weekStartsOn:o,events:a,calendarColors:s,onSelectDate:u,onSelectEvent:f,renderEvent:m}),e==="day"&&h.jsx(f8,{focusedDate:w,events:a,calendarColors:s,onSelectEvent:f,renderEvent:m}),e==="agenda"&&h.jsx(h8,{focusedDate:w,events:a,calendarColors:s,onSelectEvent:f,renderEvent:m})]})]}))});p8.displayName="Calendar";const m8=({card:e,isSelected:t,renderCard:n,onSelect:a,onCardPointerDown:s,onCardKeyDown:o})=>n?h.jsx("div",{className:`kanban-card ${t?"kanban-card--selected":""}`,onPointerDown:l=>s(l,e.id),onKeyDown:l=>o(l,e.id),onClick:()=>a(e.id),tabIndex:0,role:"button","aria-pressed":t,children:n(e,t)}):h.jsxs("div",{className:`kanban-card ${t?"kanban-card--selected":""} ${e.done?"kanban-card--done":""}`,onPointerDown:l=>s(l,e.id),onKeyDown:l=>o(l,e.id),onClick:()=>a(e.id),tabIndex:0,role:"button","aria-pressed":t,children:[e.context&&h.jsx("div",{className:"kanban-card__context",children:e.context}),h.jsx("div",{className:"kanban-card__title",children:e.title}),e.version&&h.jsx("div",{className:"kanban-card__version",children:h.jsx(Ya,{children:e.version})}),(e.dueDate||e.badges)&&h.jsxs("div",{className:"kanban-card__meta",children:[e.dueDate&&h.jsx("div",{className:"kanban-card__due-date",children:e.dueDate}),e.badges&&e.badges.length>0&&h.jsx("div",{className:"kanban-card__badges",children:e.badges.map(l=>h.jsx("span",{className:"kanban-card__badge",children:l},l))})]}),e.blocked&&h.jsxs("div",{className:"kanban-card__blocked",children:[h.jsx(He,{name:"alert",size:16}),e.blocked]})]}),g8=({column:e,cards:t,selectedId:n,onSelectCard:a,renderCard:s,draggedCardId:o,insertionIndex:l,onCardPointerDown:c,onCardKeyDown:u})=>{const f=T.useRef(null),m=e.wipLimit&&t.length>e.wipLimit;return h.jsxs(C2,{className:"kanban-column",noPadding:!0,children:[h.jsxs("div",{className:"kanban-column__header",children:[h.jsxs("div",{className:"kanban-column__header-left",children:[e.statusColor&&h.jsx("div",{className:"kanban-column__status-dot",style:{backgroundColor:Lu[e.statusColor]}}),h.jsx("div",{className:"kanban-column__title",children:e.title})]}),h.jsxs("div",{className:"kanban-column__header-right",children:[h.jsx(Na,{variant:"neutral",children:t.length}),m&&h.jsx("div",{className:"kanban-column__wip-warning",title:`Over WIP limit of ${e.wipLimit}`,children:h.jsx(He,{name:"alert",size:14})})]})]}),h.jsxs("div",{ref:f,className:"kanban-column__body",children:[t.length===0?h.jsx("div",{className:"kanban-column__empty",children:"Drop cards here"}):t.map((p,y)=>h.jsxs(ve.Fragment,{children:[o&&l===y&&h.jsx("div",{className:"kanban-column__insertion-line"}),h.jsx(m8,{card:p,isSelected:n===p.id,renderCard:s,onSelect:v=>a==null?void 0:a(v),onCardPointerDown:c,onCardKeyDown:u})]},p.id)),o&&l===t.length&&h.jsx("div",{className:"kanban-column__insertion-line"})]})]})},y8=ve.forwardRef((f,u)=>{var m=f,{columns:e,cards:t,selectedId:n,onSelectCard:a,onMoveCard:s,renderCard:o,className:l=""}=m,c=Me(m,["columns","cards","selectedId","onSelectCard","onMoveCard","renderCard","className"]);const p=T.useRef(null),[y,v]=T.useState(null),[x,b]=T.useState(null),[w,C]=T.useState(null),N=T.useRef(null),k=T.useRef(null),M=T.useMemo(()=>{const E={};return e.forEach(I=>{E[I.id]=t.filter(L=>L.columnId===I.id)}),E},[e,t]),D=T.useCallback((E,I,L)=>{N.current&&(N.current.textContent=`Card "${E}" moved to ${I} at position ${L+1}`)},[]),j=T.useCallback((E,I)=>{const L=t.find(U=>U.id===I);if(!L)return;const H=E.currentTarget;H.setPointerCapture(E.pointerId),p.current={cardId:I,sourceColumnId:L.columnId,sourceIndex:M[L.columnId].findIndex(U=>U.id===I),offsetY:E.clientY,pointerId:E.pointerId,capturingElement:H},v(I),C(L.columnId)},[t,M]),A=T.useCallback(E=>{var I;if(!p.current||!((I=k.current)!=null&&I.getBoundingClientRect()))return;let L=null;for(const K of e){const se=document.querySelector(`[data-column-id="${CSS.escape(K.id)}"]`);if(se){const V=se.getBoundingClientRect();if(E.clientX>=V.left&&E.clientX<V.right){L=K,C(K.id);break}}}if(!L)return;const H=document.querySelector(`[data-column-id="${CSS.escape(L.id)}"] .kanban-column__body`);if(!H)return;const U=H.getBoundingClientRect(),$=E.clientY-U.top,P=H.querySelectorAll(".kanban-card");let G=0;for(let K=0;K<P.length;K++){const se=P[K].getBoundingClientRect(),V=se.top-U.top;if($<V+se.height/2){G=K;break}else G=K+1}b(G)},[e]),O=T.useCallback(E=>{if(!p.current)return;const I=p.current;if(p.current=null,w&&x!==null){const L=e.find(U=>U.id===I.sourceColumnId),H=e.find(U=>U.id===w);if(H&&L){const U=t.find($=>$.id===I.cardId);if(U){const $=w===I.sourceColumnId&&x>I.sourceIndex?x-1:x;s(I.cardId,w,$),D(U.title,H.title,$)}}}if(v(null),b(null),C(null),I.capturingElement&&I.pointerId!==void 0)try{I.capturingElement.releasePointerCapture(I.pointerId)}catch(L){}},[e,t,w,x,s,D]),R=T.useCallback((E,I)=>{var L,H;const U=t.find($=>$.id===I);if(U){if(E.key===" "){E.preventDefault();const $=p.current;if($!=null&&$.isKeyboardGrab){s($.cardId,$.sourceColumnId,$.sourceIndex);const P=e.find(G=>G.id===$.sourceColumnId);D(U.title,(P==null?void 0:P.title)||"",$.sourceIndex),p.current=null,v(null),b(null),C(null)}else{const P=M[U.columnId].findIndex(G=>G.id===I);p.current={cardId:I,sourceColumnId:U.columnId,sourceIndex:P,offsetY:0,isKeyboardGrab:!0,originalColumnId:U.columnId,originalIndex:P},v(I),C(U.columnId)}}else if(E.key==="ArrowUp"||E.key==="ArrowDown"||E.key==="ArrowLeft"||E.key==="ArrowRight"){E.preventDefault();const $=p.current;if(!$||!$.isKeyboardGrab)return;const P=e.findIndex(re=>re.id===$.sourceColumnId),G=M[$.sourceColumnId];if(!G){p.current=null,v(null),b(null),C(null);return}const K=$.sourceIndex;let se=$.sourceColumnId,V=K;E.key==="ArrowUp"&&K>0?V=K-1:E.key==="ArrowDown"&&K<G.length-1?V=K+1:E.key==="ArrowLeft"&&P>0?(se=e[P-1].id,V=0):E.key==="ArrowRight"&&P<e.length-1&&(se=e[P+1].id,V=0),p.current=Z(F({},$),{sourceColumnId:se,sourceIndex:V}),C(se),b(V),D(U.title,((L=e.find(re=>re.id===se))==null?void 0:L.title)||"",V)}else if(E.key==="Escape"){const $=p.current;$!=null&&$.isKeyboardGrab&&$.originalColumnId!==void 0&&$.originalIndex!==void 0&&(s($.cardId,$.originalColumnId,$.originalIndex),D(U.title,((H=e.find(P=>P.id===$.originalColumnId))==null?void 0:H.title)||"",$.originalIndex)),p.current=null,v(null),b(null),C(null)}}},[t,M,e,s,D]);return h.jsxs("div",Z(F({ref:u,className:`kanban-board ${l}`,onPointerMove:A,onPointerUp:O},c),{children:[h.jsx("div",{ref:k,className:"kanban-board__columns",children:e.map(E=>h.jsx("div",{"data-column-id":E.id,className:"kanban-board__column-wrapper",children:h.jsx(g8,{column:E,cards:M[E.id]||[],selectedId:n,onSelectCard:I=>a==null?void 0:a(I),renderCard:o,draggedCardId:y||void 0,insertionIndex:w===E.id?x!=null?x:0:void 0,onCardPointerDown:j,onCardKeyDown:R})},E.id))}),h.jsx("div",{ref:N,className:"kanban-board__live-region",role:"status","aria-live":"polite","aria-atomic":"true"})]}))});y8.displayName="KanbanBoard";const v8=ve.forwardRef((u,c)=>{var f=u,{entries:e=[],follow:t=!0,maxRows:n=500,showOps:a=!1,className:s="","aria-label":o}=f,l=Me(f,["entries","follow","maxRows","showOps","className","aria-label"]);const m=T.useRef(null),p=T.useRef(null),[y,v]=T.useState(t);T.useEffect(()=>{c&&(typeof c=="function"?c(m.current):c.current=m.current)},[c]),T.useEffect(()=>{if(!t||!p.current)return;const C=new IntersectionObserver(N=>{N.forEach(k=>{k.isIntersecting&&v(!0)})},{threshold:.1});return C.observe(p.current),()=>{C.disconnect()}},[t]),T.useEffect(()=>{y&&t&&m.current&&(m.current.scrollTop=m.current.scrollHeight)},[e,t,y]),T.useEffect(()=>{if(!t||!m.current)return;const C=()=>{const{scrollTop:k,scrollHeight:M,clientHeight:D}=m.current;M-k-D<50||v(!1)},N=m.current;return N.addEventListener("scroll",C),()=>{N.removeEventListener("scroll",C)}},[t]);const x=e.slice(-n),b=C=>C.id?C.id:`log-${typeof C.timestamp=="string"?C.timestamp:C.timestamp.getTime()}-${C.level}-${C.message}-${C.op||""}-${C.target||""}`,w=["log-stream",s].filter(Boolean).join(" ");return h.jsxs("div",Z(F({ref:m,className:w,role:"log","aria-live":y&&t?"polite":void 0,"aria-label":o!=null?o:"Log stream"},l),{children:[h.jsx("div",{className:"log-stream__content",children:x.length===0?h.jsx("div",{className:"log-stream__empty",children:h.jsx("span",{className:"log-stream__empty-text",children:"No log entries"})}):x.map(C=>{const N=typeof C.timestamp=="string"?new Date(C.timestamp):C.timestamp,k=kT(N),M=`log-stream__level log-stream__level--${C.level.toLowerCase()}`;return h.jsxs("div",{className:a?"log-stream__row log-stream__row--with-ops":"log-stream__row",children:[h.jsx("span",{className:"log-stream__time",children:k}),h.jsx("span",{className:M,children:C.level}),a&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"log-stream__op",children:C.op||""}),h.jsx("span",{className:"log-stream__target",children:C.target||""})]}),h.jsx("span",{className:"log-stream__message",children:C.message})]},b(C))})}),t&&h.jsx("div",{ref:p,className:"log-stream__sentinel"})]}))});v8.displayName="LogStream";function $y(e){const t=e.trim();if(/^#[0-9a-fA-F]{6}$/i.test(t))return t;if(/^#[0-9a-fA-F]{3}$/i.test(t)){const l=t.slice(1);return"#"+l[0]+l[0]+l[1]+l[1]+l[2]+l[2]}const n=t.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(n){const l=Math.max(0,Math.min(255,parseInt(n[1],10))),c=Math.max(0,Math.min(255,parseInt(n[2],10))),u=Math.max(0,Math.min(255,parseInt(n[3],10)));return"#"+[l,c,u].map(f=>f.toString(16).padStart(2,"0")).join("")}const a=t.match(/hsla?\s*\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)%\s*,\s*(\d+(?:\.\d+)?)%/);if(a){const l=parseFloat(a[1])/360,c=parseFloat(a[2])/100,u=parseFloat(a[3])/100,f=(1-Math.abs(2*u-1))*c,m=f*(1-Math.abs(l*6%2-1)),p=u-f/2;let y=0,v=0,x=0;l<1/6?(y=f,v=m):l<2/6?(y=m,v=f):l<3/6?(v=f,x=m):l<4/6?(v=m,x=f):l<5/6?(y=m,x=f):(y=f,x=m);const b=w=>Math.round((w+p)*255).toString(16).padStart(2,"0");return"#"+b(y)+b(v)+b(x)}const s={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff",yellow:"#ffff00",cyan:"#00ffff",magenta:"#ff00ff",gray:"#808080",grey:"#808080",silver:"#c0c0c0",maroon:"#800000",olive:"#808000",lime:"#00ff00",aqua:"#00ffff",teal:"#008080",navy:"#000080",purple:"#800080",fuchsia:"#ff00ff"},o=t.toLowerCase();return o in s?s[o]:"#10b981"}function x8(e,t,n,a){const s=(e-t)/(n-t||1),o=Math.round((.12+s*.88)*255).toString(16).padStart(2,"0");return`${$y(a)}${o}`}const Zw=85.05112878,Jw=2,b8=60,Ww=12,_8=16;function Dl(e,t,n){const a=Math.pow(2,n),s=(t+180)/360*a*256,o=Math.max(-85.05112878,Math.min(85.05112878,e)),l=(1-Math.log(Math.tan(o*Math.PI/180)+1/Math.cos(o*Math.PI/180))/Math.PI)/2*a*256;return{x:s,y:l}}function w8(e,t,n){const a=Math.pow(2,n),s=e/(a*256)*360-180;return{lat:Math.atan(Math.sinh(Math.PI*(1-2*(t/(a*256)))))*180/Math.PI,lng:s}}function S8({patternId:e,zoomLevel:t}){const n=32*Math.pow(2,t);return h.jsxs("pattern",{id:e,x:0,y:0,width:n,height:n,patternUnits:"userSpaceOnUse",children:[h.jsx("rect",{width:n,height:n,fill:"none",stroke:"rgb(var(--canvas-fg-3))",strokeWidth:"0.5",opacity:"0.3"}),h.jsx("circle",{cx:0,cy:0,r:1,fill:"rgb(var(--canvas-fg-3))",opacity:"0.4"})]})}function C8({pin:e,x:t,y:n,onClose:a}){const s=T.useRef(null);return Ku(s,!0,{mode:"popup"}),T.useEffect(()=>{const o=l=>{l.key==="Escape"&&a()};return document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o)}},[a]),h.jsxs("div",{ref:s,className:"map-popover",style:{left:`${t}px`,top:`${n}px`},role:"dialog",children:[e.label&&h.jsx("div",{className:"map-popover__label",children:e.label}),e.timestamp&&h.jsx("div",{className:"map-popover__timestamp",children:e.timestamp}),e.detail&&h.jsx("div",{className:"map-popover__detail",children:e.detail})]})}const N8=ve.forwardRef((C,w)=>{var N=C,{mode:e,pins:t=[],selectedPinId:n,onSelectPin:a,trackPoints:s=[],heatmapData:o=[],heatmapColor:l="#10b981",tileUrl:c,bounds:u,scaleBar:f=!1,minZoom:m=0,maxZoom:p=18,onViewportChange:y,onModeChange:v,className:x=""}=N,b=Me(N,["mode","pins","selectedPinId","onSelectPin","trackPoints","heatmapData","heatmapColor","tileUrl","bounds","scaleBar","minZoom","maxZoom","onViewportChange","onModeChange","className"]);const k=T.useRef(null),[M,D]=T.useState(null),[j,A]=T.useState(null),O=T.useRef(!1),[R,E]=T.useState(Jw),I=T.useRef(Jw),L=T.useCallback(B=>{var be,je;const W=k.current,ae=(be=W==null?void 0:W.clientWidth)!=null?be:0,J=(je=W==null?void 0:W.clientHeight)!=null?je:0,le=w8((ae/2-B.x)/B.zoom,(J/2-B.y)/B.zoom,I.current);y==null||y({center:{lat:le.lat,lng:le.lng},zoom:B.zoom})},[y]),{transform:H,viewport:U,bind:$,panTo:P}=yN({minZoom:m,maxZoom:p,onViewportChange:L,containerRef:k}),G=`map-grid-${T.useId().replace(/:/g,"")}`;T.useEffect(()=>{const B=k.current;if(!B)return;const W=new ResizeObserver(ae=>{const{width:J,height:le}=ae[0].contentRect;J>0&&le>0&&D({width:J,height:le})});return W.observe(B),()=>W.disconnect()},[]),T.useEffect(()=>{if(O.current||!M)return;const B=[...t.map(me=>({lat:me.lat,lng:me.lng})),...s.map(me=>({lat:me.lat,lng:me.lng})),...o.map(me=>({lat:me.lat,lng:me.lng}))];let W;if(u)W={north:Math.max(u[0].lat,u[1].lat),south:Math.min(u[0].lat,u[1].lat),east:Math.max(u[0].lng,u[1].lng),west:Math.min(u[0].lng,u[1].lng)};else if(B.length>0){const me=B.map(ue=>ue.lat),Q=B.map(ue=>ue.lng);W={north:Math.max(...me),south:Math.min(...me),east:Math.max(...Q),west:Math.min(...Q)}}else W={north:Zw,south:-Zw,east:180,west:-180};const{width:ae,height:J}=M,le=Math.min(b8,ae/4,J/4),be=Dl(W.north,W.west,0),je=Dl(W.south,W.east,0),De=Math.abs(je.x-be.x),Ae=Math.abs(je.y-be.y);let Xe;if(De===0&&Ae===0)Xe=Ww;else{const me=De>0?Math.log2((ae-2*le)/De):1/0,Q=Ae>0?Math.log2((J-2*le)/Ae):1/0;Xe=Math.min(me,Q)}Xe=Math.max(0,Math.min(_8,Number.isFinite(Xe)?Xe:Ww));const Fe=Dl((W.north+W.south)/2,(W.east+W.west)/2,Xe);I.current=Xe,E(Xe),P(ae/2-Fe.x,J/2-Fe.y),O.current=!0},[M,u,t,s,o,P]);const K=T.useCallback(B=>{B.target instanceof Element&&(B.target.closest(".map-pin")||B.target.closest(".map-popover")||B.target.closest("[data-no-drag]"))||$.onPointerDown(B)},[$]),se=T.useCallback(()=>e!=="pins"||!t.length?null:h.jsx("div",{className:"map-pins","data-testid":"map-pins",style:{position:"absolute",inset:0,pointerEvents:"none"},children:t.map(B=>{const W=Dl(B.lat,B.lng,R),ae=U.x+W.x*U.zoom,J=U.y+W.y*U.zoom;return h.jsxs("button",{type:"button",className:["map-pin",n===B.id&&"map-pin--selected"].filter(Boolean).join(" "),onClick:le=>{le.stopPropagation(),a==null||a(B.id);const be=le.target.getBoundingClientRect();A({x:be.right+8,y:be.top})},"aria-label":`${B.label||"Pin"} at latitude ${B.lat.toFixed(4)}, longitude ${B.lng.toFixed(4)}${B.timestamp?` on ${B.timestamp}`:""}`,"data-testid":`map-pin-${B.id}`,"data-no-drag":!0,style:{position:"absolute",left:`${ae}px`,top:`${J}px`,pointerEvents:"auto"},children:[h.jsx("span",{className:"map-pin__dot"}),B.label&&h.jsx("span",{className:"map-pin__label",children:B.label})]},B.id)})}),[e,t,R,U.zoom,U.x,U.y,n,a]),V=T.useCallback(()=>{if(e!=="track"||!s.length)return null;const B=s.map(W=>Dl(W.lat,W.lng,R)).map((W,ae)=>`${ae===0?"M":"L"} ${W.x} ${W.y}`).join(" ");return h.jsx("g",{className:"map-track","data-testid":"map-track",children:h.jsx("path",{d:B,className:"map-track__line"})})},[e,s,R]),re=T.useCallback(()=>{if(e!=="heatmap"||!o.length)return null;const B=o.map(J=>J.value).filter(J=>J!=null),W=Math.min(...B),ae=Math.max(...B);return h.jsx("g",{className:"map-heatmap","data-testid":"map-heatmap",children:o.map((J,le)=>{const be=Dl(J.lat,J.lng,R),je=(J.value-W)/(ae-W||1),De=x8(J.value,W,ae,l);return h.jsx("circle",{cx:be.x,cy:be.y,r:8+je*4,fill:De,opacity:.6,"data-testid":`heatmap-point-${le}`},le)})})},[e,o,l,R]),fe=T.useCallback(()=>{if(!c||!M)return null;const B=Math.min(Math.max(Math.round(R+Math.log2(U.zoom)),0),28),W=Math.pow(2,B),ae=256*Math.pow(2,R-B),J=-U.x/U.zoom,le=-U.y/U.zoom,be=(M.width-U.x)/U.zoom,je=(M.height-U.y)/U.zoom,De=Math.max(0,Math.floor(J/ae)),Ae=Math.max(0,Math.floor(le/ae)),Xe=Math.min(W,Math.ceil(be/ae)),Fe=Math.min(W,Math.ceil(je/ae)),me=typeof c=="function"?c:(ue,xe,ze)=>c.replace("{x}",String(ue)).replace("{y}",String(xe)).replace("{z}",String(ze)),Q=[];for(let ue=De;ue<Xe;ue++)for(let xe=Ae;xe<Fe;xe++){const ze=me(ue,xe,B);Q.push(h.jsx("image",{href:ze,x:ue*ae,y:xe*ae,width:ae,height:ae,"data-testid":`tile-${ue}-${xe}`},`${B}-${ue}-${xe}`))}return Q},[c,M,U,R]);return h.jsxs("div",Z(F(Z(F({ref:B=>{typeof w=="function"?w(B):w&&(w.current=B),k.current=B},className:["map-canvas",x].filter(Boolean).join(" ")},$),{onPointerDown:K,role:"application","aria-label":"Map canvas"}),b),{children:[h.jsxs("svg",{className:"map-svg",width:"100%",height:"100%",style:{position:"absolute",inset:0,overflow:"visible"},children:[h.jsx("defs",{children:h.jsx(S8,{patternId:G,zoomLevel:U.zoom})}),c?h.jsx("g",{className:"map-tiles",transform:H,children:fe()}):h.jsx("rect",{width:"100%",height:"100%",fill:`url(#${G})`,className:"map-grid"}),h.jsxs("g",{className:"map-viewport",transform:H,children:[V(),re()]})]}),se(),h.jsxs("div",{className:"map-overlay",children:[e==="track"&&h.jsx("div",{className:"map-legend",children:h.jsxs("div",{className:"map-legend__item",children:[h.jsx("div",{className:"map-legend__line",style:{backgroundColor:"rgb(var(--status-cyan))"}}),"Track"]})}),e==="heatmap"&&h.jsx("div",{className:"map-legend",children:h.jsxs("div",{className:"map-legend__item",children:[h.jsx("div",{className:"map-legend__gradient",style:{backgroundImage:`linear-gradient(to right, ${$y(l)}20, ${$y(l)}cc)`}}),"Density"]})}),v&&h.jsxs("div",{className:"map-mode-switch",children:[h.jsx("button",{type:"button",className:["map-mode-switch__button",e==="pins"&&"map-mode-switch__button--active"].filter(Boolean).join(" "),onClick:()=>v("pins"),"aria-label":"Switch to pins mode",title:"Pins",children:"Pins"}),h.jsx("button",{type:"button",className:["map-mode-switch__button",e==="track"&&"map-mode-switch__button--active"].filter(Boolean).join(" "),onClick:()=>v("track"),"aria-label":"Switch to track mode",title:"Track",children:"Track"}),h.jsx("button",{type:"button",className:["map-mode-switch__button",e==="heatmap"&&"map-mode-switch__button--active"].filter(Boolean).join(" "),onClick:()=>v("heatmap"),"aria-label":"Switch to heatmap mode",title:"Heatmap",children:"Heatmap"})]}),f&&h.jsx("div",{className:"map-scale-bar",children:h.jsxs("div",{className:"map-scale-bar__label",children:["Zoom: ",U.zoom.toFixed(1)]})})]}),n&&j&&(()=>{const B=t.find(W=>W.id===n);return B?h.jsx(C8,{pin:B,x:j.x,y:j.y,onClose:()=>{a==null||a(null),A(null)}}):null})()]}))});N8.displayName="MapCanvas";const k8=e=>(typeof e=="string"?new Date(e):new Date(e)).toLocaleDateString("en-US",{month:"short",year:"numeric"}),M8=ve.forwardRef((u,c)=>{var f=u,{focusedDate:e,selectedDate:t,markers:n=[],weekStartsOn:a=0,onSelect:s,className:o=""}=f,l=Me(f,["focusedDate","selectedDate","markers","weekStartsOn","onSelect","className"]);const m=typeof e=="string"?new Date(e):new Date(e),p=t?typeof t=="string"?new Date(t):t:null,y=T.useMemo(()=>A2(m,a),[m.getTime(),a]),v=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];a===1&&v.push(v.shift());const x=b=>n.some(w=>nc(b,w));return h.jsxs("div",Z(F({ref:c,className:`mini-calendar ${o}`.trim()},l),{children:[h.jsx("div",{className:"mini-calendar__header",children:h.jsx("div",{className:"mini-calendar__title",children:k8(m)})}),h.jsxs("div",{className:"mini-calendar__grid",children:[h.jsx("div",{className:"mini-calendar__weekdays",children:v.map(b=>h.jsx("div",{className:"mini-calendar__weekday",children:b.toUpperCase()},b))}),h.jsx("div",{className:"mini-calendar__dates",children:y.map(b=>b.map(w=>{const C=w.getMonth()!==m.getMonth(),N=p?nc(w,p):!1,k=T2(w),M=x(w);return h.jsxs("button",{className:`mini-calendar__date ${C?"mini-calendar__date--out-of-month":""} ${N?"mini-calendar__date--selected":""} ${k?"mini-calendar__date--today":""} ${M?"mini-calendar__date--has-marker":""}`,onClick:()=>!C&&(s==null?void 0:s(w)),type:"button","aria-current":k?"date":void 0,"aria-selected":N,children:[h.jsx("span",{className:"mini-calendar__date-number",children:w.getDate()}),M&&h.jsx("span",{className:"mini-calendar__marker"})]},w.toISOString())}))})]})]}))});M8.displayName="MiniCalendar";const j8={life:"var(--dom-life)",climate:"var(--dom-climate)",software:"var(--dom-software)",data:"var(--dom-default)",infrastructure:"var(--dom-default)"},E8=e=>j8[e]||"var(--accent-primary)",R8=e=>{const t=["emerald","cyan","amber","rose","violet"],n=e.split("").reduce((a,s)=>a+s.charCodeAt(0),0);return t[n%t.length]},T8=ve.forwardRef((y,p)=>{var v=y,{domain:e,source:t,version:n,snippet:a,provenance:s,score:o,onOpen:l,actions:c,selected:u=!1,className:f=""}=v,m=Me(v,["domain","source","version","snippet","provenance","score","onOpen","actions","selected","className"]);const x=E8(e),b=R8(e),w=ve.useCallback(k=>{(k.key==="Enter"||k.key===" ")&&l&&(k.preventDefault(),l())},[l]),C=["result-card",u&&"result-card--selected",f].filter(Boolean).join(" "),N=n?`${t} v${n}`:t;return h.jsxs("div",Z(F({ref:p,className:C,role:"article","aria-label":N,tabIndex:l?0:void 0,onClick:l,onKeyDown:l?w:void 0,style:{"--domain-color":x}},m),{children:[h.jsxs("div",{className:"result-card__header",children:[h.jsxs("div",{className:"result-card__header-left",children:[h.jsx("div",{className:`result-card__domain-dot result-card__domain-dot--${b}`}),h.jsx("span",{className:"result-card__source",children:t}),n&&h.jsx(Ya,{children:n})]}),o!==void 0&&h.jsx("span",{className:"result-card__score-label",children:o.toFixed(2)})]}),o!==void 0&&h.jsx("div",{className:"result-card__score-bar",children:h.jsx(Rv,{percent:o*100,color:"amber",height:4})}),h.jsx("div",{className:"result-card__snippet",children:a}),s&&Object.values(s).some(k=>k!==void 0)&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"result-card__divider"}),h.jsxs("div",{className:"result-card__provenance",children:[s.collection&&h.jsxs("span",{className:"result-card__provenance-field",children:[h.jsx("span",{className:"result-card__provenance-label",children:"Collection"}),h.jsx("span",{className:"result-card__provenance-value",children:s.collection})]}),s.document&&h.jsxs("span",{className:"result-card__provenance-field",children:[h.jsx("span",{className:"result-card__provenance-label",children:"Document"}),h.jsx("span",{className:"result-card__provenance-value",children:s.document})]}),s.section&&h.jsxs("span",{className:"result-card__provenance-field",children:[h.jsx("span",{className:"result-card__provenance-label",children:"Section"}),h.jsx("span",{className:"result-card__provenance-value",children:s.section})]})]})]}),c&&c.length>0&&h.jsx("div",{className:"result-card__actions",children:c.map((k,M)=>h.jsx(Pn,{variant:"ghost",size:"sm",icon:!!k.icon,title:k.label,onClick:D=>{D.stopPropagation(),k.onClick()},children:k.icon?h.jsx(He,{name:k.icon,size:16}):k.label},M))})]}))});T8.displayName="ResultCard";const A8=/^[0-9a-fA-F]+$/;function kN(e){let t;typeof atob=="function"?t=atob(e):t=globalThis.Buffer.from(e,"base64").toString("binary");let n="";for(let a=0;a<t.length;a++)n+=t.charCodeAt(a).toString(16).padStart(2,"0");return n}function Yg(e,t){if(!e)return"";if(A8.test(e)&&e.length===t)return e.toLowerCase();try{return kN(e).toLowerCase()}catch(n){return e.toLowerCase()}}function D8(e){return!e||/^0+$/.test(e)?null:e}const Xg=["UNSPECIFIED","INTERNAL","SERVER","CLIENT","PRODUCER","CONSUMER"];function L8(e){var t,n;if(typeof e=="number")return(t=Xg[e])!=null?t:"UNSPECIFIED";if(typeof e=="string"){if(/^\d+$/.test(e))return(n=Xg[Number(e)])!=null?n:"UNSPECIFIED";const a=e.replace(/^SPAN_KIND_/,"").toUpperCase();return Xg.includes(a)?a:"UNSPECIFIED"}return"UNSPECIFIED"}function O8(e){const t=typeof e=="string"&&/^\d+$/.test(e)?Number(e):e;return t===2||t==="STATUS_CODE_ERROR"?"error":"ok"}function Ff(e){if(e==null||e==="")return null;try{return typeof e=="number"?Number.isFinite(e)?BigInt(Math.trunc(e)):null:BigInt(/[.eE]/.test(e)?e.split(/[.eE]/)[0]:e)}catch(t){return null}}function c1(e){var t;if(!e)return"";if(e.stringValue!==void 0)return e.stringValue;if(e.boolValue!==void 0)return e.boolValue;if(e.intValue!==void 0){const n=Number(e.intValue);return Number.isSafeInteger(n)?n:String(e.intValue)}if(e.doubleValue!==void 0)return e.doubleValue;if(e.bytesValue!==void 0)try{return kN(e.bytesValue)}catch(n){return e.bytesValue}return e.arrayValue?JSON.stringify(((t=e.arrayValue.values)!=null?t:[]).map(c1)):e.kvlistValue?JSON.stringify(Py(e.kvlistValue.values)):""}function Py(e){const t={};return(e!=null?e:[]).forEach(n=>{n&&n.key&&(t[n.key]=c1(n.value))}),t}function Kg(e,t){const n=(e!=null?e:[]).find(a=>a.key===t);return n?c1(n.value):void 0}const I8=["http.response.status_code","http.status_code","rpc.grpc.status_code"];function z8(e,t={}){var p,y,v;const n=(p=t.serviceNameKey)!=null?p:"service.name",a=Array.isArray(e)?e:(y=e==null?void 0:e.resourceSpans)!=null?y:[],s={},o=[];if(a.forEach(x=>{var N,k,M,D;var b;const w=(b=x.resource)==null?void 0:b.attributes,C=String((N=Kg(w,n))!=null?N:"unknown_service");if(!s[C]){const j=(k=Kg(w,"host.name"))!=null?k:Kg(w,"service.instance.id");s[C]={label:C,host:j!=null?String(j):void 0}}((D=(M=x.scopeSpans)!=null?M:x.instrumentationLibrarySpans)!=null?D:[]).forEach(j=>{var A;((A=j.spans)!=null?A:[]).forEach(O=>o.push({span:O,service:C}))})}),o.length===0)return{spans:[],services:s,meta:{traceId:""}};let l=null;o.forEach(({span:x})=>{const b=Ff(x.startTimeUnixNano);b!==null&&(l===null||b<l)&&(l=b)});const c=l!=null?l:BigInt(0),u=o.map(({span:x,service:b})=>{var E,I,L,H;var w;const C=(E=Ff(x.startTimeUnixNano))!=null?E:c,N=(I=Ff(x.endTimeUnixNano))!=null?I:C,k=Number(C-c)/1e6,M=Number(N-C)/1e6,D=Py(x.attributes);let j;const A=((L=x.events)!=null?L:[]).map(U=>{var K;const $=Py(U.attributes),P=Ff(U.timeUnixNano),G=P!==null?Number(P-c)/1e6:k;return U.name==="exception"&&!j&&(j={type:$["exception.type"]!=null?String($["exception.type"]):void 0,message:$["exception.message"]!=null?String($["exception.message"]):void 0,stacktrace:$["exception.stacktrace"]!=null?String($["exception.stacktrace"]):void 0}),{time:G,name:(K=U.name)!=null?K:"event",attributes:$}});let O;for(const U of I8){const $=D[U];if($!==void 0){O=typeof $=="boolean"?String($):$;break}}const R={id:Yg(x.spanId,16),parentId:D8(Yg(x.parentSpanId,16)),name:(H=x.name)!=null?H:"(unnamed)",service:b,kind:L8(x.kind),start:k,duration:M,status:O8((w=x.status)==null?void 0:w.code),statusCode:O,attributes:D,exception:j,events:A.length?A:void 0};return t.deriveStatus?Z(F({},R),{status:t.deriveStatus(R)}):R}),f=(v=u.find(x=>x.parentId===null))!=null?v:u[0],m={traceId:Yg(o[0].span.traceId,32),name:f==null?void 0:f.name,rootService:f==null?void 0:f.service};return{spans:u,services:s,meta:m}}function B8(e){if(!e)return"";const t=e.split("-");return t.length===3?(t[1]+t[2]).toLowerCase():e.replace(/-/g,"").toLowerCase()}function U8(e,t){return t?"SERVER":e.namespace==="aws"||e.namespace==="remote"?"CLIENT":"INTERNAL"}function F8(e){return e.fault||e.error||e.throttle?"error":"ok"}function Hy(e,t,n){if(n!=null){if(typeof n!="object"||Array.isArray(n)){e[t]=Array.isArray(n)?JSON.stringify(n):n;return}Object.entries(n).forEach(([a,s])=>{if(s==null)return;const o=t?`${t}.${a}`:a;typeof s=="object"&&!Array.isArray(s)?Hy(e,o,s):e[o]=Array.isArray(s)?JSON.stringify(s):s})}}function $8(e){var t,n;const a={},s=(t=e.http)==null?void 0:t.request,o=(n=e.http)==null?void 0:n.response;if((s==null?void 0:s.method)!=null&&(a["http.request.method"]=s.method),(s==null?void 0:s.url)!=null&&(a["url.full"]=s.url),(s==null?void 0:s.user_agent)!=null&&(a["user_agent.original"]=s.user_agent),(s==null?void 0:s.client_ip)!=null&&(a["client.address"]=s.client_ip),(o==null?void 0:o.status)!=null&&(a["http.response.status_code"]=o.status),(o==null?void 0:o.content_length)!=null&&(a["http.response.body.size"]=o.content_length),e.sql){const l=e.sql;l.database_type!=null&&(a["db.system"]=l.database_type),l.sanitized_query!=null&&(a["db.statement"]=l.sanitized_query),l.url!=null&&(a["server.address"]=l.url),l.user!=null&&(a["db.user"]=l.user)}return e.namespace&&(a["aws.xray.namespace"]=e.namespace),e.throttle&&(a["aws.xray.throttle"]=!0),"origin"in e&&e.origin&&(a["cloud.platform"]=String(e.origin)),e.aws&&Hy(a,"aws",e.aws),e.annotations&&Object.entries(e.annotations).forEach(([l,c])=>{a[l]=c}),e.metadata&&Hy(a,"metadata",e.metadata),a}function P8(e){var l,c;var t,n,a,s;let o;if(e.cause&&typeof e.cause=="object"&&(t=e.cause.exceptions)!=null&&t.length){const u=e.cause.exceptions[0],f=(n=u.stack)!=null&&n.length?`${(l=u.type)!=null?l:"Error"}: ${(c=u.message)!=null?c:""}
|
|
78
|
+
`+u.stack.map(m=>{var p,y,v;return` at ${(p=m.label)!=null?p:"<anonymous>"} (${(y=m.path)!=null?y:"?"}:${(v=m.line)!=null?v:0})`}).join(`
|
|
79
|
+
`):void 0;o={type:u.type,message:u.message,stacktrace:f}}else typeof e.cause=="string"&&(o={type:"Error",message:`exception ${e.cause}`});return{exception:o,statusCode:(s=(a=e.http)==null?void 0:a.response)==null?void 0:s.status}}function MN(e){var t,n;if(e==null)return[];if(Array.isArray(e))return e.flatMap(MN);if(e.Traces||e.traces){const a=(t=e.Traces)!=null?t:e.traces;let s=a;return a.length>1&&(console.warn(`fromXRay: response has ${a.length} traces; using the first. Pass one trace at a time for the rest.`),s=a.slice(0,1)),s.flatMap(o=>{var l;return((l=o.Segments)!=null?l:[]).map(c=>typeof c.Document=="string"?JSON.parse(c.Document):c.Document)})}return e.Segments||e.segments?((n=e.Segments)!=null?n:e.segments).map(a=>typeof a.Document=="string"?JSON.parse(a.Document):a.Document):[e]}function H8(e,t={}){var p;const n=MN(e);if(n.length===0)return{spans:[],services:{},meta:{traceId:""}};const a=[],s={},o=(y,v,x,b)=>{var w;a.push({node:y,parentId:v,service:x,isRoot:b}),((w=y.subsegments)!=null?w:[]).forEach(C=>o(C,y.id,x,!1))};n.forEach(y=>{var b;const v=y.type==="subsegment",x=y.name;s[x]||(s[x]={label:x}),o(y,(b=y.parent_id)!=null?b:null,x,!v)});let l=1/0,c=-1/0;a.forEach(({node:y})=>{typeof y.start_time=="number"&&(l=Math.min(l,y.start_time)),typeof y.end_time=="number"&&(c=Math.max(c,y.end_time))}),Number.isFinite(l)||(l=0),Number.isFinite(c)||(c=l);const u=a.map(({node:y,parentId:v,service:x,isRoot:b})=>{var R,E,I,L;const w=typeof y.start_time=="number"?y.start_time:l,C=(w-l)*1e3,N=typeof y.end_time=="number"?y.end_time:c,k=Math.max(0,(N-w)*1e3),M=$8(y),{exception:D,statusCode:j}=P8(y),A=D?[{time:C,name:"exception",attributes:{"exception.type":(R=D.type)!=null?R:"","exception.message":(E=D.message)!=null?E:""}}]:void 0,O={id:String((I=y.id)!=null?I:"").toLowerCase(),parentId:v!=null?String(v).toLowerCase():null,name:String((L=y.name)!=null?L:"(unnamed)"),service:x,kind:U8(y,b),start:C,duration:k,status:F8(y),statusCode:j,attributes:M,exception:D,events:A};return t.deriveStatus?Z(F({},O),{status:t.deriveStatus(O)}):O}),f=(p=n.find(y=>y.type!=="subsegment"))!=null?p:n[0],m={traceId:B8(f.trace_id),name:f.name,rootService:f.name};return{spans:u,services:s,meta:m}}function q8(e){const t={};e.forEach(u=>{t[u.id]=Z(F({},u),{end:u.start+u.duration,depth:0,children:[],hasChildren:!1})});const n=[];e.forEach(u=>{const f=t[u.id];u.parentId&&t[u.parentId]&&u.parentId!==u.id?t[u.parentId].children.push(f):n.push(f)});const a=(u,f)=>u.start-f.start||u.end-f.end;n.sort(a);const s=[];let o=0;const l=(u,f)=>{u.depth=f,u.hasChildren=u.children.length>0,f>o&&(o=f),s.push(u),u.children.sort(a),u.children.forEach(m=>l(m,f+1))};n.forEach(u=>l(u,0));const c=s.reduce((u,f)=>f.end>u?f.end:u,0);return{byId:t,ordered:s,roots:n,total:c,maxDepth:o}}function jN(e){if(!e.children.length)return e.duration;const t=e.children.map(o=>[Math.max(o.start,e.start),Math.min(o.end,e.end)]).filter(([o,l])=>l>o).sort((o,l)=>o[0]-l[0]);let n=0,a=null,s=0;return t.forEach(([o,l])=>{a===null?(a=o,s=l):o<=s?s=Math.max(s,l):(n+=s-a,a=o,s=l)}),a!==null&&(n+=s-a),Math.max(0,e.duration-n)}function V8(e,t){const n=[],a=new Set;return e.forEach(s=>{if(s.parentId&&a.has(s.parentId)){a.add(s.id);return}n.push(s),t.has(s.id)&&a.add(s.id)}),n}function G8(e){let t=0;const n=a=>{a.children.forEach(s=>{t++,n(s)})};return n(e),t}const qy=2;function EN(e,t,n=qy){const a=Math.max(1e-6,t-e),s=100-2*n;return{x:o=>n+(o-e)/a*s,w:o=>Math.max(.5,o/a*s)}}function Y8(e,t){const n=Math.max(1e-6,t-e)/8,a=Math.pow(10,Math.floor(Math.log10(n))),s=n/a,o=a*(s<1.5?1:s<3?2:s<7?5:10),l=[],c=Math.ceil(e/o-1e-9)*o;for(let u=c;u<=t+1e-6;u+=o)l.push(+u.toFixed(3));return{ticks:l,step:o}}function Ca(e){return e==null?"—":e>=1e3?(e/1e3).toFixed(2)+" s":e>=10?e.toFixed(0)+" ms":e>=1?e.toFixed(1)+" ms":e.toFixed(2)+" ms"}const RN=["#22D3EE","#818CF8","#10B981","#8B5CF6","#14B8A6","#F59E0B","#38BDF8","#A3E635","#E879F9","#2DD4BF"];function X8(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return t>>>0}function K8(e,t=RN){return t[X8(e)%t.length]}function Q8(e,t,n,a=RN){var s;return(n==null?void 0:n(e))||((s=t==null?void 0:t[e])==null?void 0:s.color)||K8(e,a)}function Z8(e,t){var n;return((n=t==null?void 0:t[e])==null?void 0:n.label)||e}const J8={SERVER:"server",CLIENT:"client",INTERNAL:"internal",PRODUCER:"producer",CONSUMER:"consumer",UNSPECIFIED:"internal"},W8={ok:"OK",warn:"WARN",error:"ERROR"};function e9({model:e,resolveColor:t,selectedId:n}){const{ordered:a,total:s}=e,o=100,l=2,c=1,u=3,f=a.length,m=u*2+f*(l+c),p=a.findIndex(v=>v.id===n),y=ve.useMemo(()=>{const v=EN(0,s);return a.map((x,b)=>h.jsx("rect",{x:v.x(x.start),y:u+b*(l+c),width:v.w(x.duration),height:l,rx:"0.6",fill:x.status==="error"?"rgb(var(--status-error))":t(x.service),fillOpacity:.5},x.id))},[a,s,t]);return h.jsxs("svg",{className:"trace-detail__minimap",width:"100%",height:m,viewBox:`0 0 ${o} ${m}`,preserveAspectRatio:"none",children:[p>=0&&h.jsx("rect",{x:"0",y:u+p*(l+c)-1,width:o,height:l+2,className:"trace-detail__minimap-band"}),y]})}function eS({rows:e}){return h.jsx("div",{className:"trace-detail__kv",children:e.map(([t,n],a)=>h.jsxs(ve.Fragment,{children:[h.jsx("div",{className:"trace-detail__kv-key",title:t,children:t}),h.jsx("div",{className:"trace-detail__kv-val",title:typeof n=="string"?n:void 0,children:n})]},t+a))})}function mo({title:e,right:t,children:n}){return h.jsxs("div",{className:"trace-detail__section",children:[h.jsxs("div",{className:"trace-detail__section-head",children:[h.jsx("span",{className:"trace-detail__eyebrow",children:e}),t]}),h.jsx("div",{className:"trace-detail__section-body",children:n})]})}const TN=ve.forwardRef(function({span:e,model:t,traceId:n,resolveColor:a,serviceLabel:s,serviceHost:o,onClose:l,onSelect:c,renderAttributes:u,closeButtonRef:f},m){var A,O,R,E;var p;const y=a(e.service),v=t.total,x=jN(e),b=v>0?e.duration/v*100:0,w=e.duration>0?x/e.duration*100:0,C=e.parentId?t.byId[e.parentId]:null,N=(A=J8[e.kind])!=null?A:"internal",k=t.ordered.findIndex(I=>I.id===e.id)+1,M=e.attributes?Object.entries(e.attributes):[],D=((O=e.events)!=null?O:[]).filter(I=>I.name!=="exception"),j=({label:I,value:L,sub:H})=>h.jsxs("div",{className:"trace-detail__timing-row",children:[h.jsx("span",{className:"trace-detail__timing-label",children:I}),h.jsxs("span",{className:"trace-detail__timing-value",children:[L,H&&h.jsxs("span",{className:"trace-detail__timing-sub",children:[" ",H]})]})]});return h.jsxs("div",{className:"trace-detail",ref:m,role:"complementary","aria-label":`Span detail: ${e.name}`,onKeyDown:I=>{I.key==="Escape"&&(I.stopPropagation(),l())},children:[h.jsxs("div",{className:"trace-detail__head",children:[h.jsx("span",{className:"trace-detail__head-swatch",style:{background:y}}),h.jsxs("div",{className:"trace-detail__head-main",children:[h.jsxs("div",{className:"trace-detail__eyebrow",children:[s.toUpperCase()," · ",e.kind]}),h.jsx("div",{className:"trace-detail__title",children:e.name}),h.jsx("div",{className:"trace-detail__status-row",children:h.jsxs("span",{className:`trace-detail__status-pill trace-detail__status-pill--${e.status}`,children:[h.jsx("span",{className:"trace-detail__status-dot"}),W8[e.status],e.statusCode!=null&&e.statusCode!==0?` · ${e.statusCode}`:""]})})]}),h.jsx("button",{type:"button",className:"trace-detail__close",onClick:l,title:"Close panel","aria-label":"Close span detail",ref:f,children:h.jsx(He,{name:"x",size:14})})]}),h.jsxs("div",{className:"trace-detail__scroll",children:[h.jsxs(mo,{title:"TRACE MAP",children:[h.jsx("div",{className:"trace-detail__minimap-wrap",children:h.jsx(e9,{model:t,resolveColor:a,selectedId:e.id})}),h.jsxs("div",{className:"trace-detail__minimap-caption",children:["row ",k," of ",t.ordered.length]})]}),h.jsxs(mo,{title:"TIMING",children:[h.jsx(j,{label:"start offset",value:Ca(e.start)}),h.jsx(j,{label:"duration",value:Ca(e.duration)}),h.jsx(j,{label:"self time",value:Ca(x),sub:`· ${w.toFixed(0)}%`}),h.jsx(j,{label:"% of trace",value:`${b.toFixed(1)}%`}),h.jsxs("div",{className:"trace-detail__selfbar",children:[h.jsx("div",{className:"trace-detail__selfbar-self",style:{width:`${w}%`,background:y}}),h.jsx("div",{className:"trace-detail__selfbar-children"})]}),h.jsxs("div",{className:"trace-detail__selfbar-legend",children:[h.jsxs("span",{children:["SELF ",Ca(x)]}),h.jsxs("span",{children:["IN CHILDREN ",Ca(e.duration-x)]})]})]}),h.jsx(mo,{title:"IDENTITY",children:h.jsx(eS,{rows:[["span_id",e.id],["parent",C?h.jsx("button",{type:"button",className:"trace-detail__link",onClick:()=>c(C.id),title:C.name,children:C.name}):h.jsx("span",{className:"trace-detail__muted",children:"— root —"})],["service",h.jsxs("span",{className:"trace-detail__svc",title:s,children:[h.jsx("span",{className:"trace-detail__svc-dot",style:{background:y}}),s]})],...o?[["host",o]]:[],["kind",h.jsx("span",{className:`trace-detail__kind trace-detail__kind--${N}`,children:e.kind})],...n?[["trace_id",n]]:[]]})}),u?h.jsx(mo,{title:"ATTRIBUTES",children:u(e)}):M.length>0?h.jsx(mo,{title:"ATTRIBUTES",right:h.jsx("span",{className:"trace-detail__count",children:M.length}),children:h.jsx(eS,{rows:M.map(([I,L])=>[I,String(L)])})}):null,D.length>0&&h.jsx(mo,{title:"EVENTS",right:h.jsx("span",{className:"trace-detail__count",children:D.length}),children:h.jsx("div",{className:"trace-detail__events",children:D.map((I,L)=>h.jsxs("div",{className:"trace-detail__event",children:[h.jsx("span",{className:"trace-detail__event-time",children:Ca(I.time)}),h.jsx("span",{className:"trace-detail__event-name",children:I.name})]},L))})}),h.jsx(mo,{title:"STATUS",children:e.status==="error"&&e.exception?h.jsxs("div",{className:"trace-detail__error",children:[h.jsxs("div",{className:"trace-detail__error-head",children:[h.jsx(He,{name:"alert",size:14}),h.jsx("span",{children:(R=e.exception.type)!=null?R:"Error"})]}),e.exception.message&&h.jsx("div",{className:"trace-detail__error-msg",children:e.exception.message}),e.exception.stacktrace&&h.jsx("pre",{className:"trace-detail__error-stack",children:e.exception.stacktrace})]}):e.status==="warn"?h.jsxs("div",{className:"trace-detail__warn",children:[h.jsx(He,{name:"alert",size:13}),"degraded — ",String((E=(p=e.attributes)==null?void 0:p.note)!=null?E:"elevated latency on this span")]}):h.jsxs("div",{className:"trace-detail__ok",children:[h.jsx("span",{className:"trace-detail__ok-dot"}),"OK",e.statusCode?` · ${e.statusCode}`:""]})}),h.jsx("div",{className:"trace-detail__foot-spacer"})]})]})});TN.displayName="TraceDetailPanel";const tS=14,nS=16;function t9({node:e,rowHeight:t,treeWidth:n,selected:a,hovered:s,collapsed:o,color:l,onSelect:c,onHover:u,onToggle:f,registerRef:m}){const p=tS+e.depth*nS,y=[];for(let x=0;x<e.depth;x++)y.push(tS+x*nS+7);const v=["trace-viewer__tree-row",a&&"is-selected",s&&"is-hovered",e.status==="error"&&"is-error",e.status==="warn"&&"is-warn"].filter(Boolean).join(" ");return h.jsxs("div",{ref:x=>m(e.id,x),className:v,role:"treeitem","aria-level":e.depth+1,"aria-selected":a,"aria-expanded":e.hasChildren?!o:void 0,tabIndex:a?0:-1,style:{height:t,paddingLeft:p,width:n},onClick:()=>c(e.id),onMouseEnter:()=>u(e.id),onMouseLeave:()=>u(null),children:[y.map((x,b)=>h.jsx("span",{className:"trace-viewer__guide",style:{left:x}},b)),e.hasChildren?h.jsx("button",{type:"button",className:"trace-viewer__twisty"+(o?"":" is-open"),onClick:x=>{x.stopPropagation(),f(e.id)},tabIndex:-1,"aria-label":o?"Expand":"Collapse",children:h.jsx(He,{name:"chevronRight",size:13})}):h.jsx("span",{className:"trace-viewer__twisty trace-viewer__twisty--leaf",children:h.jsx("span",{className:"trace-viewer__leaf-dot"})}),h.jsx("span",{className:"trace-viewer__swatch",style:{background:l}}),h.jsx("span",{className:"trace-viewer__tree-name",children:e.name}),o&&e.hasChildren&&h.jsxs("span",{className:"trace-viewer__desc-count",children:["+",G8(e)]}),h.jsx("span",{className:"trace-viewer__tree-dur",children:Ca(e.duration)})]})}function n9({node:e,rowHeight:t,scaleX:n,scaleW:a,selected:s,hovered:o,color:l,onSelect:c,onHover:u}){const f=n(e.start),m=a(e.duration),p=f+m<68,y=e.status==="error",v=e.status==="warn",x=["trace-viewer__wf-row",s&&"is-selected",o&&"is-hovered"].filter(Boolean).join(" ");return h.jsxs("div",{className:x,style:{height:t},onClick:()=>c(e.id),onMouseEnter:()=>u(e.id),onMouseLeave:()=>u(null),children:[h.jsx("div",{className:"trace-viewer__bar"+(y?" is-error":"")+(s?" is-selected":""),style:{left:`${f}%`,width:`${m}%`,background:l},children:v&&h.jsx("span",{className:"trace-viewer__bar-warn"})}),y&&h.jsx("span",{className:"trace-viewer__bar-alert",style:{left:`calc(${f}% - 4px)`},children:h.jsx(He,{name:"alert",size:12})}),h.jsxs("span",{className:"trace-viewer__bar-label",style:p?{left:`calc(${f+m}% + 7px)`}:{right:`calc(${100-f}% + 7px)`},children:[h.jsx("span",{className:"trace-viewer__bar-dur"+(y?" is-error":v?" is-warn":""),children:Ca(e.duration)}),h.jsx("span",{className:"trace-viewer__bar-name",children:e.name})]})]})}const a9=ve.memo(function({model:e,resolveColor:t,resolveLabel:n}){const{ordered:a,total:s}=e,o=new Set(a.map(y=>y.service)),l=a.filter(y=>y.status==="error").length,c=a.filter(y=>y.status==="warn").length,u={};a.forEach(y=>{u[y.service]=(u[y.service]||0)+jN(y)});const f=Object.entries(u).sort((y,v)=>v[1]-y[1]),m=f.reduce((y,[,v])=>y+v,0)||1,p=({label:y,value:v,tone:x})=>h.jsxs("div",{className:"trace-viewer__stat"+(x?` trace-viewer__stat--${x}`:""),children:[h.jsx("span",{className:"trace-viewer__eyebrow",children:y}),h.jsx("span",{className:"trace-viewer__stat-value",children:v})]});return h.jsxs("div",{className:"trace-viewer__summary",children:[h.jsx(p,{label:"DURATION",value:Ca(s),tone:"accent"}),h.jsx(p,{label:"SPANS",value:a.length}),h.jsx(p,{label:"SERVICES",value:o.size}),h.jsx(p,{label:"ERRORS",value:l,tone:l?"error":void 0}),h.jsx(p,{label:"WARNINGS",value:c,tone:c?"warn":void 0}),h.jsxs("div",{className:"trace-viewer__svcbar-wrap",children:[h.jsx("span",{className:"trace-viewer__eyebrow",children:"TIME PER SERVICE · SELF"}),h.jsx("div",{className:"trace-viewer__svcbar",children:f.map(([y,v])=>h.jsx("div",{className:"trace-viewer__svcbar-seg",title:`${n(y)} · ${Ca(v)}`,style:{width:`${v/m*100}%`,background:t(y)}},y))}),h.jsx("div",{className:"trace-viewer__svc-legend",children:f.map(([y,v])=>h.jsxs("span",{className:"trace-viewer__svc-legend-item",children:[h.jsx("span",{className:"trace-viewer__svc-legend-dot",style:{background:t(y)}}),n(y),h.jsx("span",{className:"trace-viewer__svc-legend-val",children:Ca(v)})]},y))})]})]})}),i9=ve.forwardRef(function(O,A){var R=O,{trace:e,otlp:t,xray:n,selectedSpanId:a,defaultSelectedSpanId:s=null,onSelectSpan:o,collapsedSpanIds:l,defaultCollapsedSpanIds:c,onToggleSpan:u,showSummary:f=!0,showToolbar:m=!0,showDetailPanel:p=!0,treeWidth:y=336,detailPanelWidth:v=360,rowHeight:x=30,services:b,serviceColor:w,deriveStatus:C,renderAttributes:N,enableZoom:k=!0,virtualizeThreshold:M=80,className:D=""}=R,j=Me(R,["trace","otlp","xray","selectedSpanId","defaultSelectedSpanId","onSelectSpan","collapsedSpanIds","defaultCollapsedSpanIds","onToggleSpan","showSummary","showToolbar","showDetailPanel","treeWidth","detailPanelWidth","rowHeight","services","serviceColor","deriveStatus","renderAttributes","enableZoom","virtualizeThreshold","className"]);var E,I;const L=T.useMemo(()=>{let ce;return t?ce=z8(t):n?ce=H8(n):ce=e!=null?e:{spans:[]},C&&(ce=Z(F({},ce),{spans:ce.spans.map(Ue=>Z(F({},Ue),{status:C(Ue)}))})),ce},[t,n,e,C]),H=T.useMemo(()=>q8(L.spans),[L]),{ordered:U,byId:$,total:P}=H,G=T.useMemo(()=>{var ce;return F(F({},(ce=L.services)!=null?ce:{}),b!=null?b:{})},[L.services,b]),K=T.useCallback(ce=>Q8(ce,G,w),[G,w]),se=T.useCallback(ce=>Z8(ce,G),[G]),[V,re]=T.useState(s),fe=a!==void 0?a:V,B=fe&&$[fe]?fe:null,W=T.useCallback(ce=>{a===void 0&&re(ce),o==null||o(ce)},[a,o]),[ae,J]=T.useState(()=>new Set(c!=null?c:[])),le=T.useMemo(()=>l?new Set(l):ae,[l,ae]),be=T.useCallback(ce=>{const Ue=!le.has(ce);l===void 0&&J(Je=>{const ft=new Set(Je);return ft.has(ce)?ft.delete(ce):ft.add(ce),ft}),u==null||u(ce,Ue)},[le,l,u]),je=T.useCallback(ce=>{var Ue;if(l!==void 0)return;const Je=[];let ft=(Ue=$[ce])!=null&&Ue.parentId?$[$[ce].parentId]:null;for(;ft;)Je.push(ft.id),ft=ft.parentId?$[ft.parentId]:null;Je.length&&J(on=>{const Ra=new Set(on);return Je.forEach(_i=>Ra.delete(_i)),Ra})},[$,l]),[De,Ae]=T.useState(null),[Xe,Fe]=T.useState(null),me=Xe!=null?Xe:[0,P||1],Q=T.useMemo(()=>EN(me[0],me[1]),[me[0],me[1]]),ue=T.useMemo(()=>Y8(me[0],me[1]).ticks,[me[0],me[1]]),xe=T.useMemo(()=>V8(U,le),[U,le]),ze=T.useMemo(()=>{const ce=new Map;return xe.forEach((Ue,Je)=>ce.set(Ue.id,Je)),ce},[xe]),X=xe.length*x,[ke,we]=T.useState(600),$e=xe.length>=M,{visibleRange:tt,containerRef:Ke,sentinelRef:dt}=Av({itemCount:xe.length,itemHeight:x,containerHeight:ke,overscan:16}),ye=$e?Math.max(0,tt[0]):0,Se=$e?Math.min(xe.length,tt[1]):xe.length,Be=xe.slice(ye,Se);T.useEffect(()=>{const ce=Ke.current;if(!ce||typeof ResizeObserver>"u")return;const Ue=new ResizeObserver(()=>we(ce.clientHeight||600));return Ue.observe(ce),we(ce.clientHeight||600),()=>Ue.disconnect()},[Ke]);const at=T.useMemo(()=>{const ce=new Set;let Ue=B?$[B]:null;for(;Ue;)ce.add(Ue.id),Ue=Ue.parentId?$[Ue.parentId]:null;return ce},[B,$]),Pe=T.useRef(new Map),gt=T.useCallback((ce,Ue)=>{Ue?Pe.current.set(ce,Ue):Pe.current.delete(ce)},[]),ct=T.useRef(null),Et=T.useCallback(ce=>{const Ue=ze.get(ce),Je=Ke.current;if(Ue==null||!Je)return;const ft=Ue*x,on=ft+x;ft<Je.scrollTop?Je.scrollTop=Math.max(0,ft-x):on>Je.scrollTop+Je.clientHeight&&(Je.scrollTop=on-Je.clientHeight+x)},[ze,x,Ke]),qe=T.useCallback((ce,Ue=6)=>{const Je=Pe.current.get(ce);if(Je){Je.focus();return}Ue>0&&requestAnimationFrame(()=>qe(ce,Ue-1))},[]);T.useEffect(()=>{B&&(Et(B),ct.current===B&&(qe(B),ct.current=null))},[B,Et,qe]);const vt=T.useCallback((ce,Ue=!0)=>{je(ce),Ue&&(ct.current=ce),W(ce)},[je,W]),ht=T.useCallback(ce=>{var Ue;const Je=B!=null?B:(Ue=xe[0])==null?void 0:Ue.id;if(!Je)return;const ft=ze.get(Je);if(ft==null)return;const on=$[Je];switch(ce.key){case"ArrowDown":ce.preventDefault(),xe[ft+1]&&vt(xe[ft+1].id);break;case"ArrowUp":ce.preventDefault(),xe[ft-1]&&vt(xe[ft-1].id);break;case"ArrowRight":ce.preventDefault(),on.hasChildren&&le.has(Je)?be(Je):xe[ft+1]&&xe[ft+1].parentId===Je&&vt(xe[ft+1].id);break;case"ArrowLeft":ce.preventDefault(),on.hasChildren&&!le.has(Je)?be(Je):on.parentId&&vt(on.parentId);break;case"Home":ce.preventDefault(),xe[0]&&vt(xe[0].id);break;case"End":ce.preventDefault(),xe[xe.length-1]&&vt(xe[xe.length-1].id);break;case"Enter":case" ":ce.preventDefault(),vt(Je);break;case"Escape":B&&(ce.preventDefault(),W(null));break}},[B,xe,ze,$,le,be,vt,W]),Vt=T.useMemo(()=>{const ce=new Map;return U.forEach((Ue,Je)=>ce.set(Ue.id,Je)),ce},[U]),Zt=T.useMemo(()=>U.filter(ce=>ce.status==="error").map(ce=>ce.id),[U]),Qa=T.useCallback(ce=>{var Ra,_i;if(!Zt.length)return;const Ue=Sn=>{var Ta;return(Ta=Vt.get(Sn))!=null?Ta:-1},Je=B?Ue(B):-1,ft=Zt.map(Ue).sort((Sn,Ta)=>Sn-Ta);let on;ce===1?on=(Ra=ft.find(Sn=>Sn>Je))!=null?Ra:ft[0]:on=(_i=[...ft].reverse().find(Sn=>Sn<Je))!=null?_i:ft[ft.length-1],on!=null&&vt(U[on].id)},[Zt,U,B,vt]),ln=T.useCallback(()=>{l===void 0&&J(new Set(U.filter(ce=>ce.hasChildren).map(ce=>ce.id)))},[l,U]),cn=T.useCallback(()=>{l===void 0&&J(new Set)},[l]),aa=T.useRef(null),[rn,Zn]=T.useState(null),gn=T.useRef(null),Ln=T.useCallback(ce=>{const Ue=aa.current;if(!Ue)return 0;const Je=Ue.getBoundingClientRect();return Math.min(100,Math.max(0,(ce-Je.left)/Je.width*100))},[]),ia=T.useCallback(ce=>{const Ue=100-2*qy,Je=(ce-qy)/Ue;return me[0]+Je*(me[1]-me[0])},[me]),Li=T.useCallback(ce=>{if(!k||P<=0)return;ce.currentTarget.setPointerCapture(ce.pointerId);const Ue=Ln(ce.clientX);gn.current=Ue,Zn({a:Ue,b:Ue})},[k,P,Ln]),nn=T.useCallback(ce=>{gn.current!=null&&Zn({a:gn.current,b:Ln(ce.clientX)})},[Ln]),ja=T.useCallback(()=>{if(gn.current==null)return;const ce=rn;if(gn.current=null,Zn(null),!ce||Math.abs(ce.b-ce.a)<1.5)return;const Ue=ia(Math.min(ce.a,ce.b)),Je=ia(Math.max(ce.a,ce.b)),ft=Math.max(0,Math.min(Ue,Je)),on=Math.min(P,Math.max(Ue,Je));on-ft>P*.005&&Fe([ft,on])},[rn,ia,P]),an=T.useCallback(()=>{gn.current=null,Zn(null)},[]),Za=Xe!=null;T.useEffect(()=>{a===void 0&&V&&!$[V]&&re(null)},[$,V,a]);const xi=B?$[B]:null,wn=p&&!!xi,Oi=T.useRef(null),Ii=T.useCallback(()=>{const ce=B;W(null),ce&&qe(ce)},[B,W,qe]),bi=Zt.length,Ea=["trace-viewer",D].filter(Boolean).join(" ");return U.length?h.jsxs("div",Z(F({ref:A,className:Ea},j),{children:[f&&h.jsx(a9,{model:H,resolveColor:K,resolveLabel:se}),m&&h.jsxs("div",{className:"trace-viewer__toolbar",children:[h.jsxs("div",{className:"trace-viewer__toolbar-group",children:[h.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:cn,title:"Expand all","aria-label":"Expand all",children:h.jsx(He,{name:"chevronDown",size:14})}),h.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:ln,title:"Collapse all","aria-label":"Collapse all",children:h.jsx(He,{name:"chevronRight",size:14})})]}),h.jsxs("div",{className:"trace-viewer__toolbar-group",children:[h.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:()=>Qa(-1),disabled:!bi,title:"Previous error","aria-label":"Previous error",children:h.jsx(He,{name:"arrowUp",size:14})}),h.jsxs("span",{className:"trace-viewer__error-count"+(bi?" is-active":""),children:[bi," error",bi!==1?"s":""]}),h.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:()=>Qa(1),disabled:!bi,title:"Next error","aria-label":"Next error",children:h.jsx(He,{name:"arrowDown",size:14})})]}),k&&h.jsxs("div",{className:"trace-viewer__toolbar-group",children:[h.jsx("button",{type:"button",className:"trace-viewer__tool-btn",onClick:()=>Fe(null),disabled:!Za,title:"Reset zoom","aria-label":"Reset zoom",children:h.jsx(He,{name:"reload",size:14})}),h.jsx("span",{className:"trace-viewer__zoom-hint",children:Za?`${Ca(me[0])} – ${Ca(me[1])}`:"drag axis to zoom"})]})]}),h.jsxs("div",{className:"trace-viewer__body",children:[h.jsxs("div",{className:"trace-viewer__lane",children:[h.jsxs("div",{className:"trace-viewer__lane-head",style:{height:32},children:[h.jsxs("div",{className:"trace-viewer__tree-head",style:{width:y},children:[h.jsxs("span",{className:"trace-viewer__eyebrow",children:["SPAN · ",xe.length,"/",U.length]}),h.jsx("span",{className:"trace-viewer__eyebrow",children:"DURATION"})]}),h.jsxs("div",{className:"trace-viewer__axis"+(k?" is-zoomable":""),ref:aa,onPointerDown:Li,onPointerMove:nn,onPointerUp:ja,onPointerCancel:an,onLostPointerCapture:an,onDoubleClick:()=>Fe(null),children:[ue.map((ce,Ue)=>h.jsx("div",{className:"trace-viewer__tick-label",style:{left:`${Q.x(ce)}%`},children:ce===0?"0":Ca(ce)},Ue)),rn&&h.jsx("div",{className:"trace-viewer__brush",style:{left:`${Math.min(rn.a,rn.b)}%`,width:`${Math.abs(rn.b-rn.a)}%`}})]})]}),h.jsx("div",{className:"trace-viewer__scroll",ref:Ke,children:h.jsxs("div",{className:"trace-viewer__rows",style:{height:X},children:[h.jsx("div",{ref:dt,className:"trace-viewer__sentinel"}),h.jsx("div",{className:"trace-viewer__tree",role:"tree","aria-label":"Span tree",tabIndex:0,onKeyDown:ht,style:{width:y,height:X},children:Be.map((ce,Ue)=>{const Je=ye+Ue;return h.jsx("div",{className:"trace-viewer__row-abs",style:{top:Je*x},children:h.jsx(t9,{node:ce,rowHeight:x,treeWidth:y,selected:B===ce.id,hovered:De===ce.id,collapsed:le.has(ce.id),color:K(ce.service),onSelect:ft=>vt(ft,!1),onHover:Ae,onToggle:be,registerRef:gt})},ce.id)})}),h.jsxs("div",{className:"trace-viewer__wf",style:{height:X},children:[ue.map((ce,Ue)=>h.jsx("div",{className:"trace-viewer__gridline",style:{left:`${Q.x(ce)}%`}},Ue)),h.jsx("svg",{className:"trace-viewer__connectors",width:"100%",height:X,viewBox:`0 0 100 ${X}`,preserveAspectRatio:"none",children:xe.map(ce=>{if(!ce.parentId)return null;const Ue=ze.get(ce.id),Je=ze.get(ce.parentId);if(Ue==null||Je==null)return null;const ft=Math.min(Ue,Je);if(Math.max(Ue,Je)<ye-24||ft>Se+24)return null;const on=$[ce.parentId],Ra=Q.x(on.start),_i=Q.x(ce.start),Sn=Je*x+x/2+5,Ta=Ue*x+x/2,Ja=at.has(ce.id)&&at.has(ce.parentId);return h.jsx("path",{d:`M ${Ra} ${Sn} L ${Ra} ${Ta} L ${_i} ${Ta}`,className:"trace-viewer__connector"+(Ja?" is-active":""),vectorEffect:"non-scaling-stroke"},ce.id)})}),Be.map((ce,Ue)=>{const Je=ye+Ue;return h.jsx("div",{className:"trace-viewer__row-abs",style:{top:Je*x},children:h.jsx(n9,{node:ce,rowHeight:x,scaleX:Q.x,scaleW:Q.w,selected:B===ce.id,hovered:De===ce.id,color:K(ce.service),onSelect:ft=>vt(ft,!1),onHover:Ae})},ce.id)})]})]})})]}),p&&h.jsx("div",{className:"trace-viewer__panel"+(wn?" is-open":""),style:{width:wn?v:0},children:xi&&h.jsx(TN,{span:xi,model:H,traceId:(E=L.meta)==null?void 0:E.traceId,resolveColor:K,serviceLabel:se(xi.service),serviceHost:(I=G[xi.service])==null?void 0:I.host,onClose:Ii,onSelect:ce=>vt(ce,!1),renderAttributes:N,closeButtonRef:Oi})})]})]})):h.jsx("div",Z(F({ref:A,className:Ea},j),{children:h.jsx("div",{className:"trace-viewer__empty",children:"No spans in this trace."})}))});i9.displayName="TraceViewer";function AN(e,t){let n;try{n=e()}catch(s){return}return{getItem:s=>{var o;const l=u=>u===null?null:JSON.parse(u,void 0),c=(o=n.getItem(s))!=null?o:null;return c instanceof Promise?c.then(l):l(c)},setItem:(s,o)=>n.setItem(s,JSON.stringify(o,void 0)),removeItem:s=>n.removeItem(s)}}const Vy=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(a){return Vy(a)(n)},catch(a){return this}}}catch(n){return{then(a){return this},catch(a){return Vy(a)(n)}}}},s9=(e,t)=>(n,a,s)=>{let o=F({storage:AN(()=>window.localStorage),partialize:w=>w,version:0,merge:(w,C)=>F(F({},C),w)},t),l=!1,c=0;const u=new Set,f=new Set;let m=o.storage;if(!m)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...w)},a,s);const p=()=>{const w=o.partialize(F({},a()));return m.setItem(o.name,{state:w,version:o.version})},y=s.setState;s.setState=(w,C)=>(y(w,C),p());const v=e((...w)=>(n(...w),p()),a,s);s.getInitialState=()=>v;let x;const b=()=>{var w,C;if(!m)return;const N=++c;l=!1,u.forEach(M=>{var D;return M((D=a())!=null?D:v)});const k=((C=o.onRehydrateStorage)==null?void 0:C.call(o,(w=a())!=null?w:v))||void 0;return Vy(m.getItem.bind(m))(o.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==o.version){if(o.migrate){const D=o.migrate(M.state,M.version);return D instanceof Promise?D.then(j=>[!0,j]):[!0,D]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var D;if(N!==c)return;const[j,A]=M;if(x=o.merge(A,(D=a())!=null?D:v),n(x,!0),j)return p()}).then(()=>{N===c&&(k==null||k(x,void 0),x=a(),l=!0,f.forEach(M=>M(x)))}).catch(M=>{N===c&&(k==null||k(void 0,M))})};return s.persist={setOptions:w=>{o=F(F({},o),w),w.storage&&(m=w.storage)},clearStorage:()=>{m==null||m.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>b(),hasHydrated:()=>l,onHydrate:w=>(u.add(w),()=>{u.delete(w)}),onFinishHydration:w=>(f.add(w),()=>{f.delete(w)})},o.skipHydration||b(),x||v},r9=s9,aS=typeof window!="undefined"?window.innerWidth>=1300:!1;function Gy(e){typeof document!="undefined"&&document.body.classList.toggle("dark-canvas",e)}const Ll=(e,t)=>`${e}:${t}`,o9="dr-viewer-ui-preferences",l9={getItem:e=>typeof window!="undefined"?window.localStorage.getItem(e):null,setItem:(e,t)=>{typeof window!="undefined"&&window.localStorage.setItem(e,t)},removeItem:e=>{typeof window!="undefined"&&window.localStorage.removeItem(e)}},Re=Sh()(r9(e=>({view:"model",layerId:null,selectedId:null,selectedEdgeId:null,highlightedEdgeId:null,changesetId:null,canvasDark:!0,chatOpen:aS,wide:aS,mode:"graph",navSeq:0,graphViewport:null,focus:"layer",expandedSections:new Set(["model"]),expandedLayers:new Set,graphLayout:"organic",showClusterBoundaries:!0,showAllRelations:!0,nodeMarginPreset:"default",nodeDisplay:"card",showInterLayerNodes:!0,setView:t=>e({view:t}),selectLayer:t=>e(n=>{const a=new Set(n.expandedLayers);return a.add(Ll(n.view,t)),{layerId:t,selectedId:null,selectedEdgeId:null,highlightedEdgeId:null,focus:"layer",expandedSections:new Set(n.expandedSections).add(n.view),expandedLayers:a}}),selectNode:t=>e({selectedId:t,selectedEdgeId:null,highlightedEdgeId:null,focus:"node"}),selectGraphNode:t=>e(n=>({selectedId:t,selectedEdgeId:null,highlightedEdgeId:null,focus:"node",expandedSections:new Set(n.expandedSections).add(n.view),expandedLayers:n.layerId?new Set(n.expandedLayers).add(Ll(n.view,n.layerId)):n.expandedLayers})),selectEdge:t=>e({selectedEdgeId:t,selectedId:null,highlightedEdgeId:null,focus:"layer"}),setHighlightedEdgeId:t=>e({highlightedEdgeId:t}),clearEdgeSelection:()=>e({selectedEdgeId:null,highlightedEdgeId:null}),navigateToElement:(t,n)=>e(a=>{const o=a.layerId===n?a.expandedLayers:new Set(a.expandedLayers).add(Ll("model",n));return{navSeq:a.navSeq+1,view:"model",layerId:n,selectedId:t,selectedEdgeId:null,highlightedEdgeId:null,focus:"node",expandedSections:new Set(a.expandedSections).add("model"),expandedLayers:o}}),navigateToElementWithEdge:(t,n,a)=>e(s=>{const l=s.layerId===n?s.expandedLayers:new Set(s.expandedLayers).add(Ll("model",n));return{navSeq:s.navSeq+1,view:"model",mode:"graph",layerId:n,selectedId:t,selectedEdgeId:null,highlightedEdgeId:a,focus:"node",expandedSections:new Set(s.expandedSections).add("model"),expandedLayers:l}}),navigateToSpecNode:(t,n)=>e(a=>{const o=a.layerId===n?a.expandedLayers:new Set(a.expandedLayers).add(Ll("spec",n));return{navSeq:a.navSeq+1,view:"spec",layerId:n,selectedId:t,selectedEdgeId:null,highlightedEdgeId:null,focus:"node",expandedSections:new Set(a.expandedSections).add("spec"),expandedLayers:o}}),selectChangeset:t=>e(n=>({view:"changesets",changesetId:t,highlightedEdgeId:null,expandedSections:new Set(n.expandedSections).add("changesets")})),setMode:t=>e({mode:t}),toggleCanvasDark:()=>e(t=>{const n=!t.canvasDark;return Gy(n),{canvasDark:n}}),toggleChat:()=>e(t=>({chatOpen:!t.chatOpen})),toggleSection:t=>e(n=>{const a=new Set(n.expandedSections);a.has(t)?a.delete(t):a.add(t);const s=n.view!==t;return F({view:t,expandedSections:a},s?{selectedId:null,selectedEdgeId:null,highlightedEdgeId:null,focus:"layer"}:{})}),toggleLayer:(t,n)=>e(a=>{const s=Ll(t,n),o=new Set(a.expandedLayers),l=o.has(s);return l?o.delete(s):o.add(s),{view:t,layerId:n,selectedId:l?a.selectedId:null,selectedEdgeId:l?a.selectedEdgeId:null,highlightedEdgeId:l?a.highlightedEdgeId:null,focus:l?a.focus:"layer",expandedSections:new Set(a.expandedSections).add(t),expandedLayers:o}}),setWide:t=>e({wide:t}),setGraphLayout:t=>e({graphLayout:t}),toggleClusterBoundaries:()=>e(t=>({showClusterBoundaries:!t.showClusterBoundaries})),toggleShowAllRelations:()=>e(t=>({showAllRelations:!t.showAllRelations})),setNodeMarginPreset:t=>e({nodeMarginPreset:t}),setNodeDisplay:t=>e({nodeDisplay:t}),toggleShowInterLayerNodes:()=>e(t=>({showInterLayerNodes:!t.showInterLayerNodes})),setGraphViewport:t=>e({graphViewport:t})}),{name:o9,version:1,storage:AN(()=>l9),partialize:e=>({canvasDark:e.canvasDark,chatOpen:e.chatOpen,graphLayout:e.graphLayout,showClusterBoundaries:e.showClusterBoundaries,showAllRelations:e.showAllRelations,nodeMarginPreset:e.nodeMarginPreset,nodeDisplay:e.nodeDisplay,showInterLayerNodes:e.showInterLayerNodes}),onRehydrateStorage:()=>e=>{e&&Gy(e.canvasDark)}}));typeof document!="undefined"&&Gy(Re.getState().canvasDark);const c9=new Set(["force-clustered","organic","orthogonal"]),u9=new Set(["tight","default","wide"]),d9=new Set(["card","pill"]);{const e=Re.getState(),t={};c9.has(e.graphLayout)||(t.graphLayout="organic"),u9.has(e.nodeMarginPreset)||(t.nodeMarginPreset="default"),d9.has(e.nodeDisplay)||(t.nodeDisplay="card"),typeof e.showInterLayerNodes!="boolean"&&(t.showInterLayerNodes=!0),Object.keys(t).length>0&&Re.setState(t)}typeof window!="undefined"&&window.addEventListener("resize",()=>{const e=window.innerWidth>=1300;e!==Re.getState().wide&&Re.getState().setWide(e)});const _u=Sh(e=>({state:"disconnected",reconnectAttempt:0,reconnectDelay:0,lastError:null,lastConnectedAt:null,lastDisconnectedAt:null,setConnecting:()=>e({state:"connecting",lastError:null}),setConnected:()=>e({state:"connected",reconnectAttempt:0,reconnectDelay:0,lastError:null,lastConnectedAt:new Date}),setDisconnected:()=>e({state:"disconnected",lastDisconnectedAt:new Date}),setReconnecting:(t,n)=>e({state:"reconnecting",reconnectAttempt:t,reconnectDelay:n}),setError:t=>e({state:"error",lastError:t}),reset:()=>e({state:"disconnected",reconnectAttempt:0,reconnectDelay:0,lastError:null,lastConnectedAt:null,lastDisconnectedAt:null})})),f9={connected:{label:"connected",color:"#10B981"},connecting:{label:"connecting",color:"#FBBF24"},reconnecting:{label:"reconnecting",color:"#FBBF24"},disconnected:{label:"disconnected",color:"#64748B"},error:{label:"disconnected",color:"#F43F5E"}},h9=[{value:"light",label:"light"},{value:"dark",label:"dark"}];function p9(){const e=Re(l=>l.canvasDark),t=Re(l=>l.toggleCanvasDark),n=Re(l=>l.chatOpen),a=Re(l=>l.toggleChat),s=_u(l=>l.state),o=f9[s];return h.jsxs("div",{style:{height:54,flex:"none",display:"flex",alignItems:"center",gap:18,padding:"0 16px",background:"rgb(var(--shell-bg-2))",borderBottom:"1px solid rgb(var(--shell-border))"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[h.jsx("div",{style:{width:24,height:24,borderRadius:6,background:"linear-gradient(135deg,#FBBF24,#B45309)",display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"'JetBrains Mono',monospace",fontWeight:700,fontSize:12,color:"#1B1206"},children:"dr"}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",lineHeight:1.15},children:[h.jsx("span",{style:{fontSize:13,fontWeight:600,color:"rgb(var(--shell-fg-1))"},children:"Documentation Robotics"}),h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.08em",color:"rgb(var(--shell-fg-3))"},children:"architecture viewer"})]})]}),h.jsx("div",{style:{flex:1}}),h.jsx(Wi,{value:e?"dark":"light",onChange:l=>{l==="dark"!==e&&t()},options:h9,"aria-label":"Canvas theme"}),h.jsxs("button",{type:"button",onClick:a,"aria-pressed":n,style:{display:"flex",alignItems:"center",gap:7,padding:"6px 12px",borderRadius:7,fontSize:12,fontWeight:500,fontFamily:"inherit",cursor:"pointer",transition:"all .12s",background:n?"rgb(var(--shell-surface))":"transparent",color:n?"rgb(var(--shell-fg-1))":"rgb(var(--shell-fg-2))",border:n?"1px solid rgb(var(--shell-border-2))":"1px solid rgb(var(--shell-border))"},children:[h.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#FBBF24",display:"inline-block"}}),"DrBot"]}),h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:7,paddingLeft:4},"data-testid":"connection-status","data-state":s,children:[h.jsx("span",{style:{position:"relative",width:8,height:8},children:h.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:o.color}})}),h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--shell-fg-2))"},children:o.label})]})]})}const DN=["motivation","business","security","application","technology","api","data-model","data-store","ux","navigation","apm","testing"],LN={motivation:"#8B5CF6",business:"#F59E0B",security:"#F43F5E",application:"#818CF8",technology:"#22D3EE",api:"#10B981","data-model":"#2DD4BF","data-store":"#38BDF8",ux:"#F472B6",navigation:"#A78BFA",apm:"#FB923C",testing:"#4ADE80"},m9={motivation:"Motivation",business:"Business",security:"Security",application:"Application",technology:"Technology",api:"API","data-model":"Data Model","data-store":"Data Store",ux:"UX",navigation:"Navigation",apm:"APM",testing:"Testing"},g9={motivation:"ArchiMate 3.2",business:"ArchiMate 3.2",security:"NIST SP 800-53",application:"ArchiMate 3.2",technology:"ArchiMate 3.2",api:"OpenAPI 3.0","data-model":"JSON Schema Draft 7","data-store":"ISO/IEC 9075 (SQL)",ux:"HTML 5.3",navigation:"SPA Navigation Patterns",apm:"OpenTelemetry",testing:"IEEE 829-2008"},y9="#6B7280";function Bh(e){return e in LN}function yi(e){return e&&Bh(e)?LN[e]:y9}function Ka(e){return e&&Bh(e)?m9[e]:e?e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "):""}function Uh(e){return e&&Bh(e)?g9[e]:""}const Qt={JSONRPC_MESSAGE_PARSE_FAILED:"JSONRPC_001",JSONRPC_ATTACH_LISTENER_FAILED:"JSONRPC_002",JSONRPC_ATTACH_LISTENER_BACKGROUND_FAILED:"JSONRPC_003",JSONRPC_SEND_REQUEST_FAILED:"JSONRPC_004",JSONRPC_SEND_NOTIFICATION_FAILED:"JSONRPC_005",JSONRPC_NOTIFICATION_HANDLER_ERROR:"JSONRPC_006",JSONRPC_HANDLE_NOTIFICATION_ERROR:"JSONRPC_007",JSONRPC_MESSAGE_HANDLER_ERROR:"JSONRPC_008",JSONRPC_WEBSOCKET_LOAD_FAILED:"JSONRPC_009",JSONRPC_UNKNOWN_RESPONSE_ID:"JSONRPC_010",CHAT_GET_STATUS_FAILED:"CHAT_001",CHAT_SEND_FAILED:"CHAT_002",CHAT_CANCEL_FAILED:"CHAT_003",WS_CONNECTION_ERROR:"WS_001",WS_MESSAGE_PARSE_FAILED:"WS_002",WS_ERROR_EVENT:"WS_003",WS_EVENT_HANDLER_ERROR:"WS_004",WS_MAX_RECONNECT_ATTEMPTS:"WS_005",WS_SEND_FAILED:"WS_006",WS_NOT_CONNECTED:"WS_007",SPEC_CONVERSION_FAILED:"DATA_001",DATA_LOADER_SUCCESS_CALLBACK_FAILED:"DATA_002",DATA_LOADER_ERROR_CALLBACK_FAILED:"DATA_003",DATA_NORMALIZATION_FAILED:"DATA_004",DATA_LOADER_LOAD_FAILED:"DATA_005",ANNOTATION_CREATE_FAILED:"ANNOTATION_001",ANNOTATION_DELETE_FAILED:"ANNOTATION_002",ANNOTATION_RESOLVE_FAILED:"ANNOTATION_003",ANNOTATION_REPLY_FAILED:"ANNOTATION_004",ANNOTATION_DELETE_ROLLBACK_FAILED:"ANNOTATION_005",SESSION_STORAGE_PARSE_ERROR:"STORAGE_001",AUTH_COOKIE_DECODE_FAILED:"AUTH_001",AUTH_REQUEST_FAILED:"AUTH_002"};var Te=(e=>(e.VALIDATION_ERROR="validation_error",e.NOT_FOUND="not_found",e.NETWORK_ERROR="network_error",e.TIMEOUT="timeout",e.UNAUTHORIZED="unauthorized",e.RATE_LIMITED="rate_limited",e.RESOURCE_EXHAUSTED="resource_exhausted",e.CONFLICT="conflict",e.EXTERNAL_SERVICE_ERROR="external_service_error",e.ASSERTION_FAILED="assertion_failed",e.INVALID_STATE="invalid_state",e.NOT_IMPLEMENTED="not_implemented",e.TYPE_ERROR="type_error",e.PARSE_ERROR="parse_error",e.LOGIC_ERROR="logic_error",e.NULL_REFERENCE="null_reference",e.INTERNAL_ERROR="internal_error",e))(Te||{}),yo=(e=>(e.LOW="low",e.MEDIUM="medium",e.HIGH="high",e.CRITICAL="critical",e))(yo||{}),ui=(e=>(e.RETRY="retry",e.EXPONENTIAL_BACKOFF="exponential_backoff",e.FALLBACK="fallback",e.USER_ACTION="user_action",e.RELOAD="reload",e.NONE="none",e))(ui||{});const Fn={network:/network|fetch|offline|connection|timeout|ERR_NAME_NOT_RESOLVED|ERR_INTERNET_DISCONNECTED/i,timeout:/timeout|timed out|deadline|took too long/i,networkDetail:{dns:/dns|name.*not.*resolved|ERR_NAME_NOT_RESOLVED/i,timeout:/timeout|timed out|deadline/i},unauthorized:/401|unauthorized|forbidden|not authorized|credentials/i,notFound:/404|not found|does not exist|resource.*not.*found/i,rateLimited:/429|rate limit|too many requests|quota|throttle/i,conflict:/409|conflict|duplicate|already.*exists|constraint/i,serverError:/500|502|503|504|internal.*error|service.*unavailable|gateway/i,validation:/validation|must be|required|bad request|email.*valid|password.*valid|field.*invalid/i,parseError:/parse|syntax|unexpected token|json|xml|invalid.*format/i,typeError:/type|not a function|is not a|undefined|null|cannot read|cannot set/i,resourceExhausted:/out of memory|quota|storage|disk|heap|too large|maximum/i,assertionFailed:/assertion.*failed|assert.*failed/i,invalidState:/invalid state|invariant|unreachable|should not happen/i,externalService:/third.?party|external|webhook|provider|service.*failed/i};function v9(e,t,n,a){const s=Date.now(),o=n==null?void 0:n.stack,l=`${t} ${(n==null?void 0:n.message)||""}`.toLowerCase(),c=x9(l,n),u=b9(c,a),f=_9(c),m=w9(c,l),p=S9(c,m),y=m&&C9(c),v=M9(c,t),x=E9(a,c);return{errorId:e,message:t,originalError:n,category:c,severity:u,isExpectedFailure:f,isTransient:m,recoveryStrategy:p,canRetry:y,maxRetryAttempts:N9(c),retryDelayMs:k9(c),context:a,userFacingMessage:v,devMessage:j9(c,t,n),timestamp:s,stackTrace:o,affectedFeatures:x}}function x9(e,t){return t instanceof TypeError?Te.TYPE_ERROR:t instanceof SyntaxError?Te.PARSE_ERROR:t instanceof RangeError?Te.RESOURCE_EXHAUSTED:Fn.network.test(e)?Fn.networkDetail.timeout.test(e)?Te.TIMEOUT:(Fn.networkDetail.dns.test(e),Te.NETWORK_ERROR):Fn.timeout.test(e)?Te.TIMEOUT:Fn.unauthorized.test(e)?Te.UNAUTHORIZED:Fn.notFound.test(e)?Te.NOT_FOUND:Fn.rateLimited.test(e)?Te.RATE_LIMITED:Fn.conflict.test(e)?Te.CONFLICT:Fn.serverError.test(e)?Te.EXTERNAL_SERVICE_ERROR:Fn.assertionFailed.test(e)?Te.ASSERTION_FAILED:Fn.validation.test(e)&&!Fn.invalidState.test(e)&&!Fn.assertionFailed.test(e)?Te.VALIDATION_ERROR:Fn.invalidState.test(e)?Te.INVALID_STATE:Fn.parseError.test(e)?Te.PARSE_ERROR:Fn.typeError.test(e)?Te.TYPE_ERROR:Fn.resourceExhausted.test(e)?Te.RESOURCE_EXHAUSTED:Fn.externalService.test(e)?Te.EXTERNAL_SERVICE_ERROR:Te.INTERNAL_ERROR}function b9(e,t){return t!=null&&t.isCritical||e===Te.ASSERTION_FAILED||e===Te.INVALID_STATE||e===Te.NULL_REFERENCE||e===Te.TYPE_ERROR?yo.CRITICAL:e===Te.UNAUTHORIZED||e===Te.NETWORK_ERROR||e===Te.TIMEOUT||e===Te.EXTERNAL_SERVICE_ERROR?yo.HIGH:e===Te.VALIDATION_ERROR||e===Te.NOT_FOUND||e===Te.PARSE_ERROR||e===Te.CONFLICT?yo.MEDIUM:e===Te.RATE_LIMITED||e===Te.RESOURCE_EXHAUSTED?yo.LOW:yo.MEDIUM}function _9(e){return[Te.VALIDATION_ERROR,Te.NOT_FOUND,Te.NETWORK_ERROR,Te.TIMEOUT,Te.UNAUTHORIZED,Te.RATE_LIMITED,Te.RESOURCE_EXHAUSTED,Te.CONFLICT,Te.EXTERNAL_SERVICE_ERROR,Te.PARSE_ERROR].includes(e)}function w9(e,t){const n=[Te.NETWORK_ERROR,Te.TIMEOUT,Te.RATE_LIMITED,Te.EXTERNAL_SERVICE_ERROR];return e===Te.RESOURCE_EXHAUSTED?!t.includes("permanent")&&!t.includes("quota"):n.includes(e)}function S9(e,t){return e===Te.ASSERTION_FAILED||e===Te.INVALID_STATE||e===Te.NOT_IMPLEMENTED||e===Te.TYPE_ERROR||e===Te.NULL_REFERENCE||e===Te.LOGIC_ERROR?ui.NONE:e===Te.NETWORK_ERROR&&t||e===Te.TIMEOUT&&t||e===Te.EXTERNAL_SERVICE_ERROR&&t||e===Te.RATE_LIMITED?ui.EXPONENTIAL_BACKOFF:e===Te.UNAUTHORIZED||e===Te.VALIDATION_ERROR||e===Te.NOT_FOUND?ui.USER_ACTION:e===Te.CONFLICT?ui.FALLBACK:(e===Te.PARSE_ERROR,ui.NONE)}function C9(e){return[Te.NETWORK_ERROR,Te.TIMEOUT,Te.RATE_LIMITED,Te.EXTERNAL_SERVICE_ERROR,Te.RESOURCE_EXHAUSTED].includes(e)}function N9(e){switch(e){case Te.NETWORK_ERROR:case Te.TIMEOUT:return 3;case Te.EXTERNAL_SERVICE_ERROR:return 2;case Te.RATE_LIMITED:return 1;case Te.RESOURCE_EXHAUSTED:return 2;default:return}}function k9(e){switch(e){case Te.NETWORK_ERROR:return 500;case Te.TIMEOUT:return 1e3;case Te.EXTERNAL_SERVICE_ERROR:return 1e3;case Te.RATE_LIMITED:return 5e3;case Te.RESOURCE_EXHAUSTED:return 2e3;default:return}}function M9(e,t){switch(e){case Te.NETWORK_ERROR:return"Network connection failed. Please check your internet connection.";case Te.TIMEOUT:return"The operation took too long. Please try again.";case Te.UNAUTHORIZED:return"Your session has expired. Please log in again.";case Te.NOT_FOUND:return"The requested resource was not found.";case Te.RATE_LIMITED:return"Too many requests. Please wait before trying again.";case Te.RESOURCE_EXHAUSTED:return"System resources are temporarily exhausted. Please try again.";case Te.VALIDATION_ERROR:return`Invalid input: ${t}`;case Te.CONFLICT:return"This resource has been modified by someone else. Please refresh and try again.";case Te.EXTERNAL_SERVICE_ERROR:return"External service is temporarily unavailable. Please try again.";case Te.PARSE_ERROR:return"Unable to process the response. Please try again or contact support.";case Te.ASSERTION_FAILED:case Te.INVALID_STATE:case Te.TYPE_ERROR:case Te.NULL_REFERENCE:case Te.INTERNAL_ERROR:return"An unexpected error occurred. Please refresh the page or contact support.";default:return"An error occurred. Please try again."}}function j9(e,t,n){var o;return[`[${((o=Object.entries(Te).find(([,l])=>l===e))==null?void 0:o[0])||"UNKNOWN"}] ${t}`,n!=null&&n.message?`Original: ${n.message}`:""].filter(Boolean).join(" | ")}function E9(e,t){const n=[];return e!=null&&e.feature&&typeof e.feature=="string"&&n.push(e.feature),e!=null&&e.layer&&typeof e.layer=="string"&&n.push(`${e.layer}_layer`),t===Te.NETWORK_ERROR?n.push("data_sync","websocket","api_calls"):t===Te.EXTERNAL_SERVICE_ERROR&&n.push("export","integrations"),[...new Set(n)]}function tn(e,t,n,a){const s=new Date().toISOString(),o=v9(e,t,a,n),l={errorId:e,message:t,timestamp:s,context:n||{},category:o.category,severity:o.severity,isExpectedFailure:o.isExpectedFailure,isTransient:o.isTransient,recoveryStrategy:o.recoveryStrategy,canRetry:o.canRetry,affectedFeatures:o.affectedFeatures};if(typeof window!="undefined")try{const c=window.__SENTRY__;if(c&&c.captureException){const u=a||new Error(t);u.errorId=e,u.context=n,u.category=o.category,u.severity=o.severity,u.isExpectedFailure=o.isExpectedFailure,u.isTransient=o.isTransient,u.recoveryStrategy=o.recoveryStrategy,c.setTag("error_id",e),c.setTag("error_category",o.category),c.setTag("error_severity",o.severity),c.setTag("is_expected",String(o.isExpectedFailure)),c.setTag("is_transient",String(o.isTransient)),c.captureException(u)}}catch(c){console.warn("[ErrorTracker] Failed to capture error in Sentry:",c instanceof Error?c.message:String(c),{errorId:e,message:t})}if(e!==Qt.SESSION_STORAGE_PARSE_ERROR&&typeof sessionStorage!="undefined")try{const c="app:error_log",u=sessionStorage.getItem(c),f=u?JSON.parse(u):[];f.push(l),f.length>50&&f.shift(),sessionStorage.setItem(c,JSON.stringify(f))}catch(c){console.warn("[ErrorTracker] Failed to store error log in session storage:",c instanceof Error?c.message:String(c),{errorId:e,message:t})}return o}function wu(e,t){const n=new Date().toISOString();if(console.warn(e),typeof sessionStorage!="undefined")try{const a="app:warning_log",s=sessionStorage.getItem(a),o=s?JSON.parse(s):[];o.push({message:e,timestamp:n,context:t||{}}),o.length>50&&o.shift(),sessionStorage.setItem(a,JSON.stringify(o))}catch(a){console.warn("[ErrorTracker] Failed to store warning log in session storage:",a instanceof Error?a.message:String(a),{message:e})}}const R9=0,mr=1,T9=2,A9=3;class ON{constructor(t,n=null){Lt(this,"ws",null);Lt(this,"url");Lt(this,"token",null);Lt(this,"reconnectAttempts",0);Lt(this,"maxReconnectAttempts",10);Lt(this,"reconnectDelay",1e3);Lt(this,"maxReconnectDelay",3e4);Lt(this,"reconnectTimer",null);Lt(this,"heartbeatTimer",null);Lt(this,"heartbeatInterval",3e4);Lt(this,"eventHandlers",new Map);Lt(this,"isIntentionallyClosed",!1);Lt(this,"subscribedTopics",[]);Lt(this,"mode","detecting");Lt(this,"connectionTimeout",null);Lt(this,"maxConnectionAttempts",3);Lt(this,"connectionErrors",[]);this.url=t,this.token=n}setToken(t){this.token=t,console.log("[WebSocket] Token updated:",t?"present":"cleared")}getAuthProtocols(){if(this.token)return["token",this.token]}connect(){if(this.ws&&this.ws.readyState===mr){console.log("[WebSocket] Already connected");return}if(this.mode==="rest"){console.log("[WebSocket] Using REST mode, skipping WebSocket connection"),this.emit("rest-mode",{});return}this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.close(),this.ws=null),this.isIntentionallyClosed=!1,this.mode==="detecting"&&console.log(`[WebSocket] Attempting WebSocket connection (attempt ${this.reconnectAttempts+1}/${this.maxConnectionAttempts})...`);try{const t=this.getAuthProtocols();this.ws=new WebSocket(this.url,t),this.ws.onopen=this.handleOpen.bind(this),this.ws.onmessage=this.handleMessage.bind(this),this.ws.onerror=this.handleError.bind(this),this.ws.onclose=this.handleClose.bind(this),this.mode==="detecting"&&(this.connectionTimeout=setTimeout(()=>{this.ws&&this.ws.readyState!==mr&&(console.log("[WebSocket] Connection timeout during detection phase"),this.ws.close())},3e3))}catch(t){this.mode==="detecting"?(console.debug("[WebSocket] Connection error during detection:",t),this.handleConnectionFailure(),this.connectionErrors.push(t instanceof Error?t:new Error(String(t)))):(tn(Qt.WS_CONNECTION_ERROR,"WebSocket connection error",{error:t instanceof Error?t.message:String(t)}),this.scheduleReconnect())}}getConnectionErrors(){return[...this.connectionErrors]}isTestEnvironment(){return Yy()}triggerCloseForTesting(){this.isTestEnvironment()&&(this.ws&&this.ws.readyState===mr?(console.log("[WebSocket] TEST: Forcing close event"),this.ws.close(1e3,"Test-triggered close")):console.warn("[WebSocket] TEST: Cannot close, not connected"))}simulateMaxReconnectAttemptsForTesting(){this.isTestEnvironment()&&(console.log("[WebSocket] TEST: Simulating max reconnect attempts"),this.reconnectAttempts=this.maxReconnectAttempts,tn(Qt.WS_MAX_RECONNECT_ATTEMPTS,"Max reconnection attempts reached (TEST SIMULATION)",{attempts:this.reconnectAttempts}),this.emit("max-reconnect-attempts",{attempts:this.reconnectAttempts}))}disconnect(){this.isIntentionallyClosed=!0,this.stopHeartbeat(),this.cancelReconnect(),this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=null),this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.close(),this.ws=null),console.log("[WebSocket] Disconnected"),this.emit("disconnect",{})}subscribe(t){this.subscribedTopics=t,this.ws&&this.ws.readyState===mr&&this.send({type:"subscribe",topics:t})}send(t){var n;if(this.ws&&this.ws.readyState===mr)try{return this.ws.send(JSON.stringify(t)),!0}catch(a){return tn(Qt.WS_SEND_FAILED,"Failed to send WebSocket message",{error:a instanceof Error?a.message:String(a),message:t}),!1}else return tn(Qt.WS_NOT_CONNECTED,"Cannot send message, WebSocket not connected",{connectionState:(n=this.ws)==null?void 0:n.readyState,message:t}),!1}on(t,n){this.eventHandlers.has(t)||this.eventHandlers.set(t,new Set),this.eventHandlers.get(t).add(n)}off(t,n){const a=this.eventHandlers.get(t);a&&a.delete(n)}get isConnected(){return this.ws!==null&&this.ws.readyState===mr}get connectionState(){if(!this.ws)return this.reconnectTimer?"reconnecting":"disconnected";switch(this.ws.readyState){case R9:return"connecting";case mr:return"connected";case T9:case A9:return this.reconnectTimer?"reconnecting":"disconnected";default:return"disconnected"}}get transportMode(){return this.mode}handleConnectionFailure(){this.reconnectAttempts++,this.reconnectAttempts>=this.maxConnectionAttempts?(console.log("[WebSocket] Server does not support WebSocket, using REST mode"),this.connectionErrors.length>0&&(console.warn("[WebSocket] Connection attempts failed with the following errors:"),this.connectionErrors.forEach((t,n)=>{console.warn(` [${n+1}] ${t.message}`)})),this.mode="rest",this.reconnectAttempts=0,this.emit("rest-mode",{}),this.emit("connect",{})):setTimeout(()=>this.connect(),500)}handleOpen(){this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=null),console.log("[WebSocket] Connected successfully"),this.mode="websocket",this.reconnectAttempts=0,this.reconnectDelay=1e3,this.startHeartbeat(),this.emit("connect",{}),this.subscribedTopics.length>0&&this.subscribe(this.subscribedTopics)}handleMessage(t){var n;try{const a=JSON.parse(t.data),s=(n=a.type)!=null?n:"message";console.log("[WebSocket] Received:",s),this.emit(s,a),s!=="message"&&this.emit("message",a)}catch(a){tn(Qt.WS_MESSAGE_PARSE_FAILED,"Failed to parse WebSocket message",{error:a instanceof Error?a.message:String(a),data:t.data})}}handleError(t){const n=Yy();if(this.mode==="detecting"){const a=t instanceof ErrorEvent?t.message:String(t);this.connectionErrors.push(new Error(`[Attempt ${this.reconnectAttempts+1}/${this.maxConnectionAttempts}] ${a}`)),console.debug("[WebSocket] Connection error during detection (attempt %d/%d): %s",this.reconnectAttempts+1,this.maxConnectionAttempts,a)}else n?console.debug("[WebSocket] Error in test environment:",t):tn(Qt.WS_ERROR_EVENT,"WebSocket error event",{error:t instanceof ErrorEvent?t.message:String(t)});this.emit("error",{kind:"event",error:t})}handleClose(t){if(this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=null),this.mode==="detecting"){this.handleConnectionFailure();return}console.log(`[WebSocket] Closed (code: ${t.code}, reason: ${t.reason})`),this.stopHeartbeat(),this.emit("close",{code:t.code,reason:t.reason}),!this.isIntentionallyClosed&&this.mode!=="rest"&&this.scheduleReconnect()}scheduleReconnect(){if(this.isIntentionallyClosed)return;if(this.reconnectAttempts>=this.maxReconnectAttempts){tn(Qt.WS_MAX_RECONNECT_ATTEMPTS,"Max reconnection attempts reached",{attempts:this.reconnectAttempts}),this.emit("max-reconnect-attempts",{attempts:this.reconnectAttempts});return}this.reconnectAttempts++;const t=Math.min(this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1),this.maxReconnectDelay);console.log(`[WebSocket] Reconnecting in ${t}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})`),this.emit("reconnecting",{attempt:this.reconnectAttempts,delay:t}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}cancelReconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}startHeartbeat(){this.stopHeartbeat(),this.heartbeatTimer=setInterval(()=>{this.ws&&this.ws.readyState===mr&&this.send({type:"ping"})},this.heartbeatInterval)}stopHeartbeat(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}emit(t,n){const a=this.eventHandlers.get(t);a&&a.forEach(s=>{try{s(n)}catch(o){tn(Qt.WS_EVENT_HANDLER_ERROR,`Error in WebSocket event handler for '${t}'`,{error:o instanceof Error?o.message:String(o),event:t})}})}}function Yy(){return typeof window=="undefined"?!1:!!(window.__PLAYWRIGHT__||window.__STORYBOOK_MOCK_WEBSOCKET__||window.__karma__||window.jasmine||window.jest)}let _n;if(typeof window!="undefined"){const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;_n=new ON(t,null)}else{const e=new Map;_n={setToken:()=>{},connect:()=>{setTimeout(()=>{const t=e.get("error");t&&t.forEach(a=>a({code:"SSR_ENVIRONMENT",message:"WebSocket not available in SSR/Node.js environment"}));const n=e.get("rest-mode");n&&n.forEach(a=>a({}))},0)},disconnect:()=>{},subscribe:()=>{},send:()=>(tn(Qt.WS_SEND_FAILED,"Cannot send message in SSR/Node.js environment - use REST API instead",{environment:"SSR/Node.js"}),!1),on:(t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},off:(t,n)=>{const a=e.get(t);a&&a.delete(n)},get isConnected(){return!1},get connectionState(){return"disconnected"},get transportMode(){return"rest"}}}typeof window!="undefined"&&Yy()&&(window.__WEBSOCKET_CLIENT__=_n);const D9=Object.freeze(Object.defineProperty({__proto__:null,WebSocketClient:ON,get websocketClient(){return _n}},Symbol.toStringTag,{value:"Module"})),L9={nodes:[],links:[],countsByLayer:{},nodesByLayer:{},relCount:0};function Ls(){const e=pR(),t=e.data,n=T.useMemo(()=>{var o,l,c,u,f;if(!(t!=null&&t.nodes))return L9;const a={},s={};for(const m of t.nodes){const p=m.layer_id;p&&(a[p]=((o=a[p])!=null?o:0)+1,((l=s[p])!=null?l:s[p]=[]).push(m))}return{nodes:t.nodes,links:(c=t.links)!=null?c:[],countsByLayer:a,nodesByLayer:s,relCount:(f=(u=t.links)==null?void 0:u.length)!=null?f:0}},[t]);return Z(F({},e),{derived:n})}function O9(){const e=ts();T.useEffect(()=>{const t=()=>{e.invalidateQueries({queryKey:["getapimodel"]}),e.invalidateQueries({queryKey:["getapilayerslayerName"]}),e.invalidateQueries({queryKey:["getapichangesets"]}),e.invalidateQueries({queryKey:["getapichangesetschangesetId"]})};return _n.on(iS,t),()=>_n.off(iS,t)},[e])}const iS="model.updated",I9={version:"",byLayer:{}};function Os(){const e=mR(),t=e.data,n=T.useMemo(()=>{var s,o,l,c;if(!(t!=null&&t.schemas))return I9;const a={};for(const u of Object.values(t.schemas)){const f=u,m=f.layer;if(!(m!=null&&m.id))continue;const p=(s=f.nodeSchemas)!=null?s:{},y=Object.keys(p);a[m.id]={typeCount:y.length,typeIds:y,typeTitles:y.map(v=>{var x,b;return(b=(x=p[v])==null?void 0:x.title)!=null?b:v}),standard:(l=(o=m.inspired_by)==null?void 0:o.standard)!=null?l:Uh(m.id)}}return{version:(c=t.version)!=null?c:"",byLayer:a}},[t]);return Z(F({},e),{derived:n,raw:t})}const z9={add:{op:"add",label:"ADD",color:"#10B981",colorLight:"#047857",background:"rgba(16,185,129,0.12)"},update:{op:"update",label:"MOD",color:"#22D3EE",colorLight:"#0E7490",background:"rgba(34,211,238,0.12)"},delete:{op:"delete",label:"DEL",color:"#FB7185",colorLight:"#BE123C",background:"rgba(244,63,94,0.12)"}};function IN(e){const t=(e!=null?e:"").toLowerCase();return t.includes("delete")||t==="del"||t==="remove"?"delete":t.includes("add")||t==="create"?"add":"update"}function Qg(e){var n;if(!e)return"element";const t=(n=e.type)!=null?n:e.predicate;return typeof t=="string"&&t.length>0?t:"element"}function wh(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(wh).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${wh(t[n])}`).join(",")}}`}function B9(e,t){if(!e||!t)return[];const n=new Set([...Object.keys(e),...Object.keys(t)]),a=[];for(const s of n)wh(e[s])!==wh(t[s])&&a.push(s);return a}function U9(e){var o,l,c;const t=IN(e.type);if(t==="add")return((o=e.type)!=null?o:"").includes("relationship")?"Added relationship":`Added ${Qg(e.after)}`;if(t==="delete")return((l=e.type)!=null?l:"").includes("relationship")?"Removed relationship":`Removed ${Qg(e.before)}`;const n=B9(e.before,e.after);if(n.length===0)return`Updated ${Qg((c=e.after)!=null?c:e.before)}`;const a=n.slice(0,3).join(", "),s=n.length>3?` +${n.length-3} more`:"";return`Changed ${a}${s}`}function F9(e,t){var s,o,l;const n=IN(e.type),a=(s=e.elementId)!=null?s:"(unknown)";return{key:`${a}::${(o=e.sequenceNumber)!=null?o:t}`,op:n,meta:z9[n],elementId:a,layerName:(l=e.layerName)!=null?l:"",detail:U9(e),hasDiff:!!e.before||!!e.after,raw:e}}function $9(e){return e?e.map(F9):[]}function P9(e){const t=e.before?JSON.stringify(e.before,null,2):"",n=e.after?JSON.stringify(e.after,null,2):"",a=t?t.split(`
|
|
80
|
+
`):[],s=n?n.split(`
|
|
81
|
+
`):[],o=new Set(a),l=new Set(s),c=[];for(const u of a)l.has(u)||c.push({type:"removed",content:u});for(const u of s)o.has(u)||c.push({type:"added",content:u});return c}function H9(e,t){if(!t)return e;const{additions:n,modifications:a,deletions:s}=t;return`${n} additions · ${a} modifications · ${s} deletions in this changeset.`}const q9={list:[]};function td(){const e=gR(),t=e.data,n=T.useMemo(()=>{const a=t==null?void 0:t.changesets;if(!a)return q9;const s=Object.entries(a).map(([o,l])=>{var c,u,f,m;return{id:o,name:(c=l.name)!=null?c:o,status:(u=l.status)!=null?u:"unknown",created:(f=l.created)!=null?f:"",changesCount:(m=l.changes_count)!=null?m:0}});return s.sort((o,l)=>l.created.localeCompare(o.created)),{list:s}},[t]);return Z(F({},e),{derived:n})}const V9={additions:0,modifications:0,deletions:0};function zN(e){const t=yR(e!=null?e:"",{enabled:!!e}),n=t.data,a=T.useMemo(()=>{var s,o,l,c,u,f,m,p,y,v,x,b,w,C,N,k;return n?{id:(o=(s=n.id)!=null?s:e)!=null?o:"",name:(c=(l=n.name)!=null?l:n.id)!=null?c:"",status:(u=n.status)!=null?u:"unknown",created:(f=n.created)!=null?f:"",modified:(m=n.modified)!=null?m:"",baseSnapshot:(p=n.baseSnapshot)!=null?p:"",stats:{additions:(v=(y=n.stats)==null?void 0:y.additions)!=null?v:0,modifications:(b=(x=n.stats)==null?void 0:x.modifications)!=null?b:0,deletions:(C=(w=n.stats)==null?void 0:w.deletions)!=null?C:0},rows:$9(n.changes),changesCount:(k=(N=n.changes)==null?void 0:N.length)!=null?k:0}:null},[n,e]);return Z(F({},t),{detail:a,emptyStats:V9})}function G9(e){var t;return e instanceof Qn?(t=e.serverMessage)!=null?t:e.body.trim()||e.message:e instanceof Error?e.message:String(e)}function Y9(e){const t=ts(),n=T.useRef(e);T.useEffect(()=>{n.current&&!e&&(t.invalidateQueries({queryKey:["getapichangesets"]}),t.invalidateQueries({queryKey:["getapichangesetschangesetId"]})),n.current=e},[e,t])}const X9=[{id:"model",label:"Model",icon:"graph"},{id:"spec",label:"Schema",icon:"schema"},{id:"changesets",label:"Changesets",icon:"clock"}];function BN({open:e}){return h.jsx("span",{style:{position:"absolute",right:12,top:0,bottom:0,display:"flex",alignItems:"center",pointerEvents:"none"},children:h.jsx("span",{className:`drv-chev${e?" drv-chev--open":""}`})})}function K9({section:e}){const t=Re(c=>c.view),n=Re(c=>c.expandedSections),a=Re(c=>c.toggleSection),{derived:s}=td(),o=n.has(e.id),l=e.id==="changesets"?s.list.length:12;return h.jsxs("div",{style:{position:"relative"},children:[h.jsx(Ou,{icon:e.icon,label:e.label,count:l,active:t===e.id,depth:0,onClick:()=>a(e.id)}),h.jsx(BN,{open:o})]})}function Q9({sectionId:e,slug:t}){var N,k,M;const n=Re(D=>D.view),a=Re(D=>D.layerId),s=Re(D=>D.selectedId),o=Re(D=>D.expandedLayers),l=Re(D=>D.toggleLayer),c=Re(D=>D.navigateToElement),u=Re(D=>D.navigateToSpecNode),{derived:f}=Ls(),{derived:m}=Os(),p=`${e}:${t}`,y=o.has(p),v=n===e&&a===t,x=m.byLayer[t],b=(N=f.nodesByLayer[t])!=null?N:[],w=e==="spec"?(k=x==null?void 0:x.typeCount)!=null?k:0:b.length,C=e==="spec"?((M=x==null?void 0:x.typeIds)!=null?M:[]).map((D,j)=>{var A;return{id:`${t}.${D}`,label:(A=x==null?void 0:x.typeTitles[j])!=null?A:D}}):b.map(D=>({id:D.id,label:D.name}));return h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{position:"relative"},children:[h.jsx(Ou,{label:Ka(t),count:w,active:v,depth:1,onClick:()=>l(e,t)}),h.jsx(BN,{open:y})]}),y&&C.map(D=>{const j=n===e&&a===t&&s===D.id;return h.jsx("div",{style:{position:"relative"},children:h.jsx(Ou,{label:D.label,active:j,depth:1,className:"drv-nav-l2",onClick:()=>e==="model"?c(D.id,t):u(D.id,t),title:D.label})},D.id)})]})}function Z9(){const e=Re(s=>s.view),t=Re(s=>s.changesetId),n=Re(s=>s.selectChangeset),{derived:a}=td();return a.list.length===0?h.jsx("div",{style:{padding:"8px 10px 8px 34px",fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--shell-fg-4))"},children:"no changesets"}):h.jsx(h.Fragment,{children:a.list.map(s=>{const o=e==="changesets"&&t===s.id;return h.jsx("div",{style:{position:"relative"},children:h.jsx(Ou,{label:s.name,count:s.changesCount,active:o,depth:1,onClick:()=>n(s.id),title:s.name})},s.id)})})}function J9(){const e=Re(t=>t.expandedSections);return h.jsx("div",{className:"drv-scroll drv-noscroll",style:{flex:1,overflowY:"auto",padding:"8px"},"data-testid":"nav-tree",children:X9.map(t=>{const n=e.has(t.id);return h.jsxs("div",{children:[h.jsx(K9,{section:t}),n&&t.id==="changesets"&&h.jsx(Z9,{}),n&&t.id!=="changesets"&&DN.map(a=>h.jsx(Q9,{sectionId:t.id,slug:a},a))]},t.id)})})}function W9(){const{derived:e}=Ls(),{derived:t}=Os(),n=e.relCount,a=t.version||"—";return h.jsxs("div",{style:{width:244,flex:"none",background:"rgb(var(--shell-bg-2))",borderRight:"1px solid rgb(var(--shell-border))",display:"flex",flexDirection:"column",minHeight:0},"data-testid":"left-rail",children:[h.jsxs("div",{style:{height:40,flex:"none",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 14px",borderBottom:"1px solid rgb(var(--shell-border))"},children:[h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--shell-fg-3))"},children:"Navigation"}),h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,color:"rgb(var(--shell-fg-4))"},"data-testid":"rail-count"})]}),h.jsx(J9,{}),h.jsxs("div",{style:{flex:"none",padding:"10px 14px",borderTop:"1px solid rgb(var(--shell-border))",display:"flex",flexDirection:"column",gap:3},"data-testid":"rail-footer",children:[h.jsxs("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.08em",color:"rgb(var(--shell-fg-3))"},children:["SPEC ",a]}),h.jsxs("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,color:"rgb(var(--shell-fg-4))"},children:["12 layers · ",n," rels"]})]})]})}const Xy={fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--shell-fg-3))"},sS=Z(F({},Xy),{color:"rgb(var(--shell-fg-4))"});function eB(){var c;const e=Re(u=>u.layerId),{derived:t}=Ls(),{derived:n}=Os(),a=e&&(c=t.countsByLayer[e])!=null?c:0,s=e?Ka(e).toLowerCase():"",o=e?`${a} ${s} elements`:`${t.nodes.length} elements`,l=n.version||"—";return h.jsx(kv,{style:{height:28},"data-testid":"status-bar",left:h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14},children:[h.jsx("span",{style:Xy,"data-testid":"status-elements",children:o}),h.jsx("span",{style:sS,children:"·"}),h.jsxs("span",{style:Xy,children:[t.relCount," refs indexed · 0 unresolved"]})]}),right:h.jsxs("span",{style:sS,children:["cli ",l," · refs ok"]})})}function Ma(e,t){var a;return(a=e==null?void 0:e.schemas)==null?void 0:a[`${t}.json`]}function Ji(e,t){const n=`${e}.`;if(t.startsWith(n))return t.slice(n.length);const a=t.lastIndexOf(".");return a>=0?t.slice(a+1):t}function Or(e,t,n){var o,l,c;const a=Ji(t,n),s=Ma(e,t);return(c=(l=(o=s==null?void 0:s.nodeSchemas)==null?void 0:o[a])==null?void 0:l.title)!=null?c:a}function tB(e,t){var o;const n=Ma(e,t),a=(o=n==null?void 0:n.nodeSchemas)!=null?o:{};return Object.entries(a).map(([l,c])=>{var u;return{id:`${t}.${l}`,label:(u=c.title)!=null?u:l,kind:"spec node",domainColor:t}})}const nB={"many-to-many":"N:N","one-to-many":"1:N","many-to-one":"N:1","one-to-one":"1:1"};function Ky(e){var t;return e&&(t=nB[e])!=null?t:""}function aB(e,t){var o;const n=Ma(e,t),a=(o=n==null?void 0:n.relationshipSchemas)!=null?o:{},s=[];for(const l of Object.values(a))l.source_layer!==t||l.destination_layer!==t||l.source_spec_node_id!==l.destination_spec_node_id&&s.push({id:l.id,sourceId:l.source_spec_node_id,targetId:l.destination_spec_node_id,label:l.predicate});return s}function UN(e,t){var o;const n=Ma(e,t),a=(o=n==null?void 0:n.relationshipSchemas)!=null?o:{};let s=0;for(const l of Object.values(a))l.source_layer===t&&l.destination_layer===t&&(s+=1);return s}function FN(e){var n,a,s;const t=[];for(const o of Object.values((n=e==null?void 0:e.schemas)!=null?n:{})){const l=o;(a=l==null?void 0:l.layer)!=null&&a.id&&t.push(...Object.values((s=l.relationshipSchemas)!=null?s:{}))}return t}function iB(e,t,n){var c;const a=Ma(e,t),s=(c=a==null?void 0:a.relationshipSchemas)!=null?c:{},o=[];let l=0;for(const u of Object.values(s)){const f=Ky(u.cardinality),m=f?`${u.predicate} ${f}`:u.predicate;u.source_spec_node_id===n?o.push({id:`out-${l++}-${u.id}`,target:u.destination_spec_node_id,targetTitle:Or(e,u.destination_layer,u.destination_spec_node_id),targetDomain:u.destination_layer,predicate:m,direction:"out"}):u.destination_spec_node_id===n&&o.push({id:`in-${l++}-${u.id}`,target:u.source_spec_node_id,targetTitle:Or(e,u.source_layer,u.source_spec_node_id),targetDomain:u.source_layer,predicate:m,direction:"in"})}return o}function u1(e){var s,o,l;const t=(s=e==null?void 0:e.properties)==null?void 0:s.attributes,n=new Set((o=t==null?void 0:t.required)!=null?o:[]),a=(l=t==null?void 0:t.properties)!=null?l:{};return Object.entries(a).map(([c,u])=>{var f;return{name:c,type:(f=u==null?void 0:u.type)!=null?f:"object",required:n.has(c)}})}function sB(e,t,n){var c,u;const a=Ma(e,t),s=Ji(t,n),o=(c=a==null?void 0:a.nodeSchemas)==null?void 0:c[s];if(!o)return null;const l={};for(const f of u1(o))l[f.name]=f.required?"required":"—";return{id:n,title:(u=o.title)!=null?u:s,kind:"SPEC NODE",domain:t,description:o.description,metadata:l}}function rB(e,t,n){var c;const a=Ma(e,t),s=(c=a==null?void 0:a.relationshipSchemas)!=null?c:{},o=[],l=[];for(const u of Object.values(s))u.source_spec_node_id===n&&l.push({predicate:u.predicate,typeId:u.destination_spec_node_id,typeLabel:Or(e,u.destination_layer,u.destination_spec_node_id),domain:u.destination_layer}),u.destination_spec_node_id===n&&o.push({predicate:u.predicate,typeId:u.source_spec_node_id,typeLabel:Or(e,u.source_layer,u.source_spec_node_id),domain:u.source_layer});return{inbound:o,outbound:l}}function oB(e,t,n){var u,f;const a=Ma(e,t),s=Ji(t,n),o=(u=a==null?void 0:a.nodeSchemas)==null?void 0:u[s];if(!o)return null;const{inbound:l,outbound:c}=rB(e,t,n);return{specifier:n,title:(f=o.title)!=null?f:s,description:o.description,inbound:l,outbound:c}}function lB(e,t){var s;const n=Ma(e,t),a=Object.keys((s=n==null?void 0:n.nodeSchemas)!=null?s:{})[0];return a?`${t}.${a}`:void 0}const cB=new Set(["realizes","provides","extends","connects","exposes","implements","composes","aggregates","specializes","assigned-to","associated-with","scheduled-for"]);function $N(e){return!!e&&cB.has(e)}function PN(e){return $N(e.label)}function uB(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\./g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function hc(e){return`${e.layer_id}.${e.type}.${uB(e.name)}`}function Fh(e){const t=new Map,n=new Map;for(const a of e.nodes)n.set(a.id,a),t.set(a.id,a),t.set(hc(a),a);return{byEndpoint:t,byUuid:n}}function Tn(e,t){return e.byEndpoint.get(t)}function dB(e,t){var a;return((a=e.nodesByLayer[t])!=null?a:[]).map(s=>({id:s.id,label:s.name,kind:s.type,domainColor:t}))}function fB(e,t,n){const a=[];for(const s of e.links){const o=Tn(n,s.source),l=Tn(n,s.target);!o||!l||o.layer_id!==t||l.layer_id!==t||a.push({id:s.id,sourceId:o.id,targetId:l.id,label:s.type})}return a}const hB=5;function pB(e,t,n){const a=dB(e,t),s=new Set(a.map(c=>c.id)),o=new Map;for(const c of s)o.set(c,{intraCount:0,crossLinks:[],crossTotal:0});const l=(c,u,f)=>{const m=o.get(c);m&&(m.crossTotal+=1,m.crossLinks.length<hB&&m.crossLinks.push({predicate:u,targetId:f.id,targetName:f.name,targetLayer:f.layer_id}))};for(const c of e.links){const u=Tn(n,c.source),f=Tn(n,c.target);if(!u||!f)continue;const m=s.has(u.id),p=s.has(f.id);if(!(!m&&!p)){if(m&&p){const y=o.get(u.id),v=o.get(f.id);if(!y||!v)continue;y.intraCount+=1,v.intraCount+=1;continue}m?l(u.id,c.type,f):l(f.id,c.type,u)}}return{nodes:a,cardData:o}}function rS(e){return{id:e.id,name:e.name,type:e.type,layer:e.layer_id}}function mB(e,t,n,a){var c;const s=`${t.layer_id}.${t.type}`,o=`${n.layer_id}.${n.type}`,l=u=>{var m,p;const f=(p=(m=Ma(e,u))==null?void 0:m.relationshipSchemas)!=null?p:{};return Object.values(f).find(y=>y.source_spec_node_id===s&&y.destination_spec_node_id===o&&y.predicate===a)};return(c=l(t.layer_id))!=null?c:l(n.layer_id)}function d1(e,t,n,a){const s=e.links.find(c=>c.id===t);if(!s)return;const o=Tn(n,s.source),l=Tn(n,s.target);if(!(!o||!l))return{predicate:s.type,sourceNode:rS(o),targetNode:rS(l),specRelationship:mB(a,o,l,s.type)}}function gB(e,t,n){var f,m;const a=new Set((m=(f=e.nodesByLayer[t])==null?void 0:f.map(p=>p.id))!=null?m:[]),s=new Map,o=[];for(const p of e.links){const y=Tn(n,p.source),v=Tn(n,p.target);if(!y||!v)continue;const x=a.has(y.id),b=a.has(v.id);x&&!b?(s.set(v.id,v),o.push({id:p.id,sourceId:y.id,targetId:v.id,label:p.type,opacity:.4,strokeDash:[6,4]})):!x&&b&&(s.set(y.id,y),o.push({id:p.id,sourceId:y.id,targetId:v.id,label:p.type,opacity:.4,strokeDash:[6,4]}))}const l=[],c=new Set,u=new Map;for(const p of s.values()){const y=u.get(p.layer_id);y?y.push(p):u.set(p.layer_id,[p])}for(const p of Array.from(u.keys()).sort())for(const y of u.get(p))c.add(y.id),l.push({id:y.id,label:y.name,kind:y.type,domainColor:y.layer_id});return{foreignNodes:l,crossEdges:o,foreignNodeIds:c}}function yB(e,t,n,a){if(e.foreignNodes.length===0)return e;const s=new Set;for(const u of t.links){const f=Tn(a,u.source),m=Tn(a,u.target);if(!f||!m)continue;const p=f.layer_id===n,y=m.layer_id===n;if((p&&!y||!p&&y)&&$N(u.type)){const v=p?m.id:f.id;s.add(v)}}const o=e.foreignNodes.filter(u=>s.has(u.id)),l=new Set(o.map(u=>u.id)),c=e.crossEdges.filter(u=>l.has(u.sourceId)||l.has(u.targetId));return{foreignNodes:o,crossEdges:c,foreignNodeIds:l}}function Qy(e,t,n){const a=n.byUuid.get(t);if(!a)return[];const s=[];let o=0;for(const l of e.links){const c=Tn(n,l.source),u=Tn(n,l.target);!c||!u||(c.id===t?s.push({id:`out-${o++}-${l.id}`,target:u.id,targetTitle:u.name,targetDomain:u.layer_id,predicate:l.type,direction:"out",sourceTypeLabel:a.type,destinationTypeLabel:u.type}):u.id===t&&s.push({id:`in-${o++}-${l.id}`,target:c.id,targetTitle:c.name,targetDomain:c.layer_id,predicate:l.type,direction:"in",sourceTypeLabel:c.type,destinationTypeLabel:a.type}))}return s}function HN(e){var t;return(t=e==null?void 0:e.provenance)!=null?t:"authored"}function qN(e){var t,n;return(n=(t=e==null?void 0:e.locations)==null?void 0:t.find(a=>a.symbol||a.file))!=null?n:{}}function vB(e){var n;const t=qN(e);return(n=t.symbol)!=null?n:t.file}function Zy(e,t){const n=e.source_reference,a={layer:t,type:e.type,provenance:HN(n)},s=vB(n);return s&&(a.source=s),{id:e.id,title:e.name,kind:e.type,domain:e.layer_id,description:e.description,metadata:a}}function xB(e,t,n){const a=n.byUuid.get(e);if(!a)return{nodes:[],edges:[],empty:!0};const s=new Map,o=new Map;for(const u of t.links){const f=Tn(n,u.source),m=Tn(n,u.target);if(!f||!m)continue;let p=!1,y;f.id===e?(p=!0,y=m):m.id===e&&(p=!1,y=f),y&&y.id!==e&&(s.set(y.id,y),o.has(y.id)||o.set(y.id,[]),o.get(y.id).push({id:u.id,predicate:u.type,direction:p?"out":"in",targetId:y.id}))}const l=[{id:a.id,name:a.name,kind:a.type,layer:a.layer_id,isCenter:!0}];for(const u of s.values())l.push({id:u.id,name:u.name,kind:u.type,layer:u.layer_id,isCenter:!1});const c=[];for(const u of o.values())for(const f of u)c.push(f);return{nodes:l,edges:c,empty:s.size===0}}function bB(e,t,n){var p,y;const a=Ma(n,e),s=Ji(e,t),o=(p=a==null?void 0:a.nodeSchemas)==null?void 0:p[s];if(!o)return{nodes:[],edges:[],empty:!0};const l=new Map,c=new Map,u=FN(n);for(const v of u)if(v.source_spec_node_id===t){const x=v.destination_spec_node_id;if(x===t)continue;const b=v.destination_layer,w=Or(n,b,x);l.has(x)||l.set(x,{layerId:b,title:w}),c.has(x)||c.set(x,[]),c.get(x).push({id:v.id,predicate:v.predicate,direction:"out",targetId:x})}for(const v of u)if(v.destination_spec_node_id===t){const x=v.source_spec_node_id;if(x===t)continue;const b=v.source_layer,w=Or(n,b,x);l.has(x)||l.set(x,{layerId:b,title:w}),c.has(x)||c.set(x,[]),c.get(x).push({id:v.id,predicate:v.predicate,direction:"in",targetId:x})}const f=[{id:t,name:(y=o.title)!=null?y:s,kind:"spec node",layer:e,isCenter:!0}];for(const[v,x]of l)f.push({id:v,name:x.title,kind:"spec node",layer:x.layerId,isCenter:!1});const m=[];for(const v of c.values())for(const x of v)m.push(x);return{nodes:f,edges:m,empty:l.size===0}}const f1=yi("application"),VN=yi("navigation"),GN="rgb(var(--status-emerald))",YN="rgb(var(--accent-primary))",XN="rgb(var(--accent-primary-deep))",Jy="—";function Dr(e){return e==null||e===""?Jy:String(e)}function It(e,t,n){return{text:Dr(e),kind:t,color:n}}function Lo(e,t,n,a,s){return Z(F({},It(e,t,s)),{tooltip:{kind:"nodeType",layerId:n,typeId:a}})}function Pu(e,t,n,a,s,o,l){return Z(F({},It(e,t,o)),{tooltip:{kind:"predicate",predicate:n,sourceTypeLabel:a,destinationTypeLabel:s,edge:l}})}function $t(e,t,n){return{key:e,value:Dr(t),prose:n}}function h1(e,t,n){return[{label:e==="spec"?"schema":"model",target:{kind:"section",view:e}},{label:t,target:{kind:"layer",view:e,layerId:t},current:n}]}const _B="minmax(0,1.1fr) minmax(0,1.5fr) 78px",wB="minmax(0,1.3fr) minmax(0,1fr) minmax(0,0.9fr) 96px",SB="minmax(0,1fr) minmax(0,0.9fr) minmax(0,1.2fr)";function CB(e,t,n,a,s){var N,k,M,D,j,A;if(!Bh(t))return null;const o=Ma(s,t),l=o==null?void 0:o.layer,c=l==null?void 0:l.number,u=(k=(N=l==null?void 0:l.inspired_by)==null?void 0:N.standard)!=null?k:Uh(t),f=(M=o==null?void 0:o.nodeSchemas)!=null?M:{},m=Object.keys(f).length,p=UN(s,t),y=(D=n.nodesByLayer[t])!=null?D:[],v=yi(t),x=Ka(t),b=Object.entries(f).map(([O,R])=>{var I;const E=y.filter(L=>L.type===O).length;return{target:{kind:"specNode",specNodeId:`${t}.${O}`,layerId:t},cells:[Lo((I=R.title)!=null?I:O,"name",t,O),It(`${t}.${O}`,"dim"),It(E,"num")]}}),w=y.map(O=>{let R=0,E=0;for(const I of n.links){const L=Tn(a,I.source);if(!L||L.id!==O.id)continue;const H=Tn(a,I.target);H&&(H.layer_id===t?R+=1:E+=1)}return{target:{kind:"element",elementId:O.id,layerId:t},cells:[It(O.name,"name"),Lo(O.type,"mono",t,O.type),It(p1(O),"dim"),It(`${R} · ${E}`,"num")]}}),C=[];for(const O of y)for(const R of n.links){const E=Tn(a,R.source);if(!E||E.id!==O.id)continue;const I=Tn(a,R.target);!I||I.layer_id===t||C.push({target:{kind:"element",elementId:I.id,layerId:I.layer_id},cells:[It(O.name,"name"),Pu(R.type,"dim",R.type,O.type,I.type),Lo(`${I.layer_id}.${I.type}`,"mono",I.layer_id,I.type,yi(I.layer_id))]})}return{eyebrow:`LAYER ${Dr(c)} · ${u}`,title:x,idChip:t,meta:`${m} node types · ${p} relationship schemas`,color:v,crumbs:h1(e,t,!0),description:`${x} is layer ${Dr(c)} of 12 in the federated model, inspired by ${u}. The spec defines ${m} node types and ${p} valid relationship schemas for this layer; the loaded model holds ${y.length} elements.`,stats:[{label:"NODE TYPES",value:m,color:v},{label:"RELATIONSHIPS",value:p,color:f1},{label:"ELEMENTS",value:y.length,color:GN},{label:"LAYER",value:`${Dr(c)} / 12`,color:YN}],factsTitle:"LAYER SPEC",facts:[$t("layer_id",t),$t("number",c),$t("name",x,!0),$t("description",l==null?void 0:l.description,!0),$t("inspired_by.standard",u),$t("inspired_by.version",(j=l==null?void 0:l.inspired_by)==null?void 0:j.version),$t("inspired_by.url",(A=l==null?void 0:l.inspired_by)==null?void 0:A.url),$t("spec source",`spec/dist/${t}.json`)],tables:[{title:"Spec node types",columns:["node type","spec_node_id","instances"],widths:_B,rows:b,emptyText:"No node types are published for this layer."},{title:"Elements in model",columns:["name","type","provenance","rels · xrefs"],widths:wB,rows:w,emptyText:"No elements of this layer in the loaded model."},{title:"Cross-layer references",columns:["from","predicate","to"],widths:SB,rows:C,emptyText:"This layer emits no cross-layer references."}]}}const KN="minmax(0,1fr) minmax(0,0.8fr) 96px",NB="minmax(0,1fr) minmax(0,1.2fr) minmax(0,0.8fr) minmax(0,1fr) minmax(0,0.7fr) 62px",kB="minmax(0,1.2fr) minmax(0,1fr) minmax(0,1fr) minmax(0,0.8fr)",MB="minmax(0,1fr) minmax(0,1.5fr) 96px";function jB(e,t,n,a){var N,k,M,D,j,A,O,R,E,I,L,H;const s=Ma(n,e),o=Ji(e,t),l=(N=s==null?void 0:s.nodeSchemas)==null?void 0:N[o];if(!l)return null;const c=yi(e),u=(D=(M=(k=s==null?void 0:s.layer)==null?void 0:k.inspired_by)==null?void 0:M.standard)!=null?D:Uh(e),f=u1(l),m=((j=a.nodesByLayer[e])!=null?j:[]).filter(U=>U.type===o),p=FN(n),y=p.filter(U=>U.source_spec_node_id===t),v=p.filter(U=>U.destination_spec_node_id===t),x=f.map(U=>({cells:[It(U.name,"mono"),It(U.type,"dim"),It(U.required?"required":"optional","dim",U.required?XN:void 0)]})),b=y.map(U=>({target:{kind:"specNode",specNodeId:U.destination_spec_node_id,layerId:U.destination_layer},cells:[Pu(U.predicate,"mono",U.predicate,o,Ji(U.destination_layer,U.destination_spec_node_id)),Lo(Or(n,U.destination_layer,U.destination_spec_node_id),"name",U.destination_layer,Ji(U.destination_layer,U.destination_spec_node_id)),It(U.destination_layer,"dim",yi(U.destination_layer)),It(U.cardinality?Ky(U.cardinality)||U.cardinality:Jy,"dim"),It(U.strength,"dim"),It(U.required?"yes":"no","num")]})),w=v.map(U=>({target:{kind:"specNode",specNodeId:U.source_spec_node_id,layerId:U.source_layer},cells:[Lo(Or(n,U.source_layer,U.source_spec_node_id),"name",U.source_layer,Ji(U.source_layer,U.source_spec_node_id)),Pu(U.predicate,"mono",U.predicate,Ji(U.source_layer,U.source_spec_node_id),o),It(U.cardinality?Ky(U.cardinality)||U.cardinality:Jy,"dim"),It(U.strength,"dim")]})),C=m.map(U=>({target:{kind:"element",elementId:U.id,layerId:e},cells:[It(U.name,"name"),It(hc(U),"dim"),It(p1(U),"dim")]}));return{eyebrow:`SPEC NODE · ${u}`,title:(A=l.title)!=null?A:o,idChip:t,meta:`${f.length} attributes · ${m.length} instances`,color:c,crumbs:[...h1("spec",e,!1),{label:o,current:!0}],description:(O=l.description)!=null?O:"",stats:[{label:"ATTRIBUTES",value:f.length,color:c},{label:"OUTGOING TYPES",value:y.length,color:f1},{label:"INCOMING TYPES",value:v.length,color:VN},{label:"INSTANCES",value:m.length,color:GN}],factsTitle:"SPEC NODE",facts:[$t("spec_node_id",t),$t("layer_id",e),$t("type",o),$t("title",l.title,!0),$t("extends",(E=(R=l.allOf)==null?void 0:R[0])==null?void 0:E.$ref),$t("schema",l.$id),$t("inspired_by",(L=(I=s==null?void 0:s.layer)==null?void 0:I.inspired_by)!=null&&L.version?`${u} ${s.layer.inspired_by.version}`:u),$t("required",(H=l.required)==null?void 0:H.join(", "))],tables:[{title:"Attributes",columns:["attribute","type","constraint"],widths:KN,rows:x,emptyText:"No attribute schema is published for this node type."},{title:"Valid outgoing relationships",columns:["predicate","destination","layer","cardinality","strength","required"],widths:NB,rows:b,emptyText:"This node type declares no outgoing relationships."},{title:"Valid incoming relationships",columns:["source","predicate","cardinality","strength"],widths:kB,rows:w,emptyText:"No other node type declares a relationship into this one."},{title:"Instances in model",columns:["name","path","provenance"],widths:MB,rows:C,emptyText:"No instances of this node type in the loaded model."}],neighborhoodGraph:bB(e,t,n)}}const EB="minmax(0,1fr) minmax(0,1.5fr) 88px",RB="minmax(0,1fr) minmax(0,1.3fr) minmax(0,0.8fr) minmax(0,1.4fr)",TB="minmax(0,1.3fr) minmax(0,1fr) minmax(0,1fr) minmax(0,0.8fr)";function p1(e){return HN(e.source_reference)}function AB(e,t,n,a,s){var M,D,j,A,O;const o=a.byUuid.get(t);if(!o||o.layer_id!==e)return null;const l=yi(e),c=Ka(e),u=Ma(s,e),f=(M=u==null?void 0:u.nodeSchemas)==null?void 0:M[o.type],m=u1(f),p=[],y=[];for(const R of n.links){const E=Tn(a,R.source),I=Tn(a,R.target);if(!(!E||!I)){if(E.id===o.id){const L=`${Dr(E.spec_node_id)}.${R.type}.${Dr(I.spec_node_id)}`,H=I.layer_id===e?{edgeId:R.id,sourceElementId:o.id,sourceLayerId:e}:void 0;p.push({target:{kind:"element",elementId:I.id,layerId:I.layer_id},cells:[Pu(R.type,"mono",R.type,o.type,I.type,void 0,H),It(I.name,"name"),It(I.layer_id,"dim",yi(I.layer_id)),It(L,"dim")]})}else if(I.id===o.id){const L=E.layer_id===e?{edgeId:R.id,sourceElementId:E.id,sourceLayerId:E.layer_id}:void 0;y.push({target:{kind:"element",elementId:E.id,layerId:E.layer_id},cells:[It(E.name,"name"),Pu(R.type,"mono",R.type,E.type,o.type,void 0,L),Lo(E.type,"dim",E.layer_id,E.type),It(E.layer_id,"dim",yi(E.layer_id))]})}}}const v=p.filter(R=>{var E;return((E=R.target)==null?void 0:E.kind)==="element"&&R.target.layerId===e}).length,x=p.length-v,b=[{target:{kind:"specNode",specNodeId:`${e}.${o.type}`,layerId:e},cells:[Lo((D=f==null?void 0:f.title)!=null?D:o.type,"name",e,o.type),It(`${e}.${o.type}`,"dim"),It(`${m.length} attrs`,"num")]}],w=m.map(R=>({cells:[It(R.name,"mono"),It(R.type,"dim"),It(R.required?"required":"optional","dim",R.required?XN:void 0)]})),C=hc(o),N=qN(o.source_reference),k=(j=o.metadata)!=null?j:{};return{eyebrow:`ELEMENT · ${c}`,title:o.name,idChip:o.id,meta:`${p.length} outgoing · ${y.length} incoming`,color:l,crumbs:[...h1("model",e,!1),{label:o.id,current:!0}],description:(A=o.description)!=null?A:"",stats:[{label:"INTRA-LAYER",value:v,color:l},{label:"CROSS-LAYER",value:x,color:f1},{label:"INCOMING",value:y.length,color:VN},{label:"VERSION",value:Dr(k.version),color:YN}],factsTitle:"NODE",facts:[$t("path",C),$t("id",o.id),$t("spec_node_id",(O=o.spec_node_id)!=null?O:`${e}.${o.type}`),$t("type",o.type),$t("layer_id",e),$t("name",o.name,!0),$t("source_reference.provenance",p1(o)),$t("source_reference.file",N.file),$t("source_reference.symbol",N.symbol),$t("metadata.created_at",k.created_at),$t("metadata.updated_at",k.updated_at),$t("metadata.created_by",k.created_by),$t("metadata.version",k.version)],tables:[{title:"Conforms to",columns:["spec node","spec_node_id","attributes"],widths:EB,rows:b,emptyText:"No spec node type resolved for this element."},{title:"Attributes",columns:["attribute","type","constraint"],widths:KN,rows:w,emptyText:"No attribute schema is published for this node type."},{title:"Outgoing relationships",columns:["predicate","target","layer","spec_relationship_id"],widths:RB,rows:p,emptyText:"This element has no outgoing relationships."},{title:"Incoming relationships",columns:["source","predicate","type","layer"],widths:TB,rows:y,emptyText:"No other element references this one."}],neighborhoodGraph:xB(t,n,a)}}const ba=8,DB={top:"bottom",bottom:"top",left:"right",right:"left"};function LB(e,t,n,a={width:typeof window!="undefined"?window.innerWidth:1024,height:typeof window!="undefined"?window.innerHeight:768}){var y;const s=v=>{switch(v){case"top":return e.top-t.height-ba>=0;case"bottom":return e.bottom+t.height+ba<=a.height;case"left":return e.left-t.width-ba>=0;case"right":return e.right+t.width+ba<=a.width}},o=n==="top"||n==="bottom"?["right","left"]:["bottom","top"],l=(y=[n,DB[n],...o].find(s))!=null?y:n;let c,u;l==="top"||l==="bottom"?(c=l==="top"?e.top-t.height-ba:e.bottom+ba,u=e.left+e.width/2-t.width/2):(u=l==="left"?e.left-t.width-ba:e.right+ba,c=e.top+e.height/2-t.height/2);const f=Math.max(ba,a.width-t.width-ba),m=Math.max(ba,a.height-t.height-ba);u=Math.min(Math.max(ba,u),f),c=Math.min(Math.max(ba,c),m);const p=u<e.right&&u+t.width>e.left&&c<e.bottom&&c+t.height>e.top;return{top:c,left:u,placement:l,overlapsAnchor:p}}function OB(e,t){return!!e&&e.top===t.top&&e.left===t.left&&e.placement===t.placement&&e.overlapsAnchor===t.overlapsAnchor}function QN({id:e,getAnchorRect:t,content:n,placement:a="top",track:s=!1,passThrough:o=!1,onMouseEnter:l,onMouseLeave:c,"data-testid":u}){var v,x,b;const[f,m]=T.useState(null),p=T.useRef(null),y=T.useRef(t);return y.current=t,T.useLayoutEffect(()=>{if(!p.current)return;let w=null;const C=()=>{if(!p.current)return;const k=y.current();if(!k){m(null);return}const M={width:p.current.offsetWidth,height:p.current.offsetHeight},D=LB(k,M,a);m(j=>OB(j,D)?j:D)},N=()=>{C(),w=requestAnimationFrame(N)};return C(),s&&(w=requestAnimationFrame(N)),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{w!==null&&cancelAnimationFrame(w),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[a,s]),QS.createPortal(h.jsx("div",{ref:p,id:e,role:"tooltip",className:"rich-tooltip","data-placement":(v=f==null?void 0:f.placement)!=null?v:a,style:{position:"fixed",top:(x=f==null?void 0:f.top)!=null?x:0,left:(b=f==null?void 0:f.left)!=null?b:0,visibility:f?"visible":"hidden",pointerEvents:o||f!=null&&f.overlapsAnchor?"none":void 0},onMouseEnter:l,onMouseLeave:c,"data-testid":u,children:n}),document.body)}function ZN({content:e,children:t,placement:n="top",openDelay:a=300,closeDelay:s=150,className:o,"data-testid":l}){const u=`rich-tooltip-${T.useId()}`,[f,m]=T.useState(!1),p=T.useRef(null),y=T.useRef(null),v=T.useRef(null),x=()=>{y.current&&(clearTimeout(y.current),y.current=null)},b=()=>{v.current&&(clearTimeout(v.current),v.current=null)},w=()=>{x(),b(),m(!0)},C=()=>{b(),!f&&(y.current=setTimeout(()=>{y.current=null,m(!0)},a))},N=()=>{x(),v.current=setTimeout(()=>{v.current=null,m(!1)},s)},k=()=>{x(),b(),m(!1)};return T.useEffect(()=>()=>{x(),b()},[]),T.useEffect(()=>{if(!f)return;const M=D=>{D.key==="Escape"&&k()};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[f]),h.jsxs("span",{ref:p,className:o,style:{display:"inline-block"},onMouseEnter:C,onMouseLeave:N,onFocus:w,onBlur:k,"aria-describedby":f?u:void 0,"data-testid":l,children:[t,f&&h.jsx(QN,{id:u,getAnchorRect:()=>{var M,D;return(D=(M=p.current)==null?void 0:M.getBoundingClientRect())!=null?D:null},content:e,placement:n,onMouseEnter:b,onMouseLeave:N,"data-testid":l?`${l}-card`:"rich-tooltip-card"})]})}const IB=6;function oS({items:e,max:t,testId:n,emptyLabel:a}){if(e.length===0)return h.jsx("div",{className:"rich-tooltip__empty","data-testid":n,children:a});const s=e.slice(0,t),o=e.length-s.length;return h.jsxs("ul",{className:"rich-tooltip__connections","data-testid":n,children:[s.map((l,c)=>h.jsxs("li",{className:"rich-tooltip__connection",title:`${l.predicate} · ${l.typeLabel}${l.domain?` (${Ka(l.domain)})`:""}`,children:[h.jsx("span",{className:"rich-tooltip__connection-swatch",style:{background:yi(l.domain)}}),h.jsx("span",{className:"rich-tooltip__connection-predicate",children:l.predicate}),h.jsx("span",{className:"rich-tooltip__connection-type",children:l.typeLabel})]},`${l.predicate}-${l.typeId}-${c}`)),o>0&&h.jsxs("li",{className:"rich-tooltip__overflow","data-testid":`${n}-overflow`,children:["+",o," more"]})]})}function zB({children:e,specifier:t,title:n,description:a,inbound:s,outbound:o,maxConnections:l=IB,placement:c,className:u,"data-testid":f="node-type-tooltip"}){const m=h.jsxs("div",{className:"rich-tooltip__body","data-testid":`${f}-content`,children:[h.jsx("div",{className:"rich-tooltip__title",children:n}),h.jsx("div",{className:"rich-tooltip__specifier",children:t}),a&&h.jsx("p",{className:"rich-tooltip__description",children:a}),h.jsx("div",{className:"rich-tooltip__section-label",children:"Inbound connections"}),h.jsx(oS,{items:s,max:l,testId:`${f}-inbound`,emptyLabel:"No inbound connection types"}),h.jsx("div",{className:"rich-tooltip__section-label",children:"Outbound connections"}),h.jsx(oS,{items:o,max:l,testId:`${f}-outbound`,emptyLabel:"No outbound connection types"})]});return h.jsx(ZN,{content:m,placement:c,className:u,"data-testid":f,children:e})}function rc({spec:e,layerId:t,typeId:n,children:a,placement:s,className:o,"data-testid":l}){const c=oB(e,t,`${t}.${n}`);return c?h.jsx(zB,{specifier:c.specifier,title:c.title,description:c.description,inbound:c.inbound,outbound:c.outbound,placement:s,className:o,"data-testid":l,children:a}):h.jsx(h.Fragment,{children:a})}const BB={supports:{description:"Element contributes to achieving or enabling another element",category:"motivation",archimateAlignment:"Influence"},realizes:{description:"Element implements or makes concrete another element",category:"structural",archimateAlignment:"Realization"},fulfills:{description:"Element satisfies the needs specified by another element",category:"motivation",archimateAlignment:"Realization"},delivers:{description:"Element provides value or benefit",category:"motivation",archimateAlignment:"Realization"},constrains:{description:"Element limits or restricts another element",category:"motivation",archimateAlignment:"Influence"},governs:{description:"Element provides rules or guidelines for another element",category:"motivation",archimateAlignment:"Influence"},owns:{description:"Element has responsibility or authority over another element",category:"business",archimateAlignment:"Assignment"},performs:{description:"Element executes or carries out another element",category:"business",archimateAlignment:"Assignment"},provides:{description:"Element makes functionality available",category:"structural",archimateAlignment:"Serving"},consumes:{description:"Element uses or depends on another element's functionality",category:"dependency",archimateAlignment:"Serving"},requires:{description:"Element needs another element to function correctly",category:"security",archimateAlignment:"Access"},protects:{description:"Element provides security for another element",category:"security",archimateAlignment:"Influence"},mitigates:{description:"Element reduces or addresses a risk or threat",category:"security",archimateAlignment:"Influence"},accesses:{description:"Element can read or modify another element",category:"security",archimateAlignment:"Access"},uses:{description:"Element depends on or utilizes another element",category:"dependency",archimateAlignment:"Serving"},implements:{description:"Element provides concrete implementation of another element",category:"structural",archimateAlignment:"Realization"},composes:{description:"Whole-part relationship where part cannot exist without whole",category:"structural",archimateAlignment:"Composition"},aggregates:{description:"Whole-part relationship where part can exist independently",category:"structural",archimateAlignment:"Aggregation"},triggers:{description:"Element causes or initiates another element",category:"behavioral",archimateAlignment:"Triggering"},"flows-to":{description:"Data or control flows from one element to another",category:"behavioral",archimateAlignment:"Flow"},monitors:{description:"Element observes or tracks another element",category:"apm",archimateAlignment:"Serving"},tests:{description:"Element validates or verifies another element",category:"testing",archimateAlignment:"Serving"},specializes:{description:"Type-subtype relationship (inheritance)",category:"structural",archimateAlignment:"Specialization"},"assigned-to":{description:"Active element assigned to behavior or role",category:"structural",archimateAlignment:"Assignment"},"associated-with":{description:"Generic relationship indicating elements are related or connected",category:"structural",archimateAlignment:"Association"},influence:{description:"Element affects or impacts another element",category:"behavioral",archimateAlignment:"Influence"},serves:{description:"Service available to consumer",category:"behavioral",archimateAlignment:"Serving"},references:{description:"Pointer reference without functional dependency",category:"dependency"},"depends-on":{description:"Element requires another to function",category:"dependency"},"supports-goals":{description:"Implementation contributes to achieving goal",category:"traceability"},"fulfills-requirements":{description:"Implementation satisfies requirement",category:"traceability"},"delivers-value":{description:"Implementation provides business value",category:"traceability"},"measures-outcome":{description:"Metric validates outcome achievement",category:"traceability"},"governed-by-principles":{description:"Element follows architectural principle",category:"governance"},"constrained-by":{description:"Element limited by constraint",category:"governance"},"enforces-requirement":{description:"Element actively enforces requirement",category:"governance"},traces:{description:"Distributed tracing relationships",category:"apm"},measures:{description:"Metric collection relationships",category:"apm"},authenticates:{description:"Authentication flows",category:"security"},authorizes:{description:"Permission grants",category:"security"},renders:{description:"UI rendering relationships",category:"ux"},"binds-to":{description:"Data binding relationships",category:"ux"},"navigates-to":{description:"Navigation flows",category:"ux"},"maps-to":{description:"Schema/table mapping",category:"data"},"references-table":{description:"Foreign key relationships",category:"data"},"derives-from":{description:"Calculated field relationships",category:"data"},validates:{description:"Test element validates that a requirement or target is satisfied",category:"testing"},applies:{description:"Element applies a rule, pattern, or style to another element",category:"ux"},"archives-to":{description:"Element archives data to a target store",category:"data"},"cascades-to":{description:"A change to element cascades to a dependent element",category:"data"},connects:{description:"Element establishes a connection to another element",category:"structural",archimateAlignment:"Association"},covers:{description:"Test element provides coverage for another element",category:"testing"},enforces:{description:"Element actively enforces a policy or requirement on another element",category:"governance"},evaluates:{description:"Element assesses or scores another element",category:"behavioral"},exposes:{description:"Element makes an interface or capability externally available",category:"structural",archimateAlignment:"Serving"},extends:{description:"Element extends the definition or capability of another element",category:"structural",archimateAlignment:"Specialization"},federates:{description:"Element federates identity or access with another element",category:"security"},generates:{description:"Element produces or creates another element",category:"data"},"governed-by":{description:"Element operates under the governance of another element",category:"governance"},intercepts:{description:"Element intercepts a request or action directed at another element",category:"behavioral"},"lazy-loads":{description:"Element defers loading of another element until needed",category:"behavioral"},manages:{description:"Element administers or oversees another element",category:"business"},mandates:{description:"Element requires compliance with another element",category:"governance"},migrates:{description:"Element transforms or moves data to another element",category:"data"},optimizes:{description:"Element improves the performance or efficiency of another element",category:"apm"},replicates:{description:"Element duplicates data to another element",category:"data"},"resolves-with":{description:"Element resolves an ambiguity or conflict together with another element",category:"behavioral"},satisfies:{description:"Element meets the criteria or requirement defined by another element",category:"traceability"},targets:{description:"Element is the target or subject of another element's action",category:"security"},tracks:{description:"Element records or follows the state of another element",category:"apm"},"scheduled-for":{description:"Element is scheduled to occur at or by a target element",category:"structural",archimateAlignment:"Assignment"}};function UB(e){return e?BB[e]:void 0}const JN=3e3;function WN({predicate:e,sourceTypeLabel:t,destinationTypeLabel:n,"data-testid":a="predicate-tooltip"}){var o;const s=UB(e);return h.jsxs("div",{className:"rich-tooltip__body","data-testid":`${a}-content`,children:[h.jsx("div",{className:"rich-tooltip__title",children:e}),h.jsx("p",{className:"rich-tooltip__description",children:(o=s==null?void 0:s.description)!=null?o:"No definition available for this predicate."}),h.jsx("div",{className:"rich-tooltip__section-label",children:"Relationship"}),h.jsxs("div",{className:"rich-tooltip__diagram","data-testid":`${a}-diagram`,children:[h.jsx("span",{className:"rich-tooltip__diagram-node",children:t}),h.jsx("span",{className:"rich-tooltip__diagram-arrow","aria-hidden":"true",children:"→"}),h.jsx("span",{className:"rich-tooltip__diagram-predicate",children:e}),h.jsx("span",{className:"rich-tooltip__diagram-arrow","aria-hidden":"true",children:"→"}),h.jsx("span",{className:"rich-tooltip__diagram-node",children:n})]})]})}function m1({children:e,predicate:t,sourceTypeLabel:n,destinationTypeLabel:a,placement:s,className:o,"data-testid":l="predicate-tooltip"}){return h.jsx(ZN,{content:h.jsx(WN,{predicate:t,sourceTypeLabel:n,destinationTypeLabel:a,"data-testid":l}),placement:s,className:o,openDelay:JN,"data-testid":l,children:e})}function Wy({id:e,label:t,kind:n,domainColor:a="default",selected:s=!1,onSelect:o,spec:l,typeId:c,hasChildren:u=!1,collapsed:f=!1,hiddenDescendantCount:m=0,onToggleCollapse:p}){const y=c!=null?c:n,v=["graph-node",s&&"selected"].filter(Boolean).join(" ");return h.jsxs("div",{className:v,"data-domain":a,"data-kind":n,"data-testid":`pill-node-${e}`,onClick:x=>{x.stopPropagation(),o==null||o(e)},onKeyDown:x=>{x.target===x.currentTarget&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.stopPropagation(),o==null||o(e))},role:o?"button":void 0,tabIndex:o?0:void 0,"aria-pressed":o?s:void 0,children:[h.jsx("span",{className:"graph-node__swatch"}),h.jsx("span",{className:"graph-node__label",children:t}),n&&(y?h.jsx(rc,{spec:l,layerId:a,typeId:y,"data-testid":`pill-node-kind-tooltip-${e}`,children:h.jsx("span",{className:"graph-node__kind",tabIndex:0,children:n})}):h.jsx("span",{className:"graph-node__kind",children:n})),u&&p&&h.jsxs("button",{type:"button",className:"graph-node__collapse-toggle","aria-label":f?"Expand":"Collapse","aria-expanded":!f,onClick:x=>{x.stopPropagation(),p()},children:[f&&m>0&&h.jsx("span",{className:"graph-node__hidden-badge",children:m}),h.jsx(He,{name:f?"chevronRight":"chevronDown",size:12})]})]})}function FB(e){return e.map(t=>({id:t.id,label:t.name,kind:t.kind,domainColor:t.layer}))}function $B(e,t){const n=e.find(a=>a.isCenter);return n?t.map(a=>({id:a.id,sourceId:a.direction==="out"?n.id:a.targetId,targetId:a.direction==="out"?a.targetId:n.id,label:a.predicate})):[]}function PB(e,t,n,a,s){const o=t.find(l=>l.id===e);o&&(o.isCenter||(n?s(e,o.layer):a(e,o.layer)))}function HB({neighborhood:e,isSpecView:t}){const n=Re(m=>m.navigateToElement),a=Re(m=>m.navigateToSpecNode),{raw:s}=Os(),o=T.useMemo(()=>{const m=e.nodes.find(p=>p.isCenter);return m==null?void 0:m.id},[e.nodes]),l=T.useMemo(()=>FB(e.nodes),[e.nodes]),c=T.useMemo(()=>$B(e.nodes,e.edges),[e.nodes,e.edges]),u=T.useCallback(m=>{PB(m,e.nodes,t,n,a)},[e.nodes,t,n,a]),f=T.useCallback((m,p)=>{var x;const y=e.nodes.find(b=>b.id===m.id),v=(x=y==null?void 0:y.isCenter)!=null?x:!1;return h.jsx(Wy,{id:m.id,label:m.label,kind:m.kind,domainColor:m.domainColor,selected:p,onSelect:v?void 0:u,spec:s,typeId:t?m.id.split(".")[1]:void 0})},[e.nodes,t,u,s]);return h.jsx("div",{style:{height:"40vh",minHeight:360,maxHeight:560,display:"flex",flexDirection:"column",overflow:"hidden",border:"1px solid rgb(var(--canvas-border))",borderRadius:8,background:"rgb(var(--canvas-card))"},"data-testid":"neighborhood-graph-view",children:e.empty?h.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"rgb(var(--canvas-fg-3))",fontFamily:"'JetBrains Mono',monospace",fontSize:12},"data-testid":"neighborhood-empty-state",children:"no connections"}):h.jsx(o1,{nodes:l,edges:c,selectedNodeId:o,renderNode:f,onNodeSelect:u,layout:"force",nodeMargin:40,fitView:!0,fitPadding:20,showToolbar:!1,isStructuralEdge:PN,style:{flex:1}})})}const Di="'JetBrains Mono',monospace";function qB(){const e=Re(c=>c.view),t=Re(c=>c.layerId),n=Re(c=>c.selectedId),a=Re(c=>c.focus),{derived:s}=Ls(),{raw:o}=Os(),l=T.useMemo(()=>Fh(s),[s]);return T.useMemo(()=>!t||e==="changesets"?null:a==="layer"?CB(e,t,s,l,o):n?e==="spec"?jB(t,n,o,s):AB(t,n,s,l,o):null,[e,t,n,a,s,l,o])}function VB(){const e=Re(o=>o.setView),t=Re(o=>o.selectLayer),n=Re(o=>o.navigateToElement),a=Re(o=>o.navigateToElementWithEdge),s=Re(o=>o.navigateToSpecNode);return o=>{if(o)switch(o.kind){case"section":e(o.view);return;case"layer":e(o.view),t(o.layerId);return;case"element":n(o.elementId,o.layerId);return;case"elementWithEdge":a(o.elementId,o.layerId,o.edgeId);return;case"specNode":s(o.specNodeId,o.layerId);return;default:return o}}}function GB(e){var t,n;if(((t=e.tooltip)==null?void 0:t.kind)==="nodeType")return{kind:"specNode",specNodeId:`${e.tooltip.layerId}.${e.tooltip.typeId}`,layerId:e.tooltip.layerId};if(((n=e.tooltip)==null?void 0:n.kind)==="predicate"&&e.tooltip.edge)return{kind:"elementWithEdge",elementId:e.tooltip.edge.sourceElementId,layerId:e.tooltip.edge.sourceLayerId,edgeId:e.tooltip.edge.edgeId}}const YB={name:{fontSize:13,color:"rgb(var(--canvas-fg-1))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},mono:{fontFamily:Di,fontSize:11,color:"rgb(var(--canvas-fg-2))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},dim:{fontFamily:Di,fontSize:11,color:"rgb(var(--canvas-fg-3))",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},num:{fontFamily:Di,fontSize:11,color:"rgb(var(--canvas-fg-2))",textAlign:"right"}};function XB({cell:e,spec:t,target:n,onNavigate:a}){var l,c,u;const s=F(F({},YB[e.kind]),e.color?{color:e.color}:null),o=n?h.jsx("span",{role:"cell",style:s,children:h.jsx("button",{type:"button",className:"drv-cell-link",style:{overflow:s.overflow,textOverflow:s.textOverflow,whiteSpace:s.whiteSpace,textAlign:(l=s.textAlign)!=null?l:"left",display:"block",width:"100%",border:"none",padding:0,margin:0,cursor:"pointer"},onClick:()=>a(n),"data-testid":"page-cell-link",children:e.text})}):h.jsx("span",{role:"cell",style:s,tabIndex:e.tooltip?0:void 0,children:e.text});return((c=e.tooltip)==null?void 0:c.kind)==="nodeType"?h.jsx(rc,{spec:t,layerId:e.tooltip.layerId,typeId:e.tooltip.typeId,"data-testid":"page-cell-node-type-tooltip",children:o}):((u=e.tooltip)==null?void 0:u.kind)==="predicate"?h.jsx(m1,{predicate:e.tooltip.predicate,sourceTypeLabel:e.tooltip.sourceTypeLabel,destinationTypeLabel:e.tooltip.destinationTypeLabel,"data-testid":"page-cell-predicate-tooltip",children:o}):o}function KB({pg:e,onNavigate:t}){const n={fontFamily:Di,fontSize:11};return h.jsx("nav",{"aria-label":"Breadcrumb",style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:e.crumbs.map((a,s)=>h.jsxs("span",{style:{display:"contents"},children:[s>0&&h.jsx("span",{style:Z(F({},n),{color:"rgb(var(--canvas-fg-4))"}),"aria-hidden":"true",children:"/"}),a.target?h.jsx("button",{type:"button",className:`drv-crumb${a.current?" drv-crumb--current":""}`,onClick:()=>t(a.target),"data-testid":"page-crumb",style:F({background:"none",border:"none",padding:0},n),children:a.label}):h.jsx("span",{style:Z(F({},n),{color:a.current?"rgb(var(--canvas-fg-1))":"rgb(var(--canvas-fg-3))"}),children:a.label})]},`${a.label}-${s}`))})}function QB({pg:e}){return h.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4,minmax(0,1fr))",gap:14},children:e.stats.map(t=>h.jsxs("div",{style:{padding:"12px 14px",background:"rgb(var(--canvas-card))",border:"1px solid rgb(var(--canvas-border))",borderLeft:`2px solid ${t.color}`,borderRadius:8},children:[h.jsx("div",{style:{fontFamily:Di,fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:t.label}),h.jsx("div",{style:{fontSize:28,fontWeight:700,letterSpacing:"-0.02em",color:"rgb(var(--canvas-fg-1))",marginTop:4},children:t.value})]},t.label))})}function ZB({pg:e}){return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[h.jsx("span",{style:{fontFamily:Di,fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:e.factsTitle}),h.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2,minmax(0,1fr))",gap:"1px 32px"},children:e.facts.map(t=>h.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0,150px) minmax(0,1fr)",gap:12,padding:"7px 0",borderBottom:"1px solid rgb(var(--canvas-border))"},children:[h.jsx("span",{style:{fontFamily:Di,fontSize:11,lineHeight:1.45,color:"rgb(var(--canvas-fg-3))",minWidth:0,overflowWrap:"anywhere",wordBreak:"break-word"},children:t.key}),h.jsx("span",{style:t.prose?{fontSize:12,color:"rgb(var(--canvas-fg-1))",overflowWrap:"anywhere"}:{fontFamily:Di,fontSize:11,color:"rgb(var(--canvas-fg-1))",overflowWrap:"anywhere"},children:t.value})]},t.key))})]})}const JB={display:"grid",gap:14,alignItems:"center",padding:"9px 10px",borderBottom:"1px solid rgb(var(--canvas-border))",borderRadius:4};function WB({row:e,widths:t,spec:n,onNavigate:a}){let s=!1,o=!1;const l=e.cells.map((c,u)=>{let f=GB(c);return!f&&e.target&&!s&&(f=e.target,s=!0),f&&(o=!0),h.jsx(XB,{cell:c,spec:n,target:f,onNavigate:a},u)});return h.jsx("div",{role:"row",className:o?"drv-row":void 0,style:Z(F({},JB),{gridTemplateColumns:t}),"data-testid":e.target?"page-row":void 0,children:l})}function eU({pg:e,spec:t,onNavigate:n}){return h.jsx(h.Fragment,{children:e.tables.map(a=>h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[h.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[h.jsx("span",{style:{fontFamily:Di,fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:a.title}),h.jsx("span",{style:{fontFamily:Di,fontSize:10,color:"rgb(var(--canvas-fg-3))"},children:a.rows.length?a.rows.length:""})]}),a.rows.length===0?h.jsx("span",{style:{fontSize:13,color:"rgb(var(--canvas-fg-3))"},children:a.emptyText}):h.jsxs("div",{role:"table","aria-label":a.title,children:[h.jsx("div",{role:"row",style:{display:"grid",gridTemplateColumns:a.widths,gap:14,alignItems:"center",padding:"0 10px 7px",fontFamily:Di,fontSize:10,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))",borderBottom:"1px solid rgb(var(--canvas-border))"},children:a.columns.map(s=>h.jsx("span",{role:"columnheader",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s},s))}),a.rows.map((s,o)=>h.jsx(WB,{row:s,widths:a.widths,spec:t,onNavigate:n},o))]})]},a.title))})}function tU({pg:e}){const t=VB(),{raw:n}=Os(),a=Re(s=>s.view);return h.jsx("div",{className:"drv-scroll",style:{position:"absolute",inset:0,overflowY:"auto",padding:"2px 22px 44px"},"data-testid":"page-view",children:h.jsxs("div",{style:{maxWidth:1040,display:"flex",flexDirection:"column",gap:28},children:[h.jsx(KB,{pg:e,onNavigate:t}),e.neighborhoodGraph&&h.jsx(HB,{neighborhood:e.neighborhoodGraph,isSpecView:a==="spec"},`${e.title}-neighborhood`),h.jsx("p",{style:{fontSize:14,lineHeight:1.6,color:"rgb(var(--canvas-fg-2))",margin:0,maxWidth:760,textWrap:"pretty"},children:e.description}),h.jsx(QB,{pg:e}),h.jsx(ZB,{pg:e}),h.jsx(eU,{pg:e,spec:n,onNavigate:t})]})})}const ek="You",nU=/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/;function aU(e){return nU.test(e)}function $h(e){return["annotations",e!=null?e:""]}function tk(e){return["annotation-replies",e]}function iU(e){return lc({queryKey:$h(e),enabled:!!e,queryFn:()=>ut(null,null,function*(){var n;return(n=(yield $o().getapiannotations({elementId:e})).annotations)!=null?n:[]})})}function sU(e,t=!0){return lc({queryKey:tk(e),enabled:t,queryFn:()=>ut(null,null,function*(){var a;return(a=(yield $o().getapiannotationsannotationIdreplies(e)).replies)!=null?a:[]})})}function rU(){const e=ts();return cc({mutationFn:t=>{var n,a;return $o().postapiannotations({elementId:t.elementId,author:(n=t.author)!=null?n:ek,content:t.content,tags:(a=t.tags)!=null?a:[]})},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:$h(n.elementId)})}})}function oU(){const e=ts();return cc({mutationFn:t=>{const n={};return t.content!==void 0&&(n.content=t.content),t.tags!==void 0&&(n.tags=t.tags),t.resolved!==void 0&&(n.resolved=t.resolved),$o().patchapiannotationsannotationId(t.id,n)},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:$h(n.elementId)})}})}function lU(){const e=ts();return cc({mutationFn:t=>$o().deleteapiannotationsannotationId(t.id),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:$h(n.elementId)})}})}function cU(){const e=ts();return cc({mutationFn:t=>{var n;return $o().postapiannotationsannotationIdreplies(t.annotationId,{author:(n=t.author)!=null?n:ek,content:t.content})},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:tk(n.annotationId)})}})}function nk(e){const t=new Date(e).getTime();if(Number.isNaN(t))return e;const n=Date.now()-t,a=Math.round(n/1e3);if(a<45)return"just now";const s=Math.round(a/60);if(s<60)return`${s}m ago`;const o=Math.round(s/60);if(o<24)return`${o}h ago`;const l=Math.round(o/24);if(l<30)return`${l}d ago`;const c=Math.round(l/30);return c<12?`${c}mo ago`:`${Math.round(c/12)}y ago`}function uU(e){const t=new Set;for(const n of e.split(/[\s,]+/)){const a=n.trim().toLowerCase();a&&t.add(a)}return[...t]}const dU={display:"block",fontFamily:"'JetBrains Mono', monospace",fontSize:10.5,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))",fontWeight:500},Oo={fontFamily:"'JetBrains Mono', monospace",fontSize:10.5,color:"rgb(var(--canvas-fg-3))"},fU={background:"rgb(var(--canvas-card))",border:"1px solid rgb(var(--canvas-border))",borderRadius:8,padding:"10px 12px"};function hU({elementId:e,notify:t}){const[n,a]=T.useState(""),[s,o]=T.useState(""),l=rU(),c=n.trim(),u=T.useMemo(()=>uU(s),[s]),f=u.filter(y=>!aU(y)),m=c.length>=1&&c.length<=5e3&&f.length===0&&!l.isPending,p=()=>{m&&l.mutate({elementId:e,content:c,tags:u},{onSuccess:()=>{a(""),o(""),t("success","Annotation added")},onError:()=>t("error","Failed to add annotation")})};return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[h.jsx(wv,{value:n,onChange:y=>a(y.target.value),placeholder:"Add an annotation…",rows:3,"aria-label":"New annotation content","data-testid":"annotation-add-content"}),h.jsx(Du,{mono:!0,value:s,onChange:y=>o(y.target.value),placeholder:"tags (space or comma separated)",error:f.length>0,"aria-label":"New annotation tags","data-testid":"annotation-add-tags"}),f.length>0&&h.jsxs("span",{style:Z(F({},Oo),{color:"rgb(var(--status-rose))"}),children:["invalid tag",f.length>1?"s":"",": ",f.join(", ")]}),h.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:h.jsx(Pn,{variant:"accent",size:"sm",disabled:!m,onClick:p,"data-testid":"annotation-add-submit",children:l.isPending?"Adding…":"Add"})})]})}function pU({annotationId:e,expanded:t,notify:n}){const{data:a=[],isLoading:s}=sU(e,t),o=cU(),[l,c]=T.useState(""),u=l.trim(),f=u.length>=1&&u.length<=5e3&&!o.isPending,m=()=>{f&&o.mutate({annotationId:e,content:u},{onSuccess:()=>{c(""),n("success","Reply added")},onError:()=>n("error","Failed to add reply")})};return h.jsxs("div",{style:{marginTop:8,paddingLeft:12,borderLeft:"2px solid rgb(var(--canvas-border))",display:"flex",flexDirection:"column",gap:8},"data-testid":"annotation-replies",children:[s&&a.length===0?h.jsx("span",{style:Oo,children:"loading replies…"}):a.map(p=>h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsx("span",{style:{fontSize:12,fontWeight:600,color:"rgb(var(--canvas-fg-1))"},children:p.author}),h.jsx("span",{style:Oo,title:p.createdAt,children:nk(p.createdAt)})]}),h.jsx("p",{style:{margin:0,fontSize:12.5,lineHeight:1.5,color:"rgb(var(--canvas-fg-2))",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:p.content})]},p.id)),h.jsxs("div",{style:{display:"flex",gap:6,alignItems:"flex-start"},children:[h.jsx(Du,{value:l,onChange:p=>c(p.target.value),placeholder:"Reply…","aria-label":"Reply content","data-testid":"annotation-reply-input",style:{flex:1},onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),m())}}),h.jsx(Pn,{variant:"secondary",size:"sm",disabled:!f,onClick:m,"data-testid":"annotation-reply-submit",children:"Reply"})]})]})}function mU({annotation:e,elementId:t,notify:n}){const a=oU(),s=lU(),[o,l]=T.useState(!1),[c,u]=T.useState(e.content),[f,m]=T.useState(!1),[p,y]=T.useState(!1),v=c.trim(),x=v.length>=1&&v.length<=5e3&&v!==e.content&&!a.isPending,b=()=>{x&&a.mutate({id:e.id,elementId:t,content:v},{onSuccess:()=>{l(!1),n("success","Annotation updated")},onError:()=>n("error","Failed to update annotation")})},w=()=>{a.mutate({id:e.id,elementId:t,resolved:!e.resolved},{onSuccess:()=>n("success",e.resolved?"Reopened":"Resolved"),onError:()=>n("error","Failed to update annotation")})},C=()=>{s.mutate({id:e.id,elementId:t},{onSuccess:()=>{m(!1),n("success","Annotation deleted")},onError:()=>{m(!1),n("error","Failed to delete annotation")}})},N=k=>{k==="edit"?(u(e.content),l(!0)):k==="resolve"?w():k==="delete"&&m(!0)};return h.jsxs("div",{style:fU,"data-testid":"annotation-item","data-resolved":e.resolved,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[h.jsx("span",{style:{fontSize:12.5,fontWeight:600,color:"rgb(var(--canvas-fg-1))"},children:e.author}),h.jsx("span",{style:Oo,title:e.createdAt,children:nk(e.createdAt)}),e.resolved&&h.jsx(Na,{variant:"emerald","data-testid":"annotation-resolved-chip",children:"resolved"}),h.jsx("div",{style:{marginLeft:"auto"},children:h.jsx(ZC,{placement:"bottom-end",triggerLabel:"Annotation actions",actions:[{id:"edit",label:"Edit",icon:"edit"},{id:"resolve",label:e.resolved?"Reopen":"Resolve",icon:"check"},{type:"separator"},{id:"delete",label:"Delete",icon:"trash",danger:!0}],onAction:N})})]}),o?h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[h.jsx(wv,{value:c,onChange:k=>u(k.target.value),rows:3,"aria-label":"Edit annotation content","data-testid":"annotation-edit-content",autoFocus:!0}),h.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:6},children:[h.jsx(Pn,{variant:"ghost",size:"sm",onClick:()=>l(!1),"data-testid":"annotation-edit-cancel",children:"Cancel"}),h.jsx(Pn,{variant:"accent",size:"sm",disabled:!x,onClick:b,"data-testid":"annotation-edit-save",children:a.isPending?"Saving…":"Save"})]})]}):h.jsx("p",{style:{margin:0,fontSize:13,lineHeight:1.55,color:"rgb(var(--canvas-fg-2))",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:e.content}),e.tags.length>0&&h.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:8},"data-testid":"annotation-tags",children:e.tags.map(k=>h.jsx(Na,{form:"id-tag",children:k},k))}),h.jsx("div",{style:{marginTop:8},children:h.jsx(Pn,{variant:"ghost",size:"sm",onClick:()=>y(k=>!k),"aria-expanded":p,"data-testid":"annotation-replies-toggle",children:p?"Hide replies":"Replies"})}),p&&h.jsx(pU,{annotationId:e.id,expanded:p,notify:n}),h.jsx(uh,{isOpen:f,onClose:()=>m(!1),onConfirm:C,title:"Delete annotation",message:"This permanently removes the annotation and its replies. Continue?",confirmLabel:s.isPending?"Deleting…":"Delete",variant:"danger"})]})}function gU({elementId:e}){const{data:t=[],isLoading:n,isError:a}=iU(e),[s,o]=T.useState({open:!1,variant:"success",title:""}),l=(c,u)=>o({open:!0,variant:c,title:u});return h.jsxs("section",{style:{padding:"16px",borderTop:"1px solid rgb(var(--canvas-border))",display:"flex",flexDirection:"column",gap:12},"data-testid":"annotations-section",children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsx("span",{style:dU,children:"Annotations"}),h.jsxs("span",{style:Oo,"data-testid":"annotations-count",children:["· ",t.length]})]}),h.jsx(hU,{elementId:e,notify:l}),n?h.jsx("span",{style:Oo,children:"loading…"}):a?h.jsx("span",{style:Z(F({},Oo),{color:"rgb(var(--status-rose))"}),children:"failed to load annotations"}):t.length===0?h.jsx("span",{style:{fontSize:12.5,color:"rgb(var(--canvas-fg-3))"},"data-testid":"annotations-empty",children:"No annotations yet"}):h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:t.map(c=>h.jsx(mU,{annotation:c,elementId:e,notify:l},c.id))}),h.jsx(Ev,{isOpen:s.open,onClose:()=>o(c=>Z(F({},c),{open:!1})),variant:s.variant,title:s.title})]})}function ev({relationships:e,onNodeSelect:t}){if(e.length===0)return null;const n=e.filter(s=>s.direction==="out"),a=e.filter(s=>s.direction==="in");return h.jsxs(h.Fragment,{children:[n.length>0&&h.jsxs("div",{"data-testid":"inspector-outgoing",children:[h.jsxs("div",{className:"graph-inspector__section-label",children:["Outgoing · ",n.length]}),h.jsx("ul",{className:"graph-inspector__rels",children:n.map(s=>h.jsx(lS,{rel:s,onNodeSelect:t},s.id))})]}),a.length>0&&h.jsxs("div",{"data-testid":"inspector-incoming",children:[h.jsxs("div",{className:"graph-inspector__section-label",children:["Incoming · ",a.length]}),h.jsx("ul",{className:"graph-inspector__rels",children:a.map(s=>h.jsx(lS,{rel:s,onNodeSelect:t},s.id))})]})]})}function lS({rel:e,onNodeSelect:t}){const n=()=>t(e.target),a=e.sourceTypeLabel&&e.destinationTypeLabel?h.jsx(m1,{predicate:e.predicate,sourceTypeLabel:e.sourceTypeLabel,destinationTypeLabel:e.destinationTypeLabel,"data-testid":`relationship-predicate-tooltip-${e.id}`,children:h.jsx("span",{className:"graph-inspector__rel-pred",children:e.predicate})}):h.jsx("span",{className:"graph-inspector__rel-pred",children:e.predicate}),s=e.direction==="out"?"→":"←",o=`graph-inspector__rel-dir--${e.direction}`;return h.jsxs("li",{className:"graph-inspector__rel",children:[h.jsx("div",{className:`graph-inspector__rel-dir ${o}`,children:s}),a,h.jsxs("button",{type:"button",className:"graph-inspector__rel-target","data-domain":e.targetDomain,onClick:n,"aria-label":`Navigate to ${e.targetTitle}`,children:[h.jsx("span",{className:"graph-inspector__rel-swatch"}),e.targetTitle]})]})}const Zg={border:"none",cursor:"pointer"};function yU({edgeId:e,edge:t,model:n,index:a,spec:s,onNodeSelect:o,navigateToSpecNode:l,navigateToElementWithEdge:c}){var b;const u=a.byUuid.get(t.sourceNode.id),f=a.byUuid.get(t.targetNode.id),m=T.useMemo(()=>u?Z(F({},Zy(u,Ka(u.layer_id))),{kind:void 0}):null,[u]),p=T.useMemo(()=>f?Z(F({},Zy(f,Ka(f.layer_id))),{kind:void 0}):null,[f]),y=T.useMemo(()=>u?Qy(n,u.id,a):[],[n,u,a]),v=T.useMemo(()=>f?Qy(n,f.id,a):[],[n,f,a]),x={id:e,predicate:t.predicate,sourceId:t.sourceNode.id,sourceTitle:t.sourceNode.name,sourceDomain:t.sourceNode.layer,targetId:t.targetNode.id,targetTitle:t.targetNode.name,targetDomain:t.targetNode.layer,variant:"hot",metadata:(b=t.specRelationship)!=null&&b.cardinality?{cardinality:t.specRelationship.cardinality}:void 0};return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},"data-testid":"edge-inspector",children:[h.jsxs("div",{"data-testid":"edge-inspector-source-node",children:[u&&h.jsx("div",{className:"graph-inspector__head-eyebrow","data-testid":"edge-inspector-source-type-row",children:h.jsx(rc,{spec:s,layerId:u.layer_id,typeId:u.type,"data-testid":"edge-inspector-source-type-tooltip",children:h.jsx("button",{type:"button",className:"graph-inspector__badge",style:Zg,onClick:()=>l(`${u.layer_id}.${u.type}`,u.layer_id),children:u.type})})}),h.jsxs("div",{className:"graph-inspector--custom-relationships",children:[h.jsx($u,{node:m,relationships:[],onNodeSelect:o,emptyStateText:"Source element unavailable."}),h.jsx(ev,{relationships:y,onNodeSelect:o})]})]}),h.jsx("div",{className:"graph-edge-inspector__head-eyebrow","data-testid":"edge-inspector-predicate-row",children:h.jsx(m1,{predicate:t.predicate,sourceTypeLabel:t.sourceNode.type,destinationTypeLabel:t.targetNode.type,"data-testid":"edge-inspector-predicate-tooltip",children:h.jsx("button",{type:"button",className:"graph-edge-inspector__badge",style:Zg,onClick:()=>c(t.sourceNode.id,t.sourceNode.layer,e),children:t.predicate})})}),h.jsx(NN,{edge:x,onNodeSelect:o,"data-testid":"edge-inspector-edge"}),h.jsxs("div",{"data-testid":"edge-inspector-destination-node",children:[f&&h.jsx("div",{className:"graph-inspector__head-eyebrow","data-testid":"edge-inspector-destination-type-row",children:h.jsx(rc,{spec:s,layerId:f.layer_id,typeId:f.type,"data-testid":"edge-inspector-destination-type-tooltip",children:h.jsx("button",{type:"button",className:"graph-inspector__badge",style:Zg,onClick:()=>l(`${f.layer_id}.${f.type}`,f.layer_id),children:f.type})})}),h.jsxs("div",{className:"graph-inspector--custom-relationships",children:[h.jsx($u,{node:p,relationships:[],onNodeSelect:o,emptyStateText:"Destination element unavailable."}),h.jsx(ev,{relationships:v,onNodeSelect:o})]})]})]})}function vU(e){const t=e.lastIndexOf(".");return t>0?e.slice(0,t):e}const xU=320;function bU(){const[e,t]=T.useState(xU),n=Re(R=>R.view),a=Re(R=>R.layerId),s=Re(R=>R.selectedId),o=Re(R=>R.selectedEdgeId),l=Re(R=>R.navigateToElement),c=Re(R=>R.navigateToSpecNode),u=Re(R=>R.navigateToElementWithEdge),f=Re(R=>R.clearEdgeSelection),{derived:m,isSuccess:p}=Ls(),{raw:y}=Os(),v=T.useMemo(()=>Fh(m),[m]),x=n==="spec",b=T.useMemo(()=>!x&&o?d1(m,o,v,y):void 0,[x,m,o,v,y]);T.useEffect(()=>{x||!o||!p||b||f()},[x,o,p,b,f]);const w=!x&&s?v.byUuid.get(s):void 0,C=T.useMemo(()=>w?Z(F({},Zy(w,Ka(w.layer_id))),{kind:void 0}):null,[w]),N=T.useMemo(()=>w?Qy(m,w.id,v):[],[m,w,v]),k=T.useMemo(()=>x&&a&&s?sB(y,a,s):null,[x,y,a,s]),M=T.useMemo(()=>x&&a&&s?iB(y,a,s):[],[x,y,a,s]),D=x?k:C,j=x?M:N,A=R=>{if(x){c(R,vU(R));return}const E=v.byUuid.get(R);E&&l(E.id,E.layer_id)},O=w?hc(w):null;return h.jsx(CN,{open:!!D||!!b,width:e,onWidthChange:t,"data-testid":"inspector",className:x?"":"inspector-model-branch",children:b&&o?h.jsx(yU,{edgeId:o,edge:b,model:m,index:v,spec:y,onNodeSelect:A,navigateToSpecNode:c,navigateToElementWithEdge:u}):h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[!x&&w&&h.jsx("div",{className:"graph-inspector__head-eyebrow","data-testid":"inspector-kind-tooltip-row",children:h.jsx(rc,{spec:y,layerId:w.layer_id,typeId:w.type,"data-testid":"inspector-kind-tooltip",children:h.jsx("button",{type:"button",className:"graph-inspector__badge",style:{border:"none",cursor:"pointer"},onClick:()=>c(`${w.layer_id}.${w.type}`,w.layer_id),children:w.type})})}),x?h.jsx($u,{node:D,relationships:j,onNodeSelect:A,emptyStateText:"Select a node type to inspect."}):h.jsxs("div",{className:"graph-inspector--custom-relationships",children:[h.jsx($u,{node:D,relationships:[],onNodeSelect:A,emptyStateText:"Select an element to inspect."}),h.jsx(ev,{relationships:j,onNodeSelect:A})]}),O&&h.jsx(gU,{elementId:O})]})})}function _U({id:e,label:t,kind:n,domainColor:a="default",selected:s=!1,onSelect:o,cardData:l,spec:c,hasChildren:u=!1,collapsed:f=!1,hiddenDescendantCount:m=0,onToggleCollapse:p}){var C,N,k;const y=(C=l==null?void 0:l.intraCount)!=null?C:0,v=(N=l==null?void 0:l.crossLinks)!=null?N:[],x=(k=l==null?void 0:l.crossTotal)!=null?k:0,b=x>v.length,w=["graph-node","graph-node--card",s&&"selected"].filter(Boolean).join(" ");return h.jsxs("div",{className:w,"data-domain":a,"data-kind":n,"data-testid":`model-card-node-${e}`,onClick:M=>{M.stopPropagation(),o==null||o(e)},onKeyDown:M=>{M.target===M.currentTarget&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),M.stopPropagation(),o==null||o(e))},role:o?"button":void 0,tabIndex:o?0:void 0,"aria-pressed":o?s:void 0,children:[h.jsxs("div",{className:"graph-node__card-header",children:[h.jsxs("span",{className:"graph-node__card-title",children:[h.jsx("span",{className:"graph-node__swatch"}),h.jsx("span",{className:"graph-node__label",children:t})]}),n&&h.jsx(rc,{spec:c,layerId:a,typeId:n,"data-testid":`model-card-kind-tooltip-${e}`,children:h.jsx("span",{className:"graph-node__kind",tabIndex:0,children:n})}),u&&p&&h.jsx("button",{type:"button",className:"graph-node__collapse-toggle","aria-label":f?"Expand":"Collapse","aria-expanded":!f,onClick:M=>{M.stopPropagation(),p()},children:f&&m>0&&h.jsx("span",{className:"graph-node__hidden-badge",children:m})})]}),h.jsxs("div",{className:"graph-node__card-stats","data-testid":`model-card-stats-${e}`,children:[h.jsxs("span",{className:"graph-node__card-stat","data-testid":`model-card-intra-count-${e}`,children:[y," intra-layer"]}),h.jsxs("span",{className:"graph-node__card-stat","data-testid":`model-card-cross-count-${e}`,children:[x," inter-layer"]})]}),v.length>0&&h.jsxs("ul",{className:"graph-node__cross-links","data-testid":`model-card-cross-links-${e}`,children:[v.map((M,D)=>h.jsxs("li",{className:"graph-node__cross-link",title:`${M.predicate} · ${M.targetName} (${Ka(M.targetLayer)})`,children:[h.jsx("span",{className:"graph-node__cross-link-swatch",style:{background:yi(M.targetLayer)}}),h.jsxs("span",{className:"graph-node__cross-link-label",children:[M.predicate," · ",M.targetName]})]},`${M.predicate}-${M.targetId}-${D}`)),b&&h.jsx("li",{className:"graph-node__cross-link graph-node__cross-link--overflow","data-testid":`model-card-overflow-${e}`,"aria-label":`${x-v.length} more inter-layer connections`,children:"…"})]})]})}function wU(e){const[t,n]=T.useState(),a=T.useRef(null),s=T.useCallback(o=>{a.current&&clearTimeout(a.current),a.current=null,n(l=>l===o?l:void 0),o!==void 0&&(a.current=setTimeout(()=>{a.current=null,n(o)},e))},[e]);return T.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),{dwelledId:t,onHover:s}}function SU(e,t){if(!e)return null;const n=`graph-edge-${t}`,a=Array.from(e.querySelectorAll('[data-testid^="graph-edge-"]')).find(l=>l.getAttribute("data-testid")===n);if(!a)return null;const s=a.querySelector(".graph-edge__label-bg");if(s){const l=s.getBoundingClientRect();if(l.width>0||l.height>0)return l}const o=Array.from(a.querySelectorAll("path")).find(l=>!l.closest("defs"));if(o&&typeof o.getTotalLength=="function"){const l=o.getPointAtLength(o.getTotalLength()/2),c=o.getScreenCTM();if(c){const u=l.x*c.a+l.y*c.c+c.e,f=l.x*c.b+l.y*c.d+c.f;return{left:u,right:u,top:f,bottom:f,width:0,height:0}}}return a.getBoundingClientRect()}function CU(){const e=Re(n=>n.selectedEdgeId),t=Re(n=>n.selectEdge);return{selectedEdgeId:e,edgeSelectionProps:{selectedEdgeId:e!=null?e:void 0,onEdgeSelect:t}}}function Wf(e){return`${e.view}:${e.layerId}:${e.graphLayout}:${e.nodeMarginPreset}:${e.nodeDisplay}:${e.showInterLayerNodes}`}function g1(e){return{center:{x:Math.round(e.center.x*10)/10,y:Math.round(e.center.y*10)/10},zoom:Number(e.zoom.toPrecision(4))}}function ak(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t.toString(36)}function NU(e){const t=g1(e);return`${t.center.x},${t.center.y},${t.zoom},${ak(e.scope)}`}function kU(e){if(!e)return null;const t=e.split(",");if(t.length!==3&&t.length!==4)return null;const[n,a,s]=t.slice(0,3).map(l=>l.trim()===""?NaN:Number(l));if(![n,a,s].every(Number.isFinite)||s<=0)return null;const o=t[3];return o!==void 0&&!/^[0-9a-z]+$/.test(o)?null:F(F({},g1({center:{x:n,y:a},zoom:s})),o?{tag:o}:{})}function MU(e,t){return e.tag===void 0||e.tag===ak(t)}function ik(e,t){return!e||!t?!e&&!t:e.zoom===t.zoom&&e.center.x===t.center.x&&e.center.y===t.center.y}function jU(e){const t=Re(u=>u.graphViewport),n=Re(u=>u.setGraphViewport),a=T.useRef(null),s=T.useRef(null),o=t&&t.scope===e?t:null,l=T.useCallback(u=>{const f=g1(u);s.current={key:e,vp:f},n(F({scope:e},f))},[e,n]),c=T.useCallback((u,f)=>{f.kind==="fit"&&f.reason==="mount"||l(u)},[l]);return T.useEffect(()=>{var m;if(!o)return;const u=s.current;if(u&&u.key===e&&ik(u.vp,o))return;const f={center:o.center,zoom:o.zoom};s.current={key:e,vp:f},(m=a.current)==null||m.setViewport(f,{silent:!0,animate:!0})},[o,e]),{viewportRef:a,initialViewport:o?{center:o.center,zoom:o.zoom}:void 0,onViewportDwell:l,onViewportNavigate:c}}const EU=[{value:"graph",label:"graph"},{value:"page",label:"page"}],RU=[{value:"force-clustered",label:"Clustered"},{value:"organic",label:"Organic"},{value:"orthogonal",label:"Orthogonal"}],TU=new Set(["force-clustered"]),sk=[{value:"on",label:"On"},{value:"off",label:"Off"}],AU=[{value:"tight",label:"Tight"},{value:"default",label:"Default"},{value:"wide",label:"Wide"}],DU=[{value:"structural",label:"Structural"},{value:"all",label:"All"}],LU=[{value:"card",label:"Card"},{value:"pill",label:"Pill"}],OU=120;function IU(e){if(e==="tight")return 0;if(e==="wide")return OU}function zU(){const e=Re(c=>c.graphLayout),t=Re(c=>c.setGraphLayout),n=Re(c=>c.showAllRelations),a=Re(c=>c.toggleShowAllRelations),s=Re(c=>c.showInterLayerNodes),o=Re(c=>c.toggleShowInterLayerNodes),l=Re(c=>c.view);return h.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:"8px 16px"},"data-testid":"graph-header-controls",children:[h.jsx(Fl,{label:"Layout",testId:"graph-layout-control",inline:!0,children:h.jsx(Wi,{value:e,onChange:c=>t(c),options:RU})}),h.jsx(Fl,{label:"Relations",testId:"graph-relations-control",inline:!0,children:h.jsx(Wi,{value:n?"all":"structural",onChange:c=>{c==="all"!==n&&a()},options:DU})}),l==="model"&&h.jsx(Fl,{label:"Inter-layer",testId:"graph-inter-layer-control",inline:!0,children:h.jsx(Wi,{value:s?"on":"off",onChange:c=>{c==="on"!==s&&o()},options:sk})})]})}const BU=200;function UU(){const[e,t]=T.useState(!1),n=T.useRef(null),a=T.useRef(null),s=T.useRef(!1),o=Re(C=>C.graphLayout),l=Re(C=>C.showClusterBoundaries),c=Re(C=>C.toggleClusterBoundaries),u=Re(C=>C.nodeMarginPreset),f=Re(C=>C.setNodeMarginPreset),m=Re(C=>C.nodeDisplay),p=Re(C=>C.setNodeDisplay),y=Re(C=>C.view),v=()=>{a.current&&clearTimeout(a.current),a.current=null},x=()=>{v(),t(!0)},b=()=>{v(),t(!1)};T.useEffect(()=>v,[]);const w=C=>{if(!C.currentTarget.contains(C.relatedTarget)){if(C.type==="blur"){b();return}v(),a.current=setTimeout(()=>{a.current=null,t(!1)},BU)}};return h.jsx("div",{style:{position:"absolute",top:14,left:14,right:14,zIndex:1,pointerEvents:"none"},"data-testid":"graph-controls",children:h.jsxs("div",{onMouseEnter:x,onMouseLeave:w,onFocus:()=>{if(s.current){s.current=!1;return}x()},onBlur:w,onKeyDown:C=>{var N;C.key==="Escape"&&(b(),s.current=!0,(N=n.current)==null||N.focus())},style:{display:"inline-flex",flexDirection:"column",alignItems:"flex-start",maxWidth:"100%",pointerEvents:"auto"},"data-testid":"graph-controls-flyout",children:[h.jsx("button",{ref:n,type:"button",className:"graph-toolbar__btn","aria-label":"Graph display options","aria-expanded":e,"aria-controls":"graph-controls-panel","data-testid":"graph-controls-toggle",onClick:x,style:{background:"transparent"},children:h.jsx(He,{name:"settings",size:16})}),e&&h.jsx("div",{style:{paddingTop:6,maxWidth:"100%",boxSizing:"border-box"},children:h.jsxs("div",{id:"graph-controls-panel",style:{display:"grid",gridTemplateColumns:"auto auto",justifyContent:"start",columnGap:14,rowGap:8,width:"fit-content",maxWidth:"100%",boxSizing:"border-box",padding:"10px 14px",background:"rgb(var(--canvas-card) / 0.5)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"1px solid rgb(var(--canvas-border))",borderRadius:"var(--radius-lg)",boxShadow:"var(--shadow-md)"},"data-testid":"graph-controls-panel",children:[y==="model"&&h.jsx(Fl,{label:"Display",testId:"graph-display-control",children:h.jsx(Wi,{value:m,onChange:C=>p(C),options:LU})}),h.jsx(Fl,{label:"Node margin",testId:"graph-margin-control",children:h.jsx(Wi,{value:u,onChange:C=>f(C),options:AU})}),TU.has(o)&&h.jsx(Fl,{label:"Boundaries",testId:"graph-boundaries-control",children:h.jsx(Wi,{value:l?"on":"off",onChange:C=>{C==="on"!==l&&c()},options:sk})})]})})]})})}function Fl({label:e,testId:t,inline:n=!1,children:a}){return h.jsxs("div",{style:{display:"flex",flexDirection:n?"row":"column",alignItems:n?"center":"flex-start",gap:n?8:6},"data-testid":t,children:[h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,textTransform:"uppercase",letterSpacing:"0.08em",color:"rgb(var(--canvas-fg-3))"},children:e}),a]})}function $f({message:e}){return h.jsx("div",{style:{flex:1,display:"grid",placeItems:"center",color:"rgb(var(--canvas-fg-3))",fontFamily:"'JetBrains Mono',monospace",fontSize:12},"data-testid":"canvas-empty",children:e})}function FU(){var ze;const e=Re(X=>X.view),t=Re(X=>X.layerId),n=Re(X=>X.selectedId),a=Re(X=>X.highlightedEdgeId),s=Re(X=>X.selectGraphNode),o=Re(X=>X.selectLayer),l=Re(X=>X.navigateToElement),c=Re(X=>X.navSeq),u=Re(X=>X.mode),f=Re(X=>X.setMode),m=Re(X=>X.graphLayout),p=Re(X=>X.showClusterBoundaries),y=Re(X=>X.showAllRelations),v=Re(X=>X.nodeMarginPreset),x=Re(X=>X.nodeDisplay),b=Re(X=>X.showInterLayerNodes),w=qB(),C=u==="page",N=IU(v),k=T.useRef(null),M=Wf({view:e,layerId:t,graphLayout:m,nodeMarginPreset:v,nodeDisplay:x,showInterLayerNodes:b}),D=jU(M),[j,A]=T.useState(null),O=!(j&&j.id===n&&j.navSeq===c),R=T.useCallback(X=>{A({id:X,navSeq:Re.getState().navSeq}),s(X)},[s]),{derived:E}=Ls(),{derived:I,raw:L}=Os(),H=e==="spec",U=T.useMemo(()=>Fh(E),[E]),$=T.useMemo(()=>{if(!t||H||!b)return{foreignNodes:[],crossEdges:[],foreignNodeIds:new Set};let X=gB(E,t,U);return y||(X=yB(X,E,t,U)),X},[t,H,b,E,U,y]),{nodes:P,cardData:G}=T.useMemo(()=>{if(!t)return{nodes:[],cardData:new Map};if(H)return{nodes:tB(L,t),cardData:new Map};const{nodes:X,cardData:ke}=pB(E,t,U);return{nodes:[...X,...$.foreignNodes],cardData:ke}},[H,L,E,t,U,$.foreignNodes]),K=T.useCallback((X,ke,we)=>{if($.foreignNodeIds.has(X.id)){const tt=()=>{var Ke;return l(X.id,(Ke=X.domainColor)!=null?Ke:"")};return h.jsx("div",{style:{opacity:.6},"data-testid":`foreign-node-wrapper-${X.id}`,children:h.jsx(Wy,{id:X.id,label:X.label,kind:X.kind,domainColor:X.domainColor,selected:ke,onSelect:tt,spec:L,typeId:void 0,hasChildren:we==null?void 0:we.hasChildren,collapsed:we==null?void 0:we.collapsed,hiddenDescendantCount:we==null?void 0:we.hiddenDescendantCount,onToggleCollapse:we==null?void 0:we.onToggleCollapse})})}return h.jsx(_U,{id:X.id,label:X.label,kind:X.kind,domainColor:X.domainColor,selected:ke,onSelect:R,cardData:G.get(X.id),spec:L,hasChildren:we==null?void 0:we.hasChildren,collapsed:we==null?void 0:we.collapsed,hiddenDescendantCount:we==null?void 0:we.hiddenDescendantCount,onToggleCollapse:we==null?void 0:we.onToggleCollapse})},[R,l,G,L,$.foreignNodeIds]),se=T.useCallback((X,ke,we)=>{var ye;const $e=$.foreignNodeIds.has(X.id),Ke=($e?()=>{var Se;return l(X.id,(Se=X.domainColor)!=null?Se:"")}:void 0)||R,dt=h.jsx(Wy,{id:X.id,label:X.label,kind:X.kind,domainColor:X.domainColor,selected:ke,onSelect:Ke,spec:L,typeId:H?Ji((ye=X.domainColor)!=null?ye:"",X.id):void 0,hasChildren:we==null?void 0:we.hasChildren,collapsed:we==null?void 0:we.collapsed,hiddenDescendantCount:we==null?void 0:we.hiddenDescendantCount,onToggleCollapse:we==null?void 0:we.onToggleCollapse});return $e?h.jsx("div",{style:{opacity:.6},"data-testid":`foreign-node-wrapper-${X.id}`,children:dt}):dt},[R,l,L,H,$.foreignNodeIds]),{selectedEdgeId:V,edgeSelectionProps:re}=CU(),fe=T.useMemo(()=>t?H?aB(L,t):[...fB(E,t,U),...$.crossEdges].map(we=>we.id===V||we.id===a?Z(F({},we),{variant:"hot"}):we):[],[H,L,E,t,U,V,a,$.crossEdges]),{dwelledId:B,onHover:W}=wU(JN),ae=T.useMemo(()=>{if(H||!B)return null;const X=d1(E,B,U,L);return X?h.jsx(WN,{predicate:X.predicate,sourceTypeLabel:X.sourceNode.type,destinationTypeLabel:X.targetNode.type,"data-testid":"edge-predicate-tooltip"}):null},[H,B,E,U,L]),J=t!=null?t:"",le=((ze=I.byLayer[J])==null?void 0:ze.standard)||Uh(J),be=H?`META-MODEL${le?` · ${le}`:""}`:`INSTANCE MODEL${le?` · ${le}`:""}`,je=t?H?`${Ka(J)} schema`:Ka(J):H?"Schema":"Model",De=T.useMemo(()=>{var X,ke,we;if(!t)return"";if(H){const $e=(ke=(X=I.byLayer[J])==null?void 0:X.typeCount)!=null?ke:0,tt=UN(L,J);return`${$e} node types · ${tt} relationships`}return`${(we=E.countsByLayer[J])!=null?we:0} elements`},[H,t,J,I,L,E]),Ae=H?"select a layer to view its schema":"select a layer to view its instance model",Xe=H?"no node types in this layer":"no elements in this layer",Fe=C&&w?w.color:yi(J),me=C&&w?w.eyebrow:be,Q=C&&w?w.title:je,ue=C&&w?w.idChip:t!=null?t:e,xe=C&&w?w.meta:De;return h.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,background:"rgb(var(--canvas-bg))",borderTopLeftRadius:8,overflow:"hidden"},"data-testid":"canvas",children:[h.jsx(Tv,{className:"canvas-header",style:{flex:"none",padding:"16px 22px 14px"},eyebrow:h.jsxs(h.Fragment,{children:[h.jsx("span",{style:{width:10,height:10,borderRadius:3,flex:"none",background:Fe,display:"inline-block"}}),h.jsx("span",{children:me})]}),title:Q,idChip:ue,actions:h.jsxs(h.Fragment,{children:[h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--canvas-fg-3))",marginRight:8},children:xe}),!C&&t&&h.jsx(zU,{}),h.jsx(Wi,{value:u,onChange:X=>f(X),options:EU,"data-testid":"canvas-mode-toggle"})]})}),h.jsx("div",{ref:k,style:{flex:1,position:"relative",minHeight:0},children:C?t?w?h.jsx(tU,{pg:w}):h.jsx($f,{message:"select a node to view its page"}):h.jsx($f,{message:Ae}):h.jsxs(h.Fragment,{children:[t?P.length===0?h.jsx($f,{message:Xe}):h.jsxs(h.Fragment,{children:[h.jsx(o1,Z(F(Z(F({nodes:P,edges:fe,selectedNodeId:n!=null?n:void 0,onNodeSelect:X=>{if($.foreignNodeIds.has(X)){const ke=U.byUuid.get(X);ke&&l(ke.id,ke.layer_id)}else R(X)}},H?{}:re),{onEdgeHover:H?void 0:W,onBackgroundClick:()=>o(t),renderNode:!H&&x==="card"?K:se,centerOnSelect:O}),D),{fullscreenContainerRef:k,layout:m,nodeMargin:N,showClusterBoundaries:p,isStructuralEdge:PN,showAllRelations:y,toolbarPosition:"bottom-left",fitView:!0,fitPadding:40,style:{position:"absolute",inset:0,width:"100%",height:"100%"}}),M),h.jsx(UU,{}),B&&ae&&h.jsx(QN,{getAnchorRect:()=>SU(k.current,B),content:ae,track:!0,passThrough:!0,"data-testid":"edge-predicate-tooltip-card"},B)]}):h.jsx($f,{message:Ae}),h.jsx(bU,{})]})})]})}function $U(e){return e==="staged"?"#FBBF24":"#10B981"}function cS({message:e}){return h.jsx("div",{style:{flex:1,display:"grid",placeItems:"center",color:"rgb(var(--canvas-fg-3))",fontFamily:"'JetBrains Mono',monospace",fontSize:12},"data-testid":"changeset-canvas-empty",children:e})}function PU({row:e}){const[t,n]=T.useState(!1),a=Re(o=>o.canvasDark),s=t&&e.hasDiff?P9(e.raw):[];return h.jsxs("div",{style:{background:"rgb(var(--canvas-card))",border:"1px solid rgb(var(--canvas-border))",borderRadius:8,overflow:"hidden"},"data-testid":"changeset-row","data-op":e.op,children:[h.jsxs("div",{role:e.hasDiff?"button":void 0,tabIndex:e.hasDiff?0:void 0,onClick:e.hasDiff?()=>n(o=>!o):void 0,onKeyDown:e.hasDiff?o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n(l=>!l))}:void 0,style:{display:"flex",alignItems:"flex-start",gap:12,padding:"12px 14px",cursor:e.hasDiff?"pointer":"default"},children:[h.jsx("span",{style:{flex:"none",fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.05em",textTransform:"uppercase",padding:"3px 8px",borderRadius:4,width:42,textAlign:"center",background:e.meta.background,color:a?e.meta.color:e.meta.colorLight},"data-testid":"changeset-op-badge",children:e.meta.label}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,minWidth:0,flex:1},children:[h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:12,color:"rgb(var(--canvas-fg-1))",wordBreak:"break-all"},children:e.elementId}),h.jsx("span",{style:{fontSize:12,color:"rgb(var(--canvas-fg-3))",lineHeight:1.45},children:e.detail})]}),e.layerName&&h.jsx("span",{style:{flex:"none",fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))",alignSelf:"center"},children:e.layerName})]}),t&&e.hasDiff&&h.jsx("div",{style:{borderTop:"1px solid rgb(var(--canvas-border))",padding:"10px 14px 14px"},children:s.length>0?h.jsx(Dv,{lines:s}):h.jsx("div",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--canvas-fg-3))"},children:"no field-level changes"})})]})}function HU(){var c,u,f,m,p,y;const e=Re(v=>v.changesetId),{derived:t}=td(),{detail:n}=zN(e),a=t.list.find(v=>v.id===e),s=(u=(c=n==null?void 0:n.name)!=null?c:a==null?void 0:a.name)!=null?u:"",o=(m=(f=n==null?void 0:n.status)!=null?f:a==null?void 0:a.status)!=null?m:"unknown",l=(y=(p=n==null?void 0:n.changesCount)!=null?p:a==null?void 0:a.changesCount)!=null?y:0;return h.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,background:"rgb(var(--canvas-bg))",borderTopLeftRadius:8,overflow:"hidden"},"data-testid":"canvas",children:[e&&h.jsx(Tv,{style:{flex:"none",padding:"16px 22px 14px"},eyebrow:h.jsxs(h.Fragment,{children:[h.jsx("span",{style:{width:10,height:10,borderRadius:3,flex:"none",background:$U(o),display:"inline-block"}}),h.jsx("span",{children:"CHANGESET"})]}),title:s,idChip:o,actions:h.jsxs("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--canvas-fg-3))"},children:[l," changes"]})}),h.jsx("div",{style:{flex:1,position:"relative",minHeight:0},children:e?n?h.jsxs("div",{className:"drv-scroll",style:{position:"absolute",inset:0,overflowY:"auto",padding:"20px 22px"},"data-testid":"changeset-list",children:[h.jsx("p",{style:{fontSize:13,color:"rgb(var(--canvas-fg-2))",margin:"0 0 18px 0",maxWidth:620,lineHeight:1.5},children:H9(n.name,n.stats)}),h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,maxWidth:760},children:n.rows.map(v=>h.jsx(PU,{row:v},v.key))})]}):h.jsx(cS,{message:"loading changeset…"}):h.jsx(cS,{message:"select a changeset to view its changes"})})]})}function uS(e){return e==="staged"?{color:"amber",label:"STAGED"}:e==="discarded"?{color:"neutral",label:"DISCARDED"}:e==="committed"?{color:"emerald",label:"COMMITTED"}:{color:"neutral",label:e.toUpperCase()}}function dS(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Jg({label:e,value:t}){return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:e}),h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:12,color:"rgb(var(--canvas-fg-1))",wordBreak:"break-all"},children:t})]})}function fS(e,t){return`${e} ${t}${e===1?"":"s"}`}function qU({detail:e,notify:t}){const n=vR(e.id),a=xR(e.id),[s,o]=T.useState(null),[l,c]=T.useState(null),u=n.isPending||a.isPending,f=fS(e.changesCount,"change"),m=p=>{o(null),c(null),(p==="commit"?n:a).mutate(void 0,{onSuccess:v=>{var w;const b=p==="commit"?`Applied ${fS((w=v.committed)!=null?w:e.changesCount,"change")} to the model`:`Discarded ${e.name}`;t("success",b)},onError:v=>c(G9(v))})};return h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},"data-testid":"changeset-actions",children:[h.jsxs("div",{style:{display:"flex",gap:8},children:[h.jsx(Pn,{variant:"accent",size:"sm",disabled:u||e.changesCount===0,onClick:()=>o("commit"),"data-testid":"changeset-apply-button",children:n.isPending?"Applying…":"Apply"}),h.jsx(Pn,{variant:"secondary",size:"sm",disabled:u,onClick:()=>o("discard"),"data-testid":"changeset-discard-button",children:a.isPending?"Discarding…":"Discard"})]}),l&&h.jsx("div",{role:"alert","data-testid":"changeset-action-error",style:{padding:"8px 10px",borderRadius:"var(--radius-md, 6px)",border:"1px solid rgb(var(--status-error) / 0.5)",background:"rgb(var(--status-error) / 0.08)",color:"rgb(var(--canvas-fg-1))",fontFamily:"'JetBrains Mono',monospace",fontSize:11,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:l}),h.jsx(uh,{isOpen:s==="commit",onClose:()=>o(null),onConfirm:()=>m("commit"),title:"Apply changeset",message:`Apply the ${f} in "${e.name}" to the model? They are validated first, and nothing is written if any change fails.`,confirmLabel:"Apply",variant:"primary"}),h.jsx(uh,{isOpen:s==="discard",onClose:()=>o(null),onConfirm:()=>m("discard"),title:"Discard changeset",message:`Throw away the ${f} in "${e.name}"? The model is not changed, and this can't be undone.`,confirmLabel:"Discard",variant:"danger"})]})}function VU(){const e=Re(o=>o.changesetId),{detail:t}=zN(e),[n,a]=T.useState({open:!1,variant:"success",title:""}),s=(o,l)=>a({open:!0,variant:o,title:l});return h.jsxs("div",{style:{width:320,flex:"none",borderLeft:"1px solid rgb(var(--canvas-border))",background:"rgb(var(--canvas-surface))",display:"flex",flexDirection:"column",minHeight:0},"data-testid":"inspector",children:[!e||!t?h.jsx("div",{style:{flex:1,display:"grid",placeItems:"center",padding:24,textAlign:"center",color:"rgb(var(--canvas-fg-3))",fontFamily:"'JetBrains Mono',monospace",fontSize:12},"data-testid":"changeset-inspector-empty",children:e?"loading changeset…":"Select a changeset to inspect."}):h.jsxs(h.Fragment,{children:[h.jsxs("div",{style:{flex:"none",padding:"16px 16px 14px",borderBottom:"1px solid rgb(var(--canvas-border))"},children:[h.jsx("div",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:10,letterSpacing:"0.1em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))",marginBottom:6},children:"CHANGESET"}),h.jsx("div",{style:{fontSize:16,fontWeight:600,color:"rgb(var(--canvas-fg-1))",lineHeight:1.3},children:t.name}),h.jsxs("div",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,color:"rgb(var(--canvas-fg-3))",marginTop:4},children:[t.changesCount," changes"]})]}),h.jsxs("div",{className:"drv-scroll",style:{flex:1,minHeight:0,overflowY:"auto",padding:16,display:"flex",flexDirection:"column",gap:16},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsx(_v,{color:uS(t.status).color,"aria-label":t.status}),h.jsx("span",{style:{fontFamily:"'JetBrains Mono',monospace",fontSize:11,letterSpacing:"0.06em",color:"rgb(var(--canvas-fg-2))"},children:uS(t.status).label})]}),t.status==="staged"&&h.jsx(qU,{detail:t,notify:s},t.id),h.jsxs("div",{style:{display:"flex",gap:8},children:[h.jsx(Xf,{label:"Added",value:t.stats.additions,color:"emerald",style:{flex:1,padding:11}}),h.jsx(Xf,{label:"Modified",value:t.stats.modifications,color:"cyan",style:{flex:1,padding:11}}),h.jsx(Xf,{label:"Deleted",value:t.stats.deletions,color:"rose",style:{flex:1,padding:11}})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[h.jsx(Jg,{label:"Created",value:dS(t.created)}),h.jsx(Jg,{label:"Modified",value:dS(t.modified)}),t.baseSnapshot&&h.jsx(Jg,{label:"Base Snapshot",value:t.baseSnapshot})]})]})]}),h.jsx(Ev,{isOpen:n.open,onClose:()=>a(o=>Z(F({},o),{open:!1})),variant:n.variant,title:n.title})]})}class st extends Error{constructor(t,n,a){super(n),this.code=t,this.context=a,this.name="ChatValidationError"}}function Pf(e){if(typeof e!="string"||e.trim().length===0)throw new st("INVALID_MESSAGE_ID","Message ID must be a non-empty string",{id:e})}function rk(e){if(!e||typeof e!="object")throw new st("INVALID_CONTENT","Content must be an object",{content:e});const t=e,n=t.type;if(typeof n!="string")throw new st("INVALID_CONTENT_TYPE","Content must have a type field that is a string",{type:n});if(typeof t.timestamp!="string")throw new st("MISSING_TIMESTAMP","Content must have a timestamp field",{timestamp:t.timestamp});switch(n){case"text":{if(typeof t.content!="string")throw new st("INVALID_TEXT_CONTENT","Text content must have a content field that is a string",{content:t.content});break}case"tool_invocation":{if(typeof t.toolUseId!="string"||t.toolUseId.length===0)throw new st("INVALID_TOOL_USE_ID","Tool invocation must have a non-empty toolUseId",{toolUseId:t.toolUseId});if(typeof t.toolName!="string")throw new st("INVALID_TOOL_NAME","Tool invocation must have a toolName field",{toolName:t.toolName});if(!t.toolInput||typeof t.toolInput!="object")throw new st("INVALID_TOOL_INPUT","Tool invocation must have a toolInput field",{toolInput:t.toolInput});if(!t.status||typeof t.status!="object")throw new st("INVALID_TOOL_STATUS","Tool invocation must have a status field",{status:t.status});break}case"thinking":{if(typeof t.content!="string")throw new st("INVALID_THINKING_CONTENT","Thinking content must have a content field that is a string",{content:t.content});break}case"usage":{if(typeof t.inputTokens!="number")throw new st("INVALID_USAGE","Usage content must have an inputTokens field that is a number",{inputTokens:t.inputTokens});if(typeof t.outputTokens!="number")throw new st("INVALID_USAGE","Usage content must have an outputTokens field that is a number",{outputTokens:t.outputTokens});if(typeof t.totalTokens!="number")throw new st("INVALID_USAGE","Usage content must have a totalTokens field that is a number",{totalTokens:t.totalTokens});if(typeof t.totalCostUsd!="number")throw new st("INVALID_USAGE","Usage content must have a totalCostUsd field that is a number",{totalCostUsd:t.totalCostUsd});break}case"error":{if(typeof t.code!="string")throw new st("INVALID_ERROR","Error content must have a code field that is a string",{code:t.code});if(typeof t.message!="string")throw new st("INVALID_ERROR","Error content must have a message field that is a string",{message:t.message});break}default:throw new st("UNKNOWN_CONTENT_TYPE",`Unknown content type: ${n}. Must be one of: text, tool_invocation, thinking, usage, error`,{type:n})}}function GU(e){if(!e||typeof e!="object")throw new st("INVALID_MESSAGE","Message must be an object",{message:e});const t=e;if(typeof t.id!="string"||t.id.length===0)throw new st("INVALID_MESSAGE_ID","Message must have a non-empty id field",{id:t.id});if(typeof t.role!="string")throw new st("INVALID_ROLE","Message must have a role field that is a string",{role:t.role});const n=["user","assistant","system"];if(!n.includes(t.role))throw new st("INVALID_ROLE_VALUE",`Role must be one of: ${n.join(", ")}`,{role:t.role});if(typeof t.conversationId!="string"||t.conversationId.length===0)throw new st("INVALID_CONVERSATION_ID","Message must have a non-empty conversationId field",{conversationId:t.conversationId});if(typeof t.timestamp!="string"||t.timestamp.length===0)throw new st("INVALID_TIMESTAMP","Message must have a non-empty timestamp field",{timestamp:t.timestamp});if(!Array.isArray(t.parts))throw new st("INVALID_PARTS","Message must have a parts field that is an array",{parts:t.parts});for(let a=0;a<t.parts.length;a++)try{rk(t.parts[a])}catch(s){throw s instanceof st?new st(s.code,`Invalid content at parts[${a}]: ${s.message}`,Z(F({},s.context),{partIndex:a})):s}if(t.isStreaming!==void 0&&typeof t.isStreaming!="boolean")throw new st("INVALID_STREAMING_FLAG","isStreaming must be a boolean",{isStreaming:t.isStreaming})}function YU(e){if(!e||typeof e!="object")throw new st("INVALID_SDK_STATUS","SDK status must be an object",{status:e});const t=e;if(typeof t.sdkAvailable!="boolean")throw new st("INVALID_SDK_AVAILABLE","sdkAvailable must be a boolean",{sdkAvailable:t.sdkAvailable});if(t.sdkVersion!==null&&typeof t.sdkVersion!="string")throw new st("INVALID_SDK_VERSION","sdkVersion must be a string or null",{sdkVersion:t.sdkVersion});if(t.errorMessage!==null&&typeof t.errorMessage!="string")throw new st("INVALID_ERROR_MESSAGE","errorMessage must be a string or null",{errorMessage:t.errorMessage})}function XU(e){if(e!==null&&(typeof e!="string"||e.length===0))throw new st("INVALID_CONVERSATION_ID","Conversation ID must be a non-empty string or null",{id:e})}function KU(e){if(e!==null&&typeof e!="string")throw new st("INVALID_ERROR_MESSAGE","Error message must be a string or null",{error:e})}function QU(e){if(!e||typeof e!="object")throw new st("INVALID_UPDATES","Updates must be an object",{updates:e});const t=e;if(t.id!==void 0&&(typeof t.id!="string"||t.id.length===0))throw new st("INVALID_ID_UPDATE","Updated id must be a non-empty string",{id:t.id});if(t.role!==void 0){const n=["user","assistant","system"];if(!n.includes(t.role))throw new st("INVALID_ROLE_UPDATE",`Updated role must be one of: ${n.join(", ")}`,{role:t.role})}if(t.conversationId!==void 0&&(typeof t.conversationId!="string"||t.conversationId.length===0))throw new st("INVALID_CONVERSATION_ID_UPDATE","Updated conversationId must be a non-empty string",{conversationId:t.conversationId});if(t.timestamp!==void 0&&typeof t.timestamp!="string")throw new st("INVALID_TIMESTAMP_UPDATE","Updated timestamp must be a string",{timestamp:t.timestamp});if(t.isStreaming!==void 0&&typeof t.isStreaming!="boolean")throw new st("INVALID_STREAMING_UPDATE","Updated isStreaming must be a boolean",{isStreaming:t.isStreaming});if(t.parts!==void 0)throw new st("INVALID_PARTS_UPDATE","Parts cannot be directly updated - use appendPart or appendTextContent instead",{parts:t.parts})}function ZU(e){if(!e||typeof e!="object")throw new st("INVALID_UPDATES","Updates must be an object",{updates:e});const t=e;if(t.toolName!==void 0&&(typeof t.toolName!="string"||t.toolName.length===0))throw new st("INVALID_TOOL_NAME","Updated toolName must be a non-empty string",{toolName:t.toolName});if(t.toolInput!==void 0&&(typeof t.toolInput!="object"||t.toolInput===null))throw new st("INVALID_TOOL_INPUT","Updated toolInput must be an object",{toolInput:t.toolInput});if(t.status!==void 0){if(typeof t.status!="object"||t.status===null)throw new st("INVALID_TOOL_STATUS","Updated status must be an object",{status:t.status});const n=t.status,a=["executing","completed","failed"];if(!a.includes(n.state))throw new st("INVALID_STATUS_STATE",`Updated status state must be one of: ${a.join(", ")}`,{state:n.state})}}const ea=Sh((e,t)=>({messages:[],activeConversationId:null,isStreaming:!1,sdkStatus:null,error:null,setActiveConversationId:n=>{XU(n),e({activeConversationId:n})},setStreaming:n=>{if(typeof n!="boolean")throw new st("INVALID_STREAMING_FLAG","isStreaming must be a boolean",{isStreaming:n});e({isStreaming:n})},setSdkStatus:n=>{n!==null&&YU(n),e({sdkStatus:n})},setError:n=>{KU(n),e({error:n})},reset:()=>e({messages:[],activeConversationId:null,isStreaming:!1,sdkStatus:null,error:null}),addMessage:n=>{GU(n);const s=t();if(s.messages.length>=1e3)throw new st("MAX_MESSAGES_EXCEEDED","Cannot add message: maximum limit of 1000 messages reached",{currentCount:s.messages.length,maxLimit:1e3});s.activeConversationId&&n.conversationId!==s.activeConversationId&&console.warn(`Message conversationId "${n.conversationId}" does not match active conversationId "${s.activeConversationId}"`),e(o=>({messages:[...o.messages,n]}))},updateMessage:(n,a)=>{if(Pf(n),QU(a),!t().messages.some(l=>l.id===n))throw new st("MESSAGE_NOT_FOUND",`Message with id "${n}" not found`,{id:n});e(l=>({messages:l.messages.map(c=>c.id===n?F(F({},c),a):c)}))},deleteMessage:n=>{Pf(n),e(a=>({messages:a.messages.filter(s=>s.id!==n)}))},appendPart:(n,a)=>{Pf(n),rk(a);const l=t().messages.find(c=>c.id===n);if(!l)throw new st("MESSAGE_NOT_FOUND",`Message with id "${n}" not found`,{messageId:n});if(l.parts.length>=500)throw new st("MAX_PARTS_EXCEEDED","Cannot append part: maximum limit of 500 parts per message reached",{messageId:n,currentCount:l.parts.length,maxLimit:500});e(c=>({messages:c.messages.map(u=>{if(u.id===n){const f=Z(F({},a),{timestamp:a.timestamp&&a.timestamp.length>0?a.timestamp:new Date().toISOString()});return Z(F({},u),{parts:[...u.parts,f]})}return u})}))},appendTextContent:(n,a)=>{if(Pf(n),typeof a!="string")throw new st("INVALID_TEXT_CONTENT","Content must be a string",{content:a});const l=t().messages.find(f=>f.id===n);if(!l)throw new st("MESSAGE_NOT_FOUND",`Message with id "${n}" not found`,{messageId:n});const c=l.parts[l.parts.length-1];if(!(c&&c.type==="text")&&l.parts.length>=500)throw new st("MAX_PARTS_EXCEEDED","Cannot append part: maximum limit of 500 parts per message reached",{messageId:n,currentCount:l.parts.length,maxLimit:500});e(f=>({messages:f.messages.map(m=>{if(m.id===n){const p=m.parts[m.parts.length-1];if(p&&p.type==="text"){const v=[...m.parts];return v[m.parts.length-1]=Z(F({},p),{content:p.content+a}),Z(F({},m),{parts:v})}const y={type:"text",content:a,timestamp:new Date().toISOString()};return Z(F({},m),{parts:[...m.parts,y]})}return m})}))},updateToolInvocation:(n,a)=>{if(typeof n!="string"||n.length===0)throw new st("INVALID_TOOL_USE_ID","toolUseId must be a non-empty string",{toolUseId:n});ZU(a);const s=t();let o=!1;for(const l of s.messages){for(const c of l.parts)if(c.type==="tool_invocation"&&"toolUseId"in c&&c.toolUseId===n){o=!0;break}if(o)break}if(!o)throw new st("TOOL_NOT_FOUND",`Tool invocation with toolUseId "${n}" not found`,{toolUseId:n});e(l=>({messages:l.messages.map(c=>Z(F({},c),{parts:c.parts.map(u=>u.type==="tool_invocation"&&"toolUseId"in u&&u.toolUseId===n?F(F({},u),a):u)}))}))},getLastMessage:()=>{const n=t().messages;return n.length>0?n[n.length-1]:void 0},getMessagesByConversation:n=>t().messages.filter(a=>a.conversationId===n),getCurrentStreamingMessage:()=>{const n=t().messages;for(let a=n.length-1;a>=0;a--)if(n[a].isStreaming)return n[a]}})),JU="modulepreload",WU=function(e){return"/"+e},hS={},eF=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let l=function(f){return Promise.all(f.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));s=l(n.map(f=>{if(f=WU(f),f in hS)return;hS[f]=!0;const m=f.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${p}`))return;const y=document.createElement("link");if(y.rel=m?"stylesheet":JU,m||(y.as="script"),y.crossOrigin="",y.href=f,u&&y.setAttribute("nonce",u),document.head.appendChild(y),m)return new Promise((v,x)=>{y.addEventListener("load",v),y.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function o(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return s.then(l=>{for(const c of l||[])c.status==="rejected"&&o(c.reason);return t().catch(o)})};class y1 extends Error{constructor(t,n,a){super(a),this.code=t,this.rpcError=n,this.name="JsonRpcErrorResult",Object.setPrototypeOf(this,y1.prototype)}}class tF{constructor(){Lt(this,"pendingRequests",new Map);Lt(this,"notificationHandlers",new Map);Lt(this,"requestTimeout",3e4);Lt(this,"requestIdCounter",1);Lt(this,"messageListenerAttached",!1);Lt(this,"messageListenerAttachmentInProgress",!1);Lt(this,"cachedWebSocketClient",null);this.ensureMessageListenerAttached()}getWebSocketClient(){return ut(this,null,function*(){if(this.cachedWebSocketClient)return this.cachedWebSocketClient;try{const t=yield eF(()=>Promise.resolve().then(()=>D9),void 0);return this.cachedWebSocketClient=t.websocketClient,this.cachedWebSocketClient}catch(t){throw tn(Qt.JSONRPC_WEBSOCKET_LOAD_FAILED,"Failed to load WebSocket client - JSON-RPC communication will not be available",{},t instanceof Error?t:new Error(String(t))),t}})}ensureMessageListenerAttachedAsync(){return ut(this,null,function*(){if(!this.messageListenerAttached&&!this.messageListenerAttachmentInProgress){this.messageListenerAttachmentInProgress=!0;try{const t=yield this.getWebSocketClient();t.on("message",n=>{try{if(!this.isValidJsonRpcMessage(n)){tn(Qt.JSONRPC_MESSAGE_PARSE_FAILED,"Invalid JSON-RPC message structure - missing required fields",{message:String(n)});return}this.handleMessage(n)}catch(a){a instanceof TypeError?tn(Qt.JSONRPC_MESSAGE_PARSE_FAILED,"Invalid JSON-RPC message structure",{error:a instanceof Error?a.message:String(a),message:String(n)},a instanceof Error?a:new Error(String(a))):tn(Qt.JSONRPC_MESSAGE_HANDLER_ERROR,"Unexpected error while handling JSON-RPC message - possible programming bug",{error:a instanceof Error?a.message:String(a),errorType:a instanceof Error?a.constructor.name:typeof a,message:String(n),stack:a instanceof Error?a.stack:void 0},a instanceof Error?a:new Error(String(a)))}}),t.on("close",()=>this.clearPendingRequests()),this.messageListenerAttached=!0}catch(t){tn(Qt.JSONRPC_ATTACH_LISTENER_FAILED,"Failed to attach message listener to WebSocket - JSON-RPC responses will not be received",{error:t instanceof Error?t.message:String(t)},t instanceof Error?t:new Error(String(t)))}finally{this.messageListenerAttachmentInProgress=!1}}})}ensureMessageListenerAttached(){this.messageListenerAttached||this.messageListenerAttachmentInProgress||this.ensureMessageListenerAttachedAsync().catch(t=>{tn(Qt.JSONRPC_ATTACH_LISTENER_BACKGROUND_FAILED,"Failed to attach message listener in background",{error:t instanceof Error?t.message:String(t)})})}sendRequest(t,n,a){return ut(this,null,function*(){const s=this.generateRequestId(),o={jsonrpc:"2.0",method:t,id:s};return n&&(o.params=n),new Promise((l,c)=>{const u=a!=null?a:this.requestTimeout,f=setTimeout(()=>{this.pendingRequests.delete(s),c(new Error(`JSON-RPC request timeout for method '${t}' after ${u}ms`))},u);this.pendingRequests.set(s,{id:s,method:t,resolve:m=>l(m),reject:c,timeout:f}),this._sendRequestMessage(o,s,f,c)})})}sendNotification(t,n){const a=F({jsonrpc:"2.0",method:t},n&&{params:n});this._sendNotificationMessage(a,t)}_sendRequestMessage(t,n,a,s){return ut(this,null,function*(){try{if(!(yield this.getWebSocketClient()).send(t)){this.pendingRequests.delete(n),clearTimeout(a);const c="Failed to send JSON-RPC request: WebSocket not connected";tn(Qt.JSONRPC_SEND_REQUEST_FAILED,c,{method:t.method}),s(new Error(c))}}catch(o){this.pendingRequests.delete(n),clearTimeout(a);const l=`Failed to send JSON-RPC request: ${o instanceof Error?o.message:"Unknown error"}`;tn(Qt.JSONRPC_SEND_REQUEST_FAILED,l,{error:o instanceof Error?o.message:String(o),method:t.method}),s(new Error(l))}})}_sendNotificationMessage(t,n){return ut(this,null,function*(){try{(yield this.getWebSocketClient()).send(t)||tn(Qt.JSONRPC_SEND_NOTIFICATION_FAILED,`Failed to send notification for method '${n}': WebSocket not connected`,{method:n})}catch(a){tn(Qt.JSONRPC_SEND_NOTIFICATION_FAILED,`Failed to send notification for method '${n}'`,{error:a instanceof Error?a.message:String(a),method:n})}})}onNotification(t,n){this.notificationHandlers.has(t)||this.notificationHandlers.set(t,new Set);const a=this.notificationHandlers.get(t);return a.add(n),()=>{a.delete(n),a.size===0&&this.notificationHandlers.delete(t)}}handleMessage(t){"result"in t||"error"in t?this.handleResponse(t):"method"in t&&!("id"in t)&&this.handleNotification(t)}handleResponse(t){const{id:n}=t,a=this.pendingRequests.get(n);if(!a){const s=`Received JSON-RPC response for unknown request ID: ${n}. This may indicate a timing issue or protocol error.`;tn(Qt.JSONRPC_UNKNOWN_RESPONSE_ID,s,{responseId:n},new Error(s));return}if(this.pendingRequests.delete(n),clearTimeout(a.timeout),"result"in t)a.resolve(t.result);else if("error"in t){const s=this.createError(t.error,a.method);a.reject(s)}}handleNotification(t){const{method:n,params:a}=t;if(!n){wu("Received notification without method");return}const s=this.notificationHandlers.get(n);!s||s.size===0||s.forEach(o=>{try{const l=o(a!=null?a:{});l&&typeof l.then=="function"&&l.catch(c=>{tn(Qt.JSONRPC_NOTIFICATION_HANDLER_ERROR,`Error in notification handler for '${n}'`,{error:c instanceof Error?c.message:String(c),method:n})})}catch(l){tn(Qt.JSONRPC_NOTIFICATION_HANDLER_ERROR,`Error in notification handler for '${n}'`,{error:l instanceof Error?l.message:String(l),method:n})}})}createError(t,n){const a=`JSON-RPC Error (${t.code}): ${t.message} [method: ${n}]`;return new y1(t.code,t,a)}generateRequestId(){return`req-${Date.now()}-${this.requestIdCounter++}`}clearPendingRequests(){this.pendingRequests.forEach(({timeout:n})=>{clearTimeout(n)});const t=new Error("WebSocket connection closed");this.pendingRequests.forEach(({reject:n})=>{n(t)}),this.pendingRequests.clear()}getPendingRequestCount(){return this.pendingRequests.size}static validateRequest(t){if(typeof t!="object"||t===null)return!1;const n=t;return n.jsonrpc==="2.0"&&typeof n.method=="string"&&(n.id===void 0||typeof n.id=="string"||typeof n.id=="number")}static validateResponse(t){if(typeof t!="object"||t===null)return!1;const n=t;return n.jsonrpc!=="2.0"||n.id===void 0&&n.id!==0?!1:"result"in n&&!("error"in n)||"error"in n&&!("result"in n)}isValidJsonRpcMessage(t){if(typeof t!="object"||t===null)return!1;const n=t;if(n.jsonrpc!=="2.0")return!1;const a="id"in n,s="method"in n,o="result"in n,l="error"in n;return a&&(o||l)?o&&!l||!o&&l:!!(s&&!a)}}const gr=new tF,pS={model:"Model (architecture element instances)",spec:"Schema (the meta-model: node types and allowed relationships)",changesets:"Changesets"};function nF(e){const t=[],n=e.view==="changesets"?pS.changesets:`${pS[e.view]}, ${e.mode} view`;if(t.push(`View: ${n}`),e.view==="changesets"){if(!e.changeset)return null;t.push(`Selected changeset: "${e.changeset.name}" (id ${e.changeset.id})`)}else{if(!e.layerId)return null;if(t.push(`Layer: ${e.layerLabel?`${e.layerLabel} (${e.layerId})`:e.layerId}`),e.selectedNode){const a=e.selectedNode;t.push(`Selected element: "${a.name}" (${hc(a)}, type ${a.type}, uuid ${a.id})`)}else if(e.selectedSpecNodeId)t.push(`Selected node type: ${e.selectedSpecNodeId}`);else if(e.selectedEdge){const a=e.selectedEdge;t.push(`Selected relationship: "${a.source.name}" (${a.source.ref}) --${a.predicate}--> "${a.target.name}" (${a.target.ref})`)}else t.push("Nothing selected within the layer.")}return["<viewer-context>","The user is asking from the Documentation Robotics viewer. This is what they have open;",'use it to resolve "this", "here", "this element" and "this layer".',...t,"</viewer-context>"].join(`
|
|
82
|
+
`)}function aF(e,t){return t?`${t}
|
|
83
|
+
|
|
84
|
+
${e}`:e}function mS(e,t,n){switch(e){case"executing":return{state:"executing"};case"completed":return{state:"completed",result:t};case"failed":return{state:"failed",error:n||"Unknown error"};default:return console.warn(`[ChatService] Unknown tool status: "${e}", treating as executing`),{state:"executing"}}}const iF=900*1e3;class sF{constructor(){Lt(this,"currentConversationId",null);Lt(this,"currentRequestId",null);Lt(this,"statuslessToolIds",new Set);Lt(this,"toolIdCounter",0);this.setupNotificationHandlers()}setupNotificationHandlers(){gr.onNotification("chat.response.chunk",t=>{this.handleResponseChunk(t)}),gr.onNotification("chat.tool.invoke",t=>{this.handleToolInvoke(t)}),gr.onNotification("chat.thinking",t=>{this.handleThinking(t)}),gr.onNotification("chat.usage",t=>{this.handleUsage(t)}),gr.onNotification("chat.error",t=>{this.handleError(t)})}getStatus(){return ut(this,null,function*(){var t,n,a,s,o,l;try{const c=yield gr.sendRequest("chat.status",{}),u={sdkAvailable:(n=(t=c.sdkAvailable)!=null?t:c.sdk_available)!=null?n:!1,sdkVersion:(s=(a=c.sdkVersion)!=null?a:c.sdk_version)!=null?s:null,errorMessage:(l=(o=c.errorMessage)!=null?o:c.error_message)!=null?l:null};return ea.getState().setSdkStatus(u),u}catch(c){const u=c instanceof Error?c.message:"Unknown error";tn(Qt.CHAT_GET_STATUS_FAILED,"Failed to get status",{error:u});const f={sdkAvailable:!1,sdkVersion:null,errorMessage:u};throw ea.getState().setSdkStatus(f),c}})}sendMessage(t,n){return ut(this,null,function*(){if(!t.trim())throw new Error("Message cannot be empty");const a=ea.getState(),o={id:this.generateMessageId(),role:"user",conversationId:this.currentConversationId||this.generateConversationId(),timestamp:new Date().toISOString(),parts:[{type:"text",content:t,timestamp:new Date().toISOString()}]};this.currentConversationId=o.conversationId,a.setActiveConversationId(this.currentConversationId),a.addMessage(o);const l=this.generateMessageId(),c={id:l,role:"assistant",conversationId:o.conversationId,timestamp:new Date().toISOString(),parts:[],isStreaming:!0};a.addMessage(c),a.setStreaming(!0),a.setError(null);try{this.currentRequestId=this.generateRequestId();const u=yield gr.sendRequest("chat.send",{message:aF(t,n!=null?n:null)},iF);return this.completeStatuslessTools(),a.updateMessage(l,{isStreaming:!1}),a.setStreaming(!1),u}catch(u){this.completeStatuslessTools(),a.setStreaming(!1);const f=u instanceof Error?u.message:"Unknown error";throw a.setError(f),tn(Qt.CHAT_SEND_FAILED,"Failed to send message",{error:f,message:t}),a.appendPart(l,{type:"error",code:"SEND_FAILED",message:f,timestamp:new Date().toISOString()}),u}})}cancelMessage(){return ut(this,null,function*(){const t=ea.getState();try{const n=yield gr.sendRequest("chat.cancel",{},5e3);return t.setStreaming(!1),n}catch(n){const a=n instanceof Error?n.message:"Unknown error";throw tn(Qt.CHAT_CANCEL_FAILED,"Failed to cancel",{error:a}),t.setStreaming(!1),n}})}handleResponseChunk(t){const n=ea.getState(),a=n.getCurrentStreamingMessage();if(!a){wu("Received response chunk but no streaming message");return}this.completeStatuslessTools(),n.appendTextContent(a.id,t.content)}completeStatuslessTools(){if(this.statuslessToolIds.size===0)return;const t=ea.getState();for(const n of this.statuslessToolIds)try{t.updateToolInvocation(n,{status:{state:"completed",result:void 0}})}catch(a){}this.statuslessToolIds.clear()}handleToolInvoke(t){var u,f,m,p,y;const n=ea.getState(),a=n.getCurrentStreamingMessage();if(!a){wu("Received tool invoke but no streaming message");return}const s=(f=(u=t.toolName)!=null?u:t.tool_name)!=null?f:"tool",o=(p=(m=t.toolInput)!=null?m:t.tool_input)!=null?p:{};if(!t.tool_use_id){this.completeStatuslessTools();const v=`local-tool-${++this.toolIdCounter}`;n.appendPart(a.id,{type:"tool_invocation",toolUseId:v,toolName:s,toolInput:o,status:t.status?mS(t.status,t.result,t.error):{state:"executing"},timestamp:t.timestamp||new Date().toISOString()}),(!t.status||t.status==="executing")&&this.statuslessToolIds.add(v);return}const l=mS((y=t.status)!=null?y:"executing",t.result,t.error),c=a.parts.find(v=>v.type==="tool_invocation"&&v.toolUseId===t.tool_use_id);t.status===void 0?this.statuslessToolIds.add(t.tool_use_id):this.statuslessToolIds.delete(t.tool_use_id),c?n.updateToolInvocation(t.tool_use_id,{status:l}):n.appendPart(a.id,{type:"tool_invocation",toolUseId:t.tool_use_id,toolName:s,toolInput:o,status:l,timestamp:t.timestamp||new Date().toISOString()})}handleThinking(t){const n=ea.getState(),a=n.getCurrentStreamingMessage();if(!a){wu("Received thinking but no streaming message");return}n.appendPart(a.id,{type:"thinking",content:t.content,timestamp:t.timestamp||new Date().toISOString()})}handleUsage(t){const n=ea.getState(),a=n.getCurrentStreamingMessage();if(!a){wu("Received usage but no streaming message");return}n.appendPart(a.id,{type:"usage",inputTokens:t.input_tokens,outputTokens:t.output_tokens,totalTokens:t.total_tokens,totalCostUsd:t.total_cost_usd,timestamp:t.timestamp||new Date().toISOString()})}handleError(t){const n=ea.getState(),a=t.message||"Unknown error";n.setError(a),n.setStreaming(!1);const s=n.getCurrentStreamingMessage();s&&n.appendPart(s.id,{type:"error",code:t.code||"UNKNOWN_ERROR",message:a,timestamp:t.timestamp||new Date().toISOString()})}generateMessageId(){return`msg-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}generateConversationId(){return`conv-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}generateRequestId(){return`req-${Date.now()}-${Math.random().toString(36).substring(2,11)}`}getCurrentConversationId(){return this.currentConversationId}getCurrentRequestId(){return this.currentRequestId}reset(){this.currentConversationId=null,this.currentRequestId=null,ea.getState().reset()}}const rF=new sF;function oF(e){return e==="user"?"user":"bot"}function lF(e){return e==="user"?"You":"DrBot"}function cF(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function uF(e){switch(e.state){case"executing":return"running";case"completed":return"success";case"failed":return"error";default:return"running"}}function gS(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch(t){return String(e)}}function dF(e){var a;const t=[],n=(a=e.toolInput)!=null?a:{};for(const[s,o]of Object.entries(n))t.push({key:s,value:gS(o)});return e.status.state==="completed"&&e.status.result!==void 0?t.push({key:"result",value:gS(e.status.result)}):e.status.state==="failed"&&t.push({key:"error",value:e.status.error}),t}function fF(e){return{name:e.toolName,status:uF(e.status),output:dF(e)}}function hF(e){const t=typeof e.totalCostUsd=="number"&&e.totalCostUsd>0?` · $${e.totalCostUsd.toFixed(4)}`:"";return`${e.totalTokens} tokens (${e.inputTokens} in / ${e.outputTokens} out)${t}`}function pF(e){var m,p;const t=oF(e.role),n=lF(e.role),a=cF(e.timestamp),s=!!e.isStreaming,o=[];let l=0,c=null;const u=(y={})=>F({id:`${e.id}:${l++}`,role:t,senderName:n,timestamp:a,body:"",bodyKind:"markdown",isStreaming:s},y),f=()=>{c&&(o.push(c),c=null)};for(const y of e.parts)switch(y.type){case"text":{const v=(m=y.content)!=null?m:"";c&&c.bodyKind==="markdown"&&!c.toolBlock&&!c.thinkingBlock?c.body+=v:(f(),c=u({body:v}));break}case"thinking":{const v={content:(p=y.content)!=null?p:""};c&&c.bodyKind==="markdown"&&!c.thinkingBlock&&!c.toolBlock?(c.thinkingBlock=v,f()):(f(),o.push(u({thinkingBlock:v})));break}case"tool_invocation":{const v=fF(y);c&&c.bodyKind==="markdown"&&!c.toolBlock?(c.toolBlock=v,f()):(f(),o.push(u({toolBlock:v})));break}case"error":{f(),o.push(u({body:y.message,bodyKind:"error",isStreaming:!1}));break}case"usage":{f(),o.push(u({body:hF(y),bodyKind:"usage",isStreaming:!1}));break}}return f(),o.length===0&&o.push(u({})),o}function mF(e){const t=[];for(const n of e)t.push(...pF(n));return t}const Wg=["What does this element do?","Show cross-layer references","Any unresolved references?","Explain the data-model layer"];function gF({row:e}){return e.bodyKind==="error"?h.jsx("span",{style:{color:"#F43F5E",fontSize:12.5,lineHeight:1.5},"data-testid":"chat-error-line",children:e.body}):e.bodyKind==="usage"?h.jsx("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:10.5,color:"rgb(var(--canvas-fg-3))"},children:e.body}):h.jsx(QC,{content:e.body,isStreaming:e.isStreaming})}function yF(){const e=Re(j=>j.view),t=Re(j=>j.layerId),n=Re(j=>j.selectedId),a=Re(j=>j.changesetId),s=ea(j=>j.messages),o=ea(j=>j.isStreaming),l=ea(j=>j.error),{derived:c}=Ls(),{derived:u}=td(),f=T.useMemo(()=>Fh(c),[c]),m=e==="model"&&n?f.byUuid.get(n):void 0,p=m==null?void 0:m.name,y=t?Ka(t):"",v=T.useMemo(()=>{if(e==="changesets"){const j=u.list.find(A=>A.id===a);return j?j.name:"changesets"}return p||(y?`${y} layer`:"meta-model")},[e,u.list,a,p,y]),x=T.useMemo(()=>p?[`What does ${p} do?`,"Show cross-layer references","Any unresolved references?",y?`Explain the ${y} layer`:Wg[3]]:y?[...Wg.slice(0,3),`Explain the ${y} layer`]:Wg,[p,y]),b=T.useMemo(()=>mF(s),[s]),[w,C]=T.useState(""),N=()=>{var E;const j=Re.getState(),A=I=>{const L=f.byUuid.get(I);return L?{name:L.name,ref:hc(L)}:void 0};let O;if(j.view==="model"&&j.selectedEdgeId){const I=d1(c,j.selectedEdgeId,f,void 0),L=I&&A(I.sourceNode.id),H=I&&A(I.targetNode.id);I&&L&&H&&(O={predicate:I.predicate,source:L,target:H})}const R=j.view==="changesets"?u.list.find(I=>I.id===j.changesetId):void 0;return nF({view:j.view,mode:j.mode,layerId:j.layerId,layerLabel:j.layerId?Ka(j.layerId):void 0,selectedNode:j.view==="model"&&j.selectedId?f.byUuid.get(j.selectedId):void 0,selectedSpecNodeId:j.view==="spec"&&(E=j.selectedId)!=null?E:void 0,selectedEdge:O,changeset:R?{id:R.id,name:R.name}:void 0})},k=j=>{const A=j.trim();!A||o||(C(""),rF.sendMessage(A,N()).catch(()=>{}))},M=s.length<=1,D=h.jsxs(h.Fragment,{children:[l&&h.jsx("div",{role:"alert","data-testid":"chat-store-error",style:{flex:"none",margin:"6px 12px 0 12px",padding:"8px 10px",borderRadius:8,fontSize:12,lineHeight:1.45,color:"#F43F5E",background:"rgba(244,63,94,0.08)",border:"1px solid rgba(244,63,94,0.25)"},children:/-32001|sdk|not (?:installed|available)/i.test(l)?"No chat client is available on the server (the Claude SDK is not installed). The drawer is read-only until it is enabled.":l}),M&&h.jsx("div",{style:{flex:"none",padding:"10px 12px 6px 12px",borderTop:"1px solid rgb(var(--canvas-border))"},children:h.jsx($2,{suggestions:x,onSelect:j=>k(j)})}),h.jsx("div",{style:{flex:"none",padding:"0 8px 10px 8px"},children:h.jsx(P2,{value:w,onChange:C,onSubmit:j=>k(j),scopeLabel:v,placeholder:"Ask about the model…",loading:o})})]});return h.jsx(H2,{composer:D,children:b.map(j=>h.jsx(B2,{role:j.role,senderName:j.senderName,timestamp:j.timestamp,body:h.jsx(gF,{row:j}),toolBlock:j.toolBlock,thinkingBlock:j.thinkingBlock},j.id))})}const yS={width:372,flex:"none",background:"rgb(var(--canvas-bg))",display:"flex",flexDirection:"column",minHeight:0,borderLeft:"1px solid rgb(var(--canvas-border))"},vF={position:"absolute",right:0,top:0,bottom:0,zIndex:30,boxShadow:"-16px 0 44px -22px rgba(0,0,0,0.5)"};function xF(){const e=Re(a=>a.chatOpen),t=Re(a=>a.wide);if(!e)return null;const n=t?yS:F(F({},yS),vF);return h.jsxs("div",{style:n,"data-testid":"chat-drawer","data-mode":t?"pane":"overlay",children:[h.jsxs("div",{style:{height:40,flex:"none",display:"flex",alignItems:"center",gap:8,padding:"0 16px",borderBottom:"1px solid rgb(var(--canvas-border))"},children:[h.jsx("span",{className:"drv-chat-pulse",style:{width:6,height:6,borderRadius:"50%",background:"#FBBF24",display:"inline-block"}}),h.jsx("span",{style:{fontSize:13,fontWeight:600,color:"rgb(var(--canvas-fg-1))"},children:"DrBot"}),h.jsx("span",{style:{fontFamily:"'JetBrains Mono', monospace",fontSize:10,letterSpacing:"0.06em",textTransform:"uppercase",color:"rgb(var(--canvas-fg-3))"},children:"model assistant"})]}),h.jsx("div",{style:{flex:1,minHeight:0,position:"relative"},children:h.jsx("div",{style:{position:"absolute",inset:0},children:h.jsx(yF,{})})})]})}const Hf="data-model",bF="I'm **DrBot**, scoped to the loaded architecture model. Select any element to inspect it, then ask me to explain it, trace its cross-layer references, or validate reference integrity.";function _F(){T.useEffect(()=>{var a;const e=ea.getState();if(e.messages.length>0)return;const t=new Date().toISOString(),n={id:`msg-greeting-${Date.now()}`,role:"assistant",conversationId:(a=e.activeConversationId)!=null?a:"greeting",timestamp:t,parts:[{type:"text",content:bF,timestamp:t}]};e.addMessage(n)},[])}function wF(){const e=Re(m=>m.view),t=Re(m=>m.layerId),n=Re(m=>m.changesetId),a=Re(m=>m.navigateToElement),s=Re(m=>m.navigateToSpecNode),o=Re(m=>m.selectChangeset),{derived:l}=Ls(),{derived:c,raw:u}=Os(),{derived:f}=td();T.useEffect(()=>{var m,p,y;if(e==="changesets"){if(n)return;const v=f.list[0];v&&o(v.id);return}if(!t){if(e==="model"){if(l.nodes.length===0)return;const v=(m=l.nodesByLayer[Hf])!=null&&m.length?Hf:Object.keys(l.nodesByLayer)[0];if(!v)return;const x=(p=l.nodesByLayer[v])==null?void 0:p[0];x&&a(x.id,v);return}if(e==="spec"){if(Object.keys(c.byLayer).length===0)return;const v=(y=c.byLayer[Hf])!=null&&y.typeCount?Hf:DN.find(b=>{var w;return(w=c.byLayer[b])==null?void 0:w.typeCount});if(!v)return;const x=lB(u,v);x&&s(x,v)}}},[e,t,n,l,c,u,f,a,s,o])}function SF(){const t=Re(n=>n.view)==="changesets";return wF(),_F(),Y9(ea(n=>n.isStreaming)),O9(),h.jsxs("div",{style:{height:"100vh",minWidth:880,display:"flex",flexDirection:"column",background:"rgb(var(--shell-bg))",color:"rgb(var(--shell-fg-1))",fontFamily:"Inter, system-ui, sans-serif",overflow:"hidden"},"data-testid":"app-shell",children:[h.jsx(p9,{}),h.jsxs("div",{style:{flex:1,display:"flex",minHeight:0,position:"relative"},children:[h.jsx(W9,{}),t?h.jsx(HU,{}):h.jsx(FU,{}),t&&h.jsx(VU,{}),h.jsx(xF,{})]}),h.jsx(eB,{})]})}function CF(){const e=xv(m=>m.token),t=_u(m=>m.setConnected),n=_u(m=>m.setDisconnected),a=_u(m=>m.setReconnecting),s=_u(m=>m.setError),o=T.useCallback(()=>{console.log("[RootShell] WebSocket connected"),t(),_n.transportMode==="websocket"&&_n.subscribe(["model","changesets","annotations"])},[t]),l=T.useCallback(()=>{console.log("[RootShell] Using REST mode"),t()},[t]),c=T.useCallback(()=>{console.log("[RootShell] WebSocket disconnected"),n()},[n]),u=T.useCallback(m=>{a(m.attempt,m.delay)},[a]),f=T.useCallback(m=>{const p=m.kind==="event"?m.error:`${m.code}: ${m.message}`;console.error("[RootShell] WebSocket error:",p),s("Connection error")},[s]);return T.useEffect(()=>(console.log("[RootShell] Initializing WebSocket connection"),e&&(console.log("[RootShell] Setting authentication token for WebSocket"),_n.setToken(e)),_n.on("connect",o),_n.on("disconnect",c),_n.on("reconnecting",u),_n.on("error",f),_n.on("rest-mode",l),_n.connect(),()=>{_n.off("connect",o),_n.off("disconnect",c),_n.off("reconnecting",u),_n.off("error",f),_n.off("rest-mode",l),_n.disconnect()}),[e,o,c,u,f,l]),h.jsx(e2,{})}const NF={model:"model",spec:"spec",changesets:"changesets"},kF={model:"model",spec:"spec",changesets:"changesets"},MF={model:"graph",spec:"graph",changesets:"list"};function vS(e,t,n,a){return`${e!=null?e:""}|${t!=null?t:""}|${n!=null?n:""}|${a!=null?a:""}`}function jF(){const{section:e,view:t}=Mh({strict:!1}),n=Xu({strict:!1}),a=Re(L=>L.view),s=Re(L=>L.setView),o=Re(L=>L.layerId),l=Re(L=>L.selectedId),c=Re(L=>L.selectedEdgeId),u=Re(L=>L.changesetId),f=Re(L=>L.mode),m=Re(L=>L.setMode),p=Re(L=>L.navSeq),y=Re(L=>L.graphViewport),v=Re(Wf),x=Re(L=>L.setGraphViewport),b=Re(L=>L.selectLayer),w=Re(L=>L.selectNode),C=Re(L=>L.selectEdge),N=Re(L=>L.selectChangeset),{derived:k,isSuccess:M}=Ls(),D=T.useRef(!1),j=T.useRef(a),A=T.useRef(vS(o,l,c,u)),O=T.useRef(f),R=T.useRef(o),E=T.useRef(p),I=T.useRef(void 0);return T.useEffect(()=>{const L=e?NF[e]:void 0;L&&s(L)},[e,s]),T.useEffect(()=>{(t==="graph"||t==="page")&&m(t)},[t,m]),T.useEffect(()=>{if(n.changeset&&n.changeset!==u){N(n.changeset);return}if(n.layer&&n.layer!==o&&b(n.layer),n.edge&&n.edge!==c){if(!M)return;k.links.some(L=>L.id===n.edge)?C(n.edge):tv.navigate({to:".",search:L=>Z(F({},L),{edge:void 0}),replace:!0})}else n.node&&n.node!==l&&w(n.node)},[n.layer,n.node,n.edge,n.changeset,M,k.links]),T.useEffect(()=>{const L=Re.getState(),H=Wf(L),U=kU(n.vp),$=U&&MU(U,H)?U:null,P=L.graphViewport;if(!$){P&&x(null);return}P&&P.scope===H&&ik(P,$)||x({scope:H,center:$.center,zoom:$.zoom})},[e,n.layer,n.vp,x]),T.useEffect(()=>{var J,le,be,je,De,Ae;const L=vS(o,l,c,u);if(!D.current){D.current=!0,j.current=a,A.current=L,O.current=f,R.current=o,E.current=p,I.current=n.vp;return}const H=j.current!==a,U=A.current!==L,$=O.current!==f,P=R.current!==null&&R.current!==o,G=E.current!==p,K=Re.getState(),se=a!=="changesets"&&((J=K.graphViewport)==null?void 0:J.scope)===Wf(K)?NU(K.graphViewport):void 0,V=I.current!==se;if(!H&&!U&&!$&&!G&&!V)return;j.current=a,A.current=L,O.current=f,R.current=o,E.current=p,I.current=se;const re=kF[a],fe=a==="changesets"?MF[re]:f,B=a==="changesets"?{changeset:u!=null?u:void 0}:{layer:o!=null?o:void 0,node:l!=null?l:void 0,edge:c!=null?c:void 0,vp:se},W=e===re&&t===fe&&((le=n.layer)!=null?le:void 0)===B.layer&&((be=n.node)!=null?be:void 0)===B.node&&((je=n.edge)!=null?je:void 0)===B.edge&&((De=n.changeset)!=null?De:void 0)===B.changeset;if(W&&((Ae=n.vp)!=null?Ae:void 0)===B.vp)return;const ae=!W&&(H||$||P||G||f==="page"&&U);tv.navigate({to:"/$section/$view",params:{section:re,view:fe},search:B,replace:!ae})},[a,f,o,l,c,u,p,y,v]),h.jsx(SF,{})}const v1=gE({component:CF}),EF=hv({getParentRoute:()=>v1,path:"/",validateSearch:e=>({token:typeof e.token=="string"?e.token:void 0}),component:wR}),RF=hv({getParentRoute:()=>v1,path:"/$section/$view",validateSearch:e=>({layer:typeof e.layer=="string"?e.layer:void 0,node:typeof e.node=="string"?e.node:void 0,edge:typeof e.edge=="string"?e.edge:void 0,changeset:typeof e.changeset=="string"?e.changeset:void 0,vp:typeof e.vp=="string"?e.vp:void 0}),component:jF}),TF=v1.addChildren([EF,RF]),tv=CE({routeTree:TF,history:KM()}),AF=new URLSearchParams(window.location.search),ey=AF.get("token");if(ey){console.log("[main] Found token in URL query string, storing to localStorage"),localStorage.setItem("dr_auth_token",ey),xv.getState().setToken(ey),console.log("[main] Updated authStore with new token");const e=window.location.pathname+window.location.hash;window.history.replaceState(null,"",e),console.log("[main] URL cleaned, removed token from query string")}dR();const ok=document.getElementById("root");if(!ok)throw new Error("Root element not found");const DF=bR();$M.createRoot(ok).render(h.jsx(ve.StrictMode,{children:h.jsx(JE,{client:DF,children:h.jsx(ME,{router:tv})})}))});export default LF();
|