From 2e1fb325f7e5fe5f7d02cb4bc61f2f14d80c047f Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 16 Jun 2026 03:40:31 +0000 Subject: [PATCH] refactor: move source tree into work/, multi-stage Docker build, fix satpass - Move all application source (meshai/, dashboard-frontend/, tests/, config/, docs/, Dockerfile, etc.) into work/ directory - Add Node.js multi-stage build to Dockerfile for frontend compilation; remove compiled static assets from git tracking - Fix satpass missing time windows: consolidation was splitting wire on newline and only putting line 1 in event.title, dropping the time window line that the composer uses for precomposed broadcasts - Fix satpass burst flooding: stagger consolidation timers (+60s per pending pass) so Central batch publishes don't blast the mesh - Update CI workflow build context to work/ - Anchor lib/ and data/ gitignore patterns to repo root to prevent false matches on nested directories - Add dashboard-frontend/node_modules/ to .dockerignore Co-Authored-By: Claude Opus 4.6 --- .dockerignore | 3 + .github/workflows/docker-publish.yml | 4 +- .gitignore | 10 +- .../dashboard/static/assets/index-Di1mw816.js | 475 - .../static/assets/index-WwNJt5S-.css | 1 - work/Dockerfile | 99 + work/config.example.yaml | 352 + work/config/.env.example | 19 + work/config/local.yaml.example | 57 + .../dashboard-frontend}/index.html | 3 +- work/dashboard-frontend/package.json | 35 + work/dashboard-frontend/postcss.config.js | 6 + .../public}/meshai-icon.png | Bin .../public}/meshai-logo.png | Bin work/dashboard-frontend/src/App.tsx | 36 + .../src/components/ChannelPicker.tsx | 156 + .../src/components/GeoMap.tsx | 267 + .../src/components/Layout.tsx | 185 + .../src/components/NodeDetail.tsx | 248 + .../src/components/NodePicker.tsx | 210 + .../src/components/NodeTable.tsx | 296 + .../src/components/RestartBanner.tsx | 136 + .../src/components/ToastProvider.tsx | 141 + .../src/components/TopologyGraph.tsx | 316 + .../src/hooks/useWebSocket.ts | 109 + work/dashboard-frontend/src/index.css | 76 + work/dashboard-frontend/src/lib/api.ts | 483 + work/dashboard-frontend/src/main.tsx | 13 + .../src/pages/AdapterConfig.tsx | 416 + work/dashboard-frontend/src/pages/Alerts.tsx | 563 + work/dashboard-frontend/src/pages/Config.tsx | 2013 + .../src/pages/Dashboard.tsx | 742 + .../src/pages/Environment.tsx | 1283 + .../src/pages/GaugeSites.tsx | 261 + work/dashboard-frontend/src/pages/Mesh.tsx | 143 + .../src/pages/Notifications.tsx | 2205 + .../src/pages/Reference.tsx | 1551 + .../src/pages/TownAnchors.tsx | 156 + work/dashboard-frontend/src/vite-env.d.ts | 1 + work/dashboard-frontend/tailwind.config.ts | 52 + work/dashboard-frontend/tsconfig.json | 25 + work/dashboard-frontend/tsconfig.node.json | 11 + work/dashboard-frontend/vite.config.ts | 28 + work/docker-compose.yml | 89 + work/docker-entrypoint.sh | 129 + work/docs/handoff_2026-06-09.md | 55 + work/meshai/__init__.py | 4 + work/meshai/__main__.py | 6 + work/meshai/adapter_config/__init__.py | 146 + work/meshai/adapter_config/_accessor.py | 182 + work/meshai/adapter_config/defaults.py | 799 + work/meshai/alert_engine.py | 721 + work/meshai/backends/__init__.py | 13 + work/meshai/backends/anthropic_backend.py | 145 + work/meshai/backends/base.py | 37 + work/meshai/backends/google_backend.py | 143 + work/meshai/backends/openai_backend.py | 159 + work/meshai/central/__init__.py | 6 + work/meshai/central/avy_handler.py | 185 + work/meshai/central/consumer.py | 992 + work/meshai/central/firms_handler.py | 1026 + work/meshai/central/idaho_gauge_sites.py | 52 + work/meshai/central/incident_handler.py | 897 + work/meshai/central/nwis_handler.py | 303 + work/meshai/central/nws_handler.py | 485 + work/meshai/central/pass_predictor.py | 242 + work/meshai/central/quake_handler.py | 246 + work/meshai/central/satpass_handler.py | 570 + work/meshai/central/swpc_handler.py | 461 + work/meshai/central/tle_handler.py | 148 + work/meshai/central/wfigs_handler.py | 523 + work/meshai/central_normalizer.py | 973 + work/meshai/chunker.py | 249 + work/meshai/cli/__init__.py | 5 + work/meshai/cli/configurator.py | 1434 + work/meshai/commands/__init__.py | 6 + work/meshai/commands/alerts_cmd.py | 49 + work/meshai/commands/avy_cmd.py | 55 + work/meshai/commands/base.py | 52 + work/meshai/commands/clear.py | 17 + work/meshai/commands/dispatcher.py | 331 + work/meshai/commands/fire_cmd.py | 40 + work/meshai/commands/health.py | 170 + work/meshai/commands/help.py | 139 + work/meshai/commands/hotspots_cmd.py | 100 + work/meshai/commands/ping.py | 15 + work/meshai/commands/reset.py | 20 + work/meshai/commands/roads_cmd.py | 74 + work/meshai/commands/satpass_cmd.py | 243 + work/meshai/commands/solar_cmd.py | 55 + work/meshai/commands/status.py | 43 + work/meshai/commands/streams_cmd.py | 73 + work/meshai/commands/subscribe.py | 381 + work/meshai/commands/weather.py | 254 + work/meshai/config.py | 941 + work/meshai/config_loader.py | 869 + work/meshai/connector.py | 359 + work/meshai/context.py | 154 + work/meshai/dashboard/__init__.py | 1 + work/meshai/dashboard/api/__init__.py | 1 + .../dashboard/api/adapter_config_routes.py | 317 + work/meshai/dashboard/api/alert_routes.py | 99 + work/meshai/dashboard/api/config_routes.py | 334 + work/meshai/dashboard/api/curation_routes.py | 280 + work/meshai/dashboard/api/debug_routes.py | 33 + work/meshai/dashboard/api/env_routes.py | 303 + .../dashboard/api/gauge_sites_import.py | 283 + work/meshai/dashboard/api/mesh_routes.py | 411 + .../dashboard/api/notification_routes.py | 305 + work/meshai/dashboard/api/system_routes.py | 63 + work/meshai/dashboard/server.py | 141 + work/meshai/dashboard/ws.py | 118 + work/meshai/data/zcta_centroids.csv | 33145 ++++++++++++++++ work/meshai/env/__init__.py | 1 + work/meshai/env/avalanche.py | 350 + work/meshai/env/ducting.py | 460 + work/meshai/env/fires.py | 322 + work/meshai/env/firms.py | 427 + work/meshai/env/nws.py | 270 + work/meshai/env/roads511.py | 426 + work/meshai/env/store.py | 347 + work/meshai/env/swpc.py | 360 + work/meshai/env/traffic.py | 318 + work/meshai/env/usgs.py | 525 + work/meshai/env/usgs_quake.py | 241 + work/meshai/geo.py | 297 + work/meshai/history.py | 329 + work/meshai/knowledge.py | 413 + work/meshai/main.py | 854 + work/meshai/memory.py | 125 + work/meshai/mesh_data_store.py | 2555 ++ work/meshai/mesh_health.py | 848 + work/meshai/mesh_models.py | 255 + work/meshai/mesh_reporter.py | 1746 + work/meshai/mesh_sources.py | 544 + work/meshai/meshmonitor.py | 171 + work/meshai/notifications/__init__.py | 6 + work/meshai/notifications/categories.py | 594 + work/meshai/notifications/channels.py | 839 + work/meshai/notifications/env_reporter.py | 468 + work/meshai/notifications/events.py | 232 + .../meshai/notifications/pipeline/__init__.py | 331 + work/meshai/notifications/pipeline/bus.py | 85 + work/meshai/notifications/pipeline/digest.py | 317 + .../notifications/pipeline/dispatcher.py | 693 + work/meshai/notifications/pipeline/grouper.py | 150 + .../notifications/pipeline/inhibitor.py | 142 + work/meshai/notifications/pipeline/pacer.py | 87 + .../notifications/pipeline/scheduler.py | 213 + .../notifications/pipeline/toggle_filter.py | 70 + work/meshai/notifications/region_tagger.py | 160 + .../notifications/reminders/__init__.py | 395 + .../notifications/renderers/__init__.py | 22 + work/meshai/notifications/renderers/base.py | 28 + .../notifications/renderers/composer.py | 389 + work/meshai/notifications/renderers/email.py | 78 + work/meshai/notifications/renderers/mesh.py | 131 + .../meshai/notifications/renderers/webhook.py | 67 + .../notifications/renderers/work_zone.py | 205 + work/meshai/notifications/router.py | 1037 + .../notifications/scheduled/__init__.py | 27 + .../scheduled/band_conditions.py | 425 + .../notifications/scheduled/fire_digest.py | 290 + work/meshai/notifications/summarizer.py | 64 + work/meshai/persistence/__init__.py | 31 + work/meshai/persistence/curation.py | 241 + work/meshai/persistence/db.py | 212 + work/meshai/persistence/migrations/v1.sql | 289 + work/meshai/persistence/migrations/v10.sql | 29 + work/meshai/persistence/migrations/v11.sql | 40 + work/meshai/persistence/migrations/v12.sql | 17 + work/meshai/persistence/migrations/v13.sql | 86 + work/meshai/persistence/migrations/v14.sql | 56 + work/meshai/persistence/migrations/v15.sql | 31 + work/meshai/persistence/migrations/v16.sql | 17 + work/meshai/persistence/migrations/v17.sql | 34 + work/meshai/persistence/migrations/v18.sql | 17 + work/meshai/persistence/migrations/v2.sql | 31 + work/meshai/persistence/migrations/v3.sql | 25 + work/meshai/persistence/migrations/v4.sql | 18 + work/meshai/persistence/migrations/v5.sql | 69 + work/meshai/persistence/migrations/v6.sql | 42 + work/meshai/persistence/migrations/v7.sql | 34 + work/meshai/persistence/migrations/v8.sql | 28 + work/meshai/persistence/migrations/v9.sql | 24 + work/meshai/responder.py | 53 + work/meshai/router.py | 1004 + work/meshai/scripts/__init__.py | 1 + work/meshai/scripts/migrate_config_v03.py | 736 + work/meshai/sources/__init__.py | 1 + work/meshai/sources/meshmonitor_data.py | 515 + work/meshai/sources/meshview.py | 567 + work/meshai/sources/mqtt_source.py | 435 + work/meshai/subscriptions.py | 278 + work/pyproject.toml | 71 + work/requirements.txt | 16 + work/tests/conftest.py | 52 + .../state_511_atis_01_I-15.json | 60 + .../state_511_atis_02_SH-36.json | 60 + .../state_511_atis_03_I-15.json | 60 + .../state_511_atis_04_US-95.json | 60 + .../state_511_atis_05_W_Prairie_Ave.json | 60 + .../state_511_atis_06_SH-55.json | 60 + .../state_511_atis_07_US-2.json | 60 + .../state_511_atis_08_SH-41.json | 60 + work/tests/test_adapter_avalanche.py | 196 + work/tests/test_adapter_config_api.py | 344 + work/tests/test_adapter_config_foundation.py | 350 + work/tests/test_adapter_ducting.py | 235 + work/tests/test_adapter_fires.py | 176 + work/tests/test_adapter_firms.py | 212 + work/tests/test_adapter_nws.py | 277 + work/tests/test_adapter_roads511.py | 202 + work/tests/test_adapter_swpc.py | 206 + work/tests/test_adapter_traffic.py | 205 + work/tests/test_adapter_usgs.py | 193 + work/tests/test_adapter_usgs_quake.py | 242 + work/tests/test_avalanche_v057.py | 140 + work/tests/test_band_conditions.py | 312 + work/tests/test_bool_roundtrip.py | 148 + work/tests/test_central_consumer.py | 221 + .../test_central_envelope_to_wire_v057.py | 289 + work/tests/test_central_normalizer.py | 804 + work/tests/test_central_region_routing.py | 126 + .../tests/test_central_sub_adapter_routing.py | 94 + work/tests/test_channel_rendering.py | 214 + work/tests/test_cold_start_grace.py | 136 + work/tests/test_config_loader.py | 63 + work/tests/test_config_source_field.py | 50 + work/tests/test_consumer_default_deny.py | 231 + work/tests/test_curation.py | 214 + work/tests/test_dashboard_config_save.py | 40 + work/tests/test_dispatcher_persistence.py | 503 + work/tests/test_env_reporter.py | 289 + work/tests/test_env_reporter_fire_recency.py | 126 + work/tests/test_fire_digest_recency.py | 215 + work/tests/test_fire_tracker_phase1.py | 413 + work/tests/test_fire_tracker_phase2.py | 373 + work/tests/test_fire_tracker_phase3.py | 342 + work/tests/test_fire_tracker_phase4.py | 195 + work/tests/test_fire_v057.py | 262 + work/tests/test_firms_handler.py | 384 + work/tests/test_incident_handler.py | 776 + work/tests/test_include_roundtrip.py | 240 + work/tests/test_itd_511_work_zone.py | 137 + work/tests/test_notification_toggles.py | 136 + work/tests/test_nwis_handler.py | 277 + work/tests/test_nws_dedup_relaxation.py | 140 + work/tests/test_nws_handler.py | 201 + work/tests/test_or_arch_continuous.py | 181 + work/tests/test_persistence.py | 339 + work/tests/test_pipeline_digest.py | 523 + work/tests/test_pipeline_grouper.py | 61 + work/tests/test_pipeline_inhibitor_grouper.py | 194 + work/tests/test_pipeline_persistence.py | 172 + work/tests/test_pipeline_scheduler.py | 574 + work/tests/test_pipeline_skeleton.py | 183 + work/tests/test_pipeline_toggle_filter.py | 132 + work/tests/test_quake_handler.py | 175 + work/tests/test_reminders.py | 224 + work/tests/test_renderers.py | 326 + work/tests/test_rf_v057.py | 245 + work/tests/test_router_env_scope.py | 90 + work/tests/test_satpass_broadcast_safety.py | 611 + work/tests/test_satpass_command.py | 472 + work/tests/test_satpass_compass_fallback.py | 243 + work/tests/test_satpass_event_path.py | 240 + work/tests/test_satpass_handler.py | 173 + work/tests/test_satpass_registration.py | 147 + work/tests/test_satpass_wire_fields.py | 274 + .../test_save_section_secret_preserve.py | 128 + work/tests/test_seismic_v057.py | 199 + work/tests/test_swpc_handler.py | 225 + work/tests/test_tail_followups.py | 322 + work/tests/test_tombstone_broadcast.py | 268 + work/tests/test_tracking_v057.py | 165 + work/tests/test_traffic_v057.py | 177 + work/tests/test_v052_dispatcher.py | 342 + work/tests/test_v064_guard_commit.py | 177 + work/tests/test_water_v057.py | 197 + work/tests/test_weather_v057.py | 172 + work/tests/test_wfigs_handler.py | 604 + work/tests/test_work_zone_renderer.py | 207 + 283 files changed, 109402 insertions(+), 483 deletions(-) delete mode 100644 meshai/dashboard/static/assets/index-Di1mw816.js delete mode 100644 meshai/dashboard/static/assets/index-WwNJt5S-.css create mode 100644 work/Dockerfile create mode 100644 work/config.example.yaml create mode 100644 work/config/.env.example create mode 100644 work/config/local.yaml.example rename {meshai/dashboard/static => work/dashboard-frontend}/index.html (79%) create mode 100644 work/dashboard-frontend/package.json create mode 100644 work/dashboard-frontend/postcss.config.js rename {meshai/dashboard/static => work/dashboard-frontend/public}/meshai-icon.png (100%) rename {meshai/dashboard/static => work/dashboard-frontend/public}/meshai-logo.png (100%) create mode 100644 work/dashboard-frontend/src/App.tsx create mode 100644 work/dashboard-frontend/src/components/ChannelPicker.tsx create mode 100644 work/dashboard-frontend/src/components/GeoMap.tsx create mode 100644 work/dashboard-frontend/src/components/Layout.tsx create mode 100644 work/dashboard-frontend/src/components/NodeDetail.tsx create mode 100644 work/dashboard-frontend/src/components/NodePicker.tsx create mode 100644 work/dashboard-frontend/src/components/NodeTable.tsx create mode 100644 work/dashboard-frontend/src/components/RestartBanner.tsx create mode 100644 work/dashboard-frontend/src/components/ToastProvider.tsx create mode 100644 work/dashboard-frontend/src/components/TopologyGraph.tsx create mode 100644 work/dashboard-frontend/src/hooks/useWebSocket.ts create mode 100644 work/dashboard-frontend/src/index.css create mode 100644 work/dashboard-frontend/src/lib/api.ts create mode 100644 work/dashboard-frontend/src/main.tsx create mode 100644 work/dashboard-frontend/src/pages/AdapterConfig.tsx create mode 100644 work/dashboard-frontend/src/pages/Alerts.tsx create mode 100644 work/dashboard-frontend/src/pages/Config.tsx create mode 100644 work/dashboard-frontend/src/pages/Dashboard.tsx create mode 100644 work/dashboard-frontend/src/pages/Environment.tsx create mode 100644 work/dashboard-frontend/src/pages/GaugeSites.tsx create mode 100644 work/dashboard-frontend/src/pages/Mesh.tsx create mode 100644 work/dashboard-frontend/src/pages/Notifications.tsx create mode 100644 work/dashboard-frontend/src/pages/Reference.tsx create mode 100644 work/dashboard-frontend/src/pages/TownAnchors.tsx create mode 100644 work/dashboard-frontend/src/vite-env.d.ts create mode 100644 work/dashboard-frontend/tailwind.config.ts create mode 100644 work/dashboard-frontend/tsconfig.json create mode 100644 work/dashboard-frontend/tsconfig.node.json create mode 100644 work/dashboard-frontend/vite.config.ts create mode 100644 work/docker-compose.yml create mode 100755 work/docker-entrypoint.sh create mode 100644 work/docs/handoff_2026-06-09.md create mode 100644 work/meshai/__init__.py create mode 100644 work/meshai/__main__.py create mode 100644 work/meshai/adapter_config/__init__.py create mode 100644 work/meshai/adapter_config/_accessor.py create mode 100644 work/meshai/adapter_config/defaults.py create mode 100644 work/meshai/alert_engine.py create mode 100644 work/meshai/backends/__init__.py create mode 100644 work/meshai/backends/anthropic_backend.py create mode 100644 work/meshai/backends/base.py create mode 100644 work/meshai/backends/google_backend.py create mode 100644 work/meshai/backends/openai_backend.py create mode 100644 work/meshai/central/__init__.py create mode 100644 work/meshai/central/avy_handler.py create mode 100644 work/meshai/central/consumer.py create mode 100644 work/meshai/central/firms_handler.py create mode 100644 work/meshai/central/idaho_gauge_sites.py create mode 100644 work/meshai/central/incident_handler.py create mode 100644 work/meshai/central/nwis_handler.py create mode 100644 work/meshai/central/nws_handler.py create mode 100644 work/meshai/central/pass_predictor.py create mode 100644 work/meshai/central/quake_handler.py create mode 100644 work/meshai/central/satpass_handler.py create mode 100644 work/meshai/central/swpc_handler.py create mode 100644 work/meshai/central/tle_handler.py create mode 100644 work/meshai/central/wfigs_handler.py create mode 100644 work/meshai/central_normalizer.py create mode 100644 work/meshai/chunker.py create mode 100644 work/meshai/cli/__init__.py create mode 100644 work/meshai/cli/configurator.py create mode 100644 work/meshai/commands/__init__.py create mode 100644 work/meshai/commands/alerts_cmd.py create mode 100644 work/meshai/commands/avy_cmd.py create mode 100644 work/meshai/commands/base.py create mode 100644 work/meshai/commands/clear.py create mode 100644 work/meshai/commands/dispatcher.py create mode 100644 work/meshai/commands/fire_cmd.py create mode 100644 work/meshai/commands/health.py create mode 100644 work/meshai/commands/help.py create mode 100644 work/meshai/commands/hotspots_cmd.py create mode 100644 work/meshai/commands/ping.py create mode 100644 work/meshai/commands/reset.py create mode 100644 work/meshai/commands/roads_cmd.py create mode 100644 work/meshai/commands/satpass_cmd.py create mode 100644 work/meshai/commands/solar_cmd.py create mode 100644 work/meshai/commands/status.py create mode 100644 work/meshai/commands/streams_cmd.py create mode 100644 work/meshai/commands/subscribe.py create mode 100644 work/meshai/commands/weather.py create mode 100644 work/meshai/config.py create mode 100644 work/meshai/config_loader.py create mode 100644 work/meshai/connector.py create mode 100644 work/meshai/context.py create mode 100644 work/meshai/dashboard/__init__.py create mode 100644 work/meshai/dashboard/api/__init__.py create mode 100644 work/meshai/dashboard/api/adapter_config_routes.py create mode 100644 work/meshai/dashboard/api/alert_routes.py create mode 100644 work/meshai/dashboard/api/config_routes.py create mode 100644 work/meshai/dashboard/api/curation_routes.py create mode 100644 work/meshai/dashboard/api/debug_routes.py create mode 100644 work/meshai/dashboard/api/env_routes.py create mode 100644 work/meshai/dashboard/api/gauge_sites_import.py create mode 100644 work/meshai/dashboard/api/mesh_routes.py create mode 100644 work/meshai/dashboard/api/notification_routes.py create mode 100644 work/meshai/dashboard/api/system_routes.py create mode 100644 work/meshai/dashboard/server.py create mode 100644 work/meshai/dashboard/ws.py create mode 100644 work/meshai/data/zcta_centroids.csv create mode 100644 work/meshai/env/__init__.py create mode 100644 work/meshai/env/avalanche.py create mode 100644 work/meshai/env/ducting.py create mode 100644 work/meshai/env/fires.py create mode 100644 work/meshai/env/firms.py create mode 100644 work/meshai/env/nws.py create mode 100644 work/meshai/env/roads511.py create mode 100644 work/meshai/env/store.py create mode 100644 work/meshai/env/swpc.py create mode 100644 work/meshai/env/traffic.py create mode 100644 work/meshai/env/usgs.py create mode 100644 work/meshai/env/usgs_quake.py create mode 100644 work/meshai/geo.py create mode 100644 work/meshai/history.py create mode 100644 work/meshai/knowledge.py create mode 100644 work/meshai/main.py create mode 100644 work/meshai/memory.py create mode 100644 work/meshai/mesh_data_store.py create mode 100644 work/meshai/mesh_health.py create mode 100644 work/meshai/mesh_models.py create mode 100644 work/meshai/mesh_reporter.py create mode 100644 work/meshai/mesh_sources.py create mode 100644 work/meshai/meshmonitor.py create mode 100644 work/meshai/notifications/__init__.py create mode 100644 work/meshai/notifications/categories.py create mode 100644 work/meshai/notifications/channels.py create mode 100644 work/meshai/notifications/env_reporter.py create mode 100644 work/meshai/notifications/events.py create mode 100644 work/meshai/notifications/pipeline/__init__.py create mode 100644 work/meshai/notifications/pipeline/bus.py create mode 100644 work/meshai/notifications/pipeline/digest.py create mode 100644 work/meshai/notifications/pipeline/dispatcher.py create mode 100644 work/meshai/notifications/pipeline/grouper.py create mode 100644 work/meshai/notifications/pipeline/inhibitor.py create mode 100644 work/meshai/notifications/pipeline/pacer.py create mode 100644 work/meshai/notifications/pipeline/scheduler.py create mode 100644 work/meshai/notifications/pipeline/toggle_filter.py create mode 100644 work/meshai/notifications/region_tagger.py create mode 100644 work/meshai/notifications/reminders/__init__.py create mode 100644 work/meshai/notifications/renderers/__init__.py create mode 100644 work/meshai/notifications/renderers/base.py create mode 100644 work/meshai/notifications/renderers/composer.py create mode 100644 work/meshai/notifications/renderers/email.py create mode 100644 work/meshai/notifications/renderers/mesh.py create mode 100644 work/meshai/notifications/renderers/webhook.py create mode 100644 work/meshai/notifications/renderers/work_zone.py create mode 100644 work/meshai/notifications/router.py create mode 100644 work/meshai/notifications/scheduled/__init__.py create mode 100644 work/meshai/notifications/scheduled/band_conditions.py create mode 100644 work/meshai/notifications/scheduled/fire_digest.py create mode 100644 work/meshai/notifications/summarizer.py create mode 100644 work/meshai/persistence/__init__.py create mode 100644 work/meshai/persistence/curation.py create mode 100644 work/meshai/persistence/db.py create mode 100644 work/meshai/persistence/migrations/v1.sql create mode 100644 work/meshai/persistence/migrations/v10.sql create mode 100644 work/meshai/persistence/migrations/v11.sql create mode 100644 work/meshai/persistence/migrations/v12.sql create mode 100644 work/meshai/persistence/migrations/v13.sql create mode 100644 work/meshai/persistence/migrations/v14.sql create mode 100644 work/meshai/persistence/migrations/v15.sql create mode 100644 work/meshai/persistence/migrations/v16.sql create mode 100644 work/meshai/persistence/migrations/v17.sql create mode 100644 work/meshai/persistence/migrations/v18.sql create mode 100644 work/meshai/persistence/migrations/v2.sql create mode 100644 work/meshai/persistence/migrations/v3.sql create mode 100644 work/meshai/persistence/migrations/v4.sql create mode 100644 work/meshai/persistence/migrations/v5.sql create mode 100644 work/meshai/persistence/migrations/v6.sql create mode 100644 work/meshai/persistence/migrations/v7.sql create mode 100644 work/meshai/persistence/migrations/v8.sql create mode 100644 work/meshai/persistence/migrations/v9.sql create mode 100644 work/meshai/responder.py create mode 100644 work/meshai/router.py create mode 100644 work/meshai/scripts/__init__.py create mode 100644 work/meshai/scripts/migrate_config_v03.py create mode 100644 work/meshai/sources/__init__.py create mode 100644 work/meshai/sources/meshmonitor_data.py create mode 100644 work/meshai/sources/meshview.py create mode 100644 work/meshai/sources/mqtt_source.py create mode 100644 work/meshai/subscriptions.py create mode 100644 work/pyproject.toml create mode 100644 work/requirements.txt create mode 100644 work/tests/conftest.py create mode 100644 work/tests/fixtures/central_envelopes/state_511_atis_01_I-15.json create mode 100644 work/tests/fixtures/central_envelopes/state_511_atis_02_SH-36.json create mode 100644 work/tests/fixtures/central_envelopes/state_511_atis_03_I-15.json create mode 100644 work/tests/fixtures/central_envelopes/state_511_atis_04_US-95.json create mode 100644 work/tests/fixtures/central_envelopes/state_511_atis_05_W_Prairie_Ave.json create mode 100644 work/tests/fixtures/central_envelopes/state_511_atis_06_SH-55.json create mode 100644 work/tests/fixtures/central_envelopes/state_511_atis_07_US-2.json create mode 100644 work/tests/fixtures/central_envelopes/state_511_atis_08_SH-41.json create mode 100644 work/tests/test_adapter_avalanche.py create mode 100644 work/tests/test_adapter_config_api.py create mode 100644 work/tests/test_adapter_config_foundation.py create mode 100644 work/tests/test_adapter_ducting.py create mode 100644 work/tests/test_adapter_fires.py create mode 100644 work/tests/test_adapter_firms.py create mode 100644 work/tests/test_adapter_nws.py create mode 100644 work/tests/test_adapter_roads511.py create mode 100644 work/tests/test_adapter_swpc.py create mode 100644 work/tests/test_adapter_traffic.py create mode 100644 work/tests/test_adapter_usgs.py create mode 100644 work/tests/test_adapter_usgs_quake.py create mode 100644 work/tests/test_avalanche_v057.py create mode 100644 work/tests/test_band_conditions.py create mode 100644 work/tests/test_bool_roundtrip.py create mode 100644 work/tests/test_central_consumer.py create mode 100644 work/tests/test_central_envelope_to_wire_v057.py create mode 100644 work/tests/test_central_normalizer.py create mode 100644 work/tests/test_central_region_routing.py create mode 100644 work/tests/test_central_sub_adapter_routing.py create mode 100644 work/tests/test_channel_rendering.py create mode 100644 work/tests/test_cold_start_grace.py create mode 100644 work/tests/test_config_loader.py create mode 100644 work/tests/test_config_source_field.py create mode 100644 work/tests/test_consumer_default_deny.py create mode 100644 work/tests/test_curation.py create mode 100644 work/tests/test_dashboard_config_save.py create mode 100644 work/tests/test_dispatcher_persistence.py create mode 100644 work/tests/test_env_reporter.py create mode 100644 work/tests/test_env_reporter_fire_recency.py create mode 100644 work/tests/test_fire_digest_recency.py create mode 100644 work/tests/test_fire_tracker_phase1.py create mode 100644 work/tests/test_fire_tracker_phase2.py create mode 100644 work/tests/test_fire_tracker_phase3.py create mode 100644 work/tests/test_fire_tracker_phase4.py create mode 100644 work/tests/test_fire_v057.py create mode 100644 work/tests/test_firms_handler.py create mode 100644 work/tests/test_incident_handler.py create mode 100644 work/tests/test_include_roundtrip.py create mode 100644 work/tests/test_itd_511_work_zone.py create mode 100644 work/tests/test_notification_toggles.py create mode 100644 work/tests/test_nwis_handler.py create mode 100644 work/tests/test_nws_dedup_relaxation.py create mode 100644 work/tests/test_nws_handler.py create mode 100644 work/tests/test_or_arch_continuous.py create mode 100644 work/tests/test_persistence.py create mode 100644 work/tests/test_pipeline_digest.py create mode 100644 work/tests/test_pipeline_grouper.py create mode 100644 work/tests/test_pipeline_inhibitor_grouper.py create mode 100644 work/tests/test_pipeline_persistence.py create mode 100644 work/tests/test_pipeline_scheduler.py create mode 100644 work/tests/test_pipeline_skeleton.py create mode 100644 work/tests/test_pipeline_toggle_filter.py create mode 100644 work/tests/test_quake_handler.py create mode 100644 work/tests/test_reminders.py create mode 100644 work/tests/test_renderers.py create mode 100644 work/tests/test_rf_v057.py create mode 100644 work/tests/test_router_env_scope.py create mode 100644 work/tests/test_satpass_broadcast_safety.py create mode 100644 work/tests/test_satpass_command.py create mode 100644 work/tests/test_satpass_compass_fallback.py create mode 100644 work/tests/test_satpass_event_path.py create mode 100644 work/tests/test_satpass_handler.py create mode 100644 work/tests/test_satpass_registration.py create mode 100644 work/tests/test_satpass_wire_fields.py create mode 100644 work/tests/test_save_section_secret_preserve.py create mode 100644 work/tests/test_seismic_v057.py create mode 100644 work/tests/test_swpc_handler.py create mode 100644 work/tests/test_tail_followups.py create mode 100644 work/tests/test_tombstone_broadcast.py create mode 100644 work/tests/test_tracking_v057.py create mode 100644 work/tests/test_traffic_v057.py create mode 100644 work/tests/test_v052_dispatcher.py create mode 100644 work/tests/test_v064_guard_commit.py create mode 100644 work/tests/test_water_v057.py create mode 100644 work/tests/test_weather_v057.py create mode 100644 work/tests/test_wfigs_handler.py create mode 100644 work/tests/test_work_zone_renderer.py diff --git a/.dockerignore b/.dockerignore index c754e39..e014047 100644 --- a/.dockerignore +++ b/.dockerignore @@ -56,6 +56,9 @@ Dockerfile* docker-compose*.yml .docker/ +# Frontend (npm ci installs fresh in build stage) +dashboard-frontend/node_modules/ + # Misc .DS_Store *.log diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index e465b8c..5cf25be 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -48,8 +48,8 @@ jobs: - name: Build and push uses: docker/build-push-action@v5 with: - context: . - file: Dockerfile + context: work + file: work/Dockerfile platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} diff --git a/.gitignore b/.gitignore index 93face6..c958ad6 100644 --- a/.gitignore +++ b/.gitignore @@ -20,8 +20,8 @@ dist/ downloads/ eggs/ .eggs/ -lib/ -lib64/ +/lib/ +/lib64/ parts/ sdist/ var/ @@ -50,7 +50,7 @@ config.yaml *.db *.sqlite *.sqlite3 -data/ +/data/ *.log # Secrets @@ -58,6 +58,10 @@ data/ *.pem *.key +# Frontend build output (built in Docker via multi-stage) +meshai/dashboard/static/ + + # OS .DS_Store Thumbs.db diff --git a/meshai/dashboard/static/assets/index-Di1mw816.js b/meshai/dashboard/static/assets/index-Di1mw816.js deleted file mode 100644 index 42941d5..0000000 --- a/meshai/dashboard/static/assets/index-Di1mw816.js +++ /dev/null @@ -1,475 +0,0 @@ -function V$(e,t){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=r(i);fetch(i.href,a)}})();var G$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ek(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var AB={exports:{}},S1={},kB={exports:{}},_t={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Vg=Symbol.for("react.element"),H$=Symbol.for("react.portal"),U$=Symbol.for("react.fragment"),W$=Symbol.for("react.strict_mode"),Z$=Symbol.for("react.profiler"),$$=Symbol.for("react.provider"),Y$=Symbol.for("react.context"),X$=Symbol.for("react.forward_ref"),q$=Symbol.for("react.suspense"),K$=Symbol.for("react.memo"),J$=Symbol.for("react.lazy"),JP=Symbol.iterator;function Q$(e){return e===null||typeof e!="object"?null:(e=JP&&e[JP]||e["@@iterator"],typeof e=="function"?e:null)}var LB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},IB=Object.assign,NB={};function Qf(e,t,r){this.props=e,this.context=t,this.refs=NB,this.updater=r||LB}Qf.prototype.isReactComponent={};Qf.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Qf.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function PB(){}PB.prototype=Qf.prototype;function tk(e,t,r){this.props=e,this.context=t,this.refs=NB,this.updater=r||LB}var rk=tk.prototype=new PB;rk.constructor=tk;IB(rk,Qf.prototype);rk.isPureReactComponent=!0;var QP=Array.isArray,DB=Object.prototype.hasOwnProperty,nk={current:null},EB={key:!0,ref:!0,__self:!0,__source:!0};function RB(e,t,r){var n,i={},a=null,o=null;if(t!=null)for(n in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)DB.call(t,n)&&!EB.hasOwnProperty(n)&&(i[n]=t[n]);var s=arguments.length-2;if(s===1)i.children=r;else if(1>>1,X=z[Z];if(0>>1;Zi(oe,W))lei(De,oe)?(z[Z]=De,z[le]=W,Z=le):(z[Z]=oe,z[J]=W,Z=J);else if(lei(De,W))z[Z]=De,z[le]=W,Z=le;else break e}}return $}function i(z,$){var W=z.sortIndex-$.sortIndex;return W!==0?W:z.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var l=[],u=[],c=1,h=null,f=3,d=!1,g=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(z){for(var $=r(u);$!==null;){if($.callback===null)n(u);else if($.startTime<=z)n(u),$.sortIndex=$.expirationTime,t(l,$);else break;$=r(u)}}function S(z){if(m=!1,w(z),!g)if(r(l)!==null)g=!0,H(T);else{var $=r(u);$!==null&&V(S,$.startTime-z)}}function T(z,$){g=!1,m&&(m=!1,_(N),N=-1),d=!0;var W=f;try{for(w($),h=r(l);h!==null&&(!(h.expirationTime>$)||z&&!D());){var Z=h.callback;if(typeof Z=="function"){h.callback=null,f=h.priorityLevel;var X=Z(h.expirationTime<=$);$=e.unstable_now(),typeof X=="function"?h.callback=X:h===r(l)&&n(l),w($)}else n(l);h=r(l)}if(h!==null)var re=!0;else{var J=r(u);J!==null&&V(S,J.startTime-$),re=!1}return re}finally{h=null,f=W,d=!1}}var M=!1,A=null,N=-1,P=5,I=-1;function D(){return!(e.unstable_now()-Iz||125Z?(z.sortIndex=W,t(u,z),r(l)===null&&z===r(u)&&(m?(_(N),N=-1):m=!0,V(S,W-Z))):(z.sortIndex=X,t(l,z),g||d||(g=!0,H(T))),z},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(z){var $=f;return function(){var W=f;f=$;try{return z.apply(this,arguments)}finally{f=W}}}})(FB);BB.exports=FB;var hY=BB.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var fY=G,hi=hY;function me(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),VT=Object.prototype.hasOwnProperty,dY=/^[: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]*$/,tD={},rD={};function vY(e){return VT.call(rD,e)?!0:VT.call(tD,e)?!1:dY.test(e)?rD[e]=!0:(tD[e]=!0,!1)}function pY(e,t,r,n){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function gY(e,t,r,n){if(t===null||typeof t>"u"||pY(e,t,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function jn(e,t,r,n,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var rn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){rn[e]=new jn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];rn[t]=new jn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){rn[e]=new jn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){rn[e]=new jn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){rn[e]=new jn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){rn[e]=new jn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){rn[e]=new jn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){rn[e]=new jn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){rn[e]=new jn(e,5,!1,e.toLowerCase(),null,!1,!1)});var ak=/[\-:]([a-z])/g;function ok(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ak,ok);rn[t]=new jn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ak,ok);rn[t]=new jn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ak,ok);rn[t]=new jn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){rn[e]=new jn(e,1,!1,e.toLowerCase(),null,!1,!1)});rn.xlinkHref=new jn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){rn[e]=new jn(e,1,!1,e.toLowerCase(),null,!0,!0)});function sk(e,t,r,n){var i=rn.hasOwnProperty(t)?rn[t]:null;(i!==null?i.type!==0:n||!(2s||i[o]!==a[s]){var l=` -`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=s);break}}}finally{kw=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?Bv(e):""}function mY(e){switch(e.tag){case 5:return Bv(e.type);case 16:return Bv("Lazy");case 13:return Bv("Suspense");case 19:return Bv("SuspenseList");case 0:case 2:case 15:return e=Lw(e.type,!1),e;case 11:return e=Lw(e.type.render,!1),e;case 1:return e=Lw(e.type,!0),e;default:return""}}function WT(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Vh:return"Fragment";case Fh:return"Portal";case GT:return"Profiler";case lk:return"StrictMode";case HT:return"Suspense";case UT:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case HB:return(e.displayName||"Context")+".Consumer";case GB:return(e._context.displayName||"Context")+".Provider";case uk:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ck:return t=e.displayName||null,t!==null?t:WT(e.type)||"Memo";case Bs:t=e._payload,e=e._init;try{return WT(e(t))}catch{}}return null}function yY(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return WT(t);case 8:return t===lk?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function bl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function WB(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _Y(e){var t=WB(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){n=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ny(e){e._valueTracker||(e._valueTracker=_Y(e))}function ZB(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=WB(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function A_(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ZT(e,t){var r=t.checked;return ar({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function iD(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=bl(t.value!=null?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function $B(e,t){t=t.checked,t!=null&&sk(e,"checked",t,!1)}function $T(e,t){$B(e,t);var r=bl(t.value),n=t.type;if(r!=null)n==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(n==="submit"||n==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?YT(e,t.type,r):t.hasOwnProperty("defaultValue")&&YT(e,t.type,bl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function aD(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!(n!=="submit"&&n!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function YT(e,t,r){(t!=="number"||A_(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Fv=Array.isArray;function of(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=iy.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Np(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var rp={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xY=["Webkit","ms","Moz","O"];Object.keys(rp).forEach(function(e){xY.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),rp[t]=rp[e]})});function KB(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||rp.hasOwnProperty(e)&&rp[e]?(""+t).trim():t+"px"}function JB(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=KB(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}var bY=ar({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function KT(e,t){if(t){if(bY[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(me(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(me(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(me(61))}if(t.style!=null&&typeof t.style!="object")throw Error(me(62))}}function JT(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 QT=null;function hk(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var e2=null,sf=null,lf=null;function lD(e){if(e=Ug(e)){if(typeof e2!="function")throw Error(me(280));var t=e.stateNode;t&&(t=k1(t),e2(e.stateNode,e.type,t))}}function QB(e){sf?lf?lf.push(e):lf=[e]:sf=e}function eF(){if(sf){var e=sf,t=lf;if(lf=sf=null,lD(e),t)for(e=0;e>>=0,e===0?32:31-(PY(e)/DY|0)|0}var ay=64,oy=4194304;function Vv(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function N_(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,i=e.suspendedLanes,a=e.pingedLanes,o=r&268435455;if(o!==0){var s=o&~i;s!==0?n=Vv(s):(a&=o,a!==0&&(n=Vv(a)))}else o=r&~i,o!==0?n=Vv(o):a!==0&&(n=Vv(a));if(n===0)return 0;if(t!==0&&t!==n&&!(t&i)&&(i=n&-n,a=t&-t,i>=a||i===16&&(a&4194240)!==0))return t;if(n&4&&(n|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=n;0r;r++)t.push(e);return t}function Gg(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ha(t),e[t]=r}function OY(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0=ip),mD=" ",yD=!1;function xF(e,t){switch(e){case"keyup":return hX.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bF(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gh=!1;function dX(e,t){switch(e){case"compositionend":return bF(t);case"keypress":return t.which!==32?null:(yD=!0,mD);case"textInput":return e=t.data,e===mD&&yD?null:e;default:return null}}function vX(e,t){if(Gh)return e==="compositionend"||!_k&&xF(e,t)?(e=yF(),H0=gk=Zs=null,Gh=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=wD(r)}}function TF(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?TF(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function MF(){for(var e=window,t=A_();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=A_(e.document)}return t}function xk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function SX(e){var t=MF(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&TF(r.ownerDocument.documentElement,r)){if(n!==null&&xk(r)){if(t=n.start,e=n.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=r.textContent.length,a=Math.min(n.start,i);n=n.end===void 0?a:Math.min(n.end,i),!e.extend&&a>n&&(i=n,n=a,a=i),i=SD(r,a);var o=SD(r,n);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,Hh=null,o2=null,op=null,s2=!1;function CD(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;s2||Hh==null||Hh!==A_(n)||(n=Hh,"selectionStart"in n&&xk(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),op&&Op(op,n)||(op=n,n=E_(o2,"onSelect"),0Zh||(e.current=d2[Zh],d2[Zh]=null,Zh--)}function Wt(e,t){Zh++,d2[Zh]=e.current,e.current=t}var wl={},xn=El(wl),$n=El(!1),nc=wl;function Tf(e,t){var r=e.type.contextTypes;if(!r)return wl;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in r)i[a]=t[a];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Yn(e){return e=e.childContextTypes,e!=null}function j_(){Yt($n),Yt(xn)}function ND(e,t,r){if(xn.current!==wl)throw Error(me(168));Wt(xn,t),Wt($n,r)}function RF(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in t))throw Error(me(108,yY(e)||"Unknown",i));return ar({},r,n)}function O_(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||wl,nc=xn.current,Wt(xn,e),Wt($n,$n.current),!0}function PD(e,t,r){var n=e.stateNode;if(!n)throw Error(me(169));r?(e=RF(e,t,nc),n.__reactInternalMemoizedMergedChildContext=e,Yt($n),Yt(xn),Wt(xn,e)):Yt($n),Wt($n,r)}var Bo=null,L1=!1,Hw=!1;function jF(e){Bo===null?Bo=[e]:Bo.push(e)}function RX(e){L1=!0,jF(e)}function Rl(){if(!Hw&&Bo!==null){Hw=!0;var e=0,t=Rt;try{var r=Bo;for(Rt=1;e>=o,i-=o,Vo=1<<32-ha(t)+i|r<N?(P=A,A=null):P=A.sibling;var I=f(_,A,w[N],S);if(I===null){A===null&&(A=P);break}e&&A&&I.alternate===null&&t(_,A),x=a(I,x,N),M===null?T=I:M.sibling=I,M=I,A=P}if(N===w.length)return r(_,A),Jt&&Su(_,N),T;if(A===null){for(;NN?(P=A,A=null):P=A.sibling;var D=f(_,A,I.value,S);if(D===null){A===null&&(A=P);break}e&&A&&D.alternate===null&&t(_,A),x=a(D,x,N),M===null?T=D:M.sibling=D,M=D,A=P}if(I.done)return r(_,A),Jt&&Su(_,N),T;if(A===null){for(;!I.done;N++,I=w.next())I=h(_,I.value,S),I!==null&&(x=a(I,x,N),M===null?T=I:M.sibling=I,M=I);return Jt&&Su(_,N),T}for(A=n(_,A);!I.done;N++,I=w.next())I=d(A,_,N,I.value,S),I!==null&&(e&&I.alternate!==null&&A.delete(I.key===null?N:I.key),x=a(I,x,N),M===null?T=I:M.sibling=I,M=I);return e&&A.forEach(function(O){return t(_,O)}),Jt&&Su(_,N),T}function y(_,x,w,S){if(typeof w=="object"&&w!==null&&w.type===Vh&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case ry:e:{for(var T=w.key,M=x;M!==null;){if(M.key===T){if(T=w.type,T===Vh){if(M.tag===7){r(_,M.sibling),x=i(M,w.props.children),x.return=_,_=x;break e}}else if(M.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Bs&&RD(T)===M.type){r(_,M.sibling),x=i(M,w.props),x.ref=tv(_,M,w),x.return=_,_=x;break e}r(_,M);break}else t(_,M);M=M.sibling}w.type===Vh?(x=$u(w.props.children,_.mode,S,w.key),x.return=_,_=x):(S=K0(w.type,w.key,w.props,null,_.mode,S),S.ref=tv(_,x,w),S.return=_,_=S)}return o(_);case Fh:e:{for(M=w.key;x!==null;){if(x.key===M)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){r(_,x.sibling),x=i(x,w.children||[]),x.return=_,_=x;break e}else{r(_,x);break}else t(_,x);x=x.sibling}x=Kw(w,_.mode,S),x.return=_,_=x}return o(_);case Bs:return M=w._init,y(_,x,M(w._payload),S)}if(Fv(w))return g(_,x,w,S);if(qd(w))return m(_,x,w,S);dy(_,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(r(_,x.sibling),x=i(x,w),x.return=_,_=x):(r(_,x),x=qw(w,_.mode,S),x.return=_,_=x),o(_)):r(_,x)}return y}var Af=FF(!0),VF=FF(!1),F_=El(null),V_=null,Xh=null,Ck=null;function Tk(){Ck=Xh=V_=null}function Mk(e){var t=F_.current;Yt(F_),e._currentValue=t}function g2(e,t,r){for(;e!==null;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,n!==null&&(n.childLanes|=t)):n!==null&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function cf(e,t){V_=e,Ck=Xh=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Zn=!0),e.firstContext=null)}function Fi(e){var t=e._currentValue;if(Ck!==e)if(e={context:e,memoizedValue:t,next:null},Xh===null){if(V_===null)throw Error(me(308));Xh=e,V_.dependencies={lanes:0,firstContext:e}}else Xh=Xh.next=e;return t}var Ou=null;function Ak(e){Ou===null?Ou=[e]:Ou.push(e)}function GF(e,t,r,n){var i=t.interleaved;return i===null?(r.next=r,Ak(t)):(r.next=i.next,i.next=r),t.interleaved=r,is(e,n)}function is(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var Fs=!1;function kk(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function HF(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function $o(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ol(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Mt&2){var i=n.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),n.pending=t,is(e,r)}return i=n.interleaved,i===null?(t.next=t,Ak(n)):(t.next=i.next,i.next=t),n.interleaved=t,is(e,r)}function W0(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,dk(e,r)}}function jD(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var i=null,a=null;if(r=r.firstBaseUpdate,r!==null){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};a===null?i=a=o:a=a.next=o,r=r.next}while(r!==null);a===null?i=a=t:a=a.next=t}else i=a=t;r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:n.shared,effects:n.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function G_(e,t,r,n){var i=e.updateQueue;Fs=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var l=s,u=l.next;l.next=null,o===null?a=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==o&&(s===null?c.firstBaseUpdate=u:s.next=u,c.lastBaseUpdate=l))}if(a!==null){var h=i.baseState;o=0,c=u=l=null,s=a;do{var f=s.lane,d=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:d,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var g=e,m=s;switch(f=t,d=r,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(d,h,f);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,f=typeof g=="function"?g.call(d,h,f):g,f==null)break e;h=ar({},h,f);break e;case 2:Fs=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else d={eventTime:d,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(u=c=d,l=h):c=c.next=d,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(c===null&&(l=h),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);oc|=o,e.lanes=o,e.memoizedState=h}}function OD(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=Ww.transition;Ww.transition={};try{e(!1),t()}finally{Rt=r,Ww.transition=n}}function oV(){return Vi().memoizedState}function BX(e,t,r){var n=ll(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},sV(e))lV(t,r);else if(r=GF(e,t,r,n),r!==null){var i=In();fa(r,e,n,i),uV(r,t,n)}}function FX(e,t,r){var n=ll(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(sV(e))lV(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,r);if(i.hasEagerState=!0,i.eagerState=s,ma(s,o)){var l=t.interleaved;l===null?(i.next=i,Ak(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}r=GF(e,t,i,n),r!==null&&(i=In(),fa(r,e,n,i),uV(r,t,n))}}function sV(e){var t=e.alternate;return e===nr||t!==null&&t===nr}function lV(e,t){sp=U_=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function uV(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,dk(e,r)}}var W_={readContext:Fi,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},VX={readContext:Fi,useCallback:function(e,t){return za().memoizedState=[e,t===void 0?null:t],e},useContext:Fi,useEffect:BD,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,$0(4194308,4,tV.bind(null,t,e),r)},useLayoutEffect:function(e,t){return $0(4194308,4,e,t)},useInsertionEffect:function(e,t){return $0(4,2,e,t)},useMemo:function(e,t){var r=za();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=za();return t=r!==void 0?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=BX.bind(null,nr,e),[n.memoizedState,e]},useRef:function(e){var t=za();return e={current:e},t.memoizedState=e},useState:zD,useDebugValue:jk,useDeferredValue:function(e){return za().memoizedState=e},useTransition:function(){var e=zD(!1),t=e[0];return e=zX.bind(null,e[1]),za().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=nr,i=za();if(Jt){if(r===void 0)throw Error(me(407));r=r()}else{if(r=t(),Wr===null)throw Error(me(349));ac&30||$F(n,t,r)}i.memoizedState=r;var a={value:r,getSnapshot:t};return i.queue=a,BD(XF.bind(null,n,a,e),[e]),n.flags|=2048,Wp(9,YF.bind(null,n,a,r,t),void 0,null),r},useId:function(){var e=za(),t=Wr.identifierPrefix;if(Jt){var r=Go,n=Vo;r=(n&~(1<<32-ha(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Hp++,0<\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=o.createElement(r,{is:n.is}):(e=o.createElement(r),r==="select"&&(o=e,n.multiple?o.multiple=!0:n.size&&(o.size=n.size))):e=o.createElementNS(e,r),e[Fa]=t,e[Fp]=n,_V(e,t,!1,!1),t.stateNode=e;e:{switch(o=JT(r,n),r){case"dialog":$t("cancel",e),$t("close",e),i=n;break;case"iframe":case"object":case"embed":$t("load",e),i=n;break;case"video":case"audio":for(i=0;iIf&&(t.flags|=128,n=!0,rv(a,!1),t.lanes=4194304)}else{if(!n)if(e=H_(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),rv(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!Jt)return cn(t),null}else 2*yr()-a.renderingStartTime>If&&r!==1073741824&&(t.flags|=128,n=!0,rv(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(r=a.last,r!==null?r.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=yr(),t.sibling=null,r=rr.current,Wt(rr,n?r&1|2:r&1),t):(cn(t),null);case 22:case 23:return Gk(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?ti&1073741824&&(cn(t),t.subtreeFlags&6&&(t.flags|=8192)):cn(t),null;case 24:return null;case 25:return null}throw Error(me(156,t.tag))}function XX(e,t){switch(wk(t),t.tag){case 1:return Yn(t.type)&&j_(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kf(),Yt($n),Yt(xn),Nk(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ik(t),null;case 13:if(Yt(rr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(me(340));Mf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Yt(rr),null;case 4:return kf(),null;case 10:return Mk(t.type._context),null;case 22:case 23:return Gk(),null;case 24:return null;default:return null}}var py=!1,pn=!1,qX=typeof WeakSet=="function"?WeakSet:Set,je=null;function qh(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){lr(e,t,n)}else r.current=null}function T2(e,t,r){try{r()}catch(n){lr(e,t,n)}}var qD=!1;function KX(e,t){if(l2=P_,e=MF(),xk(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,a=n.focusNode;n=n.focusOffset;try{r.nodeType,a.nodeType}catch{r=null;break e}var o=0,s=-1,l=-1,u=0,c=0,h=e,f=null;t:for(;;){for(var d;h!==r||i!==0&&h.nodeType!==3||(s=o+i),h!==a||n!==0&&h.nodeType!==3||(l=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(d=h.firstChild)!==null;)f=h,h=d;for(;;){if(h===e)break t;if(f===r&&++u===i&&(s=o),f===a&&++c===n&&(l=o),(d=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=d}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(u2={focusedElem:e,selectionRange:r},P_=!1,je=t;je!==null;)if(t=je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,je=e;else for(;je!==null;){t=je;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,y=g.memoizedState,_=t.stateNode,x=_.getSnapshotBeforeUpdate(t.elementType===t.type?m:oa(t.type,m),y);_.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(me(163))}}catch(S){lr(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,je=e;break}je=t.return}return g=qD,qD=!1,g}function lp(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&T2(t,r,a)}i=i.next}while(i!==n)}}function P1(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function M2(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function wV(e){var t=e.alternate;t!==null&&(e.alternate=null,wV(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Fa],delete t[Fp],delete t[f2],delete t[DX],delete t[EX])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function SV(e){return e.tag===5||e.tag===3||e.tag===4}function KD(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||SV(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function A2(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=R_));else if(n!==4&&(e=e.child,e!==null))for(A2(e,t,r),e=e.sibling;e!==null;)A2(e,t,r),e=e.sibling}function k2(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(k2(e,t,r),e=e.sibling;e!==null;)k2(e,t,r),e=e.sibling}var Xr=null,la=!1;function Ms(e,t,r){for(r=r.child;r!==null;)CV(e,t,r),r=r.sibling}function CV(e,t,r){if(Ya&&typeof Ya.onCommitFiberUnmount=="function")try{Ya.onCommitFiberUnmount(C1,r)}catch{}switch(r.tag){case 5:pn||qh(r,t);case 6:var n=Xr,i=la;Xr=null,Ms(e,t,r),Xr=n,la=i,Xr!==null&&(la?(e=Xr,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Xr.removeChild(r.stateNode));break;case 18:Xr!==null&&(la?(e=Xr,r=r.stateNode,e.nodeType===8?Gw(e.parentNode,r):e.nodeType===1&&Gw(e,r),Rp(e)):Gw(Xr,r.stateNode));break;case 4:n=Xr,i=la,Xr=r.stateNode.containerInfo,la=!0,Ms(e,t,r),Xr=n,la=i;break;case 0:case 11:case 14:case 15:if(!pn&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&T2(r,t,o),i=i.next}while(i!==n)}Ms(e,t,r);break;case 1:if(!pn&&(qh(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){lr(r,t,s)}Ms(e,t,r);break;case 21:Ms(e,t,r);break;case 22:r.mode&1?(pn=(n=pn)||r.memoizedState!==null,Ms(e,t,r),pn=n):Ms(e,t,r);break;default:Ms(e,t,r)}}function JD(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new qX),t.forEach(function(n){var i=oq.bind(null,e,n);r.has(n)||(r.add(n),n.then(i,i))})}}function ta(e,t){var r=t.deletions;if(r!==null)for(var n=0;ni&&(i=o),n&=~a}if(n=i,n=yr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*QX(n/1960))-n,10e?16:e,$s===null)var n=!1;else{if(e=$s,$s=null,Y_=0,Mt&6)throw Error(me(331));var i=Mt;for(Mt|=4,je=e.current;je!==null;){var a=je,o=a.child;if(je.flags&16){var s=a.deletions;if(s!==null){for(var l=0;lyr()-Fk?Zu(e,0):Bk|=r),Xn(e,t)}function PV(e,t){t===0&&(e.mode&1?(t=oy,oy<<=1,!(oy&130023424)&&(oy=4194304)):t=1);var r=In();e=is(e,t),e!==null&&(Gg(e,t,r),Xn(e,r))}function aq(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),PV(e,r)}function oq(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(me(314))}n!==null&&n.delete(t),PV(e,r)}var DV;DV=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||$n.current)Zn=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Zn=!1,$X(e,t,r);Zn=!!(e.flags&131072)}else Zn=!1,Jt&&t.flags&1048576&&OF(t,B_,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;Y0(e,t),e=t.pendingProps;var i=Tf(t,xn.current);cf(t,r),i=Dk(null,t,n,e,i,r);var a=Ek();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Yn(n)?(a=!0,O_(t)):a=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,kk(t),i.updater=N1,t.stateNode=i,i._reactInternals=t,y2(t,n,e,r),t=b2(null,t,n,!0,a,r)):(t.tag=0,Jt&&a&&bk(t),Tn(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(Y0(e,t),e=t.pendingProps,i=n._init,n=i(n._payload),t.type=n,i=t.tag=lq(n),e=oa(n,e),i){case 0:t=x2(null,t,n,e,r);break e;case 1:t=$D(null,t,n,e,r);break e;case 11:t=WD(null,t,n,e,r);break e;case 14:t=ZD(null,t,n,oa(n.type,e),r);break e}throw Error(me(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:oa(n,i),x2(e,t,n,i,r);case 1:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:oa(n,i),$D(e,t,n,i,r);case 3:e:{if(gV(t),e===null)throw Error(me(387));n=t.pendingProps,a=t.memoizedState,i=a.element,HF(e,t),G_(t,n,null,r);var o=t.memoizedState;if(n=o.element,a.isDehydrated)if(a={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){i=Lf(Error(me(423)),t),t=YD(e,t,n,r,i);break e}else if(n!==i){i=Lf(Error(me(424)),t),t=YD(e,t,n,r,i);break e}else for(ai=al(t.stateNode.containerInfo.firstChild),ui=t,Jt=!0,ua=null,r=VF(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Mf(),n===i){t=as(e,t,r);break e}Tn(e,t,n,r)}t=t.child}return t;case 5:return UF(t),e===null&&p2(t),n=t.type,i=t.pendingProps,a=e!==null?e.memoizedProps:null,o=i.children,c2(n,i)?o=null:a!==null&&c2(n,a)&&(t.flags|=32),pV(e,t),Tn(e,t,o,r),t.child;case 6:return e===null&&p2(t),null;case 13:return mV(e,t,r);case 4:return Lk(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Af(t,null,n,r):Tn(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:oa(n,i),WD(e,t,n,i,r);case 7:return Tn(e,t,t.pendingProps,r),t.child;case 8:return Tn(e,t,t.pendingProps.children,r),t.child;case 12:return Tn(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,a=t.memoizedProps,o=i.value,Wt(F_,n._currentValue),n._currentValue=o,a!==null)if(ma(a.value,o)){if(a.children===i.children&&!$n.current){t=as(e,t,r);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var s=a.dependencies;if(s!==null){o=a.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(a.tag===1){l=$o(-1,r&-r),l.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}a.lanes|=r,l=a.alternate,l!==null&&(l.lanes|=r),g2(a.return,r,t),s.lanes|=r;break}l=l.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(me(341));o.lanes|=r,s=o.alternate,s!==null&&(s.lanes|=r),g2(o,r,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Tn(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,cf(t,r),i=Fi(i),n=n(i),t.flags|=1,Tn(e,t,n,r),t.child;case 14:return n=t.type,i=oa(n,t.pendingProps),i=oa(n.type,i),ZD(e,t,n,i,r);case 15:return dV(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:oa(n,i),Y0(e,t),t.tag=1,Yn(n)?(e=!0,O_(t)):e=!1,cf(t,r),cV(t,n,i),y2(t,n,i,r),b2(null,t,n,!0,e,r);case 19:return yV(e,t,r);case 22:return vV(e,t,r)}throw Error(me(156,t.tag))};function EV(e,t){return sF(e,t)}function sq(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ei(e,t,r,n){return new sq(e,t,r,n)}function Uk(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lq(e){if(typeof e=="function")return Uk(e)?1:0;if(e!=null){if(e=e.$$typeof,e===uk)return 11;if(e===ck)return 14}return 2}function ul(e,t){var r=e.alternate;return r===null?(r=Ei(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function K0(e,t,r,n,i,a){var o=2;if(n=e,typeof e=="function")Uk(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Vh:return $u(r.children,i,a,t);case lk:o=8,i|=8;break;case GT:return e=Ei(12,r,t,i|2),e.elementType=GT,e.lanes=a,e;case HT:return e=Ei(13,r,t,i),e.elementType=HT,e.lanes=a,e;case UT:return e=Ei(19,r,t,i),e.elementType=UT,e.lanes=a,e;case UB:return E1(r,i,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case GB:o=10;break e;case HB:o=9;break e;case uk:o=11;break e;case ck:o=14;break e;case Bs:o=16,n=null;break e}throw Error(me(130,e==null?e:typeof e,""))}return t=Ei(o,r,t,i),t.elementType=e,t.type=n,t.lanes=a,t}function $u(e,t,r,n){return e=Ei(7,e,n,t),e.lanes=r,e}function E1(e,t,r,n){return e=Ei(22,e,n,t),e.elementType=UB,e.lanes=r,e.stateNode={isHidden:!1},e}function qw(e,t,r){return e=Ei(6,e,null,t),e.lanes=r,e}function Kw(e,t,r){return t=Ei(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function uq(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Nw(0),this.expirationTimes=Nw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nw(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Wk(e,t,r,n,i,a,o,s,l){return e=new uq(e,t,r,s,l),t===1?(t=1,a===!0&&(t|=8)):t=0,a=Ei(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},kk(a),e}function cq(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(zV)}catch(e){console.error(e)}}zV(),zB.exports=di;var BV=zB.exports,oE=BV;FT.createRoot=oE.createRoot,FT.hydrateRoot=oE.hydrateRoot;/** - * @remix-run/router v1.23.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function $p(){return $p=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Xk(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function gq(){return Math.random().toString(36).substr(2,8)}function lE(e,t){return{usr:e.state,key:e.key,idx:t}}function D2(e,t,r,n){return r===void 0&&(r=null),$p({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?rd(t):t,{state:r,key:t&&t.key||n||gq()})}function K_(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function rd(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function mq(e,t,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:a=!1}=n,o=i.history,s=Ys.Pop,l=null,u=c();u==null&&(u=0,o.replaceState($p({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function h(){s=Ys.Pop;let y=c(),_=y==null?null:y-u;u=y,l&&l({action:s,location:m.location,delta:_})}function f(y,_){s=Ys.Push;let x=D2(m.location,y,_);u=c()+1;let w=lE(x,u),S=m.createHref(x);try{o.pushState(w,"",S)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;i.location.assign(S)}a&&l&&l({action:s,location:m.location,delta:1})}function d(y,_){s=Ys.Replace;let x=D2(m.location,y,_);u=c();let w=lE(x,u),S=m.createHref(x);o.replaceState(w,"",S),a&&l&&l({action:s,location:m.location,delta:0})}function g(y){let _=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof y=="string"?y:K_(y);return x=x.replace(/ $/,"%20"),Tr(_,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,_)}let m={get action(){return s},get location(){return e(i,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(sE,h),l=y,()=>{i.removeEventListener(sE,h),l=null}},createHref(y){return t(i,y)},createURL:g,encodeLocation(y){let _=g(y);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:f,replace:d,go(y){return o.go(y)}};return m}var uE;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(uE||(uE={}));function yq(e,t,r){return r===void 0&&(r="/"),_q(e,t,r)}function _q(e,t,r,n){let i=typeof t=="string"?rd(t):t,a=qk(i.pathname||"/",r);if(a==null)return null;let o=FV(e);xq(o);let s=null,l=Pq(a);for(let u=0;s==null&&u{let l={relativePath:s===void 0?a.path||"":s,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};l.relativePath.startsWith("/")&&(Tr(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let u=cl([n,l.relativePath]),c=r.concat(l);a.children&&a.children.length>0&&(Tr(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),FV(a.children,t,c,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:Aq(u,a.index),routesMeta:c})};return e.forEach((a,o)=>{var s;if(a.path===""||!((s=a.path)!=null&&s.includes("?")))i(a,o);else for(let l of VV(a.path))i(a,o,l)}),t}function VV(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,i=r.endsWith("?"),a=r.replace(/\?$/,"");if(n.length===0)return i?[a,""]:[a];let o=VV(n.join("/")),s=[];return s.push(...o.map(l=>l===""?a:[a,l].join("/"))),i&&s.push(...o),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function xq(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:kq(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const bq=/^:[\w-]+$/,wq=3,Sq=2,Cq=1,Tq=10,Mq=-2,cE=e=>e==="*";function Aq(e,t){let r=e.split("/"),n=r.length;return r.some(cE)&&(n+=Mq),t&&(n+=Sq),r.filter(i=>!cE(i)).reduce((i,a)=>i+(bq.test(a)?wq:a===""?Cq:Tq),n)}function kq(e,t){return e.length===t.length&&e.slice(0,-1).every((n,i)=>n===t[i])?e[e.length-1]-t[t.length-1]:0}function Lq(e,t,r){let{routesMeta:n}=e,i={},a="/",o=[];for(let s=0;s{let{paramName:f,isOptional:d}=c;if(f==="*"){let m=s[h]||"";o=a.slice(0,a.length-m.length).replace(/(.)\/+$/,"$1")}const g=s[h];return d&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function Nq(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),Xk(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,s,l)=>(n.push({paramName:s,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),n]}function Pq(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Xk(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function qk(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const Dq=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Eq=e=>Dq.test(e);function Rq(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:i=""}=typeof e=="string"?rd(e):e,a;if(r)if(Eq(r))a=r;else{if(r.includes("//")){let o=r;r=UV(r),Xk(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?a=hE(r.substring(1),"/"):a=hE(r,t)}else a=t;return{pathname:a,search:zq(n),hash:Bq(i)}}function hE(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Jw(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function jq(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function GV(e,t){let r=jq(e);return t?r.map((n,i)=>i===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function HV(e,t,r,n){n===void 0&&(n=!1);let i;typeof e=="string"?i=rd(e):(i=$p({},e),Tr(!i.pathname||!i.pathname.includes("?"),Jw("?","pathname","search",i)),Tr(!i.pathname||!i.pathname.includes("#"),Jw("#","pathname","hash",i)),Tr(!i.search||!i.search.includes("#"),Jw("#","search","hash",i)));let a=e===""||i.pathname==="",o=a?"/":i.pathname,s;if(o==null)s=r;else{let h=t.length-1;if(!n&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),h-=1;i.pathname=f.join("/")}s=h>=0?t[h]:"/"}let l=Rq(i,s),u=o&&o!=="/"&&o.endsWith("/"),c=(a||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const UV=e=>e.replace(/\/\/+/g,"/"),cl=e=>UV(e.join("/")),Oq=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),zq=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Bq=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Fq(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const WV=["post","put","patch","delete"];new Set(WV);const Vq=["get",...WV];new Set(Vq);/** - * React Router v6.30.4 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Yp(){return Yp=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),G.useCallback(function(u,c){if(c===void 0&&(c={}),!s.current)return;if(typeof u=="number"){n.go(u);return}let h=HV(u,JSON.parse(o),a,c.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:cl([t,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[t,n,o,a,e])}function XV(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=G.useContext(Oc),{matches:i}=G.useContext(zc),{pathname:a}=nd(),o=JSON.stringify(GV(i,n.v7_relativeSplatPath));return G.useMemo(()=>HV(e,JSON.parse(o),a,r==="path"),[e,o,a,r])}function Wq(e,t){return Zq(e,t)}function Zq(e,t,r,n){Zg()||Tr(!1);let{navigator:i}=G.useContext(Oc),{matches:a}=G.useContext(zc),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=nd(),c;if(t){var h;let y=typeof t=="string"?rd(t):t;l==="/"||(h=y.pathname)!=null&&h.startsWith(l)||Tr(!1),c=y}else c=u;let f=c.pathname||"/",d=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");d="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=yq(e,{pathname:d}),m=Kq(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},s,y.params),pathname:cl([l,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:cl([l,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),a,r,n);return t&&m?G.createElement(B1.Provider,{value:{location:Yp({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:Ys.Pop}},m):m}function $q(){let e=tK(),t=Fq(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return G.createElement(G.Fragment,null,G.createElement("h2",null,"Unexpected Application Error!"),G.createElement("h3",{style:{fontStyle:"italic"}},t),r?G.createElement("pre",{style:i},r):null,null)}const Yq=G.createElement($q,null);class Xq extends G.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?G.createElement(zc.Provider,{value:this.props.routeContext},G.createElement(ZV.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function qq(e){let{routeContext:t,match:r,children:n}=e,i=G.useContext(Kk);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),G.createElement(zc.Provider,{value:t},n)}function Kq(e,t,r,n){var i;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var a;if(!r)return null;if(r.errors)e=r.matches;else if((a=n)!=null&&a.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,s=(i=r)==null?void 0:i.errors;if(s!=null){let c=o.findIndex(h=>h.route.id&&(s==null?void 0:s[h.route.id])!==void 0);c>=0||Tr(!1),o=o.slice(0,Math.min(o.length,c+1))}let l=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((c,h,f)=>{let d,g=!1,m=null,y=null;r&&(d=s&&h.route.id?s[h.route.id]:void 0,m=h.route.errorElement||Yq,l&&(u<0&&f===0?(nK("route-fallback"),g=!0,y=null):u===f&&(g=!0,y=h.route.hydrateFallbackElement||null)));let _=t.concat(o.slice(0,f+1)),x=()=>{let w;return d?w=m:g?w=y:h.route.Component?w=G.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=c,G.createElement(qq,{match:h,routeContext:{outlet:c,matches:_,isDataRoute:r!=null},children:w})};return r&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?G.createElement(Xq,{location:r.location,revalidation:r.revalidation,component:m,error:d,children:x(),routeContext:{outlet:null,matches:_,isDataRoute:!0}}):x()},null)}var qV=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(qV||{}),KV=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(KV||{});function Jq(e){let t=G.useContext(Kk);return t||Tr(!1),t}function Qq(e){let t=G.useContext(Gq);return t||Tr(!1),t}function eK(e){let t=G.useContext(zc);return t||Tr(!1),t}function JV(e){let t=eK(),r=t.matches[t.matches.length-1];return r.route.id||Tr(!1),r.route.id}function tK(){var e;let t=G.useContext(ZV),r=Qq(),n=JV();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function rK(){let{router:e}=Jq(qV.UseNavigateStable),t=JV(KV.UseNavigateStable),r=G.useRef(!1);return $V(()=>{r.current=!0}),G.useCallback(function(i,a){a===void 0&&(a={}),r.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,Yp({fromRouteId:t},a)))},[e,t])}const fE={};function nK(e,t,r){fE[e]||(fE[e]=!0)}function iK(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function na(e){Tr(!1)}function aK(e){let{basename:t="/",children:r=null,location:n,navigationType:i=Ys.Pop,navigator:a,static:o=!1,future:s}=e;Zg()&&Tr(!1);let l=t.replace(/^\/*/,"/"),u=G.useMemo(()=>({basename:l,navigator:a,static:o,future:Yp({v7_relativeSplatPath:!1},s)}),[l,s,a,o]);typeof n=="string"&&(n=rd(n));let{pathname:c="/",search:h="",hash:f="",state:d=null,key:g="default"}=n,m=G.useMemo(()=>{let y=qk(c,l);return y==null?null:{location:{pathname:y,search:h,hash:f,state:d,key:g},navigationType:i}},[l,c,h,f,d,g,i]);return m==null?null:G.createElement(Oc.Provider,{value:u},G.createElement(B1.Provider,{children:r,value:m}))}function oK(e){let{children:t,location:r}=e;return Wq(E2(t),r)}new Promise(()=>{});function E2(e,t){t===void 0&&(t=[]);let r=[];return G.Children.forEach(e,(n,i)=>{if(!G.isValidElement(n))return;let a=[...t,i];if(n.type===G.Fragment){r.push.apply(r,E2(n.props.children,a));return}n.type!==na&&Tr(!1),!n.props.index||!n.props.children||Tr(!1);let o={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=E2(n.props.children,a)),r.push(o)}),r}/** - * React Router DOM v6.30.4 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function R2(){return R2=Object.assign?Object.assign.bind():function(e){for(var t=1;t{u&&dE?dE(()=>l(h)):l(h)},[l,u]);return G.useLayoutEffect(()=>o.listen(c),[o,c]),G.useEffect(()=>iK(n),[n]),G.createElement(aK,{basename:t,children:r,location:s.location,navigationType:s.action,navigator:o,future:n})}const vK=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pK=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gK=G.forwardRef(function(t,r){let{onClick:n,relative:i,reloadDocument:a,replace:o,state:s,target:l,to:u,preventScrollReset:c,viewTransition:h}=t,f=sK(t,cK),{basename:d}=G.useContext(Oc),g,m=!1;if(typeof u=="string"&&pK.test(u)&&(g=u,vK))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),T=qk(S.pathname,d);S.origin===w.origin&&T!=null?u=T+S.search+S.hash:m=!0}catch{}let y=Hq(u,{relative:i}),_=mK(u,{replace:o,state:s,target:l,preventScrollReset:c,relative:i,viewTransition:h});function x(w){n&&n(w),w.defaultPrevented||_(w)}return G.createElement("a",R2({},f,{href:g||y,onClick:m||a?n:x,ref:r,target:l}))});var vE;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(vE||(vE={}));var pE;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(pE||(pE={}));function mK(e,t){let{target:r,replace:n,state:i,preventScrollReset:a,relative:o,viewTransition:s}=t===void 0?{}:t,l=YV(),u=nd(),c=XV(e,{relative:o});return G.useCallback(h=>{if(uK(h,r)){h.preventDefault();let f=n!==void 0?n:K_(u)===K_(c);l(e,{replace:f,state:i,preventScrollReset:a,relative:o,viewTransition:s})}},[u,l,c,n,i,r,e,a,o,s])}/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yK=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),QV=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var _K={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xK=G.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:i="",children:a,iconNode:o,...s},l)=>G.createElement("svg",{ref:l,..._K,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:QV("lucide",i),...s},[...o.map(([u,c])=>G.createElement(u,c)),...Array.isArray(a)?a:[a]]));/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Oe=(e,t)=>{const r=G.forwardRef(({className:n,...i},a)=>G.createElement(xK,{ref:a,iconNode:t,className:QV(`lucide-${yK(e)}`,n),...i}));return r.displayName=`${e}`,r};/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const id=Oe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qw=Oe("Battery",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bK=Oe("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xp=Oe("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const e6=Oe("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wK=Oe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SK=Oe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CK=Oe("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const F1=Oe("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ao=Oe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jl=Oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TK=Oe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sl=Oe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MK=Oe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const os=Oe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Jk=Oe("CircleCheckBig",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lc=Oe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AK=Oe("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uc=Oe("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kK=Oe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const t6=Oe("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LK=Oe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const r6=Oe("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IK=Oe("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const n6=Oe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const V1=Oe("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nf=Oe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const i6=Oe("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qk=Oe("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eL=Oe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const G1=Oe("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NK=Oe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PK=Oe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const H1=Oe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const a6=Oe("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o6=Oe("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $g=Oe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DK=Oe("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ad=Oe("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EK=Oe("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tL=Oe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const U1=Oe("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const s6=Oe("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const od=Oe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gi=Oe("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qp=Oe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const W1=Oe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RK=Oe("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Z1=Oe("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rL=Oe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $1=Oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const j2=Oe("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jK=Oe("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const l6=Oe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nL=Oe("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OK=Oe("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u6=Oe("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c6=Oe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Yg=Oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oo=Oe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zK=Oe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h6=Oe("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Y1=Oe("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ya=Oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.383.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Pf=Oe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);async function Yi(e){const t=await fetch(e);if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function gE(){return Yi("/api/status")}async function BK(){return Yi("/api/health")}async function FK(){return Yi("/api/nodes")}async function VK(){return Yi("/api/edges")}async function GK(){return Yi("/api/sources")}async function f6(){return Yi("/api/alerts/active")}async function mE(e=50,t=0,r,n){const i=new URLSearchParams;return i.set("limit",e.toString()),i.set("offset",t.toString()),r&&r!=="all"&&i.set("type",r),n&&n!=="all"&&i.set("severity",n),Yi(`/api/alerts/history?${i.toString()}`)}async function HK(){return Yi("/api/subscriptions")}async function d6(){return Yi("/api/env/status")}async function v6(){return Yi("/api/env/active")}async function UK(){return Yi("/api/env/swpc")}async function WK(){return Yi("/api/regions")}function iL(){const[e,t]=G.useState(!1),[r,n]=G.useState(null),[i,a]=G.useState(null),[o,s]=G.useState(null),l=G.useRef(null),u=G.useRef(null),c=G.useRef(1e3),h=G.useCallback(()=>{var g;if(((g=l.current)==null?void 0:g.readyState)===WebSocket.OPEN)return;const d=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/live`;try{const m=new WebSocket(d);l.current=m,m.onopen=()=>{t(!0),c.current=1e3},m.onmessage=_=>{try{const x=JSON.parse(_.data);switch(s(x),x.type){case"health_update":n(x.data);break;case"alert_fired":a(x.data);break}}catch(x){console.error("Failed to parse WebSocket message:",x)}},m.onclose=()=>{t(!1),l.current=null;const _=Math.min(c.current,3e4);u.current=window.setTimeout(()=>{c.current=Math.min(_*2,3e4),h()},_)},m.onerror=()=>{m.close()};const y=setInterval(()=>{m.readyState===WebSocket.OPEN&&m.send("ping")},3e4);m.addEventListener("close",()=>{clearInterval(y)})}catch(m){console.error("Failed to create WebSocket:",m)}},[]);return G.useEffect(()=>(h(),()=>{u.current&&clearTimeout(u.current),l.current&&l.current.close()}),[h]),{connected:e,lastHealth:r,lastAlert:i,lastMessage:o}}const p6=G.createContext(null);function ZK(){const e=G.useContext(p6);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}function $K(e){switch(e==null?void 0:e.toLowerCase()){case"critical":case"emergency":return{bg:"bg-red-500/10",border:"border-red-500",icon:os,iconColor:"text-red-500"};case"warning":return{bg:"bg-amber-500/10",border:"border-amber-500",icon:oo,iconColor:"text-amber-500"};default:return{bg:"bg-sky-400/10",border:"border-sky-400",icon:H1,iconColor:"text-sky-400"}}}function YK({toast:e,onDismiss:t,onNavigate:r}){const n=$K(e.alert.severity),i=n.icon;return G.useEffect(()=>{const a=setTimeout(t,8e3);return()=>clearTimeout(a)},[t]),v.jsx("div",{className:`${n.bg} border ${n.border} shadow-lg overflow-hidden animate-slide-in cursor-pointer`,onClick:r,role:"alert",children:v.jsxs("div",{className:"flex items-start gap-3 p-4",children:[v.jsx("div",{className:`w-1 self-stretch -ml-4 -my-4 ${n.border.replace("border","bg")}`}),v.jsx(i,{size:18,className:n.iconColor}),v.jsxs("div",{className:"flex-1 min-w-0 pr-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-200 mb-0.5",children:e.alert.type.replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase())}),v.jsx("div",{className:"text-sm text-slate-300 line-clamp-2",children:e.alert.message})]}),v.jsx("button",{onClick:a=>{a.stopPropagation(),t()},className:"text-slate-400 hover:text-slate-200 transition-colors",children:v.jsx(ya,{size:16})})]})})}function XK({children:e}){const[t,r]=G.useState([]),n=YV(),i=G.useCallback(s=>{const l=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>[...u,{id:l,alert:s}])},[]),a=G.useCallback(s=>{r(l=>l.filter(u=>u.id!==s))},[]),o=G.useCallback(()=>{n("/alerts")},[n]);return v.jsxs(p6.Provider,{value:{addToast:i},children:[e,v.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm w-full pointer-events-none",children:t.map(s=>v.jsx("div",{className:"pointer-events-auto",children:v.jsx(YK,{toast:s,onDismiss:()=>a(s.id),onNavigate:o})},s.id))})]})}const X1="meshai.restartRequired.v1";function yE(){try{const e=localStorage.getItem(X1);if(!e)return{required:!1,changedKeys:[],ts:0};const t=JSON.parse(e);return{required:!!t.required,changedKeys:Array.isArray(t.changedKeys)?t.changedKeys:[],ts:Number(t.ts)||0}}catch{return{required:!1,changedKeys:[],ts:0}}}function qK(e){const t={required:!0,changedKeys:[...new Set(e)],ts:Date.now()};localStorage.setItem(X1,JSON.stringify(t)),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:t}))}function _E(){localStorage.removeItem(X1),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:{required:!1,changedKeys:[],ts:0}}))}function KK(){const[e,t]=G.useState(()=>yE()),[r,n]=G.useState(!1),[i,a]=G.useState(null);G.useEffect(()=>{const l=c=>{const h=c.detail;t(h)},u=c=>{c.key===X1&&t(yE())};return window.addEventListener("meshai:restart-required",l),window.addEventListener("storage",u),()=>{window.removeEventListener("meshai:restart-required",l),window.removeEventListener("storage",u)}},[]);const o=G.useCallback(async()=>{n(!0),a(null);try{const l=await fetch("/api/system/restart",{method:"POST"});if(!l.ok&&l.status!==202){const u=await l.json().catch(()=>({}));throw new Error(u.detail||`HTTP ${l.status}`)}_E()}catch(l){a(String(l)),n(!1)}},[]),s=G.useCallback(()=>{_E()},[]);return e.required?v.jsxs("div",{className:"bg-yellow-900/40 border-b border-yellow-700 text-yellow-100 px-4 py-2 text-sm flex items-center gap-3",children:[v.jsx(oo,{className:"w-4 h-4 flex-shrink-0 text-yellow-300"}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("strong",{children:"Container restart required"}),e.changedKeys.length>0&&v.jsxs("span",{className:"text-yellow-300 ml-2",children:["(",e.changedKeys.length," key",e.changedKeys.length===1?"":"s",":"," ",v.jsxs("span",{className:"font-mono text-xs",children:[e.changedKeys.slice(0,3).join(", "),e.changedKeys.length>3?", …":""]}),")"]}),v.jsx("span",{className:"ml-2 text-yellow-300/80",children:"for these changes to take effect. Until then the runtime keeps its boot-time configuration. Restart-required keys include anything under Config → environmental (feed_source, central URL), the LLM backend swap, and the dispatcher cold-start grace window. Other keys take effect on the next handler call."}),i&&v.jsx("div",{className:"text-red-400 text-xs mt-1",children:i})]}),v.jsxs("button",{onClick:o,disabled:r,className:"flex items-center gap-1 px-3 py-1 bg-yellow-700 hover:bg-yellow-600 disabled:opacity-50 rounded text-white text-xs",children:[v.jsx(RK,{className:`w-3 h-3 ${r?"animate-spin":""}`}),r?"Restarting…":"Restart now"]}),v.jsx("button",{onClick:s,className:"text-yellow-300 hover:text-white px-1",title:"Dismiss (you can still restart later)",children:v.jsx(ya,{className:"w-4 h-4"})})]}):null}const g6=[{path:"/",label:"Dashboard",icon:o6},{path:"/mesh",label:"Mesh",icon:Gi},{path:"/environment",label:"Environment",icon:uc},{path:"/config",label:"Config",icon:l6},{path:"/alerts",label:"Alerts",icon:Xp},{path:"/notifications",label:"Notifications",icon:bK},{path:"/reference",label:"Reference",icon:e6},{path:"/adapter-config",label:"Adapter Config",icon:nL},{path:"/gauge-sites",label:"Gauge Sites",icon:V1},{path:"/town-anchors",label:"Town Anchors",icon:ad}];function JK(e){const t=Math.floor(e/86400),r=Math.floor(e%86400/3600),n=Math.floor(e%3600/60);return t>0?`${t}d ${r}h`:r>0?`${r}h ${n}m`:`${n}m`}function QK(e){const t=g6.find(r=>r.path===e);return(t==null?void 0:t.label)||"Dashboard"}function eJ({children:e}){var f;const t=nd(),{connected:r,lastAlert:n}=iL(),{addToast:i}=ZK(),[a,o]=G.useState(null),[s,l]=G.useState(null);G.useEffect(()=>{if(n){const d=`${n.type}-${n.message}-${n.timestamp}`;d!==s&&(l(d),i(n))}},[n,s,i]);const[u,c]=G.useState(new Date);G.useEffect(()=>{gE().then(o).catch(console.error);const d=setInterval(()=>{gE().then(o).catch(console.error)},3e4);return()=>clearInterval(d)},[]),G.useEffect(()=>{const d=setInterval(()=>c(new Date),1e3);return()=>clearInterval(d)},[]);const h=u.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return v.jsxs("div",{className:"flex h-screen overflow-hidden bg-bg text-white",children:[v.jsxs("aside",{className:"w-[220px] flex-shrink-0 bg-bg-card border-r border-border flex flex-col overflow-y-auto",children:[v.jsxs("div",{className:"bg-[#000000] px-4 py-3 border-b border-border flex flex-col items-center",children:[v.jsx("img",{src:"/meshai-logo.png",alt:"MeshAI",className:"w-[190px] block"}),v.jsxs("div",{className:"font-mono text-[10px] text-[#555] mt-1 self-start",children:["v",(a==null?void 0:a.version)||"..."]})]}),v.jsx("nav",{className:"flex-1 py-4",children:g6.map(d=>{const g=t.pathname===d.path,m=d.icon;return v.jsxs(gK,{to:d.path,className:`flex items-center gap-3 px-5 py-3 text-sm font-sans transition-colors relative ${g?"text-white bg-transparent":"text-[#777] hover:text-white hover:bg-bg-hover"}`,children:[g&&v.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-[2px] bg-[#f59e0b]"}),v.jsx(m,{size:16}),d.label]},d.path)})}),v.jsxs("div",{className:"p-5 border-t border-border",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${a!=null&&a.connected?"bg-green-500":"bg-red-500"}`}),v.jsx("span",{className:"text-xs font-sans text-[#777]",children:a!=null&&a.connected?"Connected":"Disconnected"})]}),v.jsxs("div",{className:"text-xs font-mono text-[#666] truncate",children:[(f=a==null?void 0:a.connection_type)==null?void 0:f.toUpperCase(),": ",a==null?void 0:a.connection_target]}),v.jsxs("div",{className:"text-xs font-sans text-[#666] mt-1",children:["Uptime: ",v.jsx("span",{className:"font-mono",children:a?JK(a.uptime_seconds):"..."})]})]})]}),v.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[v.jsxs("header",{className:"h-14 flex-shrink-0 border-b border-border bg-bg-card flex items-center justify-between px-6",children:[v.jsx("h1",{className:"text-lg font-sans font-semibold text-white",children:QK(t.pathname)}),v.jsxs("div",{className:"flex items-center gap-6",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${r?"bg-accent animate-pulse-slow":"bg-[#333]"}`}),v.jsx("span",{className:"text-xs font-sans text-[#777]",children:r?"Live":"Offline"})]}),v.jsxs("div",{className:"text-sm font-mono text-[#666]",children:[h," MT"]})]})]}),v.jsxs("main",{className:"flex-1 overflow-y-auto p-6",children:[v.jsx(KK,{}),e]})]})]})}function tJ({health:e}){const t=e.score,r=e.tier,n=2*Math.PI*45,i=t/100*n;return v.jsx("div",{className:"flex flex-col items-center",children:v.jsxs("svg",{width:"140",height:"140",viewBox:"0 0 100 100",children:[v.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#1e1e1e",strokeWidth:"8"}),v.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#f59e0b",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:n,strokeDashoffset:n-i,transform:"rotate(-90 50 50)",className:"transition-all duration-500"}),v.jsx("text",{x:"50",y:"46",textAnchor:"middle",className:"font-mono font-bold",style:{fontSize:"24px",fill:"#f59e0b"},children:t.toFixed(1)}),v.jsx("text",{x:"50",y:"62",textAnchor:"middle",className:"font-sans",style:{fontSize:"10px",fill:"#444"},children:r})]})})}function iv({label:e,value:t}){const r=n=>n>66?"bg-accent":n>33?"bg-accent-dim":"bg-red-500";return v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-24 text-xs font-sans text-[#777] truncate",children:e}),v.jsx("div",{className:"flex-1 h-2 bg-border overflow-hidden",children:v.jsx("div",{className:`h-full ${r(t)} transition-all duration-300`,style:{width:`${t}%`}})}),v.jsx("div",{className:"w-12 text-right text-xs font-mono text-[#e0e0e0]",children:t.toFixed(1)})]})}function rJ({alert:e}){const r=(i=>{switch(i.toLowerCase()){case"critical":case"emergency":case"immediate":return{bg:"bg-red-500/5",border:"border-red-500",icon:os,iconColor:"text-red-500"};case"warning":case"priority":return{bg:"bg-accent/5",border:"border-accent",icon:oo,iconColor:"text-accent"};case"routine":default:return{bg:"bg-[#161616]",border:"border-[#333]",icon:H1,iconColor:"text-[#777]"}}})(e.severity),n=r.icon;return v.jsxs("div",{className:`p-3 ${r.bg} border-l-2 ${r.border} flex items-start gap-3`,children:[v.jsx(n,{size:16,className:r.iconColor}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm font-sans font-medium text-white",children:e.message}),v.jsx("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:e.timestamp||"Just now"})]})]})}function nJ({source:e}){const t=()=>e.is_loaded?e.last_error?"bg-accent":"bg-green-500":"bg-red-500";return v.jsxs("div",{className:"flex items-center gap-3 p-2 bg-bg-hover",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${t()}`}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm font-sans font-medium text-white truncate",children:e.name}),v.jsxs("div",{className:"text-[10px] font-sans text-[#666]",children:[e.node_count," nodes · ",e.type]})]})]})}function yy({icon:e,label:t,value:r,subvalue:n,accent:i}){return v.jsxs("div",{className:"bg-bg-card border border-border p-3",style:i?{borderTopWidth:"2px",borderTopColor:i}:void 0,children:[v.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[v.jsx(e,{size:14,style:{color:i||"#333"}}),v.jsx("span",{className:"text-[9px] font-sans uppercase tracking-widest text-[#666]",children:t})]}),v.jsx("div",{className:"font-mono text-xl",style:{color:i||"#e0e0e0"},children:r}),n&&v.jsx("div",{className:"text-[9px] font-sans mt-1 text-[#666]",children:n})]})}function iJ({bandConditions:e}){const t=a=>{switch(a){case"Good":return"bg-green-500";case"Fair":return"bg-accent";case"Poor":return"bg-red-500";default:return"bg-[#333]"}},r=a=>{switch(a){case"Good":return"text-green-500";case"Fair":return"text-accent";case"Poor":return"text-red-500";default:return"text-[#666]"}},n=a=>a?a.includes("Night")?"🌙":"☀️":"";if(!(e!=null&&e.enabled)||!(e!=null&&e.ratings))return v.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[v.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[v.jsx(Pf,{size:14}),"RF Propagation"]}),v.jsx("div",{className:"flex-1 flex items-center justify-center",children:v.jsx("div",{className:"text-center py-8",children:v.jsx("div",{className:"font-sans text-[#666]",children:"No band conditions data"})})})]});const i=["80-40m","30-20m","17-15m","12-10m"];return v.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[v.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[v.jsx(Pf,{size:14}),"RF Propagation"]}),v.jsxs("div",{className:"text-center mb-3",children:[v.jsx("span",{className:"text-lg",children:n(e.slot_label)}),v.jsx("span",{className:"text-sm font-sans text-[#777] ml-2",children:e.slot_label})]}),v.jsx("div",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-2 flex items-center gap-1",children:"📡 Band Conditions"}),v.jsx("div",{className:"space-y-1.5",children:i.map(a=>{var s;const o=(s=e.ratings)==null?void 0:s[a];return v.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-bg-hover",children:[v.jsx("span",{className:"text-sm font-mono text-[#777]",children:a}),v.jsxs("span",{className:"text-sm flex items-center gap-2",children:[v.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${t(o)}`}),v.jsx("span",{className:`font-sans ${r(o)}`,children:o||"—"})]})]},a)})}),v.jsxs("div",{className:"mt-auto pt-3 border-t border-border text-[10px] font-sans text-[#666]",children:[e.source&&v.jsx("span",{children:e.source==="swpc_local"?"SWPC":"HamQSL"}),e.sent_at&&v.jsx("span",{className:"font-mono ml-2",children:new Date(e.sent_at*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}const xE=[{code:"wam",label:"Western North America"},{code:"eam",label:"Eastern North America"},{code:"enp",label:"Eastern North Pacific"},{code:"esp",label:"Eastern South Pacific"},{code:"gca",label:"Gulf-Caribbean"},{code:"nsa",label:"Northern South America"},{code:"csa",label:"Central South America"},{code:"sat",label:"South Atlantic"},{code:"nat",label:"North Atlantic"},{code:"ena",label:"Eastern North Atlantic"},{code:"nwe",label:"Northwestern Europe"},{code:"eur",label:"Europe"},{code:"eeu",label:"Eastern Europe"},{code:"saf",label:"South Africa"},{code:"mde",label:"Middle East"},{code:"nca",label:"North Central Asia"},{code:"ind",label:"Indian Ocean"},{code:"sea",label:"Southeast Asia"},{code:"fea",label:"Far East"},{code:"esi",label:"Eastern Siberia"},{code:"anz",label:"Australia & New Zealand"},{code:"oce",label:"Oceania"},{code:"wnp",label:"Western North Pacific"}];function aJ(){var c;const[e,t]=G.useState("wam"),[r,n]=G.useState(!1),[i,a]=G.useState(!1);G.useEffect(()=>{fetch("/api/adapter-config/dashboard/tropo_region").then(h=>h.ok?h.json():null).then(h=>{h!=null&&h.value&&typeof h.value=="string"&&t(h.value)}).catch(()=>{})},[]);const o=h=>{t(h),n(!1),a(!0),fetch("/api/adapter-config/dashboard/tropo_region",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:h})}).catch(()=>{}).finally(()=>a(!1))},s=new Date().toISOString().slice(0,10).replace(/-/g,""),l=`https://www.dxinfocentre.com/tr_map/fcst/${e}006.png?v${s}`,u=((c=xE.find(h=>h.code===e))==null?void 0:c.label)||e;return v.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col",children:[v.jsxs("div",{className:"flex items-center justify-between mb-3",children:[v.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] flex items-center gap-2",children:[v.jsx(Gi,{size:14}),"Tropo Forecast (Hepburn)"]}),v.jsxs("div",{className:"flex items-center gap-2",children:[i&&v.jsx("span",{className:"text-xs font-sans text-[#666]",children:"saving..."}),v.jsx("select",{value:e,onChange:h=>o(h.target.value),className:"text-xs font-sans bg-bg-hover border border-border px-2 py-1 min-h-[36px] text-[#e0e0e0] focus:outline-none focus:border-accent",children:xE.map(h=>v.jsx("option",{value:h.code,children:h.label},h.code))})]})]}),v.jsxs("div",{className:"text-xs font-sans text-[#666] mb-2",children:[u," — 6-day forecast"]}),r?v.jsx("div",{className:"flex items-center justify-center h-48 text-[#666] text-sm font-sans",children:"Failed to load forecast image"}):v.jsx("img",{src:l,alt:`Hepburn tropo forecast — ${u}`,className:"w-full border border-border",onError:()=>n(!0)}),v.jsxs("div",{className:"text-[10px] font-sans text-[#666] mt-2",children:["Source: ",v.jsx("a",{href:"https://www.dxinfocentre.com/tropo.html",target:"_blank",rel:"noopener noreferrer",className:"text-sky-400 hover:text-sky-300",children:"dxinfocentre.com"})]})]})}const oJ={nws:{icon:uc,color:"text-sky-400",label:"NWS"},swpc:{icon:u6,color:"text-accent",label:"SWPC"},ducting:{icon:Gi,color:"text-sky-500",label:"Tropo"},nifc:{icon:G1,color:"text-red-500",label:"NIFC"},firms:{icon:Z1,color:"text-red-400",label:"FIRMS"},avalanche:{icon:U1,color:"text-[#777]",label:"Avy"},usgs:{icon:V1,color:"text-sky-400",label:"USGS"},traffic:{icon:F1,color:"text-[#777]",label:"Traffic"},roads:{icon:t6,color:"text-accent-dim",label:"511"}},bE={routine:"bg-[#1e1e1e] text-[#777] border-[#222]",priority:"bg-accent/5 text-accent border-accent/30",immediate:"bg-red-500/5 text-red-500 border-red-500/30",info:"bg-sky-400/10 text-sky-400 border-sky-400/30",advisory:"bg-sky-400/10 text-sky-400 border-sky-400/30",moderate:"bg-accent/5 text-accent-dim border-accent-dim/30",watch:"bg-accent/5 text-accent border-accent/30",warning:"bg-accent/5 text-accent border-accent/30",severe:"bg-red-500/5 text-red-500 border-red-500/30",extreme:"bg-red-500/5 text-red-500 border-red-500/30",critical:"bg-red-500/5 text-red-500 border-red-500/30",emergency:"bg-red-500/5 text-red-500 border-red-500/30"};function sJ({event:e,isLocal:t}){var h;const r=oJ[e.source]||{icon:H1,color:"text-[#777]",label:e.source},n=r.icon,i=bE[(h=e.severity)==null?void 0:h.toLowerCase()]||bE.info,a=f=>{const d=new Date(f*1e3),m=new Date().getTime()-d.getTime(),y=Math.floor(m/6e4);return y<1?"just now":y<60?`${y}m ago`:y<1440?`${Math.floor(y/60)}h ago`:d.toLocaleDateString(void 0,{month:"short",day:"numeric"})},o=e.event_type,s=e.area_desc,l=e.description;let u=e.headline;if(o&&s){const f=s.replace(/ County/g,"").split(";")[0];u=`${o} — ${f}`}else o&&(u=o);const c=l?l.split(". ")[0]:null;return v.jsxs("div",{className:`flex items-start gap-2 py-2 border-b border-border/50 last:border-0 ${t?"border-l-2 border-l-accent pl-2 -ml-2":""}`,children:[v.jsx(n,{size:14,className:`mt-0.5 flex-shrink-0 ${r.color}`}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[v.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide border ${i}`,children:e.severity||"info"}),t&&v.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide bg-accent/5 text-accent border border-accent/30",title:"LOCAL: event coordinates fall inside the mesh's monitoring area (per the adapter's bbox config on Environment) — operators in this region are directly affected.",children:"LOCAL"}),v.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:r.label}),v.jsx("span",{className:"text-[10px] font-mono text-[#666] ml-auto",children:a(e.fetched_at)})]}),v.jsx("div",{className:`text-sm font-sans font-medium truncate ${t?"text-white":"text-[#e0e0e0]"}`,children:u}),c&&v.jsx("div",{className:"text-[10px] font-sans text-[#666] truncate mt-0.5",children:c})]})]})}function lJ({events:e,envStatus:t,embedded:r}){const n={immediate:0,priority:1,routine:2},i=G.useMemo(()=>{const s=new Set;return e.filter(u=>u.event_id?s.has(u.event_id)?!1:(s.add(u.event_id),!0):!0).sort((u,c)=>{var m,y;const h=u.is_local?1:0,f=c.is_local?1:0;if(h!==f)return f-h;const d=n[((m=u.severity)==null?void 0:m.toLowerCase())||"routine"]??2,g=n[((y=c.severity)==null?void 0:y.toLowerCase())||"routine"]??2;return d!==g?d-g:(c.fetched_at||0)-(u.fetched_at||0)})},[e]),a=G.useMemo(()=>{if(!(t!=null&&t.feeds))return null;const s=t.feeds.length,l=t.feeds.filter(f=>f.is_loaded&&!f.last_error).length,u=t.feeds.filter(f=>f.last_error).map(f=>f.source),c=Math.max(...t.feeds.map(f=>f.last_fetch||0)),h=c?Math.floor(Date.now()/1e3-c):null;return{total:s,active:l,errors:u,secAgo:h}},[t]),o=v.jsxs(v.Fragment,{children:[i.length>0?v.jsx("div",{className:"flex-1 overflow-y-auto max-h-80 pr-1 -mr-1",children:i.map((s,l)=>v.jsx(sJ,{event:s,isLocal:s.is_local},s.event_id||l))}):v.jsx("div",{className:"flex-1 flex items-center justify-center",children:v.jsxs("div",{className:"text-center py-8",children:[v.jsx(Jk,{size:24,className:"text-green-500 mx-auto mb-2"}),v.jsx("div",{className:"font-sans text-[#777]",children:"No active events"}),v.jsx("div",{className:"text-[10px] font-sans text-[#666]",children:"All clear"})]})}),a&&v.jsxs("div",{className:`text-[10px] font-sans mt-3 pt-3 border-t border-border ${a.errors.length>0?"text-red-500":"text-[#666]"}`,children:[v.jsx("span",{className:"font-mono",children:a.active})," of ",v.jsx("span",{className:"font-mono",children:a.total})," feeds active",a.secAgo!==null&&v.jsxs(v.Fragment,{children:[" · Last update ",v.jsxs("span",{className:"font-mono",children:[a.secAgo,"s"]})," ago"]}),a.errors.length>0&&v.jsxs("span",{className:"text-red-500",children:[" · ",a.errors.join(", "),": error"]})]})]});return r?v.jsx("div",{className:"flex flex-col h-full",children:o}):v.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[v.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[v.jsx(id,{size:14}),"Live Event Feed"]}),o]})}function uJ(){var S,T,M,A,N,P;const[e,t]=G.useState(null),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState(null),[l,u]=G.useState([]),[c,h]=G.useState(null),[f,d]=G.useState("alerts"),[g,m]=G.useState(!0),[y,_]=G.useState(null),{lastHealth:x,lastMessage:w}=iL();return G.useEffect(()=>{Promise.all([BK(),GK(),f6(),d6(),v6().catch(()=>[]),UK().catch(()=>null)]).then(([I,D,O,j,B,U])=>{t(I),n(D),a(O),s(j),u(B),h(U),m(!1),document.title="Dashboard — MeshAI"}).catch(I=>{_(I.message),m(!1),document.title="Dashboard — MeshAI"})},[]),G.useEffect(()=>{x&&t(x)},[x]),G.useEffect(()=>{(w==null?void 0:w.type)==="env_update"&&w.event&&u(I=>{const D=w.event,O=I.filter(j=>j.event_id!==D.event_id);return[D,...O].slice(0,100)})},[w]),g?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"font-sans text-[#777]",children:"Loading..."})}):y?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"font-sans text-red-500",children:["Error: ",y]})}):v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[v.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[v.jsx("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:"Mesh Health"}),e&&v.jsxs(v.Fragment,{children:[v.jsx(tJ,{health:e}),v.jsxs("div",{className:"mt-4 space-y-2",children:[v.jsx(iv,{label:"Infrastructure",value:((S=e.pillars)==null?void 0:S.infrastructure)??0}),v.jsx(iv,{label:"Utilization",value:((T=e.pillars)==null?void 0:T.utilization)??0}),v.jsx(iv,{label:"Coverage",value:((M=e.pillars)==null?void 0:M.coverage)??0}),v.jsx(iv,{label:"Behavior",value:((A=e.pillars)==null?void 0:A.behavior)??0}),v.jsx(iv,{label:"Power",value:((N=e.pillars)==null?void 0:N.power)??0})]})]})]}),v.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[v.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[v.jsxs("div",{className:"flex items-center gap-4 mb-3 border-b border-border",children:[v.jsx("button",{onClick:()=>d("alerts"),className:`py-2.5 -mb-px text-[10px] font-sans uppercase tracking-widest transition-colors border-b ${f==="alerts"?"border-accent text-white":"border-transparent text-[#777]"}`,children:"Active Alerts"}),v.jsx("button",{onClick:()=>d("feed"),className:`py-2.5 -mb-px text-[10px] font-sans uppercase tracking-widest transition-colors border-b ${f==="feed"?"border-accent text-white":"border-transparent text-[#777]"}`,children:"Event Feed"})]}),f==="alerts"?v.jsx(v.Fragment,{children:i.length>0?v.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:i.map((I,D)=>v.jsx(rJ,{alert:I},D))}):(()=>{const I=l.filter(D=>D.severity==="immediate"||D.severity==="priority").sort((D,O)=>{const j={immediate:0,priority:1},B=(j[D.severity]??2)-(j[O.severity]??2);return B!==0?B:(O.fetched_at||0)-(D.fetched_at||0)}).slice(0,5);return I.length>0?v.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:I.map((D,O)=>{const j=D.severity==="immediate"?{bg:"bg-red-500/5",border:"border-red-500",icon:os,iconColor:"text-red-500"}:{bg:"bg-accent/5",border:"border-accent",icon:oo,iconColor:"text-accent"},B=j.icon;return v.jsxs("div",{className:`p-3 ${j.bg} border-l-2 ${j.border} flex items-start gap-3`,children:[v.jsx(B,{size:16,className:j.iconColor}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide bg-[#1e1e1e] text-[#777] border border-[#222]",children:"ENV"}),v.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:D.severity})]}),v.jsx("div",{className:"text-sm font-sans font-medium text-white mt-1",children:D.headline}),v.jsxs("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:[D.source," · ",new Date(D.fetched_at*1e3).toLocaleTimeString()]})]})]},D.event_id||O)})}):v.jsxs("div",{className:"flex items-center gap-2 text-[#777] py-4",children:[v.jsx(Jk,{size:16,className:"text-green-500"}),v.jsx("span",{className:"font-sans",children:"No active alerts"})]})})()}):v.jsx(lJ,{events:l,envStatus:o,embedded:!0})]}),v.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[v.jsx(yy,{icon:Gi,label:"Nodes Online",value:(e==null?void 0:e.total_nodes)||0,accent:"#22c55e",subvalue:`${(e==null?void 0:e.unlocated_count)||0} unlocated`}),v.jsx(yy,{icon:r6,label:"Infrastructure",value:`${(e==null?void 0:e.infra_online)||0}/${(e==null?void 0:e.infra_total)||0}`,accent:"#38bdf8",subvalue:(e==null?void 0:e.infra_online)===(e==null?void 0:e.infra_total)?"All online":"Some offline"}),v.jsx(yy,{icon:id,label:"Utilization",value:`${((P=e==null?void 0:e.util_percent)==null?void 0:P.toFixed(1))||0}%`,accent:"#f59e0b",subvalue:`${(e==null?void 0:e.flagged_nodes)||0} flagged`}),v.jsx(yy,{icon:ad,label:"Regions",value:(e==null?void 0:e.total_regions)||0,accent:"#333333",subvalue:`${(e==null?void 0:e.battery_warnings)||0} battery warnings`})]})]})]}),v.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[v.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[v.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:["Mesh Sources (",v.jsx("span",{className:"font-mono",children:r.length}),")"]}),r.length>0?v.jsx("div",{className:"space-y-1",children:r.map((I,D)=>v.jsx(nJ,{source:I},D))}):v.jsx("div",{className:"font-sans text-[#666] py-4",children:"No sources configured"})]}),v.jsx(iJ,{bandConditions:c}),v.jsx(aJ,{})]})]})}/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var O2=function(e,t){return O2=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},O2(e,t)};function q(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");O2(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var hp=function(){return hp=Object.assign||function(t){for(var r,n=1,i=arguments.length;n0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]"u"&&typeof self<"u"?rt.worker=!0:!rt.hasGlobalWindow||"Deno"in window||typeof navigator<"u"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Node.js")>-1?(rt.node=!0,rt.svgSupported=!0):dJ(navigator.userAgent,rt);function dJ(e,t){var r=t.browser,n=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);n&&(r.firefox=!0,r.version=n[1]),i&&(r.ie=!0,r.version=i[1]),a&&(r.edge=!0,r.version=a[1],r.newEdge=+a[1].split(".")[0]>18),o&&(r.weChat=!0),t.svgSupported=typeof SVGRect<"u",t.touchEventsSupported="ontouchstart"in window&&!r.ie&&!r.edge,t.pointerEventsSupported="onpointerdown"in window&&(r.edge||r.ie&&+r.version>=11);var s=t.domSupported=typeof document<"u";if(s){var l=document.documentElement.style;t.transform3dSupported=(r.ie&&"transition"in l||r.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in l)&&!("OTransition"in l),t.transformSupported=t.transform3dSupported||r.ie&&+r.version>=9}}var aL=12,m6="sans-serif",ss=aL+"px "+m6,vJ=20,pJ=100,gJ="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function mJ(e){var t={};if(typeof JSON>"u")return t;for(var r=0;r=0)s=o*r.length;else for(var l=0;l=wJ&&(eS=0),eS++}function K1(){for(var e=[],t=0;t>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",n[l]+":0",i[u]+":0",n[1-l]+":auto",i[1-u]+":auto",""].join("!important;"),e.appendChild(o),r.push(o)}return t.clearMarkers=function(){E(r,function(c){c.parentNode&&c.parentNode.removeChild(c)})},r}function VJ(e,t,r){for(var n=r?"invTrans":"trans",i=t[n],a=t.srcCoords,o=[],s=[],l=!0,u=0;u<4;u++){var c=e[u].getBoundingClientRect(),h=2*u,f=c.left,d=c.top;o.push(f,d),l=l&&a&&f===a[h]&&d===a[h+1],s.push(e[u].offsetLeft,e[u].offsetTop)}return l&&i?i:(t.srcCoords=o,t[n]=r?TE(s,o):TE(o,s))}function k6(e){return e.nodeName.toUpperCase()==="CANVAS"}var GJ=/([&<>"'])/g,HJ={"&":"&","<":"<",">":">",'"':""","'":"'"};function gn(e){return e==null?"":(e+"").replace(GJ,function(t,r){return HJ[r]})}var UJ=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rS=[],WJ=rt.browser.firefox&&+rt.browser.version.split(".")[0]<39;function G2(e,t,r,n){return r=r||{},n?ME(e,t,r):WJ&&t.layerX!=null&&t.layerX!==t.offsetX?(r.zrX=t.layerX,r.zrY=t.layerY):t.offsetX!=null?(r.zrX=t.offsetX,r.zrY=t.offsetY):ME(e,t,r),r}function ME(e,t,r){if(rt.domSupported&&e.getBoundingClientRect){var n=t.clientX,i=t.clientY;if(k6(e)){var a=e.getBoundingClientRect();r.zrX=n-a.left,r.zrY=i-a.top;return}else if(V2(rS,e,n,i)){r.zrX=rS[0],r.zrY=rS[1];return}}r.zrX=r.zrY=0}function fL(e){return e||window.event}function Mi(e,t,r){if(t=fL(t),t.zrX!=null)return t;var n=t.type,i=n&&n.indexOf("touch")>=0;if(i){var o=n!=="touchend"?t.targetTouches[0]:t.changedTouches[0];o&&G2(e,o,t,r)}else{G2(e,t,t,r);var a=ZJ(t);t.zrDelta=a?a/120:-(t.detail||0)/3}var s=t.button;return t.which==null&&s!==void 0&&UJ.test(t.type)&&(t.which=s&1?1:s&2?3:s&4?2:0),t}function ZJ(e){var t=e.wheelDelta;if(t)return t;var r=e.deltaX,n=e.deltaY;if(r==null||n==null)return t;var i=Math.abs(n!==0?n:r),a=n>0?-1:n<0?1:r>0?-1:1;return 3*i*a}function H2(e,t,r,n){e.addEventListener(t,r,n)}function $J(e,t,r,n){e.removeEventListener(t,r,n)}var ls=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function AE(e){return e.which===2||e.which===3}var YJ=function(){function e(){this._track=[]}return e.prototype.recognize=function(t,r,n){return this._doTrack(t,r,n),this._recognize(t)},e.prototype.clear=function(){return this._track.length=0,this},e.prototype._doTrack=function(t,r,n){var i=t.touches;if(i){for(var a={points:[],touches:[],target:r,event:t},o=0,s=i.length;o1&&n&&n.length>1){var a=kE(n)/kE(i);!isFinite(a)&&(a=1),t.pinchScale=a;var o=XJ(n);return t.pinchX=o[0],t.pinchY=o[1],{type:"pinch",target:e[0].target,event:t}}}}};function Ft(){return[1,0,0,1,0,0]}function Fc(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function Cl(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function ci(e,t,r){var n=t[0]*r[0]+t[2]*r[1],i=t[1]*r[0]+t[3]*r[1],a=t[0]*r[2]+t[2]*r[3],o=t[1]*r[2]+t[3]*r[3],s=t[0]*r[4]+t[2]*r[5]+t[4],l=t[1]*r[4]+t[3]*r[5]+t[5];return e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e}function _a(e,t,r){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4]+r[0],e[5]=t[5]+r[1],e}function _s(e,t,r,n){n===void 0&&(n=[0,0]);var i=t[0],a=t[2],o=t[4],s=t[1],l=t[3],u=t[5],c=Math.sin(r),h=Math.cos(r);return e[0]=i*h+s*c,e[1]=-i*c+s*h,e[2]=a*h+l*c,e[3]=-a*c+h*l,e[4]=h*(o-n[0])+c*(u-n[1])+n[0],e[5]=h*(u-n[1])-c*(o-n[0])+n[1],e}function eb(e,t,r){var n=r[0],i=r[1];return e[0]=t[0]*n,e[1]=t[1]*i,e[2]=t[2]*n,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*i,e}function fi(e,t){var r=t[0],n=t[2],i=t[4],a=t[1],o=t[3],s=t[5],l=r*o-a*n;return l?(l=1/l,e[0]=o*l,e[1]=-a*l,e[2]=-n*l,e[3]=r*l,e[4]=(n*s-o*i)*l,e[5]=(a*i-r*s)*l,e):null}function L6(e){var t=Ft();return Cl(t,e),t}const qJ=Object.freeze(Object.defineProperty({__proto__:null,clone:L6,copy:Cl,create:Ft,identity:Fc,invert:fi,mul:ci,rotate:_s,scale:eb,translate:_a},Symbol.toStringTag,{value:"Module"}));var Pe=function(){function e(t,r){this.x=t||0,this.y=r||0}return e.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},e.prototype.clone=function(){return new e(this.x,this.y)},e.prototype.set=function(t,r){return this.x=t,this.y=r,this},e.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},e.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},e.prototype.scale=function(t){this.x*=t,this.y*=t},e.prototype.scaleAndAdd=function(t,r){this.x+=t.x*r,this.y+=t.y*r},e.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},e.prototype.dot=function(t){return this.x*t.x+this.y*t.y},e.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},e.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},e.prototype.distance=function(t){var r=this.x-t.x,n=this.y-t.y;return Math.sqrt(r*r+n*n)},e.prototype.distanceSquare=function(t){var r=this.x-t.x,n=this.y-t.y;return r*r+n*n},e.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.prototype.transform=function(t){if(t){var r=this.x,n=this.y;return this.x=t[0]*r+t[2]*n+t[4],this.y=t[1]*r+t[3]*n+t[5],this}},e.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},e.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},e.set=function(t,r,n){t.x=r,t.y=n},e.copy=function(t,r){t.x=r.x,t.y=r.y},e.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},e.lenSquare=function(t){return t.x*t.x+t.y*t.y},e.dot=function(t,r){return t.x*r.x+t.y*r.y},e.add=function(t,r,n){t.x=r.x+n.x,t.y=r.y+n.y},e.sub=function(t,r,n){t.x=r.x-n.x,t.y=r.y-n.y},e.scale=function(t,r,n){t.x=r.x*n,t.y=r.y*n},e.scaleAndAdd=function(t,r,n,i){t.x=r.x+n.x*i,t.y=r.y+n.y*i},e.lerp=function(t,r,n,i){var a=1-i;t.x=a*r.x+i*n.x,t.y=a*r.y+i*n.y},e}(),Bu=Math.min,Jh=Math.max,U2=Math.abs,LE=["x","y"],KJ=["width","height"],Xl=new Pe,ql=new Pe,Kl=new Pe,Jl=new Pe,ni=P6(),Hv=ni.minTv,W2=ni.maxTv,pp=[0,0],Ae=function(){function e(t,r,n,i){iS(this,t,r,n,i)}return e.set=function(t,r,n,i,a){return i<0&&(r=r+i,i=-i),a<0&&(n=n+a,a=-a),t.x=r,t.y=n,t.width=i,t.height=a,t},e.prototype.union=function(t){var r=Bu(t.x,this.x),n=Bu(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Jh(t.x+t.width,this.x+this.width)-r:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=Jh(t.y+t.height,this.y+this.height)-n:this.height=t.height,this.x=r,this.y=n},e.prototype.applyTransform=function(t){e.applyTransform(this,this,t)},e.prototype.calculateTransform=function(t){return I6(Ft(),this,t)},e.prototype.intersect=function(t,r,n){return e.intersect(this,t,r,n)},e.intersect=function(t,r,n,i){n&&Pe.set(n,0,0);var a=i&&i.outIntersectRect||null,o=i&&i.clamp;if(a&&(a.x=a.y=a.width=a.height=NaN),!t||!r)return!1;t instanceof e||(t=iS(QJ,t.x,t.y,t.width,t.height)),r instanceof e||(r=iS(eQ,r.x,r.y,r.width,r.height));var s=!!n;ni.reset(i,s);var l=ni.touchThreshold,u=t.x+l,c=t.x+t.width-l,h=t.y+l,f=t.y+t.height-l,d=r.x+l,g=r.x+r.width-l,m=r.y+l,y=r.y+r.height-l;if(u>c||h>f||d>g||m>y)return!1;var _=!(c=t.x&&r<=t.x+t.width&&n>=t.y&&n<=t.y+t.height},e.prototype.contain=function(t,r){return e.contain(this,t,r)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(t){Ef(this,t)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(t,r){return t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height,t},e.applyTransform=function(t,r,n){if(!n){t!==r&&Ef(t,r);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var i=n[0],a=n[3],o=n[4],s=n[5];t.x=r.x*i+o,t.y=r.y*a+s,t.width=r.width*i,t.height=r.height*a,t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height);return}Xl.x=Kl.x=r.x,Xl.y=Jl.y=r.y,ql.x=Jl.x=r.x+r.width,ql.y=Kl.y=r.y+r.height,Xl.transform(n),Jl.transform(n),ql.transform(n),Kl.transform(n),t.x=Bu(Xl.x,ql.x,Kl.x,Jl.x),t.y=Bu(Xl.y,ql.y,Kl.y,Jl.y);var l=Jh(Xl.x,ql.x,Kl.x,Jl.x),u=Jh(Xl.y,ql.y,Kl.y,Jl.y);t.width=l-t.x,t.height=u-t.y},e.calculateTransform=function(t,r,n){var i=n.width/r.width,a=n.height/r.height;return t=Fc(t||[]),_a(t,t,Yo(aS,-r.x,-r.y)),eb(t,t,Yo(aS,i,a)),_a(t,t,Yo(aS,n.x,n.y)),t},e}(),tb=Ae.create,iS=Ae.set,Ef=Ae.copy,I6=Ae.calculateTransform,N6=Ae.applyTransform,JJ=Ae.contain,QJ=new Ae(0,0,0,0),eQ=new Ae(0,0,0,0),aS=[];function IE(e,t,r,n,i,a,o,s){var l=U2(t-r),u=U2(n-e),c=Bu(l,u),h=LE[i],f=LE[1-i],d=KJ[i];t=u||!ni.bidirectional)&&(Hv[h]=-u,Hv[f]=0,ni.useDir&&ni.calcDirMTV())))}function P6(){var e=0,t=new Pe,r=new Pe,n={minTv:new Pe,maxTv:new Pe,useDir:!1,dirMinTv:new Pe,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(a,o){n.touchThreshold=0,a&&a.touchThreshold!=null&&(n.touchThreshold=Jh(0,a.touchThreshold)),n.negativeSize=!1,o&&(n.minTv.set(1/0,1/0),n.maxTv.set(0,0),n.useDir=!1,a&&a.direction!=null&&(n.useDir=!0,n.dirMinTv.copy(n.minTv),r.copy(n.minTv),e=a.direction,n.bidirectional=a.bidirectional==null||!!a.bidirectional,n.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=n.minTv,o=n.dirMinTv,s=a.y*a.y+a.x*a.x,l=Math.sin(e),u=Math.cos(e),c=l*a.y+u*a.x;if(i(c)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(r.x=s*u/c,r.y=s*l/c,i(r.x)&&i(r.y)){o.set(0,0);return}(n.bidirectional||t.dot(r)>0)&&r.len()=0;h--){var f=a[h];f!==i&&!f.ignore&&!f.ignoreCoarsePointer&&(!f.parent||!f.parent.ignoreCoarsePointer)&&(oS.copy(f.getBoundingRect()),f.transform&&oS.applyTransform(f.transform),oS.intersect(c)&&s.push(f))}if(s.length)for(var d=4,g=Math.PI/12,m=Math.PI*2,y=0;y4)return;this._downPoint=null}this.dispatchToElement(a,e,t)}});function aQ(e,t,r){if(e[e.rectHover?"rectContain":"contain"](t,r)){for(var n=e,i=void 0,a=!1;n;){if(n.ignoreClip&&(a=!0),!a){var o=n.getClipPath();if(o&&!o.contain(t,r))return!1}n.silent&&(i=!0);var s=n.__hostTarget;n=s?n.ignoreHostSilent?null:s:n.parent}return i?D6:!0}return!1}function NE(e,t,r,n,i){for(var a=e.length-1;a>=0;a--){var o=e[a],s=void 0;if(o!==i&&!o.ignore&&(s=aQ(o,r,n))&&(!t.topTarget&&(t.topTarget=o),s!==D6)){t.target=o;break}}}function R6(e,t,r){var n=e.painter;return t<0||t>n.getWidth()||r<0||r>n.getHeight()}var j6=32,ov=7;function oQ(e){for(var t=0;e>=j6;)t|=e&1,e>>=1;return e+t}function PE(e,t,r,n){var i=t+1;if(i===r)return 1;if(n(e[i++],e[t])<0){for(;i=0;)i++;return i-t}function sQ(e,t,r){for(r--;t>>1,i(a,e[l])<0?s=l:o=l+1;var u=n-o;switch(u){case 3:e[o+3]=e[o+2];case 2:e[o+2]=e[o+1];case 1:e[o+1]=e[o];break;default:for(;u>0;)e[o+u]=e[o+u-1],u--}e[o]=a}}function sS(e,t,r,n,i,a){var o=0,s=0,l=1;if(a(e,t[r+i])>0){for(s=n-i;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=i,l+=i}else{for(s=i+1;ls&&(l=s);var u=o;o=i-l,l=i-u}for(o++;o>>1);a(e,t[r+c])>0?o=c+1:l=c}return l}function lS(e,t,r,n,i,a){var o=0,s=0,l=1;if(a(e,t[r+i])<0){for(s=i+1;ls&&(l=s);var u=o;o=i-l,l=i-u}else{for(s=n-i;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=i,l+=i}for(o++;o>>1);a(e,t[r+c])<0?l=c:o=c+1}return l}function lQ(e,t){var r=ov,n,i,a=0,o=[];n=[],i=[];function s(d,g){n[a]=d,i[a]=g,a+=1}function l(){for(;a>1;){var d=a-2;if(d>=1&&i[d-1]<=i[d]+i[d+1]||d>=2&&i[d-2]<=i[d]+i[d-1])i[d-1]i[d+1])break;c(d)}}function u(){for(;a>1;){var d=a-2;d>0&&i[d-1]=ov||A>=ov);if(N)break;T<0&&(T=0),T+=2}if(r=T,r<1&&(r=1),g===1){for(_=0;_=0;_--)e[M+_]=e[T+_];e[S]=o[w];return}for(var A=r;;){var N=0,P=0,I=!1;do if(t(o[w],e[x])<0){if(e[S--]=e[x--],N++,P=0,--g===0){I=!0;break}}else if(e[S--]=o[w--],P++,N=0,--y===1){I=!0;break}while((N|P)=0;_--)e[M+_]=e[T+_];if(g===0){I=!0;break}}if(e[S--]=o[w--],--y===1){I=!0;break}if(P=y-sS(e[x],o,0,y,y-1,t),P!==0){for(S-=P,w-=P,y-=P,M=S+1,T=w+1,_=0;_=ov||P>=ov);if(I)break;A<0&&(A=0),A+=2}if(r=A,r<1&&(r=1),y===1){for(S-=g,x-=g,M=S+1,T=x+1,_=g-1;_>=0;_--)e[M+_]=e[T+_];e[S]=o[w]}else{if(y===0)throw new Error;for(T=S-(y-1),_=0;_s&&(l=s),DE(e,r,r+l,r+a,t),a=l}o.pushRun(r,a),o.mergeRuns(),i-=a,r+=a}while(i!==0);o.forceMergeRuns()}}var Un=1,Uv=2,jh=4,EE=!1;function uS(){EE||(EE=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function RE(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var uQ=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=RE}return e.prototype.traverse=function(t,r){for(var n=0;n=0&&this._roots.splice(i,1)},e.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},e.prototype.getRoots=function(){return this._roots},e.prototype.dispose=function(){this._displayList=null,this._roots=null},e}(),rx;rx=rt.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};var gp={linear:function(e){return e},quadraticIn:function(e){return e*e},quadraticOut:function(e){return e*(2-e)},quadraticInOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},cubicIn:function(e){return e*e*e},cubicOut:function(e){return--e*e*e+1},cubicInOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},quarticIn:function(e){return e*e*e*e},quarticOut:function(e){return 1- --e*e*e*e},quarticInOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)},quinticIn:function(e){return e*e*e*e*e},quinticOut:function(e){return--e*e*e*e*e+1},quinticInOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)},sinusoidalIn:function(e){return 1-Math.cos(e*Math.PI/2)},sinusoidalOut:function(e){return Math.sin(e*Math.PI/2)},sinusoidalInOut:function(e){return .5*(1-Math.cos(Math.PI*e))},exponentialIn:function(e){return e===0?0:Math.pow(1024,e-1)},exponentialOut:function(e){return e===1?1:1-Math.pow(2,-10*e)},exponentialInOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)},circularIn:function(e){return 1-Math.sqrt(1-e*e)},circularOut:function(e){return Math.sqrt(1- --e*e)},circularInOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)},elasticIn:function(e){var t,r=.1,n=.4;return e===0?0:e===1?1:(!r||r<1?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),-(r*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/n)))},elasticOut:function(e){var t,r=.1,n=.4;return e===0?0:e===1?1:(!r||r<1?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),r*Math.pow(2,-10*e)*Math.sin((e-t)*(2*Math.PI)/n)+1)},elasticInOut:function(e){var t,r=.1,n=.4;return e===0?0:e===1?1:(!r||r<1?(r=1,t=n/4):t=n*Math.asin(1/r)/(2*Math.PI),(e*=2)<1?-.5*(r*Math.pow(2,10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/n)):r*Math.pow(2,-10*(e-=1))*Math.sin((e-t)*(2*Math.PI)/n)*.5+1)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},backInOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)},bounceIn:function(e){return 1-gp.bounceOut(1-e)},bounceOut:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},bounceInOut:function(e){return e<.5?gp.bounceIn(e*2)*.5:gp.bounceOut(e*2-1)*.5+.5}},xy=Math.pow,fl=Math.sqrt,nx=1e-8,O6=1e-4,jE=fl(3),by=1/3,Va=Ol(),Pi=Ol(),df=Ol();function qs(e){return e>-nx&&enx||e<-nx}function Pr(e,t,r,n,i){var a=1-i;return a*a*(a*e+3*i*t)+i*i*(i*n+3*a*r)}function OE(e,t,r,n,i){var a=1-i;return 3*(((t-e)*a+2*(r-t)*i)*a+(n-r)*i*i)}function ix(e,t,r,n,i,a){var o=n+3*(t-r)-e,s=3*(r-t*2+e),l=3*(t-e),u=e-i,c=s*s-3*o*l,h=s*l-9*o*u,f=l*l-3*s*u,d=0;if(qs(c)&&qs(h))if(qs(s))a[0]=0;else{var g=-l/s;g>=0&&g<=1&&(a[d++]=g)}else{var m=h*h-4*c*f;if(qs(m)){var y=h/c,g=-s/o+y,_=-y/2;g>=0&&g<=1&&(a[d++]=g),_>=0&&_<=1&&(a[d++]=_)}else if(m>0){var x=fl(m),w=c*s+1.5*o*(-h+x),S=c*s+1.5*o*(-h-x);w<0?w=-xy(-w,by):w=xy(w,by),S<0?S=-xy(-S,by):S=xy(S,by);var g=(-s-(w+S))/(3*o);g>=0&&g<=1&&(a[d++]=g)}else{var T=(2*c*s-3*o*h)/(2*fl(c*c*c)),M=Math.acos(T)/3,A=fl(c),N=Math.cos(M),g=(-s-2*A*N)/(3*o),_=(-s+A*(N+jE*Math.sin(M)))/(3*o),P=(-s+A*(N-jE*Math.sin(M)))/(3*o);g>=0&&g<=1&&(a[d++]=g),_>=0&&_<=1&&(a[d++]=_),P>=0&&P<=1&&(a[d++]=P)}}return d}function B6(e,t,r,n,i){var a=6*r-12*t+6*e,o=9*t+3*n-3*e-9*r,s=3*t-3*e,l=0;if(qs(o)){if(z6(a)){var u=-s/a;u>=0&&u<=1&&(i[l++]=u)}}else{var c=a*a-4*o*s;if(qs(c))i[0]=-a/(2*o);else if(c>0){var h=fl(c),u=(-a+h)/(2*o),f=(-a-h)/(2*o);u>=0&&u<=1&&(i[l++]=u),f>=0&&f<=1&&(i[l++]=f)}}return l}function Tl(e,t,r,n,i,a){var o=(t-e)*i+e,s=(r-t)*i+t,l=(n-r)*i+r,u=(s-o)*i+o,c=(l-s)*i+s,h=(c-u)*i+u;a[0]=e,a[1]=o,a[2]=u,a[3]=h,a[4]=h,a[5]=c,a[6]=l,a[7]=n}function F6(e,t,r,n,i,a,o,s,l,u,c){var h,f=.005,d=1/0,g,m,y,_;Va[0]=l,Va[1]=u;for(var x=0;x<1;x+=.05)Pi[0]=Pr(e,r,i,o,x),Pi[1]=Pr(t,n,a,s,x),y=hl(Va,Pi),y=0&&y=0&&u<=1&&(i[l++]=u)}}else{var c=o*o-4*a*s;if(qs(c)){var u=-o/(2*a);u>=0&&u<=1&&(i[l++]=u)}else if(c>0){var h=fl(c),u=(-o+h)/(2*a),f=(-o-h)/(2*a);u>=0&&u<=1&&(i[l++]=u),f>=0&&f<=1&&(i[l++]=f)}}return l}function V6(e,t,r){var n=e+r-2*t;return n===0?.5:(e-t)/n}function Qp(e,t,r,n,i){var a=(t-e)*n+e,o=(r-t)*n+t,s=(o-a)*n+a;i[0]=e,i[1]=a,i[2]=s,i[3]=s,i[4]=o,i[5]=r}function G6(e,t,r,n,i,a,o,s,l){var u,c=.005,h=1/0;Va[0]=o,Va[1]=s;for(var f=0;f<1;f+=.05){Pi[0]=Hr(e,r,i,f),Pi[1]=Hr(t,n,a,f);var d=hl(Va,Pi);d=0&&d=1?1:ix(0,n,a,1,l,s)&&Pr(0,i,o,1,s[0])}}}var vQ=function(){function e(t){this._inited=!1,this._startTime=0,this._pausedTime=0,this._paused=!1,this._life=t.life||1e3,this._delay=t.delay||0,this.loop=t.loop||!1,this.onframe=t.onframe||qt,this.ondestroy=t.ondestroy||qt,this.onrestart=t.onrestart||qt,t.easing&&this.setEasing(t.easing)}return e.prototype.step=function(t,r){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),this._paused){this._pausedTime+=r;return}var n=this._life,i=t-this._startTime-this._pausedTime,a=i/n;a<0&&(a=0),a=Math.min(a,1);var o=this.easingFunc,s=o?o(a):a;if(this.onframe(s),a===1)if(this.loop){var l=i%n;this._startTime=t-l,this._pausedTime=0,this.onrestart()}else return!0;return!1},e.prototype.pause=function(){this._paused=!0},e.prototype.resume=function(){this._paused=!1},e.prototype.setEasing=function(t){this.easing=t,this.easingFunc=Ce(t)?t:gp[t]||dL(t)},e}(),H6=function(){function e(t){this.value=t}return e}(),pQ=function(){function e(){this._len=0}return e.prototype.insert=function(t){var r=new H6(t);return this.insertEntry(r),r},e.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},e.prototype.remove=function(t){var r=t.prev,n=t.next;r?r.next=n:this.head=n,n?n.prev=r:this.tail=r,t.next=t.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),Rf=function(){function e(t){this._list=new pQ,this._maxSize=10,this._map={},this._maxSize=t}return e.prototype.put=function(t,r){var n=this._list,i=this._map,a=null;if(i[t]==null){var o=n.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=n.head;n.remove(l),delete i[l.key],a=l.value,this._lastRemovedEntry=l}s?s.value=r:s=new H6(r),s.key=t,n.insertEntry(s),i[t]=s}return a},e.prototype.get=function(t){var r=this._map[t],n=this._list;if(r!=null)return r!==n.tail&&(n.remove(r),n.insertEntry(r)),r.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),zE={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function da(e){return e=Math.round(e),e<0?0:e>255?255:e}function gQ(e){return e=Math.round(e),e<0?0:e>360?360:e}function eg(e){return e<0?0:e>1?1:e}function Q0(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?da(parseFloat(t)/100*255):da(parseInt(t,10))}function Xo(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?eg(parseFloat(t)/100):eg(parseFloat(t))}function cS(e,t,r){return r<0?r+=1:r>1&&(r-=1),r*6<1?e+(t-e)*r*6:r*2<1?t:r*3<2?e+(t-e)*(2/3-r)*6:e}function Ks(e,t,r){return e+(t-e)*r}function Ci(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function $2(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var U6=new Rf(20),wy=null;function fh(e,t){wy&&$2(wy,t),wy=U6.put(e,wy||t.slice())}function yn(e,t){if(e){t=t||[];var r=U6.get(e);if(r)return $2(t,r);e=e+"";var n=e.replace(/ /g,"").toLowerCase();if(n in zE)return $2(t,zE[n]),fh(e,t),t;var i=n.length;if(n.charAt(0)==="#"){if(i===4||i===5){var a=parseInt(n.slice(1,4),16);if(!(a>=0&&a<=4095)){Ci(t,0,0,0,1);return}return Ci(t,(a&3840)>>4|(a&3840)>>8,a&240|(a&240)>>4,a&15|(a&15)<<4,i===5?parseInt(n.slice(4),16)/15:1),fh(e,t),t}else if(i===7||i===9){var a=parseInt(n.slice(1,7),16);if(!(a>=0&&a<=16777215)){Ci(t,0,0,0,1);return}return Ci(t,(a&16711680)>>16,(a&65280)>>8,a&255,i===9?parseInt(n.slice(7),16)/255:1),fh(e,t),t}return}var o=n.indexOf("("),s=n.indexOf(")");if(o!==-1&&s+1===i){var l=n.substr(0,o),u=n.substr(o+1,s-(o+1)).split(","),c=1;switch(l){case"rgba":if(u.length!==4)return u.length===3?Ci(t,+u[0],+u[1],+u[2],1):Ci(t,0,0,0,1);c=Xo(u.pop());case"rgb":if(u.length>=3)return Ci(t,Q0(u[0]),Q0(u[1]),Q0(u[2]),u.length===3?c:Xo(u[3])),fh(e,t),t;Ci(t,0,0,0,1);return;case"hsla":if(u.length!==4){Ci(t,0,0,0,1);return}return u[3]=Xo(u[3]),Y2(u,t),fh(e,t),t;case"hsl":if(u.length!==3){Ci(t,0,0,0,1);return}return Y2(u,t),fh(e,t),t;default:return}}Ci(t,0,0,0,1)}}function Y2(e,t){var r=(parseFloat(e[0])%360+360)%360/360,n=Xo(e[1]),i=Xo(e[2]),a=i<=.5?i*(n+1):i+n-i*n,o=i*2-a;return t=t||[],Ci(t,da(cS(o,a,r+1/3)*255),da(cS(o,a,r)*255),da(cS(o,a,r-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function mQ(e){if(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=a-i,s=(a+i)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(a+i):u=o/(2-a-i);var c=((a-t)/6+o/2)/o,h=((a-r)/6+o/2)/o,f=((a-n)/6+o/2)/o;t===a?l=f-h:r===a?l=1/3+c-f:n===a&&(l=2/3+h-c),l<0&&(l+=1),l>1&&(l-=1)}var d=[l*360,u,s];return e[3]!=null&&d.push(e[3]),d}}function ax(e,t){var r=yn(e);if(r){for(var n=0;n<3;n++)t<0?r[n]=r[n]*(1-t)|0:r[n]=(255-r[n])*t+r[n]|0,r[n]>255?r[n]=255:r[n]<0&&(r[n]=0);return Oi(r,r.length===4?"rgba":"rgb")}}function yQ(e){var t=yn(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)}function mp(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){r=r||[];var n=e*(t.length-1),i=Math.floor(n),a=Math.ceil(n),o=t[i],s=t[a],l=n-i;return r[0]=da(Ks(o[0],s[0],l)),r[1]=da(Ks(o[1],s[1],l)),r[2]=da(Ks(o[2],s[2],l)),r[3]=eg(Ks(o[3],s[3],l)),r}}var _Q=mp;function vL(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){var n=e*(t.length-1),i=Math.floor(n),a=Math.ceil(n),o=yn(t[i]),s=yn(t[a]),l=n-i,u=Oi([da(Ks(o[0],s[0],l)),da(Ks(o[1],s[1],l)),da(Ks(o[2],s[2],l)),eg(Ks(o[3],s[3],l))],"rgba");return r?{color:u,leftIndex:i,rightIndex:a,value:n}:u}}var xQ=vL;function qo(e,t,r,n){var i=yn(e);if(e)return i=mQ(i),t!=null&&(i[0]=gQ(Ce(t)?t(i[0]):t)),r!=null&&(i[1]=Xo(Ce(r)?r(i[1]):r)),n!=null&&(i[2]=Xo(Ce(n)?n(i[2]):n)),Oi(Y2(i),"rgba")}function tg(e,t){var r=yn(e);if(r&&t!=null)return r[3]=eg(t),Oi(r,"rgba")}function Oi(e,t){if(!(!e||!e.length)){var r=e[0]+","+e[1]+","+e[2];return(t==="rgba"||t==="hsva"||t==="hsla")&&(r+=","+e[3]),t+"("+r+")"}}function rg(e,t){var r=yn(e);return r?(.299*r[0]+.587*r[1]+.114*r[2])*r[3]/255+(1-r[3])*t:0}function bQ(){return Oi([Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255)],"rgb")}var BE=new Rf(100);function ox(e){if(ue(e)){var t=BE.get(e);return t||(t=ax(e,-.1),BE.put(e,t)),t}else if(Xg(e)){var r=ee({},e);return r.colorStops=ae(e.colorStops,function(n){return{offset:n.offset,color:ax(n.color,-.1)}}),r}return e}const wQ=Object.freeze(Object.defineProperty({__proto__:null,fastLerp:mp,fastMapToColor:_Q,lerp:vL,lift:ax,liftColor:ox,lum:rg,mapToColor:xQ,modifyAlpha:tg,modifyHSL:qo,parse:yn,parseCssFloat:Xo,parseCssInt:Q0,random:bQ,stringify:Oi,toHex:yQ},Symbol.toStringTag,{value:"Module"}));var sx=Math.round;function ng(e){var t;if(!e||e==="transparent")e="none";else if(typeof e=="string"&&e.indexOf("rgba")>-1){var r=yn(e);r&&(e="rgb("+r[0]+","+r[1]+","+r[2]+")",t=r[3])}return{color:e,opacity:t??1}}var FE=1e-4;function Js(e){return e-FE}function Sy(e){return sx(e*1e3)/1e3}function X2(e){return sx(e*1e4)/1e4}function SQ(e){return"matrix("+Sy(e[0])+","+Sy(e[1])+","+Sy(e[2])+","+Sy(e[3])+","+X2(e[4])+","+X2(e[5])+")"}var CQ={left:"start",right:"end",center:"middle",middle:"middle"};function TQ(e,t,r){return r==="top"?e+=t/2:r==="bottom"&&(e-=t/2),e}function MQ(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function AQ(e){var t=e.style,r=e.getGlobalScale();return[t.shadowColor,(t.shadowBlur||0).toFixed(2),(t.shadowOffsetX||0).toFixed(2),(t.shadowOffsetY||0).toFixed(2),r[0],r[1]].join(",")}function W6(e){return e&&!!e.image}function kQ(e){return e&&!!e.svgElement}function pL(e){return W6(e)||kQ(e)}function Z6(e){return e.type==="linear"}function $6(e){return e.type==="radial"}function Y6(e){return e&&(e.type==="linear"||e.type==="radial")}function rb(e){return"url(#"+e+")"}function X6(e){var t=e.getGlobalScale(),r=Math.max(t[0],t[1]);return Math.max(Math.ceil(Math.log(r)/Math.log(10)),1)}function q6(e){var t=e.x||0,r=e.y||0,n=(e.rotation||0)*fp,i=_e(e.scaleX,1),a=_e(e.scaleY,1),o=e.skewX||0,s=e.skewY||0,l=[];return(t||r)&&l.push("translate("+t+"px,"+r+"px)"),n&&l.push("rotate("+n+")"),(i!==1||a!==1)&&l.push("scale("+i+","+a+")"),(o||s)&&l.push("skew("+sx(o*fp)+"deg, "+sx(s*fp)+"deg)"),l.join(" ")}var LQ=function(){return typeof Buffer<"u"&&typeof Buffer.from=="function"?function(e){return Buffer.from(e).toString("base64")}:typeof btoa=="function"&&typeof unescape=="function"&&typeof encodeURIComponent=="function"?function(e){return btoa(unescape(encodeURIComponent(e)))}:function(e){return null}}(),q2=Array.prototype.slice;function jo(e,t,r){return(t-e)*r+e}function hS(e,t,r,n){for(var i=t.length,a=0;an?t:e,a=Math.min(r,n),o=i[a-1]||{color:[0,0,0,0],offset:0},s=a;so;if(s)n.length=o;else for(var l=a;l=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(t,r,n){this._needsSort=!0;var i=this.keyframes,a=i.length,o=!1,s=GE,l=r;if(nn(r)){var u=DQ(r);s=u,(u===1&&!at(r[0])||u===2&&!at(r[0][0]))&&(o=!0)}else if(at(r)&&!tn(r))s=Ty;else if(ue(r))if(!isNaN(+r))s=Ty;else{var c=yn(r);c&&(l=c,s=Wv)}else if(Xg(r)){var h=ee({},l);h.colorStops=ae(r.colorStops,function(d){return{offset:d.offset,color:yn(d.color)}}),Z6(r)?s=K2:$6(r)&&(s=J2),l=h}a===0?this.valType=s:(s!==this.valType||s===GE)&&(o=!0),this.discrete=this.discrete||o;var f={time:t,value:l,rawValue:r,percent:0};return n&&(f.easing=n,f.easingFunc=Ce(n)?n:gp[n]||dL(n)),i.push(f),f},e.prototype.prepare=function(t,r){var n=this.keyframes;this._needsSort&&n.sort(function(m,y){return m.time-y.time});for(var i=this.valType,a=n.length,o=n[a-1],s=this.discrete,l=My(i),u=HE(i),c=0;c=0&&!(o[c].percent<=r);c--);c=f(c,s-2)}else{for(c=h;cr);c++);c=f(c-1,s-2)}g=o[c+1],d=o[c]}if(d&&g){this._lastFr=c,this._lastFrP=r;var y=g.percent-d.percent,_=y===0?1:f((r-d.percent)/y,1);g.easingFunc&&(_=g.easingFunc(_));var x=n?this._additiveValue:u?sv:t[l];if((My(a)||u)&&!x&&(x=this._additiveValue=[]),this.discrete)t[l]=_<1?d.rawValue:g.rawValue;else if(My(a))a===t_?hS(x,d[i],g[i],_):IQ(x,d[i],g[i],_);else if(HE(a)){var w=d[i],S=g[i],T=a===K2;t[l]={type:T?"linear":"radial",x:jo(w.x,S.x,_),y:jo(w.y,S.y,_),colorStops:ae(w.colorStops,function(A,N){var P=S.colorStops[N];return{offset:jo(A.offset,P.offset,_),color:e_(hS([],A.color,P.color,_))}}),global:S.global},T?(t[l].x2=jo(w.x2,S.x2,_),t[l].y2=jo(w.y2,S.y2,_)):t[l].r=jo(w.r,S.r,_)}else if(u)hS(x,d[i],g[i],_),n||(t[l]=e_(x));else{var M=jo(d[i],g[i],_);n?this._additiveValue=M:t[l]=M}n&&this._addToTarget(t)}}},e.prototype._addToTarget=function(t){var r=this.valType,n=this.propName,i=this._additiveValue;r===Ty?t[n]=t[n]+i:r===Wv?(yn(t[n],sv),Cy(sv,sv,i,1),t[n]=e_(sv)):r===t_?Cy(t[n],t[n],i,1):r===K6&&VE(t[n],t[n],i,1)},e}(),gL=function(){function e(t,r,n,i){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=t,this._loop=r,r&&i){K1("Can' use additive animation on looped animation.");return}this._additiveAnimators=i,this._allowDiscrete=n}return e.prototype.getMaxTime=function(){return this._maxTime},e.prototype.getDelay=function(){return this._delay},e.prototype.getLoop=function(){return this._loop},e.prototype.getTarget=function(){return this._target},e.prototype.changeTarget=function(t){this._target=t},e.prototype.when=function(t,r,n){return this.whenWithKeys(t,r,tt(r),n)},e.prototype.whenWithKeys=function(t,r,n,i){for(var a=this._tracks,o=0;o0&&l.addKeyframe(0,yp(u),i),this._trackKeys.push(s)}l.addKeyframe(t,yp(r[s]),i)}return this._maxTime=Math.max(this._maxTime,t),this},e.prototype.pause=function(){this._clip.pause(),this._paused=!0},e.prototype.resume=function(){this._clip.resume(),this._paused=!1},e.prototype.isPaused=function(){return!!this._paused},e.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},e.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var r=t.length,n=0;n0)){this._started=1;for(var r=this,n=[],i=this._maxTime||0,a=0;a1){var s=o.pop();a.addKeyframe(s.time,t[i]),a.prepare(this._maxTime,a.getAdditiveTrack())}}}},e}();function Qh(){return new Date().getTime()}var RQ=function(e){q(t,e);function t(r){var n=e.call(this)||this;return n._running=!1,n._time=0,n._pausedTime=0,n._pauseStart=0,n._paused=!1,r=r||{},n.stage=r.stage||{},n}return t.prototype.addClip=function(r){r.animation&&this.removeClip(r),this._head?(this._tail.next=r,r.prev=this._tail,r.next=null,this._tail=r):this._head=this._tail=r,r.animation=this},t.prototype.addAnimator=function(r){r.animation=this;var n=r.getClip();n&&this.addClip(n)},t.prototype.removeClip=function(r){if(r.animation){var n=r.prev,i=r.next;n?n.next=i:this._head=i,i?i.prev=n:this._tail=n,r.next=r.prev=r.animation=null}},t.prototype.removeAnimator=function(r){var n=r.getClip();n&&this.removeClip(n),r.animation=null},t.prototype.update=function(r){for(var n=Qh()-this._pausedTime,i=n-this._time,a=this._head;a;){var o=a.next,s=a.step(n,i);s&&(a.ondestroy(),this.removeClip(a)),a=o}this._time=n,r||(this.trigger("frame",i),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var r=this;this._running=!0;function n(){r._running&&(rx(n),!r._paused&&r.update())}rx(n)},t.prototype.start=function(){this._running||(this._time=Qh(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=Qh(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=Qh()-this._pauseStart,this._paused=!1)},t.prototype.clear=function(){for(var r=this._head;r;){var n=r.next;r.prev=r.next=r.animation=null,r=n}this._head=this._tail=null},t.prototype.isFinished=function(){return this._head==null},t.prototype.animate=function(r,n){n=n||{},this.start();var i=new gL(r,n.loop);return this.addAnimator(i),i},t}(Xi),jQ=300,fS=rt.domSupported,dS=function(){var e=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],t=["touchstart","touchend","touchmove"],r={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},n=ae(e,function(i){var a=i.replace("mouse","pointer");return r.hasOwnProperty(a)?a:i});return{mouse:e,touch:t,pointer:n}}(),UE={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},WE=!1;function Q2(e){var t=e.pointerType;return t==="pen"||t==="touch"}function OQ(e){e.touching=!0,e.touchTimer!=null&&(clearTimeout(e.touchTimer),e.touchTimer=null),e.touchTimer=setTimeout(function(){e.touching=!1,e.touchTimer=null},700)}function vS(e){e&&(e.zrByTouch=!0)}function zQ(e,t){return Mi(e.dom,new BQ(e,t),!0)}function J6(e,t){for(var r=t,n=!1;r&&r.nodeType!==9&&!(n=r.domBelongToZr||r!==t&&r===e.painterRoot);)r=r.parentNode;return n}var BQ=function(){function e(t,r){this.stopPropagation=qt,this.stopImmediatePropagation=qt,this.preventDefault=qt,this.type=r.type,this.target=this.currentTarget=t.dom,this.pointerType=r.pointerType,this.clientX=r.clientX,this.clientY=r.clientY}return e}(),aa={mousedown:function(e){e=Mi(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=Mi(this.dom,e);var t=this.__mayPointerCapture;t&&(e.zrX!==t[0]||e.zrY!==t[1])&&this.__togglePointerCapture(!0),this.trigger("mousemove",e)},mouseup:function(e){e=Mi(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){e=Mi(this.dom,e);var t=e.toElement||e.relatedTarget;J6(this,t)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){WE=!0,e=Mi(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){WE||(e=Mi(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){e=Mi(this.dom,e),vS(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),aa.mousemove.call(this,e),aa.mousedown.call(this,e)},touchmove:function(e){e=Mi(this.dom,e),vS(e),this.handler.processGesture(e,"change"),aa.mousemove.call(this,e)},touchend:function(e){e=Mi(this.dom,e),vS(e),this.handler.processGesture(e,"end"),aa.mouseup.call(this,e),+new Date-+this.__lastTouchMomentYE||e<-YE}var eu=[],dh=[],gS=Ft(),mS=Math.abs,_o=function(){function e(){}return e.prototype.getLocalTransform=function(t){return Ml(this,t)},e.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},e.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},e.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},e.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},e.prototype.needLocalTransform=function(){return Ql(this.rotation)||Ql(this.x)||Ql(this.y)||Ql(this.scaleX-1)||Ql(this.scaleY-1)||Ql(this.skewX)||Ql(this.skewY)},e.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,r=this.needLocalTransform(),n=this.transform;if(!(r||t)){n&&($E(n),this.invTransform=null);return}n=n||Ft(),r?this.getLocalTransform(n):$E(n),t&&(r?ci(n,t,n):Cl(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||Ft(),fi(this.invTransform,n)},e.prototype._resolveGlobalScaleRatio=function(t){var r=this.globalScaleRatio;if(r!=null&&r!==1){this.getGlobalScale(eu);var n=eu[0]<0?-1:1,i=eu[1]<0?-1:1,a=((eu[0]-n)*r+n)/eu[0]||0,o=((eu[1]-i)*r+i)/eu[1]||0;t[0]*=a,t[1]*=a,t[2]*=o,t[3]*=o}},e.prototype.getComputedTransform=function(){for(var t=this,r=[];t;)r.push(t),t=t.parent;for(;t=r.pop();)t.updateTransform();return this.transform},e.prototype.setLocalTransform=function(t){if(t){var r=t[0]*t[0]+t[1]*t[1],n=t[2]*t[2]+t[3]*t[3],i=Math.atan2(t[1],t[0]),a=Math.PI/2+i-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(a),r=Math.sqrt(r),this.skewX=a,this.skewY=0,this.rotation=-i,this.x=+t[4],this.y=+t[5],this.scaleX=r,this.scaleY=n,this.originX=0,this.originY=0}},e.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,r=this.transform;t&&t.transform&&(t.invTransform=t.invTransform||Ft(),ci(dh,t.invTransform,r),r=dh);var n=this.originX,i=this.originY;(n||i)&&(gS[4]=n,gS[5]=i,ci(dh,r,gS),dh[4]-=n,dh[5]-=i,r=dh),this.setLocalTransform(r)}},e.prototype.getGlobalScale=function(t){var r=this.transform;return t=t||[],r?(t[0]=Math.sqrt(r[0]*r[0]+r[1]*r[1]),t[1]=Math.sqrt(r[2]*r[2]+r[3]*r[3]),r[0]<0&&(t[0]=-t[0]),r[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},e.prototype.transformCoordToLocal=function(t,r){var n=[t,r],i=this.invTransform;return i&&Kt(n,n,i),n},e.prototype.transformCoordToGlobal=function(t,r){var n=[t,r],i=this.transform;return i&&Kt(n,n,i),n},e.prototype.getLineScale=function(){var t=this.transform;return t&&mS(t[0]-1)>1e-10&&mS(t[3]-1)>1e-10?Math.sqrt(mS(t[0]*t[3]-t[2]*t[1])):1},e.prototype.copyTransform=function(t){so(this,t)},e.getLocalTransform=function(t,r){r=r||[];var n=t.originX||0,i=t.originY||0,a=t.scaleX,o=t.scaleY,s=t.anchorX,l=t.anchorY,u=t.rotation||0,c=t.x,h=t.y,f=t.skewX?Math.tan(t.skewX):0,d=t.skewY?Math.tan(-t.skewY):0;if(n||i||s||l){var g=n+s,m=i+l;r[4]=-g*a-f*m*o,r[5]=-m*o-d*g*a}else r[4]=r[5]=0;return r[0]=a,r[3]=o,r[1]=d*a,r[2]=f*o,u&&_s(r,r,u),r[4]+=n+c,r[5]+=i+h,r},e.initDefaultProps=function(){var t=e.prototype;t.scaleX=t.scaleY=t.globalScaleRatio=1,t.x=t.y=t.originX=t.originY=t.skewX=t.skewY=t.rotation=t.anchorX=t.anchorY=0}(),e}(),Ml=_o.getLocalTransform;function vf(){return new _o}var us=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function so(e,t){return b6(e,t,us)}function Ka(e){Ay||(Ay=new Rf(100)),e=e||ss;var t=Ay.get(e);return t||(t={font:e,strWidthCache:new Rf(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:Rr.measureText("国",e).width,asciiCharWidth:Rr.measureText("a",e).width},Ay.put(e,t)),t}var Ay;function UQ(e){if(!(yS>=XE)){e=e||ss;for(var t=[],r=+new Date,n=0;n<=127;n++)t[n]=Rr.measureText(String.fromCharCode(n),e).width;var i=+new Date-r;return i>16?yS=XE:i>2&&yS++,t}}var yS=0,XE=5;function eG(e,t){return e.asciiWidthMapTried||(e.asciiWidthMap=UQ(e.font),e.asciiWidthMapTried=!0),0<=t&&t<=127?e.asciiWidthMap!=null?e.asciiWidthMap[t]:e.asciiCharWidth:e.stWideCharWidth}function Ja(e,t){var r=e.strWidthCache,n=r.get(t);return n==null&&(n=Rr.measureText(t,e.font).width,r.put(t,n)),n}function qE(e,t,r,n){var i=Ja(Ka(t),e),a=Jg(t),o=jf(0,i,r),s=Yu(0,a,n),l=new Ae(o,s,i,a);return l}function nb(e,t,r,n){var i=((e||"")+"").split(` -`),a=i.length;if(a===1)return qE(i[0],t,r,n);for(var o=new Ae(0,0,0,0),s=0;s=0?parseFloat(e)/100*t:parseFloat(e):e}function ux(e,t,r){var n=t.position||"inside",i=t.distance!=null?t.distance:5,a=r.height,o=r.width,s=a/2,l=r.x,u=r.y,c="left",h="top";if(n instanceof Array)l+=lo(n[0],r.width),u+=lo(n[1],r.height),c=null,h=null;else switch(n){case"left":l-=i,u+=s,c="right",h="middle";break;case"right":l+=i+o,u+=s,h="middle";break;case"top":l+=o/2,u-=i,c="center",h="bottom";break;case"bottom":l+=o/2,u+=a+i,c="center";break;case"inside":l+=o/2,u+=s,c="center",h="middle";break;case"insideLeft":l+=i,u+=s,h="middle";break;case"insideRight":l+=o-i,u+=s,c="right",h="middle";break;case"insideTop":l+=o/2,u+=i,c="center";break;case"insideBottom":l+=o/2,u+=a-i,c="center",h="bottom";break;case"insideTopLeft":l+=i,u+=i;break;case"insideTopRight":l+=o-i,u+=i,c="right";break;case"insideBottomLeft":l+=i,u+=a-i,h="bottom";break;case"insideBottomRight":l+=o-i,u+=a-i,c="right",h="bottom";break}return e=e||{},e.x=l,e.y=u,e.align=c,e.verticalAlign=h,e}var _S="__zr_normal__",xS=us.concat(["ignore"]),WQ=Hi(us,function(e,t){return e[t]=!0,e},{ignore:!1}),vh={},ZQ=new Ae(0,0,0,0),ky=[],n_=0,ib=1,ab=function(){function e(t){this.id=lL(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return e.prototype._init=function(t){this.attr(t)},e.prototype.drift=function(t,r,n){switch(this.draggable){case"horizontal":r=0;break;case"vertical":t=0;break}var i=this.transform;i||(i=this.transform=[1,0,0,1,0,0]),i[4]+=t,i[5]+=r,this.decomposeTransform(),this.markRedraw()},e.prototype.beforeUpdate=function(){},e.prototype.afterUpdate=function(){},e.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},e.prototype.updateInnerText=function(t){var r=this._textContent;if(r&&(!r.ignore||t)){this.textConfig||(this.textConfig={});var n=this.textConfig,i=n.local,a=r.innerTransformable,o=void 0,s=void 0,l=!1;a.parent=i?this:null;var u=!1;a.copyTransform(r);var c=n.position!=null,h=n.autoOverflowArea,f=void 0;if((h||c)&&(f=ZQ,n.layoutRect?f.copy(n.layoutRect):f.copy(this.getBoundingRect()),i||f.applyTransform(this.transform)),c){this.calculateTextPosition?this.calculateTextPosition(vh,n,f):ux(vh,n,f),a.x=vh.x,a.y=vh.y,o=vh.align,s=vh.verticalAlign;var d=n.origin;if(d&&n.rotation!=null){var g=void 0,m=void 0;d==="center"?(g=f.width*.5,m=f.height*.5):(g=lo(d[0],f.width),m=lo(d[1],f.height)),u=!0,a.originX=-a.x+g+(i?0:f.x),a.originY=-a.y+m+(i?0:f.y)}}n.rotation!=null&&(a.rotation=n.rotation);var y=n.offset;y&&(a.x+=y[0],a.y+=y[1],u||(a.originX=-y[0],a.originY=-y[1]));var _=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={});if(h){var x=_.overflowRect=_.overflowRect||new Ae(0,0,0,0);a.getLocalTransform(ky),fi(ky,ky),Ae.copy(x,f),x.applyTransform(ky)}else _.overflowRect=null;var w=n.inside==null?typeof n.position=="string"&&n.position.indexOf("inside")>=0:n.inside,S=void 0,T=void 0,M=void 0;w&&this.canBeInsideText()?(S=n.insideFill,T=n.insideStroke,(S==null||S==="auto")&&(S=this.getInsideTextFill()),(T==null||T==="auto")&&(T=this.getInsideTextStroke(S),M=!0)):(S=n.outsideFill,T=n.outsideStroke,(S==null||S==="auto")&&(S=this.getOutsideFill()),(T==null||T==="auto")&&(T=this.getOutsideStroke(S),M=!0)),S=S||"#000",(S!==_.fill||T!==_.stroke||M!==_.autoStroke||o!==_.align||s!==_.verticalAlign)&&(l=!0,_.fill=S,_.stroke=T,_.autoStroke=M,_.align=o,_.verticalAlign=s,r.setDefaultTextStyle(_)),r.__dirty|=Un,l&&r.dirtyStyle(!0)}},e.prototype.canBeInsideText=function(){return!0},e.prototype.getInsideTextFill=function(){return"#fff"},e.prototype.getInsideTextStroke=function(t){return"#000"},e.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?nM:rM},e.prototype.getOutsideStroke=function(t){var r=this.__zr&&this.__zr.getBackgroundColor(),n=typeof r=="string"&&yn(r);n||(n=[255,255,255,1]);for(var i=n[3],a=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*i+(a?0:255)*(1-i);return n[3]=1,Oi(n,"rgba")},e.prototype.traverse=function(t,r){},e.prototype.attrKV=function(t,r){t==="textConfig"?this.setTextConfig(r):t==="textContent"?this.setTextContent(r):t==="clipPath"?this.setClipPath(r):t==="extra"?(this.extra=this.extra||{},ee(this.extra,r)):this[t]=r},e.prototype.hide=function(){this.ignore=!0,this.markRedraw()},e.prototype.show=function(){this.ignore=!1,this.markRedraw()},e.prototype.attr=function(t,r){if(typeof t=="string")this.attrKV(t,r);else if(Ie(t))for(var n=t,i=tt(n),a=0;a0},e.prototype.getState=function(t){return this.states[t]},e.prototype.ensureState=function(t){var r=this.states;return r[t]||(r[t]={}),r[t]},e.prototype.clearStates=function(t){this.useState(_S,!1,t)},e.prototype.useState=function(t,r,n,i){var a=t===_S,o=this.hasState();if(!(!o&&a)){var s=this.currentStates,l=this.stateTransition;if(!(Be(s,t)>=0&&(r||s.length===1))){var u;if(this.stateProxy&&!a&&(u=this.stateProxy(t)),u||(u=this.states&&this.states[t]),!u&&!a){K1("State "+t+" not exists.");return}a||this.saveCurrentToNormalState(u);var c=this._textContent,h=KE(this,c,u,i);h&&!this.__inHover&&(this.__inHover=h),this._applyStateObj(t,u,this._normalState,r,QE(this,n,l),l);var f=this._textGuide;return c&&c.useState(t,r,n,!!h),f&&f.useState(t,r,n,!!h),a?(this.currentStates=[],this._normalState={}):r?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!h&&this.__inHover&&(this.__inHover=n_,this.__dirty&=~Un),u}}},e.prototype.useStates=function(t,r,n){if(!t.length)this.clearStates();else{var i=[],a=this.currentStates,o=t.length,s=o===a.length;if(s){for(var l=0;l=0){var n=this.currentStates.slice();n.splice(r,1),this.useStates(n)}},e.prototype.replaceState=function(t,r,n){var i=this.currentStates.slice(),a=Be(i,t),o=Be(i,r)>=0;a>=0?o?i.splice(a,1):i[a]=r:n&&!o&&i.push(r),this.useStates(i)},e.prototype.toggleState=function(t,r){r?this.useState(t,!0):this.removeState(t)},e.prototype._mergeStates=function(t){for(var r={},n,i=0;i=0&&a.splice(o,1)}),this.animators.push(t),n&&n.animation.addAnimator(t),n&&n.wakeUp()},e.prototype.updateDuringAnimation=function(t){this.markRedraw()},e.prototype.stopAnimation=function(t,r){for(var n=this.animators,i=n.length,a=[],o=0;o0&&r.during&&a[0].during(function(g,m){r.during(m)});for(var f=0;f0||i.force&&!o.length){var N=void 0,P=void 0,I=void 0;if(s){P={},f&&(N={});for(var S=0;S0}var Me=function(e){q(t,e);function t(r){var n=e.call(this)||this;return n.isGroup=!0,n._children=[],n.attr(r),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.children=function(){return this._children.slice()},t.prototype.childAt=function(r){return this._children[r]},t.prototype.childOfName=function(r){for(var n=this._children,i=0;i=0&&(i.splice(a,0,r),this._doAdd(r))}return this},t.prototype.replace=function(r,n){var i=Be(this._children,r);return i>=0&&this.replaceAt(n,i),this},t.prototype.replaceAt=function(r,n){var i=this._children,a=i[n];if(r&&r!==this&&r.parent!==this&&r!==a){i[n]=r,a.parent=null;var o=this.__zr;o&&a.removeSelfFromZr(o),this._doAdd(r)}return this},t.prototype._doAdd=function(r){r.parent&&r.parent.remove(r),r.parent=this;var n=this.__zr;n&&n!==r.__zr&&r.addSelfToZr(n),n&&n.refresh()},t.prototype.remove=function(r){var n=this.__zr,i=this._children,a=Be(i,r);return a<0?this:(i.splice(a,1),r.parent=null,n&&r.removeSelfFromZr(n),n&&n.refresh(),this)},t.prototype.removeAll=function(){for(var r=this._children,n=this.__zr,i=0;i0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},e.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},e.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},e.prototype.refreshHover=function(){this._needsRefreshHover=!0},e.prototype.refreshHoverImmediately=function(){this._disposed||this._refresh({animUpdate:!1,refresh:!1,refreshHover:!0})},e.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},e.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},e.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},e.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},e.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},e.prototype.findHover=function(t,r){if(!this._disposed)return this.handler.findHover(t,r)},e.prototype.on=function(t,r,n){return this._disposed||this.handler.on(t,r,n),this},e.prototype.off=function(t,r){this._disposed||this.handler.off(t,r)},e.prototype.trigger=function(t,r){this._disposed||this.handler.trigger(t,r)},e.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),r=0;r0){if(e<=i)return o;if(e>=a)return s}else{if(e>=i)return o;if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/l*u+o}var he=lee;function lee(e,t,r){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%";break}return fx(e,t,r)}function fx(e,t,r){return ue(e)?aG(e)?parseFloat(e)/100*t+(r||0):parseFloat(e):e==null?NaN:+e}function uee(e){return ue(e)&&aG(e)}function aG(e){return!!oee(e).match(/%$/)}function st(e,t,r){return isNaN(t)?r?""+e:+e:(t=bt($e(0,t),cx),e=(+e).toFixed(t),r?e:+e)}function cee(e,t,r){return t==null&&(t=10),st(e,t,r)}function Ur(e){return e.sort(function(t,r){return t-r}),e}function Ha(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,r=0;r<15;r++,t*=10)if(uo(e*t)/t===e)return r}return oG(e)}function oG(e){var t=e.toString().toLowerCase(),r=t.indexOf("e"),n=r>0?+t.slice(r+1):0,i=r>0?r:t.length,a=t.indexOf("."),o=a<0?0:i-1-a;return $e(0,o-n)}function hee(e,t){var r=Ui(hc(e[1]-e[0])/ig),n=uo(hc(Xt(t[1]-t[0]))/ig),i=bt($e(-r+n,0),cx);return isFinite(i)?i:cx}function mL(e,t,r){var n=Xt(e[1]-e[0]);if(!isFinite(n)||n===0)return NaN;var i=hc(2*Xt(r||1)*Xt(n))/ig,a=hc(Xt(t))/ig,o=$e(0,Vc(-i+a));return isFinite(o)||(o=NaN),o}function fee(e,t,r){if(!e[t])return 0;var n=sG(e,r);return n[t]||0}function sG(e,t){var r=Hi(e,function(d,g){return d+(isNaN(g)?0:g)},0);if(r===0)return[];for(var n=Gc(10,t),i=ae(e,function(d){return(isNaN(d)?0:d)/r*n*100}),a=n*100,o=ae(i,function(d){return Ui(d)}),s=Hi(o,function(d,g){return d+g},0),l=ae(i,function(d,g){return d-o[g]});su&&(u=l[h],c=h);++o[c],l[c]=0,++s}return ae(o,function(d){return d/n})}function Tu(e,t){var r=$e(Ha(e),Ha(t)),n=e+t;return r>cx?n:st(n,r)}var ag=Gc(2,53)-1;function yL(e){var t=hx*2;return(e%t+t)%t}function fc(e){return e>-eR&&e=10&&t++,t}var lG=2;function sb(e,t){var r=ob(e),n=Gc(10,r),i=e/n,a;return t===lG?a=1:t?i<1.5?a=1:i<2.5?a=2:i<4?a=3:i<7?a=5:a=10:i<1?a=1:i<2?a=2:i<3?a=3:i<5?a=5:a=10,e=a*n,st(e,-r)}function a_(e,t){var r=(e.length-1)*t+1,n=Ui(r),i=+e[n-1],a=r-n;return a?i+a*(e[n]-i):i}function oM(e){e.sort(function(l,u){return s(l,u,0)?-1:1});for(var t=-1/0,r=1,n=0;n0?t.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)?(this.item=this._list[this._idx],this.key=this._idx=this._idx+this._step,!0):!1},e}();function SS(e){e.option=e.parentModel=e.ecModel=null}function Qr(){return[1/0,-1/0]}function lM(e,t){cs(t)&&(te[1]&&(e[1]=t))}function mG(e,t){cs(t)&&te[1]&&(e[1]=t)}function Pee(e,t){pc(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function cs(e){return e!=null&&isFinite(e)}function pc(e,t){return cs(e)&&cs(t)&&e<=t}function Dee(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function o_(e){pc(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function cd(){var e="__ec_once_"+Eee++;return function(t,r){ge(t,e)||(t[e]=1,r())}}var Eee=bL();function lb(e,t,r){var n=pe(),i=0;E(e,function(a){var o=t(a),s=n.get(o)||0;r&&r(a,s),!s&&!r&&(e[i++]=a),n.set(o,s+1)}),r||(e.length=i)}function Ree(e){return e.value+""}function jee(e){return e+""}function Qa(e,t){return _e(t,!0)?e.seriesIndex+2:0}function _G(e,t,r){var n=e.getData().count();return{progressiveRender:r.progressiveEnabled&&t.incrementalPrepareRender&&n>=r.threshold,large:e.get("large")&&n>=e.get("largeThreshold"),modDataCount:e.get("progressiveChunkMode")==="mod"?e.getData().count():null}}function kr(e,t){return{seriesType:e,overallReset:t}}function Qg(e){return{overallReset:e}}var Oee=".",tu="___EC__COMPONENT__CONTAINER___",xG="___EC__EXTENDED_CLASS___";function Ua(e){var t={main:"",sub:""};if(e){var r=e.split(Oee);t.main=r[0]||"",t.sub=r[1]||""}return t}function zee(e){an(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),'componentType "'+e+'" illegal')}function Bee(e){return!!(e&&e[xG])}function TL(e,t){e.$constructor=e,e.extend=function(r){var n=this,i;return Fee(n)?i=function(a){q(o,a);function o(){return a.apply(this,arguments)||this}return o}(n):(i=function(){(r.$constructor||n).apply(this,arguments)},uL(i,this)),ee(i.prototype,r),i[xG]=!0,i.extend=this.extend,i.superCall=Hee,i.superApply=Uee,i.superClass=n,i}}function Fee(e){return Ce(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function bG(e,t){e.extend=t.extend}var Vee=Math.round(Math.random()*10);function Gee(e){var t=["__\0is_clz",Vee++].join("_");e.prototype[t]=!0,e.isInstance=function(r){return!!(r&&r[t])}}function Hee(e,t){for(var r=[],n=2;n=0||a&&Be(a,l)<0)){var u=n.getShallow(l,t);u!=null&&(o[e[s][0]]=u)}}return o}}var Wee=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],Zee=gc(Wee),$ee=function(){function e(){}return e.prototype.getAreaStyle=function(t,r){return Zee(this,t,r)},e}(),uM=new Rf(50);function Yee(e){if(typeof e=="string"){var t=uM.get(e);return t&&t.image}else return e}function ML(e,t,r,n,i){if(e)if(typeof e=="string"){if(t&&t.__zrImageSrc===e||!r)return t;var a=uM.get(e),o={hostEl:r,cb:n,cbPayload:i};return a?(t=a.image,!cb(t)&&a.pending.push(o)):(t=Rr.loadImage(e,iR,iR),t.__zrImageSrc=e,uM.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}else return e;else return t}function iR(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t=s;u++)l-=s;var c=Ja(o,r);return c>l&&(r="",c=0),l=e-c,i.ellipsis=r,i.ellipsisWidth=c,i.contentWidth=l,i.containerWidth=e,i}function CG(e,t,r){var n=r.containerWidth,i=r.contentWidth,a=r.fontMeasureInfo;if(!n){e.textLine="",e.isTruncated=!1;return}var o=Ja(a,t);if(o<=n){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=r.maxIterations){t+=r.ellipsis;break}var l=s===0?qee(t,i,a):o>0?Math.floor(t.length*i/o):0;t=t.substr(0,l),o=Ja(a,t)}t===""&&(t=r.placeholder),e.textLine=t,e.isTruncated=!0}function qee(e,t,r){for(var n=0,i=0,a=e.length;iy&&d){var w=Math.floor(y/f);g=g||_.length>w,_=_.slice(0,w),x=_.length*f}if(i&&c&&m!=null)for(var S=SG(m,u,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),T={},M=0;M<_.length;M++)CG(T,_[M],S),_[M]=T.textLine,g=g||T.isTruncated;for(var A=y,N=0,P=Ka(u),M=0;M<_.length;M++)N=Math.max(Ja(P,_[M]),N);m==null&&(m=N);var I=m;return A+=l,I+=s,{lines:_,height:y,outerWidth:I,outerHeight:A,lineHeight:f,calculatedLineHeight:h,contentWidth:N,contentHeight:x,width:m,isTruncated:g}}var Jee=function(){function e(){}return e}(),aR=function(){function e(t){this.tokens=[],t&&(this.tokens=t)}return e}(),Qee=function(){function e(){this.width=0,this.height=0,this.contentWidth=0,this.contentHeight=0,this.outerWidth=0,this.outerHeight=0,this.lines=[],this.isTruncated=!1}return e}();function ete(e,t,r,n,i){var a=new Qee,o=AL(e);if(!o)return a;var s=t.padding,l=s?s[1]+s[3]:0,u=s?s[0]+s[2]:0,c=t.width;c==null&&r!=null&&(c=r-l);var h=t.height;h==null&&n!=null&&(h=n-u);for(var f=t.overflow,d=(f==="break"||f==="breakAll")&&c!=null?{width:c,accumWidth:0,breakAll:f==="breakAll"}:null,g=CS.lastIndex=0,m;(m=CS.exec(o))!=null;){var y=m.index;y>g&&TS(a,o.substring(g,y),t,d),TS(a,m[2],t,d,m[1]),g=CS.lastIndex}gh){var $=a.lines.length;O>0?(P.tokens=P.tokens.slice(0,O),A(P,D,I),a.lines=a.lines.slice(0,N+1)):a.lines=a.lines.slice(0,N),a.isTruncated=a.isTruncated||a.lines.length<$;break e}var W=B.width,Z=W==null||W==="auto";if(typeof W=="string"&&W.charAt(W.length-1)==="%")j.percentWidth=W,_.push(j),j.contentWidth=Ja(Ka(V),j.text);else{if(Z){var X=B.backgroundColor,re=X&&X.image;re&&(re=Yee(re),cb(re)&&(j.width=Math.max(j.width,re.width*z/re.height)))}var J=S&&c!=null?c-D:null;J!=null&&J0&&g+n.accumWidth>n.width&&(c=t.split(` -`),u=!0),n.accumWidth=g}else{var m=TG(t,l,n.width,n.breakAll,n.accumWidth);n.accumWidth=m.accumWidth+d,h=m.linesWidths,c=m.lines}}c||(c=t.split(` -`));for(var y=Ka(l),_=0;_=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}var rte=Hi(",&?/;] ".split(""),function(e,t){return e[t]=!0,e},{});function nte(e){return tte(e)?!!rte[e]:!0}function TG(e,t,r,n,i){for(var a=[],o=[],s="",l="",u=0,c=0,h=Ka(t),f=0;fr:i+c+g>r){c?(s||l)&&(m?(s||(s=l,l="",u=0,c=u),a.push(s),o.push(c-u),l+=d,u+=g,s="",c=u):(l&&(s+=l,l="",u=0),a.push(s),o.push(c),s=d,c=g)):m?(a.push(l),o.push(u),l=d,u=g):(a.push(d),o.push(g));continue}c+=g,m?(l+=d,u+=g):(l&&(s+=l,l="",u=0),s+=d)}return l&&(s+=l),s&&(a.push(s),o.push(c)),a.length===1&&(c+=i),{accumWidth:c,lines:a,linesWidths:o}}function oR(e,t,r,n,i,a){if(e.baseX=r,e.baseY=n,e.outerWidth=e.outerHeight=null,!!t){var o=t.width*2,s=t.height*2;Ae.set(sR,jf(r,o,i),Yu(n,s,a),o,s),Ae.intersect(t,sR,null,lR);var l=lR.outIntersectRect;e.outerWidth=l.width,e.outerHeight=l.height,e.baseX=jf(l.x,l.width,i,!0),e.baseY=Yu(l.y,l.height,a,!0)}}var sR=new Ae(0,0,0,0),lR={outIntersectRect:{},clamp:!0};function AL(e){return e!=null?e+="":e=""}function ite(e){var t=AL(e.text),r=e.font,n=Ja(Ka(r),t),i=Jg(r);return cM(e,n,i,null)}function cM(e,t,r,n){var i=new Ae(jf(e.x||0,t,e.textAlign),Yu(e.y||0,r,e.textBaseline),t,r),a=n??(MG(e)?e.lineWidth:0);return a>0&&(i.x-=a/2,i.y-=a/2,i.width+=a,i.height+=a),i}function MG(e){var t=e.stroke;return t!=null&&t!=="none"&&e.lineWidth>0}var hM="__zr_style_"+Math.round(Math.random()*10),Xu={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},hb={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Xu[hM]=!0;var uR=["z","z2","invisible"],ate=["invisible"],Zi=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype._init=function(r){for(var n=tt(r),i=0;i1e-4){s[0]=e-r,s[1]=t-n,l[0]=e+r,l[1]=t+n;return}if(Ly[0]=LS(i)*r+e,Ly[1]=kS(i)*n+t,Iy[0]=LS(a)*r+e,Iy[1]=kS(a)*n+t,u(s,Ly,Iy),c(l,Ly,Iy),i=i%ru,i<0&&(i=i+ru),a=a%ru,a<0&&(a=a+ru),i>a&&!o?a+=ru:ii&&(Ny[0]=LS(d)*r+e,Ny[1]=kS(d)*n+t,u(s,Ny,s),c(l,Ny,l))}var Pt={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},nu=[],iu=[],La=[],As=[],Ia=[],Na=[],IS=Math.min,NS=Math.max,au=Math.cos,ou=Math.sin,Io=Math.abs,fM=Math.PI,Os=fM*2,PS=typeof Float32Array<"u",lv=[];function DS(e){var t=Math.round(e/fM*1e8)/1e8;return t%2*fM}function db(e,t){var r=DS(e[0]);r<0&&(r+=Os);var n=r-e[0],i=e[1];i+=n,!t&&i-r>=Os?i=r+Os:t&&r-i>=Os?i=r-Os:!t&&r>i?i=r+(Os-DS(r-i)):t&&r0&&(this._ux=Io(n/lx/t)||0,this._uy=Io(n/lx/r)||0)},e.prototype.setDPR=function(t){this.dpr=t},e.prototype.setContext=function(t){this._ctx=t},e.prototype.getContext=function(){return this._ctx},e.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},e.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},e.prototype.moveTo=function(t,r){return this._drawPendingPt(),this.addData(Pt.M,t,r),this._ctx&&this._ctx.moveTo(t,r),this._x0=t,this._y0=r,this._xi=t,this._yi=r,this},e.prototype.lineTo=function(t,r){var n=Io(t-this._xi),i=Io(r-this._yi),a=n>this._ux||i>this._uy;if(this.addData(Pt.L,t,r),this._ctx&&a&&this._ctx.lineTo(t,r),a)this._xi=t,this._yi=r,this._pendingPtDist=0;else{var o=n*n+i*i;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=r,this._pendingPtDist=o)}return this},e.prototype.bezierCurveTo=function(t,r,n,i,a,o){return this._drawPendingPt(),this.addData(Pt.C,t,r,n,i,a,o),this._ctx&&this._ctx.bezierCurveTo(t,r,n,i,a,o),this._xi=a,this._yi=o,this},e.prototype.quadraticCurveTo=function(t,r,n,i){return this._drawPendingPt(),this.addData(Pt.Q,t,r,n,i),this._ctx&&this._ctx.quadraticCurveTo(t,r,n,i),this._xi=n,this._yi=i,this},e.prototype.arc=function(t,r,n,i,a,o){this._drawPendingPt(),lv[0]=i,lv[1]=a,db(lv,o),i=lv[0],a=lv[1];var s=a-i;return this.addData(Pt.A,t,r,n,n,i,s,0,o?0:1),this._ctx&&this._ctx.arc(t,r,n,i,a,o),this._xi=au(a)*n+t,this._yi=ou(a)*n+r,this},e.prototype.arcTo=function(t,r,n,i,a){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(t,r,n,i,a),this},e.prototype.rect=function(t,r,n,i){return this._drawPendingPt(),this._ctx&&this._ctx.rect(t,r,n,i),this.addData(Pt.R,t,r,n,i),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(Pt.Z);var t=this._ctx,r=this._x0,n=this._y0;return t&&t.closePath(),this._xi=r,this._yi=n,this},e.prototype.fill=function(t){t&&t.fill(),this.toStatic()},e.prototype.stroke=function(t){t&&t.stroke(),this.toStatic()},e.prototype.len=function(){return this._len},e.prototype.setData=function(t){if(this._saveData){var r=t.length;!(this.data&&this.data.length===r)&&PS&&(this.data=new Float32Array(r));for(var n=0;n0&&o))for(var s=0;sc.length&&(this._expandData(),c=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},e.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],r=0;r11&&(this.data=new Float32Array(t)))}},e.prototype.getBoundingRect=function(){La[0]=La[1]=Ia[0]=Ia[1]=Number.MAX_VALUE,As[0]=As[1]=Na[0]=Na[1]=-Number.MAX_VALUE;var t=this.data,r=0,n=0,i=0,a=0,o;for(o=0;on||Io(w)>i||f===r-1)&&(m=Math.sqrt(x*x+w*w),a=y,o=_);break}case Pt.C:{var S=t[f++],T=t[f++],y=t[f++],_=t[f++],M=t[f++],A=t[f++];m=cQ(a,o,S,T,y,_,M,A,10),a=M,o=A;break}case Pt.Q:{var S=t[f++],T=t[f++],y=t[f++],_=t[f++];m=fQ(a,o,S,T,y,_,10),a=y,o=_;break}case Pt.A:var N=t[f++],P=t[f++],I=t[f++],D=t[f++],O=t[f++],j=t[f++],B=j+O;f+=1,g&&(s=au(O)*I+N,l=ou(O)*D+P),m=NS(I,D)*IS(Os,Math.abs(j)),a=au(B)*I+N,o=ou(B)*D+P;break;case Pt.R:{s=a=t[f++],l=o=t[f++];var U=t[f++],H=t[f++];m=U*2+H*2;break}case Pt.Z:{var x=s-a,w=l-o;m=Math.sqrt(x*x+w*w),a=s,o=l;break}}m>=0&&(u[h++]=m,c+=m)}return this._pathLen=c,c},e.prototype.rebuildPath=function(t,r){var n=this.data,i=this._ux,a=this._uy,o=this._len,s,l,u,c,h,f,d=r<1,g,m,y=0,_=0,x,w=0,S,T;if(!(d&&(this._pathSegLen||this._calculateLength(),g=this._pathSegLen,m=this._pathLen,x=r*m,!x)))e:for(var M=0;M0&&(t.lineTo(S,T),w=0),A){case Pt.M:s=u=n[M++],l=c=n[M++],t.moveTo(u,c);break;case Pt.L:{h=n[M++],f=n[M++];var P=Io(h-u),I=Io(f-c);if(P>i||I>a){if(d){var D=g[_++];if(y+D>x){var O=(x-y)/D;t.lineTo(u*(1-O)+h*O,c*(1-O)+f*O);break e}y+=D}t.lineTo(h,f),u=h,c=f,w=0}else{var j=P*P+I*I;j>w&&(S=h,T=f,w=j)}break}case Pt.C:{var B=n[M++],U=n[M++],H=n[M++],V=n[M++],z=n[M++],$=n[M++];if(d){var D=g[_++];if(y+D>x){var O=(x-y)/D;Tl(u,B,H,z,O,nu),Tl(c,U,V,$,O,iu),t.bezierCurveTo(nu[1],iu[1],nu[2],iu[2],nu[3],iu[3]);break e}y+=D}t.bezierCurveTo(B,U,H,V,z,$),u=z,c=$;break}case Pt.Q:{var B=n[M++],U=n[M++],H=n[M++],V=n[M++];if(d){var D=g[_++];if(y+D>x){var O=(x-y)/D;Qp(u,B,H,O,nu),Qp(c,U,V,O,iu),t.quadraticCurveTo(nu[1],iu[1],nu[2],iu[2]);break e}y+=D}t.quadraticCurveTo(B,U,H,V),u=H,c=V;break}case Pt.A:var W=n[M++],Z=n[M++],X=n[M++],re=n[M++],J=n[M++],oe=n[M++],le=n[M++],De=!n[M++],we=X>re?X:re,ve=Io(X-re)>.001,Ne=J+oe,xe=!1;if(d){var D=g[_++];y+D>x&&(Ne=J+oe*(x-y)/D,xe=!0),y+=D}if(ve&&t.ellipse?t.ellipse(W,Z,X,re,le,J,Ne,De):t.arc(W,Z,we,J,Ne,De),xe)break e;N&&(s=au(J)*X+W,l=ou(J)*re+Z),u=au(Ne)*X+W,c=ou(Ne)*re+Z;break;case Pt.R:s=u=n[M],l=c=n[M+1],h=n[M++],f=n[M++];var Le=n[M++],ht=n[M++];if(d){var D=g[_++];if(y+D>x){var Fe=x-y;t.moveTo(h,f),t.lineTo(h+IS(Fe,Le),f),Fe-=Le,Fe>0&&t.lineTo(h+Le,f+IS(Fe,ht)),Fe-=ht,Fe>0&&t.lineTo(h+NS(Le-Fe,0),f+ht),Fe-=Le,Fe>0&&t.lineTo(h,f+NS(ht-Fe,0));break e}y+=D}t.rect(h,f,Le,ht);break;case Pt.Z:if(d){var D=g[_++];if(y+D>x){var O=(x-y)/D;t.lineTo(u*(1-O)+s*O,c*(1-O)+l*O);break e}y+=D}t.closePath(),u=s,c=l}}},e.prototype.clone=function(){var t=new e,r=this.data;return t.data=r.slice?r.slice():Array.prototype.slice.call(r),t._len=this._len,t},e.prototype.canSave=function(){return!!this._saveData},e.CMD=Pt,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function Vs(e,t,r,n,i,a,o){if(i===0)return!1;var s=i,l=0,u=e;if(o>t+s&&o>n+s||oe+s&&a>r+s||at+h&&c>n+h&&c>a+h&&c>s+h||ce+h&&u>r+h&&u>i+h&&u>o+h||ut+u&&l>n+u&&l>a+u||le+u&&s>r+u&&s>i+u||sr||c+ui&&(i+=uv);var f=Math.atan2(l,s);return f<0&&(f+=uv),f>=n&&f<=i||f+uv>=n&&f+uv<=i}function Oo(e,t,r,n,i,a){if(a>t&&a>n||ai?s:0}var ks=ho.CMD,su=Math.PI*2,fte=1e-4;function dte(e,t){return Math.abs(e-t)t&&u>n&&u>a&&u>s||u1&&vte(),d=Pr(t,n,a,s,ki[0]),f>1&&(g=Pr(t,n,a,s,ki[1]))),f===2?yt&&s>n&&s>a||s=0&&u<=1){for(var c=0,h=Hr(t,n,a,u),f=0;fr||s<-r)return 0;var l=Math.sqrt(r*r-s*s);Mn[0]=-l,Mn[1]=l;var u=Math.abs(n-i);if(u<1e-4)return 0;if(u>=su-1e-4){n=0,i=su;var c=a?1:-1;return o>=Mn[0]+e&&o<=Mn[1]+e?c:0}if(n>i){var h=n;n=i,i=h}n<0&&(n+=su,i+=su);for(var f=0,d=0;d<2;d++){var g=Mn[d];if(g+e>o){var m=Math.atan2(s,g),c=a?1:-1;m<0&&(m=su+m),(m>=n&&m<=i||m+su>=n&&m+su<=i)&&(m>Math.PI/2&&m1&&(r||(s+=Oo(l,u,c,h,n,i))),y&&(l=a[g],u=a[g+1],c=l,h=u),m){case ks.M:c=a[g++],h=a[g++],l=c,u=h;break;case ks.L:if(r){if(Vs(l,u,a[g],a[g+1],t,n,i))return!0}else s+=Oo(l,u,a[g],a[g+1],n,i)||0;l=a[g++],u=a[g++];break;case ks.C:if(r){if(cte(l,u,a[g++],a[g++],a[g++],a[g++],a[g],a[g+1],t,n,i))return!0}else s+=pte(l,u,a[g++],a[g++],a[g++],a[g++],a[g],a[g+1],n,i)||0;l=a[g++],u=a[g++];break;case ks.Q:if(r){if(AG(l,u,a[g++],a[g++],a[g],a[g+1],t,n,i))return!0}else s+=gte(l,u,a[g++],a[g++],a[g],a[g+1],n,i)||0;l=a[g++],u=a[g++];break;case ks.A:var _=a[g++],x=a[g++],w=a[g++],S=a[g++],T=a[g++],M=a[g++];g+=1;var A=!!(1-a[g++]);f=Math.cos(T)*w+_,d=Math.sin(T)*S+x,y?(c=f,h=d):s+=Oo(l,u,f,d,n,i);var N=(n-_)*S/w+_;if(r){if(hte(_,x,S,T,T+M,A,t,N,i))return!0}else s+=mte(_,x,S,T,T+M,A,N,i);l=Math.cos(T+M)*w+_,u=Math.sin(T+M)*S+x;break;case ks.R:c=l=a[g++],h=u=a[g++];var P=a[g++],I=a[g++];if(f=c+P,d=h+I,r){if(Vs(c,h,f,h,t,n,i)||Vs(f,h,f,d,t,n,i)||Vs(f,d,c,d,t,n,i)||Vs(c,d,c,h,t,n,i))return!0}else s+=Oo(f,h,f,d,n,i),s+=Oo(c,d,c,h,n,i);break;case ks.Z:if(r){if(Vs(l,u,c,h,t,n,i))return!0}else s+=Oo(l,u,c,h,n,i);l=c,u=h;break}}return!r&&!dte(u,h)&&(s+=Oo(l,u,c,h,n,i)||0),s!==0}function yte(e,t,r){return kG(e,0,!1,t,r)}function _te(e,t,r,n){return kG(e,t,!0,r,n)}var dx=ke({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Xu),xte={style:ke({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},hb.style)},ES=us.concat(["invisible","culling","z","z2","zlevel","parent"]),Qe=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.update=function(){var r=this;e.prototype.update.call(this);var n=this.style;if(n.decal){var i=this._decalEl=this._decalEl||new t;i.buildPath===t.prototype.buildPath&&(i.buildPath=function(l){r.buildPath(l,r.shape)}),i.silent=!0;var a=i.style;for(var o in n)a[o]!==n[o]&&(a[o]=n[o]);a.fill=n.fill?n.decal:null,a.decal=null,a.shadowColor=null,n.strokeFirst&&(a.stroke=null);for(var s=0;s.5?rM:n>.2?HQ:nM}else if(r)return nM}return rM},t.prototype.getInsideTextStroke=function(r){var n=this.style.fill;if(ue(n)){var i=this.__zr,a=!!(i&&i.isDarkMode()),o=rg(r,0)0))},t.prototype.hasFill=function(){var r=this.style,n=r.fill;return n!=null&&n!=="none"},t.prototype.getBoundingRect=function(){var r=this._rect,n=this.style,i=!r;if(i){var a=!1;this.path||(a=!0,this.createPathProxy());var o=this.path;(a||this.__dirty&jh)&&(o.beginPath(),this.buildPath(o,this.shape,!1),this.pathUpdated()),r=o.getBoundingRect()}if(this._rect=r,this.hasStroke()&&this.path&&this.path.len()>0){var s=this._rectStroke||(this._rectStroke=r.clone());if(this.__dirty||i){s.copy(r);var l=n.strokeNoScale?this.getLineScale():1,u=n.lineWidth;if(!this.hasFill()){var c=this.strokeContainThreshold;u=Math.max(u,c??4)}l>1e-10&&(s.width+=u/l,s.height+=u/l,s.x-=u/l/2,s.y-=u/l/2)}return s}return r},t.prototype.contain=function(r,n){var i=this.transformCoordToLocal(r,n),a=this.getBoundingRect(),o=this.style;if(r=i[0],n=i[1],a.contain(r,n)){var s=this.path;if(this.hasStroke()){var l=o.lineWidth,u=o.strokeNoScale?this.getLineScale():1;if(u>1e-10&&(this.hasFill()||(l=Math.max(l,this.strokeContainThreshold)),_te(s,l/u,r,n)))return!0}if(this.hasFill())return yte(s,r,n)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=jh,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},t.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},t.prototype.animateShape=function(r){return this.animate("shape",r)},t.prototype.updateDuringAnimation=function(r){r==="style"?this.dirtyStyle():r==="shape"?this.dirtyShape():this.markRedraw()},t.prototype.attrKV=function(r,n){r==="shape"?this.setShape(n):e.prototype.attrKV.call(this,r,n)},t.prototype.setShape=function(r,n){var i=this.shape;return i||(i=this.shape={}),typeof r=="string"?i[r]=n:ee(i,r),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(this.__dirty&jh)},t.prototype.createStyle=function(r){return Kg(dx,r)},t.prototype._innerSaveToNormal=function(r){e.prototype._innerSaveToNormal.call(this,r);var n=this._normalState;r.shape&&!n.shape&&(n.shape=ee({},this.shape))},t.prototype._applyStateObj=function(r,n,i,a,o,s){if(e.prototype._applyStateObj.call(this,r,n,i,a,o,s),this.__inHover!==ib){var l=!(n&&a),u;if(n&&n.shape?o?a?u=n.shape:(u=ee({},i.shape),ee(u,n.shape)):(u=ee({},a?this.shape:i.shape),ee(u,n.shape)):l&&(u=i.shape),u)if(o){this.shape=ee({},this.shape);for(var c={},h=tt(u),f=0;fi&&(h=s+l,s*=i/h,l*=i/h),u+c>i&&(h=u+c,u*=i/h,c*=i/h),l+u>a&&(h=l+u,l*=a/h,u*=a/h),s+c>a&&(h=s+c,s*=a/h,c*=a/h),e.moveTo(r+s,n),e.lineTo(r+i-l,n),l!==0&&e.arc(r+i-l,n+l,l,-Math.PI/2,0),e.lineTo(r+i,n+a-u),u!==0&&e.arc(r+i-u,n+a-u,u,0,Math.PI/2),e.lineTo(r+c,n+a),c!==0&&e.arc(r+c,n+a-c,c,Math.PI/2,Math.PI),e.lineTo(r,n+s),s!==0&&e.arc(r+s,n+s,s,Math.PI,Math.PI*1.5),e.closePath()}var ef=Math.round;function vb(e,t,r){if(t){var n=t.x1,i=t.x2,a=t.y1,o=t.y2;e.x1=n,e.x2=i,e.y1=a,e.y2=o;var s=r&&r.lineWidth;return s&&(ef(n*2)===ef(i*2)&&(e.x1=e.x2=li(n,s,!0)),ef(a*2)===ef(o*2)&&(e.y1=e.y2=li(a,s,!0))),e}}function LG(e,t,r){if(t){var n=t.x,i=t.y,a=t.width,o=t.height;e.x=n,e.y=i,e.width=a,e.height=o;var s=r&&r.lineWidth;return s&&(e.x=li(n,s,!0),e.y=li(i,s,!0),e.width=Math.max(li(n+a,s,!1)-e.x,a===0?0:1),e.height=Math.max(li(i+o,s,!1)-e.y,o===0?0:1)),e}}function li(e,t,r){if(!t)return e;var n=ef(e*2);return(n+ef(t))%2===0?n/2:(n+(r?1:-1))/2}var Mte=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0}return e}(),Ate={},Ye=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new Mte},t.prototype.buildPath=function(r,n){var i,a,o,s;if(this.subPixelOptimize){var l=LG(Ate,n,this.style);i=l.x,a=l.y,o=l.width,s=l.height,l.r=n.r,n=l}else i=n.x,a=n.y,o=n.width,s=n.height;n.r?Tte(r,n):r.rect(i,a,o,s)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(Qe);Ye.prototype.type="rect";var vR={fill:"#000"},pR=2,Pa={},kte={style:ke({fill:!0,stroke:!0,fillOpacity:!0,strokeOpacity:!0,lineWidth:!0,fontSize:!0,lineHeight:!0,width:!0,height:!0,textShadowColor:!0,textShadowBlur:!0,textShadowOffsetX:!0,textShadowOffsetY:!0,backgroundColor:!0,padding:!0,borderColor:!0,borderWidth:!0,borderRadius:!0},hb.style)},it=function(e){q(t,e);function t(r){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=vR,n.attr(r),n}return t.prototype.childrenRef=function(){return this._children},t.prototype.update=function(){e.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var r=0;r0,O=0;O=0&&(B=M[j],B.align==="right");)this._placeToken(B,r,N,_,O,"right",w),P-=B.width,O-=B.width,j--;for(D+=(c-(D-y)-(x-O)-P)/2;I<=j;)B=M[I],this._placeToken(B,r,N,_,D+B.width/2,"center",w),D+=B.width,I++;_+=N}},t.prototype._placeToken=function(r,n,i,a,o,s,l){var u=n.rich[r.styleName]||{};u.text=r.text;var c=r.verticalAlign,h=a+i/2;c==="top"?h=a+r.height/2:c==="bottom"&&(h=a+i-r.height/2);var f=!r.isLineHolder&&RS(u);f&&this._renderBackground(u,n,s==="right"?o-r.width:s==="center"?o-r.width/2:o,h-r.height/2,r.width,r.height);var d=!!u.backgroundColor,g=r.textPadding;g&&(o=bR(o,s,g),h-=r.height/2-g[0]-r.innerHeight/2);var m=this._getOrCreateChild(Of),y=m.createStyle();m.useStyle(y);var _=this._defaultStyle,x=!1,w=0,S=!1,T=xR("fill"in u?u.fill:"fill"in n?n.fill:(x=!0,_.fill)),M=_R("stroke"in u?u.stroke:"stroke"in n?n.stroke:!d&&!l&&(!_.autoStroke||x)?(w=pR,S=!0,_.stroke):null),A=u.textShadowBlur>0||n.textShadowBlur>0;y.text=r.text,y.x=o,y.y=h,A&&(y.shadowBlur=u.textShadowBlur||n.textShadowBlur||0,y.shadowColor=u.textShadowColor||n.textShadowColor||"transparent",y.shadowOffsetX=u.textShadowOffsetX||n.textShadowOffsetX||0,y.shadowOffsetY=u.textShadowOffsetY||n.textShadowOffsetY||0),y.textAlign=s,y.textBaseline="middle",y.font=r.font||ss,y.opacity=qn(u.opacity,n.opacity,1),mR(y,u),M&&(y.lineWidth=qn(u.lineWidth,n.lineWidth,w),y.lineDash=_e(u.lineDash,n.lineDash),y.lineDashOffset=n.lineDashOffset||0,y.stroke=M),T&&(y.fill=T),m.setBoundingRect(cM(y,r.contentWidth,r.contentHeight,S?0:null))},t.prototype._renderBackground=function(r,n,i,a,o,s){var l=r.backgroundColor,u=r.borderWidth,c=r.borderColor,h=l&&l.image,f=l&&!h,d=r.borderRadius,g=this,m,y;if(f||r.lineHeight||u&&c){m=this._getOrCreateChild(Ye),m.useStyle(m.createStyle()),m.style.fill=null;var _=m.shape;_.x=i,_.y=a,_.width=o,_.height=s,_.r=d,m.dirtyShape()}if(f){var x=m.style;x.fill=l||null,x.fillOpacity=_e(r.fillOpacity,1)}else if(h){y=this._getOrCreateChild(zr),y.onload=function(){g.dirtyStyle()};var w=y.style;w.image=l.image,w.x=i,w.y=a,w.width=o,w.height=s}if(u&&c){var x=m.style;x.lineWidth=u,x.stroke=c,x.strokeOpacity=_e(r.strokeOpacity,1),x.lineDash=r.borderDash,x.lineDashOffset=r.borderDashOffset||0,m.strokeContainThreshold=0,m.hasFill()&&m.hasStroke()&&(x.strokeFirst=!0,x.lineWidth*=2)}var S=(m||y).style;S.shadowBlur=r.shadowBlur||0,S.shadowColor=r.shadowColor||"transparent",S.shadowOffsetX=r.shadowOffsetX||0,S.shadowOffsetY=r.shadowOffsetY||0,S.opacity=qn(r.opacity,n.opacity,1)},t.makeFont=function(r){var n="";return NG(r)&&(n=[r.fontStyle,r.fontWeight,IG(r.fontSize),r.fontFamily||"sans-serif"].join(" ")),n&&oi(n)||r.textFont||r.font},t}(Zi),Lte={left:!0,right:1,center:1},Ite={top:1,bottom:1,middle:1},gR=["fontStyle","fontWeight","fontSize","fontFamily"];function IG(e){return typeof e=="string"&&(e.indexOf("px")!==-1||e.indexOf("rem")!==-1||e.indexOf("em")!==-1)?e:isNaN(+e)?aL+"px":e+"px"}function mR(e,t){for(var r=0;r=0,a=!1;if(e instanceof Qe){var o=OG(e),s=i&&o.selectFill||o.normalFill,l=i&&o.selectStroke||o.normalStroke;if(ph(s)||ph(l)){n=n||{};var u=n.style||{};u.fill==="inherit"?(a=!0,n=ee({},n),u=ee({},u),u.fill=s):!ph(u.fill)&&ph(s)?(a=!0,n=ee({},n),u=ee({},u),u.fill=ox(s)):!ph(u.stroke)&&ph(l)&&(a||(n=ee({},n),u=ee({},u)),u.stroke=ox(l)),n.style=u}}if(n&&n.z2==null){a||(n=ee({},n));var c=e.z2EmphasisLift;n.z2=e.z2+(c??fd)}return n}function zte(e,t,r){if(r&&r.z2==null){r=ee({},r);var n=e.z2SelectLift;r.z2=e.z2+(n??Dte)}return r}function Bte(e,t,r){var n=Be(e.currentStates,t)>=0,i=e.style.opacity,a=n?null:jte(e,["opacity"],t,{opacity:1});r=r||{};var o=r.style||{};return o.opacity==null&&(r=ee({},r),o=ee({opacity:n?i:a.opacity*.1},o),r.style=o),r}function jS(e,t){var r=this.states[e];if(this.style){if(e==="emphasis")return Ote(this,e,t,r);if(e==="blur")return Bte(this,e,r);if(e==="select")return zte(this,e,r)}return r}function mc(e){e.stateProxy=jS;var t=e.getTextContent(),r=e.getTextGuideLine();t&&(t.stateProxy=jS),r&&(r.stateProxy=jS)}function MR(e,t){!UG(e,t)&&!e.__highByOuter&&xs(e,zG)}function AR(e,t){!UG(e,t)&&!e.__highByOuter&&xs(e,BG)}function hs(e,t){e.__highByOuter|=1<<(t||0),xs(e,zG)}function fs(e,t){!(e.__highByOuter&=~(1<<(t||0)))&&xs(e,BG)}function VG(e){xs(e,NL)}function PL(e){xs(e,FG)}function GG(e){xs(e,Ete)}function HG(e){xs(e,Rte)}function UG(e,t){return e.__highDownSilentOnTouch&&t.zrByTouch}function WG(e){var t=e.getModel(),r=[],n=[];t.eachComponent(function(i,a){var o=kL(a),s=jG(e,a),l=i==="series";!l&&n.push(s),o.isBlured&&(s.group.traverse(function(u){FG(u)}),l&&r.push(a)),o.isBlured=!1}),E(n,function(i){i&&i.toggleBlurSeries&&i.toggleBlurSeries(r,!1,t)})}function pM(e,t,r,n){var i=n.getModel();r=r||"coordinateSystem";function a(u,c){for(var h=0;h0){var s={dataIndex:o,seriesIndex:r.seriesIndex};a!=null&&(s.dataType=a),t.push(s)}})}),t}function pl(e,t,r){Vu(e,!0),xs(e,mc),mM(e,t,r)}function Wte(e){Vu(e,!1)}function Vt(e,t,r,n){n?Wte(e):pl(e,t,r)}function mM(e,t,r){var n=Re(e);t!=null?(n.focus=t,n.blurScope=r):n.focus&&(n.focus=null)}var LR=["emphasis","blur","select"],Zte={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Mr(e,t,r,n){r=r||"itemStyle";for(var i=0;i1&&(o*=OS(g),s*=OS(g));var m=(i===a?-1:1)*OS((o*o*(s*s)-o*o*(d*d)-s*s*(f*f))/(o*o*(d*d)+s*s*(f*f)))||0,y=m*o*d/s,_=m*-s*f/o,x=(e+r)/2+Dy(h)*y-Py(h)*_,w=(t+n)/2+Py(h)*y+Dy(h)*_,S=DR([1,0],[(f-y)/o,(d-_)/s]),T=[(f-y)/o,(d-_)/s],M=[(-1*f-y)/o,(-1*d-_)/s],A=DR(T,M);if(_M(T,M)<=-1&&(A=cv),_M(T,M)>=1&&(A=0),A<0){var N=Math.round(A/cv*1e6)/1e6;A=cv*2+N%2*cv}c.addData(u,x,w,o,s,S,A,h,a)}var Jte=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,Qte=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function ere(e){var t=new ho;if(!e)return t;var r=0,n=0,i=r,a=n,o,s=ho.CMD,l=e.match(Jte);if(!l)return t;for(var u=0;uB*B+U*U&&(N=I,P=D),{cx:N,cy:P,x0:-c,y0:-h,x1:N*(i/T-1),y1:P*(i/T-1)}}function sre(e){var t;if(ne(e)){var r=e.length;if(!r)return e;r===1?t=[e[0],e[0],0,0]:r===2?t=[e[0],e[0],e[1],e[1]]:r===3?t=e.concat(e[2]):t=e}else t=[e,e,e,e];return t}function lre(e,t){var r,n=Zv(t.r,0),i=Zv(t.r0||0,0),a=n>0,o=i>0;if(!(!a&&!o)){if(a||(n=i,i=0),i>n){var s=n;n=i,i=s}var l=t.startAngle,u=t.endAngle;if(!(isNaN(l)||isNaN(u))){var c=t.cx,h=t.cy,f=!!t.clockwise,d=RR(u-l),g=d>zS&&d%zS;if(g>ia&&(d=g),!(n>ia))e.moveTo(c,h);else if(d>zS-ia)e.moveTo(c+n*mh(l),h+n*lu(l)),e.arc(c,h,n,l,u,!f),i>ia&&(e.moveTo(c+i*mh(u),h+i*lu(u)),e.arc(c,h,i,u,l,f));else{var m=void 0,y=void 0,_=void 0,x=void 0,w=void 0,S=void 0,T=void 0,M=void 0,A=void 0,N=void 0,P=void 0,I=void 0,D=void 0,O=void 0,j=void 0,B=void 0,U=n*mh(l),H=n*lu(l),V=i*mh(u),z=i*lu(u),$=d>ia;if($){var W=t.cornerRadius;W&&(r=sre(W),m=r[0],y=r[1],_=r[2],x=r[3]);var Z=RR(n-i)/2;if(w=Da(Z,_),S=Da(Z,x),T=Da(Z,m),M=Da(Z,y),P=A=Zv(w,S),I=N=Zv(T,M),(A>ia||N>ia)&&(D=n*mh(u),O=n*lu(u),j=i*mh(l),B=i*lu(l),dia){var ve=Da(_,P),Ne=Da(x,P),xe=Ey(j,B,U,H,n,ve,f),Le=Ey(D,O,V,z,n,Ne,f);e.moveTo(c+xe.cx+xe.x0,h+xe.cy+xe.y0),P0&&e.arc(c+xe.cx,h+xe.cy,ve,hn(xe.y0,xe.x0),hn(xe.y1,xe.x1),!f),e.arc(c,h,n,hn(xe.cy+xe.y1,xe.cx+xe.x1),hn(Le.cy+Le.y1,Le.cx+Le.x1),!f),Ne>0&&e.arc(c+Le.cx,h+Le.cy,Ne,hn(Le.y1,Le.x1),hn(Le.y0,Le.x0),!f))}else e.moveTo(c+U,h+H),e.arc(c,h,n,l,u,!f);if(!(i>ia)||!$)e.lineTo(c+V,h+z);else if(I>ia){var ve=Da(m,I),Ne=Da(y,I),xe=Ey(V,z,D,O,i,-Ne,f),Le=Ey(U,H,j,B,i,-ve,f);e.lineTo(c+xe.cx+xe.x0,h+xe.cy+xe.y0),I0&&e.arc(c+xe.cx,h+xe.cy,Ne,hn(xe.y0,xe.x0),hn(xe.y1,xe.x1),!f),e.arc(c,h,i,hn(xe.cy+xe.y1,xe.cx+xe.x1),hn(Le.cy+Le.y1,Le.cx+Le.x1),f),ve>0&&e.arc(c+Le.cx,h+Le.cy,ve,hn(Le.y1,Le.x1),hn(Le.y0,Le.x0),!f))}else e.lineTo(c+V,h+z),e.arc(c,h,i,u,l,f)}e.closePath()}}}var ure=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0,this.cornerRadius=0}return e}(),on=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new ure},t.prototype.buildPath=function(r,n){lre(r,n)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(Qe);on.prototype.type="sector";var cre=function(){function e(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return e}(),dd=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new cre},t.prototype.buildPath=function(r,n){var i=n.cx,a=n.cy,o=Math.PI*2;r.moveTo(i+n.r,a),r.arc(i,a,n.r,0,o,!1),r.moveTo(i+n.r0,a),r.arc(i,a,n.r0,0,o,!0)},t}(Qe);dd.prototype.type="ring";function hre(e,t,r,n){var i=[],a=[],o=[],s=[],l,u,c,h;if(n){c=[1/0,1/0],h=[-1/0,-1/0];for(var f=0,d=e.length;f=2){if(n){var a=hre(i,n,r,t.smoothConstraint);e.moveTo(i[0][0],i[0][1]);for(var o=i.length,s=0;s<(r?o:o-1);s++){var l=a[s*2],u=a[s*2+1],c=i[(s+1)%o];e.bezierCurveTo(l[0],l[1],u[0],u[1],c[0],c[1])}}else{e.moveTo(i[0][0],i[0][1]);for(var s=1,h=i.length;scu[1]){if(a=!1,Vr.negativeSize||n)return a;var l=Ry(cu[0]-uu[1]),u=Ry(uu[0]-cu[1]);BS(l,u)>Oy.len()&&(l=u||!Vr.bidirectional)&&(Pe.scale(jy,s,-u*i),Vr.useDir&&Vr.calcDirMTV()))}}return a},e.prototype._getProjMinMaxOnAxis=function(t,r,n){for(var i=this._axes[t],a=this._origin,o=r[0].dot(i)+a[t],s=o,l=o,u=1;u0){var h=c.duration,f=c.delay,d=c.easing,g={duration:h,delay:f||0,easing:d,done:a,force:!!a||!!o,setToFinal:!u,scope:e,during:o};s?t.animateFrom(r,g):t.animateTo(r,g)}else t.stopAnimation(),!s&&t.attr(r),o&&o(1),a&&a()}function lt(e,t,r,n,i,a){jL("update",e,t,r,n,i,a)}function jt(e,t,r,n,i,a){jL("enter",e,t,r,n,i,a)}function gf(e){if(!e.__zr)return!0;for(var t=0;tXt(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"}function zR(e){return!e.isGroup}function Mre(e){return e.shape!=null}function im(e,t,r){if(!e||!t)return;function n(o){var s={};return o.traverse(function(l){zR(l)&&l.anid&&(s[l.anid]=l)}),s}function i(o){var s={x:o.x,y:o.y,rotation:o.rotation};return Mre(o)&&(s.shape=Se(o.shape)),s}var a=n(e);t.traverse(function(o){if(zR(o)&&o.anid){var s=a[o.anid];if(s){var l=i(o);o.attr(i(s)),lt(o,l,r,Re(o).dataIndex)}}})}function BL(e,t){return ae(e,function(r){var n=r[0];n=$e(n,t.x),n=bt(n,t.x+t.width);var i=r[1];return i=$e(i,t.y),i=bt(i,t.y+t.height),[n,i]})}function uH(e,t){var r=$e(e.x,t.x),n=bt(e.x+e.width,t.x+t.width),i=$e(e.y,t.y),a=bt(e.y+e.height,t.y+t.height);if(n>=r&&a>=i)return{x:r,y:i,width:n-r,height:a-i}}function md(e,t,r){var n=ee({rectHover:!0},t),i=n.style={strokeNoScale:!0};if(r=r||{x:-1,y:-1,width:2,height:2},e)return e.indexOf("image://")===0?(i.image=e.slice(8),ke(i,r),new zr(n)):zf(e.replace("path://",""),n,r,"center")}function $v(e,t,r,n,i){for(var a=0,o=i[i.length-1];a1)return!1;var y=FS(d,g,c,h)/f;return!(y<0||y>1)}function FS(e,t,r,n){return e*n-r*t}function Are(e){return e<=1e-6&&e>=-1e-6}function yc(e,t,r,n,i){return t==null||(at(t)?Ut[0]=Ut[1]=Ut[2]=Ut[3]=t:(Ut[0]=t[0],Ut[1]=t[1],Ut[2]=t[2],Ut[3]=t[3]),n&&(Ut[0]=$e(0,Ut[0]),Ut[1]=$e(0,Ut[1]),Ut[2]=$e(0,Ut[2]),Ut[3]=$e(0,Ut[3])),r&&(Ut[0]=-Ut[0],Ut[1]=-Ut[1],Ut[2]=-Ut[2],Ut[3]=-Ut[3]),BR(e,Ut,"x","width",3,1,i&&i[0]||0),BR(e,Ut,"y","height",0,2,i&&i[1]||0)),e}var Ut=[0,0,0,0];function BR(e,t,r,n,i,a,o){var s=t[a]+t[i],l=e[n];e[n]+=s,o=$e(0,bt(o,l)),e[n]=0?-t[i]:t[a]>=0?l+t[a]:Xt(s)>1e-8?(l-o)*t[i]/s:0):e[r]-=t[i]}function bs(e){var t=e.itemTooltipOption,r=e.componentModel,n=e.itemName,i=ue(t)?{formatter:t}:t,a=r.mainType,o=r.componentIndex,s={componentType:a,name:n,$vars:["name"]};s[a+"Index"]=o;var l=e.formatterParamsExtra;l&&E(tt(l),function(c){ge(s,c)||(s[c]=l[c],s.$vars.push(c))});var u=Re(e.el);u.componentMainType=a,u.componentIndex=o,u.tooltipConfig={name:n,option:ke({content:n,encodeHTMLContent:!0,formatterParams:s},i)}}function bM(e,t){var r;e.isGroup&&(r=t(e)),r||e.traverse(t)}function zl(e,t){if(e)if(ne(e))for(var r=0;rt&&(t=o),ot&&(r=t=0),{min:r,max:t}}function yb(e,t,r){fH(e,t,r,-1/0)}function fH(e,t,r,n){if(e.ignoreModelZ)return n;var i=e.getTextContent(),a=e.getTextGuideLine(),o=e.isGroup;if(o)for(var s=e.childrenRef(),l=0;l=0&&s.push(l)}),s}}function Bl(e,t){return He(He({},e,!0),t,!0)}const Bre={time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}},Fre={time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}};var yx="ZH",UL="EN",mf=UL,c_={},WL={},yH=rt.domSupported?function(){var e=(document.documentElement.lang||navigator.language||navigator.browserLanguage||mf).toUpperCase();return e.indexOf(yx)>-1?yx:mf}():mf;function ZL(e,t){e=e.toUpperCase(),WL[e]=new Je(t),c_[e]=t}function Vre(e){if(ue(e)){var t=c_[e.toUpperCase()]||{};return e===yx||e===UL?Se(t):He(Se(t),Se(c_[mf]),!1)}else return He(Se(e),Se(c_[mf]),!1)}function CM(e){return WL[e]}function Gre(){return WL[mf]}ZL(UL,Bre);ZL(yx,Fre);var TM=null;function Hre(e){TM||(TM=e)}function hr(){return TM}function _H(e,t){var r=hr(),n=t.breakOption,i=t.breakParsed;return!i&&r&&(i=r.parseAxisBreakOption(n,e)),i}function _x(e){var t=e.brk;return t?t.breaks:[]}function xx(e){var t=e.brk;return t?t.hasBreaks():!1}var $L=1e3,YL=$L*60,bp=YL*60,Di=bp*24,UR=Di*365,Ure={year:/({yyyy}|{yy})/,month:/({MMMM}|{MMM}|{MM}|{M})/,day:/({dd}|{d})/,hour:/({HH}|{H}|{hh}|{h})/,minute:/({mm}|{m})/,second:/({ss}|{s})/,millisecond:/({SSS}|{S})/},h_={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}"},Wre="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}",By="{yyyy}-{MM}-{dd}",WR={year:"{yyyy}",month:"{yyyy}-{MM}",day:By,hour:By+" "+h_.hour,minute:By+" "+h_.minute,second:By+" "+h_.second,millisecond:Wre},ri=["year","month","day","hour","minute","second","millisecond"],Zre=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function $re(e){return!ue(e)&&!Ce(e)?Yre(e):e}function Yre(e){e=e||{};var t={},r=!0;return E(ri,function(n){r&&(r=e[n]==null)}),E(ri,function(n,i){var a=e[n];t[n]={};for(var o=null,s=i;s>=0;s--){var l=ri[s],u=Ie(a)&&!ne(a)?a[l]:a,c=void 0;ne(u)?(c=u.slice(),o=c[0]||""):ue(u)?(o=u,c=[o]):(o==null?o=h_[n]:Ure[l].test(o)||(o=t[l][l][0]+" "+o),c=[o],r&&(c[1]="{primary|"+o+"}")),t[n][l]=c}}),t}function An(e,t){return e+="","0000".substr(0,t-e.length)+e}function wp(e){switch(e){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return e}}function Xre(e){return e===wp(e)}function qre(e){switch(e){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function am(e,t,r,n){var i=xo(e),a=i[xH(r)](),o=i[XL(r)]()+1,s=Math.floor((o-1)/3)+1,l=i[qL(r)](),u=i["get"+(r?"UTC":"")+"Day"](),c=i[KL(r)](),h=(c-1)%12+1,f=i[JL(r)](),d=i[QL(r)](),g=i[eI(r)](),m=c>=12?"pm":"am",y=m.toUpperCase(),_=n instanceof Je?n:CM(n||yH)||Gre(),x=_.getModel("time"),w=x.get("month"),S=x.get("monthAbbr"),T=x.get("dayOfWeek"),M=x.get("dayOfWeekAbbr");return(t||"").replace(/{a}/g,m+"").replace(/{A}/g,y+"").replace(/{yyyy}/g,a+"").replace(/{yy}/g,An(a%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,w[o-1]).replace(/{MMM}/g,S[o-1]).replace(/{MM}/g,An(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,An(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,T[u]).replace(/{ee}/g,M[u]).replace(/{e}/g,u+"").replace(/{HH}/g,An(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,An(h+"",2)).replace(/{h}/g,h+"").replace(/{mm}/g,An(f,2)).replace(/{m}/g,f+"").replace(/{ss}/g,An(d,2)).replace(/{s}/g,d+"").replace(/{SSS}/g,An(g,3)).replace(/{S}/g,g+"")}function Kre(e,t,r,n,i){var a=null;if(ue(r))a=r;else if(Ce(r)){var o={time:e.time,level:e.time?e.time.level:0},s=hr();s&&s.makeAxisLabelFormatterParamBreak(o,e.break),a=r(e.value,t,o)}else{var l=e.time;if(l){var u=r[l.lowerTimeUnit][l.upperTimeUnit];a=u[Math.min(l.level,u.length-1)]||""}else{var c=yf(e.value,i);a=r[c][c][0]}}return am(new Date(e.value),a,i,n)}function yf(e,t){var r=xo(e),n=r[XL(t)]()+1,i=r[qL(t)](),a=r[KL(t)](),o=r[JL(t)](),s=r[QL(t)](),l=r[eI(t)](),u=l===0,c=u&&s===0,h=c&&o===0,f=h&&a===0,d=f&&i===1,g=d&&n===1;return g?"year":d?"month":f?"day":h?"hour":c?"minute":u?"second":"millisecond"}function bx(e,t,r){switch(t){case"year":e[bH(r)](0);case"month":e[wH(r)](1);case"day":e[SH(r)](0);case"hour":e[CH(r)](0);case"minute":e[TH(r)](0);case"second":e[MH(r)](0)}return e}function xH(e){return e?"getUTCFullYear":"getFullYear"}function XL(e){return e?"getUTCMonth":"getMonth"}function qL(e){return e?"getUTCDate":"getDate"}function KL(e){return e?"getUTCHours":"getHours"}function JL(e){return e?"getUTCMinutes":"getMinutes"}function QL(e){return e?"getUTCSeconds":"getSeconds"}function eI(e){return e?"getUTCMilliseconds":"getMilliseconds"}function Jre(e){return e?"setUTCFullYear":"setFullYear"}function bH(e){return e?"setUTCMonth":"setMonth"}function wH(e){return e?"setUTCDate":"setDate"}function SH(e){return e?"setUTCHours":"setHours"}function CH(e){return e?"setUTCMinutes":"setMinutes"}function TH(e){return e?"setUTCSeconds":"setSeconds"}function MH(e){return e?"setUTCMilliseconds":"setMilliseconds"}function Qre(e,t,r,n,i,a,o,s){var l=new it({style:{text:e,font:t,align:r,verticalAlign:n,padding:i,rich:a,overflow:o?"truncate":null,lineHeight:s}});return l.getBoundingRect()}function tI(e){if(!xL(e))return ue(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function rI(e,t){return e=(e||"").toLowerCase().replace(/-(.)/g,function(r,n){return n.toUpperCase()}),t&&e&&(e=e.charAt(0).toUpperCase()+e.slice(1)),e}var _d=qg;function MM(e,t,r){var n="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function i(c){return c&&oi(c)?c:"-"}function a(c){return Wi(c)}var o=t==="time",s=e instanceof Date;if(o||s){var l=o?xo(e):e;if(isNaN(+l)){if(s)return"-"}else return am(l,n,r)}if(t==="ordinal")return J_(e)?i(e):at(e)&&a(e)?e+"":"-";var u=co(e);return a(u)?tI(u):J_(e)?i(e):typeof e=="boolean"?e+"":"-"}var ZR=["a","b","c","d","e","f","g"],HS=function(e,t){return"{"+e+(t??"")+"}"};function nI(e,t,r){ne(t)||(t=[t]);var n=t.length;if(!n)return"";for(var i=t[0].$vars||[],a=0;a':'';var o=r.markerId||"markerX";return{renderMode:a,content:"{"+o+"|} ",style:i==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:n}:{width:10,height:10,borderRadius:5,backgroundColor:n}}}function ene(e,t,r){(e==="week"||e==="month"||e==="quarter"||e==="half-year"||e==="year")&&(e=`MM-dd -yyyy`);var n=xo(t),i=r?"getUTC":"get",a=n[i+"FullYear"](),o=n[i+"Month"]()+1,s=n[i+"Date"](),l=n[i+"Hours"](),u=n[i+"Minutes"](),c=n[i+"Seconds"](),h=n[i+"Milliseconds"]();return e=e.replace("MM",An(o,2)).replace("M",o).replace("yyyy",a).replace("yy",An(a%100+"",2)).replace("dd",An(s,2)).replace("d",s).replace("hh",An(l,2)).replace("h",l).replace("mm",An(u,2)).replace("m",u).replace("ss",An(c,2)).replace("s",c).replace("SSS",An(h,3)),e}function tne(e){return e&&e.charAt(0).toUpperCase()+e.substr(1)}function xc(e,t){return t=t||"transparent",ue(e)?e:Ie(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}function Sx(e,t){if(t==="_blank"||t==="blank"){var r=window.open();r.opener=null,r.location.href=e}else window.open(e,t)}var f_={},US={},xd=function(){function e(){this._normalMasterList=[],this._nonSeriesBoxMasterList=[]}return e.prototype.create=function(t,r){this._nonSeriesBoxMasterList=n(f_),this._normalMasterList=n(US);function n(i,a){var o=[];return E(i,function(s,l){var u=s.create(t,r);o=o.concat(u||[])}),o}},e.prototype.update=function(t,r){E(this._normalMasterList,function(n){n.update&&n.update(t,r)})},e.prototype.getCoordinateSystems=function(){return this._normalMasterList.concat(this._nonSeriesBoxMasterList)},e.register=function(t,r){if(t==="matrix"||t==="calendar"){f_[t]=r;return}US[t]=r},e.get=function(t){return US[t]||f_[t]},e}();function rne(e){return!!f_[e]}var nne=1,LH=2;function ine(e){IH.set(e.fullType,{getCoord2:void 0}).getCoord2=e.getCoord2}var IH=pe();function NH(e){var t=e.getShallow("coord",!0),r=nne;if(t==null){var n=IH.get(e.type);n&&n.getCoord2&&(r=LH,t=n.getCoord2(e))}return{coord:t,from:r}}var _f=0,d_=1,PH=2;function DH(e,t){var r=e.getShallow("coordinateSystem"),n=e.getShallow("coordinateSystemUsage",!0),i=_f;if(r){var a=e.mainType==="series";n==null&&(n=a?"data":"box"),n==="data"?(i=d_,a||(i=_f)):n==="box"&&(i=PH,!a&&!rne(r)&&(i=_f))}return{coordSysType:r,kind:i}}function om(e){var t=e.targetModel,r=e.coordSysType,n=e.coordSysProvider,i=e.isDefaultDataCoordSys;e.allowNotFound;var a=DH(t),o=a.kind,s=a.coordSysType;if(i&&o!==d_&&(o=d_,s=r),o===_f||s!==r)return _f;var l=n(r,t);return l?(o===d_?t.coordinateSystem=l:t.boxCoordinateSystem=l,o):_f}var EH=function(e,t){var r=t.getReferringComponents(e,Qt).models[0];return r&&r.coordinateSystem},v_=E,RH=["left","right","top","bottom","width","height"],Gu=[["width","left","right"],["height","top","bottom"]];function iI(e,t,r,n,i){var a=0,o=0;n==null&&(n=1/0),i==null&&(i=1/0);var s=0;t.eachChild(function(l,u){var c=l.getBoundingRect(),h=t.childAt(u+1),f=h&&h.getBoundingRect(),d,g;if(e==="horizontal"){var m=c.width+(f?-f.x+c.x:0);d=a+m,d>n||l.newline?(a=0,d=m,o+=s+r,s=c.height):s=Math.max(s,c.height)}else{var y=c.height+(f?-f.y+c.y:0);g=o+y,g>i||l.newline?(a+=s+r,o=0,g=y,s=c.width):s=Math.max(s,c.width)}l.newline||(l.x=a,l.y=o,l.markRedraw(),e==="horizontal"?a=d+r:o=g+r)})}var Ju=iI;Ze(iI,"vertical");Ze(iI,"horizontal");function jH(e,t){return{left:e.getShallow("left",t),top:e.getShallow("top",t),right:e.getShallow("right",t),bottom:e.getShallow("bottom",t),width:e.getShallow("width",t),height:e.getShallow("height",t)}}function ane(e,t){var r=Lr(e,t,{enableLayoutOnlyByCenter:!0}),n=e.getBoxLayoutParams(),i,a;if(r.type===Xv.point)a=r.refPoint,i=Bt(n,{width:t.getWidth(),height:t.getHeight()});else{var o=e.get("center"),s=ne(o)?o:[o,o];i=Bt(n,r.refContainer),a=r.boxCoordFrom===LH?r.refPoint:[he(s[0],i.width)+i.x,he(s[1],i.height)+i.y]}return{viewRect:i,center:a}}function OH(e,t){var r=ane(e,t),n=r.viewRect,i=r.center,a=e.get("radius");ne(a)||(a=[0,a]);var o=he(n.width,t.getWidth()),s=he(n.height,t.getHeight()),l=Math.min(o,s),u=he(a[0],l/2),c=he(a[1],l/2);return{cx:i[0],cy:i[1],r0:u,r:c,viewRect:n}}function Bt(e,t,r){r=_d(r||0);var n=t.width,i=t.height,a=he(e.left,n),o=he(e.top,i),s=he(e.right,n),l=he(e.bottom,i),u=he(e.width,n),c=he(e.height,i),h=r[2]+r[0],f=r[1]+r[3],d=e.aspect;switch(isNaN(u)&&(u=n-s-f-a),isNaN(c)&&(c=i-l-h-o),d!=null&&(isNaN(u)&&isNaN(c)&&(d>n/i?u=n*.8:c=i*.8),isNaN(u)&&(u=d*c),isNaN(c)&&(c=u/d)),isNaN(a)&&(a=n-s-u-f),isNaN(o)&&(o=i-l-c-h),e.left||e.right){case"center":a=n/2-u/2-r[3];break;case"right":a=n-u-f;break}switch(e.top||e.bottom){case"middle":case"center":o=i/2-c/2-r[0];break;case"bottom":o=i-c-h;break}a=a||0,o=o||0,isNaN(u)&&(u=n-f-a-(s||0)),isNaN(c)&&(c=i-h-o-(l||0));var g=new Ae((t.x||0)+a+r[3],(t.y||0)+o+r[0],u,c);return g.margin=r,g}function zH(e,t,r){var n=e.getShallow("preserveAspect",!0);if(!n)return t;var i=t.width/t.height;if(Math.abs(Math.atan(r)-Math.atan(i))<1e-9)return t;var a=e.getShallow("preserveAspectAlign",!0),o=e.getShallow("preserveAspectVerticalAlign",!0),s={width:t.width,height:t.height},l=n==="cover";return i>r&&!l||i=m)return h;for(var y=0;y=0;l--)s=He(s,i[l],!0);n.defaultOption=s}return n.defaultOption},t.prototype.getReferringComponents=function(r,n){var i=r+"Index",a=r+"Id";return ud(this.ecModel,r,{index:this.get(i,!0),id:this.get(a,!0)},n)},t.prototype.getBoxLayoutParams=function(){return jH(this,!1)},t.prototype.getZLevelKey=function(){return""},t.prototype.setZLevel=function(r){this.option.zlevel=r},t.protoInitialize=function(){var r=t.prototype;r.type="component",r.id="",r.name="",r.mainType="",r.subType="",r.componentIndex=0}(),t}(Je);bG(qe,Je);ub(qe);Ore(qe);zre(qe,lne);function lne(e){var t=[];return E(qe.getClassesByMainType(e),function(r){t=t.concat(r.dependencies||r.prototype.dependencies||[])}),t=ae(t,function(r){return Ua(r).main}),e!=="dataset"&&Be(t,"dataset")<=0&&t.unshift("dataset"),t}var K={color:{},darkColor:{},size:{}},sr=K.color={theme:["#5070dd","#b6d634","#505372","#ff994d","#0ca8df","#ffd10a","#fb628b","#785db0","#3fbe95"],neutral00:"#fff",neutral05:"#f4f7fd",neutral10:"#e8ebf0",neutral15:"#dbdee4",neutral20:"#cfd2d7",neutral25:"#c3c5cb",neutral30:"#b7b9be",neutral35:"#aaacb2",neutral40:"#9ea0a5",neutral45:"#929399",neutral50:"#86878c",neutral55:"#797b7f",neutral60:"#6d6e73",neutral65:"#616266",neutral70:"#54555a",neutral75:"#48494d",neutral80:"#3c3c41",neutral85:"#303034",neutral90:"#232328",neutral95:"#17171b",neutral99:"#000",accent05:"#eff1f9",accent10:"#e0e4f2",accent15:"#d0d6ec",accent20:"#c0c9e6",accent25:"#b1bbdf",accent30:"#a1aed9",accent35:"#91a0d3",accent40:"#8292cc",accent45:"#7285c6",accent50:"#6578ba",accent55:"#5c6da9",accent60:"#536298",accent65:"#4a5787",accent70:"#404c76",accent75:"#374165",accent80:"#2e3654",accent85:"#252b43",accent90:"#1b2032",accent95:"#121521",transparent:"rgba(0,0,0,0)",highlight:"rgba(255,231,130,0.8)"};ee(sr,{primary:sr.neutral80,secondary:sr.neutral70,tertiary:sr.neutral60,quaternary:sr.neutral50,disabled:sr.neutral20,border:sr.neutral30,borderTint:sr.neutral20,borderShade:sr.neutral40,background:sr.neutral05,backgroundTint:"rgba(234,237,245,0.5)",backgroundTransparent:"rgba(255,255,255,0)",backgroundShade:sr.neutral10,shadow:"rgba(0,0,0,0.2)",shadowTint:"rgba(129,130,136,0.2)",axisLine:sr.neutral70,axisLineTint:sr.neutral40,axisTick:sr.neutral70,axisTickMinor:sr.neutral60,axisLabel:sr.neutral70,axisSplitLine:sr.neutral15,axisMinorSplitLine:sr.neutral05});for(var hu in sr)if(sr.hasOwnProperty(hu)){var $R=sr[hu];hu==="theme"?K.darkColor.theme=sr.theme.slice():hu==="highlight"?K.darkColor.highlight="rgba(255,231,130,0.4)":hu.indexOf("accent")===0?K.darkColor[hu]=qo($R,null,function(e){return e*.5},function(e){return Math.min(1,1.3-e)}):K.darkColor[hu]=qo($R,null,function(e){return e*.9},function(e){return 1-Math.pow(e,1.5)})}K.size={xxs:2,xs:5,s:10,m:15,l:20,xl:30,xxl:40,xxxl:50};var FH="";typeof navigator<"u"&&(FH=navigator.platform||"");var yh="rgba(0, 0, 0, 0.2)",VH=K.color.theme[0],une=qo(VH,null,null,.9);const GH={darkMode:"auto",colorBy:"series",color:K.color.theme,gradientColor:[une,VH],aria:{decal:{decals:[{color:yh,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:yh,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:yh,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:yh,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:yh,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:yh,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:FH.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1};var qr={Must:1,Might:2,Not:3},HH=Ue();function cne(e){HH(e).datasetMap=pe()}function UH(e,t,r){var n={},i=oI(t);if(!i||!e)return n;var a=[],o=[],s=t.ecModel,l=HH(s).datasetMap,u=i.uid+"_"+r.seriesLayoutBy,c,h;e=e.slice(),E(e,function(m,y){var _=Ie(m)?m:e[y]={name:m};_.type==="ordinal"&&c==null&&(c=y,h=g(_)),n[_.name]=[]});var f=l.get(u)||l.set(u,{categoryWayDim:h,valueWayDim:0});E(e,function(m,y){var _=m.name,x=g(m);if(c==null){var w=f.valueWayDim;d(n[_],w,x),d(o,w,x),f.valueWayDim+=x}else if(c===y)d(n[_],0,x),d(a,0,x);else{var w=f.categoryWayDim;d(n[_],w,x),d(o,w,x),f.categoryWayDim+=x}});function d(m,y,_){for(var x=0;x<_;x++)m.push(y+x)}function g(m){var y=m.dimsDef;return y?y.length:1}return a.length&&(n.itemName=a),o.length&&(n.seriesName=o),n}function aI(e,t,r){var n={},i=oI(e);if(!i)return n;var a=t.sourceFormat,o=t.dimensionsDefine,s;(a===gi||a===ba)&&E(o,function(c,h){(Ie(c)?c.name:c)==="name"&&(s=h)});var l=function(){for(var c={},h={},f=[],d=0,g=Math.min(5,r);dt)return e[n];return e[r-1]}function $H(e,t,r,n,i,a,o){a=a||e;var s=t(a),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(i))return u[i];var c=o==null||!n?r:pne(n,o);if(c=c||r,!(!c||!c.length)){var h=c[l];return i&&(u[i]=h),s.paletteIdx=(l+1)%c.length,h}}function gne(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}var Fy,hv,XR,qR="\0_ec_inner",mne=1,lI=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.init=function(r,n,i,a,o,s){a=a||{},this.option=null,this._theme=new Je(a),this._locale=new Je(o),this._optionManager=s},t.prototype.setOption=function(r,n,i){var a=QR(n);this._optionManager.setOption(r,i,a),this._resetOption(null,a)},t.prototype.resetOption=function(r,n){return this._resetOption(r,QR(n))},t.prototype._resetOption=function(r,n){var i=!1,a=this._optionManager;if(!r||r==="recreate"){var o=a.mountOption(r==="recreate");!this.option||r==="recreate"?XR(this,o):(this.restoreData(),this._mergeOption(o,n)),i=!0}if((r==="timeline"||r==="media")&&this.restoreData(),!r||r==="recreate"||r==="timeline"){var s=a.getTimelineOption(this);s&&(i=!0,this._mergeOption(s,n))}if(!r||r==="recreate"||r==="media"){var l=a.getMediaOption(this);l.length&&E(l,function(u){i=!0,this._mergeOption(u,n)},this)}return i},t.prototype.mergeOption=function(r){this._mergeOption(r,null)},t.prototype._mergeOption=function(r,n){var i=this.option,a=this._componentsMap,o=this._componentsCount,s=[],l=pe(),u=n&&n.replaceMergeMainTypeMap;cne(this),E(r,function(h,f){h!=null&&(qe.hasClass(f)?f&&(s.push(f),l.set(f,!0)):i[f]=i[f]==null?Se(h):He(i[f],h,!0))}),u&&u.each(function(h,f){qe.hasClass(f)&&!l.get(f)&&(s.push(f),l.set(f,!0))}),qe.topologicalTravel(s,qe.getAllClassMainTypes(),c,this);function c(h){var f=dne(this,h,It(r[h])),d=a.get(h),g=d?u&&u.get(h)?"replaceMerge":"normalMerge":"replaceAll",m=dG(d,f,g);Tee(m,h,qe),i[h]=null,a.set(h,null),o.set(h,0);var y=[],_=[],x=0,w;E(m,function(S,T){var M=S.existing,A=S.newOption;if(!A)M&&(M.mergeOption({},this),M.optionUpdated({},!1));else{var N=h==="series",P=qe.getClass(h,S.keyInfo.subType,!N);if(!P)return;if(h==="tooltip"){if(w)return;w=!0}if(M&&M.constructor===P)M.name=S.keyInfo.name,M.mergeOption(A,this),M.optionUpdated(A,!1);else{var I=ee({componentIndex:T},S.keyInfo);M=new P(A,this,this,I),ee(M,I),S.brandNew&&(M.__requireNewView=!0),M.init(A,this,this),M.optionUpdated(null,!0)}}M?(y.push(M.option),_.push(M),x++):(y.push(void 0),_.push(void 0))},this),i[h]=y,a.set(h,_),o.set(h,x),h==="series"&&Fy(this)}this._seriesIndices||Fy(this)},t.prototype.getOption=function(){var r=Se(this.option);return E(r,function(n,i){if(qe.hasClass(i)){for(var a=It(n),o=a.length,s=!1,l=o-1;l>=0;l--)a[l]&&!og(a[l])?s=!0:(a[l]=null,!s&&o--);a.length=o,r[i]=a}}),delete r[qR],r},t.prototype.setTheme=function(r){this._theme=new Je(r),this._resetOption("recreate",null)},t.prototype.getTheme=function(){return this._theme},t.prototype.getLocaleModel=function(){return this._locale},t.prototype.setUpdatePayload=function(r){this._payload=r},t.prototype.getUpdatePayload=function(){return this._payload},t.prototype.getComponent=function(r,n){var i=this._componentsMap.get(r);if(i){var a=i[n||0];if(a)return a;if(n==null){for(var o=0;o=t:r==="max"?e<=t:e===t}function Tne(e,t){return e.join(",")===t.join(",")}var ra=E,fg=Ie,ej=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function WS(e){var t=e&&e.itemStyle;if(t)for(var r=0,n=ej.length;r0?r[o-1].seriesModel:null)}),Rne(r)}})}function Rne(e){E(e,function(t,r){var n=[],i=[NaN,NaN],a=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,l=t.seriesModel.get("stackStrategy")||"samesign";o.modify(a,function(u,c,h){var f=o.get(t.stackedDimension,h);if(isNaN(f))return i;var d,g;s?g=o.getRawIndex(h):d=o.get(t.stackedByDimension,h);for(var m=NaN,y=r-1;y>=0;y--){var _=e[y];if(s||(g=_.data.rawIndexOf(_.stackedByDimension,d)),g>=0){var x=_.data.getByRawIndex(_.stackResultDimension,g);if(l==="all"||l==="positive"&&x>0||l==="negative"&&x<0||l==="samesign"&&f>=0&&x>0||l==="samesign"&&f<=0&&x<0){f=Tu(f,x),m=x;break}}}return n[0]=f,n[1]=m,n})})}var wb=function(){function e(t){this.data=t.data||(t.sourceFormat===ba?{}:[]),this.sourceFormat=t.sourceFormat||DG,this.seriesLayoutBy=t.seriesLayoutBy||va,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var r=this.dimensionsDefine=t.dimensionsDefine;if(r)for(var n=0;nm&&(m=w)}d[0]=g,d[1]=m}},i=function(){return this._data?this._data.length/this._dimSize:0};sj=(t={},t[Zr+"_"+va]={pure:!0,appendData:a},t[Zr+"_"+Hc]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},t[gi]={pure:!0,appendData:a},t[ba]={pure:!0,appendData:function(o){var s=this._data;E(o,function(l,u){for(var c=s[u]||(s[u]=[]),h=0;h<(l||[]).length;h++)c.push(l[h])})}},t[pi]={appendData:a},t[vl]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},t);function a(o){for(var s=0;s=0&&(m=o.interpolatedValue[y])}return m!=null?m+"":""})}},e.prototype.getRawValue=function(t,r){return Ff(this.getData(r),t)},e.prototype.formatTooltip=function(t,r,n){},e}();function hj(e){var t,r;return Ie(e)?e.type&&(r=e):t=e,{text:t,frag:r}}function Sp(e){return new Hne(e)}var Hne=function(){function e(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return e.prototype.perform=function(t){var r=this._upstream,n=t&&t.skip;if(this._dirty&&r){var i=this.context;i.data=i.outputData=r.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var a;this._plan&&!n&&(a=this._plan(this.context));var o=c(this._modBy),s=this._modDataCount||0,l=c(t&&t.modBy),u=t&&t.modDataCount||0;(o!==l||s!==u)&&(a="reset");function c(x){return!(x>=1)&&(x=1),x}var h;(this._dirty||a==="reset")&&(this._dirty=!1,h=this._doReset(n)),this._modBy=l,this._modDataCount=u;var f=t&&t.step;if(r?this._dueEnd=r._outputDueEnd:this._dueEnd=this._count?this._count(this.context):1/0,this._progress){var d=this._dueIndex,g=Math.min(f!=null?this._dueIndex+f:1/0,this._dueEnd);if(!n&&(h||d1&&n>0?s:o}};return a;function o(){return t=e?null:lt},gte:function(e,t){return e>=t}},Wne=function(){function e(t,r){if(!at(r)){var n="";gt(n)}this._opFn=nU[t],this._rvalFloat=co(r)}return e.prototype.evaluate=function(t){return at(t)?this._opFn(t,this._rvalFloat):this._opFn(co(t),this._rvalFloat)},e}(),iU=function(){function e(t,r){var n=t==="desc";this._resultLT=n?1:-1,r==null&&(r=n?"min":"max"),this._incomparable=r==="min"?-1/0:1/0}return e.prototype.evaluate=function(t,r){var n=at(t)?t:co(t),i=at(r)?r:co(r),a=isNaN(n),o=isNaN(i);if(a&&(n=this._incomparable),o&&(i=this._incomparable),a&&o){var s=ue(t),l=ue(r);s&&(n=l?t:0),l&&(i=s?r:0)}return ni?-this._resultLT:0},e}(),Zne=function(){function e(t,r){this._rval=r,this._isEQ=t,this._rvalTypeof=typeof r,this._rvalFloat=co(r)}return e.prototype.evaluate=function(t){var r=t===this._rval;if(!r){var n=typeof t;n!==this._rvalTypeof&&(n==="number"||this._rvalTypeof==="number")&&(r=co(t)===this._rvalFloat)}return this._isEQ?r:!r},e}();function $ne(e,t){return e==="eq"||e==="ne"?new Zne(e==="eq",t):ge(nU,e)?new Wne(e,t):null}function aU(e){var t="",r=-1/0,n=-1/0,i=1/0,a=1/0;return e&&(e.g!=null&&(t+="G"+e.g,r=e.g),e.ge!=null&&(t+="GE"+e.ge,n=e.ge),e.l!=null&&(t+="L"+e.l,i=e.l),e.le!=null&&(t+="LE"+e.le,a=e.le)),{key:t,g:r,ge:n,l:i,le:a}}function oU(e,t){return t>e.g&&t>=e.ge&&t65535?nie:iie}function aie(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function vj(e,t,r,n,i){var a=uU[r||"float"];if(i){var o=e[t],s=o&&o.length;if(s!==n){for(var l=new a(n),u=0;uy[1]&&(y[1]=m)}return this._rawCount=this._count=l,{start:s,end:l}},e.prototype._initDataFromProvider=function(t,r,n){for(var i=this._provider,a=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,u=ae(o,function(x){return x.property}),c=0;c_[1]&&(_[1]=y)}}!i.persistent&&i.clean&&i.clean(),this._rawCount=this._count=r,this._extent=[]},e.prototype.count=function(){return this._count},e.prototype.get=function(t,r){if(!(r>=0&&r=0&&r=this._rawCount||t<0)return-1;if(!this._indices)return t;var r=this._indices,n=r[t];if(n!=null&&nt)a=o-1;else return o}return-1},e.prototype.getIndices=function(){var t,r=this._indices;if(r){var n=r.constructor,i=this._count;if(n===Array){t=new n(i);for(var a=0;a=h&&x<=f||isNaN(x))&&(l[u++]=m),m++}g=!0}else if(a===2){for(var y=d[i[0]],w=d[i[1]],S=t[i[1]][0],T=t[i[1]][1],_=0;_=h&&x<=f||isNaN(x))&&(M>=S&&M<=T||isNaN(M))&&(l[u++]=m),m++}g=!0}}if(!g)if(a===1)for(var _=0;_=h&&x<=f||isNaN(x))&&(l[u++]=A)}else for(var _=0;_t[I][1])&&(N=!1)}N&&(l[u++]=r.getRawIndex(_))}return u_[1]&&(_[1]=y)}}}},e.prototype.lttbDownSample=function(t,r){var n=this.clone([t],!0),i=n._chunks,a=i[t],o=this.count(),s=0,l=Math.floor(1/r),u=this.getRawIndex(0),c,h,f,d=new(_h(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));d[s++]=u;for(var g=1;gc&&(c=h,f=S)}D>0&&Ds&&(m=s-c);for(var y=0;yg&&(g=x,d=c+y)}var w=this.getRawIndex(h),S=this.getRawIndex(d);hc-g&&(l=c-g,s.length=l);for(var m=0;mh[1]&&(h[1]=_),f[d++]=x}return a._count=d,a._indices=f,a._updateGetRawIdx(),a},e.prototype.each=function(t,r){if(this._count)for(var n=t.length,i=this._chunks,a=0,o=this.count();ad&&(d=y))}return l[c]=[f,d]},e.prototype.getRawDataItem=function(t){var r=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(r);for(var n=[],i=this._chunks,a=0;a=0?this._indices[t]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function t(r,n,i,a){return gl(r[a],this._dimensions[a])}YS={arrayRows:t,objectRows:function(r,n,i,a){return gl(r[n],this._dimensions[a])},keyedColumns:t,original:function(r,n,i,a){var o=r&&(r.value==null?r:r.value);return gl(o instanceof Array?o[a]:o,this._dimensions[a])},typedArray:function(r,n,i,a){return r[a]}}}(),e}(),cU=function(){function e(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return e.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},e.prototype._setLocalSource=function(t,r){this._sourceList=t,this._upstreamSignList=r,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},e.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},e.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},e.prototype._createSource=function(){this._setLocalSource([],[]);var t=this._sourceHost,r=this._getUpstreamSourceManagers(),n=!!r.length,i,a;if(Gy(t)){var o=t,s=void 0,l=void 0,u=void 0;if(n){var c=r[0];c.prepareSource(),u=c.getSource(),s=u.data,l=u.sourceFormat,a=[c._getVersionSign()]}else s=o.get("data",!0),l=Pn(s)?vl:pi,a=[];var h=this._getSourceMetaRawOption()||{},f=u&&u.metaRawOption||{},d=_e(h.seriesLayoutBy,f.seriesLayoutBy)||null,g=_e(h.sourceHeader,f.sourceHeader),m=_e(h.dimensions,f.dimensions),y=d!==f.seriesLayoutBy||!!g!=!!f.sourceHeader||m;i=y?[LM(s,{seriesLayoutBy:d,sourceHeader:g,dimensions:m},l)]:[]}else{var _=t;if(n){var x=this._applyTransform(r);i=x.sourceList,a=x.upstreamSignList}else{var w=_.get("source",!0);i=[LM(w,this._getSourceMetaRawOption(),null)],a=[]}}this._setLocalSource(i,a)},e.prototype._applyTransform=function(t){var r=this._sourceHost,n=r.get("transform",!0),i=r.get("fromTransformResult",!0);if(i!=null){var a="";t.length!==1&&gj(a)}var o,s=[],l=[];return E(t,function(u){u.prepareSource();var c=u.getSource(i||0),h="";i!=null&&!c&&gj(h),s.push(c),l.push(u._getVersionSign())}),n?o=tie(n,s,{datasetIndex:r.componentIndex}):i!=null&&(o=[jne(s[0])]),{sourceList:o,upstreamSignList:l}},e.prototype._isDirty=function(){if(this._dirty)return!0;for(var t=this._getUpstreamSourceManagers(),r=0;r1||r>0&&!e.noHeader;return E(e.blocks,function(i){var a=vU(i);a>=t&&(t=a+ +(n&&(!a||NM(i)&&!i.noHeader)))}),t}return 0}function uie(e,t,r,n){var i=t.noHeader,a=hie(vU(t)),o=[],s=t.blocks||[];an(!s||ne(s)),s=s||[];var l=e.orderMode;if(t.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(ge(u,l)){var c=new iU(u[l],null);s.sort(function(m,y){return c.evaluate(m.sortParam,y.sortParam)})}else l==="seriesDesc"&&s.reverse()}E(s,function(m,y){var _=t.valueFormatter,x=dU(m)(_?ee(ee({},e),{valueFormatter:_}):e,m,y>0?a.html:0,n);x!=null&&o.push(x)});var h=e.renderMode==="richText"?o.join(a.richText):PM(n,o.join(""),i?r:a.html);if(i)return h;var f=MM(t.header,"ordinal",e.useUTC),d=fU(n,e.renderMode).nameStyle,g=hU(n);return e.renderMode==="richText"?pU(e,f,d)+a.richText+h:PM(n,'
'+gn(f)+"
"+h,r)}function cie(e,t,r,n){var i=e.renderMode,a=t.noName,o=t.noValue,s=!t.markerType,l=t.name,u=e.useUTC,c=t.valueFormatter||e.valueFormatter||function(S){return S=ne(S)?S:[S],ae(S,function(T,M){return MM(T,ne(d)?d[M]:d,u)})};if(!(a&&o)){var h=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||K.color.secondary,i),f=a?"":MM(l,"ordinal",u),d=t.valueType,g=o?[]:c(t.value,t.rawDataIndex),m=!s||!a,y=!s&&a,_=fU(n,i),x=_.nameStyle,w=_.valueStyle;return i==="richText"?(s?"":h)+(a?"":pU(e,f,x))+(o?"":vie(e,g,m,y,w)):PM(n,(s?"":h)+(a?"":fie(f,!s,x))+(o?"":die(g,m,y,w)),r)}}function mj(e,t,r,n,i,a){if(e){var o=dU(e),s={useUTC:i,renderMode:r,orderMode:n,markupStyleCreator:t,valueFormatter:e.valueFormatter};return o(s,e,0,a)}}function hie(e){return{html:sie[e],richText:lie[e]}}function PM(e,t,r){var n='
',i="margin: "+r+"px 0 0",a=hU(e);return'
'+t+n+"
"}function fie(e,t,r){var n=t?"margin-left:2px":"";return''+gn(e)+""}function die(e,t,r,n){var i=r?"10px":"20px",a=t?"float:right;margin-left:"+i:"";return e=ne(e)?e:[e],''+ae(e,function(o){return gn(o)}).join("  ")+""}function pU(e,t,r){return e.markupStyleCreator.wrapRichTextStyle(t,r)}function vie(e,t,r,n,i){var a=[i],o=n?10:20;return r&&a.push({padding:[0,0,0,o],align:"right"}),e.markupStyleCreator.wrapRichTextStyle(ne(t)?t.join(" "):t,a)}function gU(e,t){var r=e.getData().getItemVisual(t,"style"),n=r[e.visualDrawType];return xc(n)}function mU(e,t){var r=e.get("padding");return r??(t==="richText"?[8,10]:10)}var XS=function(){function e(){this.richTextStyles={},this._nextStyleNameId=bL()}return e.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(t,r,n){var i=n==="richText"?this._generateStyleName():null,a=kH({color:r,type:t,renderMode:n,markerId:i});return ue(a)?a:(this.richTextStyles[i]=a.style,a.content)},e.prototype.wrapRichTextStyle=function(t,r){var n={};ne(r)?E(r,function(a){return ee(n,a)}):ee(n,r);var i=this._generateStyleName();return this.richTextStyles[i]=n,"{"+i+"|"+t+"}"},e}();function yU(e){var t=e.series,r=e.dataIndex,n=e.multipleSeries,i=t.getData(),a=i.mapDimensionsAll("defaultedTooltip"),o=a.length,s=t.getRawValue(r),l=ne(s),u=gU(t,r),c,h,f,d;if(o>1||l&&!o){var g=pie(s,t,r,a,u);c=g.inlineValues,h=g.inlineValueTypes,f=g.blocks,d=g.inlineValues[0]}else if(o){var m=i.getDimensionInfo(a[0]);d=c=Ff(i,r,a[0]),h=m.type}else d=c=l?s[0]:s;var y=wL(t),_=y&&t.name||"",x=i.getName(r),w=n?_:x;return _r("section",{header:_,noHeader:n||!y,sortParam:d,blocks:[_r("nameValue",{markerType:"item",markerColor:u,name:w,noName:!oi(w),value:c,valueType:h,rawDataIndex:i.getRawIndex(r)})].concat(f||[])})}function pie(e,t,r,n,i){var a=t.getData(),o=Hi(e,function(h,f,d){var g=a.getDimensionInfo(d);return h=h||g&&g.tooltip!==!1&&g.displayName!=null},!1),s=[],l=[],u=[];n.length?E(n,function(h){c(Ff(a,r,h),h)}):E(e,c);function c(h,f){var d=a.getDimensionInfo(f);!d||d.otherDims.tooltip===!1||(o?u.push(_r("nameValue",{markerType:"subItem",markerColor:i,name:d.displayName,value:h,valueType:d.type})):(s.push(h),l.push(d.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var Ls=Ue();function Hy(e,t){return e.getName(t)||e.getId(t)}var p_="__universalTransitionEnabled",At=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r._selectedDataIndicesMap={},r}return t.prototype.init=function(r,n,i){this.seriesIndex=this.componentIndex,this.dataTask=Sp({count:mie,reset:yie}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(r,i);var a=Ls(this).sourceManager=new cU(this);a.prepareSource();var o=this.getInitialData(r,i);_j(o,this),this.dataTask.context.data=o,Ls(this).dataBeforeProcessed=o,yj(this),this._initSelectedMapFromData(o)},t.prototype.mergeDefaultAndTheme=function(r,n){var i=hg(this),a=i?$c(r):{},o=this.subType;qe.hasClass(o)&&(o+="Series"),He(r,n.getTheme().get(this.subType)),He(r,this.getDefaultOption()),dc(r,"label",["show"]),this.fillDataTextStyle(r.data),i&&vo(r,a,i)},t.prototype.mergeOption=function(r,n){r=He(this.option,r,!0),this.fillDataTextStyle(r.data);var i=hg(this);i&&vo(this.option,r,i);var a=Ls(this).sourceManager;a.dirty(),a.prepareSource();var o=this.getInitialData(r,n);_j(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,Ls(this).dataBeforeProcessed=o,yj(this),this._initSelectedMapFromData(o)},t.prototype.fillDataTextStyle=function(r){if(r&&!Pn(r))for(var n=["show"],i=0;i=0&&f<0)&&(h=T,f=S,d=0),S===f&&(c[d++]=y))}return c.length=d,c},t.prototype.formatTooltip=function(r,n,i){return yU({series:this,dataIndex:r,multipleSeries:n})},t.prototype.isAnimationEnabled=function(){var r=this.ecModel;if(rt.node&&!(r&&r.ssr))return!1;var n=this.getShallow("animation");return n&&this.getData().count()>this.getShallow("animationThreshold")&&(n=!1),!!n},t.prototype.restoreData=function(){this.dataTask.dirty()},t.prototype.getColorFromPalette=function(r,n,i){var a=this.ecModel,o=sI.prototype.getColorFromPalette.call(this,r,n,i);return o||(o=a.getColorFromPalette(r,n,i)),o},t.prototype.coordDimToDataDim=function(r){return this.getRawData().mapDimensionsAll(r)},t.prototype.getProgressive=function(){return this.get("progressive")},t.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},t.prototype.select=function(r,n){this._innerSelect(this.getData(n),r)},t.prototype.unselect=function(r,n){var i=this.option.selectedMap;if(i){var a=this.option.selectedMode,o=this.getData(n);if(a==="series"||i==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s=0&&i.push(o)}return i},t.prototype.isSelected=function(r,n){var i=this.option.selectedMap;if(!i)return!1;var a=this.getData(n);return(i==="all"||i[Hy(a,r)])&&!a.getItemModel(r).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[p_])return!0;var r=this.option.universalTransition;return r?r===!0?!0:r&&r.enabled:!1},t.prototype._innerSelect=function(r,n){var i,a,o=this.option,s=o.selectedMode,l=n.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){Ie(o.selectedMap)||(o.selectedMap={});for(var u=o.selectedMap,c=0;c0&&this._innerSelect(r,n)}},t.registerClass=function(r){return qe.registerClass(r)},t.protoInitialize=function(){var r=t.prototype;r.type="series.__base__",r.seriesIndex=0,r.ignoreStyleOnData=!1,r.hasSymbolVisual=!1,r.defaultSymbol="circle",r.visualStyleAccessPath="itemStyle",r.visualDrawType="fill"}(),t}(qe);vr(At,Sb);vr(At,sI);bG(At,qe);function yj(e){var t=e.name;wL(e)||(e.name=gie(e)||t)}function gie(e){var t=e.getRawData(),r=t.mapDimensionsAll("seriesName"),n=[];return E(r,function(i){var a=t.getDimensionInfo(i);a.displayName&&n.push(a.displayName)}),n.join(" ")}function mie(e){return e.model.getRawData().count()}function yie(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),_ie}function _ie(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function _j(e,t){E(Df(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(r){e.wrapMethod(r,Ze(xie,t))})}function xie(e,t){var r=DM(e);return r&&r.setOutputEnd((t||this).count()),t}function DM(e){var t=(e.ecModel||{}).scheduler,r=t&&t.getPipeline(e.uid);if(r){var n=r.currentTask;if(n){var i=n.agentStubMap;i&&(n=i.get(e.uid))}return n}}var Nt=function(){function e(){this.group=new Me,this.uid=Zc("viewComponent")}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,i){},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,i){},e.prototype.updateLayout=function(t,r,n,i){},e.prototype.updateVisual=function(t,r,n,i){},e.prototype.toggleBlurSeries=function(t,r,n){},e.prototype.eachRendered=function(t){var r=this.group;r&&r.traverse(t)},e}();TL(Nt);ub(Nt);function Yc(){var e=Ue();return function(t){var r=e(t),n=t.pipelineContext,i=!!r.large,a=!!r.progressiveRender,o=r.large=!!(n&&n.large),s=r.progressiveRender=!!(n&&n.progressiveRender);return(i!==o||a!==s)&&"reset"}}var _U=Ue(),bie=Yc(),wt=function(){function e(){this.group=new Me,this.uid=Zc("viewChart"),this.renderTask=Sp({plan:wie,reset:Sie}),this.renderTask.context={view:this}}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,i){},e.prototype.highlight=function(t,r,n,i){var a=t.getData(i&&i.dataType);a&&bj(a,i,"emphasis")},e.prototype.downplay=function(t,r,n,i){var a=t.getData(i&&i.dataType);a&&bj(a,i,"normal")},e.prototype.remove=function(t,r){this.group.removeAll()},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,i){this.render(t,r,n,i)},e.prototype.updateVisual=function(t,r,n,i){this.render(t,r,n,i)},e.prototype.eachRendered=function(t){zl(this.group,t)},e.markUpdateMethod=function(t,r){_U(t).updateMethod=r},e.protoInitialize=function(){var t=e.prototype;t.type="chart"}(),e}();function xj(e,t,r){e&&lg(e)&&(t==="emphasis"?hs:fs)(e,r)}function bj(e,t,r){var n=vc(e,t),i=t&&t.highlightKey!=null?Yte(t.highlightKey):null;n!=null?E(It(n),function(a){xj(e.getItemGraphicEl(a),r,i)}):e.eachItemGraphicEl(function(a){xj(a,r,i)})}TL(wt);ub(wt);function wie(e){return bie(e.model)}function Sie(e){var t=e.model,r=e.ecModel,n=e.api,i=e.payload,a=t.pipelineContext.progressiveRender,o=e.view,s=i&&_U(i).updateMethod,l=a?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](t,r,n,i),Cie[l]}var Cie={incrementalPrepareRender:{progress:function(e,t){t.view.incrementalRender(e,t.model,t.ecModel,t.api,t.payload)}},render:{forceFirstProgress:!0,progress:function(e,t){t.view.render(t.model,t.ecModel,t.api,t.payload)}}},Cx="\0__throttleOriginMethod",wj="\0__throttleRate",Sj="\0__throttleType";function Cb(e,t,r){var n,i=0,a=0,o=null,s,l,u,c;t=t||0;function h(){a=new Date().getTime(),o=null,e.apply(l,u||[])}var f=function(){for(var d=[],g=0;g=0?h():o=setTimeout(h,-s),i=n};return f.clear=function(){o&&(clearTimeout(o),o=null)},f.debounceNextCall=function(d){c=d},f}function bd(e,t,r,n){var i=e[t];if(i){var a=i[Cx]||i,o=i[Sj],s=i[wj];if(s!==r||o!==n){if(r==null||!n)return e[t]=a;i=e[t]=Cb(a,r,n==="debounce"),i[Cx]=a,i[Sj]=n,i[wj]=r}return i}}function dg(e,t){var r=e[t];r&&r[Cx]&&(r.clear&&r.clear(),e[t]=r[Cx])}var Cj=Ue(),Tj={itemStyle:gc(mH,!0),lineStyle:gc(gH,!0)},Tie={lineStyle:"stroke",itemStyle:"fill"};function xU(e,t){var r=e.visualStyleMapper||Tj[t];return r||(console.warn("Unknown style type '"+t+"'."),Tj.itemStyle)}function bU(e,t){var r=e.visualDrawType||Tie[t];return r||(console.warn("Unknown style type '"+t+"'."),"fill")}var Mie={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",i=e.getModel(n),a=xU(e,n),o=a(i),s=i.getShallow("decal");s&&(r.setVisual("decal",s),s.dirty=!0);var l=bU(e,n),u=o[l],c=Ce(u)?u:null,h=o.fill==="auto"||o.stroke==="auto";if(!o[l]||c||h){var f=e.getColorFromPalette(e.name,null,t.getSeriesCount());o[l]||(o[l]=f,r.setVisual("colorFromPalette",!0)),o.fill=o.fill==="auto"||Ce(o.fill)?f:o.fill,o.stroke=o.stroke==="auto"||Ce(o.stroke)?f:o.stroke}if(r.setVisual("style",o),r.setVisual("drawType",l),!t.isSeriesFiltered(e)&&c)return r.setVisual("colorFromPalette",!1),{dataEach:function(d,g){var m=e.getDataParams(g),y=ee({},o);y[l]=c(m),d.setItemVisual(g,"style",y)}}}},dv=new Je,Aie={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",i=xU(e,n),a=r.getVisual("drawType");return{dataEach:r.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[n]){dv.option=l[n];var u=i(dv),c=o.ensureUniqueItemVisual(s,"style");ee(c,u),dv.option.decal&&(o.setItemVisual(s,"decal",dv.option.decal),dv.option.decal.dirty=!0),a in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},kie={performRawSeries:!0,overallReset:function(e){var t=pe();e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.type+"-"+r.getColorBy();Cj(r).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.getRawData(),i={},a=r.getData(),o=Cj(r).scope,s=r.visualStyleAccessPath||"itemStyle",l=bU(r,s);a.each(function(u){var c=a.getRawIndex(u);i[c]=u}),n.each(function(u){var c=i[u],h=a.getItemVisual(c,"colorFromPalette");if(h){var f=a.ensureUniqueItemVisual(c,"style"),d=n.getName(u)||u+"",g=n.count();f[l]=r.getColorFromPalette(d,o,g)}})}})}},Uy=Math.PI;function Lie(e,t){t=t||{},ke(t,{text:"loading",textColor:K.color.primary,fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255,255,255,0.8)",showSpinner:!0,color:K.color.theme[0],spinnerRadius:10,lineWidth:5,zlevel:0});var r=new Me,n=new Ye({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});r.add(n);var i=new it({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),a=new Ye({style:{fill:"none"},textContent:i,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});r.add(a);var o;return t.showSpinner&&(o=new rm({shape:{startAngle:-Uy/2,endAngle:-Uy/2+.1,r:t.spinnerRadius},style:{stroke:t.color,lineCap:"round",lineWidth:t.lineWidth},zlevel:t.zlevel,z:10001}),o.animateShape(!0).when(1e3,{endAngle:Uy*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:Uy*3/2}).delay(300).start("circularInOut"),r.add(o)),r.resize=function(){var s=i.getBoundingRect().width,l=t.showSpinner?t.spinnerRadius:0,u=(e.getWidth()-l*2-(t.showSpinner&&s?10:0)-s)/2-(t.showSpinner&&s?0:5+s/2)+(t.showSpinner?0:s/2)+(s?0:l),c=e.getHeight()/2;t.showSpinner&&o.setShape({cx:u,cy:c}),a.setShape({x:u-l,y:c-l,width:l*2,height:l*2}),n.setShape({x:0,y:0,width:e.getWidth(),height:e.getHeight()})},r.resize(),r}var wU=function(){function e(t,r,n,i){this._stageTaskMap=pe(),this.ecInstance=t,this.api=r,n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return e.prototype.restoreData=function(t,r){t.restoreData(r),this._stageTaskMap.each(function(n){var i=n.overallTask;i&&i.dirty()})},e.prototype.getPerformArgs=function(t,r){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),i=n.context,a=!r&&n.progressiveEnabled&&(!i||i.progressiveRender)&&t.__idxInPipeline>n.blockIndex,o=a?n.step:null,s=i&&i.modDataCount,l=s!=null?Math.ceil(s/o):null;return{step:o,modBy:l,modDataCount:s}}},e.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},e.prototype.updateStreamModes=function(t,r){var n=this._pipelineMap.get(t.uid),i=t.__preparePipelineContext?t.__preparePipelineContext(r,n):_G(t,r,n);t.pipelineContext=n.context=i},e.prototype.restorePipelines=function(t,r){var n=this,i=n._pipelineMap=pe();r.eachSeries(function(a){var o=t.painter.type==="canvas"&&a.getProgressive(),s=a.uid;i.set(s,{id:s,head:null,tail:null,threshold:a.getProgressiveThreshold(),progressiveEnabled:o&&!(a.preventIncremental&&a.preventIncremental()),blockIndex:-1,step:Math.round(o||700),count:0}),n._pipe(a,a.dataTask)})},e.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,r=this.api.getModel(),n=this.api;E(this._allHandlers,function(i){var a=t.get(i.uid)||t.set(i.uid,{}),o="";an(!(i.reset&&i.overallReset),o),i.reset&&this._createSeriesStageTask(i,a,r,n),i.overallReset&&this._createOverallStageTask(i,a,r,n)},this)},e.prototype.prepareView=function(t,r,n,i){var a=t.renderTask,o=a.context;o.model=r,o.ecModel=n,o.api=i,a.__block=!t.incrementalPrepareRender,this._pipe(r,a)},e.prototype.performDataProcessorTasks=function(t,r){this._performStageTasks(this._dataProcessorHandlers,t,r,{block:!0})},e.prototype.performVisualTasks=function(t,r,n){this._performStageTasks(this._visualHandlers,t,r,n)},e.prototype._performStageTasks=function(t,r,n,i){i=i||{};var a=!1,o=this;E(t,function(l,u){if(!(i.visualType&&i.visualType!==l.visualType)){var c=o._stageTaskMap.get(l.uid),h=c.seriesTaskMap,f=c.overallTask;if(f){var d,g=f.agentStubMap;g.each(function(y){s(i,y)&&(y.dirty(),d=!0)}),d&&f.dirty(),o.updatePayload(f,n);var m=o.getPerformArgs(f,i.block);g.each(function(y){y.perform(m)}),f.perform(m)&&(a=!0)}else h&&h.each(function(y,_){s(i,y)&&y.dirty();var x=o.getPerformArgs(y,i.block);x.skip=!l.performRawSeries&&r.isSeriesFiltered(y.context.model),o.updatePayload(y,n),y.perform(x)&&(a=!0)})}});function s(l,u){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(u.__pipeline.id))}this.unfinished=a||this.unfinished},e.prototype.performSeriesTasks=function(t){var r;t.eachSeries(function(n){r=n.dataTask.perform()||r}),this.unfinished=r||this.unfinished},e.prototype.plan=function(){this._pipelineMap.each(function(t){var r=t.tail;do{if(r.__block){t.blockIndex=r.__idxInPipeline;break}r=r.getUpstream()}while(r)})},e.prototype.updatePayload=function(t,r){r!=="remain"&&(t.context.payload=r)},e.prototype._createSeriesStageTask=function(t,r,n,i){var a=this,o=r.seriesTaskMap,s=r.seriesTaskMap=pe(),l=t.seriesType,u=t.getTargetSeries;t.createOnAllSeries?n.eachRawSeries(c):l?n.eachRawSeriesByType(l,c):u&&u(n,i).each(c);function c(h){var f=h.uid,d=s.set(f,o&&o.get(f)||Sp({plan:Eie,reset:Rie,count:Oie}));d.context={model:h,ecModel:n,api:i,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:a},a._pipe(h,d)}},e.prototype._createOverallStageTask=function(t,r,n,i){var a=this,o=r.overallTask=r.overallTask||Sp({reset:Iie});o.context={ecModel:n,api:i,overallReset:t.overallReset,scheduler:a};var s=o.agentStubMap,l=o.agentStubMap=pe(),u=t.seriesType,c=t.getTargetSeries,h=t.dirtyOnOverallProgress,f=!1,d="";an(!t.createOnAllSeries,d),u?n.eachRawSeriesByType(u,g):c?c(n,i).each(g):E(n.getSeries(),g);function g(m){var y=m.uid,_=l.set(y,s&&s.get(y)||(f=!0,Sp({reset:Nie,onDirty:Die})));_.context={model:m,dirtyOnOverallProgress:h},_.agent=o,_.__block=h,a._pipe(m,_)}f&&o.dirty()},e.prototype._pipe=function(t,r){var n=t.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=r),i.tail&&i.tail.pipe(r),i.tail=r,r.__idxInPipeline=i.count++,r.__pipeline=i},e.wrapStageHandler=function(t,r){return Ce(t)&&(t={overallReset:t,seriesType:zie(t)}),t.uid=Zc("stageHandler"),r&&(t.visualType=r),t},e}();function Iie(e){e.overallReset(e.ecModel,e.api,e.payload)}function Nie(e){return e.dirtyOnOverallProgress&&Pie}function Pie(){this.agent.dirty(),this.getDownstream().dirty()}function Die(){this.agent&&this.agent.dirty()}function Eie(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function Rie(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=It(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?ae(t,function(r,n){return SU(n)}):jie}var jie=SU(0);function SU(e){return function(t,r){var n=r.data,i=r.resetDefines[e];if(i&&i.dataEach)for(var a=t.start;a0&&d===u.length-f.length){var g=u.slice(0,d);g!=="data"&&(r.mainType=g,r[f.toLowerCase()]=l,c=!0)}}s.hasOwnProperty(u)&&(n[u]=l,c=!0),c||(i[u]=l)})}return{cptQuery:r,dataQuery:n,otherQuery:i}},e.prototype.filter=function(t,r){var n=this.eventInfo;if(!n)return!0;var i=n.targetEl,a=n.packedEvent,o=n.model,s=n.view;if(!o||!s)return!0;var l=r.cptQuery,u=r.dataQuery;return c(l,o,"mainType")&&c(l,o,"subType")&&c(l,o,"index","componentIndex")&&c(l,o,"name")&&c(l,o,"id")&&c(u,a,"name")&&c(u,a,"dataIndex")&&c(u,a,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(t,r.otherQuery,i,a));function c(h,f,d,g){return h[d]==null||f[g||d]===h[d]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),EM=["symbol","symbolSize","symbolRotate","symbolOffset"],kj=EM.concat(["symbolKeepAspect"]),Fie={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var r=e.getData();if(e.legendIcon&&r.setVisual("legendIcon",e.legendIcon),!e.hasSymbolVisual)return;for(var n={},i={},a=!1,o=0;o=0&&Uu(l)?l:.5;var u=e.createRadialGradient(o,s,0,o,s,l);return u}function RM(e,t,r){for(var n=t.type==="radial"?aae(e,t,r):iae(e,t,r),i=t.colorStops,a=0;a0)?null:e==="dashed"?[4*t,2*t]:e==="dotted"?[t]:at(e)?[e]:ne(e)?e:null}function vI(e){var t=e.style,r=t.lineDash&&t.lineWidth>0&&sae(t.lineDash,t.lineWidth),n=t.lineDashOffset;if(r){var i=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;i&&i!==1&&(r=ae(r,function(a){return a/i}),n/=i)}return[r,n]}var lae=new ho(!0);function Ax(e){var t=e.stroke;return!(t==null||t==="none"||!(e.lineWidth>0))}function Lj(e){return typeof e=="string"&&e!=="none"}function kx(e){var t=e.fill;return t!=null&&t!=="none"}function Ij(e,t){if(t.fillOpacity!=null&&t.fillOpacity!==1){var r=e.globalAlpha;e.globalAlpha=t.fillOpacity*t.opacity,e.fill(),e.globalAlpha=r}else e.fill()}function Nj(e,t){if(t.strokeOpacity!=null&&t.strokeOpacity!==1){var r=e.globalAlpha;e.globalAlpha=t.strokeOpacity*t.opacity,e.stroke(),e.globalAlpha=r}else e.stroke()}function jM(e,t,r){var n=ML(t.image,t.__image,r);if(cb(n)){var i=e.createPattern(n,t.repeat||"repeat");if(typeof DOMMatrix=="function"&&i&&i.setTransform){var a=new DOMMatrix;a.translateSelf(t.x||0,t.y||0),a.rotateSelf(0,0,(t.rotation||0)*fp),a.scaleSelf(t.scaleX||1,t.scaleY||1),i.setTransform(a)}return i}}function uae(e,t,r,n,i){var a,o=Ax(r),s=kx(r),l=r.strokePercent,u=l<1,c=!t.path;(!t.silent||u)&&c&&t.createPathProxy();var h=t.path||lae,f=t.__dirty;if(!n){var d=r.fill,g=r.stroke,m=s&&!!d.colorStops,y=o&&!!g.colorStops,_=s&&!!d.image,x=o&&!!g.image,w=void 0,S=void 0,T=void 0,M=void 0,A=void 0;(m||y)&&(A=t.getBoundingRect()),m&&(w=f?RM(e,d,A):t.__canvasFillGradient,t.__canvasFillGradient=w),y&&(S=f?RM(e,g,A):t.__canvasStrokeGradient,t.__canvasStrokeGradient=S),_&&(T=f||!t.__canvasFillPattern?jM(e,d,t):t.__canvasFillPattern,t.__canvasFillPattern=T),x&&(M=f||!t.__canvasStrokePattern?jM(e,g,t):t.__canvasStrokePattern,t.__canvasStrokePattern=M),m?e.fillStyle=w:_&&(T?e.fillStyle=T:s=!1),y?e.strokeStyle=S:x&&(M?e.strokeStyle=M:o=!1)}var N=t.getGlobalScale();h.setScale(N[0],N[1],t.segmentIgnoreThreshold);var P,I;e.setLineDash&&r.lineDash&&(a=vI(t),P=a[0],I=a[1]);var D=!0;(c||f&jh)&&(h.setDPR(e.dpr),u?h.setContext(null):(h.setContext(e),D=!1),h.reset(),t.buildPath(h,t.shape,n),h.toStatic(),t.pathUpdated()),D&&h.rebuildPath(e,u?l:1),P&&(e.setLineDash(P),e.lineDashOffset=I),n?(i.batchFill=s,i.batchStroke=o):r.strokeFirst?(o&&Nj(e,r),s&&Ij(e,r)):(s&&Ij(e,r),o&&Nj(e,r)),P&&e.setLineDash([])}function cae(e,t,r){var n=t.__image=ML(r.image,t.__image,t,t.onload);if(!(!n||!cb(n))){var i=r.x||0,a=r.y||0,o=t.getWidth(),s=t.getHeight(),l=n.width/n.height;if(o==null&&s!=null?o=s*l:s==null&&o!=null?s=o/l:o==null&&s==null&&(o=n.width,s=n.height),r.sWidth&&r.sHeight){var u=r.sx||0,c=r.sy||0;e.drawImage(n,u,c,r.sWidth,r.sHeight,i,a,o,s)}else if(r.sx&&r.sy){var u=r.sx,c=r.sy,h=o-u,f=s-c;e.drawImage(n,u,c,h,f,i,a,o,s)}else e.drawImage(n,i,a,o,s)}}function hae(e,t,r){var n,i=r.text;if(i!=null&&(i+=""),i){e.font=r.font||ss,e.textAlign=r.textAlign,e.textBaseline=r.textBaseline;var a=void 0,o=void 0;e.setLineDash&&r.lineDash&&(n=vI(t),a=n[0],o=n[1]),a&&(e.setLineDash(a),e.lineDashOffset=o),r.strokeFirst?(Ax(r)&&e.strokeText(i,r.x,r.y),kx(r)&&e.fillText(i,r.x,r.y)):(kx(r)&&e.fillText(i,r.x,r.y),Ax(r)&&e.strokeText(i,r.x,r.y)),a&&e.setLineDash([])}}var Pj=["shadowBlur","shadowOffsetX","shadowOffsetY"],Dj=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function EU(e,t,r,n,i){var a=!1;if(!n&&(r=r||{},t===r))return!1;if(n||t.opacity!==r.opacity){Ln(e,i),a=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?Xu.opacity:o}(n||t.blend!==r.blend)&&(a||(Ln(e,i),a=!0),e.globalCompositeOperation=t.blend||Xu.blend);for(var s=0;s0&&r.unfinished);r.unfinished||this._zr.flush()}}},t.prototype.getDom=function(){return this._dom},t.prototype.getId=function(){return this.id},t.prototype.getZr=function(){return this._zr},t.prototype.isSSR=function(){return this._ssr},t.prototype.setOption=function(r,n,i){if(!this[wr]){if(this._disposed){this.id;return}var a,o,s;if(Ie(n)&&(i=n.lazyUpdate,a=n.silent,o=n.replaceMerge,s=n.transition,n=n.notMerge),this[wr]=!0,Sh(this),!this._model||n){var l=new bne(this._api),u=this._theme,c=this._model=new lI;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,u,this._locale,l)}this._model.setOption(r,{replaceMerge:o},FM);var h={seriesTransition:s,optionChanged:!0};if(i)this[Fr]={silent:a,updateParams:h},this[wr]=!1,this.getZr().wakeUp();else{try{gu(this),Po.update.call(this,null,h)}catch(f){throw this[Fr]=null,this[wr]=!1,f}this._ssr||this._zr.flush(),this[Fr]=null,this[wr]=!1,bh.call(this,a),wh.call(this,a)}}},t.prototype.setTheme=function(r,n){if(!this[wr]){if(this._disposed){this.id;return}var i=this._model;if(i){var a=n&&n.silent,o=null;this[Fr]&&(a==null&&(a=this[Fr].silent),o=this[Fr].updateParams,this[Fr]=null),this[wr]=!0,Sh(this);try{this._updateTheme(r),i.setTheme(this._theme),gu(this),Po.update.call(this,{type:"setTheme"},o)}catch(s){throw this[wr]=!1,s}this[wr]=!1,bh.call(this,a),wh.call(this,a)}}},t.prototype._updateTheme=function(r){ue(r)&&(r=XU[r]),r&&(r=Se(r),r&&XH(r,!0),this._theme=r)},t.prototype.getModel=function(){return this._model},t.prototype.getOption=function(){return this._model&&this._model.getOption()},t.prototype.getWidth=function(){return this._zr.getWidth()},t.prototype.getHeight=function(){return this._zr.getHeight()},t.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||rt.hasGlobalWindow&&window.devicePixelRatio||1},t.prototype.getRenderedCanvas=function(r){return this.renderToCanvas(r)},t.prototype.renderToCanvas=function(r){r=r||{};var n=this._zr.painter;return n.getRenderedCanvas({backgroundColor:r.backgroundColor||this._model.get("backgroundColor"),pixelRatio:r.pixelRatio||this.getDevicePixelRatio()})},t.prototype.renderToSVGString=function(r){r=r||{};var n=this._zr.painter;return n.renderToString({useViewBox:r.useViewBox})},t.prototype.getSvgDataURL=function(){var r=this._zr,n=r.storage.getDisplayList();return E(n,function(i){i.stopAnimation(null,!0)}),r.painter.toDataURL()},t.prototype.getDataURL=function(r){if(this._disposed){this.id;return}r=r||{};var n=r.excludeComponents,i=this._model,a=[],o=this;E(n,function(l){i.eachComponent({mainType:l},function(u){var c=o._componentsMap[u.__viewId];c.group.ignore||(a.push(c),c.group.ignore=!0)})});var s=this._zr.painter.getType()==="svg"?this.getSvgDataURL():this.renderToCanvas(r).toDataURL("image/"+(r&&r.type||"png"));return E(a,function(l){l.group.ignore=!1}),s},t.prototype.getConnectedDataURL=function(r){if(this._disposed){this.id;return}var n=r.type==="svg",i=this.group,a=Math.min,o=Math.max,s=1/0;if(Px[i]){var l=s,u=s,c=-s,h=-s,f=[],d=r&&r.pixelRatio||this.getDevicePixelRatio();E(Qu,function(w,S){if(w.group===i){var T=n?w.getZr().painter.getSvgDom().innerHTML:w.renderToCanvas(Se(r)),M=w.getDom().getBoundingClientRect();l=a(M.left,l),u=a(M.top,u),c=o(M.right,c),h=o(M.bottom,h),f.push({dom:T,left:M.left,top:M.top})}}),l*=d,u*=d,c*=d,h*=d;var g=c-l,m=h-u,y=Rr.createCanvas(),_=iM(y,{renderer:n?"svg":"canvas"});if(_.resize({width:g,height:m}),n){var x="";return E(f,function(w){var S=w.left-l,T=w.top-u;x+=''+w.dom+""}),_.painter.getSvgRoot().innerHTML=x,r.connectedBackgroundColor&&_.painter.setBackgroundColor(r.connectedBackgroundColor),_.refreshImmediately(),_.painter.toDataURL()}else return r.connectedBackgroundColor&&_.add(new Ye({shape:{x:0,y:0,width:g,height:m},style:{fill:r.connectedBackgroundColor}})),E(f,function(w){var S=new zr({style:{x:w.left*d-l,y:w.top*d-u,image:w.dom}});_.add(S)}),_.refreshImmediately(),y.toDataURL("image/"+(r&&r.type||"png"))}else return this.getDataURL(r)},t.prototype.convertToPixel=function(r,n,i){return Yy(this,"convertToPixel",r,n,i)},t.prototype.convertToLayout=function(r,n,i){return Yy(this,"convertToLayout",r,n,i)},t.prototype.convertFromPixel=function(r,n,i){return Yy(this,"convertFromPixel",r,n,i)},t.prototype.containPixel=function(r,n){if(this._disposed){this.id;return}var i=this._model,a,o=pf(i,r);return E(o,function(s,l){l.indexOf("Models")>=0&&E(s,function(u){var c=u.coordinateSystem;if(c&&c.containPoint)a=a||!!c.containPoint(n);else if(l==="seriesModels"){var h=this._chartsMap[u.__viewId];h&&h.containPoint&&(a=a||h.containPoint(n,u))}},this)},this),!!a},t.prototype.getVisual=function(r,n){var i=this._model,a=pf(i,r,{defaultMainType:"series"}),o=a.seriesModel,s=o.getData(),l=a.hasOwnProperty("dataIndexInside")?a.dataIndexInside:a.hasOwnProperty("dataIndex")?s.indexOfRawIndex(a.dataIndex):null;return l!=null?dI(s,l,n):sm(s,n)},t.prototype.getViewOfComponentModel=function(r){return this._componentsMap[r.__viewId]},t.prototype.getViewOfSeriesModel=function(r){return this._chartsMap[r.__viewId]},t.prototype._initEvents=function(){var r=this;E(jae,function(i){var a=function(o){var s=r.getModel(),l=o.target,u,c=i==="globalout";if(c?u={}:l&&Hu(l,function(m){var y=Re(m);if(y&&y.dataIndex!=null){var _=y.dataModel||s.getSeriesByIndex(y.seriesIndex);return u=_&&_.getDataParams(y.dataIndex,y.dataType,l)||{},!0}else if(y.eventData)return u=ee({},y.eventData),!0},!0),u){var h=u.componentType,f=u.componentIndex;(h==="markLine"||h==="markPoint"||h==="markArea")&&(h="series",f=u.seriesIndex);var d=h&&f!=null&&s.getComponent(h,f),g=d&&r[d.mainType==="series"?"_chartsMap":"_componentsMap"][d.__viewId];u.event=o,u.type=i,r._$eventProcessor.eventInfo={targetEl:l,packedEvent:u,model:d,view:g},r.trigger(i,u)}};a.zrEventfulCallAtLast=!0,r._zr.on(i,a,r)});var n=this._messageCenter;E(zM,function(i,a){n.on(a,function(o){r.trigger(a,o)})}),Gie(n,this,this._api)},t.prototype.isDisposed=function(){return this._disposed},t.prototype.clear=function(){if(this._disposed){this.id;return}this.setOption({series:[]},!0)},t.prototype.dispose=function(){if(this._disposed){this.id;return}this._disposed=!0;var r=this.getDom();r&&pG(this.getDom(),yI,"");var n=this,i=n._api,a=n._model;E(n._componentsViews,function(o){o.dispose(a,i)}),E(n._chartsViews,function(o){o.dispose(a,i)}),n._zr.dispose(),n._dom=n._model=n._chartsMap=n._componentsMap=n._chartsViews=n._componentsViews=n._scheduler=n._api=n._zr=n._throttledZrFlush=n._theme=n._coordSysMgr=n._messageCenter=null,delete Qu[n.id]},t.prototype.resize=function(r){if(!this[wr]){if(this._disposed){this.id;return}this._zr.resize(r);var n=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!n){var i=n.resetOption("media"),a=r&&r.silent;this[Fr]&&(a==null&&(a=this[Fr].silent),i=!0,this[Fr]=null),this[wr]=!0,Sh(this);try{i&&gu(this),Po.update.call(this,{type:"resize",animation:ee({duration:0},r&&r.animation)})}catch(o){throw this[wr]=!1,o}this[wr]=!1,bh.call(this,a),wh.call(this,a)}}},t.prototype.showLoading=function(r,n){if(this._disposed){this.id;return}if(Ie(r)&&(n=r,r=""),r=r||"default",this.hideLoading(),!!VM[r]){var i=VM[r](this._api,n),a=this._zr;this._loadingFX=i,a.add(i)}},t.prototype.hideLoading=function(){if(this._disposed){this.id;return}this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},t.prototype.makeActionFromEvent=function(r){var n=ee({},r);return n.type=OM[r.type],n},t.prototype.dispatchAction=function(r,n){if(this._disposed){this.id;return}if(Ie(n)||(n={silent:!!n}),!!Ix[r.type]&&this._model){if(this[wr]){this._pendingActions.push(r);return}var i=n.silent;tC.call(this,r,i);var a=n.flush;a?this._zr.flush():a!==!1&&rt.browser.weChat&&this._throttledZrFlush(),bh.call(this,i),wh.call(this,i)}},t.prototype.updateLabelLayout=function(){Ti.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(r){if(this._disposed){this.id;return}var n=r.seriesIndex,i=this.getModel(),a=i.getSeriesByIndex(n);a.appendData(r),this._scheduler.unfinished=!0,this.getZr().wakeUp()},t.internalField=function(){gu=function(h){Wie(h._model);var f=h._scheduler;f.restorePipelines(h._zr,h._model),f.prepareStageTasks(),QS(h,!0),QS(h,!1),f.plan()},QS=function(h,f){for(var d=h._model,g=h._scheduler,m=f?h._componentsViews:h._chartsViews,y=f?h._componentsMap:h._chartsMap,_=h._zr,x=h._api,w=0;w_e(f.get("hoverLayerThreshold"),GH.hoverLayerThreshold)&&!rt.node&&!rt.worker;(h._usingTHL||y)&&(f.eachSeries(function(_){if(!_.preventUsingHoverLayer){var x=h._chartsMap[_.__viewId];x.__alive&&x.eachRendered(function(w){var S=w.states.emphasis;S&&S.hoverLayer!==gd&&(S.hoverLayer=y?aH:iH)})}}),h._usingTHL=y)}}function s(h,f){var d=h.get("blendMode")||null;f.eachRendered(function(g){g.isGroup||(g.style.blend=d)})}function l(h,f){if(!h.preventAutoZ){var d=_c(h);f.eachRendered(function(g){return yb(g,d.z,d.zlevel),!0})}}function u(h,f){f.eachRendered(function(d){if(!gf(d)){var g=d.getTextContent(),m=d.getTextGuideLine();d.stateTransition&&(d.stateTransition=null),g&&g.stateTransition&&(g.stateTransition=null),m&&m.stateTransition&&(m.stateTransition=null),d.hasState()?(d.prevStates=d.currentStates,d.clearStates()):d.prevStates&&(d.prevStates=null)}})}function c(h,f){var d=h.getModel("stateAnimation"),g=h.isAnimationEnabled(),m=d.get("duration"),y=m>0?{duration:m,delay:d.get("delay"),easing:d.get("easing")}:null;f.eachRendered(function(_){if(_.states&&_.states.emphasis){if(gf(_))return;if(_ instanceof Qe&&Xte(_),_.__dirty){var x=_.prevStates;x&&_.useStates(x)}if(g){_.stateTransition=y;var w=_.getTextContent(),S=_.getTextGuideLine();w&&(w.stateTransition=y),S&&(S.stateTransition=y)}_.__dirty&&a(_)}})}$j=function(h){return new(function(f){q(d,f);function d(){return f!==null&&f.apply(this,arguments)||this}return d.prototype.getCoordinateSystems=function(){return h._coordSysMgr.getCoordinateSystems()},d.prototype.getComponentByElement=function(g){for(;g;){var m=g.__ecComponentInfo;if(m!=null)return h._model.getComponent(m.mainType,m.index);g=g.parent}},d.prototype.enterEmphasis=function(g,m){hs(g,m),bi(h)},d.prototype.leaveEmphasis=function(g,m){fs(g,m),bi(h)},d.prototype.enterBlur=function(g){VG(g),bi(h)},d.prototype.leaveBlur=function(g){PL(g),bi(h)},d.prototype.enterSelect=function(g){GG(g),bi(h)},d.prototype.leaveSelect=function(g){HG(g),bi(h)},d.prototype.getModel=function(){return h.getModel()},d.prototype.getViewOfComponentModel=function(g){return h.getViewOfComponentModel(g)},d.prototype.getViewOfSeriesModel=function(g){return h.getViewOfSeriesModel(g)},d.prototype.getECUpdateCycleVersion=function(){return h[Zy]},d.prototype.usingTHL=function(){return h._usingTHL},d}(RG))(h)},YU=function(h){function f(d,g){for(var m=0;m=0)){Xj.push(r);var o=wU.wrapStageHandler(r,i);o.__prio=t,o.__raw=r,e.push(o)}}function CI(e,t){VM[e]=t}function Zae(e){y6({createCanvas:e})}function t8(e,t,r){var n=IU("registerMap");n&&n(e,t,r)}function $ae(e){var t=IU("getMap");return t&&t(e)}var r8=eie;Fl(gI,Mie);Fl(Mb,Aie);Fl(Mb,kie);Fl(gI,Fie);Fl(Mb,Vie);Fl(VU,_ae);bI(XH);wI(Tae,Dne);CI("default",Lie);wa({type:qu,event:qu,update:qu},qt);wa({type:s_,event:s_,update:s_},qt);wa({type:vx,event:IL,update:vx,action:qt,refineEvent:TI,publishNonRefinedEvent:!0});wa({type:vM,event:IL,update:vM,action:qt,refineEvent:TI,publishNonRefinedEvent:!0});wa({type:px,event:IL,update:px,action:qt,refineEvent:TI,publishNonRefinedEvent:!0});function TI(e,t,r,n){return{eventContent:{selected:Ute(r),isFromClick:t.isFromClick||!1}}}xI("default",{});xI("dark",MU);var Yae={},qj=[],Xae={registerPreprocessor:bI,registerProcessor:wI,registerPostInit:KU,registerPostUpdate:JU,registerUpdateLifecycle:Ab,registerAction:wa,registerCoordinateSystem:QU,registerLayout:e8,registerVisual:Fl,registerTransform:r8,registerLoading:CI,registerMap:t8,registerImpl:Hie,PRIORITY:GU,ComponentModel:qe,ComponentView:Nt,SeriesModel:At,ChartView:wt,registerComponentModel:function(e){qe.registerClass(e)},registerComponentView:function(e){Nt.registerClass(e)},registerSeriesModel:function(e){At.registerClass(e)},registerChartView:function(e){wt.registerClass(e)},registerCustomSeries:function(e,t){PU(e,t)},registerSubTypeDefaulter:function(e,t){qe.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){rG(e,t)}};function We(e){if(ne(e)){E(e,function(t){We(t)});return}Be(qj,e)>=0||(qj.push(e),Ce(e)&&(e={install:e}),e.install(Xae))}function pv(e){return e==null?0:e.length||1}function Kj(e){return e}var ds=function(){function e(t,r,n,i,a,o){this._old=t,this._new=r,this._oldKeyGetter=n||Kj,this._newKeyGetter=i||Kj,this.context=a,this._diffModeMultiple=o==="multiple"}return e.prototype.add=function(t){return this._add=t,this},e.prototype.update=function(t){return this._update=t,this},e.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this},e.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this},e.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this},e.prototype.remove=function(t){return this._remove=t,this},e.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},e.prototype._executeOneToOne=function(){var t=this._old,r=this._new,n={},i=new Array(t.length),a=new Array(r.length);this._initIndexMap(t,null,i,"_oldKeyGetter"),this._initIndexMap(r,n,a,"_newKeyGetter");for(var o=0;o1){var c=l.shift();l.length===1&&(n[s]=l[0]),this._update&&this._update(c,o)}else u===1?(n[s]=null,this._update&&this._update(l,o)):this._remove&&this._remove(o)}this._performRestAdd(a,n)},e.prototype._executeMultiple=function(){var t=this._old,r=this._new,n={},i={},a=[],o=[];this._initIndexMap(t,n,a,"_oldKeyGetter"),this._initIndexMap(r,i,o,"_newKeyGetter");for(var s=0;s1&&f===1)this._updateManyToOne&&this._updateManyToOne(c,u),i[l]=null;else if(h===1&&f>1)this._updateOneToMany&&this._updateOneToMany(c,u),i[l]=null;else if(h===1&&f===1)this._update&&this._update(c,u),i[l]=null;else if(h>1&&f>1)this._updateManyToMany&&this._updateManyToMany(c,u),i[l]=null;else if(h>1)for(var d=0;d1)for(var s=0;s30}var gv=Ie,Is=ae,toe=typeof Int32Array>"u"?Array:Int32Array,roe="e\0\0",Jj=-1,noe=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],ioe=["_approximateExtent"],Qj,qy,mv,yv,iC,_v,aC,_n=function(){function e(t,r){this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[],this._visual={},this._layout={},this._itemVisuals=[],this._itemLayouts=[],this._graphicEls=[],this._approximateExtent={},this._calculationInfo={},this.hasItemOption=!1,this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var n,i=!1;i8(t)?(n=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(i=!0,n=t),n=n||["x","y"];for(var a={},o=[],s={},l=!1,u={},c=0;c=r)){var n=this._store,i=n.getProvider();this._updateOrdinalMeta();var a=this._nameList,o=this._idList,s=i.getSource().sourceFormat,l=s===pi;if(l&&!i.pure)for(var u=[],c=t;c0},e.prototype.ensureUniqueItemVisual=function(t,r){var n=this._itemVisuals,i=n[t];i||(i=n[t]={});var a=i[r];return a==null&&(a=this.getVisual(r),ne(a)?a=a.slice():gv(a)&&(a=ee({},a)),i[r]=a),a},e.prototype.setItemVisual=function(t,r,n){var i=this._itemVisuals[t]||{};this._itemVisuals[t]=i,gv(r)?ee(i,r):i[r]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(t,r){gv(t)?ee(this._layout,t):this._layout[t]=r},e.prototype.getLayout=function(t){return this._layout[t]},e.prototype.getItemLayout=function(t){return this._itemLayouts[t]},e.prototype.setItemLayout=function(t,r,n){this._itemLayouts[t]=n?ee(this._itemLayouts[t]||{},r):r},e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},e.prototype.setItemGraphicEl=function(t,r){var n=this.hostModel&&this.hostModel.seriesIndex;dM(n,this.dataType,t,r),this._graphicEls[t]=r},e.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},e.prototype.eachItemGraphicEl=function(t,r){E(this._graphicEls,function(n,i){n&&t&&t.call(r,n,i)})},e.prototype.cloneShallow=function(t){return t||(t=new e(this._schema?this._schema:Is(this.dimensions,this._getDimInfo,this),this.hostModel)),iC(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(t,r){var n=this[t];Ce(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var i=n.apply(this,arguments);return r.apply(this,[i].concat(Q1(arguments)))})},e.internalField=function(){Qj=function(t){var r=t._invertedIndicesMap;E(r,function(n,i){var a=t._dimInfos[i],o=a.ordinalMeta,s=t._store;if(o){n=r[i]=new toe(o.categories.length);for(var l=0;l1&&(l+="__ec__"+c),i[r]=l}}}(),e}();function aoe(e,t){return Cd(e,t).dimensions}function Cd(e,t){uI(e)||(e=cI(e)),t=t||{};var r=t.coordDimensions||[],n=t.dimensionsDefine||e.dimensionsDefine||[],i=pe(),a=[],o=ooe(e,r,n,t.dimensionsCount),s=t.canOmitUnusedDimensions&&o8(o),l=n===e.dimensionsDefine,u=l?a8(e):MI(n),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var h=pe(c),f=new lU(o),d=0;d0&&(P.name=P.name+(I-1))}),new n8({source:e,dimensions:a,fullDimensionCount:o,dimensionOmitted:s})}function ooe(e,t,r,n){var i=Math.max(e.dimensionsDetectedCount||1,t.length,r.length,n||0);return E(t,function(a){var o;Ie(a)&&(o=a.dimsDef)&&(i=Math.max(i,o.length))}),i}function soe(e,t,r){if(r||t.hasKey(e)){for(var n=0;t.hasKey(e+n);)n++;e+=n}return t.set(e,!0),e}var loe=function(){function e(t){this.coordSysDims=[],this.axisMap=pe(),this.categoryAxisMap=pe(),this.coordSysName=t}return e}();function uoe(e){var t=e.get("coordinateSystem"),r=new loe(t),n=coe[t];if(n)return n(e,r,r.axisMap,r.categoryAxisMap),r}var coe={cartesian2d:function(e,t,r,n){var i=e.getReferringComponents("xAxis",Qt).models[0],a=e.getReferringComponents("yAxis",Qt).models[0];t.coordSysDims=["x","y"],r.set("x",i),r.set("y",a),Ch(i)&&(n.set("x",i),t.firstCategoryDimIndex=0),Ch(a)&&(n.set("y",a),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,r,n){var i=e.getReferringComponents("singleAxis",Qt).models[0];t.coordSysDims=["single"],r.set("single",i),Ch(i)&&(n.set("single",i),t.firstCategoryDimIndex=0)},polar:function(e,t,r,n){var i=e.getReferringComponents("polar",Qt).models[0],a=i.findAxisModel("radiusAxis"),o=i.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],r.set("radius",a),r.set("angle",o),Ch(a)&&(n.set("radius",a),t.firstCategoryDimIndex=0),Ch(o)&&(n.set("angle",o),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=1))},geo:function(e,t,r,n){t.coordSysDims=["lng","lat"]},parallel:function(e,t,r,n){var i=e.ecModel,a=i.getComponent("parallel",e.get("parallelIndex")),o=t.coordSysDims=a.dimensions.slice();E(a.parallelAxisIndex,function(s,l){var u=i.getComponent("parallelAxis",s),c=o[l];r.set(c,u),Ch(u)&&(n.set(c,u),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=l))})},matrix:function(e,t,r,n){var i=e.getReferringComponents("matrix",Qt).models[0];t.coordSysDims=["x","y"];var a=i.getDimensionModel("x"),o=i.getDimensionModel("y");r.set("x",a),r.set("y",o),n.set("x",a),n.set("y",o)}};function Ch(e){return e.get("type")==="category"}function s8(e,t,r){r=r||{};var n=r.byIndex,i=r.stackedCoordDimension,a,o,s;hoe(t)?a=t:(o=t.schema,a=o.dimensions,s=t.store);var l=!!(e&&e.get("stack")),u,c,h,f,d=!0;function g(S){return S.type!=="ordinal"&&S.type!=="time"}if(E(a,function(S,T){ue(S)&&(a[T]=S={name:S}),g(S)||(d=!1)}),E(a,function(S,T){l&&!S.isExtraCoord&&(!n&&!u&&S.ordinalMeta&&(u=S),!c&&g(S)&&(!d||S.coordDim!=="x"&&S.coordDim!=="angle")&&(!i||i===S.coordDim)&&(c=S))}),c&&!n&&!u&&(n=!0),c){h="__\0ecstackresult_"+e.id,f="__\0ecstackedover_"+e.id,u&&(u.createInvertedIndices=!0);var m=c.coordDim,y=c.type,_=0;E(a,function(S){S.coordDim===m&&_++});var x={name:h,coordDim:m,coordDimIndex:_,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length},w={name:f,coordDim:f,coordDimIndex:_+1,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:a.length+1};o?(s&&(x.storeDimIndex=s.ensureCalculationDimension(f,y),w.storeDimIndex=s.ensureCalculationDimension(h,y)),o.appendCalculationDimension(x),o.appendCalculationDimension(w)):(a.push(x),a.push(w))}return{stackedDimension:c&&c.name,stackedByDimension:u&&u.name,isStackedByIndex:n,stackedOverDimension:f,stackResultDimension:h}}function hoe(e){return!i8(e.schema)}function vs(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function AI(e,t){return vs(e,t)?e.getCalculationInfo("stackResultDimension"):t}function foe(e,t){var r=e.get("coordinateSystem"),n=xd.get(r),i;return t&&t.coordSysDims&&(i=ae(t.coordSysDims,function(a){var o={name:a},s=t.axisMap.get(a);if(s){var l=s.get("type");o.type=Dx(l)}return o})),i||(i=n&&(n.getDimensionsInfo?n.getDimensionsInfo():n.dimensions.slice())||["x","y"]),i}function doe(e,t,r){var n,i;return r&&E(e,function(a,o){var s=a.coordDim,l=r.categoryAxisMap.get(s);l&&(n==null&&(n=o),a.ordinalMeta=l.getOrdinalMeta(),t&&(a.createInvertedIndices=!0)),a.otherDims.itemName!=null&&(i=!0)}),!i&&n!=null&&(e[n].otherDims.itemName=0),n}function wo(e,t,r){r=r||{};var n=t.getSourceManager(),i,a=!1;e?(a=!0,i=cI(e)):(i=n.getSource(),a=i.sourceFormat===pi);var o=uoe(t),s=foe(t,o),l=r.useEncodeDefaulter,u=Ce(l)?l:l?Ze(UH,s,t):null,c={coordDimensions:s,generateCoord:r.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!a},h=Cd(i,c),f=doe(h.dimensions,r.createInvertedIndices,o),d=a?null:n.getSharedDataStore(h),g=s8(t,{schema:h,store:d}),m=new _n(h,t);m.setCalculationInfo(g);var y=f!=null&&voe(i)?function(_,x,w,S){return S===f?w:this.defaultDimValueGetter(_,x,w,S)}:null;return m.hasItemOption=!1,m.initData(a?i:d,null,y),m}function voe(e){if(e.sourceFormat===pi){var t=poe(e.data||[]);return!ne(ld(t))}}function poe(e){for(var t=0;t=t[0]&&e<=t[1]},getExtent:function(){return this._extents[Wn].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){eO(this._extents,Wn,e,t)},setExtent2:function(e,t,r){var n=this._extents;n[e]||(n[e]=n[Wn].slice()),eO(n,e,t,r)},freeze:function(){}};function eO(e,t,r,n){pc(r,n)&&(e[t][0]=r,e[t][1]=n)}function c8(e){return Rx(e)||Gf(e)}function Rx(e){return e.type==="interval"}function lm(e){return e.type==="time"}function Gf(e){return e.type==="log"}function bn(e){return e.type==="ordinal"}function boe(e){var t=ob(e),r=Gc(10,t),n=uo(e/r);return n?n===2?n=3:n===3?n=5:n*=2:n=1,st(n*r,-t)}function bc(e){return Ha(e)+2}function Ky(e,t){return hc(e)/hc(t)}function oC(e,t,r){var n=r&&r.lookup;if(n){for(var i=0;i1&&a/o>2&&(i=Math.round(Math.ceil(i/o)*o)),i!==n[0]&&l(n[0],!0,!0);for(var s=i;s<=n[1];s+=o)l(s,!1,s===n[0]||s===n[1]);s-o!==n[1]&&l(n[1],!0,!0);function l(u,c,h){r({value:u,offInterval:c},h)}}var yg=function(e){q(t,e);function t(r){var n=e.call(this)||this;n.type="ordinal",n.parse=t.parse,LI(n,t.decoratedMethods);var i=r.ordinalMeta;i||(i=new pg({})),ne(i)&&(i=new pg({categories:ae(i,function(o){return Ie(o)?o.value:o})})),n._ordinalMeta=i;var a=kI(null,null,r.extent||[0,i.categories.length-1]);return n._mapper=a.mapper,II(n),n}return t.parse=function(r){return r==null?r=NaN:ue(r)?(r=this._ordinalMeta.getOrdinal(r),r==null&&(r=NaN)):r=uo(r),r},t.prototype.getTicks=function(){var r=[];return f8(this,0,function(n){r.push(n)}),r},t.prototype.getMinorTicks=function(r){},t.prototype.setSortInfo=function(r){if(r==null){this._ordinalNumbersByTick=this._ticksByOrdinalNumber=null;return}for(var n=r.ordinalNumbers,i=this._ordinalNumbersByTick=[],a=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=bt(s,n.length);o=0&&r=0&&r=0&&ro[0]&&mo[1]||!isFinite(m)||!isFinite(o[1]))break}else{if(y>g)break;m=bt(m,o[1]),y===g&&(m=o[1])}if(h.push({value:m}),m=st(m+i,s),u){var _=u.calcNiceTickMultiple(m,d);_>=0&&(m=st(m+_*i,s))}if(h.length>0&&m===h[h.length-1].value)break;if(h.length>f)return[]}var x=h.length?h[h.length-1].value:o[1];return a[1]>x&&h.push({value:r.expandToNicedExtent?st(x+i,s):a[1]}),c&&l.pruneTicksByBreak(r.pruneByBreak,h,u.breaks,function(w){return w.value},n.interval,a),c&&r.breakTicks!=="none"&&l.addBreaksToTicks(h,u.breaks,a),h},t.prototype.getMinorTicks=function(r){return NI(this,r,_x(this),this._cfg.interval)},t.prototype.getLabel=function(r,n){if(r==null)return"";var i=n&&n.precision;i==null?i=Ha(r.value)||0:i==="auto"&&(i=this._cfg.intervalPrecision);var a=st(r.value,i,!0);return tI(a)},t.type="interval",t}(Sa);Sa.registerClass(ml);var Soe=function(e,t,r,n){for(;r>>1;e[i][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function Toe(e){var t=30*Di;return e/=t,e>6?6:e>3?3:e>2?2:1}function Moe(e){return e/=bp,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function tO(e,t){return e/=t?YL:$L,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function Aoe(e){return $e(sb(e,!0),1)}function koe(e,t,r){var n=Math.max(0,Be(ri,t)-1);return bx(new Date(e),ri[n],r).getTime()}function Loe(e,t){var r=new Date(0);r[e](1);var n=r.getTime();r[e](1+t);var i=r.getTime()-n;return function(a,o){return Math.max(0,Math.round((o-a)/i))}}function Ioe(e,t,r,n,i,a){var o=3e3,s=Zre,l=0;function u(H,V,z,$,W,Z,X){for(var re=Loe(W,H),J=V,oe=new Date(J);Jo));)if(oe[W](oe[$]()+H),J=oe.getTime(),a){var le=a.calcNiceTickMultiple(J,re);le>0&&(oe[W](oe[$]()+le*H),J=oe.getTime())}X.push({value:J,notAdd:J>n[1]})}function c(H,V,z){var $=[],W=!V.length;if(!v8(wp(H),n[0],n[1],r)){W&&(V=[{value:koe(n[0],H,r)},{value:n[1]}]);for(var Z=0;Z=n[0]&&X<=n[1]&&u(J,X,re,oe,le,De,$),H==="year"&&z.length>1&&Z===0&&z.unshift({value:z[0].value-J})}}for(var Z=0;Z<$.length;Z++)z.push($[Z])}}for(var h=[],f=[],d=0,g=0,m=0;m=n[0]&&S<=n[1]&&d++)}var T=i/t;if(d>T*1.5&&g>T/1.5||(h.push(x),d>T||e===s[m]))break}f=[]}}}for(var M=mt(ae(h,function(H){return mt(H,function(V){return V.value>=n[0]&&V.value<=n[1]&&!V.notAdd})}),function(H){return H.length>0}),A=M.length-1,N=[],m=0;mn[0])&&N.unshift({value:n[0],time:{level:0,upperTimeUnit:B,lowerTimeUnit:B},notNice:!0}),(!j||j.values&&(a=s);var l=Jy.length,u=Math.min(Soe(Jy,a,0,l),l-1),c=Jy[u][1],h=Jy[Math.max(u-1,0)][0];e.setTimeInterval({approxInterval:a,interval:c,minLevelUnit:h})};Sa.registerClass(d8);var Qy=0,e0=1,Poe=2,p8=function(e){q(t,e);function t(r){var n=e.call(this)||this;n.type="log",n.parse=ml.parse,n.base=r.logBase||10;var i=[],a=[],o=n._lookup={from:i,to:a};i[Qy]=i[e0]=a[Qy]=a[e0]=NaN,LI(n,t.mapperMethods);var s=hr(),l=r.breakOption,u={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(l,n,{noNegative:!0},Poe,u),n.powStub=new ml({breakParsed:u.original}),n.intervalStub=new ml({breakParsed:u.transformed}),II(n,n.intervalStub),n}return t.prototype.getTicks=function(r){var n=this.base,i=this.powStub,a=hr(),o=this.intervalStub,s=o.getExtent(),l=i.getExtent(),u={lookup:{from:s,to:l}};return ae(o.getTicks(r||{}),function(c){var h=c.value,f=oC(h,n,u),d;if(a){var g=a.getTicksBreakOutwardTransform(this,c,_x(i),this._lookup);g&&(d=g.vBreak,f=g.tickVal)}return{value:f,break:d}},this)},t.prototype.getMinorTicks=function(r){return NI(this,r,_x(this.powStub),this.intervalStub.getConfig().interval)},t.prototype.getLabel=function(r,n){return this.intervalStub.getLabel(r,n)},t.type="log",t.mapperMethods={needTransform:function(){return!0},normalize:function(r){return this.intervalStub.normalize(Ky(r,this.base))},scale:function(r){return oC(this.intervalStub.scale(r),this.base,null)},transformIn:function(r,n){return r=Ky(r,this.base),n&&n.depth===Jo?r:this.intervalStub.transformIn(r,n)},transformOut:function(r,n){var i=n?n.depth:null;return rO.depth=i,nO.lookup=this._lookup,oC(i===Jo?r:this.intervalStub.transformOut(r,rO),this.base,nO)},contain:function(r){return this.powStub.contain(r)},setExtent:function(r,n){this.setExtent2(Wn,r,n)},setExtent2:function(r,n,i){if(!(!pc(n,i)||n<=0||i<=0)){var a=iO,o=iO;if(r===Wn){var s=this._lookup;a=s.to,o=s.from}this.powStub.setExtent2(r,a[Qy]=n,a[e0]=i);var l=this.base;this.intervalStub.setExtent2(r,o[Qy]=Ky(n,l),o[e0]=Ky(i,l))}},getFilter:function(){return{g:0}},sanitize:function(r,n){return pc(n[0],n[1])&&Wi(r)&&r<=0&&(r=n[0]),r},getDefaultStartValue:function(){return 1},getExtent:function(){return this.powStub.getExtent()},getExtentUnsafe:function(r,n){return n===null?this.powStub.getExtentUnsafe(r,null):this.intervalStub.getExtentUnsafe(r,n)}},t}(Sa);Sa.registerClass(p8);var rO={},nO={},iO=[],g8={value:1,category:1,time:1,log:1},m8=Ue();function um(e){var t=e.get("type");return(t==null||!ge(g8,t)&&!Sa.getClass(t))&&(t="value"),t}function Td(e,t,r){var n=hr(),i;switch(n&&(i=y8(e,t,r)),t){case"category":return new yg({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:Qr()});case"time":return new d8({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC"),breakOption:i});case"log":return new p8({logBase:e.get("logBase"),breakOption:i});case"value":return new ml({breakOption:i});default:return new(Sa.getClass(t)||ml)({})}}function Doe(e,t,r){var n=e.getExtentUnsafe(Wn,null),i=n[0],a=n[1];return pc(i,a)?i===t||a===t?Roe:it?Eoe:HM:HM}var Eoe=1,Roe=2,HM=3;function joe(e){m8(e).noOnMyZero=!0}function Ooe(e){return m8(e).noOnMyZero}function cm(e){var t=e.getLabelModel().get("formatter");if(e.type==="time"){var r=$re(t);return function(i,a){return e.scale.getFormattedLabel(i,a,r)}}else{if(ue(t))return function(i){var a=e.scale.getLabel(i),o=t.replace("{value}",a??"");return o};if(Ce(t)){if(e.type==="category")return function(i,a){return t(jx(e,i),i.value-e.scale.getExtent()[0],null)};var n=hr();return function(i,a){var o=null;return n&&(o=n.makeAxisLabelFormatterParamBreak(o,i.break)),t(jx(e,i),a,o)}}else return function(i){return e.scale.getLabel(i)}}}function jx(e,t){var r=e.scale;return bn(r)?r.getLabel(t):t.value}function PI(e){var t=e.get("interval");return t??"auto"}function zoe(e){return e.type==="category"&&PI(e.getLabelModel())===0}function Boe(e,t){var r={};return E(e.mapDimensionsAll(t),function(n){r[AI(e,n)]=!0}),tt(r)}function Hf(e){return e==="middle"||e==="center"}function _g(e){return e.getShallow("show")}function y8(e,t,r){var n=e.get("breaks",!0);if(n!=null)return!hr()||!r||!Foe(t)?void 0:n}function Foe(e){return e!=="category"}function _8(e,t,r,n,i,a){var o=Gf(e),s=o?e.intervalStub:e;if(s.setExtent(n[0],n[1]),o){var l=e.powStub,u={depth:Jo},c=e.transformOut(n[0],u),h=e.transformOut(n[1],u),f=woe(r,n);t[0]&&!f[0]&&(c=i[0]),t[1]&&!f[1]&&(h=i[1]),l.setExtent(c,h)}s.setConfig(a)}function Md(e,t){return bn(e)?e.getRawOrdinalNumber(t.value):t.value}function hm(e,t){return bn(e)&&!!t.get("boundaryGap")}var Ad=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),Voe=cd(),Ox="|&",kd=Ue(),x8=-2,Goe=-1,Hoe=Ue();function DI(e,t){var r=e.model,n=kd(wd(r.ecModel)).keyed,i=n&&n.get(t);return i&&i.get(r.uid)}function Uoe(e,t){return w8(DI(e,t))}function Woe(e,t){var r=[];return b8(e.model.ecModel,function(n){for(var i=0;i0&&h[1]>0&&!f[0]&&(h[0]=0),h[0]<0&&h[1]<0&&!f[1]&&(h[1]=0));var S=!1;h[0]>h[1]&&(h.reverse(),S=!0);var T=xv(t,r.get("startValue",!0)),M=T!=null;!Wi(T)&&i&&(T=t.getDefaultStartValue?t.getDefaultStartValue():0),Wi(T)&&(M||!x||w)&&(Th[1]&&!f[1]&&(h[1]=T,f[1]=!0));var A=this._i={scale:t,dataMM:c,noZoomEffMM:h,zoomMM:[],fixMM:f,zoomFixMM:[!1,!1],startValue:T,isBlank:_,incl0:w,tggAxInv:S,ctnShp:a};aO(A,h)}return e.prototype.makeNoZoom=function(){return this._i.noZoomEffMM.slice()},e.prototype.makeFinal=function(){var t=this._i,r=t.zoomMM,n=t.noZoomEffMM,i=t.zoomFixMM,a=t.fixMM,o={fixMM:a,zoomFixMM:i,isBlank:t.isBlank,incl0:t.incl0,tggAxInv:t.tggAxInv,ctnShp:t.ctnShp,effMM:n.slice()},s=o.effMM;return r[0]!=null&&(s[0]=r[0],a[0]=i[0]=!0),r[1]!=null&&(s[1]=r[1],a[1]=i[1]=!0),aO(t,s),o},e.prototype.makeRenderInfo=function(){return{startValue:this._i.startValue}},e.prototype.setZoomMM=function(t,r){this._i.zoomMM[t]=r},e}();function aO(e,t){var r=e.scale,n=e.dataMM;r.sanitize&&(t[0]=r.sanitize(t[0],n),t[1]=r.sanitize(t[1],n),o_(t))}function xv(e,t){return t==null?null:tn(t)?NaN:e.parse(t)}function Qoe(e,t){var r;if(bn(e))r=[0,0];else{var n=t.get("boundaryGap");typeof n=="boolean"&&(n=null),r=ne(n)?n:[n,n]}return[oO(r[0]),oO(r[1])]}function oO(e){return lo(typeof e=="boolean"?0:e,1)||0}function M8(e){var t=qoe(e.scale);return t.extent||(t.extent=Qr()),t}function ese(e,t){M8(e).dimIdxInCoord=t.get(e.dim)}function Cc(e,t){var r=e.scale,n=e.model,i=e.dim;r.rawExtentInfo||tse(r,e,i,n,t)}function tse(e,t,r,n,i){var a=M8(t),o=a.extent,s=!1;Zoe(t,function(c){if(c.boxCoordinateSystem){var h=NH(c).coord,f=a.dimIdxInCoord;if(f>=0){if(ne(h)){var d=h[f];d!=null&&!ne(d)&&lM(o,e.parse(d))}}}else if(c.coordinateSystem){var g=c.getData();if(g){var m=e.getFilter?e.getFilter():null;E(Boe(g,r),function(y){Pee(o,g.getApproximateExtent(y,m))})}c.__requireStartValue&&c.__requireStartValue(t)&&(s=!0)}});var l=nse(e,t,n),u=new T8(e,n,o,s,l);A8(e,u,i),a.extent=null}function rse(e,t){var r=e.scale;A8(r,new T8(r,e.model,t,!1,!1),Joe)}function A8(e,t,r){e.rawExtentInfo=t,t.from=r}function Nb(e,t){jI.set(e,t)}var jI=pe();function k8(e,t,r,n,i){e.rawExtentInfo||rse({scale:e,model:t},i||Qr());var a=e.rawExtentInfo.makeFinal(),o=a.effMM;return e.setExtent(o[0],o[1]),e.setBlank(a.isBlank),n&&a.tggAxInv&&r&&!r.get("legacyMinMaxDontInverseAxis")&&(n.inverse=!n.inverse),a}function nse(e,t,r){var n=hm(e,r),i=r.get("containShape",!0);if(i==null&&!n&&(i=!0),!i)return!1;var a=!1;return S8(t,function(o){a=!!jI.get(o)||a}),a}function ise(e,t,r,n){if(r.ctnShp){var i;if(S8(e,function(s){var l=jI.get(s);if(l){var u=l(e,n);u&&(i=i||[0,0],mG(i,u[0]),yG(i,u[1]),joe(e))}}),!!i){var a=t.getExtent();if(bn(t))e.onBand||t.setExtent2(gg,bt(a[0],a[0]+i[0]),$e(a[1],a[1]+i[1]));else{var o=a.slice();r.zoomFixMM[0]||(o[0]=bt(o[0],t.transformOut(t.transformIn(o[0],null)+i[0],null))),r.zoomFixMM[1]||(o[1]=$e(o[1],t.transformOut(t.transformIn(o[1],null)+i[1],null))),(o[0]a[1])&&t.setExtent2(gg,o[0],o[1])}}}}function sO(e,t){var r=Gf(e),n=r?e.intervalStub:e,i=t.fixMinMax||[],a=r?e.getExtent():null,o=n.getExtent(),s=h8(o,i,t.rawExtentResult);n.setExtent(s[0],s[1]),s=n.getExtent();var l=r?ose(n,t):ase(n,t),u=l.intervalPrecision,c=l.interval,h=t.userInterval;h!=null&&(l.interval=h,l.intervalPrecision=bc(h)),i[0]||(s[0]=st(Ui(s[0]/c)*c,u)),i[1]||(s[1]=st(Vc(s[1]/c)*c,u)),h!=null&&(l.niceExtent=s.slice()),_8(e,i,o,s,a,l)}function ase(e,t){var r=Lb(t.splitNumber,5),n=kb(e),i=t.minInterval,a=t.maxInterval,o=sb(n/r,!0);i!=null&&oa&&(o=a);var s=bc(o),l=e.getExtent(),u=[st(Vc(l[0]/o)*o,s),st(Ui(l[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:u}}function ose(e,t){var r=Lb(t.splitNumber,10),n=e.getExtent(),i=kb(e),a=$e(_L(i),1),o=r/i*a;o<=.5&&(a*=10);var s=bc(a),l=[st(Vc(n[0]/a)*a,s),st(Ui(n[1]/a)*a,s)];return{intervalPrecision:s,interval:a,niceExtent:l}}function Wf(e){var t=e.scale,r=e.model,n=r.axis,i=r.ecModel;L8(t,r,n,i,null)}function L8(e,t,r,n,i){var a=k8(e,t,n,r,i),o=Rx(e)||lm(e);I8(e,{splitNumber:t.get("splitNumber"),fixMinMax:a.fixMM,userInterval:t.get("interval"),minInterval:o?t.get("minInterval"):null,maxInterval:o?t.get("maxInterval"):null,rawExtentResult:a}),r&&n&&ise(r,e,a,n)}function I8(e,t){sse[e.type](e,t)}var sse={interval:sO,log:sO,time:Noe,ordinal:qt};function lse(e){return wo(null,e)}var use={isDimensionStacked:vs,enableDataStack:s8,getStackedDimension:AI};function cse(e,t){var r=t;t instanceof Je||(r=new Je(t));var n=um(r),i=Td(r,n,!1);return e[1]i&&(n=o,i=l)}if(n)return gse(n.exterior);var u=this.getBoundingRect();return[u.x+u.width/2,u.y+u.height/2]},t.prototype.getBoundingRect=function(r){var n=this._rect;if(n&&!r)return n;var i=[1/0,1/0],a=[-1/0,-1/0],o=this.geometries;return E(o,function(s){s.type==="polygon"?uO(s.exterior,i,a,r):E(s.points,function(l){uO(l,i,a,r)})}),isFinite(i[0])&&isFinite(i[1])&&isFinite(a[0])&&isFinite(a[1])||(i[0]=i[1]=a[0]=a[1]=0),n=new Ae(i[0],i[1],a[0]-i[0],a[1]-i[1]),r||(this._rect=n),n},t.prototype.contain=function(r){var n=this.getBoundingRect(),i=this.geometries;if(!n.contain(r[0],r[1]))return!1;e:for(var a=0,o=i.length;a>1^-(s&1),l=l>>1^-(l&1),s+=i,l+=a,i=s,a=l,n.push([s/r,l/r])}return n}function ZM(e,t){return e=yse(e),ae(mt(e.features,function(r){return r.geometry&&r.properties&&r.geometry.coordinates.length>0}),function(r){var n=r.properties,i=r.geometry,a=[];switch(i.type){case"Polygon":var o=i.coordinates;a.push(new cO(o[0],o.slice(1)));break;case"MultiPolygon":E(i.coordinates,function(l){l[0]&&a.push(new cO(l[0],l.slice(1)))});break;case"LineString":a.push(new hO([i.coordinates]));break;case"MultiLineString":a.push(new hO(i.coordinates))}var s=new P8(n[t||"name"],a,n.cp);return s.properties=n,s})}const _se=Object.freeze(Object.defineProperty({__proto__:null,MAX_SAFE_INTEGER:ag,asc:Ur,getPercentWithPrecision:fee,getPixelPrecision:hee,getPrecision:Ha,getPrecisionSafe:oG,isNumeric:xL,isRadianAroundZero:fc,linearMap:ct,nice:sb,numericToNumber:co,parseDate:xo,parsePercent:he,quantile:a_,quantity:_L,quantityExponent:ob,reformIntervals:oM,remRadian:yL,round:cee},Symbol.toStringTag,{value:"Module"})),xse=Object.freeze(Object.defineProperty({__proto__:null,format:am,parse:xo,roundTime:bx},Symbol.toStringTag,{value:"Module"})),bse=Object.freeze(Object.defineProperty({__proto__:null,Arc:rm,BezierCurve:vd,BoundingRect:Ae,Circle:bo,CompoundPath:nm,Ellipse:tm,Group:Me,Image:zr,IncrementalDisplayable:rH,Line:cr,LinearGradient:Uc,Polygon:sn,Polyline:$r,RadialGradient:RL,Rect:Ye,Ring:dd,Sector:on,Text:it,clipPointsByRect:BL,clipRectByRect:uH,createIcon:md,extendPath:sH,extendShape:oH,getShapeClass:ug,getTransform:Ku,initProps:jt,makeImage:OL,makePath:zf,mergePath:ii,registerShape:qi,resizePath:zL,updateProps:lt},Symbol.toStringTag,{value:"Module"})),wse=Object.freeze(Object.defineProperty({__proto__:null,addCommas:tI,capitalFirst:tne,encodeHTML:gn,formatTime:ene,formatTpl:nI,getTextRect:Qre,getTooltipMarker:kH,normalizeCssArray:_d,toCamelCase:rI,truncateText:Xee},Symbol.toStringTag,{value:"Module"})),Sse=Object.freeze(Object.defineProperty({__proto__:null,bind:de,clone:Se,curry:Ze,defaults:ke,each:E,extend:ee,filter:mt,indexOf:Be,inherits:uL,isArray:ne,isFunction:Ce,isObject:Ie,isString:ue,map:ae,merge:He,reduce:Hi},Symbol.toStringTag,{value:"Module"}));var Cse=Ue(),Cp=Ue(),xa={estimate:1,determine:2};function zx(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function Tse(e,t){var r=e.getLabelModel().get("customValues");if(r){var n=e.scale;return{labels:ae(E8(r,n),function(i,a){return{formattedLabel:cm(e)(i,a),rawLabel:n.getLabel(i),tick:i}})}}return e.type==="category"?Ase(e,t):Lse(e)}function Mse(e,t,r){var n=e.scale,i=e.getTickModel().get("customValues");return i?{ticks:E8(i,n)}:e.type==="category"?kse(e,t):{ticks:n.getTicks(r)}}function E8(e,t){var r=t.getExtent(),n=[];return E(e,function(i){i=t.parse(i),i>=r[0]&&i<=r[1]&&n.push(i)}),lb(n,jee,null),Ur(n),ae(n,function(i){return{value:i}})}function Ase(e,t){var r=e.getLabelModel(),n=R8(e,r,t);return!r.get("show")||e.scale.isBlank()?{labels:[]}:n}function R8(e,t,r){var n=Nse(e),i=PI(t),a=r.kind===xa.estimate;if(!a){var o=O8(n,i);if(o)return o}var s,l;Ce(i)?s=Bx(e,i,!1):(l=i==="auto"?Pse(e,r):i,s=Bx(e,l,!1));var u={labels:s,labelCategoryInterval:l};return a?r.out.noPxChangeTryDetermine.push(function(){return $M(n,i,u),!0}):$M(n,i,u),u}function kse(e,t){var r=Ise(e),n=PI(t),i=O8(r,n);if(i)return i;var a,o;if((!t.get("show")||e.scale.isBlank())&&(a=[]),Ce(n))a=Bx(e,n,!0);else if(n==="auto"){var s=R8(e,e.getLabelModel(),zx(xa.determine));o=s.labelCategoryInterval,a=ae(s.labels,function(l){return l.tick})}else o=n,a=Bx(e,o,!0);return $M(r,n,{ticks:a,tickCategoryInterval:o})}function Lse(e){var t=e.scale.getTicks(),r=cm(e);return{labels:ae(t,function(n,i){return{formattedLabel:r(n,i),rawLabel:e.scale.getLabel(n),tick:n}})}}var Ise=j8("axisTick"),Nse=j8("axisLabel");function j8(e){return function(r){return Cp(r)[e]||(Cp(r)[e]={list:[]})}}function O8(e,t){for(var r=0;rc&&(u=Math.max(1,Math.floor(l/c)));for(var h=s[0],f=e.dataToCoord(h+1)-e.dataToCoord(h),d=Math.abs(f*Math.cos(a)),g=Math.abs(f*Math.sin(a)),m=0,y=0;h<=s[1];h+=u){var _=0,x=0,w=nb(i({value:h}),n.font,"center","top");_=w.width*1.3,x=w.height*1.3,m=Math.max(m,_,7),y=Math.max(y,x,7)}var S=m/d,T=y/g;isNaN(S)&&(S=1/0),isNaN(T)&&(T=1/0);var M=Math.max(0,Math.floor(Math.min(S,T)));if(r===xa.estimate)return t.out.noPxChangeTryDetermine.push(de(Ese,null,e,M,l)),M;var A=z8(e,M,l);return A??M}function Ese(e,t,r){return z8(e,t,r)==null}function z8(e,t,r){var n=Cse(e.model),i=e.getExtent(),a=n.lastAutoInterval,o=n.lastTickCount;if(a!=null&&o!=null&&Math.abs(a-t)<=1&&Math.abs(o-r)<=1&&a>t&&n.axisExtent0===i[0]&&n.axisExtent1===i[1])return a;n.lastTickCount=r,n.lastAutoInterval=t,n.axisExtent0=i[0],n.axisExtent1=i[1]}function Rse(e){var t=e.getLabelModel();return{axisRotate:e.getRotate?e.getRotate():e.isHorizontal&&!e.isHorizontal()?90:0,labelRotate:t.get("rotate")||0,font:t.getFont()}}function Bx(e,t,r){var n=cm(e),i=e.scale,a=[],o=Ce(t);return f8(i,o?0:t,function(s,l){var u=i.getLabel(s);if(o){var c=!!t(s.value,u);if(s.offInterval=!c,!c&&!l)return}a.push(r?s:{formattedLabel:n(s),rawLabel:u,tick:s})}),a}var jse=.8;function ln(e,t){t=t||{};var r={w:NaN,w2:NaN},n=e.scale,i=t.fromStat,a=t.min,o=_oe(n);Wi(o)||(o=NaN);var s=e.getExtent(),l=Xt(s[1]-s[0]);return bn(n)?Ose(r,e,o,l):i&&zse(r,e,o,l,i),a!=null&&(r.w=Wi(r.w)?$e(a,r.w):a),r}function Ose(e,t,r,n){var i=t.onBand,a=r+(i?1:0);a===0&&(a=1),e.w=n/a,!i&&r&&n&&(e.w2=e.w*r/n)}function zse(e,t,r,n,i){var a=!1,o=-1/0;E(i.key?[Uoe(t,i.key)]:Woe(t,i.sers||[]),function(s){var l=s.liPosMinGap;l!=null&&(l>0?(l>o&&(o=l),a=!1):l===x8&&(a=!0))}),Wi(r)&&r>0&&Wi(o)?(e.w=n/r*o,e.w2=o):a&&(e.w=n*jse,e.w2=e.w*r/n)}var fO=[0,1],Ki=function(){function e(t,r,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=r,this._extent=n||[0,0]}return e.prototype.contain=function(t){var r=this._extent,n=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return t>=n&&t<=i},e.prototype.containData=function(t){return this.scale.contain(this.scale.parse(t))},e.prototype.getExtent=function(){return this._extent.slice()},e.prototype.setExtent=function(t,r){var n=this._extent;n[0]=t,n[1]=r},e.prototype.dataToCoord=function(t,r){var n=this.scale;return t=n.normalize(n.parse(t)),ct(t,fO,dO(this),r)},e.prototype.coordToData=function(t,r){var n=ct(t,dO(this),fO,r);return this.scale.scale(n)},e.prototype.pointToData=function(t,r){},e.prototype.getTicksCoords=function(t){t=t||{};var r=t.tickModel||this.getTickModel(),n=Mse(this,r,{breakTicks:t.breakTicks,pruneByBreak:t.pruneByBreak}),i=ae(n.ticks,function(s){return{coord:this.dataToCoord(Md(this.scale,s)),tick:s}},this),a=r.get("alignWithLabel"),o=Bse(this,i,a);return ae(i,function(s){return{coord:s.coord,tickValue:s.tick.value,onBand:o}})},e.prototype.getMinorTicksCoords=function(){if(bn(this.scale))return[];var t=this.model.getModel("minorTick"),r=t.get("splitNumber");r>0&&r<100||(r=5);var n=this.scale.getMinorTicks(r),i=ae(n,function(a){return ae(a,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return i},e.prototype.getViewLabels=function(t){return t=t||zx(xa.determine),Tse(this,t).labels},e.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},e.prototype.getTickModel=function(){return this.model.getModel("axisTick")},e.prototype.getBandWidth=function(){return ln(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(t){return t=t||zx(xa.determine),Dse(this,t)},e}();function dO(e){var t=e.getExtent();if(e.onBand){var r=t[1]-t[0],n=r/e.scale.count()/2;t[0]+=n,t[1]-=n}return t}function Bse(e,t,r){var n=t.length;if(!e.onBand||r||!n)return!1;var i=ln(e).w;if(!i)return!1;E(t,function(s){s.coord-=i/2});var a=e.scale.getExtent(),o=t[n-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+i,tick:{value:a[1]+1}}),!0}function Fse(e){var t=qe.extend(e);return qe.registerClass(t),t}function Vse(e){var t=Nt.extend(e);return Nt.registerClass(t),t}function Gse(e){var t=At.extend(e);return At.registerClass(t),t}function Hse(e){var t=wt.extend(e);return wt.registerClass(t),t}var bv=Math.PI*2,mu=ho.CMD,Use=["top","right","bottom","left"];function Wse(e,t,r,n,i){var a=r.width,o=r.height;switch(e){case"top":n.set(r.x+a/2,r.y-t),i.set(0,-1);break;case"bottom":n.set(r.x+a/2,r.y+o+t),i.set(0,1);break;case"left":n.set(r.x-t,r.y+o/2),i.set(-1,0);break;case"right":n.set(r.x+a+t,r.y+o/2),i.set(1,0);break}}function Zse(e,t,r,n,i,a,o,s,l){o-=e,s-=t;var u=Math.sqrt(o*o+s*s);o/=u,s/=u;var c=o*r+e,h=s*r+t;if(Math.abs(n-i)%bv<1e-4)return l[0]=c,l[1]=h,u-r;if(a){var f=n;n=si(i),i=si(f)}else n=si(n),i=si(i);n>i&&(i+=bv);var d=Math.atan2(s,o);if(d<0&&(d+=bv),d>=n&&d<=i||d+bv>=n&&d+bv<=i)return l[0]=c,l[1]=h,u-r;var g=r*Math.cos(n)+e,m=r*Math.sin(n)+t,y=r*Math.cos(i)+e,_=r*Math.sin(i)+t,x=(g-o)*(g-o)+(m-s)*(m-s),w=(y-o)*(y-o)+(_-s)*(_-s);return x0){t=t/180*Math.PI,ca.fromArray(e[0]),Et.fromArray(e[1]),ur.fromArray(e[2]),Pe.sub(Wa,ca,Et),Pe.sub(Ga,ur,Et);var r=Wa.len(),n=Ga.len();if(!(r<.001||n<.001)){Wa.scale(1/r),Ga.scale(1/n);var i=Wa.dot(Ga),a=Math.cos(t);if(a1&&Pe.copy(kn,ur),kn.toArray(e[1])}}}}function Xse(e,t,r){if(r<=180&&r>0){r=r/180*Math.PI,ca.fromArray(e[0]),Et.fromArray(e[1]),ur.fromArray(e[2]),Pe.sub(Wa,Et,ca),Pe.sub(Ga,ur,Et);var n=Wa.len(),i=Ga.len();if(!(n<.001||i<.001)){Wa.scale(1/n),Ga.scale(1/i);var a=Wa.dot(t),o=Math.cos(r);if(a=l)Pe.copy(kn,ur);else{kn.scaleAndAdd(Ga,s/Math.tan(Math.PI/2-c));var h=ur.x!==Et.x?(kn.x-Et.x)/(ur.x-Et.x):(kn.y-Et.y)/(ur.y-Et.y);if(isNaN(h))return;h<0?Pe.copy(kn,Et):h>1&&Pe.copy(kn,ur)}kn.toArray(e[1])}}}}function uC(e,t,r,n){var i=r==="normal",a=i?e:e.ensureState(r);a.ignore=t;var o=n.get("smooth");o=o===!0?.3:Math.max(+o,0)||0,a.shape=a.shape||{},a.shape.smooth=o;var s=n.getModel("lineStyle").getLineStyle();i?e.useStyle(s):a.style=s}function qse(e,t){var r=t.smooth,n=t.points;if(n)if(e.moveTo(n[0][0],n[0][1]),r>0&&n.length>=3){var i=Ho(n[0],n[1]),a=Ho(n[1],n[2]);if(!i||!a){e.lineTo(n[1][0],n[1][1]),e.lineTo(n[2][0],n[2][1]);return}var o=Math.min(i,a)*r,s=vp([],n[1],n[0],o/i),l=vp([],n[1],n[2],o/a),u=vp([],s,l,.5);e.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),e.bezierCurveTo(l[0],l[1],l[0],l[1],n[2][0],n[2][1])}else for(var c=1;c0){S(I*P,0,a);var D=I+A;D<0&&T(-D*P,1)}else T(-A*P,1)}}function S(A,N,P){A!==0&&(c=!0);for(var I=N;I0)for(var D=0;D0;D--){var U=P[D-1]*B;S(-U,D,a)}}}function M(A){var N=A<0?-1:1;A=Math.abs(A);for(var P=Math.ceil(A/(a-1)),I=0;I0?S(P,0,I+1):S(-P,a-I-1,a),A-=P,A<=0)return}return c}function Qse(e){for(var t=0;t=0&&n.attr(a.oldLayoutSelect),Be(f,"emphasis")>=0&&n.attr(a.oldLayoutEmphasis)),lt(n,u,r,l)}else if(n.attr(u),!yd(n).valueAnimation){var h=_e(n.style.opacity,1);n.style.opacity=0,jt(n,{style:{opacity:h}},r,l)}if(a.oldLayout=u,n.states.select){var d=a.oldLayoutSelect={};t0(d,u,r0),t0(d,n.states.select,r0)}if(n.states.emphasis){var g=a.oldLayoutEmphasis={};t0(g,u,r0),t0(g,n.states.emphasis,r0)}pH(n,l,c,r,r)}if(i&&!i.ignore&&!i.invisible){var a=rle(i),o=a.oldLayout,m={points:i.shape.points};o?(i.attr({shape:o}),lt(i,{shape:m},r)):(i.setShape(m),i.style.strokePercent=0,jt(i,{style:{strokePercent:1}},r)),a.oldLayout=m}},e}(),fC=Ue();function ile(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){var i=fC(r).labelManager;i||(i=fC(r).labelManager=new nle),i.clearLabels()}),e.registerUpdateLifecycle("series:layoutlabels",function(t,r,n){var i=fC(r).labelManager;E(n.updatedSeries,function(a){i.addLabelsOfSeries(r.getViewOfSeriesModel(a))}),i.updateLayoutConfig(r),i.layout(r),i.processLabelsOverall()})}var dC=Math.sin,vC=Math.cos,W8=Math.PI,yu=Math.PI*2,ale=180/W8,Z8=function(){function e(){}return e.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},e.prototype.moveTo=function(t,r){this._add("M",t,r)},e.prototype.lineTo=function(t,r){this._add("L",t,r)},e.prototype.bezierCurveTo=function(t,r,n,i,a,o){this._add("C",t,r,n,i,a,o)},e.prototype.quadraticCurveTo=function(t,r,n,i){this._add("Q",t,r,n,i)},e.prototype.arc=function(t,r,n,i,a,o){this.ellipse(t,r,n,n,0,i,a,o)},e.prototype.ellipse=function(t,r,n,i,a,o,s,l){var u=s-o,c=!l,h=Math.abs(u),f=Js(h-yu)||(c?u>=yu:-u>=yu),d=u>0?u%yu:u%yu+yu,g=!1;f?g=!0:Js(h)?g=!1:g=d>=W8==!!c;var m=t+n*vC(o),y=r+i*dC(o);this._start&&this._add("M",m,y);var _=Math.round(a*ale);if(f){var x=1/this._p,w=(c?1:-1)*(yu-x);this._add("A",n,i,_,1,+c,t+n*vC(o+w),r+i*dC(o+w)),x>.01&&this._add("A",n,i,_,0,+c,m,y)}else{var S=t+n*vC(s),T=r+i*dC(s);this._add("A",n,i,_,+g,+c,S,T)}},e.prototype.rect=function(t,r,n,i){this._add("M",t,r),this._add("l",n,0),this._add("l",0,i),this._add("l",-n,0),this._add("Z")},e.prototype.closePath=function(){this._d.length>0&&this._add("Z")},e.prototype._add=function(t,r,n,i,a,o,s,l,u){for(var c=[],h=this._p,f=1;f"}function vle(e){return""}function FI(e,t){t=t||{};var r=t.newline?` -`:"";function n(i){var a=i.children,o=i.tag,s=i.attrs,l=i.text;return dle(o,s)+(o!=="style"?gn(l):l||"")+(a?""+r+ae(a,function(u){return n(u)}).join(r)+r:"")+vle(o)}return n(e)}function ple(e,t,r){r=r||{};var n=r.newline?` -`:"",i=" {"+n,a=n+"}",o=ae(tt(e),function(l){return l+i+ae(tt(e[l]),function(u){return u+":"+e[l][u]+";"}).join(n)+a}).join(n),s=ae(tt(t),function(l){return"@keyframes "+l+i+ae(tt(t[l]),function(u){return u+i+ae(tt(t[l][u]),function(c){var h=t[l][u][c];return c==="d"&&(h='path("'+h+'")'),c+":"+h+";"}).join(n)+a}).join(n)+a}).join(n);return!o&&!s?"":[""].join(n)}function JM(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function _O(e,t,r,n){return Er("svg","root",{width:e,height:t,xmlns:$8,"xmlns:xlink":Y8,version:"1.1",baseProfile:"full",viewBox:n?"0 0 "+e+" "+t:!1},r)}var gle=0;function q8(){return gle++}var xO={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},Mu="transform-origin";function mle(e,t,r){var n=ee({},e.shape);ee(n,t),e.buildPath(r,n);var i=new Z8;return i.reset(X6(e)),r.rebuildPath(i,1),i.generateStr(),i.getStr()}function yle(e,t){var r=t.originX,n=t.originY;(r||n)&&(e[Mu]=r+"px "+n+"px")}var _le={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function K8(e,t){var r=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[r]=e,r}function xle(e,t,r){var n=e.shape.paths,i={},a,o;if(E(n,function(l){var u=JM(r.zrId);u.animation=!0,Db(l,{},u,!0);var c=u.cssAnims,h=u.cssNodes,f=tt(c),d=f.length;if(d){o=f[d-1];var g=c[o];for(var m in g){var y=g[m];i[m]=i[m]||{d:""},i[m].d+=y.d||""}for(var _ in h){var x=h[_].animation;x.indexOf(o)>=0&&(a=x)}}}),!!a){t.d=!1;var s=K8(i,r);return a.replace(o,s)}}function bO(e){return ue(e)?xO[e]?"cubic-bezier("+xO[e]+")":dL(e)?e:"":""}function Db(e,t,r,n){var i=e.animators,a=i.length,o=[];if(e instanceof nm){var s=xle(e,t,r);if(s)o.push(s);else if(!a)return}else if(!a)return;for(var l={},u=0;u0}).length){var De=K8(A,r);return De+" "+x[0]+" both"}}for(var y in l){var s=m(l[y]);s&&o.push(s)}if(o.length){var _=r.zrId+"-cls-"+q8();r.cssNodes["."+_]={animation:o.join(",")},t.class=_}}function ble(e,t,r){if(!e.ignore)if(e.isSilent()){var n={"pointer-events":"none"};wO(n,t,r)}else{var i=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},a=i.fill;if(!a){var o=e.style&&e.style.fill,s=e.states.select&&e.states.select.style&&e.states.select.style.fill,l=e.currentStates.indexOf("select")>=0&&s||o;l&&(a=ox(l))}var u=i.lineWidth;if(u){var c=!i.strokeNoScale&&e.transform?e.transform[0]:1;u=u/c}var n={cursor:"pointer"};a&&(n.fill=a),i.stroke&&(n.stroke=i.stroke),u&&(n["stroke-width"]=u),wO(n,t,r)}}function wO(e,t,r,n){var i=JSON.stringify(e),a=r.cssStyleCache[i];a||(a=r.zrId+"-cls-"+q8(),r.cssStyleCache[i]=a,r.cssNodes["."+a+":hover"]=e),t.class=t.class?t.class+" "+a:a}var xg=Math.round;function J8(e){return e&&ue(e.src)}function Q8(e){return e&&Ce(e.toDataURL)}function VI(e,t,r,n){cle(function(i,a){var o=i==="fill"||i==="stroke";o&&Y6(a)?tW(t,e,i,n):o&&pL(a)?rW(r,e,i,n):e[i]=a,o&&n.ssr&&a==="none"&&(e["pointer-events"]="visible")},t,r,!1),kle(r,e,n)}function GI(e,t){var r=nG(t);r&&(r.each(function(n,i){n!=null&&(e[(yO+i).toLowerCase()]=n+"")}),t.isSilent()&&(e[yO+"silent"]="true"))}function SO(e){return Js(e[0]-1)&&Js(e[1])&&Js(e[2])&&Js(e[3]-1)}function wle(e){return Js(e[4])&&Js(e[5])}function HI(e,t,r){if(t&&!(wle(t)&&SO(t))){var n=1e4;e.transform=SO(t)?"translate("+xg(t[4]*n)/n+" "+xg(t[5]*n)/n+")":SQ(t)}}function CO(e,t,r){for(var n=e.points,i=[],a=0;a"u"){var y="Image width/height must been given explictly in svg-ssr renderer.";an(f,y),an(d,y)}else if(f==null||d==null){var _=function(I,D){if(I){var O=I.elm,j=f||D.width,B=d||D.height;I.tag==="pattern"&&(u?(B=1,j/=a.width):c&&(j=1,B/=a.height)),I.attrs.width=j,I.attrs.height=B,O&&(O.setAttribute("width",j),O.setAttribute("height",B))}},x=ML(g,null,e,function(I){l||_(M,I),_(h,I)});x&&x.width&&x.height&&(f=f||x.width,d=d||x.height)}h=Er("image","img",{href:g,width:f,height:d}),o.width=f,o.height=d}else i.svgElement&&(h=Se(i.svgElement),o.width=i.svgWidth,o.height=i.svgHeight);if(h){var w,S;l?w=S=1:u?(S=1,w=o.width/a.width):c?(w=1,S=o.height/a.height):o.patternUnits="userSpaceOnUse",w!=null&&!isNaN(w)&&(o.width=w),S!=null&&!isNaN(S)&&(o.height=S);var T=q6(i);T&&(o.patternTransform=T);var M=Er("pattern","",o,[h]),A=FI(M),N=n.patternCache,P=N[A];P||(P=n.zrId+"-p"+n.patternIdx++,N[A]=P,o.id=P,M=n.defs[P]=Er("pattern",P,o,[h])),t[r]=rb(P)}}function Lle(e,t,r){var n=r.clipPathCache,i=r.defs,a=n[e.id];if(!a){a=r.zrId+"-c"+r.clipPathIdx++;var o={id:a};n[e.id]=a,i[a]=Er("clipPath",a,o,[eW(e,r)])}t["clip-path"]=rb(a)}function AO(e){return document.createTextNode(e)}function Du(e,t,r){e.insertBefore(t,r)}function kO(e,t){e.removeChild(t)}function LO(e,t){e.appendChild(t)}function nW(e){return e.parentNode}function iW(e){return e.nextSibling}function pC(e,t){e.textContent=t}var IO=58,Ile=120,Nle=Er("","");function QM(e){return e===void 0}function Ba(e){return e!==void 0}function Ple(e,t,r){for(var n={},i=t;i<=r;++i){var a=e[i].key;a!==void 0&&(n[a]=i)}return n}function Kv(e,t){var r=e.key===t.key,n=e.tag===t.tag;return n&&r}function bg(e){var t,r=e.children,n=e.tag;if(Ba(n)){var i=e.elm=X8(n);if(UI(Nle,e),ne(r))for(t=0;ta?(g=r[l+1]==null?null:r[l+1].elm,aW(e,g,r,i,l)):Ux(e,t,n,a))}function Oh(e,t){var r=t.elm=e.elm,n=e.children,i=t.children;e!==t&&(UI(e,t),QM(t.text)?Ba(n)&&Ba(i)?n!==i&&Dle(r,n,i):Ba(i)?(Ba(e.text)&&pC(r,""),aW(r,null,i,0,i.length-1)):Ba(n)?Ux(r,n,0,n.length-1):Ba(e.text)&&pC(r,""):e.text!==t.text&&(Ba(n)&&Ux(r,n,0,n.length-1),pC(r,t.text)))}function Ele(e,t){if(Kv(e,t))Oh(e,t);else{var r=e.elm,n=nW(r);bg(t),n!==null&&(Du(n,t.elm,iW(r)),Ux(n,[e],0,0))}return t}var Rle=0,jle=function(){function e(t,r,n){if(this.type="svg",this.configLayer=Ole(),this.storage=r,this._opts=n=ee({},n),this.root=t,this._id="zr"+Rle++,this._oldVNode=_O(n.width,n.height),t&&!n.ssr){var i=this._viewport=document.createElement("div");i.style.cssText="position:relative;overflow:hidden";var a=this._svgDom=this._oldVNode.elm=X8("svg");UI(null,this._oldVNode),i.appendChild(a),t.appendChild(i)}this.resize(n.width,n.height)}return e.prototype.getType=function(){return this.type},e.prototype.getViewportRoot=function(){return this._viewport},e.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},e.prototype.getSvgDom=function(){return this._svgDom},e.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",Ele(this._oldVNode,t),this._oldVNode=t}},e.prototype.renderOneToVNode=function(t){return MO(t,JM(this._id))},e.prototype.renderToVNode=function(t){t=t||{};var r=this.storage.getDisplayList(!0),n=this._width,i=this._height,a=JM(this._id);a.animation=t.animation,a.willUpdate=t.willUpdate,a.compress=t.compress,a.emphasis=t.emphasis,a.ssr=this._opts.ssr;var o=[],s=this._bgVNode=zle(n,i,this._backgroundColor,a);s&&o.push(s);var l=t.compress?null:this._mainVNode=Er("g","main",{},[]);this._paintList(r,a,l?l.children:o),l&&o.push(l);var u=ae(tt(a.defs),function(f){return a.defs[f]});if(u.length&&o.push(Er("defs","defs",{},u)),t.animation){var c=ple(a.cssNodes,a.cssAnims,{newline:!0});if(c){var h=Er("style","stl",{},[],c);o.push(h)}}return _O(n,i,o,t.useViewBox)},e.prototype.renderToString=function(t){return t=t||{},FI(this.renderToVNode({animation:_e(t.cssAnimation,!0),emphasis:_e(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:_e(t.useViewBox,!0)}),{newline:!0})},e.prototype.setBackgroundColor=function(t){this._backgroundColor=t},e.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},e.prototype._paintList=function(t,r,n){for(var i=t.length,a=[],o=0,s,l,u=0,c=0;c=0&&!(f&&l&&f[m]===l[m]);m--);for(var y=g-1;y>m;y--)o--,s=a[o-1];for(var _=m+1;_=s)}}for(var h=PO(this),f=h.startIdx;f=0)&&(o=!0)}),!(!o&&!a.__dirty)){var s=n._opts.useDirtyRect&&!gC(a)?a.createRepaintRects(t,r,n._width,n._height):null,l=n._i.layerStack[0],u=!0;if(a.__dirty){u=!1,a.__dirty=!1;var c=a.zlevel===l.zl&&a.zlevel2===l.zl2?n._backgroundColor:null;a.clear(!1,c,s)}n0(a,function(h){var f=n._paintPerCursor(a,h,t,s,u);i=i&&f})}},i0),rt.wxa&&fn(this._i,function(a){a&&a.ctx&&a.ctx.draw&&a.ctx.draw()}),i},e.prototype._paintPerCursor=function(t,r,n,i,a){var o=t.ctx;if(i)if(!i.length)r.drawIdx=r.endIdx;else for(var s=this.dpr,l=0;l=r.endIdx},e.prototype._paintPerCursorInRect=function(t,r,n,i,a){for(var o={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:a}},s=t.ctx,l=gC(t),u=l&&Rr.getTime(),c=r.drawIdx,h=r.notClearIdx,f=h>=0?Math.min(h,c):c;f15){f++;break}}}}xf(s,o),r.drawIdx=Math.max(f,c)},e.prototype.getLayer=function(t,r){return this._ensureLayer(t,0,r)},e.prototype._ensureLayer=function(t,r,n){r=r||0;var i=this._singleCanvas;i&&!this._needsManuallyCompositing&&(t=_u,r=0);var a=_C(this._i,t)[r];return a||(a=EO("zr_"+t+"."+r,this,t,r),this._layerConfig[t]&&He(a,this._layerConfig[t],!0),(n||i&&t!==_u)&&(a.virtual=!0),this._insertLayer(a,t,r,!1),a.initContext()),a},e.prototype.insertLayer=function(t,r){this._insertLayer(r,t,0,!1)},e.prototype._insertLayer=function(t,r,n,i){var a=this._i,o=a.layers,s=a.layerStack,l=this._domRoot,u=null;if(!(o[r]&&o[r][n])&&Vle(t)){for(var c=s.length,h=0;h0&&(u=_C(a,s[h-1].zl)[s[h-1].zl2]),s.splice(h,0,{zl:r,zl2:n}),_C(a,r)[n]=t,!i&&!t.virtual)if(u){var f=u.dom;f.nextSibling?l.insertBefore(t.dom,f.nextSibling):l.appendChild(t.dom)}else l.firstChild?l.insertBefore(t.dom,l.firstChild):l.appendChild(t.dom);t.painter||(t.painter=this)}},e.prototype.eachLayer=function(t,r){return fn(this._i,function(n,i){t.call(r,n,i)})},e.prototype.eachBuiltinLayer=function(t,r){return fn(this._i,function(n,i){t.call(r,n,i)},Tp)},e.prototype.eachOtherLayer=function(t,r){return fn(this._i,function(n,i){t.call(r,n,i)},eA)},e.prototype.getLayers=function(){var t={};return fn(this._i,function(r,n,i){t[r.id]=r}),t},e.prototype._updateLayerStatus=function(t,r){var n=this;if(n._singleCanvas)for(var i=1;i=0;w--){var S=x.get(_[w]);if(!S.used)y.__dirty=!0,x.removeKey(_[w]),_.splice(w,1);else{var T=S.endIdxNew;(gC(y)?T=0;i--){var a=r[i];if(a.zl===t){var o=n[t][a.zl2];if(o.__builtin__)continue;if(r.splice(i,1),n[t][a.zl2]=void 0,!o.virtual){var s=o.dom.parentNode;s&&s.removeChild(o.dom)}}}},e.prototype.resize=function(t,r){if(this._domRoot.style){var n=this._domRoot;n.style.display="none";var i=this._opts,a=this.root;t!=null&&(i.width=t),r!=null&&(i.height=r),t=rf(a,0,i),r=rf(a,1,i),n.style.display="",(this._width!==t||r!==this._height)&&(n.style.width=t+"px",n.style.height=r+"px",fn(this._i,function(o){o.resize(t,r)}),this.refresh({paintAll:!0})),this._width=t,this._height=r}else{if(t==null||r==null)return;this._width=t,this._height=r,this._ensureLayer(_u).resize(t,r)}return this},e.prototype.clearLayer=function(t){E(this._i.layers[t],function(r){r&&!r.__builtin__&&r.clear()})},e.prototype.dispose=function(){this.root.innerHTML="",this.root=this.storage=this._domRoot=this._i=null},e.prototype.getRenderedCanvas=function(t){if(t=t||{},this._singleCanvas&&!this._compositeManually)return this._i.layers[_u][0].dom;var r=new oW("image",this,t.pixelRatio||this.dpr);r.initContext(),r.clear(!1,t.backgroundColor||this._backgroundColor);var n=r.ctx;if(t.pixelRatio<=this.dpr){this.refresh();var i=r.dom.width,a=r.dom.height;fn(this._i,function(h){h.__builtin__?n.drawImage(h.dom,0,0,i,a):h.renderToCanvas&&(n.save(),h.renderToCanvas(n),n.restore())})}else{for(var o={inHover:!1,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{}},s=this.storage.getDisplayList(!0),l=0,u=s.length;l-1&&(u.style.stroke=u.style.fill,u.style.fill=K.color.neutral00,u.style.lineWidth=2),n},t.type="series.line",t.dependencies=["grid","polar"],t.defaultOption={z:3,coordinateSystem:"cartesian2d",legendHoverLink:!0,clip:!0,label:{position:"top"},endLabel:{show:!1,valueAnimation:!0,distance:8},lineStyle:{width:2,type:"solid"},emphasis:{scale:!0},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:6,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1,triggerEvent:!1},t}(At);function Zf(e,t){var r=e.mapDimensionsAll("defaultedLabel"),n=r.length;if(n===1){var i=Ff(e,t,r[0]);return i!=null?i+"":null}else if(n){for(var a=[],o=0;o=0&&n.push(t[a])}return n.join(" ")}var fm=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this)||this;return o.updateData(r,n,i,a),o}return t.prototype._createSymbol=function(r,n,i,a,o,s){this.removeAll();var l=dr(r,-1,-1,2,2,null,s);l.attr({z2:_e(o,100),culling:!0,scaleX:a[0]/2,scaleY:a[1]/2}),l.drift=Yle,this._symbolType=r,this.add(l)},t.prototype.stopSymbolAnimation=function(r){this.childAt(0).stopAnimation(null,r)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){hs(this.childAt(0))},t.prototype.downplay=function(){fs(this.childAt(0))},t.prototype.setZ=function(r,n){var i=this.childAt(0);i.zlevel=r,i.z=n},t.prototype.setDraggable=function(r,n){var i=this.childAt(0);i.draggable=r,i.cursor=!n&&r?"move":i.cursor},t.prototype.updateData=function(r,n,i,a){this.silent=!1;var o=r.getItemVisual(n,"symbol")||"circle",s=r.hostModel,l=t.getSymbolSize(r,n),u=t.getSymbolZ2(r,n),c=o!==this._symbolType,h=a&&a.disableAnimation;if(c){var f=r.getItemVisual(n,"symbolKeepAspect");this._createSymbol(o,r,n,l,u,f)}else{var d=this.childAt(0);d.silent=!1;var g={scaleX:l[0]/2,scaleY:l[1]/2};h?d.attr(g):lt(d,g,s,n),$i(d)}if(this._updateCommon(r,n,l,i,a),c){var d=this.childAt(0);if(!h){var g={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:d.style.opacity}};d.scaleX=d.scaleY=0,d.style.opacity=0,jt(d,g,s,n)}}h&&this.childAt(0).stopAnimation("leave")},t.prototype._updateCommon=function(r,n,i,a,o){var s=this.childAt(0),l=r.hostModel,u,c,h,f,d,g,m,y,_;if(a&&(u=a.emphasisItemStyle,c=a.blurItemStyle,h=a.selectItemStyle,f=a.focus,d=a.blurScope,m=a.labelStatesModels,y=a.hoverScale,_=a.cursorStyle,g=a.emphasisDisabled),!a||r.hasItemOption){var x=a&&a.itemModel?a.itemModel:r.getItemModel(n),w=x.getModel("emphasis");u=w.getModel("itemStyle").getItemStyle(),h=x.getModel(["select","itemStyle"]).getItemStyle(),c=x.getModel(["blur","itemStyle"]).getItemStyle(),f=w.get("focus"),d=w.get("blurScope"),g=w.get("disabled"),m=Ar(x),y=w.getShallow("scale"),_=x.getShallow("cursor")}var S=r.getItemVisual(n,"symbolRotate");s.attr("rotation",(S||0)*Math.PI/180||0);var T=Xc(r.getItemVisual(n,"symbolOffset"),i);T&&(s.x=T[0],s.y=T[1]),_&&s.attr("cursor",_);var M=r.getItemVisual(n,"style"),A=M.fill;if(s instanceof zr){var N=s.style;s.useStyle(ee({image:N.image,x:N.x,y:N.y,width:N.width,height:N.height},M))}else s.__isEmptyBrush?s.useStyle(ee({},M)):s.useStyle(M),s.style.decal=null,s.setColor(A,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var P=r.getItemVisual(n,"liftZ"),I=this._z2;P!=null?I==null&&(this._z2=s.z2,s.z2+=P):I!=null&&(s.z2=I,this._z2=null);var D=o&&o.useNameLabel;Or(s,m,{labelFetcher:l,labelDataIndex:n,defaultText:O,inheritColor:A,defaultOpacity:M.opacity});function O(U){return D?r.getName(U):Zf(r,U)}this._sizeX=i[0]/2,this._sizeY=i[1]/2;var j=s.ensureState("emphasis");j.style=u,s.ensureState("select").style=h,s.ensureState("blur").style=c;var B=y==null||y===!0?Math.max(1.1,3/this._sizeY):isFinite(y)&&y>0?+y:1;j.scaleX=this._sizeX*B,j.scaleY=this._sizeY*B,this.setSymbolScale(1),Vt(this,f,d,g)},t.prototype.setSymbolScale=function(r){this.scaleX=this.scaleY=r},t.prototype.fadeOut=function(r,n,i){var a=this.childAt(0),o=Re(this).dataIndex,s=i&&i.animation;if(this.silent=a.silent=!0,i&&i.fadeLabel){var l=a.getTextContent();l&&Al(l,{style:{opacity:0}},n,{dataIndex:o,removeOpt:s,cb:function(){a.removeTextContent()}})}else a.removeTextContent();Al(a,{style:{opacity:0},scaleX:0,scaleY:0},n,{dataIndex:o,cb:r,removeOpt:s})},t.getSymbolSize=function(r,n){return Sd(r.getItemVisual(n,"symbolSize"))},t.getSymbolZ2=function(r,n){return r.getItemVisual(n,"z2")},t}(Me);function Yle(e,t){this.parent.drift(e,t)}function a0(e,t,r,n){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(n&&n.isIgnore&&n.isIgnore(r))&&!(n&&n.clipShape&&!n.clipShape.contain(t[0],t[1]))&&e.getItemVisual(r,"symbol")!=="none"}function RO(e){return e!=null&&!Ie(e)&&(e={isIgnore:e}),e||{}}function jO(e){var t=e.hostModel,r=t.getModel("emphasis");return{emphasisItemStyle:r.getModel("itemStyle").getItemStyle(),blurItemStyle:t.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:t.getModel(["select","itemStyle"]).getItemStyle(),focus:r.get("focus"),blurScope:r.get("blurScope"),emphasisDisabled:r.get("disabled"),hoverScale:r.get("scale"),labelStatesModels:Ar(t),cursorStyle:t.get("cursor")}}function OO(e,t,r,n,i,a,o){var s=new e(t,r,n,i);return s.setPosition(a),t.setItemGraphicEl(r,s),o.add(s),s}var dm=function(){function e(t){this.group=new Me,this._SymbolCtor=t||fm}return e.prototype.updateData=function(t,r){this._progressiveEls=null,r=RO(r);var n=this.group,i=t.hostModel,a=this._data,o=this._SymbolCtor,s=r.disableAnimation,l=this._seriesScope=jO(t),u={disableAnimation:s},c=r.getSymbolPoint||function(h){return t.getItemLayout(h)};a||n.removeAll(),t.diff(a).add(function(h){var f=c(h);a0(t,f,h,r)&&OO(o,t,h,l,u,f,n)}).update(function(h,f){var d=a.getItemGraphicEl(f),g=c(h);if(!a0(t,g,h,r)){n.remove(d);return}var m=t.getItemVisual(h,"symbol")||"circle",y=d&&d.getSymbolType&&d.getSymbolType();if(!d||y&&y!==m)n.remove(d),d=new o(t,h,l,u),d.setPosition(g);else{d.updateData(t,h,l,u);var _={x:g[0],y:g[1]};s?d.attr(_):lt(d,_,i)}n.add(d),t.setItemGraphicEl(h,d)}).remove(function(h){var f=a.getItemGraphicEl(h);f&&f.fadeOut(function(){n.remove(f)},i)}).execute(),this._getSymbolPoint=c,this._data=t},e.prototype.updateLayout=function(t){var r=this._data;if(r)for(var n=this,i=r.getStore(),a=0,o=i.count();a0?r=n[0]:n[1]<0&&(r=n[1]),r}function hW(e,t,r,n){var i=NaN;e.stacked&&(i=r.get(r.getCalculationInfo("stackedOverDimension"),n)),isNaN(i)&&(i=e.valueStart);var a=e.baseDataOffset,o=[];return o[a]=r.get(e.baseDim,n),o[1-a]=i,t.dataToPoint(o)}function zi(e,t){return!isFinite(e)||!isFinite(t)}var qle=typeof Float32Array!==hd?Float32Array:void 0,Kle=typeof Float64Array!==hd?Float64Array:void 0;function Za(e){return WI({ctor:qle},e).arr}function WI(e,t){var r=e.arr,n=e.ctor;if(t>ag&&(t=ag),!r||e.typed&&r.length=i||m<0)break;if(zi(_,x)){if(l){m+=a;continue}break}if(m===r)e[a>0?"moveTo":"lineTo"](_,x),h=_,f=x;else{var w=_-u,S=x-c;if(w*w+S*S<.5){m+=a;continue}if(o>0){for(var T=m+a,M=t[T*2],A=t[T*2+1];M===_&&A===x&&y=n||zi(M,A))d=_,g=x;else{I=M-u,D=A-c;var B=_-u,U=M-_,H=x-c,V=A-x,z=void 0,$=void 0;if(s==="x"){z=Math.abs(B),$=Math.abs(U);var W=I>0?1:-1;d=_-W*z*o,g=x,O=_+W*$*o,j=x}else if(s==="y"){z=Math.abs(H),$=Math.abs(V);var Z=D>0?1:-1;d=_,g=x-Z*z*o,O=_,j=x+Z*$*o}else z=Math.sqrt(B*B+H*H),$=Math.sqrt(U*U+V*V),P=$/($+z),d=_-I*o*(1-P),g=x-D*o*(1-P),O=_+I*o*P,j=x+D*o*P,O=Ns(O,Ps(M,_)),j=Ns(j,Ps(A,x)),O=Ps(O,Ns(M,_)),j=Ps(j,Ns(A,x)),I=O-_,D=j-x,d=_-I*z/$,g=x-D*z/$,d=Ns(d,Ps(u,_)),g=Ns(g,Ps(c,x)),d=Ps(d,Ns(u,_)),g=Ps(g,Ns(c,x)),I=_-d,D=x-g,O=_+I*$/z,j=x+D*$/z}e.bezierCurveTo(h,f,d,g,_,x),h=O,f=j}else e.lineTo(_,x)}u=_,c=x,m+=a}return y}var fW=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),eue=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="ec-polyline",n}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new fW},t.prototype.buildPath=function(r,n){var i=n.points,a=0,o=i.length/2;if(n.connectNulls){for(;o>0&&zi(i[o*2-2],i[o*2-1]);o--);for(;a=0){var S=u?(g-l)*w+l:(d-s)*w+s;return u?[r,S]:[S,r]}s=d,l=g;break;case o.C:d=a[h++],g=a[h++],m=a[h++],y=a[h++],_=a[h++],x=a[h++];var T=u?ix(s,d,m,_,r,c):ix(l,g,y,x,r,c);if(T>0)for(var M=0;M=0){var S=u?Pr(l,g,y,x,A):Pr(s,d,m,_,A);return u?[r,S]:[S,r]}}s=_,l=x;break}}},t}(Qe),tue=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(fW),dW=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="ec-polygon",n}return t.prototype.getDefaultShape=function(){return new tue},t.prototype.buildPath=function(r,n){var i=n.points,a=n.stackedOnPoints,o=0,s=i.length/2,l=n.smoothMonotone;if(n.connectNulls){for(;s>0&&zi(i[s*2-2],i[s*2-1]);s--);for(;o=0,a=e.fill||K.color.neutral99;VO(n,t);var o=n.textFill==null;return i?o&&(n.textFill=r.insideFill||K.color.neutral00,!n.textStroke&&r.insideStroke&&(n.textStroke=r.insideStroke),!n.textStroke&&(n.textStroke=a),n.textStrokeWidth==null&&(n.textStrokeWidth=2)):(o&&(n.textFill=e.fill||r.outsideFill||K.color.neutral00),!n.textStroke&&r.outsideStroke&&(n.textStroke=r.outsideStroke)),n.text=t.text,n.rich=t.rich,E(t.rich,function(s){VO(s,s)}),n}function VO(e,t){t&&(ge(t,"fill")&&(e.textFill=t.fill),ge(t,"stroke")&&(e.textStroke=t.fill),ge(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),ge(t,"font")&&(e.font=t.font),ge(t,"fontStyle")&&(e.fontStyle=t.fontStyle),ge(t,"fontWeight")&&(e.fontWeight=t.fontWeight),ge(t,"fontSize")&&(e.fontSize=t.fontSize),ge(t,"fontFamily")&&(e.fontFamily=t.fontFamily),ge(t,"align")&&(e.textAlign=t.align),ge(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),ge(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),ge(t,"width")&&(e.textWidth=t.width),ge(t,"height")&&(e.textHeight=t.height),ge(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),ge(t,"padding")&&(e.textPadding=t.padding),ge(t,"borderColor")&&(e.textBorderColor=t.borderColor),ge(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),ge(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),ge(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),ge(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),ge(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),ge(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),ge(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),ge(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),ge(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),ge(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}function GO(e,t){if(e.length===t.length){for(var r=0;rt){a?r.push(o(a,l,t)):i&&r.push(o(i,l,0),o(i,l,t));break}else i&&(r.push(o(i,l,0)),i=null),r.push(l),a=l}return r}function iue(e,t,r){var n=e.getVisual("visualMeta");if(!(!n||!n.length||!e.count())&&t.type==="cartesian2d"){for(var i,a,o=n.length-1;o>=0;o--){var s=e.getDimensionInfo(n[o].dimension);if(i=s&&s.coordDim,i==="x"||i==="y"){a=n[o];break}}if(a){var l=t.getAxis(i),u=ae(a.stops,function(w){return{coord:l.toGlobalCoord(l.dataToCoord(w.value)),color:w.color}}),c=u.length,h=a.outerColors.slice();c&&u[0].coord>u[c-1].coord&&(u.reverse(),h.reverse());var f=nue(u,i==="x"?r.getWidth():r.getHeight()),d=f.length;if(!d&&c)return u[0].coord<0?h[1]?h[1]:u[c-1].color:h[0]?h[0]:u[0].color;var g=10,m=f[0].coord-g,y=f[d-1].coord+g,_=y-m;if(_<.001)return"transparent";E(f,function(w){w.offset=(w.coord-m)/_}),f.push({offset:d?f[d-1].offset:.5,color:h[1]||"transparent"}),f.unshift({offset:d?f[0].offset:.5,color:h[0]||"transparent"});var x=new Uc(0,0,0,0,f,!0);return x[i]=m,x[i+"2"]=y,x}}}function aue(e,t,r){var n=e.get("showAllSymbol"),i=n==="auto";if(!(n&&!i)){var a=r.getAxesByScale("ordinal")[0];if(a&&!(i&&oue(a,t))){var o=t.mapDimension(a.dim),s={};return E(a.getViewLabels(),function(l){l.tick.offInterval||(s[Md(a.scale,l.tick)]=1)}),function(l){return!s.hasOwnProperty(t.get(o,l))}}}}function oue(e,t){var r=e.getExtent(),n=Math.abs(r[1]-r[0])/e.scale.count();isNaN(n)&&(n=0);for(var i=t.count(),a=Math.max(1,Math.round(i/5)),o=0;on)return!1;return!0}function sue(e){for(var t=e.length/2;t>0&&zi(e[t*2-2],e[t*2-1]);t--);return t-1}function ZO(e,t){return[e[t*2],e[t*2+1]]}function lue(e,t,r){for(var n=e.length/2,i=r==="x"?0:1,a,o,s=0,l=-1,u=0;u=t||a>=t&&o<=t){l=u;break}s=u,a=o}return{range:[s,l],t:(t-a)/(o-a)}}function _W(e){if(e.get(["endLabel","show"]))return!0;for(var t=0;t0&&r.get(["emphasis","lineStyle","width"])==="bolder"){var $=g.getState("emphasis").style;$.lineWidth=+g.style.lineWidth+1}Re(g).seriesIndex=r.seriesIndex,Vt(g,H,V,z);var W=WO(r.get("smooth")),Z=r.get("smoothMonotone");if(g.setShape({smooth:W,smoothMonotone:Z,connectNulls:A}),m){var X=s.getCalculationInfo("stackedOnSeries"),re=0;m.useStyle(ke(u.getAreaStyle(),{fill:O,opacity:.7,lineJoin:"bevel",decal:s.getVisual("style").decal})),X&&(re=WO(X.get("smooth"))),m.setShape({smooth:W,stackedOnSmooth:re,smoothMonotone:Z,connectNulls:A}),Mr(m,r,"areaStyle"),Re(m).seriesIndex=r.seriesIndex,Vt(m,H,V,z)}var J=this._changePolyState;s.eachItemGraphicEl(function(ve){ve&&(ve.onHoverStateChange=J)}),this._polyline.onHoverStateChange=J,this._data=s,this._coordSys=a,this._stackedOnPoints=T,this._points=c,this._step=I,this._valueOrigin=w;var oe=r.get("triggerEvent"),le=r.get("triggerLineEvent"),De=le===!0||oe===!0||oe==="line",we=le===!0||oe===!0||oe==="area";this.packEventData(r,g,De),m&&this.packEventData(r,m,we)},t.prototype.packEventData=function(r,n,i){Re(n).eventData=i?{componentType:"series",componentSubType:"line",componentIndex:r.componentIndex,seriesIndex:r.seriesIndex,seriesName:r.name,seriesType:"line",selfType:n===this._polygon?"area":"line"}:null},t.prototype.highlight=function(r,n,i,a){var o=r.getData(),s=vc(o,a);if(this._changePolyState("emphasis"),!(s instanceof Array)&&s!=null&&s>=0){var l=o.getLayout("points"),u=o.getItemGraphicEl(s);if(!u){var c=l[s*2],h=l[s*2+1];if(zi(c,h)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,h))return;var f=r.get("zlevel")||0,d=r.get("z")||0;u=new fm(o,s),u.x=c,u.y=h,u.setZ(f,d);var g=u.getSymbolPath().getTextContent();g&&(g.zlevel=f,g.z=d,g.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else wt.prototype.highlight.call(this,r,n,i,a)},t.prototype.downplay=function(r,n,i,a){var o=r.getData(),s=vc(o,a);if(this._changePolyState("normal"),s!=null&&s>=0){var l=o.getItemGraphicEl(s);l&&(l.__temp?(o.setItemGraphicEl(s,null),this.group.remove(l)):l.downplay())}else wt.prototype.downplay.call(this,r,n,i,a)},t.prototype._changePolyState=function(r){var n=this._polygon;gx(this._polyline,r),n&&gx(n,r)},t.prototype._newPolyline=function(r){var n=this._polyline;return n&&this._lineGroup.remove(n),n=new eue({shape:{points:r},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(n),this._polyline=n,n},t.prototype._newPolygon=function(r,n){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new dW({shape:{points:r,stackedOnPoints:n},segmentIgnoreThreshold:2}),this._lineGroup.add(i),this._polygon=i,i},t.prototype._initSymbolLabelAnimation=function(r,n,i){var a,o,s=n.getBaseAxis(),l=s.inverse;n.type==="cartesian2d"?(a=s.isHorizontal(),o=!1):n.type==="polar"&&(a=s.dim==="angle",o=!0);var u=r.hostModel,c=u.get("animationDuration");Ce(c)&&(c=c(null));var h=u.get("animationDelay")||0,f=Ce(h)?h(null):h;r.eachItemGraphicEl(function(d,g){var m=d;if(m){var y=[d.x,d.y],_=void 0,x=void 0,w=void 0;if(i)if(o){var S=i,T=n.pointToCoord(y);a?(_=S.startAngle,x=S.endAngle,w=-T[1]/180*Math.PI):(_=S.r0,x=S.r,w=T[0])}else{var M=i;a?(_=M.x,x=M.x+M.width,w=d.x):(_=M.y+M.height,x=M.y,w=d.y)}var A=x===_?0:(w-_)/(x-_);l&&(A=1-A);var N=Ce(h)?h(g):c*A+f,P=m.getSymbolPath(),I=P.getTextContent();m.attr({scaleX:0,scaleY:0}),m.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:N}),I&&I.animateFrom({style:{opacity:0}},{duration:300,delay:N}),P.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(r,n,i){var a=r.getModel("endLabel");if(_W(r)){var o=r.getData(),s=this._polyline,l=o.getLayout("points");if(!l){s.removeTextContent(),this._endLabel=null;return}var u=this._endLabel;u||(u=this._endLabel=new it({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=sue(l);c>=0&&(Or(s,Ar(r,"endLabel"),{inheritColor:i,labelFetcher:r,labelDataIndex:c,defaultText:function(h,f,d){return d!=null?uW(o,d):Zf(o,h)},enableTextSetter:!0},uue(a,n)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},t.prototype._endLabelOnDuring=function(r,n,i,a,o,s,l){var u=this._endLabel,c=this._polyline;if(u){r<1&&a.originalX==null&&(a.originalX=u.x,a.originalY=u.y);var h=i.getLayout("points"),f=i.hostModel,d=f.get("connectNulls"),g=s.get("precision"),m=s.get("distance")||0,y=l.getBaseAxis(),_=y.isHorizontal(),x=y.inverse,w=n.shape,S=x?_?w.x:w.y+w.height:_?w.x+w.width:w.y,T=(_?m:0)*(x?-1:1),M=(_?0:-m)*(x?-1:1),A=_?"x":"y",N=lue(h,S,A),P=N.range,I=P[1]-P[0],D=void 0;if(I>=1){if(I>1&&!d){var O=ZO(h,P[0]);u.attr({x:O[0]+T,y:O[1]+M}),o&&(D=f.getRawValue(P[0]))}else{var O=c.getPointOn(S,A);O&&u.attr({x:O[0]+T,y:O[1]+M});var j=f.getRawValue(P[0]),B=f.getRawValue(P[1]);o&&(D=gG(i,g,j,B,N.t))}a.lastFrameIndex=P[0]}else{var U=r===1||a.lastFrameIndex>0?P[0]:0,O=ZO(h,U);o&&(D=f.getRawValue(U)),u.attr({x:O[0]+T,y:O[1]+M})}if(o){var H=yd(u);typeof H.setLabelText=="function"&&H.setLabelText(D)}}},t.prototype._doUpdateAnimation=function(r,n,i,a,o,s,l){var u=this._polyline,c=this._polygon,h=r.hostModel,f=Qle(this._data,r,this._stackedOnPoints,n,this._coordSys,i,this._valueOrigin),d=f.current,g=f.stackedOnCurrent,m=f.next,y=f.stackedOnNext;if(o&&(g=Ds(f.stackedOnCurrent,f.current,i,o,l),d=Ds(f.current,null,i,o,l),y=Ds(f.stackedOnNext,f.next,i,o,l),m=Ds(f.next,null,i,o,l)),UO(d,m)>3e3||c&&UO(g,y)>3e3){u.stopAnimation(),u.setShape({points:m}),c&&(c.stopAnimation(),c.setShape({points:m,stackedOnPoints:y}));return}u.shape.__points=f.current,u.shape.points=d;var _={shape:{points:m}};f.current!==d&&(_.shape.__points=f.next),u.stopAnimation(),lt(u,_,h),c&&(c.setShape({points:d,stackedOnPoints:g}),c.stopAnimation(),lt(c,{shape:{stackedOnPoints:y}},h),u.shape.points!==c.shape.points&&(c.shape.points=u.shape.points));for(var x=[],w=f.status,S=0;St&&(t=e[r]);return isFinite(t)?t:NaN},min:function(e){for(var t=1/0,r=0;r10&&o.type==="cartesian2d"&&a){var l=o.getBaseAxis(),u=o.getOtherAxis(l),c=l.getExtent(),h=n.getDevicePixelRatio(),f=Math.abs(c[1]-c[0])*(h||1),d=Math.round(s/f);if(isFinite(d)&&d>1){a==="lttb"?t.setData(i.lttbDownSample(i.mapDimension(u.dim),1/d)):a==="minmax"&&t.setData(i.minmaxDownSample(i.mapDimension(u.dim),1/d));var g=void 0;ue(a)?g=hue[a]:Ce(a)&&(g=a),g&&t.setData(i.downSample(i.mapDimension(u.dim),1/d,g,fue))}}}}}function due(e){e.registerChartView(cue),e.registerSeriesModel($le),e.registerLayout(vm("line",!0)),e.registerVisual({seriesType:"line",reset:function(t){var r=t.getData(),n=t.getModel("lineStyle").getLineStyle();n&&!n.stroke&&(n.stroke=r.getVisual("style").fill),r.setVisual("legendLineStyle",n)}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,xW("line"))}var bW=function(e){q(t,e);function t(r,n,i,a,o){var s=e.call(this,r,n,i)||this;return s.index=0,s.type=a||"value",s.position=o||"bottom",s}return t.prototype.isHorizontal=function(){var r=this.position;return r==="top"||r==="bottom"},t.prototype.getGlobalExtent=function(r){var n=this.getExtent();return n[0]=this.toGlobalCoord(n[0]),n[1]=this.toGlobalCoord(n[1]),r&&n[0]>n[1]&&n.reverse(),n},t.prototype.pointToData=function(r,n){return this.coordToData(this.toLocalCoord(r[this.dim==="x"?0:1]),n)},t.prototype.setCategorySortInfo=function(r){if(this.type!=="category")return!1;this.model.option.categorySortInfo=r,this.scale.setSortInfo(r)},t}(Ki),rA=null;function vue(e){rA||(rA=e)}function pm(){return rA}var Eb="expandAxisBreak",wW="collapseAxisBreak",SW="toggleAxisBreak",ZI="axisbreakchanged",pue={type:Eb,event:ZI,update:"update",refineEvent:$I},gue={type:wW,event:ZI,update:"update",refineEvent:$I},mue={type:SW,event:ZI,update:"update",refineEvent:$I};function $I(e,t,r,n){var i=[];return E(e,function(a){i=i.concat(a.eventBreaks)}),{eventContent:{breaks:i}}}function yue(e){e.registerAction(pue,t),e.registerAction(gue,t),e.registerAction(mue,t);function t(r,n){var i=[],a=pf(n,r);function o(s,l){E(a[s],function(u){var c=u.updateAxisBreaks(r);E(c.breaks,function(h){var f;i.push(ke((f={},f[l]=u.componentIndex,f),h))})})}return o("xAxisModels","xAxisIndex"),o("yAxisModels","yAxisIndex"),o("singleAxisModels","singleAxisIndex"),{eventBreaks:i}}}var Qs=Math.PI,_ue=[[1,2,1,2],[5,3,5,3],[8,3,8,3]],xue=[[0,1,0,1],[0,3,0,3],[0,3,0,3]],Ac=Ue(),CW=Ue(),TW=function(){function e(t){this.recordMap={},this.resolveAxisNameOverlap=t}return e.prototype.ensureRecord=function(t){var r=t.axis.dim,n=t.componentIndex,i=this.recordMap,a=i[r]||(i[r]=[]);return a[n]||(a[n]={ready:{}})},e}();function bue(e,t,r,n){var i=r.axis,a=t.ensureRecord(r),o=[],s,l=YI(e.axisName)&&Hf(e.nameLocation);E(n,function(g){var m=po(g);if(!(!m||m.label.ignore)){o.push(m);var y=a.transGroup;l&&(y.transform?fi(wv,y.transform):Fc(wv),m.transform&&ci(wv,wv,m.transform),Ae.copy(o0,m.localRect),o0.applyTransform(wv),s?s.union(o0):Ae.copy(s=new Ae(0,0,0,0),o0))}});var u=Math.abs(a.dirVec.x)>.1?"x":"y",c=a.transGroup[u];if(o.sort(function(g,m){return Math.abs(g.label[u]-c)-Math.abs(m.label[u]-c)}),l&&s){var h=i.getExtent(),f=Math.min(h[0],h[1]),d=Math.max(h[0],h[1])-f;s.union(new Ae(f,0,d,1))}a.stOccupiedRect=s,a.labelInfoList=o}var wv=Ft(),o0=new Ae(0,0,0,0),MW=function(e,t,r,n,i,a){if(Hf(e.nameLocation)){var o=a.stOccupiedRect;o&&AW(Jse({},o,a.transGroup.transform),n,i)}else kW(a.labelInfoList,a.dirVec,n,i)};function AW(e,t,r){var n=new Pe;Pb(e,t,n,{direction:Math.atan2(r.y,r.x),bidirectional:!1,touchThreshold:.05})&&YM(t,n)}function kW(e,t,r,n){for(var i=Pe.dot(n,t)>=0,a=0,o=e.length;a0?"top":"bottom",a="center"):fc(i-Qs)?(o=n>0?"bottom":"top",a="center"):(o="middle",i>0&&i0?"right":"left":a=n>0?"left":"right"),{rotation:i,textAlign:a,textVerticalAlign:o}},e.makeAxisEventDataBase=function(t){var r={componentType:t.mainType,componentIndex:t.componentIndex};return r[t.mainType+"Index"]=t.componentIndex,r},e.isLabelSilent=function(t){var r=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||r&&r.show)},e}(),wue=["axisLine","axisTickLabelEstimate","axisTickLabelDetermine","axisName"],Sue={axisLine:function(e,t,r,n,i,a,o){var s=n.get(["axisLine","show"]);if(s==="auto"&&(s=!0,e.raw.axisLineAutoShow!=null&&(s=!!e.raw.axisLineAutoShow)),!!s){var l=n.axis.getExtent(),u=a.transform,c=[l[0],0],h=[l[1],0],f=c[0]>h[0];u&&(Kt(c,c,u),Kt(h,h,u));var d=ee({lineCap:"round"},n.getModel(["axisLine","lineStyle"]).getLineStyle()),g={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:d};if(n.get(["axisLine","breakLine"])&&xx(n.axis.scale))pm().buildAxisBreakLine(n,i,a,g);else{var m=new cr(ee({shape:{x1:c[0],y1:c[1],x2:h[0],y2:h[1]}},g));Bf(m.shape,m.style.lineWidth),m.anid="line",i.add(m)}var y=n.get(["axisLine","symbol"]);if(y!=null){var _=n.get(["axisLine","symbolSize"]);ue(y)&&(y=[y,y]),(ue(_)||at(_))&&(_=[_,_]);var x=Xc(n.get(["axisLine","symbolOffset"])||0,_),w=_[0],S=_[1];E([{rotate:e.rotation+Math.PI/2,offset:x[0],r:0},{rotate:e.rotation-Math.PI/2,offset:x[1],r:Math.sqrt((c[0]-h[0])*(c[0]-h[0])+(c[1]-h[1])*(c[1]-h[1]))}],function(T,M){if(y[M]!=="none"&&y[M]!=null){var A=dr(y[M],-w/2,-S/2,w,S,d.stroke,!0),N=T.r+T.offset,P=f?h:c;A.attr({rotation:T.rotate,x:P[0]+N*Math.cos(e.rotation),y:P[1]-N*Math.sin(e.rotation),silent:!0,z2:11}),i.add(A)}})}}},axisTickLabelEstimate:function(e,t,r,n,i,a,o,s){var l=YO(t,i,s);l&&$O(e,t,r,n,i,a,o,xa.estimate)},axisTickLabelDetermine:function(e,t,r,n,i,a,o,s){var l=YO(t,i,s);l&&$O(e,t,r,n,i,a,o,xa.determine);var u=Aue(e,i,a,n);Mue(e,t.labelLayoutList,u),kue(e,i,a,n,e.tickDirection)},axisName:function(e,t,r,n,i,a,o,s){var l=r.ensureRecord(n);t.nameEl&&(i.remove(t.nameEl),t.nameEl=l.nameLayout=l.nameLocation=null);var u=e.axisName;if(YI(u)){var c=e.nameLocation,h=e.nameDirection,f=n.getModel("nameTextStyle"),d=n.get("nameGap")||0,g=n.axis.getExtent(),m=n.axis.inverse?-1:1,y=new Pe(0,0),_=new Pe(0,0);c==="start"?(y.x=g[0]-m*d,_.x=-m):c==="end"?(y.x=g[1]+m*d,_.x=m):(y.x=(g[0]+g[1])/2,y.y=e.labelOffset+h*d,_.y=h);var x=Ft();_.transform(_s(x,x,e.rotation));var w=n.get("nameRotate");w!=null&&(w=w*Qs/180);var S,T;Hf(c)?S=Nn.innerTextLayout(e.rotation,w??e.rotation,h):(S=Cue(e.rotation,c,w||0,g),T=e.raw.axisNameAvailableWidth,T!=null&&(T=Math.abs(T/Math.sin(S.rotation)),!isFinite(T)&&(T=null)));var M=f.getFont(),A=n.get("nameTruncate",!0)||{},N=A.ellipsis,P=mn(e.raw.nameTruncateMaxWidth,A.maxWidth,T),I=s.nameMarginLevel||0,D=new it({x:y.x,y:y.y,rotation:S.rotation,silent:Nn.isLabelSilent(n),style:Lt(f,{text:u,font:M,overflow:"truncate",width:P,ellipsis:N,fill:f.getTextColor()||n.get(["axisLine","lineStyle","color"]),align:f.get("align")||S.textAlign,verticalAlign:f.get("verticalAlign")||S.textVerticalAlign}),z2:1});if(bs({el:D,componentModel:n,itemName:u}),D.__fullText=u,D.anid="name",n.get("triggerEvent")){var O=Nn.makeAxisEventDataBase(n);O.targetType="axisName",O.name=u,Re(D).eventData=O}a.add(D),D.updateTransform(),t.nameEl=D;var j=l.nameLayout=po({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:Hf(c)?_ue[I]:xue[I]});if(l.nameLocation=c,i.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&j){var B=r.ensureRecord(n);r.resolveAxisNameOverlap(e,r,n,j,_,B)}}}};function $O(e,t,r,n,i,a,o,s){IW(t)||Lue(e,t,i,s,n,o);var l=t.labelLayoutList;Iue(e,n,l,a),Due(n,e.rotation,l);var u=e.optionHideOverlap;Tue(n,l,u),u&&U8(mt(l,function(c){return c&&!c.label.ignore})),bue(e,r,n,l)}function Cue(e,t,r,n){var i=yL(r-e),a,o,s=n[0]>n[1],l=t==="start"&&!s||t!=="start"&&s;return fc(i-Qs/2)?(o=l?"bottom":"top",a="center"):fc(i-Qs*1.5)?(o=l?"top":"bottom",a="center"):(o="middle",iQs/2?a=l?"left":"right":a=l?"right":"left"),{rotation:i,textAlign:a,textVerticalAlign:o}}function Tue(e,t,r){var n=e.axis,i=e.get(["axisLabel","customValues"]);if(zoe(n))return;function a(u,c,h){var f=po(t[c]),d=po(t[h]),g=n.scale;if(!(!f||!d)){if(u==null){if(!r&&i)return;var m=Ac(f.label).labelInfo.tick;if(lm(g)&&m.notNice||bn(g)&&m.offInterval){zh(f.label);return}}if(u===!1||f.suggestIgnore){zh(f.label);return}if(d.suggestIgnore){zh(d.label);return}var y=.1;if(!r){var _=[0,0,0,0];f=XM({marginForce:_},f),d=XM({marginForce:_},d)}Pb(f,d,null,{touchThreshold:y})&&zh(u?d.label:f.label)}}var o=e.get(["axisLabel","showMinLabel"]),s=e.get(["axisLabel","showMaxLabel"]),l=t.length;a(o,0,1),a(s,l-1,l-2)}function Mue(e,t,r){e.showMinorTicks||E(t,function(n){if(n&&n.label.ignore)for(var i=0;i=0&&w(M,S,T.getStore())})}var d=0;if(f(function(w,S,T){n.set(S.uid,1),(!i||!i.hasKey(S.uid))&&(o=!0),d+=T.count()}),(!i||i.keys().length!==n.keys().length)&&(o=!0),!o&&a!=null){t.liPosMinGap=a;return}WI(xu,d);var g=0;f(function(w,S,T){for(var M=0,A=T.count();M0&&x0?x8:Goe,r.serUids=n}var xu=WI({ctor:Kle},50);function Rb(e){return function(t,r){var n=ln(t,{fromStat:{key:e}});if(Wi(n.w2))return[-n.w2/2,n.w2/2]}}function ec(e){return e+Ox}function qc(e,t){return e+Ox+t}function XI(e){return Bue(),{liPosMinGap:!bn(e.scale)}}var eo="bar",Tg="pictorialBar";function NW(e,t,r,n){RI(e,{key:t,seriesType:r,coordSysType:n,getMetrics:XI})}function PW(e){var t=e.scale.rawExtentInfo.makeRenderInfo().startValue;return t}var DW={left:0,right:0,top:0,bottom:0},Zx=["25%","25%"],ga="cartesian2d",Vue=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(r,n){var i=$c(r.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),i&&r.outerBounds&&vo(r.outerBounds,i)},t.prototype.mergeOption=function(r,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&r.outerBounds&&vo(this.option.outerBounds,r.outerBounds)},t.type="grid",t.dependencies=["xAxis","yAxis"],t.layoutMode="box",t.defaultOption={show:!1,z:0,left:"15%",top:65,right:"10%",bottom:80,containLabel:!1,outerBoundsMode:"auto",outerBounds:DW,outerBoundsContain:"all",outerBoundsClampWidth:Zx[0],outerBoundsClampHeight:Zx[1],backgroundColor:K.color.transparent,borderWidth:1,borderColor:K.color.neutral30},t}(qe),Gue=cd(),iA="__ec_stack_";function EW(e){return e.get("stack")||iA+e.seriesIndex}function Hue(e){if(bn(e.axis.scale)){for(var t=ln(e.axis),r=[],n=0;nw&&(w=x),w!==c&&(y.width=w,r-=w+u*w,n--)}}),c=(r-l)/(n+(n-1)*u),c=$e(c,0);var h=0,f;E(o,function(m){var y=s[m];y.width||(y.width=c),f=y,h+=y.width*(1+u)}),f&&(h-=f.width*u);var d={},g=-h/2;return E(o,function(m){var y=s[m];d[m]=d[m]||{bandWidth:t,offset:g,width:y.width},g+=y.width*(1+u)}),d}function jW(e){return{seriesType:e,overallReset:function(t){var r=qc(e,ga);EI(t,r,function(n){var i=Uue(n,e);wc(n,r,function(a){var o=i.columnMap[EW(a)];a.getData().setLayout({bandWidth:o.bandWidth,offset:o.offset,size:o.width})})})}}}function OW(e){return{seriesType:e,plan:Yc(),reset:function(t){if(Eue(t)){var r=t.getData(),n=t.coordinateSystem,i=n.getBaseAxis(),a=n.getOtherAxis(i),o=r.getDimensionIndex(r.mapDimension(a.dim)),s=r.getDimensionIndex(r.mapDimension(i.dim)),l=t.get("showBackground",!0),u=r.mapDimension(a.dim),c=r.getCalculationInfo("stackResultDimension"),h=vs(r,u)&&!!r.getCalculationInfo("stackedOnSeries"),f=a.isHorizontal(),d=a.toGlobalCoord(a.dataToCoord(PW(a))),g=zW(t),m=t.get("barMinHeight")||0,y=c&&r.getDimensionIndex(c),_=r.getLayout("size"),x=r.getLayout("offset");return{progress:function(w,S){for(var T=w.count,M=g&&Za(T*3),A=g&&l&&Za(T*3),N=g&&Za(T),P=n.master.getRect(),I=f?P.width:P.height,D,O=S.getStore(),j=0;(D=w.next())!=null;){var B=O.get(h?y:o,D),U=O.get(s,D),H=d,V=void 0;h&&(V=+B-O.get(o,D));var z=void 0,$=void 0,W=void 0,Z=void 0;if(f){var X=n.dataToPoint([B,U]);h&&(H=n.dataToPoint([V,U])[0]),z=H,$=X[1]+x,W=X[0]-H,Z=_,Xt(W)y){w=(M+x)/2;break}T===1&&(S=A-g[0].tickValue)}w==null&&(x?x&&(w=g[g.length-1].coord):w=g[0].coord),s[d]=f.toGlobalCoord(w)}});else{var l=this.getData(),u=l.getLayout("offset"),c=l.getLayout("size"),h=a.getBaseAxis().isHorizontal()?0:1;s[h]+=u+c/2}return s}return[NaN,NaN]},t.prototype.__requireStartValue=function(r){return this.getBaseAxis()!==r},t.type="series.__base_bar__",t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod",defaultBarGap:"10%"},t}(At);At.registerClass(Mg);var $ue=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(){return wo(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},t.prototype.getProgressive=function(){return this.get("large")?this.get("progressive"):!1},t.prototype.__preparePipelineContext=function(r,n){var i=_G(this,r,n);return i.progressiveRender&&(i.large=!0),i},t.prototype.brushSelector=function(r,n,i){return i.rect(n.getItemLayout(r))},t.type="series."+eo,t.dependencies=["grid","polar"],t.defaultOption=Bl(Mg.defaultOption,{clip:!0,roundCap:!1,showBackground:!1,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)",borderColor:null,borderWidth:0,borderType:"solid",borderRadius:0,shadowBlur:0,shadowColor:null,shadowOffsetX:0,shadowOffsetY:0,opacity:1},select:{itemStyle:{borderColor:K.color.primary,borderWidth:2}},realtimeSort:!1}),t}(Mg),Yue=function(){function e(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return e}(),$x=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="sausage",n}return t.prototype.getDefaultShape=function(){return new Yue},t.prototype.buildPath=function(r,n){var i=n.cx,a=n.cy,o=Math.max(n.r0||0,0),s=Math.max(n.r,0),l=(s-o)*.5,u=o+l,c=n.startAngle,h=n.endAngle,f=n.clockwise,d=Math.PI*2,g=f?h-cMath.PI/2&&cs)return!0;s=h}return!1},t.prototype._isOrderDifferentInView=function(r,n){for(var i=n.scale,a=i.getExtent(),o=Math.max(0,a[0]),s=Math.min(a[1],i.getOrdinalMeta().categories.length-1);o<=s;++o)if(r.ordinalNumbers[o]!==i.getRawOrdinalNumber(o))return!0},t.prototype._updateSortWithinSameData=function(r,n,i,a){if(this._isOrderChangedWithinSameData(r,n,i)){var o=this._dataSort(r,i,n);this._isOrderDifferentInView(o,i)&&(this._removeOnRenderedListener(a),a.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",axisId:i.index,sortInfo:o}))}},t.prototype._dispatchInitSort=function(r,n,i){var a=n.baseAxis,o=this._dataSort(r,a,function(s){return r.get(r.mapDimension(n.otherAxis.dim),s)});i.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",isInitSort:!0,axisId:a.index,sortInfo:o})},t.prototype.remove=function(r,n){this._clear(this._model),this._removeOnRenderedListener(n)},t.prototype.dispose=function(r,n){this._removeOnRenderedListener(n)},t.prototype._removeOnRenderedListener=function(r){this._onRendered&&(r.getZr().off("rendered",this._onRendered),this._onRendered=null)},t.prototype._clear=function(r){var n=this.group,i=this._data;r&&r.isAnimationEnabled()&&i&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],i.eachItemGraphicEl(function(a){Ko(a,r,Re(a).dataIndex)})):n.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=eo,t}(wt),XO={cartesian2d:function(e,t){var r=t.width<0?-1:1,n=t.height<0?-1:1;r<0&&(t.x+=t.width,t.width=-t.width),n<0&&(t.y+=t.height,t.height=-t.height);var i=e.x+e.width,a=e.y+e.height,o=bC(t.x,e.x),s=wC(t.x+t.width,i),l=bC(t.y,e.y),u=wC(t.y+t.height,a),c=si?s:o,t.y=h&&l>a?u:l,t.width=c?0:s-o,t.height=h?0:u-l,r<0&&(t.x+=t.width,t.width=-t.width),n<0&&(t.y+=t.height,t.height=-t.height),c||h},polar:function(e,t){var r=t.r0<=t.r?1:-1;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}var i=wC(t.r,e.r),a=bC(t.r0,e.r0);t.r=i,t.r0=a;var o=i-a<0;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}return o}},qO={cartesian2d:function(e,t,r,n,i,a,o,s,l){var u=new Ye({shape:ee({},n),z2:1});if(u.__dataIndex=r,u.name="item",a){var c=u.shape,h=i?"height":"width";c[h]=0}return u},polar:function(e,t,r,n,i,a,o,s,l){var u=!i&&l?$x:on,c=new u({shape:n,z2:1});c.name="item";var h=FW(i);if(c.calculateTextPosition=Xue(h,{isRoundCap:u===$x}),a){var f=c.shape,d=i?"r":"endAngle",g={};f[d]=i?n.r0:n.startAngle,g[d]=n[d],(s?lt:jt)(c,{shape:g},a)}return c}};function Jue(e,t){var r=e.get("realtimeSort",!0),n=t.getBaseAxis();if(r&&n.type==="category"&&t.type==="cartesian2d")return{baseAxis:n,otherAxis:t.getOtherAxis(n)}}function KO(e,t,r,n,i,a,o,s){var l,u;a?(u={x:n.x,width:n.width},l={y:n.y,height:n.height}):(u={y:n.y,height:n.height},l={x:n.x,width:n.width}),s||(o?lt:jt)(r,{shape:l},t,i,null);var c=t?e.baseAxis.model:null;(o?lt:jt)(r,{shape:u},c,i)}function JO(e,t){for(var r=0;r0?1:-1,o=n.height>0?1:-1;return{x:n.x+a*i/2,y:n.y+o*i/2,width:n.width-a*i,height:n.height-o*i}},polar:function(e,t,r){var n=e.getItemLayout(t);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}}};function tce(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function FW(e){return function(t){var r=t?"Arc":"Angle";return function(n){switch(n){case"start":case"insideStart":case"end":case"insideEnd":return n+r;default:return n}}}(e)}function e5(e,t,r,n,i,a,o,s){var l=t.getItemVisual(r,"style");if(s){if(!a.get("roundCap")){var c=e.shape,h=$a(n.getModel("itemStyle"),c,!0);ee(c,h),e.setShape(c)}}else{var u=n.get(["itemStyle","borderRadius"])||0;e.setShape("r",u)}e.useStyle(l);var f=n.getShallow("cursor");f&&e.attr("cursor",f);var d=s?o?i.r>=i.r0?"endArc":"startArc":i.endAngle>=i.startAngle?"endAngle":"startAngle":o?oce(i,a.coordinateSystem):sce(i,a.coordinateSystem),g=Ar(n);Or(e,g,{labelFetcher:a,labelDataIndex:r,defaultText:Zf(a.getData(),r),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:d});var m=e.getTextContent();if(s&&m){var y=n.get(["label","position"]);e.textConfig.inside=y==="middle"?!0:null,que(e,y==="outside"?d:y,FW(o),n.get(["label","rotate"]))}vH(m,g,a.getRawValue(r),function(x){return uW(t,x)});var _=n.getModel(["emphasis"]);Vt(e,_.get("focus"),_.get("blurScope"),_.get("disabled")),Mr(e,n),tce(i)&&(e.style.fill="none",e.style.stroke="none",E(e.states,function(x){x.style&&(x.style.fill=x.style.stroke="none")}))}function rce(e,t){var r=e.get(["itemStyle","borderColor"]);if(!r||r==="none")return 0;var n=e.get(["itemStyle","borderWidth"])||0,i=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),a=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(n,i,a)}var nce=function(){function e(){}return e}(),t5=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="largeBar",n}return t.prototype.getDefaultShape=function(){return new nce},t.prototype.buildPath=function(r,n){for(var i=n.points,a=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],u=this.barWidth,c=0;c=0?r:null},30,!1);function ice(e,t,r){for(var n=e.baseDimIdx,i=1-n,a=e.shape.points,o=e.largeDataIndices,s=[],l=[],u=e.barWidth,c=0,h=a.length/3;c=s[0]&&t<=s[0]+l[0]&&r>=s[1]&&r<=s[1]+l[1])return o[c]}return-1}function VW(e,t,r){if(Mc(r,"cartesian2d")){var n=t,i=r.getArea();return{x:e?n.x:i.x,y:e?i.y:n.y,width:e?n.width:i.width,height:e?i.height:n.height}}else{var i=r.getArea(),a=t;return{cx:i.cx,cy:i.cy,r0:e?i.r0:a.r0,r:e?i.r:a.r,startAngle:e?a.startAngle:0,endAngle:e?a.endAngle:Math.PI*2}}}function ace(e,t,r){var n=e.type==="polar"?on:Ye;return new n({shape:VW(t,r,e),silent:!0,z2:0})}function oce(e,t){if(e.height===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"bottom":"top"}return e.height>0?"bottom":"top"}function sce(e,t){if(e.width===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"left":"right"}return e.width>=0?"right":"left"}function lce(e){e.registerChartView(Kue),e.registerSeriesModel($ue),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,jW(eo)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,OW(eo)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,xW(eo)),e.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(t,r){var n=t.componentType||"series";r.eachComponent({mainType:n,query:t},function(i){t.sortInfo&&i.axis.setCategorySortInfo(t.sortInfo)})}),BW(e)}function gm(e){return{seriesType:e,reset:function(t,r){var n=r.findComponents({mainType:"legend"});if(!(!n||!n.length)){var i=t.getData();i.filterSelf(function(a){for(var o=i.getName(a),s=0;s=0},e.prototype.indexOfName=function(t){var r=this._getDataWithEncodedVisual();return r.indexOfName(t)},e.prototype.getItemVisual=function(t,r){var n=this._getDataWithEncodedVisual();return n.getItemVisual(t,r)},e}(),yl="pie",uce=Ue(),GW=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new Id(de(this.getData,this),de(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return Ld(this,{coordDimensions:["value"],encodeDefaulter:Ze(aI,this)})},t.prototype.getDataParams=function(r){var n=this.getData(),i=uce(n),a=i.seats;if(!a){var o=[];n.each(n.mapDimension("value"),function(l){o.push(l)}),a=i.seats=sG(o,n.hostModel.get("percentPrecision"))}var s=e.prototype.getDataParams.call(this,r);return s.percent=a[r]||0,s.$vars.push("percent"),s},t.prototype._defaultLabelLine=function(r){dc(r,"labelLine",["show"]);var n=r.labelLine,i=r.emphasis.labelLine;n.show=n.show&&r.label.show,i.show=i.show&&r.emphasis.label.show},t.type="series."+yl,t.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"50%"],clockwise:!0,startAngle:90,endAngle:"auto",padAngle:0,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,coordinateSystemUsage:"box",left:0,top:0,right:0,bottom:0,width:null,height:null,label:{rotate:0,show:!0,overflow:"truncate",position:"outer",alignTo:"none",edgeDistance:"25%",distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:30,smooth:!1,minTurnAngle:90,maxSurfaceAngle:90,lineStyle:{width:1,type:"solid"}},itemStyle:{borderWidth:1,borderJoin:"round"},showEmptyCircle:!0,emptyCircleStyle:{color:"lightgray",opacity:1},labelLayout:{hideOverlap:!0},emphasis:{scale:!0,scaleSize:5},avoidLabelOverlap:!0,animationType:"expansion",animationDuration:1e3,animationTypeUpdate:"transition",animationEasingUpdate:"cubicInOut",animationDurationUpdate:500,animationEasing:"cubicInOut"},t}(At);ine({fullType:GW.type,getCoord2:function(e){return e.getShallow("center")}});var cce=Math.PI/180;function i5(e,t,r,n,i,a,o,s,l,u){if(e.length<2)return;function c(m){for(var y=m.rB,_=y*y,x=0;xr?_:y,T=Math.abs(w.label.y-r);if(T>=S.maxY){var M=w.label.x-t-w.len2*i,A=n+w.len,N=Math.abs(M)e.unconstrainedWidth?null:f:null;n.setStyle("width",d)}UW(a,n)}}}function UW(e,t){a5.rect=e,H8(a5,t,fce)}var fce={minMarginForce:[null,0,null,0],marginDefault:[1,0,1,0]},a5={};function SC(e){return e.position==="center"}function dce(e){var t=e.getData(),r=[],n,i,a=!1,o=(e.get("minShowLabelAngle")||0)*cce,s=t.getLayout("viewRect"),l=t.getLayout("r"),u=s.width,c=s.x,h=s.y,f=s.height;function d(M){M.ignore=!0}function g(M){if(!M.ignore)return!0;for(var A in M.states)if(M.states[A].ignore===!1)return!0;return!1}t.each(function(M){var A=t.getItemGraphicEl(M),N=A.shape,P=A.getTextContent(),I=A.getTextGuideLine(),D=t.getItemModel(M),O=D.getModel("label"),j=O.get("position")||D.get(["emphasis","label","position"]),B=O.get("distanceToLabelLine"),U=O.get("alignTo"),H=he(O.get("edgeDistance"),u),V=O.get("bleedMargin");V==null&&(V=Math.min(u,f)>200?10:2);var z=D.getModel("labelLine"),$=z.get("length");$=he($,u);var W=z.get("length2");if(W=he(W,u),Math.abs(N.endAngle-N.startAngle)0?"right":"left":X>0?"left":"right"}var nt=Math.PI,ft=0,Ot=O.get("rotate");if(at(Ot))ft=Ot*(nt/180);else if(j==="center")ft=0;else if(Ot==="radial"||Ot===!0){var Xe=X<0?-Z+nt:-Z;ft=Xe}else if(Ot==="tangential"||Ot==="tangential-noflip"&&j!=="outside"&&j!=="outer"){var Zt=Math.atan2(X,re);Zt<0&&(Zt=nt*2+Zt);var On=re>0;On&&Ot!=="tangential-noflip"&&(Zt=nt+Zt),ft=Zt-nt}if(a=!!ft,P.x=J,P.y=oe,P.rotation=ft,P.setStyle({verticalAlign:"middle"}),we){P.setStyle({align:De});var So=P.states.select;So&&(So.x+=P.x,So.y+=P.y)}else{var Qn=new Ae(0,0,0,0);UW(Qn,P),r.push({label:P,labelLine:I,position:j,len:$,len2:W,minTurnAngle:z.get("minTurnAngle"),maxSurfaceAngle:z.get("maxSurfaceAngle"),surfaceNormal:new Pe(X,re),linePoints:le,textAlign:De,labelDistance:B,labelAlignTo:U,edgeDistance:H,bleedMargin:V,rect:Qn,unconstrainedWidth:Qn.width,labelStyleWidth:P.style.width})}A.setTextConfig({inside:we})}}),!a&&e.get("avoidLabelOverlap")&&hce(r,n,i,l,u,f,c,h);for(var m=0;mz?(W=B+A*z/2,Z=W):(W=B+P,Z=$-P),n.setItemLayout(V,{angle:z,startAngle:W,endAngle:Z,clockwise:w,cx:o,cy:s,r0:u,r:S?ct(H,M,[u,l]):l}),B=$}),O0){for(var c=o.getItemLayout(0),h=1;isNaN(c&&c.startAngle)&&h=a.r0}},t.type=yl,t}(wt);function yce(e){return{seriesType:e,reset:function(t,r){var n=t.getData();n.filterSelf(function(i){var a=n.mapDimension("value"),o=n.get(a,i);return!(at(o)&&!isNaN(o)&&o<0)})}}}function _ce(e){e.registerChartView(mce),e.registerSeriesModel(GW),kU(yl,e.registerAction),e.registerLayout(vce),e.registerProcessor(gm(yl)),e.registerProcessor(yce(yl))}var xce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r}return t.prototype.getInitialData=function(r,n){return wo(null,this,{useEncodeDefaulter:!0})},t.prototype.getProgressive=function(){var r=this.option.progressive;return r??(this.option.large?5e3:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var r=this.option.progressiveThreshold;return r??(this.option.large?1e4:this.get("progressiveThreshold"))},t.prototype.brushSelector=function(r,n,i){return i.point(n.getItemLayout(r))},t.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},t.type="series.scatter",t.dependencies=["grid","polar","geo","singleAxis","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:K.color.primary}},universalTransition:{divideShape:"clone"}},t}(At),ZW=4,bce=function(){function e(){}return e}(),wce=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.getDefaultShape=function(){return new bce},t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.beforeBrush=function(r){r&&!r.contentRetained&&this.reset()},t.prototype.buildPath=function(r,n){var i=n.points,a=n.size,o=this.symbolProxy,s=o.shape,l=r.getContext?r.getContext():r,u=l&&a[0]=0;u--){var c=u*2,h=a[c]-s/2,f=a[c+1]-l/2;if(r>=h&&n>=f&&r<=h+s&&n<=f+l)return u}return-1},t.prototype.contain=function(r,n){var i=this.transformCoordToLocal(r,n),a=this.getBoundingRect();if(r=i[0],n=i[1],a.contain(r,n)){var o=this.hoverDataIdx=this.findDataIndex(r,n);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var r=this._rect;if(!r){for(var n=this.shape,i=n.points,a=n.size,o=a[0],s=a[1],l=1/0,u=1/0,c=-1/0,h=-1/0,f=0;f=0&&(u.dataIndex=h+(t.startIndex||0))})},e.prototype.remove=function(){this._clear()},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),Cce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=r.getData(),o=this._updateSymbolDraw(a,r);o.updateData(a,CC(r)),this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,i){var a=r.getData(),o=this._updateSymbolDraw(a,r);o.incrementalPrepareUpdate(a),this._finished=!1},t.prototype.incrementalRender=function(r,n,i){this._symbolDraw.incrementalUpdate(r,n.getData(),Qa(n),CC(n)),this._finished=r.end===n.getData().count()},t.prototype.updateTransform=function(r,n,i){var a=r.getData();if(this.group.dirty(),this._finished){var o=vm("").reset(r,n,i);o.progress&&o.progress({start:0,end:a.count(),count:a.count()},a),this._symbolDraw.updateLayout(CC(r))}else return{update:!0}},t.prototype.eachRendered=function(r){this._symbolDraw&&this._symbolDraw.eachRendered(r)},t.prototype._updateSymbolDraw=function(r,n){var i=this._symbolDraw,a=n.pipelineContext,o=a.large;return(!i||o!==this._isLargeDraw)&&(i&&i.remove(),i=this._symbolDraw=o?new Sce:new dm,this._isLargeDraw=o,this.group.removeAll()),this.group.add(i.group),i},t.prototype.remove=function(r,n){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type="scatter",t}(wt);function CC(e){return{clipShape:gW(e)}}var aA=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Qt).models[0]},t.type="cartesian2dAxis",t}(qe);vr(aA,Ad);var $W={show:!0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:"auto",onZeroAxisIndex:null,lineStyle:{color:K.color.axisLine,width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15],breakLine:!0},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12,color:K.color.axisLabel,textMargin:[0,3]},splitLine:{show:!0,showMinLine:!0,showMaxLine:!0,lineStyle:{color:K.color.axisSplitLine,width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:[K.color.backgroundTint,K.color.backgroundTransparent]}},breakArea:{show:!0,itemStyle:{color:K.color.neutral00,borderColor:K.color.border,borderWidth:1,borderType:[3,3],opacity:.6},zigzagAmplitude:4,zigzagMinSpan:4,zigzagMaxSpan:20,zigzagZ:100,expandOnClick:!0},breakLabelLayout:{moveOverlap:"auto"}},Tce=He({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto",show:"auto"},axisLabel:{interval:"auto"}},$W),qI=He({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:K.color.axisMinorSplitLine,width:1}}},$W),Mce=He({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},qI),Ace=ke({logBase:10},qI);const YW={category:Tce,value:qI,time:Mce,log:Ace};function $f(e,t,r,n){E(g8,function(i,a){var o=He(He({},YW[a],!0),n,!0),s=function(l){q(u,l);function u(){var c=l!==null&&l.apply(this,arguments)||this;return c.type=t+"Axis."+a,c}return u.prototype.mergeDefaultAndTheme=function(c,h){var f=hg(this),d=f?$c(c):{},g=h.getTheme();He(c,g.get(a+"Axis")),He(c,this.getDefaultOption()),c.type=s5(c),f&&vo(c,d,f)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=pg.createByAxisModel(this))},u.prototype.getCategories=function(c){var h=this.option;if(h.type==="category")return c?h.data:this.__ordinalMeta.categories},u.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},u.prototype.updateAxisBreaks=function(c){var h=pm();return h?h.updateModelAxisBreak(this,c):{breaks:[]}},u.type=t+"Axis."+a,u.defaultOption=o,u}(r);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+"Axis",s5)}function s5(e){return e.type||(e.data?"category":"value")}var kce=function(){function e(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return e.prototype.getAxis=function(t){return this._axes[t]},e.prototype.getAxes=function(){return ae(this._dimList,function(t){return this._axes[t]},this)},e.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),mt(this.getAxes(),function(r){return r.scale.type===t})},e.prototype.addAxis=function(t){var r=t.dim;this._axes[r]=t,this._dimList.push(r)},e}(),m_=["x","y"];function l5(e){return(e.type==="interval"||e.type==="time")&&!xx(e)}var Lce=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=ga,r.dimensions=m_,r}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var r=this.getAxis("x").scale,n=this.getAxis("y").scale;if(!(!l5(r)||!l5(n))){var i=Ex(r,null),a=Ex(n,null),o=this.dataToPoint([i[0],a[0]]),s=this.dataToPoint([i[1],a[1]]),l=i[1]-i[0],u=a[1]-a[0];if(!(!l||!u)){var c=(s[0]-o[0])/l,h=(s[1]-o[1])/u,f=o[0]-i[0]*c,d=o[1]-a[0]*h,g=this._transform=[c,0,0,h,f,d];this._invTransform=fi([],g)}}},t.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},t.prototype.containPoint=function(r){var n=this.getAxis("x"),i=this.getAxis("y");return n.contain(n.toLocalCoord(r[0]))&&i.contain(i.toLocalCoord(r[1]))},t.prototype.containData=function(r){return this.getAxis("x").containData(r[0])&&this.getAxis("y").containData(r[1])},t.prototype.containZone=function(r,n){var i=this.dataToPoint(r),a=this.dataToPoint(n),o=this.getArea(),s=new Ae(i[0],i[1],a[0]-i[0],a[1]-i[1]);return o.intersect(s)},t.prototype.dataToPoint=function(r,n,i){i=i||[];var a=r[0],o=r[1];if(this._transform&&a!=null&&isFinite(a)&&o!=null&&isFinite(o))return Kt(i,r,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return i[0]=s.toGlobalCoord(s.dataToCoord(a,n)),i[1]=l.toGlobalCoord(l.dataToCoord(o,n)),i},t.prototype.clampData=function(r,n){var i=this.getAxis("x").scale,a=this.getAxis("y").scale,o=i.getExtent(),s=a.getExtent(),l=i.parse(r[0]),u=a.parse(r[1]);return n=n||[],n[0]=Math.min(Math.max(Math.min(o[0],o[1]),l),Math.max(o[0],o[1])),n[1]=Math.min(Math.max(Math.min(s[0],s[1]),u),Math.max(s[0],s[1])),n},t.prototype.pointToData=function(r,n,i){if(i=i||[],this._invTransform)return Kt(i,r,this._invTransform);var a=this.getAxis("x"),o=this.getAxis("y");return i[0]=a.coordToData(a.toLocalCoord(r[0]),n),i[1]=o.coordToData(o.toLocalCoord(r[1]),n),i},t.prototype.getOtherAxis=function(r){return this.getAxis(r.dim==="x"?"y":"x")},t.prototype.getArea=function(r){r=r||0;var n=this.getAxis("x").getGlobalExtent(),i=this.getAxis("y").getGlobalExtent(),a=Math.min(n[0],n[1])-r,o=Math.min(i[0],i[1])-r,s=Math.max(n[0],n[1])-a+r,l=Math.max(i[0],i[1])-o+r;return new Ae(a,o,s,l)},t}(kce);function XW(e,t){var r=e.scale,n=e.model,i=k8(r,n,n.ecModel,e,null),a=Gf(r),o=Gf(t)?t.intervalStub:t,s=a?r.intervalStub:r,l=r.base,u=o.getTicks(),c=o.getTicks({expandToNicedExtent:!0}),h=u.length-1,f,d,g;if(h===1)f=d=0,g=1;else if(h===2){var m=Xt(u[0].value-u[1].value),y=Xt(u[1].value-u[2].value);f=d=0,m===y?g=2:(g=1,m=A[1])return!0})):S[1]?(P=A[1],B(function(){if(z(),j=st(O-I*g,D),U(),N<=A[0])return!0})):B(function(){j=st(Vc(A[0]/I)*I,D),O=st(Ui(A[1]/I)*I,D);var X=uo((O-j)/I);if(X<=g){var re=g-X,J=void 0,oe=i.incl0||a;if(oe&&A[0]===0)J=[0,re];else if(oe&&A[1]===0)J=[re,0];else{var le=Ui(re/2);J=re%2===0?[le,le]:N+P=A[1])return!0}})}_8(r,S,M,[N,P],T,{interval:I,intervalCount:g,intervalPrecision:D,niceExtent:[j,O]})}var u5=[[3,1],[0,2]],Ice=function(){function e(t,r,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=m_,this._initCartesian(t,r,n),this.model=t}return e.prototype.getRect=function(){return this._rect},e.prototype.update=function(t,r){var n=this._axesMap;E(this._axesList,function(o){Cc(o,Uf);var s=o.scale;bn(s)&&s.setSortInfo(o.model.get("categorySortInfo"))});function i(o){for(var s=tt(o),l=[],u=s.length-1;u>=0;u--){var c=o[+s[u]];c.__alignTo?l.push(c):Wf(c)}E(l,function(h){Pce(h,h.__alignTo)?Wf(h):XW(h,h.__alignTo.scale)})}i(n.x),i(n.y);var a={};E(n.x,function(o){c5(n,"y",o,a)}),E(n.y,function(o){c5(n,"x",o,a)}),this.resize(this.model,r)},e.prototype.resize=function(t,r,n){var i=Lr(t,r),a=this._rect=Bt(t.getBoxLayoutParams(),i.refContainer),o=this._axesMap,s=this._coordsList,l=t.get("containLabel");if(oA(o,a),!n){var u=Rce(a,s,o,l,r),c=void 0;if(l)sA?(sA(this._axesList,a),oA(o,a)):c=v5(a.clone(),"axisLabel",null,a,o,u,i);else{var h=jce(t,a,i),f=h.outerBoundsRect,d=h.parsedOuterBoundsContain,g=h.outerBoundsClamp;f&&(c=v5(f,d,g,a,o,u,i))}qW(a,o,xa.determine,null,c,i),E(this._coordsList,function(m){m.calcAffineTransform()})}},e.prototype.getAxis=function(t,r){var n=this._axesMap[t];if(n!=null)return n[r||0]},e.prototype.getAxes=function(){return this._axesList.slice()},e.prototype.getCartesian=function(t,r){if(t!=null&&r!=null){var n="x"+t+"y"+r;return this._coordsMap[n]}Ie(t)&&(r=t.yAxisIndex,t=t.xAxisIndex);for(var i=0,a=this._coordsList;i=0;i--){var a=e[+t[i]];c8(a.scale)&&y8(a.model,a.type,!0)==null&&(a.model.get("alignTicks")&&a.model.get("interval")==null?n.push(a):r=a)}r||(r=n.pop()),r&&E(n,function(o){o.__alignTo=r})}function Pce(e,t){return xx(e.scale)||xx(t.scale)||t.scale.getTicks().length<2}function Dce(e,t){var r=e.getExtent(),n=r[0]+r[1];e.toGlobalCoord=e.dim==="x"?function(i){return i+t}:function(i){return n-i+t},e.toLocalCoord=e.dim==="x"?function(i){return i-t}:function(i){return n-i+t}}function oA(e,t){E(e.x,function(r){return d5(r,t.x,t.width)}),E(e.y,function(r){return d5(r,t.y,t.height)})}function d5(e,t,r){var n=[0,r],i=e.inverse?1:0;e.setExtent(n[i],n[1-i]),Dce(e,t)}var sA;function Ece(e){sA=e}function v5(e,t,r,n,i,a,o){qW(n,i,xa.estimate,t,!1,o);var s=[0,0,0,0];u(0),u(1),c(n,0,NaN),c(n,1,NaN);var l=ys(s,function(f){return f>0})==null;return yc(n,s,!0,!0,r),oA(i,n),l;function u(f){E(i[ze[f]],function(d){if(_g(d.model)){var g=a.ensureRecord(d.model),m=g.labelInfoList;if(m)for(var y=0;y0&&!tn(d)&&d>1e-4&&(f/=d),f}}function Rce(e,t,r,n,i){var a=new TW(Oce);return E(r,function(o){return E(o,function(s){if(_g(s.model)){var l=!n;s.axisBuilder=jue(e,t,s.model,i,a,l)}})}),a}function qW(e,t,r,n,i,a){var o=r===xa.determine;E(t,function(u){return E(u,function(c){_g(c.model)&&(Oue(c.axisBuilder,e,c.model),c.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:i}))})});var s={x:0,y:0};l(0),l(1);function l(u){s[ze[1-u]]=e[ir[u]]<=a.refContainer[ir[u]]*.5?0:1-u===1?2:1}E(t,function(u,c){return E(u,function(h){_g(h.model)&&((n==="all"||o)&&h.axisBuilder.build({axisName:!0},{nameMarginLevel:s[c]}),o&&h.axisBuilder.build({axisLine:!0}))})})}function jce(e,t,r){var n,i=e.get("outerBoundsMode",!0);i==="same"?n=t.clone():(i==null||i==="auto")&&(n=Bt(e.get("outerBounds",!0)||DW,r.refContainer));var a=e.get("outerBoundsContain",!0),o;a==null||a==="auto"||Be(["all","axisLabel"],a)<0?o="all":o=a;var s=[fx(_e(e.get("outerBoundsClampWidth",!0),Zx[0]),t.width),fx(_e(e.get("outerBoundsClampHeight",!0),Zx[1]),t.height)];return{outerBoundsRect:n,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var Oce=function(e,t,r,n,i,a){var o=r.axis.dim==="x"?"y":"x";MW(e,t,r,n,i,a),Hf(e.nameLocation)||E(t.recordMap[o],function(s){s&&s.labelInfoList&&s.dirVec&&kW(s.labelInfoList,s.dirVec,n,i)})};function zce(e,t){var r={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return Bce(r,e,t),r.seriesInvolved&&Vce(r,e),r}function Bce(e,t,r){var n=t.getComponent("tooltip"),i=t.getComponent("axisPointer"),a=i.get("link",!0)||[],o=[];E(r.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=Ag(s.model),u=e.coordSysAxesInfo[l]={};e.coordSysMap[l]=s;var c=s.model,h=c.getModel("tooltip",n);if(E(s.getAxes(),Ze(m,!1,null)),s.getTooltipAxes&&n&&h.get("show")){var f=h.get("trigger")==="axis",d=h.get(["axisPointer","type"])==="cross",g=s.getTooltipAxes(h.get(["axisPointer","axis"]));(f||d)&&E(g.baseAxes,Ze(m,d?"cross":!0,f)),d&&E(g.otherAxes,Ze(m,"cross",!1))}function m(y,_,x){var w=x.model.getModel("axisPointer",i),S=w.get("show");if(!(!S||S==="auto"&&!y&&!lA(w))){_==null&&(_=w.get("triggerTooltip")),w=y?Fce(x,h,i,t,y,_):w;var T=w.get("snap"),M=w.get("triggerEmphasis"),A=Ag(x.model),N=_||T||x.type==="category",P=e.axesInfo[A]={key:A,axis:x,coordSys:s,axisPointerModel:w,triggerTooltip:_,triggerEmphasis:M,involveSeries:N,snap:T,useHandle:lA(w),seriesModels:[],linkGroup:null};u[A]=P,e.seriesInvolved=e.seriesInvolved||N;var I=Gce(a,x);if(I!=null){var D=o[I]||(o[I]={axesInfo:{}});D.axesInfo[A]=P,D.mapper=a[I].mapper,P.linkGroup=D}}}})}function Fce(e,t,r,n,i,a){var o=t.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};E(s,function(f){l[f]=Se(o.get(f))}),l.snap=e.type!=="category"&&!!a,o.get("type")==="cross"&&(l.type="line");var u=l.label||(l.label={});if(u.show==null&&(u.show=!1),i==="cross"){var c=o.get(["label","show"]);if(u.show=c??!0,!a){var h=l.lineStyle=o.get("crossStyle");h&&ke(u,h.textStyle)}}return e.model.getModel("axisPointer",new Je(l,r,n))}function Vce(e,t){t.eachSeries(function(r){var n=r.coordinateSystem,i=r.get(["tooltip","trigger"],!0),a=r.get(["tooltip","show"],!0);!n||!n.model||i==="none"||i===!1||i==="item"||a===!1||r.get(["axisPointer","show"],!0)===!1||E(e.coordSysAxesInfo[Ag(n.model)],function(o){var s=o.axis;n.getAxis(s.dim)===s&&(o.seriesModels.push(r),o.seriesDataCount==null&&(o.seriesDataCount=0),o.seriesDataCount+=r.getData().count())})})}function Gce(e,t){for(var r=t.model,n=t.dim,i=0;i=0||e===t}function Hce(e){var t=KI(e);if(t){var r=t.axisPointerModel,n=t.axis.scale,i=r.option,a=r.get("status"),o=r.get("value");o!=null&&(o=n.parse(o));var s=lA(r);a==null&&(i.status=s?"show":"hide");var l=n.getExtent();(o==null||o>l[1])&&(o=l[1]),o0;return o&&s}var Kce=Ue();function m5(e,t,r,n){if(e instanceof bW){var i=e.scale.type;if(i!=="ordinal")return r}var a=e.model,o=a.get("jitter");if(!(o>0))return r;var s=a.get("jitterOverlap"),l=a.get("jitterMargin")||0,u=bn(e.scale)?ln(e).w:null;return s?r7(r,o,u,n):Jce(e,t,r,n,o,l)}function r7(e,t,r,n){if(r===null)return e+(Math.random()-.5)*t;var i=r-n*2,a=Math.min(Math.max(0,t),i);return e+(Math.random()-.5)*a}function Jce(e,t,r,n,i,a){var o=Kce(e);o.items||(o.items=[]);var s=o.items,l=y5(s,t,r,n,i,a,1),u=y5(s,t,r,n,i,a,-1),c=Math.abs(l-r)i/2||h&&f>h/2-n?r7(r,i,h,n):(s.push({fixedCoord:t,floatCoord:c,r:n}),c)}function y5(e,t,r,n,i,a,o){for(var s=r,l=0;li/2)return Number.MAX_VALUE;if(o===1&&g>s||o===-1&&g0&&!m.min?m.min=0:m.min!=null&&m.min<0&&!m.max&&(m.max=0);var y=u;m.color!=null&&(y=ke({color:m.color},u));var _=He(Se(m),{boundaryGap:r,splitNumber:n,clockwise:i,scale:a,axisLine:o,axisTick:s,axisLabel:l,name:m.text,showName:c,nameLocation:"end",nameGap:f,nameTextStyle:y,triggerEvent:d},!1);if(ue(h)){var x=_.name;_.name=h.replace("{value}",x??"")}else Ce(h)&&(_.name=h(_.name,_));var w=new Je(_,null,this.ecModel);return vr(w,Ad.prototype),w.mainType="radar",w.componentIndex=this.componentIndex,w.uid=Zc("ec_radar"),w},this);this._indicatorModels=g},t.prototype.getIndicatorModels=function(){return this._indicatorModels},t.type=n7,t.defaultOption={z:0,center:["50%","50%"],radius:"50%",startAngle:90,clockwise:!1,axisName:{show:!0,color:K.color.axisLabel},boundaryGap:[0,0],splitNumber:i7,axisNameGap:15,scale:!1,shape:"polygon",axisLine:He({lineStyle:{color:K.color.neutral20}},Sv.axisLine),axisLabel:h0(Sv.axisLabel,!1),axisTick:h0(Sv.axisTick,!1),splitLine:h0(Sv.splitLine,!0),splitArea:h0(Sv.splitArea,!0),indicator:[]},t}(qe),she=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=this.group;a.removeAll(),this._buildAxes(r,i),this._buildSplitLineAndArea(r)},t.prototype._buildAxes=function(r,n){var i=r.coordinateSystem,a=i.getIndicatorAxes(),o=ae(a,function(s){var l=s.model.get("showName")?s.name:"",u=new Nn(s.model,n,{axisName:l,position:[i.cx,i.cy],rotation:s.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return u});E(o,function(s){s.build(),this.group.add(s.group)},this)},t.prototype._buildSplitLineAndArea=function(r){var n=r.coordinateSystem,i=n.getIndicatorAxes();if(!i.length)return;var a=r.get("shape"),o=r.getModel("splitLine"),s=r.getModel("splitArea"),l=o.getModel("lineStyle"),u=s.getModel("areaStyle"),c=o.get("show"),h=s.get("show"),f=l.get("color"),d=u.get("color"),g=ne(f)?f:[f],m=ne(d)?d:[d],y=[],_=[];function x(U,H,V){var z=V%H.length;return U[z]=U[z]||[],z}if(a==="circle")for(var w=i[0].getTicksCoords(),S=n.cx,T=n.cy,M=0;M3?1.4:o>1?1.2:1.1,c=a>0?u:1/u;this._checkTriggerMoveZoom(this,"zoom","zoomOnMouseWheel",r,{scale:c,originX:s,originY:l,isAvailableBehavior:null})}if(i){var h=Math.abs(a),f=(a>0?1:-1)*(h>3?.4:h>1?.15:.05);this._checkTriggerMoveZoom(this,"scrollMove","moveOnMouseWheel",r,{scrollDelta:f,originX:s,originY:l,isAvailableBehavior:null})}}}},t.prototype._pinchHandler=function(r){if(!(b5(this._zr,"globalPan")||Cv(r))){var n=r.pinchScale>1?1.1:1/1.1;this._checkTriggerMoveZoom(this,"zoom",null,r,{scale:n,originX:r.pinchX,originY:r.pinchY,isAvailableBehavior:null})}},t.prototype._checkTriggerMoveZoom=function(r,n,i,a,o){r._checkPointer(a,o.originX,o.originY)&&(ls(a.event),a.__ecRoamConsumed=!0,w5(r,n,i,a,o))},t}(Xi);function Cv(e){return e.__ecRoamConsumed}var mhe=Ue();function Ob(e){var t=mhe(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function Tv(e,t,r,n){for(var i=Ob(e),a=i.roam,o=a[t]=a[t]||[],s=0;s=4&&(c={x:parseFloat(f[0]||0),y:parseFloat(f[1]||0),width:parseFloat(f[2]),height:parseFloat(f[3])})}if(c&&s!=null&&l!=null&&(h=l7(c,{x:0,y:0,width:s,height:l}),!r.ignoreViewBox)){var d=i;i=new Me,i.add(d),d.scaleX=d.scaleY=h.scale,d.x=h.x,d.y=h.y}return!r.ignoreRootClip&&s!=null&&l!=null&&i.setClipPath(new Ye({shape:{x:0,y:0,width:s,height:l}})),{root:i,width:s,height:l,viewBoxRect:c,viewBoxTransform:h,named:a}},e.prototype._parseNode=function(t,r,n,i,a,o){var s=t.nodeName.toLowerCase(),l,u=i;if(s==="defs"&&(a=!0),s==="text"&&(o=!0),s==="defs"||s==="switch")l=r;else{if(!a){var c=MC[s];if(c&&ge(MC,s)){l=c.call(this,t,r);var h=t.getAttribute("name");if(h){var f={name:h,namedFrom:null,svgNodeTagLower:s,el:l};n.push(f),s==="g"&&(u=f)}else i&&n.push({name:i.name,namedFrom:i,svgNodeTagLower:s,el:l});r.add(l)}}var d=T5[s];if(d&&ge(T5,s)){var g=d.call(this,t),m=t.getAttribute("id");m&&(this._defs[m]=g)}}if(l&&l.isGroup)for(var y=t.firstChild;y;)y.nodeType===1?this._parseNode(y,l,n,u,a,o):y.nodeType===3&&o&&this._parseText(y,l),y=y.nextSibling},e.prototype._parseText=function(t,r){var n=new Of({style:{text:t.textContent},silent:!0,x:this._textX||0,y:this._textY||0});wi(r,n),ei(t,n,this._defsUsePending,!1,!1),bhe(n,r);var i=n.style,a=i.fontSize;a&&a<9&&(i.fontSize=9,n.scaleX*=a/9,n.scaleY*=a/9);var o=(i.fontSize||i.fontFamily)&&[i.fontStyle,i.fontWeight,(i.fontSize||12)+"px",i.fontFamily||"sans-serif"].join(" ");i.font=o;var s=n.getBoundingRect();return this._textX+=s.width,r.add(n),n},e.internalField=function(){MC={g:function(t,r){var n=new Me;return wi(r,n),ei(t,n,this._defsUsePending,!1,!1),n},rect:function(t,r){var n=new Ye;return wi(r,n),ei(t,n,this._defsUsePending,!1,!1),n.setShape({x:parseFloat(t.getAttribute("x")||"0"),y:parseFloat(t.getAttribute("y")||"0"),width:parseFloat(t.getAttribute("width")||"0"),height:parseFloat(t.getAttribute("height")||"0")}),n.silent=!0,n},circle:function(t,r){var n=new bo;return wi(r,n),ei(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),r:parseFloat(t.getAttribute("r")||"0")}),n.silent=!0,n},line:function(t,r){var n=new cr;return wi(r,n),ei(t,n,this._defsUsePending,!1,!1),n.setShape({x1:parseFloat(t.getAttribute("x1")||"0"),y1:parseFloat(t.getAttribute("y1")||"0"),x2:parseFloat(t.getAttribute("x2")||"0"),y2:parseFloat(t.getAttribute("y2")||"0")}),n.silent=!0,n},ellipse:function(t,r){var n=new tm;return wi(r,n),ei(t,n,this._defsUsePending,!1,!1),n.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),rx:parseFloat(t.getAttribute("rx")||"0"),ry:parseFloat(t.getAttribute("ry")||"0")}),n.silent=!0,n},polygon:function(t,r){var n=t.getAttribute("points"),i;n&&(i=k5(n));var a=new sn({shape:{points:i||[]},silent:!0});return wi(r,a),ei(t,a,this._defsUsePending,!1,!1),a},polyline:function(t,r){var n=t.getAttribute("points"),i;n&&(i=k5(n));var a=new $r({shape:{points:i||[]},silent:!0});return wi(r,a),ei(t,a,this._defsUsePending,!1,!1),a},image:function(t,r){var n=new zr;return wi(r,n),ei(t,n,this._defsUsePending,!1,!1),n.setStyle({image:t.getAttribute("xlink:href")||t.getAttribute("href"),x:+t.getAttribute("x"),y:+t.getAttribute("y"),width:+t.getAttribute("width"),height:+t.getAttribute("height")}),n.silent=!0,n},text:function(t,r){var n=t.getAttribute("x")||"0",i=t.getAttribute("y")||"0",a=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0";this._textX=parseFloat(n)+parseFloat(a),this._textY=parseFloat(i)+parseFloat(o);var s=new Me;return wi(r,s),ei(t,s,this._defsUsePending,!1,!0),s},tspan:function(t,r){var n=t.getAttribute("x"),i=t.getAttribute("y");n!=null&&(this._textX=parseFloat(n)),i!=null&&(this._textY=parseFloat(i));var a=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0",s=new Me;return wi(r,s),ei(t,s,this._defsUsePending,!1,!0),this._textX+=parseFloat(a),this._textY+=parseFloat(o),s},path:function(t,r){var n=t.getAttribute("d")||"",i=qG(n);return wi(r,i),ei(t,i,this._defsUsePending,!1,!1),i.silent=!0,i}}}(),e}(),T5={lineargradient:function(e){var t=parseInt(e.getAttribute("x1")||"0",10),r=parseInt(e.getAttribute("y1")||"0",10),n=parseInt(e.getAttribute("x2")||"10",10),i=parseInt(e.getAttribute("y2")||"0",10),a=new Uc(t,r,n,i);return M5(e,a),A5(e,a),a},radialgradient:function(e){var t=parseInt(e.getAttribute("cx")||"0",10),r=parseInt(e.getAttribute("cy")||"0",10),n=parseInt(e.getAttribute("r")||"0",10),i=new RL(t,r,n);return M5(e,i),A5(e,i),i}};function M5(e,t){var r=e.getAttribute("gradientUnits");r==="userSpaceOnUse"&&(t.global=!0)}function A5(e,t){for(var r=e.firstChild;r;){if(r.nodeType===1&&r.nodeName.toLocaleLowerCase()==="stop"){var n=r.getAttribute("offset"),i=void 0;n&&n.indexOf("%")>0?i=parseInt(n,10)/100:n?i=parseFloat(n):i=0;var a={};s7(r,a,a);var o=a.stopColor||r.getAttribute("stop-color")||"#000000",s=a.stopOpacity||r.getAttribute("stop-opacity");if(s){var l=yn(o),u=l&&l[3];u&&(l[3]*=Xo(s),o=Oi(l,"rgba"))}t.colorStops.push({offset:i,color:o})}r=r.nextSibling}}function wi(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),ke(t.__inheritedStyle,e.__inheritedStyle))}function k5(e){for(var t=zb(e),r=[],n=0;n0;a-=2){var o=n[a],s=n[a-1],l=zb(o);switch(i=i||Ft(),s){case"translate":_a(i,i,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":eb(i,i,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":_s(i,i,-parseFloat(l[0])*AC,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*AC);ci(i,[1,0,u,1,0,0],i);break;case"skewY":var c=Math.tan(parseFloat(l[0])*AC);ci(i,[1,c,0,1,0,0],i);break;case"matrix":i[0]=parseFloat(l[0]),i[1]=parseFloat(l[1]),i[2]=parseFloat(l[2]),i[3]=parseFloat(l[3]),i[4]=parseFloat(l[4]),i[5]=parseFloat(l[5]);break}}t.setLocalTransform(i)}}var I5=/([^\s:;]+)\s*:\s*([^:;]+)/g;function s7(e,t,r){var n=e.getAttribute("style");if(n){I5.lastIndex=0;for(var i;(i=I5.exec(n))!=null;){var a=i[1],o=ge(Yx,a)?Yx[a]:null;o&&(t[o]=i[2]);var s=ge(Xx,a)?Xx[a]:null;s&&(r[s]=i[2])}}}function Ahe(e,t,r){for(var n=0;n1e-6;kv[0]=o?(i[0]-n.x)/a:i[0],kv[1]=o?(i[1]-n.y)/a:i[1],Kt(kv,kv,e.mtRawInv);var s=Jhe(e,kv);z5(t,s,a),E(r,function(l){l!==t&&z5(l,s.slice(),a)})}var kv=[];function z5(e,t,r){var n=e.option;n.center=t,n.zoom=r}function nN(e,t){if(t){var r=t.min||0,n=t.max||1/0;e=Math.max(Math.min(n,e),r)}return e}function m7(e,t){var r=t.getShallow("nodeScaleRatio",!0)||1,n=e;return((n.zoom-1)*r+1)/(n.trans[go].scaleX||1)}function Vb(e,t,r,n,i,a,o,s){var l=Jx(e);if(!l){r.disable();return}r.enable(_e(e.get("roam"),o),{api:t,zInfo:{component:e},triggerInfo:{roamTrigger:e.get("roamTrigger"),isInSelf:n,isInClip:function(c,h,f){return!i||i.contain(h,f)}}});function u(c){var h=e.mainType,f=GL(ke({type:_7(h,e.subType,EG)},c));s&&(f.componentType=h),f[h+"Id"]=e.id,t.dispatchAction(f)}r.off("pan").off("zoom").on("pan",function(c){a&&a("pan"),u({dx:c.dx,dy:c.dy})}).on("zoom",function(c){a&&a("zoom"),u({zoom:c.scale,originX:c.originX,originY:c.originY})})}function y7(e){return function(t,r,n){return NC.copy(e.getBoundingRect()),NC.applyTransform(e.getComputedTransform()),NC.contain(r,n)}}var NC=new Ae(0,0,0,0);function iN(e,t,r){var n=_7(t,r,EG);e.registerAction({type:n,event:n,update:"none"},function(i,a,o){a.eachComponent(CL(i,t,r),function(s){d7(i,s),v7(i,s,a,o)})})}function _7(e,t,r){return(e!==fo?e:t==="map"?"geo":t)+r}function x7(e){return e.zoom!=null}function aN(e,t,r,n,i,a,o){var s=new Bb(null,g7(e.ecModel,t));return Fb(s,r,n,i,a),o?Kx(s,o.x,o.y,o.width,o.height):Kx(s,r,n,i,a),tN(s,e),s}var oN=["rect","circle","line","ellipse","polygon","polyline","path"],efe=pe(oN),tfe=pe(oN.concat(["g"])),rfe=pe(oN.concat(["g"])),b7=Ue();function p0(e){var t=e.getItemStyle(),r=e.get("areaColor");return r!=null&&(t.fill=r),t}function B5(e){var t=e.style;t&&(t.stroke=t.stroke||t.fill,t.fill=null)}var w7=function(){function e(t){var r=this.group=new Me,n=this._transformGroup=new Me;r.add(n),this.uid=Zc("ec_map_draw"),this._controller=new Jc(t.getZr()),n.add(this._regionsGroup=new Me),n.add(this._svgGroup=new Me)}return e.prototype.draw=function(t,r,n,i,a){var o=this,s=t.getData&&t.getData();bf(t)&&r.eachComponent({mainType:"series",subType:"map"},function(m){!s&&m.getHostGeoModel()===t&&(s=m.getData())});var l=t.coordinateSystem,u=l.view,c=this._regionsGroup,h=this._transformGroup,f=!c.childAt(0)||a,d;l.shouldClip()?(d=QI(null,u),this.group.setClipPath(new Ye({shape:d.clone()}))):this.group.removeClipPath(),kl(h,Lc,u,f?null:t);var g=s&&s.getVisual("visualMeta")&&s.getVisual("visualMeta").length>0;l.resourceType==="geoJSON"?this._buildGeoJSON(u,n,l,t,s,g):l.resourceType==="geoSVG"&&this._buildSVG(u,n,l,t,s,g),Vb(t,n,this._controller,function(m,y,_){return t.coordinateSystem.containPoint([y,_])},d,function(){o._mouseDownFlag=!1},!1,!0),this._updateMapSelectHandler(t,c,n,i)},e.prototype.__updateOnOwnRoam=function(t){kl(this._transformGroup,Lc,t.coordinateSystem.view,null)},e.prototype._buildGeoJSON=function(t,r,n,i,a,o){var s=this._regionsGroupByName=pe(),l=pe(),u=this._regionsGroup,c=n.projection,h=c&&c.stream,f=Ml(Lg(null,t,kc));function d(y,_){return _&&(y=_(y)),y&&Kt([],y,f)}function g(y){for(var _=[],x=!h&&c&&c.project,w=0;w=0)&&(c=e);var h=o?{normal:{align:"center",verticalAlign:"middle"}}:null;Or(r,Ar(i),{labelFetcher:c,labelDataIndex:u,defaultText:n},h);var f=r.getTextContent();if(f&&(b7(f).ignore=f.ignore,r.textConfig&&o)){var d=r.getBoundingRect().clone();r.textConfig.layoutRect=d,r.textConfig.position=[(o[0]-d.x)/d.width*100+"%",(o[1]-d.y)/d.height*100+"%"]}r.disableLabelAnimation=!0}else r.removeTextContent(),r.removeTextConfig(),r.disableLabelAnimation=null}function G5(e,t,r,n,i,a){t?t.setItemGraphicEl(a,r):Re(r).eventData={componentType:"geo",componentIndex:e.componentIndex,geoIndex:e.componentIndex,name:n,region:i&&i.option||{}}}function H5(e,t,r,n,i){t||bs({el:r,componentModel:e,itemName:n,itemTooltipOption:i.get("tooltip")})}function U5(e,t,r,n){t.highDownSilentOnTouch=!!e.get("selectedMode");var i=n.getModel("emphasis"),a=i.get("focus");return Vt(t,a,i.get("blurScope"),i.get("disabled")),bf(e)&&$te(t,e,r),a}function W5(e,t,r){var n=[],i;function a(){i=[]}function o(){i.length&&(n.push(i),i=[])}var s=t({polygonStart:a,polygonEnd:o,lineStart:a,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&i.push([l,u])},sphere:function(){}});return!r&&s.polygonStart(),E(e,function(l){s.lineStart();for(var u=0;u-1&&(i.style.stroke=i.style.fill,i.style.fill=K.color.neutral00,i.style.lineWidth=2),i},t.prototype.__ownRoamView=function(){return Qx(this)?this.coordinateSystem.view:null},t.type="series."+Ic,t.dependencies=["geo"],t.layoutMode="box",t.defaultOption={z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:null,showLegendSymbol:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,selectedMode:!0,label:{show:!1,color:K.color.tertiary},itemStyle:{borderWidth:.5,borderColor:K.color.border,areaColor:K.color.background},emphasis:{label:{show:!0,color:K.color.primary},itemStyle:{areaColor:K.color.highlight}},select:{label:{show:!0,color:K.color.primary},itemStyle:{color:K.color.highlight}},nameProperty:"name"},t}(At);function S7(e){return e.indexOf("i")===0}function Qx(e){return Ig(e.seriesGroup)===e&&!e.getHostGeoModel()}function Ig(e){return e.f[0]}function sN(e,t){var r={};return e.eachRawSeriesByType(Ic,function(n){var i=n.getHostGeoModel(),a=i?"o"+i.id:"i"+n.getMapType(),o=r[a]=r[a]||{f:[],r:[]};!e.isSeriesFiltered(n)&&!t&&o.f.push(n),o.r.push(n)}),r}var ife=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Ic,r}return t.prototype.render=function(r,n,i,a){if(!(a&&a.type==="mapToggleSelect"&&a.from===this.uid)){var o=this.group;if(o.removeAll(),!r.getHostGeoModel()){var s=this._mapDraw;s&&a&&a.type==="geoRoam"&&s.resetForLabelLayout(),a&&a.type==="geoRoam"&&a.componentType==="series"&&a.seriesId===r.id?s&&o.add(s.group):Qx(r)?(s=s||(this._mapDraw=new w7(i)),o.add(s.group),s.draw(r,n,i,this,a)):this._clearMapDraw(),r.get("showLegendSymbol")&&n.getComponent("legend")&&this._renderSymbols(r)}}},t.prototype.__updateOnOwnRoam=function(r,n,i){var a=this._mapDraw;Qx(n)&&a&&a.__updateOnOwnRoam(n)},t.prototype.remove=function(){this._clearMapDraw(),this.group.removeAll()},t.prototype.dispose=function(){this._clearMapDraw()},t.prototype._clearMapDraw=function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},t.prototype._renderSymbols=function(r){var n=r.originalData,i=this.group;n.each(n.mapDimension("value"),function(a,o){if(!isNaN(a)){var s=n.getItemLayout(o);if(!(!s||!s.point)){var l=s.point,u=s.offset,c=new bo({style:{fill:r.getData().getVisual("style").fill},shape:{cx:l[0]+u*9,cy:l[1],r:3},silent:!0,z2:8+(u?0:fd+1)});if(!u){var h=Ig(r.seriesGroup).getData(),f=n.getName(o),d=h.indexOfName(f),g=n.getItemModel(o),m=g.getModel("label"),y=h.getItemGraphicEl(d);Or(c,Ar(g),{labelFetcher:{getFormattedLabel:function(_,x){return r.getFormattedLabel(d,x)}},defaultText:f}),c.disableLabelAnimation=!0,m.get("position")||c.setTextConfig({position:"bottom"}),y.onHoverStateChange=function(_){gx(c,_)}}i.add(c)}}})},t.type=Ic,t}(wt),afe={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},C7=["lng","lat"],Z5=function(e){q(t,e);function t(r,n,i){var a=e.call(this)||this;a.dimensions=C7,a.type="geo",a._nameCoordMap=pe(),a.name=r;var o=i.projection,s=ps.load(n,i.nameMap,i.nameProperty),l=ps.getGeoResource(n);a.resourceType=l?l.type:null;var u=a.regions=s.regions,c=afe[l.type];a._clip=i.clip;var h=o?!1:c.invertLongitute;a.view=new Bb(h,g7(i.ecModel,i.api),a),a.map=n,a._regionsMap=s.regionsMap,a.regions=s.regions,a.projection=o;var f;if(o)for(var d=0;d1?(S.width=w,S.height=w/y):(S.height=w,S.width=w*y),S.y=x[1]-S.height/2,S.x=x[0]-S.width/2;else{var T=e.getBoxLayoutParams();T.aspect=y,S=Bt(T,m),S=zH(e,S,y)}Kx(r,S.x,S.y,S.width,S.height),tN(r,e)}function ofe(e,t){E(t.get("geoCoord"),function(r,n){e.addGeoCoord(n,r)})}var sfe=function(){function e(){this.dimensions=C7}return e.prototype.create=function(t,r){var n=[];function i(a){return{nameProperty:a.get("nameProperty"),aspectScale:a.get("aspectScale"),projection:a.get("projection"),clip:a.getShallow("clip",!0)}}return t.eachComponent("geo",function(a,o){var s=a.get("map"),l=new Z5(s+o,s,ee({nameMap:a.get("nameMap"),api:r,ecModel:t},i(a)));n.push(l),a.coordinateSystem=l,l.model=a,l.resize=Y5,l.resize(a,r)}),t.eachSeries(function(a){om({targetModel:a,coordSysType:"geo",coordSysProvider:function(){var o=a.subType===Ic?a.getHostGeoModel():a.getReferringComponents("geo",Qt).models[0];return o&&o.coordinateSystem},allowNotFound:!0})}),E(sN(t,!0),function(a,o){if(S7(o)){var s=a.r[0],l=[];E(a.r,function(f){l.push(f.get("nameMap")),f.seriesGroup=null});var u=o.slice(1),c=new Z5(u,u,ee({nameMap:J1(l),api:r,ecModel:t},i(s))),h;E(a.r,function(f){h=_e(h,f.get("scaleLimit"))}),n.push(c),c.resize=Y5,c.resize(s,r),E(a.r,function(f){f.coordinateSystem=c,ofe(c,f)})}}),n},e.prototype.getFilledRegions=function(t,r,n,i){for(var a=(t||[]).slice(),o=pe(),s=0;s=0;o--){var s=i[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},r.push(s)}}function yfe(e,t){var r=e.isExpand?e.children:[],n=e.parentNode.children,i=e.hierNode.i?n[e.hierNode.i-1]:null;if(r.length){xfe(e);var a=(r[0].hierNode.prelim+r[r.length-1].hierNode.prelim)/2;i?(e.hierNode.prelim=i.hierNode.prelim+t(e,i),e.hierNode.modifier=e.hierNode.prelim-a):e.hierNode.prelim=a}else i&&(e.hierNode.prelim=i.hierNode.prelim+t(e,i));e.parentNode.hierNode.defaultAncestor=bfe(e,i,e.parentNode.hierNode.defaultAncestor||n[0],t)}function _fe(e){var t=e.hierNode.prelim+e.parentNode.hierNode.modifier;e.setLayout({x:t},!0),e.hierNode.modifier+=e.parentNode.hierNode.modifier}function X5(e){return arguments.length?e:Cfe}function Jv(e,t){return e-=Math.PI/2,{x:t*Math.cos(e),y:t*Math.sin(e)}}function xfe(e){for(var t=e.children,r=t.length,n=0,i=0;--r>=0;){var a=t[r];a.hierNode.prelim+=n,a.hierNode.modifier+=n,i+=a.hierNode.change,n+=a.hierNode.shift+i}}function bfe(e,t,r,n){if(t){for(var i=e,a=e,o=a.parentNode.children[0],s=t,l=i.hierNode.modifier,u=a.hierNode.modifier,c=o.hierNode.modifier,h=s.hierNode.modifier;s=PC(s),a=DC(a),s&&a;){i=PC(i),o=DC(o),i.hierNode.ancestor=e;var f=s.hierNode.prelim+h-a.hierNode.prelim-u+n(s,a);f>0&&(Sfe(wfe(s,e,r),e,f),u+=f,l+=f),h+=s.hierNode.modifier,u+=a.hierNode.modifier,l+=i.hierNode.modifier,c+=o.hierNode.modifier}s&&!PC(i)&&(i.hierNode.thread=s,i.hierNode.modifier+=h-l),a&&!DC(o)&&(o.hierNode.thread=a,o.hierNode.modifier+=u-c,r=e)}return r}function PC(e){var t=e.children;return t.length&&e.isExpand?t[t.length-1]:e.hierNode.thread}function DC(e){var t=e.children;return t.length&&e.isExpand?t[0]:e.hierNode.thread}function wfe(e,t,r){return e.hierNode.ancestor.parentNode===t.parentNode?e.hierNode.ancestor:r}function Sfe(e,t,r){var n=r/(t.hierNode.i-e.hierNode.i);t.hierNode.change-=n,t.hierNode.shift+=r,t.hierNode.modifier+=r,t.hierNode.prelim+=r,e.hierNode.change+=n}function Cfe(e,t){return e.parentNode===t.parentNode?1:2}var Bi=Ue();function A7(e){var t=e.mainData,r=e.datas;r||(r={main:t},e.datasAttr={main:"data"}),e.datas=e.mainData=null,k7(t,r,e),E(r,function(n){E(t.TRANSFERABLE_METHODS,function(i){n.wrapMethod(i,Ze(Tfe,e))})}),t.wrapMethod("cloneShallow",Ze(Afe,e)),E(t.CHANGABLE_METHODS,function(n){t.wrapMethod(n,Ze(Mfe,e))}),an(r[t.dataType]===t)}function Tfe(e,t){if(Ife(this)){var r=ee({},Bi(this).datas);r[this.dataType]=t,k7(t,r,e)}else lN(t,this.dataType,Bi(this).mainData,e);return t}function Mfe(e,t){return e.struct&&e.struct.update(),t}function Afe(e,t){return E(Bi(t).datas,function(r,n){r!==t&&lN(r.cloneShallow(),n,t,e)}),t}function kfe(e){var t=Bi(this).mainData;return e==null||t==null?t:Bi(t).datas[e]}function Lfe(){var e=Bi(this).mainData;return e==null?[{data:e}]:ae(tt(Bi(e).datas),function(t){return{type:t,data:Bi(e).datas[t]}})}function Ife(e){return Bi(e).mainData===e}function k7(e,t,r){Bi(e).datas={},E(t,function(n,i){lN(n,i,e,r)})}function lN(e,t,r,n){Bi(r).datas[t]=e,Bi(e).mainData=r,e.dataType=t,n.struct&&(e[n.structAttr]=n.struct,n.struct[n.datasAttr[t]]=e),e.getLinkedData=kfe,e.getLinkedDataAll=Lfe}var Nfe=function(){function e(t,r){this.depth=0,this.height=0,this.dataIndex=-1,this.children=[],this.viewChildren=[],this.isExpand=!1,this.name=t||"",this.hostTree=r}return e.prototype.isRemoved=function(){return this.dataIndex<0},e.prototype.eachNode=function(t,r,n){Ce(t)&&(n=r,r=t,t=null),t=t||{},ue(t)&&(t={order:t});var i=t.order||"preorder",a=this[t.attr||"children"],o;i==="preorder"&&(o=r.call(n,this));for(var s=0;!o&&sr&&(r=i.height)}this.height=r+1},e.prototype.getNodeById=function(t){if(this.getId()===t)return this;for(var r=0,n=this.children,i=n.length;r=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,r)},e.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostTree,n=r.data.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},e.prototype.setVisual=function(t,r){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,r)},e.prototype.getVisual=function(t){return this.hostTree.data.getItemVisual(this.dataIndex,t)},e.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},e.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},e.prototype.getChildIndex=function(){if(this.parentNode){for(var t=this.parentNode.children,r=0;r=0){var n=r.getData().tree.root,i=e.targetNode;if(ue(i)&&(i=n.getNodeById(i)),i&&n.contains(i))return{node:i};var a=e.targetNodeId;if(a!=null&&(i=n.getNodeById(a)))return{node:i}}}function L7(e){for(var t=[];e;)e=e.parentNode,e&&t.push(e);return t.reverse()}function cN(e,t){var r=L7(e);return Be(r,t)>=0}function Gb(e,t){for(var r=[];e;){var n=e.dataIndex;r.push({name:e.name,dataIndex:n,value:t.getRawValue(n)}),e=e.parentNode}return r.reverse(),r}var Nc="tree",Dfe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r.ignoreStyleOnData=!0,r}return t.prototype.getInitialData=function(r){var n={name:r.name,children:r.data},i=r.leaves||{},a=new Je(i,this,this.ecModel),o=uN.createTree(n,this,s);function s(h){h.wrapMethod("getItemModel",function(f,d){var g=o.getNodeByDataIndex(d);return g&&g.children.length&&g.isExpand||(f.parentModel=a),f})}var l=0;o.eachNode("preorder",function(h){h.depth>l&&(l=h.depth)});var u=r.expandAndCollapse,c=u&&r.initialTreeDepth>=0?r.initialTreeDepth:l;return o.root.eachNode("preorder",function(h){var f=h.hostTree.data.getRawDataItem(h.dataIndex);h.isExpand=f&&f.collapsed!=null?!f.collapsed:h.depth<=c}),o.data},t.prototype.getOrient=function(){var r=this.get("orient");return r==="horizontal"?r="LR":r==="vertical"&&(r="TB"),r},t.prototype.formatTooltip=function(r,n,i){for(var a=this.getData().tree,o=a.root.children[0],s=a.getNodeByDataIndex(r),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return _r("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=Gb(i,this),n.collapsed=!i.isExpand,n},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+Nc,t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,roamTrigger:"global",nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:K.color.borderTint,width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500},t}(At),Efe=function(){function e(){this.parentPoint=[],this.childPoints=[]}return e}(),Rfe=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new Efe},t.prototype.buildPath=function(r,n){var i=n.childPoints,a=i.length,o=n.parentPoint,s=i[0],l=i[a-1];if(a===1){r.moveTo(o[0],o[1]),r.lineTo(s[0],s[1]);return}var u=n.orient,c=u==="TB"||u==="BT"?0:1,h=1-c,f=he(n.forkPosition,1),d=[];d[c]=o[c],d[h]=o[h]+(l[h]-o[h])*f,r.moveTo(o[0],o[1]),r.lineTo(d[0],d[1]),r.moveTo(s[0],s[1]),d[c]=s[c],r.lineTo(d[0],d[1]),d[c]=l[c],r.lineTo(d[0],d[1]),r.lineTo(l[0],l[1]);for(var g=1;gx.x,T||(S=S-Math.PI));var A=T?"left":"right",N=s.getModel("label"),P=N.get("rotate"),I=P*(Math.PI/180),D=y.getTextContent();D&&(y.setTextConfig({position:N.get("position")||A,rotation:P==null?-S:I,origin:"center"}),D.setStyle("verticalAlign","middle"))}var O=s.get(["emphasis","focus"]),j=O==="relative"?Df(o.getAncestorsIndices(),o.getDescendantIndices()):O==="ancestor"?o.getAncestorsIndices():O==="descendant"?o.getDescendantIndices():null;j&&(Re(r).focus=j),Ofe(i,o,c,r,g,d,m,n),r.__edge&&(r.onHoverStateChange=function(B){if(B!=="blur"){var U=o.parentNode&&e.getItemGraphicEl(o.parentNode.dataIndex);U&&U.hoverState===em||gx(r.__edge,B)}})}function Ofe(e,t,r,n,i,a,o,s){var l=t.getModel(),u=e.get("edgeShape"),c=e.get("layout"),h=e.getOrient(),f=e.get(["lineStyle","curveness"]),d=e.get("edgeForkPosition"),g=l.getModel("lineStyle").getLineStyle(),m=n.__edge;if(u==="curve")t.parentNode&&t.parentNode!==r&&(m||(m=n.__edge=new vd({shape:fA(c,h,f,i,i)})),lt(m,{shape:fA(c,h,f,a,o)},e));else if(u==="polyline"&&c==="orthogonal"&&t!==r&&t.children&&t.children.length!==0&&t.isExpand===!0){for(var y=t.children,_=[],x=0;x=0;a--)r.push(i[a])}}function Bfe(e,t){e.eachSeriesByType("tree",function(r){Ffe(r,t)})}function Ffe(e,t){var r=Lr(e,t).refContainer,n=Bt(e.getBoxLayoutParams(),r);e.layoutInfo=n;var i=e.get("layout"),a=0,o=0,s=null;i==="radial"?(a=2*Math.PI,o=Math.min(n.height,n.width)/2,s=X5(function(S,T){return(S.parentNode===T.parentNode?1:2)/S.depth})):(a=n.width,o=n.height,s=X5());var l=e.getData().tree.root,u=l.children[0];if(u){mfe(l),zfe(u,yfe,s),l.hierNode.modifier=-u.hierNode.prelim,Lv(u,_fe);var c=u,h=u,f=u;Lv(u,function(S){var T=S.getLayout().x;Th.getLayout().x&&(h=S),S.depth>f.depth&&(f=S)});var d=c===h?1:s(c,h)/2,g=d-c.getLayout().x,m=0,y=0,_=0,x=0;if(i==="radial")m=a/(h.getLayout().x+d+g),y=o/(f.depth-1||1),Lv(u,function(S){_=(S.getLayout().x+g)*m,x=(S.depth-1)*y;var T=Jv(_,x);S.setLayout({x:T.x,y:T.y,rawX:_,rawY:x},!0)});else{var w=e.getOrient();w==="RL"||w==="LR"?(y=o/(h.getLayout().x+d+g),m=a/(f.depth-1||1),Lv(u,function(S){x=(S.getLayout().x+g)*y,_=w==="LR"?(S.depth-1)*m:a-(S.depth-1)*m,S.setLayout({x:_,y:x},!0)})):(w==="TB"||w==="BT")&&(m=a/(h.getLayout().x+d+g),y=o/(f.depth-1||1),Lv(u,function(S){_=(S.getLayout().x+g)*m,x=w==="TB"?(S.depth-1)*y:o-(S.depth-1)*y,S.setLayout({x:_,y:x},!0)}))}}}function Vfe(e){e.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,r){r.eachComponent({mainType:fo,subType:Nc,query:t},function(n){var i=t.dataIndex,a=n.getData().tree,o=a.getNodeByDataIndex(i);o.isExpand=!o.isExpand})}),iN(e,fo,Nc)}var Gfe=kr(Nc,Hfe);function Hfe(e){e.eachSeriesByType(Nc,function(t){var r=t.getData(),n=r.tree;n.eachNode(function(i){var a=i.getModel(),o=a.getModel("itemStyle").getItemStyle(),s=r.ensureUniqueItemVisual(i.dataIndex,"style");ee(s,o)})})}function Ufe(e){e.registerChartView(jfe),e.registerSeriesModel(Dfe),e.registerLayout(Bfe),e.registerVisual(Gfe),Vfe(e)}var e3=["treemapZoomToNode","treemapRender","treemapMove"];function Wfe(e){for(var t=0;t1;)a=a.parentNode;var o=kM(e.ecModel,a.name||a.dataIndex+"",n);i.setVisual("decal",o)})}var Zfe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventUsingHoverLayer=!0,r}return t.prototype.getInitialData=function(r,n){var i={name:r.name,children:r.data};P7(i);var a=r.levels||[],o=this.designatedVisualItemStyle={},s=new Je({itemStyle:o},this,n);a=r.levels=$fe(a,n);var l=ae(a||[],function(h){return new Je(h,s,n)},this),u=uN.createTree(i,this,c);function c(h){h.wrapMethod("getItemModel",function(f,d){var g=u.getNodeByDataIndex(d),m=g?l[g.depth]:null;return f.parentModel=m||s,f})}return u.data},t.prototype.optionUpdated=function(){this.resetViewRoot()},t.prototype.formatTooltip=function(r,n,i){var a=this.getData(),o=this.getRawValue(r),s=a.getName(r);return _r("nameValue",{name:s,value:o})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=Gb(i,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(r){this.layoutInfo=this.layoutInfo||{},ee(this.layoutInfo,r)},t.prototype.mapIdToIndex=function(r){var n=this._idIndexMap;n||(n=this._idIndexMap=pe(),this._idIndexMapCount=0);var i=n.get(r);return i==null&&n.set(r,i=this._idIndexMapCount++),i},t.prototype.getViewRoot=function(){return this._viewRoot},t.prototype.resetViewRoot=function(r){r?this._viewRoot=r:r=this._viewRoot;var n=this.getRawData().tree.root;(!r||r!==n&&!n.contains(r))&&(this._viewRoot=n)},t.prototype.enableAriaDecal=function(){N7(this)},t.type="series.treemap",t.layoutMode="box",t.defaultOption={progressive:0,coordinateSystemUsage:"box",left:K.size.l,top:K.size.xxxl,right:K.size.l,bottom:K.size.xxxl,sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.32*.32,scaleLimit:{max:5,min:.2},roam:!0,roamTrigger:"global",nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",bottom:K.size.m,emptyItemWidth:25,itemStyle:{color:K.color.backgroundShade,textStyle:{color:K.color.secondary}},emphasis:{itemStyle:{color:K.color.background}}},label:{show:!0,distance:0,padding:5,position:"inside",color:K.color.neutral00,overflow:"truncate"},upperLabel:{show:!1,position:[0,"50%"],height:20,overflow:"truncate",verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:K.color.neutral00,borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],overflow:"truncate",verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},t}(At);function P7(e){var t=0;E(e.children,function(n){P7(n);var i=n.value;ne(i)&&(i=i[0]),t+=i});var r=e.value;ne(r)&&(r=r[0]),(r==null||isNaN(r))&&(r=t),r<0&&(r=0),ne(e.value)?e.value[0]=r:e.value=r}function $fe(e,t){var r=It(t.get("color")),n=It(t.get(["aria","decal","decals"]));if(r){e=e||[];var i,a;E(e,function(s){var l=new Je(s),u=l.get("color"),c=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(i=!0),(l.get(["itemStyle","decal"])||c&&c!=="none")&&(a=!0)});var o=e[0]||(e[0]={});return i||(o.color=r.slice()),!a&&n&&(o.decal=n.slice()),e}}var Yfe=8,t3=8,EC=5,Xfe=function(){function e(t){this.group=new Me,t.add(this.group)}return e.prototype.render=function(t,r,n,i){var a=t.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!a.get("show")||!n)){var s=a.getModel("itemStyle"),l=a.getModel("emphasis"),u=s.getModel("textStyle"),c=l.getModel(["itemStyle","textStyle"]),h=Lr(t,r).refContainer,f={left:a.get("left"),right:a.get("right"),top:a.get("top"),bottom:a.get("bottom")},d={emptyItemWidth:a.get("emptyItemWidth"),totalWidth:0,renderList:[]},g=Bt(f,h);this._prepare(n,d,u),this._renderContent(t,d,g,s,l,u,c,i),bb(o,f,h)}},e.prototype._prepare=function(t,r,n){for(var i=t;i;i=i.parentNode){var a=Cr(i.getModel().get("name"),""),o=n.getTextRect(a),s=Math.max(o.width+Yfe*2,r.emptyItemWidth);r.totalWidth+=s+t3,r.renderList.push({node:i,text:a,width:s})}},e.prototype._renderContent=function(t,r,n,i,a,o,s,l){for(var u=0,c=r.emptyItemWidth,h=t.get(["breadcrumb","height"]),f=r.totalWidth,d=r.renderList,g=a.getModel("itemStyle").getItemStyle(),m=d.length-1;m>=0;m--){var y=d[m],_=y.node,x=y.width,w=y.text;f>n.width&&(f-=x-c,x=c,w=null);var S=new sn({shape:{points:qfe(u,0,x,h,m===d.length-1,m===0)},style:ke(i.getItemStyle(),{lineJoin:"bevel"}),textContent:new it({style:Lt(o,{text:w})}),textConfig:{position:"inside"},z2:fd*1e4,onclick:Ze(l,_)});S.disableLabelAnimation=!0,S.getTextContent().ensureState("emphasis").style=Lt(s,{text:w}),S.ensureState("emphasis").style=g,Vt(S,a.get("focus"),a.get("blurScope"),a.get("disabled")),this.group.add(S),Kfe(S,t,_),u+=x+t3}},e.prototype.remove=function(){this.group.removeAll()},e}();function qfe(e,t,r,n,i,a){var o=[[i?e:e-EC,t],[e+r,t],[e+r,t+n],[i?e:e-EC,t+n]];return!a&&o.splice(2,0,[e+r+EC,t+n/2]),!i&&o.push([e,t+n/2]),o}function Kfe(e,t,r){Re(e).eventData={componentType:"series",componentSubType:"treemap",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:r&&r.dataIndex,name:r&&r.name},treePathInfo:r&&Gb(r,t)}}var Jfe=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(t,r,n,i,a){return this._elExistsMap[t.id]?!1:(this._elExistsMap[t.id]=!0,this._storage.push({el:t,target:r,duration:n,delay:i,easing:a}),!0)},e.prototype.finished=function(t){return this._finishedCallback=t,this},e.prototype.start=function(){for(var t=this,r=this._storage.length,n=function(){r--,r<=0&&(t._storage.length=0,t._elExistsMap={},t._finishedCallback&&t._finishedCallback())},i=0,a=this._storage.length;i=0;l--){var u=i[n==="asc"?o-l-1:l].getValue();u/r*ts[1]&&(s[1]=u)})),{sum:n,dataExtent:s}}function lde(e,t,r){for(var n=0,i=1/0,a=0,o=void 0,s=e.length;an&&(n=o));var l=e.area*e.area,u=t*t*r;return l?Pg(u*n/l,l/(u*i)):1/0}function r3(e,t,r,n,i){var a=t===r.width?0:1,o=1-a,s=["x","y"],l=["width","height"],u=r[s[a]],c=t?e.area/t:0;(i||c>r[l[o]])&&(c=r[l[o]]);for(var h=0,f=e.length;hag&&(c=ag),i=l}ci3||Math.abs(r.dy)>i3)){var n=this.seriesModel.getData().tree.root;if(!n)return;var i=n.getLayout();if(!i)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:i.x+r.dx,y:i.y+r.dy,width:i.width,height:i.height}})}},t.prototype._onZoom=function(r){var n=r.originX,i=r.originY,a=r.scale,o=this.seriesModel;if(this._state!=="animating"){var s=o.getData().tree.root;if(!s)return;var l=s.getLayout();if(!l)return;var u=new Ae(l.x,l.y,l.width,l.height),c=o.layoutInfo,h=O7(c,l),f=h*a;f=z7(f,o);var d=f/h;n-=c.x,i-=c.y;var g=Ft();_a(g,g,[-n,-i]),eb(g,g,[d,d]),_a(g,g,[n,i]),u.applyTransform(g),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:u.x,y:u.y,width:u.width,height:u.height}})}},t.prototype._initEvents=function(r){var n=this;r.on("click",function(i){if(n._state==="ready"){var a=n.seriesModel.get("nodeClick",!0);if(a){var o=n.findTarget(i.offsetX,i.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)n._rootToNode(o);else if(a==="zoomToNode")n._zoomToNode(o);else if(a==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),c=l.get("target",!0)||"blank";u&&Sx(u,c)}}}}},this)},t.prototype._renderBreadcrumb=function(r,n,i){var a=this;i||(i=r.get("leafDepth",!0)!=null?{node:r.getViewRoot()}:this.findTarget(n.getWidth()/2,n.getHeight()/2),i||(i={node:r.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new Xfe(this.group))).render(r,n,i.node,function(o){a._state!=="animating"&&(cN(r.getViewRoot(),o)?a._rootToNode({node:o}):a._zoomToNode({node:o}))})},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=Iv(),this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},t.prototype.dispose=function(){this._clearController()},t.prototype._zoomToNode=function(r){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype._rootToNode=function(r){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:r.node})},t.prototype.findTarget=function(r,n){var i,a=this.seriesModel.getViewRoot();return a.eachNode({attr:"viewChildren",order:"preorder"},function(o){var s=this._storage.background[o.getRawIndex()];if(s){var l=s.transformCoordToLocal(r,n),u=s.shape;if(u.x<=l[0]&&l[0]<=u.x+u.width&&u.y<=l[1]&&l[1]<=u.y+u.height)i={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),i},t.type="treemap",t}(wt);function Iv(){return{nodeGroup:[],background:[],content:[]}}function pde(e,t,r,n,i,a,o,s,l,u){if(!o)return;var c=o.getLayout(),h=e.getData(),f=o.getModel();if(h.setItemGraphicEl(o.dataIndex,null),!c||!c.isInView)return;var d=c.width,g=c.height,m=c.borderWidth,y=c.invisible,_=o.getRawIndex(),x=s&&s.getRawIndex(),w=o.viewChildren,S=c.upperHeight,T=w&&w.length,M=f.getModel("itemStyle"),A=f.getModel(["emphasis","itemStyle"]),N=f.getModel(["blur","itemStyle"]),P=f.getModel(["select","itemStyle"]),I=M.get("borderRadius")||0,D=oe("nodeGroup",dA);if(!D)return;if(l.add(D),D.x=c.x||0,D.y=c.y||0,D.markRedraw(),t1(D).nodeWidth=d,t1(D).nodeHeight=g,c.isAboveViewRoot)return D;var O=oe("background",n3,u,fde);O&&W(D,O,T&&c.upperLabelHeight);var j=f.getModel("emphasis"),B=j.get("focus"),U=j.get("blurScope"),H=j.get("disabled"),V=B==="ancestor"?o.getAncestorsIndices():B==="descendant"?o.getDescendantIndices():B;if(T)lg(D)&&Vu(D,!1),O&&(Vu(O,!H),h.setItemGraphicEl(o.dataIndex,O),mM(O,V,U));else{var z=oe("content",n3,u,dde);z&&Z(D,z),O.disableMorphing=!0,O&&lg(O)&&Vu(O,!1),Vu(D,!H),h.setItemGraphicEl(o.dataIndex,D);var $=f.getShallow("cursor");$&&z.attr("cursor",$),mM(D,V,U)}return D;function W(we,ve,Ne){var xe=Re(ve);if(xe.dataIndex=o.dataIndex,xe.seriesIndex=e.seriesIndex,ve.setShape({x:0,y:0,width:d,height:g,r:I}),y)X(ve);else{ve.invisible=!1;var Le=o.getVisual("style"),ht=Le.stroke,Fe=s3(M);Fe.fill=ht;var nt=ku(A);nt.fill=A.get("borderColor");var ft=ku(N);ft.fill=N.get("borderColor");var Ot=ku(P);if(Ot.fill=P.get("borderColor"),Ne){var Xe=d-2*m;re(ve,ht,Le.opacity,{x:m,y:0,width:Xe,height:S})}else ve.removeTextContent();ve.setStyle(Fe),ve.ensureState("emphasis").style=nt,ve.ensureState("blur").style=ft,ve.ensureState("select").style=Ot,mc(ve)}we.add(ve)}function Z(we,ve){var Ne=Re(ve);Ne.dataIndex=o.dataIndex,Ne.seriesIndex=e.seriesIndex;var xe=Math.max(d-2*m,0),Le=Math.max(g-2*m,0);if(ve.culling=!0,ve.setShape({x:m,y:m,width:xe,height:Le,r:I}),y)X(ve);else{ve.invisible=!1;var ht=o.getVisual("style"),Fe=ht.fill,nt=s3(M);nt.fill=Fe,nt.decal=ht.decal;var ft=ku(A),Ot=ku(N),Xe=ku(P);re(ve,Fe,ht.opacity,null),ve.setStyle(nt),ve.ensureState("emphasis").style=ft,ve.ensureState("blur").style=Ot,ve.ensureState("select").style=Xe,mc(ve)}we.add(ve)}function X(we){!we.invisible&&a.push(we)}function re(we,ve,Ne,xe){var Le=f.getModel(xe?o3:a3),ht=Cr(f.get("name"),null),Fe=Le.getShallow("show");Or(we,Ar(f,xe?o3:a3),{defaultText:Fe?ht:null,inheritColor:ve,defaultOpacity:Ne,labelFetcher:e,labelDataIndex:o.dataIndex});var nt=we.getTextContent();if(nt){var ft=nt.style,Ot=qg(ft.padding||0);xe&&(we.setTextConfig({layoutRect:xe}),nt.disableLabelLayout=!0),nt.beforeUpdate=function(){var Zt=Math.max((xe?xe.width:we.shape.width)-Ot[1]-Ot[3],0),On=Math.max((xe?xe.height:we.shape.height)-Ot[0]-Ot[2],0);(ft.width!==Zt||ft.height!==On)&&nt.setStyle({width:Zt,height:On})},ft.truncateMinChar=2,ft.lineOverflow="truncate",J(ft,xe,c);var Xe=nt.getState("emphasis");J(Xe?Xe.style:null,xe,c)}}function J(we,ve,Ne){var xe=we?we.text:null;if(!ve&&Ne.isLeafRoot&&xe!=null){var Le=e.get("drillDownIcon",!0);we.text=Le?Le+" "+xe:xe}}function oe(we,ve,Ne,xe){var Le=x!=null&&r[we][x],ht=i[we];return Le?(r[we][x]=null,le(ht,Le)):y||(Le=new ve,Le instanceof Zi&&(Le.z2=gde(Ne,xe)),De(ht,Le)),t[we][_]=Le}function le(we,ve){var Ne=we[_]={};ve instanceof dA?(Ne.oldX=ve.x,Ne.oldY=ve.y):Ne.oldShape=ee({},ve.shape)}function De(we,ve){var Ne=we[_]={},xe=o.parentNode,Le=ve instanceof Me;if(xe&&(!n||n.direction==="drillDown")){var ht=0,Fe=0,nt=i.background[xe.getRawIndex()];!n&&nt&&nt.oldShape&&(ht=nt.oldShape.width,Fe=nt.oldShape.height),Le?(Ne.oldX=0,Ne.oldY=Fe):Ne.oldShape={x:ht,y:Fe,width:0,height:0}}Ne.fadein=!Le}}function gde(e,t){return e*hde+t}var Dg=E,mde=Ie,r1=-1,jr=function(){function e(t){var r=t.mappingMethod,n=t.type,i=this.option=Se(t);this.type=n,this.mappingMethod=r,this._normalizeData=xde[r];var a=e.visualHandlers[n];this.applyVisual=a.applyVisual,this.getColorMapper=a.getColorMapper,this._normalizedToVisual=a._normalizedToVisual[r],r==="piecewise"?(RC(i),yde(i)):r==="category"?i.categories?_de(i):RC(i,!0):(an(r!=="linear"||i.dataExtent),RC(i))}return e.prototype.mapValueToVisual=function(t){var r=this._normalizeData(t);return this._normalizedToVisual(r,t)},e.prototype.getNormalizer=function(){return de(this._normalizeData,this)},e.listVisualTypes=function(){return tt(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(t,r,n){Ie(t)?E(t,r,n):r.call(n,t)},e.mapVisual=function(t,r,n){var i,a=ne(t)?[]:Ie(t)?{}:(i=!0,null);return e.eachVisual(t,function(o,s){var l=r.call(n,o,s);i?a=l:a[s]=l}),a},e.retrieveVisuals=function(t){var r={},n;return t&&Dg(e.visualHandlers,function(i,a){t.hasOwnProperty(a)&&(r[a]=t[a],n=!0)}),n?r:null},e.prepareVisualTypes=function(t){if(ne(t))t=t.slice();else if(mde(t)){var r=[];Dg(t,function(n,i){r.push(i)}),t=r}else return[];return t.sort(function(n,i){return i==="color"&&n!=="color"&&n.indexOf("color")===0?1:-1}),t},e.dependsOn=function(t,r){return r==="color"?!!(t&&t.indexOf(r)===0):t===r},e.findPieceIndex=function(t,r,n){for(var i,a=1/0,o=0,s=r.length;o=0;a--)n[a]==null&&(delete r[t[a]],t.pop())}function RC(e,t){var r=e.visual,n=[];Ie(r)?Dg(r,function(a){n.push(a)}):r!=null&&n.push(r);var i={color:1,symbol:1};!t&&n.length===1&&!i.hasOwnProperty(e.type)&&(n[1]=n[0]),B7(e,n)}function g0(e){return{applyVisual:function(t,r,n){var i=this.mapValueToVisual(t);n("color",e(r("color"),i))},_normalizedToVisual:vA([0,1])}}function l3(e){var t=this.option.visual;return t[Math.round(ct(e,[0,1],[0,t.length-1],!0))]||{}}function Nv(e){return function(t,r,n){n(e,this.mapValueToVisual(t))}}function Qv(e){var t=this.option.visual;return t[this.option.loop&&e!==r1?e%t.length:e]}function Lu(){return this.option.visual[0]}function vA(e){return{linear:function(t){return ct(t,e,this.option.visual,!0)},category:Qv,piecewise:function(t,r){var n=pA.call(this,r);return n==null&&(n=ct(t,e,this.option.visual,!0)),n},fixed:Lu}}function pA(e){var t=this.option,r=t.pieceList;if(t.hasSpecialVisual){var n=jr.findPieceIndex(e,r),i=r[n];if(i&&i.visual)return i.visual[this.type]}}function B7(e,t){return e.visual=t,e.type==="color"&&(e.parsedVisual=ae(t,function(r){var n=yn(r);return n||[0,0,0,1]})),t}var xde={linear:function(e){return ct(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,r=jr.findPieceIndex(e,t,!0);if(r!=null)return ct(r,[0,t.length-1],[0,1],!0)},category:function(e){var t=this.option.categories?this.option.categoryMap[e]:e;return t??r1},fixed:qt};function m0(e,t,r){return e?t<=r:t=r.length||m===r[m.depth]){var _=Mde(i,l,m,y,g,n);V7(m,_,r,n)}})}}}function Sde(e,t,r){var n=ee({},t),i=r.designatedVisualItemStyle;return E(["color","colorAlpha","colorSaturation"],function(a){i[a]=t[a];var o=e.get(a);i[a]=null,o!=null&&(n[a]=o)}),n}function u3(e){var t=jC(e,"color");if(t){var r=jC(e,"colorAlpha"),n=jC(e,"colorSaturation");return n&&(t=qo(t,null,null,n)),r&&(t=tg(t,r)),t}}function Cde(e,t){return t!=null?qo(t,null,null,e):null}function jC(e,t){var r=e[t];if(r!=null&&r!=="none")return r}function Tde(e,t,r,n,i,a){if(!(!a||!a.length)){var o=OC(t,"color")||i.color!=null&&i.color!=="none"&&(OC(t,"colorAlpha")||OC(t,"colorSaturation"));if(o){var s=t.get("visualMin"),l=t.get("visualMax"),u=r.dataExtent.slice();s!=null&&su[1]&&(u[1]=l);var c=t.get("colorMappingBy"),h={type:o.name,dataExtent:u,visual:o.range};h.type==="color"&&(c==="index"||c==="id")?(h.mappingMethod="category",h.loop=!0):h.mappingMethod="linear";var f=new jr(h);return F7(f).drColorMappingBy=c,f}}}function OC(e,t){var r=e.get(t);return ne(r)&&r.length?{name:t,range:r}:null}function Mde(e,t,r,n,i,a){var o=ee({},t);if(i){var s=i.type,l=s==="color"&&F7(i).drColorMappingBy,u=l==="index"?n:l==="id"?a.mapIdToIndex(r.getId()):r.getValue(e.get("visualDimension"));o[s]=i.mapValueToVisual(u)}return o}function Ade(e){e.registerSeriesModel(Zfe),e.registerChartView(vde),e.registerVisual(wde),e.registerLayout(nde),Wfe(e)}function Mh(e){return"_EC_"+e}var kde=function(){function e(t){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=t||!1}return e.prototype.isDirected=function(){return this._directed},e.prototype.addNode=function(t,r){t=t==null?""+r:""+t;var n=this._nodesMap;if(!n[Mh(t)]){var i=new Iu(t,r);return i.hostGraph=this,this.nodes.push(i),n[Mh(t)]=i,i}},e.prototype.getNodeByIndex=function(t){var r=this.data.getRawIndex(t);return this.nodes[r]},e.prototype.getNodeById=function(t){return this._nodesMap[Mh(t)]},e.prototype.addEdge=function(t,r,n){var i=this._nodesMap,a=this._edgesMap;if(at(t)&&(t=this.nodes[t]),at(r)&&(r=this.nodes[r]),t instanceof Iu||(t=i[Mh(t)]),r instanceof Iu||(r=i[Mh(r)]),!(!t||!r)){var o=t.id+"-"+r.id,s=new G7(t,r,n);return s.hostGraph=this,this._directed&&(t.outEdges.push(s),r.inEdges.push(s)),t.edges.push(s),t!==r&&r.edges.push(s),this.edges.push(s),a[o]=s,s}},e.prototype.getEdgeByIndex=function(t){var r=this.edgeData.getRawIndex(t);return this.edges[r]},e.prototype.getEdge=function(t,r){t instanceof Iu&&(t=t.id),r instanceof Iu&&(r=r.id);var n=this._edgesMap;return this._directed?n[t+"-"+r]:n[t+"-"+r]||n[r+"-"+t]},e.prototype.eachNode=function(t,r){for(var n=this.nodes,i=n.length,a=0;a=0&&t.call(r,n[a],a)},e.prototype.eachEdge=function(t,r){for(var n=this.edges,i=n.length,a=0;a=0&&n[a].node1.dataIndex>=0&&n[a].node2.dataIndex>=0&&t.call(r,n[a],a)},e.prototype.breadthFirstTraverse=function(t,r,n,i){if(r instanceof Iu||(r=this._nodesMap[Mh(r)]),!!r){for(var a=n==="out"?"outEdges":n==="in"?"inEdges":"edges",o=0;o=0&&l.node2.dataIndex>=0});for(var a=0,o=i.length;a=0&&!t.hasKey(g)&&(t.set(g,!0),o.push(d.node1))}for(l=0;l=0&&!t.hasKey(w)&&(t.set(w,!0),s.push(x.node2))}}}return{edge:t.keys(),node:r.keys()}},e}(),G7=function(){function e(t,r,n){this.dataIndex=-1,this.node1=t,this.node2=r,this.dataIndex=n??-1}return e.prototype.getModel=function(t){if(!(this.dataIndex<0)){var r=this.hostGraph,n=r.edgeData.getItemModel(this.dataIndex);return n.getModel(t)}},e.prototype.getAdjacentDataIndices=function(){return{edge:[this.dataIndex],node:[this.node1.dataIndex,this.node2.dataIndex]}},e.prototype.getTrajectoryDataIndices=function(){var t=pe(),r=pe();t.set(this.dataIndex,!0);for(var n=[this.node1],i=[this.node2],a=0;a=0&&!t.hasKey(h)&&(t.set(h,!0),n.push(c.node1))}for(a=0;a=0&&!t.hasKey(m)&&(t.set(m,!0),i.push(g.node2))}return{edge:t.keys(),node:r.keys()}},e}();function H7(e,t){return{getValue:function(r){var n=this[e][t];return n.getStore().get(n.getDimensionIndex(r||"value"),this.dataIndex)},setVisual:function(r,n){this.dataIndex>=0&&this[e][t].setItemVisual(this.dataIndex,r,n)},getVisual:function(r){return this[e][t].getItemVisual(this.dataIndex,r)},setLayout:function(r,n){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,r,n)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}vr(Iu,H7("hostGraph","data"));vr(G7,H7("hostGraph","edgeData"));function fN(e,t,r,n,i){for(var a=new kde(n),o=0;o "+f)),u++)}var d=r.get("coordinateSystem"),g;if(d==="cartesian2d"||d==="polar"||d==="matrix")g=wo(e,r);else{var m=xd.get(d),y=m?m.dimensions||[]:[];Be(y,"value")<0&&y.concat(["value"]);var _=Cd(e,{coordDimensions:y,encodeDefine:r.getEncode()}).dimensions;g=new _n(_,r),g.initData(e)}var x=new _n(["value"],r);return x.initData(l,s),i&&i(g,x),A7({mainData:g,struct:a,structAttr:"graph",datas:{node:g,edge:x},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a}var gA="-->",Hb=function(e){return e.get("autoCurveness")||null},U7=function(e,t){var r=Hb(e),n=20,i=[];if(at(r))n=r;else if(ne(r)){e.__curvenessList=r;return}t>n&&(n=t);var a=n%2?n+2:n+3;i=[];for(var o=0;o "),value:o.value,noValue:o.value==null})}var h=yU({series:this,dataIndex:r,multipleSeries:n});return h},t.prototype._updateCategoriesData=function(){var r=ae(this.option.categories||[],function(i){return i.value!=null?i:ee({value:0},i)}),n=new _n(["value"],this);n.initData(r),this._categoriesData=n,this._categoriesModels=n.mapArray(function(i){return n.getItemModel(i)})},t.prototype.isAnimationEnabled=function(){return e.prototype.isAnimationEnabled.call(this)&&!(this.get("layout")==="force"&&this.get(["force","layoutAnimation"]))},t.prototype.__ownRoamView=function(){var r=this.coordinateSystem;return f7(r)&&r},t.type="series."+En,t.dependencies=["grid","polar","geo","singleAxis","calendar"],t.defaultOption={z:2,coordinateSystem:"view",legendHoverLink:!0,layout:null,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,friction:.6,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle",distance:5},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:K.color.neutral50,width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(At);function y0(e){return e instanceof Array||(e=[e,e]),e}var Ede=kr(En,Rde);function Rde(e){e.eachSeriesByType(En,function(t){var r=t.getGraph(),n=t.getEdgeData(),i=y0(t.get("edgeSymbol")),a=y0(t.get("edgeSymbolSize"));n.setVisual("fromSymbol",i&&i[0]),n.setVisual("toSymbol",i&&i[1]),n.setVisual("fromSymbolSize",a&&a[0]),n.setVisual("toSymbolSize",a&&a[1]),n.setVisual("style",t.getModel("lineStyle").getLineStyle()),n.each(function(o){var s=n.getItemModel(o),l=r.getEdgeByIndex(o),u=y0(s.getShallow("symbol",!0)),c=y0(s.getShallow("symbolSize",!0)),h=s.getModel("lineStyle").getLineStyle(),f=n.ensureUniqueItemVisual(o,"style");switch(ee(f,h),f.stroke){case"source":{var d=l.node1.getVisual("style");f.stroke=d&&d.fill;break}case"target":{var d=l.node2.getVisual("style");f.stroke=d&&d.fill;break}}u[0]&&l.setVisual("fromSymbol",u[0]),u[1]&&l.setVisual("toSymbol",u[1]),c[0]&&l.setVisual("fromSymbolSize",c[0]),c[1]&&l.setVisual("toSymbolSize",c[1])})})}function Z7(e){var t=e.coordinateSystem;if(!(t&&t.type!=="view")){var r=e.getGraph();r.eachNode(function(n){var i=n.getModel();n.setLayout([+i.get("x"),+i.get("y")])}),vN(r,e)}}function vN(e,t){e.eachEdge(function(r,n){var i=qn(r.getModel().get(["lineStyle","curveness"]),-dN(r,t,n,!0),0),a=qa(r.node1.getLayout()),o=qa(r.node2.getLayout()),s=[a,o];+i&&s.push([(a[0]+o[0])/2-(a[1]-o[1])*i,(a[1]+o[1])/2-(o[0]-a[0])*i]),r.setLayout(s)})}var jde=kr(En,Ode);function Ode(e,t){e.eachSeriesByType(En,function(r){var n=r.get("layout"),i=r.coordinateSystem;if(i&&i.type!=="view"){var a=r.getData(),o=[];E(i.dimensions,function(f){o=o.concat(a.mapDimensionsAll(f))});for(var s=0;s0&&(T[0]=-T[0],T[1]=-T[1]);var A=S[0]<0?-1:1;if(a.__position!=="start"&&a.__position!=="end"){var N=-Math.atan2(S[1],S[0]);h[0].8?"left":f[0]<-.8?"right":"center",m=f[1]>.8?"top":f[1]<-.8?"bottom":"middle";break;case"start":a.x=-f[0]*_+c[0],a.y=-f[1]*x+c[1],g=f[0]>.8?"right":f[0]<-.8?"left":"center",m=f[1]>.8?"bottom":f[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":a.x=_*A+c[0],a.y=c[1]+P,g=S[0]<0?"right":"left",a.originX=-_*A,a.originY=-P;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":a.x=M[0],a.y=M[1]+P,g="center",a.originY=-P;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":a.x=-_*A+h[0],a.y=h[1]+P,g=S[0]>=0?"right":"left",a.originX=_*A,a.originY=-P;break}a.scaleX=a.scaleY=o,a.setStyle({verticalAlign:a.__verticalAlign||m,align:a.__align||g})}},t}(Me),mN=function(){function e(t){this.group=new Me,this._LineCtor=t||gN}return e.prototype.updateData=function(t){var r=this;this._progressiveEls=null;var n=this,i=n.group,a=n._lineData;n._lineData=t,a||i.removeAll();var o=p3(t);t.diff(a).add(function(s){r._doAdd(t,s,o)}).update(function(s,l){r._doUpdate(a,t,l,s,o)}).remove(function(s){i.remove(a.getItemGraphicEl(s))}).execute()},e.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(r,n){r.updateLayout(t,n)},this)},e.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=p3(t),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(t,r,n){this._progressiveEls=[];function i(l){!l.isGroup&&!$de(l)&&(l.incremental=n,l.ensureState("emphasis").hoverLayer=gd)}for(var a=t.start;a0}function p3(e){var t=e.hostModel,r=t.getModel("emphasis");return{lineStyle:t.getModel("lineStyle").getLineStyle(),emphasisLineStyle:r.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:t.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:t.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:r.get("disabled"),blurScope:r.get("blurScope"),focus:r.get("focus"),labelStatesModels:Ar(t)}}function g3(e){return isNaN(e[0])||isNaN(e[1])}function GC(e){return e&&!g3(e[0])&&!g3(e[1])}var HC=[],UC=[],WC=[],kh=Hr,ZC=hl,m3=Math.abs;function y3(e,t,r){for(var n=e[0],i=e[1],a=e[2],o=1/0,s,l=r*r,u=.1,c=.1;c<=.9;c+=.1){HC[0]=kh(n[0],i[0],a[0],c),HC[1]=kh(n[1],i[1],a[1],c);var h=m3(ZC(HC,t)-l);h=0?s=s+u:s=s-u:g>=0?s=s-u:s=s+u}return s}function $C(e,t){var r=[],n=Qp,i=[[],[],[]],a=[[],[]],o=[];t/=2,e.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),h=s.getVisual("toSymbol");u.__original||(u.__original=[qa(u[0]),qa(u[1])],u[2]&&u.__original.push(qa(u[2])));var f=u.__original;if(u[2]!=null){if(Kr(i[0],f[0]),Kr(i[1],f[2]),Kr(i[2],f[1]),c&&c!=="none"){var d=tp(s.node1),g=y3(i,f[0],d*t);n(i[0][0],i[1][0],i[2][0],g,r),i[0][0]=r[3],i[1][0]=r[4],n(i[0][1],i[1][1],i[2][1],g,r),i[0][1]=r[3],i[1][1]=r[4]}if(h&&h!=="none"){var d=tp(s.node2),g=y3(i,f[1],d*t);n(i[0][0],i[1][0],i[2][0],g,r),i[1][0]=r[1],i[2][0]=r[2],n(i[0][1],i[1][1],i[2][1],g,r),i[1][1]=r[1],i[2][1]=r[2]}Kr(u[0],i[0]),Kr(u[1],i[2]),Kr(u[2],i[1])}else{if(Kr(a[0],f[0]),Kr(a[1],f[1]),Xs(o,a[1],a[0]),Bc(o,o),c&&c!=="none"){var d=tp(s.node1);Q_(a[0],a[0],o,d*t)}if(h&&h!=="none"){var d=tp(s.node2);Q_(a[1],a[1],o,-d*t)}Kr(u[0],a[0]),Kr(u[1],a[1])}})}var q7=Ue();function Yde(e){if(e)return q7(e).bridge}function _3(e,t){e&&(q7(e).bridge=t)}var Xde=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=En,r}return t.prototype.init=function(r,n){var i=new dm,a=new mN,o=this.group,s=new Me;this._controller=new Jc(n.getZr()),s.add(i.group),s.add(a.group),o.add(s),this._symbolDraw=i,this._lineDraw=a,this._mainGroup=s,this._firstRender=!0},t.prototype.render=function(r,n,i){var a=this,o=Jx(r),s=!1;this._model=r,this._api=i,this._active=!0;var l=this._mainGroup,u=this._getThumbnailInfo();u&&u.bridge.reset(i);var c=this._symbolDraw,h=this._lineDraw;o&&kl(l,go,o,this._firstRender?null:r),$C(r.getGraph(),ep(r));var f=r.getData();c.updateData(f);var d=r.getEdgeData();h.updateData(d),this._updateNodeAndLinkScale(),o&&Vb(r,i,this._controller,function(S,T,M){return r.coordinateSystem.containPoint([T,M])},null),clearTimeout(this._layoutTimeout);var g=r.forceLayout,m=r.get(["force","layoutAnimation"]);g&&(s=!0,this._startForceLayoutIteration(g,i,m));var y=r.get("layout");f.graph.eachNode(function(S){var T=S.dataIndex,M=S.getGraphicEl(),A=S.getModel();if(M){M.off("drag").off("dragend");var N=A.get("draggable");N&&M.on("drag",function(I){switch(y){case"force":g.warmUp(),!a._layouting&&a._startForceLayoutIteration(g,i,m),g.setFixed(T),f.setItemLayout(T,[M.x,M.y]);break;case"circular":f.setItemLayout(T,[M.x,M.y]),S.setLayout({fixed:!0},!0),pN(r,"symbolSize",S,[I.offsetX,I.offsetY]),a.updateLayout(r);break;case"none":default:f.setItemLayout(T,[M.x,M.y]),vN(r.getGraph(),r),a.updateLayout(r);break}}).on("dragend",function(){g&&g.setUnfixed(T)}),M.setDraggable(N,!!A.get("cursor"));var P=A.get(["emphasis","focus"]);P==="adjacency"&&(Re(M).focus=S.getAdjacentDataIndices())}}),f.graph.eachEdge(function(S){var T=S.getGraphicEl(),M=S.getModel().get(["emphasis","focus"]);T&&M==="adjacency"&&(Re(T).focus={edge:[S.dataIndex],node:[S.node1.dataIndex,S.node2.dataIndex]})});var _=r.get("layout")==="circular"&&r.get(["circular","rotateLabel"]),x=f.getLayout("cx"),w=f.getLayout("cy");f.graph.eachNode(function(S){$7(S,_,x,w)}),this._firstRender=!1,s||this._renderThumbnail(r,i,this._symbolDraw,this._lineDraw)},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose()},t.prototype._startForceLayoutIteration=function(r,n,i){var a=this,o=!1;(function s(){r.step(function(l){a.updateLayout(a._model),(l||!o)&&(o=!0,a._renderThumbnail(a._model,n,a._symbolDraw,a._lineDraw)),(a._layouting=!l)&&(i?a._layoutTimeout=setTimeout(s,16):s())})})()},t.prototype.__updateOnOwnRoam=function(r,n,i){var a=Jx(n);!this._active||!a||(kl(this._mainGroup,go,a,null),x7(r)&&(this._updateNodeAndLinkScale(),$C(n.getGraph(),ep(n)),this._lineDraw.updateLayout(),i.updateLabelLayout()),this._updateThumbnailWindow())},t.prototype._updateNodeAndLinkScale=function(){var r=this._model,n=r.getData(),i=ep(r);n.eachItemGraphicEl(function(a,o){a&&a.setSymbolScale(i)})},t.prototype.updateLayout=function(r){this._active&&($C(r.getGraph(),ep(r)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout())},t.prototype.remove=function(){this._active=!1,clearTimeout(this._layoutTimeout),this._layouting=!1,this._layoutTimeout=null,this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove(),this._controller&&this._controller.disable()},t.prototype._getThumbnailInfo=function(){var r=this._model,n=r.coordinateSystem;if(n.type==="view"){var i=Yde(r);if(i)return{bridge:i,coordSys:n}}},t.prototype._updateThumbnailWindow=function(){var r=this._getThumbnailInfo();r&&r.bridge.updateWindow(qx(null,r.coordSys),this._api)},t.prototype._renderThumbnail=function(r,n,i,a){var o=this._getThumbnailInfo();if(o){var s=new Me,l=i.group.children(),u=a.group.children(),c=new Me,h=new Me;s.add(h),s.add(c);for(var f=0;f "),value:a.value,noValue:a.value==null})}return _r("nameValue",{name:a.name,value:a.value,noValue:a.value==null})},t.prototype.getDataParams=function(r,n){var i=e.prototype.getDataParams.call(this,r,n);if(n==="node"){var a=this.getData(),o=this.getGraph().getNodeByIndex(r);if(i.name==null&&(i.name=a.getName(r)),i.value==null){var s=o.getLayout().value;i.value=s}}return i},t.type="series."+Rg,t.defaultOption={z:2,coordinateSystem:"none",legendHoverLink:!0,colorBy:"data",left:0,top:0,right:0,bottom:0,width:null,height:null,center:["50%","50%"],radius:["70%","80%"],clockwise:!0,startAngle:90,endAngle:"auto",minAngle:0,padAngle:3,itemStyle:{borderRadius:[0,0,5,5]},lineStyle:{width:0,color:"source",opacity:.2},label:{show:!0,position:"outside",distance:5},emphasis:{focus:"adjacency",lineStyle:{opacity:.5}}},t}(At),x3=function(e){q(t,e);function t(r,n,i){var a=e.call(this)||this;Re(a).dataType="node",a.z2=2;var o=new it;return a.setTextContent(o),a.updateData(r,n,i,!0),a}return t.prototype.updateData=function(r,n,i,a){var o=this,s=r.graph.getNodeByIndex(n),l=r.hostModel,u=s.getModel(),c=u.getModel("emphasis"),h=r.getItemLayout(n),f=ee($a(u.getModel("itemStyle"),h,!0),h),d=this;if(isNaN(f.startAngle)){d.setShape(f);return}a?d.setShape(f):lt(d,{shape:f},l,n);var g=ee($a(u.getModel("itemStyle"),h,!0),h);o.setShape(g),o.useStyle(r.getItemVisual(n,"style")),Mr(o,u),this._updateLabel(l,u,s),r.setItemGraphicEl(n,d),Mr(d,u,"itemStyle");var m=c.get("focus");Vt(this,m==="adjacency"?s.getAdjacentDataIndices():m,c.get("blurScope"),c.get("disabled"))},t.prototype._updateLabel=function(r,n,i){var a=this.getTextContent(),o=i.getLayout(),s=(o.startAngle+o.endAngle)/2,l=Math.cos(s),u=Math.sin(s),c=n.getModel("label");a.ignore=!c.get("show");var h=Ar(n),f=i.getVisual("style");Or(a,h,{labelFetcher:{getFormattedLabel:function(x,w,S,T,M,A){return r.getFormattedLabel(x,w,"node",T,qn(M,h.normal&&h.normal.get("formatter"),n.get("name")),A)}},labelDataIndex:i.dataIndex,defaultText:i.dataIndex+"",inheritColor:f.fill,defaultOpacity:f.opacity,defaultOutsidePosition:"startArc"});var d=c.get("position")||"outside",g=c.get("distance")||0,m;d==="outside"?m=o.r+g:m=(o.r+o.r0)/2,this.textConfig={inside:d!=="outside"};var y=d!=="outside"?c.get("align")||"center":l>0?"left":"right",_=d!=="outside"?c.get("verticalAlign")||"middle":u>0?"top":"bottom";a.attr({x:l*m+o.cx,y:u*m+o.cy,rotation:0,style:{align:y,verticalAlign:_}})},t}(on),rve=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this)||this;return Re(o).dataType="edge",o.updateData(r,n,i,a,!0),o}return t.prototype.buildPath=function(r,n){r.moveTo(n.s1[0],n.s1[1]);var i=.7,a=n.clockwise;r.arc(n.cx,n.cy,n.r,n.sStartAngle,n.sEndAngle,!a),r.bezierCurveTo((n.cx-n.s2[0])*i+n.s2[0],(n.cy-n.s2[1])*i+n.s2[1],(n.cx-n.t1[0])*i+n.t1[0],(n.cy-n.t1[1])*i+n.t1[1],n.t1[0],n.t1[1]),r.arc(n.cx,n.cy,n.r,n.tStartAngle,n.tEndAngle,!a),r.bezierCurveTo((n.cx-n.t2[0])*i+n.t2[0],(n.cy-n.t2[1])*i+n.t2[1],(n.cx-n.s1[0])*i+n.s1[0],(n.cy-n.s1[1])*i+n.s1[1],n.s1[0],n.s1[1]),r.closePath()},t.prototype.updateData=function(r,n,i,a,o){var s=r.hostModel,l=n.graph.getEdgeByIndex(i),u=l.getLayout(),c=l.node1.getModel(),h=n.getItemModel(l.dataIndex),f=h.getModel("lineStyle"),d=h.getModel("emphasis"),g=d.get("focus"),m=ee($a(c.getModel("itemStyle"),u,!0),u),y=this;if(isNaN(m.sStartAngle)||isNaN(m.tStartAngle)){y.setShape(m);return}o?(y.setShape(m),b3(y,l,r,f)):($i(y),b3(y,l,r,f),lt(y,{shape:m},s,i)),Vt(this,g==="adjacency"?l.getAdjacentDataIndices():g,d.get("blurScope"),d.get("disabled")),Mr(y,h,"lineStyle"),n.setItemGraphicEl(l.dataIndex,y)},t}(Qe);function b3(e,t,r,n){var i=t.node1,a=t.node2,o=e.style;e.setStyle(n.getLineStyle());var s=n.get("color");switch(s){case"source":o.fill=r.getItemVisual(i.dataIndex,"style").fill,o.decal=i.getVisual("style").decal;break;case"target":o.fill=r.getItemVisual(a.dataIndex,"style").fill,o.decal=a.getVisual("style").decal;break;case"gradient":var l=r.getItemVisual(i.dataIndex,"style").fill,u=r.getItemVisual(a.dataIndex,"style").fill;if(ue(l)&&ue(u)){var c=e.shape,h=(c.s1[0]+c.s2[0])/2,f=(c.s1[1]+c.s2[1])/2,d=(c.t1[0]+c.t2[0])/2,g=(c.t1[1]+c.t2[1])/2;o.fill=new Uc(h,f,d,g,[{offset:0,color:l},{offset:1,color:u}],!0)}break}}var nve=Math.PI/180,ive=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Rg,r}return t.prototype.init=function(r,n){},t.prototype.render=function(r,n,i){var a=r.getData(),o=this._data,s=this.group,l=-r.get("startAngle")*nve;if(a.diff(o).add(function(c){var h=a.getItemLayout(c);if(h){var f=new x3(a,c,l);Re(f).dataIndex=c,s.add(f)}}).update(function(c,h){var f=o.getItemGraphicEl(h),d=a.getItemLayout(c);if(!d){f&&Ko(f,r,h);return}f?f.updateData(a,c,l):f=new x3(a,c,l),s.add(f)}).remove(function(c){var h=o.getItemGraphicEl(c);h&&Ko(h,r,c)}).execute(),!o){var u=r.get("center");this.group.scaleX=.01,this.group.scaleY=.01,this.group.originX=he(u[0],i.getWidth()),this.group.originY=he(u[1],i.getHeight()),jt(this.group,{scaleX:1,scaleY:1},r)}this._data=a,this.renderEdges(r,l)},t.prototype.renderEdges=function(r,n){var i=r.getData(),a=r.getEdgeData(),o=this._edgeData,s=this.group;a.diff(o).add(function(l){var u=new rve(i,a,l,n);Re(u).dataIndex=l,s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(i,a,l,n),s.add(c)}).remove(function(l){var u=o.getItemGraphicEl(l);u&&Ko(u,r,l)}).execute(),this._edgeData=a},t.prototype.dispose=function(){},t.type=Rg,t}(wt),YC=Math.PI/180,ave=kr(Rg,ove);function ove(e,t){e.eachSeriesByType(Rg,function(r){sve(r,t)})}function sve(e,t){var r=e.getData(),n=r.graph,i=e.getEdgeData(),a=i.count();if(a){var o=OH(e,t),s=o.cx,l=o.cy,u=o.r,c=o.r0,h=Math.max((e.get("padAngle")||0)*YC,0),f=Math.max((e.get("minAngle")||0)*YC,0),d=-e.get("startAngle")*YC,g=d+Math.PI*2,m=e.get("clockwise"),y=m?1:-1,_=[d,g];db(_,!m);var x=_[0],w=_[1],S=w-x,T=r.getSum("value")===0&&i.getSum("value")===0,M=[],A=0;n.eachEdge(function(z){var $=T?1:z.getValue("value");T&&($>0||f)&&(A+=2);var W=z.node1.dataIndex,Z=z.node2.dataIndex;M[W]=(M[W]||0)+$,M[Z]=(M[Z]||0)+$});var N=0;if(n.eachNode(function(z){var $=z.getValue("value");isNaN($)||(M[z.dataIndex]=Math.max($,M[z.dataIndex]||0)),!T&&(M[z.dataIndex]>0||f)&&A++,N+=M[z.dataIndex]||0}),!(A===0||N===0)){h*A>=Math.abs(S)&&(h=Math.max(0,(Math.abs(S)-f*A)/A)),(h+f)*A>=Math.abs(S)&&(f=(Math.abs(S)-h*A)/A);var P=(S-h*A*y)/N,I=0,D=0,O=0;n.eachNode(function(z){var $=M[z.dataIndex]||0,W=P*(N?$:1)*y;Math.abs(W)D){var B=I/D;n.eachNode(function(z){var $=z.getLayout().angle;Math.abs($)>=f?z.setLayout({angle:$*B,ratio:B},!0):z.setLayout({angle:f,ratio:f===0?1:$/f},!0)})}else n.eachNode(function(z){if(!j){var $=z.getLayout().angle,W=Math.min($/O,1),Z=W*I;$-Zf&&f>0){var W=j?1:Math.min($/O,1),Z=$-f,X=Math.min(Z,Math.min(U,I*W));U-=X,z.setLayout({angle:$-X,ratio:($-X)/$},!0)}else f>0&&z.setLayout({angle:f,ratio:$===0?1:f/$},!0)}});var H=x,V=[];n.eachNode(function(z){var $=Math.max(z.getLayout().angle,f);z.setLayout({cx:s,cy:l,r0:c,r:u,startAngle:H,endAngle:H+$*y,clockwise:m},!0),V[z.dataIndex]=H,H+=($+h)*y}),n.eachEdge(function(z){var $=T?1:z.getValue("value"),W=P*(N?$:1)*y,Z=z.node1.dataIndex,X=V[Z]||0,re=Math.abs((z.node1.getLayout().ratio||1)*W),J=X+re*y,oe=[s+c*Math.cos(X),l+c*Math.sin(X)],le=[s+c*Math.cos(J),l+c*Math.sin(J)],De=z.node2.dataIndex,we=V[De]||0,ve=Math.abs((z.node2.getLayout().ratio||1)*W),Ne=we+ve*y,xe=[s+c*Math.cos(we),l+c*Math.sin(we)],Le=[s+c*Math.cos(Ne),l+c*Math.sin(Ne)];z.setLayout({s1:oe,s2:le,sStartAngle:X,sEndAngle:J,t1:xe,t2:Le,tStartAngle:we,tEndAngle:Ne,cx:s,cy:l,r:c,value:$,clockwise:m}),V[Z]=J,V[De]=Ne})}}}function lve(e){e.registerChartView(ive),e.registerSeriesModel(tve),e.registerLayout(e.PRIORITY.VISUAL.POST_CHART_LAYOUT,ave),e.registerProcessor(gm("chord"))}var uve=function(){function e(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return e}(),cve=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="pointer",n}return t.prototype.getDefaultShape=function(){return new uve},t.prototype.buildPath=function(r,n){var i=Math.cos,a=Math.sin,o=n.r,s=n.width,l=n.angle,u=n.x-i(l)*s*(s>=o/3?1:2),c=n.y-a(l)*s*(s>=o/3?1:2);l=n.angle-Math.PI/2,r.moveTo(u,c),r.lineTo(n.x+i(l)*s,n.y+a(l)*s),r.lineTo(n.x+i(n.angle)*o,n.y+a(n.angle)*o),r.lineTo(n.x-i(l)*s,n.y-a(l)*s),r.lineTo(u,c)},t}(Qe);function hve(e,t){var r=e.get("center"),n=t.getWidth(),i=t.getHeight(),a=Math.min(n,i),o=he(r[0],t.getWidth()),s=he(r[1],t.getHeight()),l=he(e.get("radius"),a/2);return{cx:o,cy:s,r:l}}function _0(e,t){var r=e==null?"":e+"";return t&&(ue(t)?r=t.replace("{value}",r):Ce(t)&&(r=t(e))),r}var fve=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){this.group.removeAll();var a=r.get(["axisLine","lineStyle","color"]),o=hve(r,i);this._renderMain(r,n,i,a,o),this._data=r.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(r,n,i,a,o){var s=this.group,l=r.get("clockwise"),u=-r.get("startAngle")/180*Math.PI,c=-r.get("endAngle")/180*Math.PI,h=r.getModel("axisLine"),f=h.get("roundCap"),d=f?$x:on,g=h.get("show"),m=h.getModel("lineStyle"),y=m.get("width"),_=[u,c];db(_,!l),u=_[0],c=_[1];for(var x=c-u,w=u,S=[],T=0;g&&T=P&&(I===0?0:a[I-1][0])Math.PI/2&&(J+=Math.PI)):re==="tangential"?J=-N-Math.PI/2:at(re)&&(J=re*Math.PI/180),J===0?h.add(new it({style:Lt(w,{text:$,x:Z,y:X,verticalAlign:U<-.8?"top":U>.8?"bottom":"middle",align:B<-.4?"left":B>.4?"right":"center"},{inheritColor:W}),silent:!0})):h.add(new it({style:Lt(w,{text:$,x:Z,y:X,verticalAlign:"middle",align:"center"},{inheritColor:W}),silent:!0,originX:Z,originY:X,rotation:J}))}if(x.get("show")&&H!==S){var V=x.get("distance");V=V?V+c:c;for(var oe=0;oe<=T;oe++){B=Math.cos(N),U=Math.sin(N);var le=new cr({shape:{x1:B*(g-V)+f,y1:U*(g-V)+d,x2:B*(g-A-V)+f,y2:U*(g-A-V)+d},silent:!0,style:O});O.stroke==="auto"&&le.setStyle({stroke:a((H+oe/T)/S)}),h.add(le),N+=I}N-=I}else N+=P}},t.prototype._renderPointer=function(r,n,i,a,o,s,l,u,c){var h=this.group,f=this._data,d=this._progressEls,g=[],m=r.get(["pointer","show"]),y=r.getModel("progress"),_=y.get("show"),x=r.getData(),w=x.mapDimension("value"),S=+r.get("min"),T=+r.get("max"),M=[S,T],A=[s,l];function N(I,D){var O=x.getItemModel(I),j=O.getModel("pointer"),B=he(j.get("width"),o.r),U=he(j.get("length"),o.r),H=r.get(["pointer","icon"]),V=j.get("offsetCenter"),z=he(V[0],o.r),$=he(V[1],o.r),W=j.get("keepAspect"),Z;return H?Z=dr(H,z-B/2,$-U,B,U,null,W):Z=new cve({shape:{angle:-Math.PI/2,width:B,r:U,x:z,y:$}}),Z.rotation=-(D+Math.PI/2),Z.x=o.cx,Z.y=o.cy,Z}function P(I,D){var O=y.get("roundCap"),j=O?$x:on,B=y.get("overlap"),U=B?y.get("width"):c/x.count(),H=B?o.r-U:o.r-(I+1)*U,V=B?o.r:o.r-I*U,z=new j({shape:{startAngle:s,endAngle:D,cx:o.cx,cy:o.cy,clockwise:u,r0:H,r:V}});return B&&(z.z2=ct(x.get(w,I),[S,T],[100,0],!0)),z}(_||m)&&(x.diff(f).add(function(I){var D=x.get(w,I);if(m){var O=N(I,s);jt(O,{rotation:-((isNaN(+D)?A[0]:ct(D,M,A,!0))+Math.PI/2)},r),h.add(O),x.setItemGraphicEl(I,O)}if(_){var j=P(I,s),B=y.get("clip");jt(j,{shape:{endAngle:ct(D,M,A,B)}},r),h.add(j),dM(r.seriesIndex,x.dataType,I,j),g[I]=j}}).update(function(I,D){var O=x.get(w,I);if(m){var j=f.getItemGraphicEl(D),B=j?j.rotation:s,U=N(I,B);U.rotation=B,lt(U,{rotation:-((isNaN(+O)?A[0]:ct(O,M,A,!0))+Math.PI/2)},r),h.add(U),x.setItemGraphicEl(I,U)}if(_){var H=d[D],V=H?H.shape.endAngle:s,z=P(I,V),$=y.get("clip");lt(z,{shape:{endAngle:ct(O,M,A,$)}},r),h.add(z),dM(r.seriesIndex,x.dataType,I,z),g[I]=z}}).execute(),x.each(function(I){var D=x.getItemModel(I),O=D.getModel("emphasis"),j=O.get("focus"),B=O.get("blurScope"),U=O.get("disabled"),H=a(ct(x.get(w,I),M,[0,1],!0));if(m){var V=x.getItemGraphicEl(I),z=x.getItemVisual(I,"style"),$=z.fill;if(V instanceof zr){var W=V.style;V.useStyle(ee({image:W.image,x:W.x,y:W.y,width:W.width,height:W.height},z))}else V.useStyle(z),V.type!=="pointer"&&V.setColor($);V.setStyle(D.getModel(["pointer","itemStyle"]).getItemStyle()),V.style.fill==="auto"&&V.setStyle("fill",H),V.z2EmphasisLift=0,Mr(V,D),Vt(V,j,B,U)}if(_){var Z=g[I];Z.useStyle(x.getItemVisual(I,"style")),Z.setStyle(D.getModel(["progress","itemStyle"]).getItemStyle()),Z.style.fill==="auto"&&Z.setStyle("fill",H),Z.z2EmphasisLift=0,Mr(Z,D),Vt(Z,j,B,U)}}),this._progressEls=g)},t.prototype._renderAnchor=function(r,n){var i=r.getModel("anchor"),a=i.get("show");if(a){var o=i.get("size"),s=i.get("icon"),l=i.get("offsetCenter"),u=i.get("keepAspect"),c=dr(s,n.cx-o/2+he(l[0],n.r),n.cy-o/2+he(l[1],n.r),o,o,null,u);c.z2=i.get("showAbove")?1:0,c.setStyle(i.getModel("itemStyle").getItemStyle()),this.group.add(c)}},t.prototype._renderTitleAndDetail=function(r,n,i,a,o){var s=this,l=r.getData(),u=l.mapDimension("value"),c=+r.get("min"),h=+r.get("max"),f=new Me,d=[],g=[],m=r.isAnimationEnabled(),y=r.get(["pointer","showAbove"]);l.diff(this._data).add(function(_){d[_]=new it({silent:!0}),g[_]=new it({silent:!0})}).update(function(_,x){d[_]=s._titleEls[x],g[_]=s._detailEls[x]}).execute(),l.each(function(_){var x=l.getItemModel(_),w=l.get(u,_),S=new Me,T=a(ct(w,[c,h],[0,1],!0)),M=x.getModel("title");if(M.get("show")){var A=M.get("offsetCenter"),N=o.cx+he(A[0],o.r),P=o.cy+he(A[1],o.r),I=d[_];I.attr({z2:y?0:2,style:Lt(M,{x:N,y:P,text:l.getName(_),align:"center",verticalAlign:"middle"},{inheritColor:T})}),S.add(I)}var D=x.getModel("detail");if(D.get("show")){var O=D.get("offsetCenter"),j=o.cx+he(O[0],o.r),B=o.cy+he(O[1],o.r),U=he(D.get("width"),o.r),H=he(D.get("height"),o.r),V=r.get(["progress","show"])?l.getItemVisual(_,"style").fill:T,I=g[_],z=D.get("formatter");I.attr({z2:y?0:2,style:Lt(D,{x:j,y:B,text:_0(w,z),width:isNaN(U)?null:U,height:isNaN(H)?null:H,align:"center",verticalAlign:"middle"},{inheritColor:V})}),vH(I,{normal:D},w,function(W){return _0(W,z)}),m&&pH(I,_,l,r,{getFormattedLabel:function(W,Z,X,re,J,oe){return _0(oe?oe.interpolatedValue:w,z)}}),S.add(I)}f.add(S)}),this.group.add(f),this._titleEls=d,this._detailEls=g},t.type="gauge",t}(wt),dve=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="itemStyle",r}return t.prototype.getInitialData=function(r,n){return Ld(this,["value"])},t.type="series.gauge",t.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,K.color.neutral10]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:K.color.axisTick,width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:K.color.axisTickMinor,width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:K.color.axisLabel,fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:K.color.neutral00,borderWidth:0,borderColor:K.color.theme[0]}},title:{show:!0,offsetCenter:[0,"20%"],color:K.color.secondary,fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:K.color.transparent,borderWidth:0,borderColor:K.color.neutral40,width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:K.color.primary,fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},t}(At);function vve(e){e.registerChartView(fve),e.registerSeriesModel(dve)}var Yf="funnel",pve=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new Id(de(this.getData,this),de(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.getInitialData=function(r,n){return Ld(this,{coordDimensions:["value"],encodeDefaulter:Ze(aI,this)})},t.prototype._defaultLabelLine=function(r){dc(r,"labelLine",["show"]);var n=r.labelLine,i=r.emphasis.labelLine;n.show=n.show&&r.label.show,i.show=i.show&&r.emphasis.label.show},t.prototype.getDataParams=function(r){var n=this.getData(),i=e.prototype.getDataParams.call(this,r),a=n.mapDimension("value"),o=n.getSum(a);return i.percent=o?+(n.get(a,r)/o*100).toFixed(2):0,i.$vars.push("percent"),i},t.type="series."+Yf,t.defaultOption={coordinateSystemUsage:"box",z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:65,minSize:"0%",maxSize:"100%",sort:"descending",orient:"vertical",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1}},itemStyle:{borderColor:K.color.neutral00,borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:K.color.primary}}},t}(At),gve=["itemStyle","opacity"],mve=function(e){q(t,e);function t(r,n){var i=e.call(this)||this,a=i,o=new $r,s=new it;return a.setTextContent(s),i.setTextGuideLine(o),i.updateData(r,n,!0),i}return t.prototype.updateData=function(r,n,i){var a=this,o=r.hostModel,s=r.getItemModel(n),l=r.getItemLayout(n),u=s.getModel("emphasis"),c=s.get(gve);c=c??1,i||$i(a),a.useStyle(r.getItemVisual(n,"style")),a.style.lineJoin="round",i?(a.setShape({points:l.points}),a.style.opacity=0,jt(a,{style:{opacity:c}},o,n)):lt(a,{style:{opacity:c},shape:{points:l.points}},o,n),Mr(a,s),this._updateLabel(r,n),Vt(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r,n){var i=this,a=this.getTextGuideLine(),o=i.getTextContent(),s=r.hostModel,l=r.getItemModel(n),u=r.getItemLayout(n),c=u.label,h=r.getItemVisual(n,"style"),f=h.fill;Or(o,Ar(l),{labelFetcher:r.hostModel,labelDataIndex:n,defaultOpacity:h.opacity,defaultText:r.getName(n)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}});var d=l.getModel("label"),g=d.get("color"),m=g==="inherit"?f:null;i.setTextConfig({local:!0,inside:!!c.inside,insideStroke:m,outsideFill:m});var y=c.linePoints;a.setShape({points:y}),i.textGuideLineConfig={anchor:y?new Pe(y[0][0],y[0][1]):null},lt(o,{style:{x:c.x,y:c.y}},s,n),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),OI(i,zI(l),{stroke:f})},t}(sn),yve=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Yf,r.ignoreLabelLineUpdate=!0,r}return t.prototype.render=function(r,n,i){var a=r.getData(),o=this._data,s=this.group;a.diff(o).add(function(l){var u=new mve(a,l);a.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(a,l),s.add(c),a.setItemGraphicEl(l,c)}).remove(function(l){var u=o.getItemGraphicEl(l);Ko(u,r,l)}).execute(),this._data=a},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type=Yf,t}(wt);function _ve(e,t){for(var r=e.mapDimension("value"),n=e.mapArray(r,function(l){return l}),i=[],a=t==="ascending",o=0,s=e.count();o-1&&(o="left"),r&&Be(["left","right"],o)>-1&&(o="bottom")),o==="left"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,_=m-w,f=_-5,h="right"):o==="right"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,_=m+w,f=_+5,h="left"):o==="top"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,x=y-w,d=x-5,h="center"):o==="bottom"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,x=y+w,d=x+5,h="center"):o==="rightTop"?(m=r?u[3][0]:u[1][0],y=r?u[3][1]:u[1][1],r?(x=y-w,d=x-5,h="center"):(_=m+w,f=_+5,h="top")):o==="rightBottom"?(m=u[2][0],y=u[2][1],r?(x=y+w,d=x+5,h="center"):(_=m+w,f=_+5,h="bottom")):o==="leftTop"?(m=u[0][0],y=r?u[0][1]:u[1][1],r?(x=y-w,d=x-5,h="center"):(_=m-w,f=_-5,h="right")):o==="leftBottom"?(m=r?u[1][0]:u[3][0],y=r?u[1][1]:u[2][1],r?(x=y+w,d=x+5,h="center"):(_=m-w,f=_-5,h="right")):(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,r?(x=y+w,d=x+5,h="center"):(_=m+w,f=_+5,h="left")),r?(_=m,f=_):(x=y,d=x),g=[[m,y],[_,x]]}l.label={linePoints:g,x:f,y:d,verticalAlign:"middle",textAlign:h,inside:c}})}var bve=kr(Yf,wve);function wve(e,t){e.eachSeriesByType(Yf,function(r){var n=r.getData(),i=n.mapDimension("value"),a=r.get("sort"),o=Lr(r,t),s=Bt(r.getBoxLayoutParams(),o.refContainer),l=K7(r),u=s.width,c=s.height,h=_ve(n,a),f=s.x,d=s.y,g=l?[he(r.get("minSize"),c),he(r.get("maxSize"),c)]:[he(r.get("minSize"),u),he(r.get("maxSize"),u)],m=n.getDataExtent(i),y=r.get("min"),_=r.get("max");y==null&&(y=Math.min(m[0],0)),_==null&&(_=m[1]);var x=r.get("funnelAlign"),w=r.get("gap"),S=l?u:c,T=(S-w*(n.count()-1))/n.count(),M=function(U,H){if(l){var V=n.get(i,U)||0,z=ct(V,[y,_],g,!0),$=void 0;switch(x){case"top":$=d;break;case"center":$=d+(c-z)/2;break;case"bottom":$=d+(c-z);break}return[[H,$],[H,$+z]]}var W=n.get(i,U)||0,Z=ct(W,[y,_],g,!0),X;switch(x){case"left":X=f;break;case"center":X=f+(u-Z)/2;break;case"right":X=f+u-Z;break}return[[X,H],[X+Z,H]]};a==="ascending"&&(T=-T,w=-w,l?f+=u:d+=c,h=h.reverse());for(var A=0;Ajve)return;var i=this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]);i.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:i.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(e){if(!(this._mouseDownPoint||!qC(this,"mousemove"))){var t=this._model,r=t.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]),n=r.behavior;n==="jump"&&this._throttledDispatchExpand.debounceNextCall(t.get("axisExpandDebounce")),this._throttledDispatchExpand(n==="none"?null:{axisExpandWindow:r.axisExpandWindow,animation:n==="jump"?null:{duration:0}})}}};function qC(e,t){var r=e._model;return r.get("axisExpandable")&&r.get("axisExpandTriggerOn")===t}var n1="parallel",_A=n1,Bve=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){e.prototype.init.apply(this,arguments),this.mergeOption({})},t.prototype.mergeOption=function(r){var n=this.option;r&&He(n,r,!0),this._initDimensions()},t.prototype.contains=function(r,n){var i=r.get("parallelIndex");return i!=null&&n.getComponent("parallel",i)===this},t.prototype.setAxisExpand=function(r){E(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],function(n){r.hasOwnProperty(n)&&(this.option[n]=r[n])},this)},t.prototype._initDimensions=function(){var r=this.dimensions=[],n=this.parallelAxisIndex=[],i=mt(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(a){return(a.get("parallelIndex")||0)===this.componentIndex},this);E(i,function(a){r.push("dim"+a.get("dim")),n.push(a.componentIndex)})},t.type=_A,t.dependencies=["parallelAxis"],t.layoutMode="box",t.defaultOption={z:0,left:80,top:60,right:80,bottom:60,layout:"horizontal",axisExpandable:!1,axisExpandCenter:null,axisExpandCount:0,axisExpandWidth:50,axisExpandRate:17,axisExpandDebounce:50,axisExpandSlideTriggerArea:[-.15,.05,.4],axisExpandTriggerOn:"click",parallelAxisDefault:null},t}(qe),Fve=function(e){q(t,e);function t(r,n,i,a,o){var s=e.call(this,r,n,i)||this;return s.type=a||"value",s.axisIndex=o,s}return t.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},t}(Ki);function Ll(e,t,r,n,i,a){e=e||0;var o=Tu(r[1],-r[0]);if(i!=null&&(i=Lh(i,[0,o])),a!=null&&(a=Math.max(a,i??0)),n==="all"){var s=Math.abs(Tu(t[1],-t[0]));s=Lh(s,[0,o]),i=a=Lh(s,[i,a]),n=0}t[0]=Lh(t[0],r),t[1]=Lh(t[1],r);var l=KC(t,n);t[n]+=e;var u=i||0,c=r.slice();l.sign<0?c[0]=Tu(c[0],u):c[1]=Tu(c[1],-u),t[n]=Lh(t[n],c);var h;return h=KC(t,n),i!=null&&(h.sign!==l.sign||h.spana&&(t[1-n]=Tu(t[n],h.sign*a)),t}function KC(e,t){var r=e[t]-e[1-t];return{span:Math.abs(r),sign:r>0?-1:r<0?1:t?-1:1}}function Lh(e,t){return Math.min(t[1]!=null?t[1]:1/0,Math.max(t[0]!=null?t[0]:-1/0,e))}var Vve=function(){function e(t,r,n){this.type=n1,this._axesMap=pe(),this._axesLayout={},this.dimensions=t.dimensions,this._model=t,this._init(t,r,n)}return e.prototype._init=function(t,r,n){var i=t.dimensions,a=t.parallelAxisIndex;E(i,function(o,s){var l=a[s],u=r.getComponent("parallelAxis",l),c=um(u),h=this._axesMap.set(o,new Fve(o,Td(u,c,!1),[0,0],c,l));h.onBand=hm(h.scale,u),h.inverse=u.get("inverse"),u.axis=h,h.model=u,h.coordinateSystem=u.coordinateSystem=this},this)},e.prototype.update=function(t,r){E(this.dimensions,function(n){var i=this._axesMap.get(n);Cc(i,Uf),Wf(i)},this)},e.prototype.containPoint=function(t){var r=this._makeLayoutInfo(),n=r.axisBase,i=r.layoutBase,a=r.pixelDimIndex,o=t[1-a],s=t[a];return o>=n&&o<=n+r.axisLength&&s>=i&&s<=i+r.layoutLength},e.prototype.getModel=function(){return this._model},e.prototype.resize=function(t,r){var n=Lr(t,r).refContainer;this._rect=Bt(t.getBoxLayoutParams(),n),this._layoutAxes()},e.prototype.getRect=function(){return this._rect},e.prototype._makeLayoutInfo=function(){var t=this._model,r=this._rect,n=["x","y"],i=["width","height"],a=t.get("layout"),o=a==="horizontal"?0:1,s=r[i[o]],l=[0,s],u=this.dimensions.length,c=x0(t.get("axisExpandWidth"),l),h=x0(t.get("axisExpandCount")||0,[0,u]),f=t.get("axisExpandable")&&u>3&&u>h&&h>1&&c>0&&s>0,d=t.get("axisExpandWindow"),g;if(d)g=x0(d[1]-d[0],l),d[1]=d[0]+g;else{g=x0(c*(h-1),l);var m=t.get("axisExpandCenter")||Ui(u/2);d=[c*m-g/2],d[1]=d[0]+g}var y=(s-g)/(u-h);y<3&&(y=0);var _=[Ui(st(d[0]/c,1))+1,Vc(st(d[1]/c,1))-1],x=y/c*d[0];return{layout:a,pixelDimIndex:o,layoutBase:r[n[o]],layoutLength:s,axisBase:r[n[1-o]],axisLength:r[i[1-o]],axisExpandable:f,axisExpandWidth:c,axisCollapseWidth:y,axisExpandWindow:d,axisCount:u,winInnerIndices:_,axisExpandWindow0Pos:x}},e.prototype._layoutAxes=function(){var t=this._rect,r=this._axesMap,n=this.dimensions,i=this._makeLayoutInfo(),a=i.layout;r.each(function(o){var s=[0,i.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),E(n,function(o,s){var l=(i.axisExpandable?Hve:Gve)(s,i),u={horizontal:{x:l.position,y:i.axisLength},vertical:{x:0,y:l.position}},c={horizontal:hx/2,vertical:0},h=[u[a].x+t.x,u[a].y+t.y],f=c[a],d=Ft();_s(d,d,f),_a(d,d,h),this._axesLayout[o]={position:h,rotation:f,transform:d,axisNameAvailableWidth:l.axisNameAvailableWidth,axisLabelShow:l.axisLabelShow,nameTruncateMaxWidth:l.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},e.prototype.getAxis=function(t){return this._axesMap.get(t)},e.prototype.dataToPoint=function(t,r){return this.axisCoordToPoint(this._axesMap.get(r).dataToCoord(t),r)},e.prototype.eachActiveState=function(t,r,n,i){n==null&&(n=0),i==null&&(i=t.count());var a=this._axesMap,o=this.dimensions,s=[],l=[];E(o,function(y){s.push(t.mapDimension(y)),l.push(a.get(y).model)});for(var u=this.hasAxisBrushed(),c=n;ca*(1-h[0])?(u="jump",l=s-a*(1-h[2])):(l=s-a*h[1])>=0&&(l=s-a*(1-h[1]))<=0&&(l=0),l*=r.axisExpandWidth/c,l?Ll(l,i,o,"all"):u="none";else{var d=i[1]-i[0],g=o[1]*s/d;i=[$e(0,g-d/2)],i[1]=bt(o[1],i[0]+d),i[0]=i[1]-d}return{axisExpandWindow:i,behavior:u}},e}();function x0(e,t){return bt($e(e,t[0]),t[1])}function Gve(e,t){var r=t.layoutLength/(t.axisCount-1);return{position:r*e,axisNameAvailableWidth:r,axisLabelShow:!0}}function Hve(e,t){var r=t.layoutLength,n=t.axisExpandWidth,i=t.axisCount,a=t.axisCollapseWidth,o=t.winInnerIndices,s,l=a,u=!1,c;return e=0;i--)Ur(n[i])},t.prototype.getActiveState=function(r){var n=this.activeIntervals;if(!n.length)return"normal";if(r==null||isNaN(+r))return"inactive";if(n.length===1){var i=n[0];if(i[0]<=r&&r<=i[1])return"active"}else for(var a=0,o=n.length;aYve}function i9(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function a9(e,t,r,n){var i=new Me;return i.add(new Ye({name:"main",style:wN(r),silent:!0,draggable:!0,cursor:"move",drift:Ze(M3,e,t,i,["n","s","w","e"]),ondragend:Ze(Dc,t,{isEnd:!0})})),E(n,function(a){i.add(new Ye({name:a.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:Ze(M3,e,t,i,a),ondragend:Ze(Dc,t,{isEnd:!0})}))}),i}function o9(e,t,r,n){var i=n.brushStyle.lineWidth||0,a=Xf(i,Xve),o=r[0][0],s=r[1][0],l=o-i/2,u=s-i/2,c=r[0][1],h=r[1][1],f=c-a+i/2,d=h-a+i/2,g=c-o,m=h-s,y=g+i,_=m+i;Eo(e,t,"main",o,s,g,m),n.transformable&&(Eo(e,t,"w",l,u,a,_),Eo(e,t,"e",f,u,a,_),Eo(e,t,"n",l,u,y,a),Eo(e,t,"s",l,d,y,a),Eo(e,t,"nw",l,u,a,a),Eo(e,t,"ne",f,u,a,a),Eo(e,t,"sw",l,d,a,a),Eo(e,t,"se",f,d,a,a))}function wA(e,t){var r=t.__brushOption,n=r.transformable,i=t.childAt(0);i.useStyle(wN(r)),i.attr({silent:!n,cursor:n?"move":"default"}),E([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(a){var o=t.childOfName(a.join("")),s=a.length===1?SA(e,a[0]):tpe(e,a);o&&o.attr({silent:!n,invisible:!n,cursor:n?Kve[s]+"-resize":null})})}function Eo(e,t,r,n,i,a,o){var s=t.childOfName(r);s&&s.setShape(npe(SN(e,t,[[n,i],[n+a,i+o]])))}function wN(e){return ke({strokeNoScale:!0},e.brushStyle)}function s9(e,t,r,n){var i=[jg(e,r),jg(t,n)],a=[Xf(e,r),Xf(t,n)];return[[i[0],a[0]],[i[1],a[1]]]}function epe(e){return Ku(e.group)}function SA(e,t){var r={w:"left",e:"right",n:"top",s:"bottom"},n={left:"w",right:"e",top:"n",bottom:"s"},i=mb(r[t],epe(e));return n[i]}function tpe(e,t){var r=[SA(e,t[0]),SA(e,t[1])];return(r[0]==="e"||r[0]==="w")&&r.reverse(),r.join("")}function M3(e,t,r,n,i,a){var o=r.__brushOption,s=e.toRectRange(o.range),l=l9(t,i,a);E(n,function(u){var c=qve[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=e.fromRectRange(s9(s[0][0],s[1][0],s[0][1],s[1][1])),_N(t,r),Dc(t,{isEnd:!1})}function rpe(e,t,r,n){var i=t.__brushOption.range,a=l9(e,r,n);E(i,function(o){o[0]+=a[0],o[1]+=a[1]}),_N(e,t),Dc(e,{isEnd:!1})}function l9(e,t,r){var n=e.group,i=n.transformCoordToLocal(t,r),a=n.transformCoordToLocal(0,0);return[i[0]-a[0],i[1]-a[1]]}function SN(e,t,r){var n=n9(e,t);return n&&n!==Pc?n.clipPath(r,e._transform):Se(r)}function npe(e){var t=jg(e[0][0],e[1][0]),r=jg(e[0][1],e[1][1]),n=Xf(e[0][0],e[1][0]),i=Xf(e[0][1],e[1][1]);return{x:t,y:r,width:n-t,height:i-r}}function ipe(e,t,r){if(!(!e._brushType||ope(e,t.offsetX,t.offsetY))){var n=e._zr,i=e._covers,a=bN(e,t,r);if(!e._dragging)for(var o=0;on.getWidth()||r<0||r>n.getHeight()}var Ub={lineX:L3(0),lineY:L3(1),rect:{createCover:function(e,t){function r(n){return n}return a9({toRectRange:r,fromRectRange:r},e,t,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(e){var t=i9(e);return s9(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,r,n){o9(e,t,r,n)},updateCommon:wA,contain:TA},polygon:{createCover:function(e,t){var r=new Me;return r.add(new $r({name:"main",style:wN(t),silent:!0})),r},getCreatingRange:function(e){return e},endCreating:function(e,t){t.remove(t.childAt(0)),t.add(new sn({name:"main",draggable:!0,drift:Ze(rpe,e,t),ondragend:Ze(Dc,e,{isEnd:!0})}))},updateCoverShape:function(e,t,r,n){t.childAt(0).setShape({points:SN(e,t,r)})},updateCommon:wA,contain:TA}};function L3(e){return{createCover:function(t,r){return a9({toRectRange:function(n){var i=[n,[0,100]];return e&&i.reverse(),i},fromRectRange:function(n){return n[e]}},t,r,[[["w"],["e"]],[["n"],["s"]]][e])},getCreatingRange:function(t){var r=i9(t),n=jg(r[0][e],r[1][e]),i=Xf(r[0][e],r[1][e]);return[n,i]},updateCoverShape:function(t,r,n,i){var a,o=n9(t,r);if(o!==Pc&&o.getLinearBrushOtherExtent)a=o.getLinearBrushOtherExtent(e);else{var s=t._zr;a=[0,[s.getWidth(),s.getHeight()][1-e]]}var l=[n,a];e&&l.reverse(),o9(t,r,l,i)},updateCommon:wA,contain:TA}}function c9(e){return e=CN(e),function(t){return BL(t,e)}}function h9(e,t){return e=CN(e),function(r){var n=t??r,i=n?e.width:e.height,a=n?e.x:e.y;return[a,a+(i||0)]}}function f9(e,t,r){var n=CN(e);return function(i,a){return n.contain(a[0],a[1])&&!a7(i,t,r)}}function CN(e){return Ae.create(e)}var spe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){e.prototype.init.apply(this,arguments),(this._brushController=new yN(n.getZr())).on("brush",de(this._onBrush,this))},t.prototype.render=function(r,n,i,a){if(!lpe(r,n,a)){this.axisModel=r,this.api=i,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new Me,this.group.add(this._axisGroup),!!r.get("show")){var s=cpe(r,n),l=s.coordinateSystem,u=r.getAreaSelectStyle(),c=u.width,h=r.axis.dim,f=l.getAxisLayout(h),d=ee({strokeContainThreshold:c},f),g=new Nn(r,i,d);g.build(),this._axisGroup.add(g.group),this._refreshBrushController(d,u,r,s,c,i),im(o,this._axisGroup,r)}}},t.prototype._refreshBrushController=function(r,n,i,a,o,s){var l=i.axis.getExtent(),u=l[1]-l[0],c=Math.min(30,Math.abs(u)*.1),h=Ae.create({x:l[0],y:-o/2,width:u,height:o});h.x-=c,h.width+=2*c,this._brushController.mount({enableGlobalPan:!0,rotation:r.rotation,x:r.position[0],y:r.position[1]}).setPanels([{panelId:"pl",clipPath:c9(h),isTargetByCursor:f9(h,s,a),getLinearBrushOtherExtent:h9(h,0)}]).enableBrush({brushType:"lineX",brushStyle:n,removeOnClick:!0}).updateCovers(upe(i))},t.prototype._onBrush=function(r){var n=r.areas,i=this.axisModel,a=i.axis,o=ae(n,function(s){return[a.coordToData(s.range[0],!0),a.coordToData(s.range[1],!0)]});(!i.option.realtime===r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:i.id,intervals:o})},t.prototype.dispose=function(){this._brushController.dispose()},t.type="parallelAxis",t}(Nt);function lpe(e,t,r){return r&&r.type==="axisAreaSelect"&&t.findComponents({mainType:"parallelAxis",query:r})[0]===e}function upe(e){var t=e.axis;return ae(e.activeIntervals,function(r){return{brushType:"lineX",panelId:"pl",range:[t.dataToCoord(r[0],!0),t.dataToCoord(r[1],!0)]}})}function cpe(e,t){return t.getComponent("parallel",e.get("parallelIndex"))}var hpe={type:"axisAreaSelect",event:"axisAreaSelected"};function fpe(e){e.registerAction(hpe,function(t,r){r.eachComponent({mainType:"parallelAxis",query:t},function(n){n.axis.model.setActiveIntervals(t.intervals)})}),e.registerAction("parallelAxisExpand",function(t,r){r.eachComponent({mainType:"parallel",query:t},function(n){n.setAxisExpand(t)})})}var dpe={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function d9(e){e.registerComponentView(Ove),e.registerComponentModel(Bve),e.registerCoordinateSystem("parallel",Wve),e.registerPreprocessor(Dve),e.registerComponentModel(xA),e.registerComponentView(spe),$f(e,"parallel",xA,dpe),fpe(e)}function vpe(e){We(d9),e.registerChartView(Tve),e.registerSeriesModel(kve),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,Pve)}var gs="sankey",ppe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){var i=r.edges||r.links||[],a=r.data||r.nodes||[],o=r.levels||[];this.levelModels=[];for(var s=this.levelModels,l=0;l=0&&(s[o[l].depth]=new Je(o[l],this,n));var u=fN(a,i,this,!0,c);return u.data;function c(h,f){h.wrapMethod("getItemModel",function(d,g){var m=d.parentModel,y=m.getData().getItemLayout(g);if(y){var _=y.depth,x=m.levelModels[_];x&&(d.parentModel=x)}return d}),f.wrapMethod("getItemModel",function(d,g){var m=d.parentModel,y=m.getGraph().getEdgeByIndex(g),_=y.node1.getLayout();if(_){var x=_.depth,w=m.levelModels[x];w&&(d.parentModel=w)}return d})}},t.prototype.setNodePosition=function(r,n){var i=this.option.data||this.option.nodes,a=i[r];a.localX=n[0],a.localY=n[1]},t.prototype.getGraph=function(){return this.getData().graph},t.prototype.getEdgeData=function(){return this.getGraph().edgeData},t.prototype.formatTooltip=function(r,n,i){function a(d){return isNaN(d)||d==null}if(i==="edge"){var o=this.getDataParams(r,i),s=o.data,l=o.value,u=s.source+" -- "+s.target;return _r("nameValue",{name:u,value:l,noValue:a(l)})}else{var c=this.getGraph().getNodeByIndex(r),h=c.getLayout().value,f=this.getDataParams(r,i).data.name;return _r("nameValue",{name:f!=null?f+"":null,value:h,noValue:a(h)})}},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(r,n){var i=e.prototype.getDataParams.call(this,r,n);if(i.value==null&&n==="node"){var a=this.getGraph().getNodeByIndex(r),o=a.getLayout().value;i.value=o}return i},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+gs,t.layoutMode="box",t.defaultOption={z:2,coordinateSystemUsage:"box",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,roam:!1,roamTrigger:"global",center:null,zoom:1,label:{show:!0,position:"right",fontSize:12},edgeLabel:{show:!1,fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:K.color.neutral50,opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:K.color.primary}},animationEasing:"linear",animationDuration:1e3},t}(At),gpe=function(){function e(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.cpx2=0,this.cpy2=0,this.extent=0}return e}(),mpe=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new gpe},t.prototype.buildPath=function(r,n){var i=n.extent;r.moveTo(n.x1,n.y1),r.bezierCurveTo(n.cpx1,n.cpy1,n.cpx2,n.cpy2,n.x2,n.y2),n.orient==="vertical"?(r.lineTo(n.x2+i,n.y2),r.bezierCurveTo(n.cpx2+i,n.cpy2,n.cpx1+i,n.cpy1,n.x1+i,n.y1)):(r.lineTo(n.x2,n.y2+i),r.bezierCurveTo(n.cpx2,n.cpy2+i,n.cpx1,n.cpy1+i,n.x1,n.y1+i)),r.closePath()},t.prototype.highlight=function(){hs(this)},t.prototype.downplay=function(){fs(this)},t}(Qe),ype=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=gs,r._mainGroup=new Me,r}return t.prototype.init=function(r,n){this._controller=new Jc(n.getZr()),this.group.add(this._mainGroup),this._firstRender=!0},t.prototype.render=function(r,n,i){var a=r.getGraph(),o=this._mainGroup,s=r.layoutInfo,l=s.width,u=s.height,c=r.getData(),h=r.getData("edge"),f=r.get("orient");o.removeAll(),o.x=s.x,o.y=s.y,this._updateViewCoordSys(r,i),Vb(r,i,this._controller,y7(o),null),a.eachEdge(function(d){var g=new mpe,m=Re(g);m.dataIndex=d.dataIndex,m.seriesIndex=r.seriesIndex,m.dataType="edge";var y=d.getModel(),_=y.getModel("lineStyle"),x=_.get("curveness"),w=d.node1.getLayout(),S=d.node1.getModel(),T=S.get("localX"),M=S.get("localY"),A=d.node2.getLayout(),N=d.node2.getModel(),P=N.get("localX"),I=N.get("localY"),D=d.getLayout(),O,j,B,U,H,V,z,$;g.shape.extent=Math.max(1,D.dy),g.shape.orient=f,f==="vertical"?(O=(T!=null?T*l:w.x)+D.sy,j=(M!=null?M*u:w.y)+w.dy,B=(P!=null?P*l:A.x)+D.ty,U=I!=null?I*u:A.y,H=O,V=j*(1-x)+U*x,z=B,$=j*x+U*(1-x)):(O=(T!=null?T*l:w.x)+w.dx,j=(M!=null?M*u:w.y)+D.sy,B=P!=null?P*l:A.x,U=(I!=null?I*u:A.y)+D.ty,H=O*(1-x)+B*x,V=j,z=O*x+B*(1-x),$=U),g.setShape({x1:O,y1:j,x2:B,y2:U,cpx1:H,cpy1:V,cpx2:z,cpy2:$}),g.useStyle(_.getItemStyle()),I3(g.style,f,d);var W=""+y.get("value"),Z=Ar(y,"edgeLabel");Or(g,Z,{labelFetcher:{getFormattedLabel:function(J,oe,le,De,we,ve){return r.getFormattedLabel(J,oe,"edge",De,qn(we,Z.normal&&Z.normal.get("formatter"),W),ve)}},labelDataIndex:d.dataIndex,defaultText:W}),g.setTextConfig({position:"inside"});var X=y.getModel("emphasis");Mr(g,y,"lineStyle",function(J){var oe=J.getItemStyle();return I3(oe,f,d),oe}),o.add(g),h.setItemGraphicEl(d.dataIndex,g);var re=X.get("focus");Vt(g,re==="adjacency"?d.getAdjacentDataIndices():re==="trajectory"?d.getTrajectoryDataIndices():re,X.get("blurScope"),X.get("disabled"))}),a.eachNode(function(d){var g=d.getLayout(),m=d.getModel(),y=m.get("localX"),_=m.get("localY"),x=m.getModel("emphasis"),w=m.get(["itemStyle","borderRadius"])||0,S=new Ye({shape:{x:y!=null?y*l:g.x,y:_!=null?_*u:g.y,width:g.dx,height:g.dy,r:w},style:m.getModel("itemStyle").getItemStyle(),z2:10});Or(S,Ar(m),{labelFetcher:{getFormattedLabel:function(M,A){return r.getFormattedLabel(M,A,"node")}},labelDataIndex:d.dataIndex,defaultText:d.id}),S.disableLabelAnimation=!0,S.setStyle("fill",d.getVisual("color")),S.setStyle("decal",d.getVisual("style").decal),Mr(S,m),o.add(S),c.setItemGraphicEl(d.dataIndex,S),Re(S).dataType="node";var T=x.get("focus");Vt(S,T==="adjacency"?d.getAdjacentDataIndices():T==="trajectory"?d.getTrajectoryDataIndices():T,x.get("blurScope"),x.get("disabled"))}),c.eachItemGraphicEl(function(d,g){var m=c.getItemModel(g);m.get("draggable")&&(d.drift=function(y,_){this.shape.x+=y,this.shape.y+=_,this.dirty(),i.dispatchAction({type:"dragNode",seriesId:r.id,dataIndex:c.getRawIndex(g),localX:this.shape.x/l,localY:this.shape.y/u})},d.draggable=!0,d.cursor="move")}),!this._data&&r.isAnimationEnabled()&&o.setClipPath(_pe(o.getBoundingRect(),r,function(){o.removeClipPath()})),this._data=r.getData(),this._firstRender=!1},t.prototype.__updateOnOwnRoam=function(r,n,i){kl(this.group,go,n.coordinateSystem,null)},t.prototype.dispose=function(){this._controller&&this._controller.dispose()},t.prototype._updateViewCoordSys=function(r,n){var i=r.layoutInfo,a=r.coordinateSystem=aN(r,n,i.x,i.y,i.width,i.height);kl(this.group,go,a,this._firstRender?null:r)},t.type=gs,t}(wt);function I3(e,t,r){switch(e.fill){case"source":e.fill=r.node1.getVisual("color"),e.decal=r.node1.getVisual("style").decal;break;case"target":e.fill=r.node2.getVisual("color"),e.decal=r.node2.getVisual("style").decal;break;case"gradient":var n=r.node1.getVisual("color"),i=r.node2.getVisual("color");ue(n)&&ue(i)&&(e.fill=new Uc(0,0,+(t==="horizontal"),+(t==="vertical"),[{color:n,offset:0},{color:i,offset:1}]))}}function _pe(e,t,r){var n=new Ye({shape:{x:e.x-10,y:e.y-10,width:0,height:e.height+20}});return jt(n,{shape:{width:e.width+20}},t,r),n}var xpe=kr(gs,bpe);function bpe(e,t){e.eachSeriesByType(gs,function(r){var n=r.get("nodeWidth"),i=r.get("nodeGap"),a=Lr(r,t).refContainer,o=Bt(r.getBoxLayoutParams(),a);r.layoutInfo=o;var s=o.width,l=o.height,u=r.getGraph(),c=u.nodes,h=u.edges;Spe(c);var f=mt(c,function(y){return y.getLayout().value===0}),d=f.length!==0?0:r.get("layoutIterations"),g=r.get("orient"),m=r.get("nodeAlign");wpe(c,h,n,i,s,l,d,g,m)})}function wpe(e,t,r,n,i,a,o,s,l){Cpe(e,t,r,i,a,s,l),kpe(e,t,a,i,n,o,s),Ope(e,s)}function Spe(e){E(e,function(t){var r=_l(t.outEdges,i1),n=_l(t.inEdges,i1),i=t.getValue()||0,a=Math.max(r,n,i);t.setLayout({value:a},!0)})}function Cpe(e,t,r,n,i,a,o){for(var s=[],l=[],u=[],c=[],h=0,f=0;f=0;_&&y.depth>d&&(d=y.depth),m.setLayout({depth:_?y.depth:h},!0),a==="vertical"?m.setLayout({dy:r},!0):m.setLayout({dx:r},!0);for(var x=0;xh-1?d:h-1;o&&o!=="left"&&Tpe(e,o,a,A);var N=a==="vertical"?(i-r)/A:(n-r)/A;Ape(e,N,a)}function v9(e){var t=e.hostGraph.data.getRawDataItem(e.dataIndex);return t.depth!=null&&t.depth>=0}function Tpe(e,t,r,n){if(t==="right"){for(var i=[],a=e,o=0;a.length;){for(var s=0;s0;a--)l*=.99,Npe(s,l,o),JC(s,i,r,n,o),jpe(s,l,o),JC(s,i,r,n,o)}function Lpe(e,t){var r=[],n=t==="vertical"?"y":"x",i=sM(e,function(a){return a.getLayout()[n]});return Ur(i.keys),E(i.keys,function(a){r.push(i.buckets.get(a))}),r}function Ipe(e,t,r,n,i,a){var o=1/0;E(e,function(s){var l=s.length,u=0;E(s,function(h){u+=h.getLayout().value});var c=a==="vertical"?(n-(l-1)*i)/u:(r-(l-1)*i)/u;c0&&(s=l.getLayout()[a]+u,i==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]+l.getLayout()[f]+t;var g=i==="vertical"?n:r;if(u=c-t-g,u>0){s=l.getLayout()[a]-u,i==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),c=s;for(var d=h-2;d>=0;--d)l=o[d],u=l.getLayout()[a]+l.getLayout()[f]+t-c,u>0&&(s=l.getLayout()[a]-u,i==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[a]}})}function Npe(e,t,r){E(e.slice().reverse(),function(n){E(n,function(i){if(i.outEdges.length){var a=_l(i.outEdges,Ppe,r)/_l(i.outEdges,i1);if(isNaN(a)){var o=i.outEdges.length;a=o?_l(i.outEdges,Dpe,r)/o:0}if(r==="vertical"){var s=i.getLayout().x+(a-Il(i,r))*t;i.setLayout({x:s},!0)}else{var l=i.getLayout().y+(a-Il(i,r))*t;i.setLayout({y:l},!0)}}})})}function Ppe(e,t){return Il(e.node2,t)*e.getValue()}function Dpe(e,t){return Il(e.node2,t)}function Epe(e,t){return Il(e.node1,t)*e.getValue()}function Rpe(e,t){return Il(e.node1,t)}function Il(e,t){return t==="vertical"?e.getLayout().x+e.getLayout().dx/2:e.getLayout().y+e.getLayout().dy/2}function i1(e){return e.getValue()}function _l(e,t,r){for(var n=0,i=e.length,a=-1;++ao&&(o=l)}),E(n,function(s){var l=new jr({type:"color",mappingMethod:"linear",dataExtent:[a,o],visual:t.get("color")}),u=l.mapValueToVisual(s.getLayout().value),c=s.getModel().get(["itemStyle","color"]);c!=null?(s.setVisual("color",c),s.setVisual("style",{fill:c})):(s.setVisual("color",u),s.setVisual("style",{fill:u}))})}i.length&&E(i,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function Fpe(e){e.registerChartView(ype),e.registerSeriesModel(ppe),e.registerLayout(xpe),e.registerVisual(zpe),e.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(t,r){r.eachComponent({mainType:fo,subType:gs,query:t},function(n){n.setNodePosition(t.dataIndex,[t.localX,t.localY])})}),iN(e,fo,gs)}var p9=function(){function e(){}return e.prototype._hasEncodeRule=function(t){var r=this.getEncode();return r&&r.get(t)!=null},e.prototype.getInitialData=function(t,r){var n,i=r.getComponent("xAxis",this.get("xAxisIndex")),a=r.getComponent("yAxis",this.get("yAxisIndex")),o=i.get("type"),s=a.get("type"),l,u=t.layout;o==="category"?(u="horizontal",n=i.getOrdinalMeta(),l=!this._hasEncodeRule("x")):s==="category"&&(u="vertical",n=a.getOrdinalMeta(),l=!this._hasEncodeRule("y")),u||(u=s==="time"?"vertical":"horizontal"),this._layout=u;var c=["x","y"],h=u==="horizontal"?0:1,f=this._baseAxisDim=c[h],d=c[1-h],g=[i,a],m=g[h].get("type"),y=g[1-h].get("type"),_=t.data;if(_&&l){var x=[];E(_,function(T,M){var A;ne(T)?(A=T.slice(),T.unshift(M)):ne(T.value)?(A=ee({},T),A.value=A.value.slice(),T.value.unshift(M)):A=T,x.push(A)}),t.data=x}var w=this.defaultValueDimensions,S=[{name:f,type:Dx(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:d,type:Dx(y),dimsDef:w.slice()}];return Ld(this,{coordDimensions:S,dimensionsCount:w.length+1,encodeDefaulter:Ze(UH,S,this)})},e.prototype.getBaseAxis=function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis},e.prototype.getWhiskerBoxesLayout=function(){return this._layout},e}();function a1(e,t){for(var r=t.ends.length,n=0,i=0;im){var S=[_,w];n.push(S)}}}return{boxData:r,outliers:n}}var Jpe={type:"echarts:boxplot",transform:function(t){var r=t.upstream;if(r.sourceFormat!==Zr){var n="";gt(n)}var i=Kpe(r.getRawData(),t.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:i.boxData},{data:i.outliers}]}};function Qpe(e){e.registerSeriesModel(g9),e.registerChartView(Vpe),e.registerLayout(Zpe),e.registerTransform(Jpe),qpe(e)}var Nl="candlestick",y9=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.defaultValueDimensions=[{name:"open",defaultTooltip:!0},{name:"close",defaultTooltip:!0},{name:"lowest",defaultTooltip:!0},{name:"highest",defaultTooltip:!0}],r}return t.prototype.getShadowDim=function(){return"open"},t.prototype.brushSelector=function(r,n,i){var a=n.getItemLayout(r);return a&&i.rect(a.brushRect)},t.type="series."+Nl,t.dependencies=["xAxis","yAxis","grid"],t.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,clip:!0,itemStyle:{color:"#eb5454",color0:"#47b262",borderColor:"#eb5454",borderColor0:"#47b262",borderColorDoji:null,borderWidth:1},emphasis:{itemStyle:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,large:!0,largeThreshold:600,progressive:3e3,progressiveThreshold:1e4,progressiveChunkMode:"mod",animationEasing:"linear",animationDuration:300},t}(At);vr(y9,p9,!0);var ege=["itemStyle","borderColor"],tge=["itemStyle","borderColor0"],rge=["itemStyle","borderColorDoji"],nge=["itemStyle","color"],ige=["itemStyle","color0"];function TN(e,t){return t.get(e>0?nge:ige)}function MN(e,t){return t.get(e===0?rge:e>0?ege:tge)}var age={seriesType:Nl,plan:Yc(),performRawSeries:!0,reset:function(e,t){if(!t.isSeriesFiltered(e)){var r=e.pipelineContext.large;return!r&&{progress:function(n,i){for(var a;(a=n.next())!=null;){var o=i.getItemModel(a),s=i.getItemLayout(a).sign,l=o.getItemStyle();l.fill=TN(s,o),l.stroke=MN(s,o)||l.fill;var u=i.ensureUniqueItemVisual(a,"style");ee(u,l)}}}}}},oge=["color","borderColor"],sge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(r),this._isLargeDraw?this._renderLarge(r):this._renderNormal(r)},t.prototype.incrementalPrepareRender=function(r,n,i){this._clear(),this._updateDrawMode(r)},t.prototype.incrementalRender=function(r,n,i,a){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(r,n):this._incrementalRenderNormal(r,n)},t.prototype.eachRendered=function(r){zl(this._progressiveEls||this.group,r)},t.prototype._updateDrawMode=function(r){var n=r.pipelineContext.large;(this._isLargeDraw==null||n!==this._isLargeDraw)&&(this._isLargeDraw=n,this._clear())},t.prototype._renderNormal=function(r){var n=r.getData(),i=this._data,a=this.group,o=n.getLayout("isSimpleBox"),s=r.get("clip",!0),l=r.coordinateSystem,u=l.getArea&&l.getArea(),c=s&&Tc(l,!1,r);this._data||a.removeAll();var h=P3(r);n.diff(i).add(function(f){if(n.hasValue(f)){var d=n.getItemLayout(f),g=s?a1(u,d):wg;if(g===Cg)return;var m=QC(d,f,h,!0);jt(m,{shape:{points:d.ends}},r,f),nf(g===Sg,m,c),eT(m,n,f,o),a.add(m),n.setItemGraphicEl(f,m)}}).update(function(f,d){var g=i.getItemGraphicEl(d);if(!n.hasValue(f)){a.remove(g);return}var m=n.getItemLayout(f),y=s?a1(u,m):wg;if(y===Cg){a.remove(g);return}g?(lt(g,{shape:{points:m.ends}},r,f),$i(g)):g=QC(m,f,h),eT(g,n,f,o),nf(y===Sg,g,c),a.add(g),n.setItemGraphicEl(f,g)}).remove(function(f){var d=i.getItemGraphicEl(f);d&&a.remove(d)}).execute(),this._data=n},t.prototype._renderLarge=function(r){this._clear(),D3(r,this.group);var n=r.get("clip",!0)?Tc(r.coordinateSystem,!1,r):null;nf(!!n,this.group,n)},t.prototype._incrementalRenderNormal=function(r,n){for(var i=n.getData(),a=i.getLayout("isSimpleBox"),o=P3(n),s;(s=r.next())!=null;){var l=i.getItemLayout(s),u=QC(l,s,o);eT(u,i,s,a),u.incremental=Qa(n),this.group.add(u),this._progressiveEls.push(u)}},t.prototype._incrementalRenderLarge=function(r,n){D3(n,this.group,this._progressiveEls,!0)},t.prototype.remove=function(r){this._clear()},t.prototype._clear=function(){this.group.removeAll(),nf(!1,this.group,null),this._data=null},t.type=Nl,t}(wt),lge=function(){function e(){}return e}(),uge=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="normalCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new lge},t.prototype.buildPath=function(r,n){var i=n.points;this.__simpleBox?(r.moveTo(i[4][0],i[4][1]),r.lineTo(i[6][0],i[6][1])):(r.moveTo(i[0][0],i[0][1]),r.lineTo(i[1][0],i[1][1]),r.lineTo(i[2][0],i[2][1]),r.lineTo(i[3][0],i[3][1]),r.closePath(),r.moveTo(i[4][0],i[4][1]),r.lineTo(i[5][0],i[5][1]),r.moveTo(i[6][0],i[6][1]),r.lineTo(i[7][0],i[7][1]))},t}(Qe);function QC(e,t,r,n){var i=e.ends;return new uge({shape:{points:n?cge(i,r,e):i},z2:100})}function eT(e,t,r,n){var i=t.getItemModel(r);e.useStyle(t.getItemVisual(r,"style")),e.style.strokeNoScale=!0;var a=i.getShallow("cursor");a&&e.attr("cursor",a),e.__simpleBox=n,Mr(e,i);var o=t.getItemLayout(r).sign;E(e.states,function(l,u){var c=i.getModel(u),h=TN(o,c),f=MN(o,c)||h,d=l.style||(l.style={});h&&(d.fill=h),f&&(d.stroke=f)});var s=i.getModel("emphasis");Vt(e,s.get("focus"),s.get("blurScope"),s.get("disabled"))}function cge(e,t,r){return ae(e,function(n){return n=n.slice(),n[t]=r.initBaseline,n})}function P3(e){return e.getWhiskerBoxesLayout()==="horizontal"?1:0}var hge=function(){function e(){}return e}(),tT=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n.type="largeCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new hge},t.prototype.buildPath=function(r,n){for(var i=n.points,a=0;aT?D[a]:I[a],ends:B,brushRect:$(M,A,w)})}function V(Z,X){var re=[];return re[i]=X,re[a]=Z,isNaN(X)||isNaN(Z)?[NaN,NaN]:t.dataToPoint(re)}function z(Z,X,re){var J=X.slice(),oe=X.slice();J[i]=u_(J[i]+n/2,1,!1),oe[i]=u_(oe[i]-n/2,1,!0),re?Z.push(J,oe):Z.push(oe,J)}function $(Z,X,re){var J=V(Z,re),oe=V(X,re);return J[i]-=n/2,oe[i]-=n/2,{x:J[0],y:J[1],width:a?n:oe[0]-J[0],height:a?oe[1]-J[1]:n}}function W(Z){return Z[i]=u_(Z[i],1),Z}}function g(m,y){for(var _=Za(m.count*4),x=0,w,S=[],T=[],M,A=y.getStore(),N=!!e.get(["itemStyle","borderColorDoji"]);(M=m.next())!=null;){var P=A.get(s,M),I=A.get(u,M),D=A.get(c,M),O=A.get(h,M),j=A.get(f,M);if(isNaN(P)||isNaN(O)||isNaN(j)){_[x++]=NaN,x+=3;continue}_[x++]=E3(A,M,I,D,c,N),S[i]=P,S[a]=O,w=t.dataToPoint(S,null,T),_[x++]=w?w[0]:NaN,_[x++]=w?w[1]:NaN,S[a]=j,w=t.dataToPoint(S,null,T),_[x++]=w?w[1]:NaN}y.setLayout("largePoints",_)}}};function E3(e,t,r,n,i,a){var o;return r>n?o=-1:r0?e.get(i,t-1)<=n?1:-1:1,o}function pge(e,t){var r=e.getBaseAxis(),n=ln(r,{fromStat:{key:ec(Nl)},min:1}).w,i=he(_e(e.get("barMaxWidth"),n),n),a=he(_e(e.get("barMinWidth"),1),n),o=e.get("barWidth");return o!=null?he(o,n):$e(bt(n/2,i),a)}function gge(e){dge(e,function(){var t=ec(Nl);RI(e,{key:t,seriesType:Nl,getMetrics:XI}),Nb(t,Rb(t))})}function mge(e){e.registerChartView(sge),e.registerSeriesModel(y9),e.registerPreprocessor(fge),e.registerVisual(age),e.registerLayout(vge),gge(e)}function R3(e,t){var r=t.rippleEffectColor||t.color;e.eachChild(function(n){n.attr({z:t.z,zlevel:t.zlevel,style:{stroke:t.brushType==="stroke"?r:null,fill:t.brushType==="fill"?r:null}})})}var yge=function(e){q(t,e);function t(r,n){var i=e.call(this)||this,a=new fm(r,n),o=new Me;return i.add(a),i.add(o),i.updateData(r,n),i}return t.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},t.prototype.startEffectAnimation=function(r){for(var n=r.symbolType,i=r.color,a=r.rippleNumber,o=this.childAt(1),s=0;s0&&(s=this._getLineLength(a)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){a.stopAnimation();var f=void 0;Ce(h)?f=h(i):f=h,a.__t>0&&(f=-s*a.__t),this._animateSymbol(a,s,f,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},t.prototype._animateSymbol=function(r,n,i,a,o){if(n>0){r.__t=0;var s=this,l=r.animate("",a).when(o?n*2:n,{__t:o?2:1}).delay(i).during(function(){s._updateSymbolPosition(r)});a||l.done(function(){s.remove(r)}),l.start()}},t.prototype._getLineLength=function(r){return Ho(r.__p1,r.__cp1)+Ho(r.__cp1,r.__p2)},t.prototype._updateAnimationPoints=function(r,n){r.__p1=n[0],r.__p2=n[1],r.__cp1=n[2]||[(n[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2]},t.prototype.updateData=function(r,n,i){this.childAt(0).updateData(r,n,i),this._updateEffectSymbol(r,n)},t.prototype._updateSymbolPosition=function(r){var n=r.__p1,i=r.__p2,a=r.__cp1,o=r.__t<=1?r.__t:2-r.__t,s=[r.x,r.y],l=s.slice(),u=Hr,c=Z2;s[0]=u(n[0],a[0],i[0],o),s[1]=u(n[1],a[1],i[1],o);var h=r.__t<=1?c(n[0],a[0],i[0],o):c(i[0],a[0],n[0],1-o),f=r.__t<=1?c(n[1],a[1],i[1],o):c(i[1],a[1],n[1],1-o);r.rotation=-Math.atan2(f,h)-Math.PI/2,(this._symbolType==="line"||this._symbolType==="rect"||this._symbolType==="roundRect")&&(r.__lastT!==void 0&&r.__lastT=0&&!(a[l]<=n);l--);l=Math.min(l,o-2)}else{for(l=s;ln);l++);l=Math.min(l-1,o-2)}var c=(n-a[l])/(a[l+1]-a[l]),h=i[l],f=i[l+1];r.x=h[0]*(1-c)+c*f[0],r.y=h[1]*(1-c)+c*f[1];var d=r.__t<=1?f[0]-h[0]:h[0]-f[0],g=r.__t<=1?f[1]-h[1]:h[1]-f[1];r.rotation=-Math.atan2(g,d)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=n,r.ignore=!1}},t}(_9),Sge=function(){function e(){this.polyline=!1,this.curveness=0,this.segs=[]}return e}(),Cge=function(e){q(t,e);function t(r){var n=e.call(this,r)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.beforeBrush=function(r){r&&!r.contentRetained&&this.reset()},t.prototype.getDefaultStyle=function(){return{stroke:K.color.neutral99,fill:null}},t.prototype.getDefaultShape=function(){return new Sge},t.prototype.buildPath=function(r,n){var i=n.segs,a=n.curveness,o;if(n.polyline)for(o=this._off;o0){r.moveTo(i[o++],i[o++]);for(var l=1;l0){var d=(u+h)/2-(c-f)*a,g=(c+f)/2-(h-u)*a;r.quadraticCurveTo(d,g,h,f)}else r.lineTo(h,f)}this.incremental&&(this._off=o,this.notClear=!0)},t.prototype.findDataIndex=function(r,n){var i=this.shape,a=i.segs,o=i.curveness,s=this.style.lineWidth;if(i.polyline)for(var l=0,u=0;u0)for(var h=a[u++],f=a[u++],d=1;d0){var y=(h+g)/2-(f-m)*o,_=(f+m)/2-(g-h)*o;if(AG(h,f,y,_,g,m,s,r,n))return l}else if(Vs(h,f,g,m,s,r,n))return l;l++}return-1},t.prototype.contain=function(r,n){var i=this.transformCoordToLocal(r,n),a=this.getBoundingRect();if(r=i[0],n=i[1],a.contain(r,n)){var o=this.hoverDataIdx=this.findDataIndex(r,n);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var r=this._rect;if(!r){for(var n=this.shape,i=n.segs,a=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u0&&(o.dataIndex=l+t.__startIndex)})},e.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},e}(),b9={seriesType:"lines",plan:Yc(),reset:function(e){var t=e.coordinateSystem;if(t){var r=e.get("polyline"),n=e.pipelineContext.large;return{progress:function(i,a){var o=[];if(n){var s=void 0,l=i.end-i.start;if(r){for(var u=0,c=i.start;c0&&c&&u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)}),o.updateData(a);var h=r.get("clip",!0)&&Tc(r.coordinateSystem,!1,r);h?this.group.setClipPath(h):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,i){var a=r.getData(),o=this._updateLineDraw(a,r);o.incrementalPrepareUpdate(a),this._clearLayer(i),this._finished=!1},t.prototype.incrementalRender=function(r,n,i){this._lineDraw.incrementalUpdate(r,n.getData(),Qa(n)),this._finished=r.end===n.getData().count()},t.prototype.eachRendered=function(r){this._lineDraw&&this._lineDraw.eachRendered(r)},t.prototype.updateTransform=function(r,n,i){var a=r.getData(),o=this._lineDraw;if(!this._finished||!o||!o.updateLayout)return{update:!0};var s=b9.reset(r,n,i);s.progress&&s.progress({start:0,end:a.count(),count:a.count()},a),o.updateLayout(),this._clearLayer(i)},t.prototype._updateLineDraw=function(r,n){var i=this._lineDraw,a=this._showEffect(n),o=!!n.get("polyline"),s=n.pipelineContext,l=s.large;return(!i||a!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(i&&i.remove(),i=this._lineDraw=l?new Tge:new mN(o?a?wge:x9:a?_9:gN),this._hasEffet=a,this._isPolyline=o,this._isLargeDraw=l),this.group.add(i.group),i},t.prototype._showEffect=function(r){return!!r.get(["effect","show"])},t.prototype._clearLayer=function(r){var n=wM(r);n&&this._lastZlevel!=null&&n.getLayer(this._lastZlevel).clear(!0)},t.prototype.remove=function(r,n){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(n)},t.prototype.dispose=function(r,n){this.remove(r,n)},t.type="lines",t}(wt),Age=typeof Uint32Array>"u"?Array:Uint32Array,kge=typeof Float64Array>"u"?Array:Float64Array;function O3(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=ae(t,function(r){var n=[r[0].coord,r[1].coord],i={coords:n};return r[0].name&&(i.fromName=r[0].name),r[1].name&&(i.toName=r[1].name),J1([i,r[0],r[1]])}))}var Lge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.visualStyleAccessPath="lineStyle",r.visualDrawType="stroke",r}return t.prototype.init=function(r){r.data=r.data||[],O3(r);var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count)),e.prototype.init.apply(this,arguments)},t.prototype.mergeOption=function(r){if(O3(r),r.data){var n=this._processFlatCoordsArray(r.data);this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset,n.flatCoords&&(r.data=new Float32Array(n.count))}e.prototype.mergeOption.apply(this,arguments)},t.prototype.appendData=function(r){var n=this._processFlatCoordsArray(r.data);n.flatCoords&&(this._flatCoords?(this._flatCoords=Df(this._flatCoords,n.flatCoords),this._flatCoordsOffset=Df(this._flatCoordsOffset,n.flatCoordsOffset)):(this._flatCoords=n.flatCoords,this._flatCoordsOffset=n.flatCoordsOffset),r.data=new Float32Array(n.count)),this.getRawData().appendData(r.data)},t.prototype._getCoordsFromItemModel=function(r){var n=this.getData().getItemModel(r),i=n.option instanceof Array?n.option:n.getShallow("coords");return i},t.prototype.getLineCoordsCount=function(r){return this._flatCoordsOffset?this._flatCoordsOffset[r*2+1]:this._getCoordsFromItemModel(r).length},t.prototype.getLineCoords=function(r,n){if(this._flatCoordsOffset){for(var i=this._flatCoordsOffset[r*2],a=this._flatCoordsOffset[r*2+1],o=0;o ")}return _r("nameValue",{name:l,value:o,noValue:o==null||isNaN(o)})},t.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},t.prototype.getProgressive=function(){var r=this.option.progressive;return r??(this.option.large?1e4:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var r=this.option.progressiveThreshold;return r??(this.option.large?2e4:this.get("progressiveThreshold"))},t.prototype.getZLevelKey=function(){var r=this.getModel("effect"),n=r.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:r.get("show")&&n>0?n+"":""},t.type="series.lines",t.dependencies=["grid","polar","geo","calendar"],t.defaultOption={coordinateSystem:"geo",z:2,legendHoverLink:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,clip:!0,label:{show:!1,position:"end"},lineStyle:{opacity:.5}},t}(At);function b0(e){return e instanceof Array||(e=[e,e]),e}var Ige={seriesType:"lines",reset:function(e){var t=b0(e.get("symbol")),r=b0(e.get("symbolSize")),n=e.getData();n.setVisual("fromSymbol",t&&t[0]),n.setVisual("toSymbol",t&&t[1]),n.setVisual("fromSymbolSize",r&&r[0]),n.setVisual("toSymbolSize",r&&r[1]);function i(a,o){var s=a.getItemModel(o),l=b0(s.getShallow("symbol",!0)),u=b0(s.getShallow("symbolSize",!0));l[0]&&a.setItemVisual(o,"fromSymbol",l[0]),l[1]&&a.setItemVisual(o,"toSymbol",l[1]),u[0]&&a.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&a.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:n.hasItemOption?i:null}}};function Nge(e){e.registerChartView(Mge),e.registerSeriesModel(Lge),e.registerLayout(b9),e.registerVisual(Ige)}var Pge=256,Dge=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var t=Rr.createCanvas();this.canvas=t}return e.prototype.update=function(t,r,n,i,a,o){var s=this._getBrush(),l=this._getGradient(a,"inRange"),u=this._getGradient(a,"outOfRange"),c=this.pointSize+this.blurSize,h=this.canvas,f=h.getContext("2d"),d=t.length;h.width=r,h.height=n;for(var g=0;g0){var O=o(w)?l:u;w>0&&(w=w*I+N),T[M++]=O[D],T[M++]=O[D+1],T[M++]=O[D+2],T[M++]=O[D+3]*w*256}else M+=4}return f.putImageData(S,0,0),h},e.prototype._getBrush=function(){var t=this._brushCanvas||(this._brushCanvas=Rr.createCanvas()),r=this.pointSize+this.blurSize,n=r*2;t.width=n,t.height=n;var i=t.getContext("2d");return i.clearRect(0,0,n,n),i.shadowOffsetX=n,i.shadowBlur=this.blurSize,i.shadowColor=K.color.neutral99,i.beginPath(),i.arc(-r,r,this.pointSize,0,Math.PI*2,!0),i.closePath(),i.fill(),t},e.prototype._getGradient=function(t,r){for(var n=this._gradientPixels,i=n[r]||(n[r]=new Uint8ClampedArray(256*4)),a=[0,0,0,0],o=0,s=0;s<256;s++)t[r](s/255,!0,a),i[o++]=a[0],i[o++]=a[1],i[o++]=a[2],i[o++]=a[3];return i},e}();function Ege(e,t,r){var n=e[1]-e[0];t=ae(t,function(o){return{interval:[(o.interval[0]-e[0])/n,(o.interval[1]-e[0])/n]}});var i=t.length,a=0;return function(o){var s;for(s=a;s=0;s--){var l=t[s].interval;if(l[0]<=o&&o<=l[1]){a=s;break}}return s>=0&&s=t[0]&&n<=t[1]}}var jge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a;n.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===r&&(a=s)})}),this._progressiveEls=null,this.group.removeAll();var o=r.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"||o.type==="matrix"?this._renderOnGridLike(r,i,0,r.getData().count()):zO(o)&&this._renderOnGeo(o,r,a,i)},t.prototype.incrementalPrepareRender=function(r,n,i){this.group.removeAll()},t.prototype.incrementalRender=function(r,n,i,a){var o=n.coordinateSystem;o&&(zO(o)?this.render(n,i,a):(this._progressiveEls=[],this._renderOnGridLike(n,a,r.start,r.end,!0)))},t.prototype.eachRendered=function(r){zl(this._progressiveEls||this.group,r)},t.prototype._renderOnGridLike=function(r,n,i,a,o){var s=r.coordinateSystem,l=Mc(s,"cartesian2d"),u=Mc(s,"matrix"),c,h,f,d;if(l){var g=s.getAxis("x"),m=s.getAxis("y");c=ln(g).w+.5,h=ln(m).w+.5,f=g.scale.getExtent(),d=m.scale.getExtent()}for(var y=this.group,_=r.getData(),x=r.getModel(["emphasis","itemStyle"]).getItemStyle(),w=r.getModel(["blur","itemStyle"]).getItemStyle(),S=r.getModel(["select","itemStyle"]).getItemStyle(),T=r.get(["itemStyle","borderRadius"]),M=Ar(r),A=r.getModel("emphasis"),N=A.get("focus"),P=A.get("blurScope"),I=A.get("disabled"),D=l||u?[_.mapDimension("x"),_.mapDimension("y"),_.mapDimension("value")]:[_.mapDimension("time"),_.mapDimension("value")],O=i;Of[1]||Hd[1])continue;var V=s.dataToPoint([U,H]);j=new Ye({shape:{x:V[0]-c/2,y:V[1]-h/2,width:c,height:h},style:B})}else if(u){var z=s.dataToLayout([_.get(D[0],O),_.get(D[1],O)]).rect;if(tn(z.x))continue;j=new Ye({z2:1,shape:z,style:B})}else{if(isNaN(_.get(D[1],O)))continue;var $=s.dataToLayout([_.get(D[0],O)]),z=$.contentRect||$.rect;if(tn(z.x)||tn(z.y))continue;j=new Ye({z2:1,shape:z,style:B})}if(_.hasItemOption){var W=_.getItemModel(O),Z=W.getModel("emphasis");x=Z.getModel("itemStyle").getItemStyle(),w=W.getModel(["blur","itemStyle"]).getItemStyle(),S=W.getModel(["select","itemStyle"]).getItemStyle(),T=W.get(["itemStyle","borderRadius"]),N=Z.get("focus"),P=Z.get("blurScope"),I=Z.get("disabled"),M=Ar(W)}j.shape.r=T;var X=r.getRawValue(O),re="-";X&&X[2]!=null&&(re=X[2]+""),Or(j,M,{labelFetcher:r,labelDataIndex:O,defaultOpacity:B.opacity,defaultText:re}),j.ensureState("emphasis").style=x,j.ensureState("blur").style=w,j.ensureState("select").style=S,Vt(j,N,P,I),j.incremental=Qa(r,o),o&&(j.states.emphasis.hoverLayer=gd),y.add(j),_.setItemGraphicEl(O,j),this._progressiveEls&&this._progressiveEls.push(j)}},t.prototype._renderOnGeo=function(r,n,i,a){var o=i.targetVisuals.inRange,s=i.targetVisuals.outOfRange,l=n.getData(),u=this._hmLayer||this._hmLayer||new Dge;u.blurSize=n.get("blurSize"),u.pointSize=n.get("pointSize"),u.minOpacity=n.get("minOpacity"),u.maxOpacity=n.get("maxOpacity");var c=r.getViewRect().clone(),h=r.getRoamTransform();c.applyTransform(h);var f=Math.max(c.x,0),d=Math.max(c.y,0),g=Math.min(c.width+c.x,a.getWidth()),m=Math.min(c.height+c.y,a.getHeight()),y=g-f,_=m-d,x=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],w=l.mapArray(x,function(A,N,P){var I=r.dataToPoint([A,N]);return I[0]-=f,I[1]-=d,I.push(P),I}),S=i.getExtent(),T=i.type==="visualMap.continuous"?Rge(S,i.option.range):Ege(S,i.getPieceList(),i.option.selected);u.update(w,y,_,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},T);var M=new zr({style:{width:y,height:_,x:f,y:d,image:u.canvas},silent:!0});this.group.add(M)},t.type="heatmap",t}(wt),Oge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.getInitialData=function(r,n){return wo(null,this,{generateCoord:"value"})},t.prototype.preventIncremental=function(){var r=xd.get(this.get("coordinateSystem"));if(r&&r.dimensions)return r.dimensions[0]==="lng"&&r.dimensions[1]==="lat"},t.type="series.heatmap",t.dependencies=["grid","geo","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,geoIndex:0,blurSize:30,pointSize:20,maxOpacity:1,minOpacity:0,select:{itemStyle:{borderColor:K.color.primary}}},t}(At);function zge(e){e.registerChartView(jge),e.registerSeriesModel(Oge)}var Bge=["itemStyle","borderWidth"],z3=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],nT=new bo,Fge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Tg,r}return t.prototype.render=function(r,n,i){var a=this.group,o=r.getData(),s=this._data,l=r.coordinateSystem,u=l.getBaseAxis(),c=u.isHorizontal(),h=l.master.getRect(),f={ecSize:{width:i.getWidth(),height:i.getHeight()},seriesModel:r,coordSys:l,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:c,valueDim:z3[+c],categoryDim:z3[1-+c]};o.diff(s).add(function(g){if(o.hasValue(g)){var m=F3(o,g),y=B3(o,g,m,f),_=V3(o,f,y);o.setItemGraphicEl(g,_),a.add(_),H3(_,f,y)}}).update(function(g,m){var y=s.getItemGraphicEl(m);if(!o.hasValue(g)){a.remove(y);return}var _=F3(o,g),x=B3(o,g,_,f),w=A9(o,x);y&&w!==y.__pictorialShapeStr&&(a.remove(y),o.setItemGraphicEl(g,null),y=null),y?$ge(y,f,x):y=V3(o,f,x,!0),o.setItemGraphicEl(g,y),y.__pictorialSymbolMeta=x,a.add(y),H3(y,f,x)}).remove(function(g){var m=s.getItemGraphicEl(g);m&&G3(s,g,m.__pictorialSymbolMeta.animationModel,m)}).execute();var d=r.get("clip",!0)?Tc(r.coordinateSystem,!1,r):null;return d?a.setClipPath(d):a.removeClipPath(),this._data=o,this.group},t.prototype.remove=function(r,n){var i=this.group,a=this._data;r.get("animation")?a&&a.eachItemGraphicEl(function(o){G3(a,Re(o).dataIndex,r,o)}):i.removeAll()},t.type=Tg,t}(wt);function B3(e,t,r,n){var i=e.getItemLayout(t),a=r.get("symbolRepeat"),o=r.get("symbolClip"),s=r.get("symbolPosition")||"start",l=r.get("symbolRotate"),u=(l||0)*Math.PI/180||0,c=r.get("symbolPatternSize")||2,h=r.isAnimationEnabled(),f={dataIndex:t,layout:i,itemModel:r,symbolType:e.getItemVisual(t,"symbol")||"circle",style:e.getItemVisual(t,"style"),symbolClip:o,symbolRepeat:a,symbolRepeatDirection:r.get("symbolRepeatDirection"),symbolPatternSize:c,rotation:u,animationModel:h?r:null,hoverScale:h&&r.get(["emphasis","scale"]),z2:r.getShallow("z",!0)||0};Vge(r,a,i,n,f),Gge(e,t,i,a,o,f.boundingLength,f.pxSign,c,n,f),Hge(r,f.symbolScale,u,n,f);var d=f.symbolSize,g=Xc(r.get("symbolOffset"),d);return Uge(r,d,i,a,o,g,s,f.valueLineWidth,f.boundingLength,f.repeatCutLength,n,f),f}function Vge(e,t,r,n,i){var a=n.valueDim,o=e.get("symbolBoundingData"),s=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(r[a.wh]<=0),c;if(ne(o)){var h=[iT(s,o[0])-l,iT(s,o[1])-l];h[1]=0?1:-1:c>0?1:-1}function iT(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function Gge(e,t,r,n,i,a,o,s,l,u){var c=l.valueDim,h=l.categoryDim,f=Math.abs(r[h.wh]),d=e.getItemVisual(t,"symbolSize"),g;ne(d)?g=d.slice():d==null?g=["100%","100%"]:g=[d,d],g[h.index]=he(g[h.index],f),g[c.index]=he(g[c.index],n?f:Math.abs(a)),u.symbolSize=g;var m=u.symbolScale=[g[0]/s,g[1]/s];m[c.index]*=(l.isHorizontal?-1:1)*o}function Hge(e,t,r,n,i){var a=e.get(Bge)||0;a&&(nT.attr({scaleX:t[0],scaleY:t[1],rotation:r}),nT.updateTransform(),a/=nT.getLineScale(),a*=t[n.valueDim.index]),i.valueLineWidth=a||0}function Uge(e,t,r,n,i,a,o,s,l,u,c,h){var f=c.categoryDim,d=c.valueDim,g=h.pxSign,m=Math.max(t[d.index]+s,0),y=m;if(n){var _=Math.abs(l),x=mn(e.get("symbolMargin"),"15%")+"",w=!1;x.lastIndexOf("!")===x.length-1&&(w=!0,x=x.slice(0,x.length-1));var S=he(x,t[d.index]),T=Math.max(m+S*2,0),M=w?0:S*2,A=xL(n),N=A?n:U3((_+M)/T),P=_-N*m;S=P/2/(w?N:Math.max(N-1,1)),T=m+S*2,M=w?0:S*2,!A&&n!=="fixed"&&(N=u?U3((Math.abs(u)+M)/T):0),y=N*T-M,h.repeatTimes=N,h.symbolMargin=S}var I=g*(y/2),D=h.pathPosition=[];D[f.index]=r[f.wh]/2,D[d.index]=o==="start"?I:o==="end"?l-I:l/2,a&&(D[0]+=a[0],D[1]+=a[1]);var O=h.bundlePosition=[];O[f.index]=r[f.xy],O[d.index]=r[d.xy];var j=h.barRectShape=ee({},r);j[d.wh]=g*Math.max(Math.abs(r[d.wh]),Math.abs(D[d.index]+I)),j[f.wh]=r[f.wh];var B=h.clipShape={};B[f.xy]=-r[f.xy],B[f.wh]=c.ecSize[f.wh],B[d.xy]=0,B[d.wh]=r[d.wh]}function w9(e){var t=e.symbolPatternSize,r=dr(e.symbolType,-t/2,-t/2,t,t);return r.attr({culling:!0}),r.type!=="image"&&r.setStyle({strokeNoScale:!0}),r}function S9(e,t,r,n){var i=e.__pictorialBundle,a=r.symbolSize,o=r.valueLineWidth,s=r.pathPosition,l=t.valueDim,u=r.repeatTimes||0,c=0,h=a[t.valueDim.index]+o+r.symbolMargin*2;for(AN(e,function(m){m.__pictorialAnimationIndex=c,m.__pictorialRepeatTimes=u,c0:_<0)&&(x=u-1-m),y[l.index]=h*(x-u/2+.5)+s[l.index],{x:y[0],y:y[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation}}}function C9(e,t,r,n){var i=e.__pictorialBundle,a=e.__pictorialMainPath;a?wf(a,null,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation},r,n):(a=e.__pictorialMainPath=w9(r),i.add(a),wf(a,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:0,scaleY:0,rotation:r.rotation},{scaleX:r.symbolScale[0],scaleY:r.symbolScale[1]},r,n))}function T9(e,t,r){var n=ee({},t.barRectShape),i=e.__pictorialBarRect;i?wf(i,null,{shape:n},t,r):(i=e.__pictorialBarRect=new Ye({z2:2,shape:n,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),i.disableMorphing=!0,e.add(i))}function M9(e,t,r,n){if(r.symbolClip){var i=e.__pictorialClipPath,a=ee({},r.clipShape),o=t.valueDim,s=r.animationModel,l=r.dataIndex;if(i)lt(i,{shape:a},s,l);else{a[o.wh]=0,i=new Ye({shape:a}),e.__pictorialBundle.setClipPath(i),e.__pictorialClipPath=i;var u={};u[o.wh]=r.clipShape[o.wh],Wc[n?"updateProps":"initProps"](i,{shape:u},s,l)}}}function F3(e,t){var r=e.getItemModel(t);return r.getAnimationDelayParams=Wge,r.isAnimationEnabled=Zge,r}function Wge(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function Zge(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function V3(e,t,r,n){var i=new Me,a=new Me;return i.add(a),i.__pictorialBundle=a,a.x=r.bundlePosition[0],a.y=r.bundlePosition[1],r.symbolRepeat?S9(i,t,r):C9(i,t,r),T9(i,r,n),M9(i,t,r,n),i.__pictorialShapeStr=A9(e,r),i.__pictorialSymbolMeta=r,i}function $ge(e,t,r){var n=r.animationModel,i=r.dataIndex,a=e.__pictorialBundle;lt(a,{x:r.bundlePosition[0],y:r.bundlePosition[1]},n,i),r.symbolRepeat?S9(e,t,r,!0):C9(e,t,r,!0),T9(e,r,!0),M9(e,t,r,!0)}function G3(e,t,r,n){var i=n.__pictorialBarRect;i&&i.removeTextContent();var a=[];AN(n,function(o){a.push(o)}),n.__pictorialMainPath&&a.push(n.__pictorialMainPath),n.__pictorialClipPath&&(r=null),E(a,function(o){Al(o,{scaleX:0,scaleY:0},r,t,function(){n.parent&&n.parent.remove(n)})}),e.setItemGraphicEl(t,null)}function A9(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function AN(e,t,r){E(e.__pictorialBundle.children(),function(n){n!==e.__pictorialBarRect&&t.call(r,n)})}function wf(e,t,r,n,i,a){t&&e.attr(t),n.symbolClip&&!i?r&&e.attr(r):r&&Wc[i?"updateProps":"initProps"](e,r,n.animationModel,n.dataIndex,a)}function H3(e,t,r){var n=r.dataIndex,i=r.itemModel,a=i.getModel("emphasis"),o=a.getModel("itemStyle").getItemStyle(),s=i.getModel(["blur","itemStyle"]).getItemStyle(),l=i.getModel(["select","itemStyle"]).getItemStyle(),u=i.getShallow("cursor"),c=a.get("focus"),h=a.get("blurScope"),f=a.get("scale");AN(e,function(m){if(m instanceof zr){var y=m.style;m.useStyle(ee({image:y.image,x:y.x,y:y.y,width:y.width,height:y.height},r.style))}else m.useStyle(r.style);var _=m.ensureState("emphasis");_.style=o,f&&(_.scaleX=m.scaleX*1.1,_.scaleY=m.scaleY*1.1),m.ensureState("blur").style=s,m.ensureState("select").style=l,u&&(m.cursor=u),m.z2=r.z2});var d=t.valueDim.posDesc[+(r.boundingLength>0)],g=e.__pictorialBarRect;g.ignoreClip=!0,Or(g,Ar(i),{labelFetcher:t.seriesModel,labelDataIndex:n,defaultText:Zf(t.seriesModel.getData(),n),inheritColor:r.style.fill,defaultOpacity:r.style.opacity,defaultOutsidePosition:d}),Vt(e,c,h,a.get("disabled"))}function U3(e){var t=Math.round(e);return Math.abs(e-t)<1e-4?t:Math.ceil(e)}var Yge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.hasSymbolVisual=!0,r.defaultSymbol="roundRect",r}return t.prototype.getInitialData=function(r){return r.stack=null,e.prototype.getInitialData.apply(this,arguments)},t.type="series."+Tg,t.dependencies=["grid"],t.defaultOption=Bl(Mg.defaultOption,{symbol:"circle",symbolSize:null,symbolRotate:null,symbolPosition:null,symbolOffset:null,symbolMargin:null,symbolRepeat:!1,symbolRepeatDirection:"end",symbolClip:!1,symbolBoundingData:null,symbolPatternSize:400,barGap:"-100%",clip:!1,progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:K.color.primary}}}),t}(Mg);function Xge(e){e.registerChartView(Fge),e.registerSeriesModel(Yge),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,jW(Tg)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,OW(Tg)),BW(e)}var aT=2,qf="themeRiver",qge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r){e.prototype.init.apply(this,arguments),this.legendVisualProvider=new Id(de(this.getData,this),de(this.getRawData,this))},t.prototype.fixData=function(r){var n=r.length,i={},a=sM(r,function(f){return i.hasOwnProperty(f[0]+"")||(i[f[0]+""]=-1),f[2]}),o=[];a.buckets.each(function(f,d){o.push({name:d,dataList:f})});for(var s=o.length,l=0;la&&(a=s),n.push(s)}for(var u=0;ua&&(a=h)}return{y0:i,max:a}}function rme(e){e.registerChartView(Kge),e.registerSeriesModel(qge),e.registerLayout(Qge),e.registerProcessor(gm(qf))}var nme=2,ime=4,Z3=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this)||this;o.z2=nme,o.textConfig={inside:!0},Re(o).seriesIndex=n.seriesIndex;var s=new it({z2:ime,silent:r.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,r,n,i,a),o}return t.prototype.updateData=function(r,n,i,a,o){this.node=n,n.piece=this,i=i||this._seriesModel,a=a||this._ecModel;var s=this;Re(s).dataIndex=n.dataIndex;var l=n.getModel(),u=l.getModel("emphasis"),c=n.getLayout(),h=ee({},c);h.label=null;var f=n.getVisual("style");f.lineJoin="bevel";var d=n.getVisual("decal");d&&(f.decal=Vf(d,o));var g=$a(l.getModel("itemStyle"),h,!0);ee(h,g),E(Dn,function(x){var w=s.ensureState(x),S=l.getModel([x,"itemStyle"]);w.style=S.getItemStyle();var T=$a(S,h);T&&(w.shape=T)}),r?(s.setShape(h),s.shape.r=c.r0,jt(s,{shape:{r:c.r}},i,n.dataIndex)):(lt(s,{shape:h},i),$i(s)),s.useStyle(f),this._updateLabel(i);var m=l.getShallow("cursor");m&&s.attr("cursor",m),this._seriesModel=i||this._seriesModel,this._ecModel=a||this._ecModel;var y=u.get("focus"),_=y==="relative"?Df(n.getAncestorsIndices(),n.getDescendantIndices()):y==="ancestor"?n.getAncestorsIndices():y==="descendant"?n.getDescendantIndices():y;Vt(this,_,u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r){var n=this,i=this.node.getModel(),a=i.getModel("label"),o=this.node.getLayout(),s=o.endAngle-o.startAngle,l=(o.startAngle+o.endAngle)/2,u=Math.cos(l),c=Math.sin(l),h=this,f=h.getTextContent(),d=this.node.dataIndex,g=a.get("minAngle")/180*Math.PI,m=a.get("show")&&!(g!=null&&Math.abs(s)B&&!fc(H-B)&&H0?(o.virtualPiece?o.virtualPiece.updateData(!1,x,r,n,i):(o.virtualPiece=new Z3(x,r,n,i),c.add(o.virtualPiece)),w.piece.off("click"),o.virtualPiece.on("click",function(S){o._rootToNode(w.parentNode)})):o.virtualPiece&&(c.remove(o.virtualPiece),o.virtualPiece=null)}},t.prototype._initEvents=function(){var r=this;this.group.off("click"),this.group.on("click",function(n){var i=!1,a=r.seriesModel.getViewRoot();a.eachNode(function(o){if(!i&&o.piece&&o.piece===n.target){var s=o.getModel().get("nodeClick");if(s==="rootToNode")r._rootToNode(o);else if(s==="link"){var l=o.getModel(),u=l.get("link");if(u){var c=l.get("target",!0)||"_blank";Sx(u,c)}}i=!0}})})},t.prototype._rootToNode=function(r){r!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:MA,from:this.uid,seriesId:this.seriesModel.id,targetNode:r})},t.prototype.containPoint=function(r,n){var i=n.getData(),a=i.getItemLayout(0);if(a){var o=r[0]-a.cx,s=r[1]-a.cy,l=Math.sqrt(o*o+s*s);return l<=a.r&&l>=a.r0}},t.type=Ec,t}(wt),ume=kr(Ec,cme);function cme(e){var t={};function r(n,i,a){if(n.depth===0)return K.color.neutral50;for(var o=n;o&&o.depth>1;)o=o.parentNode;var s=i.getColorFromPalette(o.name||o.dataIndex+"",t);return n.depth>1&&ue(s)&&(s=ax(s,(n.depth-1)/(a-1)*.5)),s}e.eachSeriesByType(Ec,function(n){var i=n.getData(),a=i.tree;a.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=r(o,n,a.root.height));var u=i.ensureUniqueItemVisual(o.dataIndex,"style");ee(u,l)})})}var Y3=Math.PI/180,hme=kr(Ec,fme);function fme(e,t){e.eachSeriesByType(Ec,function(r){var n=r.get("center"),i=r.get("radius");ne(i)||(i=[0,i]),ne(n)||(n=[n,n]);var a=t.getWidth(),o=t.getHeight(),s=Math.min(a,o),l=he(n[0],a),u=he(n[1],o),c=he(i[0],s/2),h=he(i[1],s/2),f=-r.get("startAngle")*Y3,d=r.get("minAngle")*Y3,g=r.getData().tree.root,m=r.getViewRoot(),y=m.depth,_=r.get("sort");_!=null&&L9(m,_);var x=0;E(m.children,function(U){!isNaN(U.getValue())&&x++});var w=m.getValue(),S=Math.PI/(w||x)*2,T=m.depth>0,M=m.height-(T?-1:1),A=(h-c)/(M||1),N=r.get("clockwise"),P=r.get("stillShowZeroSum"),I=N?1:-1,D=function(U,H){if(U){var V=H;if(U!==g){var z=U.getValue(),$=w===0&&P?S:z*S;$n[1]&&n.reverse(),{coordSys:{type:"polar",cx:e.cx,cy:e.cy,r:n[1],r0:n[0]},api:{coord:function(i){var a=t.dataToRadius(i[0]),o=r.dataToAngle(i[1]),s=e.coordToPoint([a,o]);return s.push(a,o*Math.PI/180),s},size:de(Sme,e)}}}function Tme(e){var t=e.getRect(),r=e.getRangeInfo();return{coordSys:{type:"calendar",x:t.x,y:t.y,width:t.width,height:t.height,cellWidth:e.getCellWidth(),cellHeight:e.getCellHeight(),rangeInfo:{start:r.start,end:r.end,weeks:r.weeks,dayCount:r.allDay}},api:{coord:function(n,i){return e.dataToPoint(n,i)},layout:function(n,i){return e.dataToLayout(n,i)}}}}function Mme(e){var t=e.getRect();return{coordSys:{type:"matrix",x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:function(r,n){return e.dataToPoint(r,n)},layout:function(r,n){return e.dataToLayout(r,n)}}}}var I9={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},q3=tt(I9);Hi(us,function(e,t){return e[t]=1,e},{});us.join(", ");var o1=["","style","shape","extra"],Kf=Ue();function kN(e,t,r,n,i){var a=e+"Animation",o=pd(e,n,i)||{},s=Kf(t).userDuring;return o.duration>0&&(o.during=s?de(Nme,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),ee(o,r[a]),o}function x_(e,t,r,n){n=n||{};var i=n.dataIndex,a=n.isInit,o=n.clearStyle,s=r.isAnimationEnabled(),l=Kf(e),u=t.style;l.userDuring=t.during;var c={},h={};if(Dme(e,t,h),e.type==="compound")for(var f=e.shape.paths,d=t.shape.paths,g=0;g0&&e.animateFrom(y,_)}else kme(e,t,i||0,r,c);N9(e,t),u?e.dirty():e.markRedraw()}function N9(e,t){for(var r=Kf(e).leaveToProps,n=0;n0&&e.animateFrom(i,a)}}function Lme(e,t){ge(t,"silent")&&(e.silent=t.silent),ge(t,"ignore")&&(e.ignore=t.ignore),e instanceof Zi&&ge(t,"invisible")&&(e.invisible=t.invisible),e instanceof Qe&&ge(t,"autoBatch")&&(e.autoBatch=t.autoBatch)}var ja={},Ime={setTransform:function(e,t){return ja.el[e]=t,this},getTransform:function(e){return ja.el[e]},setShape:function(e,t){var r=ja.el,n=r.shape||(r.shape={});return n[e]=t,r.dirtyShape&&r.dirtyShape(),this},getShape:function(e){var t=ja.el.shape;if(t)return t[e]},setStyle:function(e,t){var r=ja.el,n=r.style;return n&&(n[e]=t,r.dirtyStyle&&r.dirtyStyle()),this},getStyle:function(e){var t=ja.el.style;if(t)return t[e]},setExtra:function(e,t){var r=ja.el.extra||(ja.el.extra={});return r[e]=t,this},getExtra:function(e){var t=ja.el.extra;if(t)return t[e]}};function Nme(){var e=this,t=e.el;if(t){var r=Kf(t).userDuring,n=e.userDuring;if(r!==n){e.el=e.userDuring=null;return}ja.el=t,n(Ime)}}function K3(e,t,r,n){var i=r[e];if(i){var a=t[e],o;if(a){var s=r.transition,l=i.transition;if(l)if(!o&&(o=n[e]={}),tc(l))ee(o,a);else for(var u=It(l),c=0;c=0){!o&&(o=n[e]={});for(var d=tt(a),c=0;c=0)){var f=e.getAnimationStyleProps(),d=f?f.style:null;if(d){!a&&(a=n.style={});for(var g=tt(r),u=0;u=0?t.getStore().get(z,H):void 0}var $=t.get(V.name,H),W=V&&V.ordinalMeta;return W?W.categories[$]:$}function A(U,H){H==null&&(H=c);var V=t.getItemVisual(H,"style"),z=V&&V.fill,$=V&&V.opacity,W=w(H,el).getItemStyle();z!=null&&(W.fill=z),$!=null&&(W.opacity=$);var Z={inheritColor:ue(z)?z:K.color.neutral99},X=S(H,el),re=Lt(X,null,Z,!1,!0);re.text=X.getShallow("show")?_e(e.getFormattedLabel(H,el),Zf(t,H)):null;var J=mx(X,Z,!1);return I(U,W),W=FO(W,re,J),U&&P(W,U),W.legacy=!0,W}function N(U,H){H==null&&(H=c);var V=w(H,es).getItemStyle(),z=S(H,es),$=Lt(z,null,null,!0,!0);$.text=z.getShallow("show")?qn(e.getFormattedLabel(H,es),e.getFormattedLabel(H,el),Zf(t,H)):null;var W=mx(z,null,!0);return I(U,V),V=FO(V,$,W),U&&P(V,U),V.legacy=!0,V}function P(U,H){for(var V in H)ge(H,V)&&(U[V]=H[V])}function I(U,H){U&&(U.textFill&&(H.textFill=U.textFill),U.textPosition&&(H.textPosition=U.textPosition))}function D(U,H){if(H==null&&(H=c),ge(X3,U)){var V=t.getItemVisual(H,"style");return V?V[X3[U]]:null}if(ge(pme,U))return t.getItemVisual(H,U)}function O(U){if(o.type==="cartesian2d"){var H=o.getBaseAxis();return Hue(ke({axis:H},U))}}function j(){return r.getCurrentSeriesIndices()}function B(U){return HL(U,r)}}function Ume(e){var t={};return E(e.dimensions,function(r){var n=e.getDimensionInfo(r);if(!n.isExtraCoord){var i=n.coordDim,a=t[i]=t[i]||[];a[n.coordDimIndex]=e.getDimensionIndex(r)}}),t}function uT(e,t,r,n,i,a,o){if(!n){a.remove(t);return}var s=DN(e,t,r,n,i,a);return s&&o.setItemGraphicEl(r,s),s&&Vt(s,n.focus,n.blurScope,n.emphasisDisabled),s}function DN(e,t,r,n,i,a){var o=-1,s=t;t&&R9(t,n,i)&&(o=Be(a.childrenRef(),t),t=null);var l=!t,u=t;u?u.clearStates():(u=NN(n),s&&Fme(s,u)),n.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),n.tooltipDisabled&&(u.tooltipDisabled=!0),Si.normal.cfg=Si.normal.conOpt=Si.emphasis.cfg=Si.emphasis.conOpt=Si.blur.cfg=Si.blur.conOpt=Si.select.cfg=Si.select.conOpt=null,Si.isLegacy=!1,Zme(u,r,n,i,l,Si),Wme(u,r,n,i,l),PN(e,u,r,n,Si,i,l),ge(n,"info")&&(Qo(u).info=n.info);for(var c=0;c=0?a.replaceAt(u,o):a.add(u),u}function R9(e,t,r){var n=Qo(e),i=t.type,a=t.shape,o=t.style;return r.isUniversalTransitionEnabled()||i!=null&&i!==n.customGraphicType||i==="path"&&Kme(a)&&j9(a)!==n.customPathData||i==="image"&&ge(o,"image")&&o.image!==n.customImagePath}function Wme(e,t,r,n,i){var a=r.clipPath;if(a===!1)e&&e.getClipPath()&&e.removeClipPath();else if(a){var o=e.getClipPath();o&&R9(o,a,n)&&(o=null),o||(o=NN(a),e.setClipPath(o)),PN(null,o,t,a,null,n,i)}}function Zme(e,t,r,n,i,a){if(!(e.isGroup||e.type==="compoundPath")){Q3(r,null,a),Q3(r,es,a);var o=a.normal.conOpt,s=a.emphasis.conOpt,l=a.blur.conOpt,u=a.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var c=e.getTextContent();if(o===!1)c&&e.removeTextContent();else{o=a.normal.conOpt=o||{type:"text"},c?c.clearStates():(c=NN(o),e.setTextContent(c)),PN(null,c,t,o,null,n,i);for(var h=o&&o.style,f=0;f=c;d--){var g=t.childAt(d);Yme(t,g,i)}}}function Yme(e,t,r){t&&Wb(t,Qo(e).option,r)}function Xme(e){new ds(e.oldChildren,e.newChildren,ez,ez,e).add(tz).update(tz).remove(qme).execute()}function ez(e,t){var r=e&&e.name;return r??zme+t}function tz(e,t){var r=this.context,n=e!=null?r.newChildren[e]:null,i=t!=null?r.oldChildren[t]:null;DN(r.api,i,r.dataIndex,n,r.seriesModel,r.group)}function qme(e){var t=this.context,r=t.oldChildren[e];r&&Wb(r,Qo(r).option,t.seriesModel)}function j9(e){return e&&(e.pathData||e.d)}function Kme(e){return e&&(ge(e,"pathData")||ge(e,"d"))}function Jme(e){e.registerChartView(Vme),e.registerSeriesModel(gme)}var Eu=Ue(),rz=Se,cT=de,RN=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(t,r,n,i){var a=r.get("value"),o=r.get("status");if(this._axisModel=t,this._axisPointerModel=r,this._api=n,!(!i&&this._lastValue===a&&this._lastStatus===o)){this._lastValue=a,this._lastStatus=o;var s=this._group,l=this._handle;if(!o||o==="hide"){s&&s.hide(),l&&l.hide();return}s&&s.show(),l&&l.show();var u={};this.makeElOption(u,a,t,r,n);var c=u.graphicKey;c!==this._lastGraphicKey&&this.clear(n),this._lastGraphicKey=c;var h=this._moveAnimation=this.determineAnimation(t,r);if(!s)s=this._group=new Me,this.createPointerEl(s,u,t,r),this.createLabelEl(s,u,t,r),n.getZr().add(s);else{var f=Ze(nz,r,h);this.updatePointerEl(s,u,f),this.updateLabelEl(s,u,f,r)}az(s,r,!0),this._renderHandle(a)}},e.prototype.remove=function(t){this.clear(t)},e.prototype.dispose=function(t){this.clear(t)},e.prototype.determineAnimation=function(t,r){var n=r.get("animation"),i=t.axis,a=i.type==="category",o=r.get("snap");if(!o&&!a)return!1;if(n==="auto"||n==null){var s=this.animationThreshold;if(a&&ln(i).w>s)return!0;if(o){var l=KI(t).seriesDataCount,u=i.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return n===!0},e.prototype.makeElOption=function(t,r,n,i,a){},e.prototype.createPointerEl=function(t,r,n,i){var a=r.pointer;if(a){var o=Eu(t).pointerEl=new Wc[a.type](rz(r.pointer));t.add(o)}},e.prototype.createLabelEl=function(t,r,n,i){if(r.label){var a=Eu(t).labelEl=new it(rz(r.label));t.add(a),iz(a,i)}},e.prototype.updatePointerEl=function(t,r,n){var i=Eu(t).pointerEl;i&&r.pointer&&(i.setStyle(r.pointer.style),n(i,{shape:r.pointer.shape}))},e.prototype.updateLabelEl=function(t,r,n,i){var a=Eu(t).labelEl;a&&(a.setStyle(r.label.style),n(a,{x:r.label.x,y:r.label.y}),iz(a,i))},e.prototype._renderHandle=function(t){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,n=this._api.getZr(),i=this._handle,a=r.getModel("handle"),o=r.get("status");if(!a.get("show")||!o||o==="hide"){i&&n.remove(i),this._handle=null;return}var s;this._handle||(s=!0,i=this._handle=md(a.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){ls(u.event)},onmousedown:cT(this._onHandleDragMove,this,0,0),drift:cT(this._onHandleDragMove,this),ondragend:cT(this._onHandleDragEnd,this)}),n.add(i)),az(i,r,!1),i.setStyle(a.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=a.get("size");ne(l)||(l=[l,l]),i.scaleX=l[0]/2,i.scaleY=l[1]/2,bd(this,"_doDispatchAxisPointer",a.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,s)}},e.prototype._moveHandleToValue=function(t,r){nz(this._axisPointerModel,!r&&this._moveAnimation,this._handle,hT(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(t,r){var n=this._handle;if(n){this._dragging=!0;var i=this.updateHandleTransform(hT(n),[t,r],this._axisModel,this._axisPointerModel);this._payloadInfo=i,n.stopAnimation(),n.attr(hT(i)),Eu(n).lastProp=null,this._doDispatchAxisPointer()}},e.prototype._doDispatchAxisPointer=function(){var t=this._handle;if(t){var r=this._payloadInfo,n=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:r.cursorPoint[0],y:r.cursorPoint[1],tooltipOption:r.tooltipOption,axesInfo:[{axisDim:n.axis.dim,axisIndex:n.componentIndex}]})}},e.prototype._onHandleDragEnd=function(){this._dragging=!1;var t=this._handle;if(t){var r=this._axisPointerModel.get("value");this._moveHandleToValue(r),this._api.dispatchAction({type:"hideTip"})}},e.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var r=t.getZr(),n=this._group,i=this._handle;r&&n&&(this._lastGraphicKey=null,n&&r.remove(n),i&&r.remove(i),this._group=null,this._handle=null,this._payloadInfo=null),dg(this,"_doDispatchAxisPointer")},e.prototype.doClear=function(){},e.prototype.buildLabel=function(t,r,n){return n=n||0,{x:t[n],y:t[1-n],width:r[n],height:r[1-n]}},e}();function nz(e,t,r,n){O9(Eu(r).lastProp,n)||(Eu(r).lastProp=n,t?lt(r,n,e):(r.stopAnimation(),r.attr(n)))}function O9(e,t){if(Ie(e)&&Ie(t)){var r=!0;return E(t,function(n,i){r=r&&O9(e[i],n)}),!!r}else return e===t}function iz(e,t){e[t.get(["label","show"])?"show":"hide"]()}function hT(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function az(e,t,r){var n=t.get("z"),i=t.get("zlevel");e&&e.traverse(function(a){a.type!=="group"&&(n!=null&&(a.z=n),i!=null&&(a.zlevel=i),a.silent=r)})}function jN(e){var t=e.get("type"),r=e.getModel(t+"Style"),n;return t==="line"?(n=r.getLineStyle(),n.fill=null):t==="shadow"&&(n=r.getAreaStyle(),n.stroke=null),n}function z9(e,t,r,n,i){var a=r.get("value"),o=B9(a,t.axis,t.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=_d(s.get("padding")||0),u=s.getFont(),c=nb(o,u),h=i.position,f=c.width+l[1]+l[3],d=c.height+l[0]+l[2],g=i.align;g==="right"&&(h[0]-=f),g==="center"&&(h[0]-=f/2);var m=i.verticalAlign;m==="bottom"&&(h[1]-=d),m==="middle"&&(h[1]-=d/2),Qme(h,f,d,n);var y=s.get("backgroundColor");(!y||y==="auto")&&(y=t.get(["axisLine","lineStyle","color"])),e.label={x:h[0],y:h[1],style:Lt(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:y}),z2:10}}function Qme(e,t,r,n){var i=n.getWidth(),a=n.getHeight();e[0]=Math.min(e[0]+t,i)-t,e[1]=Math.min(e[1]+r,a)-r,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function B9(e,t,r,n,i){e=t.scale.parse(e);var a=t.scale.getLabel({value:e},{precision:i.precision}),o=i.formatter;if(o){var s={value:jx(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};E(n,function(l){var u=r.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,h=u&&u.getDataParams(c);h&&s.seriesData.push(h)}),ue(o)?a=o.replace("{value}",a):Ce(o)&&(a=o(s))}return a}function ON(e,t,r){var n=Ft();return _s(n,n,r.rotation),_a(n,n,r.position),pa([e.dataToCoord(t),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],n)}function F9(e,t,r,n,i,a){var o=Nn.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=i.get(["label","margin"]),z9(t,n,i,a,{position:ON(n.axis,e,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function zN(e,t,r){return r=r||0,{x1:e[r],y1:e[1-r],x2:t[r],y2:t[1-r]}}function V9(e,t,r){return r=r||0,{x:e[r],y:e[1-r],width:t[r],height:t[1-r]}}function oz(e,t,r,n,i,a){return{cx:e,cy:t,r0:r,r:n,startAngle:i,endAngle:a,clockwise:!0}}function BN(e,t,r){return ln(e,{fromStat:{sers:ae(t,function(n){return r.getSeriesByIndex(n.seriesIndex)})},min:1}).w}function FN(e,t,r){return[$e(bt(t[0],t[1]),e-r/2),bt(e+r/2,$e(t[0],t[1]))]}var eye=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,i,a,o){var s=i.axis,l=s.grid,u=a.get("type"),c=s.getGlobalExtent(),h=sz(l,s).getOtherAxis(s).getGlobalExtent(),f=s.toGlobalCoord(s.dataToCoord(n,!0));if(u&&u!=="none"){var d=jN(a),g=tye[u](s,f,c,h,a.get("seriesDataIndices"),a.ecModel);g.style=d,r.graphicKey=g.type,r.pointer=g}var m=Wx(l.getRect(),i);F9(n,r,m,i,a,o)},t.prototype.getHandleTransform=function(r,n,i){var a=Wx(n.axis.grid.getRect(),n,{labelInside:!1});a.labelMargin=i.get(["handle","margin"]);var o=ON(n.axis,r,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,i,a){var o=i.axis,s=o.grid,l=o.getGlobalExtent(!0),u=sz(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,h=[r.x,r.y];h[c]+=n[c],h[c]=bt(l[1],h[c]),h[c]=$e(l[0],h[c]);var f=(u[1]+u[0])/2,d=[f,f];d[c]=h[c];var g=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:r.rotation,cursorPoint:d,tooltipOption:g[c]}},t}(RN);function sz(e,t){var r={};return r[t.dim+"AxisIndex"]=t.index,e.getCartesian(r)}var tye={line:function(e,t,r,n){var i=zN([t,n[0]],[t,n[1]],lz(e));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(e,t,r,n,i,a){var o=BN(e,i,a),s=n[1]-n[0],l=FN(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:V9([u,n[0]],[c-u,s],lz(e))}}};function lz(e){return e.dim==="x"?0:1}var rye=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="axisPointer",t.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,triggerEmphasis:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:K.color.border,width:1,type:"dashed"},shadowStyle:{color:K.color.shadowTint},label:{show:!0,formatter:null,precision:"auto",margin:3,color:K.color.neutral00,padding:[5,7,5,7],backgroundColor:K.color.accent60,borderColor:null,borderWidth:0,borderRadius:3},handle:{show:!1,icon:"M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z",size:45,margin:50,color:K.color.accent40,throttle:40}},t}(qe),Zo=Ue(),nye=E;function G9(e,t,r){if(!rt.node){var n=t.getZr();Zo(n).records||(Zo(n).records={}),iye(n,t);var i=Zo(n).records[e]||(Zo(n).records[e]={});i.handler=r}}function iye(e,t){if(Zo(e).initialized)return;Zo(e).initialized=!0,r("click",Ze(fT,"click")),r("mousemove",Ze(fT,"mousemove")),r("mousewheel",Ze(fT,"mousewheel")),r("globalout",oye);function r(n,i){e.on(n,function(a){var o=sye(t);nye(Zo(e).records,function(s){s&&i(s,a,o.dispatchAction)}),aye(o.pendings,t)})}}function aye(e,t){var r=e.showTip.length,n=e.hideTip.length,i;r?i=e.showTip[r-1]:n&&(i=e.hideTip[n-1]),i&&(i.dispatchAction=null,t.dispatchAction(i))}function oye(e,t,r){e.handler("leave",null,r)}function fT(e,t,r,n){t.handler(e,r,n)}function sye(e){var t={showTip:[],hideTip:[]},r=function(n){var i=t[n.type];i?i.push(n):(n.dispatchAction=r,e.dispatchAction(n))};return{dispatchAction:r,pendings:t}}function LA(e,t){if(!rt.node){var r=t.getZr(),n=(Zo(r).records||{})[e];n&&(Zo(r).records[e]=null)}}var lye=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=n.getComponent("tooltip"),o=r.get("triggerOn")||a&&a.get("triggerOn")||"mousemove|click|mousewheel";G9("axisPointer",i,function(s,l,u){o!=="none"&&(s==="leave"||o.indexOf(s)>=0)&&u({type:"updateAxisPointer",currTrigger:s,x:l&&l.offsetX,y:l&&l.offsetY})})},t.prototype.remove=function(r,n){LA("axisPointer",n)},t.prototype.dispose=function(r,n){LA("axisPointer",n)},t.type="axisPointer",t}(Nt);function H9(e,t){var r=[],n=e.seriesIndex,i;if(n==null||!(i=t.getSeriesByIndex(n)))return{point:[]};var a=i.getData(),o=vc(a,e);if(o==null||o<0||ne(o))return{point:[]};var s=a.getItemGraphicEl(o),l=i.coordinateSystem;if(i.getTooltipPosition)r=i.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(e.isStacked){var u=l.getBaseAxis(),c=l.getOtherAxis(u),h=c.dim,f=u.dim,d=h==="x"||h==="radius"?1:0,g=a.mapDimension(f),m=[];m[d]=a.get(g,o),m[1-d]=a.get(a.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(m)||[]}else r=l.dataToPoint(a.getValues(ae(l.dimensions,function(_){return a.mapDimension(_)}),o))||[];else if(s){var y=s.getBoundingRect().clone();y.applyTransform(s.transform),r=[y.x+y.width/2,y.y+y.height/2]}return{point:r,el:s}}var uz=Ue();function uye(e,t,r){var n=e.currTrigger,i=[e.x,e.y],a=e,o=e.dispatchAction||de(r.dispatchAction,r),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){b_(i)&&(i=H9({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},t).point);var l=b_(i),u=a.axesInfo,c=s.axesInfo,h=n==="leave"||b_(i),f={},d={},g={list:[],map:{}},m={showPointer:Ze(hye,d),showTooltip:Ze(fye,g)};E(s.coordSysMap,function(_,x){var w=l||_.containPoint(i);E(s.coordSysAxesInfo[x],function(S,T){var M=S.axis,A=gye(u,S);if(!h&&w&&(!u||A)){var N=A&&A.value;N==null&&!l&&(N=M.pointToData(i)),N!=null&&cz(S,N,m,!1,f)}})});var y={};return E(c,function(_,x){var w=_.linkGroup;w&&!d[x]&&E(w.axesInfo,function(S,T){var M=d[T];if(S!==_&&M){var A=M.value;w.mapper&&(A=_.axis.scale.parse(w.mapper(A,hz(S),hz(_)))),y[_.key]=A}})}),E(y,function(_,x){cz(c[x],_,m,!0,f)}),dye(d,c,f),vye(g,i,e,o),pye(c,o,r),f}}function cz(e,t,r,n,i){var a=e.axis;if(!(a.scale.isBlank()||!a.containData(t))){if(!e.involveSeries){r.showPointer(e,t);return}var o=cye(t,e),s=o.payloadBatch,l=o.snapToValue;s[0]&&i.seriesIndex==null&&ee(i,s[0]),!n&&e.snap&&a.containData(l)&&l!=null&&(t=l),r.showPointer(e,t,s),r.showTooltip(e,o,l)}}function cye(e,t){var r=t.axis,n=r.dim,i=e,a=[],o=Number.MAX_VALUE,s=-1;return E(t.seriesModels,function(l,u){var c=l.getData().mapDimensionsAll(n),h,f;if(l.getAxisTooltipData){var d=l.getAxisTooltipData(c,e,r);f=d.dataIndices,h=d.nestestValue}else{if(f=l.indicesOfNearest(n,c[0],e,r.type==="category"?.5:null),!f.length)return;h=l.getData().get(c[0],f[0])}if(Wi(h)){var g=e-h,m=Math.abs(g);m<=o&&((m=0&&s<0)&&(o=m,s=g,i=h,a.length=0),E(f,function(y){a.push({seriesIndex:l.seriesIndex,dataIndexInside:y,dataIndex:l.getData().getRawIndex(y)})}))}}),{payloadBatch:a,snapToValue:i}}function hye(e,t,r,n){e[t.key]={value:r,payloadBatch:n}}function fye(e,t,r,n){var i=r.payloadBatch,a=t.axis,o=a.model,s=t.axisPointerModel;if(!(!t.triggerTooltip||!i.length)){var l=t.coordSys.model,u=Ag(l),c=e.map[u];c||(c=e.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},e.list.push(c)),c.dataByAxis.push({axisDim:a.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:i.slice()})}}function dye(e,t,r){var n=r.axesInfo=[];E(t,function(i,a){var o=i.axisPointerModel.option,s=e[a];s?(!i.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!i.useHandle&&(o.status="hide"),o.status==="show"&&n.push({axisDim:i.axis.dim,axisIndex:i.axis.model.componentIndex,value:o.value})})}function vye(e,t,r,n){if(b_(t)||!e.list.length){n({type:"hideTip"});return}var i=((e.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:t[0],y:t[1],tooltipOption:r.tooltipOption,position:r.position,dataIndexInside:i.dataIndexInside,dataIndex:i.dataIndex,seriesIndex:i.seriesIndex,dataByCoordSys:e.list})}function pye(e,t,r){var n=r.getZr(),i="axisPointerLastHighlights",a=uz(n)[i]||{},o=uz(n)[i]={};E(e,function(c,h){var f=c.axisPointerModel.option;f.status==="show"&&c.triggerEmphasis&&E(f.seriesDataIndices,function(d){o[d.seriesIndex+"|"+d.dataIndex]=d})});var s=[],l=[];function u(c){return{seriesIndex:c.seriesIndex,dataIndex:c.dataIndex}}E(a,function(c,h){!o[h]&&l.push(u(c))}),E(o,function(c,h){!a[h]&&s.push(u(c))}),l.length&&r.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&r.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}function gye(e,t){for(var r=0;r<(e||[]).length;r++){var n=e[r];if(t.axis.dim===n.axisDim&&t.axis.model.componentIndex===n.axisIndex)return n}}function hz(e){var t=e.axis.model,r={},n=r.axisDim=e.axis.dim;return r.axisIndex=r[n+"AxisIndex"]=t.componentIndex,r.axisName=r[n+"AxisName"]=t.name,r.axisId=r[n+"AxisId"]=t.id,r}function b_(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function mm(e){Kc.registerAxisPointerClass("CartesianAxisPointer",eye),e.registerComponentModel(rye),e.registerComponentView(lye),e.registerPreprocessor(function(t){if(t){(!t.axisPointer||t.axisPointer.length===0)&&(t.axisPointer={});var r=t.axisPointer.link;r&&!ne(r)&&(t.axisPointer.link=[r])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(t,r){t.getComponent("axisPointer").coordSysAxesInfo=zce(t,r)}}),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},uye)}function mye(e){We(t7),We(mm)}var yye=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,i,a,o){var s=i.axis;s.dim==="angle"&&(this.animationThreshold=Math.PI/18);var l=s.polar,u=s.getExtent(),c=l.getOtherAxis(s).getExtent(),h=s.dataToCoord(n),f=a.get("type");if(f&&f!=="none"){var d=jN(a),g=xye[f](s,l,h,u,c,a.get("seriesDataIndices"),a.ecModel);g.style=d,r.graphicKey=g.type,r.pointer=g}var m=a.get(["label","margin"]),y=_ye(n,i,a,l,m);z9(r,i,a,o,y)},t}(RN);function _ye(e,t,r,n,i){var a=t.axis,o=a.dataToCoord(e),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=n.getRadiusAxis().getExtent(),u,c,h;if(a.dim==="radius"){var f=Ft();_s(f,f,s),_a(f,f,[n.cx,n.cy]),u=pa([o,-i],f);var d=t.getModel("axisLabel").get("rotate")||0,g=Nn.innerTextLayout(s,d*Math.PI/180,-1);c=g.textAlign,h=g.textVerticalAlign}else{var m=l[1];u=n.coordToPoint([m+i,o]);var y=n.cx,_=n.cy;c=Math.abs(u[0]-y)/m<.3?"center":u[0]>y?"left":"right",h=Math.abs(u[1]-_)/m<.3?"middle":u[1]>_?"top":"bottom"}return{position:u,align:c,verticalAlign:h}}var xye={line:function(e,t,r,n,i){return e.dim==="angle"?{type:"Line",shape:zN(t.coordToPoint([i[0],r]),t.coordToPoint([i[1],r]))}:{type:"Circle",shape:{cx:t.cx,cy:t.cy,r}}},shadow:function(e,t,r,n,i,a,o){var s=Math.PI/180,l=BN(e,a,o),u;if(e.dim==="angle")u=oz(t.cx,t.cy,i[0],i[1],(-r-l/2)*s,(-r+l/2)*s);else{var c=FN(r,n,l),h=c[0],f=c[1];u=oz(t.cx,t.cy,h,f,0,Math.PI*2)}return{type:"Sector",shape:u}}},ro="polar",fz=ro,bye=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.findAxisModel=function(r){var n,i=this.ecModel;return i.eachComponent(r,function(a){a.getCoordSysModel()===this&&(n=a)},this),n},t.type=ro,t.dependencies=["radiusAxis","angleAxis"],t.defaultOption={z:0,center:["50%","50%"],radius:"80%"},t}(qe),VN=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Qt).models[0]},t.type="polarAxis",t}(qe);vr(VN,Ad);var wye=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="angleAxis",t}(VN),Sye=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="radiusAxis",t}(VN),GN=function(e){q(t,e);function t(r,n){return e.call(this,"radius",r,n)||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t}(Ki);GN.prototype.dataToRadius=Ki.prototype.dataToCoord;GN.prototype.radiusToData=Ki.prototype.coordToData;var Cye=Ue(),HN=function(e){q(t,e);function t(r,n){return e.call(this,"angle",r,n||[0,360])||this}return t.prototype.pointToData=function(r,n){return this.polar.pointToData(r,n)[this.dim==="radius"?0:1]},t.prototype.calculateCategoryInterval=function(){var r=this,n=r.getLabelModel(),i=r.scale,a=i.getExtent(),o=i.count();if(a[1]-a[0]<1)return 0;var s=a[0],l=r.dataToCoord(s+1)-r.dataToCoord(s),u=Math.abs(l),c=nb(s==null?"":s+"",n.getFont(),"center","top"),h=Math.max(c.height,7),f=h/u;isNaN(f)&&(f=1/0);var d=Math.max(0,Math.floor(f)),g=Cye(r.model),m=g.lastAutoInterval,y=g.lastTickCount;return m!=null&&y!=null&&Math.abs(m-d)<=1&&Math.abs(y-o)<=1&&m>d?d=m:(g.lastTickCount=o,g.lastAutoInterval=d),d},t}(Ki);HN.prototype.dataToAngle=Ki.prototype.dataToCoord;HN.prototype.angleToData=Ki.prototype.coordToData;var U9=["radius","angle"],Tye=function(){function e(t){this.dimensions=U9,this.type=ro,this.cx=0,this.cy=0,this._radiusAxis=new GN,this._angleAxis=new HN,this.axisPointerEnabled=!0,this.name=t||"",this._radiusAxis.polar=this._angleAxis.polar=this}return e.prototype.containPoint=function(t){var r=this.pointToCoord(t);return this._radiusAxis.contain(r[0])&&this._angleAxis.contain(r[1])},e.prototype.containData=function(t){return this._radiusAxis.containData(t[0])&&this._angleAxis.containData(t[1])},e.prototype.getAxis=function(t){var r="_"+t+"Axis";return this[r]},e.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},e.prototype.getAxesByScale=function(t){var r=[],n=this._angleAxis,i=this._radiusAxis;return n.scale.type===t&&r.push(n),i.scale.type===t&&r.push(i),r},e.prototype.getAngleAxis=function(){return this._angleAxis},e.prototype.getRadiusAxis=function(){return this._radiusAxis},e.prototype.getOtherAxis=function(t){var r=this._angleAxis;return t===r?this._radiusAxis:r},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},e.prototype.getTooltipAxes=function(t){var r=t!=null&&t!=="auto"?this.getAxis(t):this.getBaseAxis();return{baseAxes:[r],otherAxes:[this.getOtherAxis(r)]}},e.prototype.dataToPoint=function(t,r,n){return this.coordToPoint([this._radiusAxis.dataToRadius(t[0],r),this._angleAxis.dataToAngle(t[1],r)],n)},e.prototype.pointToData=function(t,r,n){n=n||[];var i=this.pointToCoord(t);return n[0]=this._radiusAxis.radiusToData(i[0],r),n[1]=this._angleAxis.angleToData(i[1],r),n},e.prototype.pointToCoord=function(t){var r=t[0]-this.cx,n=t[1]-this.cy,i=this.getAngleAxis(),a=i.getExtent(),o=Math.min(a[0],a[1]),s=Math.max(a[0],a[1]);i.inverse?o=s-360:s=o+360;var l=Math.sqrt(r*r+n*n);r/=l,n/=l;for(var u=Math.atan2(-n,r)/Math.PI*180,c=us;)u+=c*360;return[l,u]},e.prototype.coordToPoint=function(t,r){r=r||[];var n=t[0],i=t[1]/180*Math.PI;return r[0]=Math.cos(i)*n+this.cx,r[1]=-Math.sin(i)*n+this.cy,r},e.prototype.getArea=function(){var t=this.getAngleAxis(),r=this.getRadiusAxis(),n=r.getExtent().slice();n[0]>n[1]&&n.reverse();var i=t.getExtent(),a=Math.PI/180,o=1e-4;return{cx:this.cx,cy:this.cy,r0:n[0],r:n[1],startAngle:-i[0]*a,endAngle:-i[1]*a,clockwise:t.inverse,contain:function(s,l){var u=s-this.cx,c=l-this.cy,h=u*u+c*c,f=this.r,d=this.r0;return f!==d&&h-o<=f*f&&h+o>=d*d},x:this.cx-n[1],y:this.cy-n[1],width:n[1]*2,height:n[1]*2}},e.prototype.convertToPixel=function(t,r,n){var i=dz(r);return i===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var i=dz(r);return i===this?this.pointToData(n):null},e}();function dz(e){var t=e.seriesModel,r=e.polarModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function Mye(e,t,r){var n=t.get("center"),i=Lr(t,r).refContainer;e.cx=he(n[0],i.width)+i.x,e.cy=he(n[1],i.height)+i.y;var a=e.getRadiusAxis(),o=Math.min(i.width,i.height)/2,s=t.get("radius");s==null?s=[0,"100%"]:ne(s)||(s=[0,s]);var l=[he(s[0],o),he(s[1],o)];a.inverse?a.setExtent(l[1],l[0]):a.setExtent(l[0],l[1])}function Aye(e,t){var r=this,n=r.getAngleAxis(),i=r.getRadiusAxis();if(Cc(n,Uf),Cc(i,Uf),Wf(n),Wf(i),n.type==="category"&&!n.onBand){var a=n.getExtent(),o=360/n.scale.count();n.inverse?a[1]+=o:a[1]-=o,n.setExtent(a[0],a[1])}}function kye(e){return e.mainType==="angleAxis"}function vz(e,t){var r;if(e.type=um(t),e.scale=Td(t,e.type,!1),e.onBand=hm(e.scale,t),e.inverse=t.get("inverse"),kye(t)){e.inverse=e.inverse!==t.get("clockwise");var n=t.get("startAngle"),i=(r=t.get("endAngle"))!==null&&r!==void 0?r:n+(e.inverse?-360:360);e.setExtent(n,i)}t.axis=e,e.model=t}var Lye={dimensions:U9,create:function(e,t){var r=[];return e.eachComponent(fz,function(n,i){var a=new Tye(i+"");a.update=Aye;var o=a.getRadiusAxis(),s=a.getAngleAxis(),l=n.findAxisModel("radiusAxis"),u=n.findAxisModel("angleAxis");vz(o,l),vz(s,u),Mye(a,n,t),r.push(a),n.coordinateSystem=a,a.model=n}),e.eachSeries(function(n){if(n.get("coordinateSystem")===ro){var i=n.getReferringComponents(fz,Qt).models[0],a=n.coordinateSystem=i.coordinateSystem;a&&(Sc(a.getRadiusAxis(),n,ro),Sc(a.getAngleAxis(),n,ro))}}),r}},Iye=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function w0(e,t,r){t[1]>t[0]&&(t=t.slice().reverse());var n=e.coordToPoint([t[0],r]),i=e.coordToPoint([t[1],r]);return{x1:n[0],y1:n[1],x2:i[0],y2:i[1]}}function S0(e){var t=e.getRadiusAxis();return t.inverse?0:1}function pz(e){var t=e[0],r=e[e.length-1];t&&r&&Math.abs(Math.abs(t.coord-r.coord)-360)<1e-4&&e.pop()}var Nye=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.axisPointerClass="PolarAxisPointer",r}return t.prototype.render=function(r,n){if(this.group.removeAll(),!!r.get("show")){var i=r.axis,a=i.polar,o=a.getRadiusAxis().getExtent(),s=i.getTicksCoords({breakTicks:"none"}),l=i.getMinorTicksCoords(),u=[];E(i.getViewLabels(),function(c){if(!c.tick.offInterval){c=Se(c);var h=i.scale;c.coord=i.dataToCoord(Md(h,c.tick)),u.push(c)}}),pz(u),pz(s),E(Iye,function(c){r.get([c,"show"])&&(!i.scale.isBlank()||c==="axisLine")&&Pye[c](this.group,r,a,s,l,o,u)},this)}},t.type="angleAxis",t}(Kc),Pye={axisLine:function(e,t,r,n,i,a){var o=t.getModel(["axisLine","lineStyle"]),s=r.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),c=S0(r),h=c?0:1,f,d=Math.abs(u[1]-u[0])===360?"Circle":"Arc";a[h]===0?f=new Wc[d]({shape:{cx:r.cx,cy:r.cy,r:a[c],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):f=new dd({shape:{cx:r.cx,cy:r.cy,r:a[c],r0:a[h]},style:o.getLineStyle(),z2:1,silent:!0}),f.style.fill=null,e.add(f)},axisTick:function(e,t,r,n,i,a){var o=t.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=a[S0(r)],u=ae(n,function(c){return new cr({shape:w0(r,[l,l+s],c.coord)})});e.add(ii(u,{style:ke(o.getModel("lineStyle").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})}))},minorTick:function(e,t,r,n,i,a){if(i.length){for(var o=t.getModel("axisTick"),s=t.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=a[S0(r)],c=[],h=0;h_?"left":"right",S=Math.abs(y[1]-x)/m<.3?"middle":y[1]>x?"top":"bottom";if(s&&s[g]){var T=s[g];Ie(T)&&T.textStyle&&(d=new Je(T.textStyle,l,l.ecModel))}var M=new it({silent:Nn.isLabelSilent(t),style:Lt(d,{x:y[0],y:y[1],fill:d.getTextColor()||t.get(["axisLine","lineStyle","color"]),text:h.formattedLabel,align:w,verticalAlign:S})});if(e.add(M),bs({el:M,componentModel:t,itemName:h.formattedLabel,formatterParamsExtra:{isTruncated:function(){return M.isTruncated},value:h.rawLabel,tickIndex:f}}),c){var A=Nn.makeAxisEventDataBase(t);A.targetType="axisLabel",A.value=h.rawLabel,Re(M).eventData=A}},this)},splitLine:function(e,t,r,n,i,a){var o=t.getModel("splitLine"),s=o.getModel("lineStyle"),l=s.get("color"),u=0;l=l instanceof Array?l:[l];for(var c=[],h=0;h=0?"p":"n",P=w;_&&(n[a][A]||(n[a][A]={p:w,n:w}),P=n[a][A][N]);var I=void 0,D=void 0,O=void 0,j=void 0;if(c.dim==="radius"){var B=c.dataToCoord(M)-w,U=e.dataToCoord(A);Xt(B)=j})}}function Vye(e,t){var r=qc(t,ro),n=ln(e,{fromStat:{key:r},min:1}).w,i=n,a=0,o="20%",s="30%",l={};wc(e,r,function(y){var _=W9(y);l[_]||a++,l[_]=l[_]||{width:0,maxWidth:0};var x=he(y.get("barWidth"),n),w=he(y.get("barMaxWidth"),n),S=y.get("barGap"),T=y.get("barCategoryGap");x&&!l[_].width&&(x=bt(i,x),l[_].width=x,i-=x),w&&(l[_].maxWidth=w),S!=null&&(s=S),T!=null&&(o=T)});var u={},c=he(o,n),h=he(s,1),f=(i-c)/(a+(a-1)*h);f=$e(f,0),E(l,function(y,_){var x=y.maxWidth;x&&x=r.y&&t[1]<=r.y+r.height:n.contain(n.toLocalCoord(t[1]))&&t[0]>=r.y&&t[0]<=r.y+r.height},e.prototype.pointToData=function(t,r,n){n=n||[];var i=this.getAxis();return n[0]=i.coordToData(i.toLocalCoord(t[i.orient==="horizontal"?0:1])),n},e.prototype.dataToPoint=function(t,r,n){var i=this.getAxis(),a=this.getRect();n=n||[];var o=i.orient==="horizontal"?0:1;return t instanceof Array&&(t=t[0]),n[o]=i.toGlobalCoord(i.dataToCoord(+t)),n[1-o]=o===0?a.y+a.height/2:a.x+a.width/2,n},e.prototype.convertToPixel=function(t,r,n){var i=gz(r);return i===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var i=gz(r);return i===this?this.pointToData(n):null},e}();function gz(e){var t=e.seriesModel,r=e.singleAxisModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function Jye(e,t){var r=[];return e.eachComponent(cA,function(n,i){var a=new Kye(n,e,t);a.name="single_"+i,a.resize(n,t),n.coordinateSystem=a,r.push(a)}),e.eachSeries(function(n){if(n.get("coordinateSystem")===Xce){var i=n.getReferringComponents(cA,Qt).models[0],a=n.coordinateSystem=i&&i.coordinateSystem;a&&Sc(a.getAxis(),n,jb)}}),r}var Qye={create:Jye,dimensions:Z9},mz=["x","y"],e0e=["width","height"],t0e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,i,a,o){var s=i.axis,l=s.coordinateSystem,u=u1(s),c=C0(l,u),h=C0(l,1-u),f=l.dataToPoint(n)[0],d=a.get("type");if(d&&d!=="none"){var g=jN(a),m=r0e[d](s,f,c,h,a.get("seriesDataIndices"),a.ecModel);m.style=g,r.graphicKey=m.type,r.pointer=m}var y=IA(i);F9(n,r,y,i,a,o)},t.prototype.getHandleTransform=function(r,n,i){var a=IA(n,{labelInside:!1});a.labelMargin=i.get(["handle","margin"]);var o=ON(n.axis,r,a);return{x:o[0],y:o[1],rotation:a.rotation+(a.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,i,a){var o=i.axis,s=o.coordinateSystem,l=u1(o),u=C0(s,l),c=[r.x,r.y];c[l]+=n[l],c[l]=Math.min(u[1],c[l]),c[l]=Math.max(u[0],c[l]);var h=C0(s,1-l),f=(h[1]+h[0])/2,d=[f,f];return d[l]=c[l],{x:c[0],y:c[1],rotation:r.rotation,cursorPoint:d,tooltipOption:{verticalAlign:"middle"}}},t}(RN),r0e={line:function(e,t,r,n){var i=zN([t,n[0]],[t,n[1]],u1(e));return{type:"Line",subPixelOptimize:!0,shape:i}},shadow:function(e,t,r,n,i,a){var o=BN(e,i,a),s=n[1]-n[0],l=FN(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:V9([u,n[0]],[c-u,s],u1(e))}}};function u1(e){return e.isHorizontal()?0:1}function C0(e,t){var r=e.getRect();return[r[mz[t]],r[mz[t]]+r[e0e[t]]]}var n0e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="single",t}(Nt);function i0e(e){We(mm),Kc.registerAxisPointerClass("SingleAxisPointer",t0e),e.registerComponentView(n0e),e.registerComponentView(Yye),e.registerComponentModel(y_),$f(e,"single",y_,y_.defaultOption),e.registerCoordinateSystem("single",Qye)}var a0e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n,i){var a=$c(r);e.prototype.init.apply(this,arguments),yz(r,a)},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),yz(this.option,r)},t.prototype.getCellSize=function(){return this.option.cellSize},t.type="calendar",t.layoutMode="box",t.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:K.color.axisLine,width:1,type:"solid"}},itemStyle:{color:K.color.neutral00,borderWidth:1,borderColor:K.color.neutral10},dayLabel:{show:!0,firstDay:0,position:"start",margin:K.size.s,color:K.color.secondary},monthLabel:{show:!0,position:"start",margin:K.size.s,align:"center",formatter:null,color:K.color.secondary},yearLabel:{show:!0,position:null,margin:K.size.xl,formatter:null,color:K.color.quaternary,fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},t}(qe);function yz(e,t){var r=e.cellSize,n;ne(r)?n=r:n=e.cellSize=[r,r],n.length===1&&(n[1]=n[0]);var i=ae([0,1],function(a){return one(t,a)&&(n[a]="auto"),n[a]!=null&&n[a]!=="auto"});vo(e,t,{type:"box",ignoreSize:i})}var o0e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){var a=this.group;a.removeAll();var o=r.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=n.getLocaleModel();this._renderDayRect(r,s,a),this._renderLines(r,s,l,a),this._renderYearText(r,s,l,a),this._renderMonthText(r,u,l,a),this._renderWeekText(r,u,s,l,a)},t.prototype._renderDayRect=function(r,n,i){for(var a=r.coordinateSystem,o=r.getModel("itemStyle").getItemStyle(),s=a.getCellWidth(),l=a.getCellHeight(),u=n.start.time;u<=n.end.time;u=a.getNextNDay(u,1).time){var c=a.dataToCalendarLayout([u],!1).tl,h=new Ye({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});i.add(h)}},t.prototype._renderLines=function(r,n,i,a){var o=this,s=r.coordinateSystem,l=r.getModel(["splitLine","lineStyle"]).getLineStyle(),u=r.get(["splitLine","show"]),c=l.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var h=n.start,f=0;h.time<=n.end.time;f++){g(h.formatedDate),f===0&&(h=s.getDateInfo(n.start.y+"-"+n.start.m));var d=h.date;d.setMonth(d.getMonth()+1),h=s.getDateInfo(d)}g(s.getNextNDay(n.end.time,1).formatedDate);function g(m){o._firstDayOfMonth.push(s.getDateInfo(m)),o._firstDayPoints.push(s.dataToCalendarLayout([m],!1).tl);var y=o._getLinePointsOfOneWeek(r,m,i);o._tlpoints.push(y[0]),o._blpoints.push(y[y.length-1]),u&&o._drawSplitline(y,l,a)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,c,i),l,a),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,c,i),l,a)},t.prototype._getEdgesPoints=function(r,n,i){var a=[r[0].slice(),r[r.length-1].slice()],o=i==="horizontal"?0:1;return a[0][o]=a[0][o]-n/2,a[1][o]=a[1][o]+n/2,a},t.prototype._drawSplitline=function(r,n,i){var a=new $r({z2:20,shape:{points:r},style:n});i.add(a)},t.prototype._getLinePointsOfOneWeek=function(r,n,i){for(var a=r.coordinateSystem,o=a.getDateInfo(n),s=[],l=0;l<7;l++){var u=a.getNextNDay(o.time,l),c=a.dataToCalendarLayout([u.time],!1);s[2*u.day]=c.tl,s[2*u.day+1]=c[i==="horizontal"?"bl":"tr"]}return s},t.prototype._formatterLabel=function(r,n){return ue(r)&&r?AH(r,n):Ce(r)?r(n):n.nameMap},t.prototype._yearTextPositionControl=function(r,n,i,a,o){var s=n[0],l=n[1],u=["center","bottom"];a==="bottom"?(l+=o,u=["center","top"]):a==="left"?s-=o:a==="right"?(s+=o,u=["center","top"]):l-=o;var c=0;return(a==="left"||a==="right")&&(c=Math.PI/2),{rotation:c,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},t.prototype._renderYearText=function(r,n,i,a){var o=r.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=i!=="horizontal"?"top":"left");var u=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],c=(u[0][0]+u[1][0])/2,h=(u[0][1]+u[1][1])/2,f=i==="horizontal"?0:1,d={top:[c,u[f][1]],bottom:[c,u[1-f][1]],left:[u[1-f][0],h],right:[u[f][0],h]},g=n.start.y;+n.end.y>+n.start.y&&(g=g+"-"+n.end.y);var m=o.get("formatter"),y={start:n.start.y,end:n.end.y,nameMap:g},_=this._formatterLabel(m,y),x=new it({z2:30,style:Lt(o,{text:_}),silent:o.get("silent")});x.attr(this._yearTextPositionControl(x,d[l],i,l,s)),a.add(x)}},t.prototype._monthTextPositionControl=function(r,n,i,a,o){var s="left",l="top",u=r[0],c=r[1];return i==="horizontal"?(c=c+o,n&&(s="center"),a==="start"&&(l="bottom")):(u=u+o,n&&(l="middle"),a==="start"&&(s="right")),{x:u,y:c,align:s,verticalAlign:l}},t.prototype._renderMonthText=function(r,n,i,a){var o=r.getModel("monthLabel");if(o.get("show")){var s=o.get("nameMap"),l=o.get("margin"),u=o.get("position"),c=o.get("align"),h=[this._tlpoints,this._blpoints];(!s||ue(s))&&(s&&(n=CM(s)||n),s=n.get(["time","monthAbbr"])||[]);var f=u==="start"?0:1,d=i==="horizontal"?0:1;l=u==="start"?-l:l;for(var g=c==="center",m=o.get("silent"),y=0;y=a.start.time&&i.times.end.time&&r.reverse(),r},e.prototype._getRangeInfo=function(t){var r=[this.getDateInfo(t[0]),this.getDateInfo(t[1])],n;r[0].time>r[1].time&&(n=!0,r.reverse());var i=Math.floor(r[1].time/dT)-Math.floor(r[0].time/dT)+1,a=new Date(r[0].time),o=a.getDate(),s=r[1].date.getDate();a.setDate(o+i-1);var l=a.getDate();if(l!==s)for(var u=a.getTime()-r[1].time>0?1:-1;(l=a.getDate())!==s&&(a.getTime()-r[1].time)*u>0;)i-=u,a.setDate(l-u);var c=Math.floor((i+r[0].day+6)/7),h=n?-c+1:c-1;return n&&r.reverse(),{range:[r[0].formatedDate,r[1].formatedDate],start:r[0],end:r[1],allDay:i,weeks:c,nthWeek:h,fweek:r[0].day,lweek:r[1].day}},e.prototype._getDateByWeeksAndDay=function(t,r,n){var i=this._getRangeInfo(n);if(t>i.weeks||t===0&&ri.lweek)return null;var a=(t-1)*7-i.fweek+r,o=new Date(i.start.time);return o.setDate(+i.start.d+a),this.getDateInfo(o)},e.create=function(t,r){var n=[];return t.eachComponent("calendar",function(i){var a=new e(i,t,r);n.push(a),i.coordinateSystem=a}),t.eachComponent(function(i,a){om({targetModel:a,coordSysType:"calendar",coordSysProvider:EH})}),n},e.dimensions=["time","value"],e}();function vT(e){var t=e.calendarModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}function l0e(e){e.registerComponentModel(a0e),e.registerComponentView(o0e),e.registerCoordinateSystem("calendar",s0e)}var Fo={level:1,leaf:2,nonLeaf:3},ts={none:0,all:1,body:2,corner:3};function NA(e,t,r){var n=t[ze[r]].getCell(e);return!n&&at(e)&&e<0&&(n=t[ze[1-r]].getUnitLayoutInfo(r,Math.round(e))),n}function $9(e){var t=e||[];return t[0]=t[0]||[],t[1]=t[1]||[],t[0][0]=t[0][1]=t[1][0]=t[1][1]=NaN,t}function Y9(e,t,r,n,i){_z(e[0],t,i,r,n,0),_z(e[1],t,i,r,n,1)}function _z(e,t,r,n,i,a){e[0]=1/0,e[1]=-1/0;var o=n[a],s=ne(o)?o:[o],l=s.length,u=!!r;if(l>=1?(xz(e,t,s,u,i,a,0),l>1&&xz(e,t,s,u,i,a,l-1)):e[0]=e[1]=NaN,u){var c=-i[ze[1-a]].getLocatorCount(a),h=i[ze[a]].getLocatorCount(a)-1;r===ts.body?c=$e(0,c):r===ts.corner&&(h=bt(-1,h)),h=t[0]&&e[0]<=t[1]}function Sz(e,t){e.id.set(t[0][0],t[1][0]),e.span.set(t[0][1]-e.id.x+1,t[1][1]-e.id.y+1)}function h0e(e,t){e[0][0]=t[0][0],e[0][1]=t[0][1],e[1][0]=t[1][0],e[1][1]=t[1][1]}function Cz(e,t,r,n){var i=NA(t[n][0],r,n),a=NA(t[n][1],r,n);e[ze[n]]=e[ir[n]]=NaN,i&&a&&(e[ze[n]]=i.xy,e[ir[n]]=a.xy+a.wh-i.xy)}function Pv(e,t,r,n){return e[ze[t]]=r,e[ze[1-t]]=n,e}function f0e(e){return e&&(e.type===Fo.leaf||e.type===Fo.nonLeaf)?e:null}function c1(){return{x:NaN,y:NaN,width:NaN,height:NaN}}var Tz=function(){function e(t,r){this._cells=[],this._levels=[],this.dim=t,this.dimIdx=t==="x"?0:1,this._model=r,this._uniqueValueGen=d0e(t);var n=r.get("data",!0),i=r.get("length",!0);if(n!=null&&!ne(n)&&(n=[]),n)this._initByDimModelData(n);else if(i!=null){n=Array(i);for(var a=0;a=1,w=r[ze[n]],S=a.getLocatorCount(n)-1,T=new dl;for(o.resetLayoutIterator(T,n);T.next();)M(T.item);for(a.resetLayoutIterator(T,n);T.next();)M(T.item);function M(A){tn(A.wh)&&(A.wh=_),A.xy=w,A.id[ze[n]]===S&&!x&&(A.wh=r[ze[n]]+r[ir[n]]-A.xy),w+=A.wh}}function Pz(e,t){for(var r=t[ze[e]].resetCellIterator();r.next();){var n=r.item;h1(n.rect,e,n.id,n.span,t),h1(n.rect,1-e,n.id,n.span,t),n.type===Fo.nonLeaf&&(n.xy=n.rect[ze[e]],n.wh=n.rect[ir[e]])}}function Dz(e,t){e.travelExistingCells(function(r){var n=r.span;if(n){var i=r.spanRect,a=r.id;h1(i,0,a,n,t),h1(i,1,a,n,t)}})}function h1(e,t,r,n,i){e[ir[t]]=0;var a=r[ze[t]],o=a<0?i[ze[1-t]]:i[ze[t]],s=o.getUnitLayoutInfo(t,r[ze[t]]);if(e[ze[t]]=s.xy,e[ir[t]]=s.wh,n[ze[t]]>1){var l=o.getUnitLayoutInfo(t,r[ze[t]]+n[ze[t]]-1);e[ir[t]]=l.xy+l.wh-s.xy}}function M0e(e,t,r){var n=fx(e,r[ir[t]]);return DA(n,r[ir[t]])}function DA(e,t){return Math.max(Math.min(e,_e(t,1/0)),0)}function mT(e){var t=e.matrixModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}var Jr={inBody:1,inCorner:2,outside:3},Ea={x:null,y:null,point:[]};function Ez(e,t,r,n,i){var a=r[ze[t]],o=r[ze[1-t]],s=a.getUnitLayoutInfo(t,a.getLocatorCount(t)-1),l=a.getUnitLayoutInfo(t,0),u=o.getUnitLayoutInfo(t,-o.getLocatorCount(t)),c=o.shouldShow()?o.getUnitLayoutInfo(t,-1):null,h=e.point[t]=n[t];if(!l&&!c){e[ze[t]]=Jr.outside;return}if(i===ts.body){l?(e[ze[t]]=Jr.inBody,h=bt(s.xy+s.wh,$e(l.xy,h)),e.point[t]=h):e[ze[t]]=Jr.outside;return}else if(i===ts.corner){c?(e[ze[t]]=Jr.inCorner,h=bt(c.xy+c.wh,$e(u.xy,h)),e.point[t]=h):e[ze[t]]=Jr.outside;return}var f=l?l.xy:c?c.xy+c.wh:NaN,d=u?u.xy:f,g=s?s.xy+s.wh:f;if(hg){if(!i){e[ze[t]]=Jr.outside;return}h=g}e.point[t]=h,e[ze[t]]=f<=h&&h<=g?Jr.inBody:d<=h&&h<=f?Jr.inCorner:Jr.outside}function Rz(e,t,r,n){var i=1-r;if(e[ze[r]]!==Jr.outside)for(n[ze[r]].resetCellIterator(gT);gT.next();){var a=gT.item;if(Oz(e.point[r],a.rect,r)&&Oz(e.point[i],a.rect,i)){t[r]=a.ordinal,t[i]=a.id[ze[i]];return}}}function jz(e,t,r,n){if(e[ze[r]]!==Jr.outside){var i=e[ze[r]]===Jr.inCorner?n[ze[1-r]]:n[ze[r]];for(i.resetLayoutIterator(L0,r);L0.next();)if(A0e(e.point[r],L0.item)){t[r]=L0.item.id[ze[r]];return}}}function A0e(e,t){return t.xy<=e&&e<=t.xy+t.wh}function Oz(e,t,r){return t[ze[r]]<=e&&e<=t[ze[r]]+t[ir[r]]}function k0e(e){e.registerComponentModel(m0e),e.registerComponentView(w0e),e.registerCoordinateSystem("matrix",T0e)}function L0e(e,t){var r=e.existing;if(t.id=e.keyInfo.id,!t.type&&r&&(t.type=r.type),t.parentId==null){var n=t.parentOption;n?t.parentId=n.id:r&&(t.parentId=r.parentId)}t.parentOption=null}function zz(e,t){var r;return E(t,function(n){e[n]!=null&&e[n]!=="auto"&&(r=!0)}),r}function I0e(e,t,r){var n=ee({},r),i=e[t],a=r.$action||"merge";a==="merge"?i?(He(i,n,!0),vo(i,n,{ignoreSize:!0}),BH(r,i),I0(r,i),I0(r,i,"shape"),I0(r,i,"style"),I0(r,i,"extra"),r.clipPath=i.clipPath):e[t]=n:a==="replace"?e[t]=n:a==="remove"&&i&&(e[t]=null)}var q9=["transition","enterFrom","leaveTo"],N0e=q9.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function I0(e,t,r){if(r&&(!e[r]&&t[r]&&(e[r]={}),e=e[r],t=t[r]),!(!e||!t))for(var n=r?q9:N0e,i=0;i=0;c--){var h=i[c],f=Cr(h.id,null),d=f!=null?o.get(f):null;if(d){var g=d.parent,_=Li(g),x=g===a?{width:s,height:l}:{width:_.width,height:_.height},w={},S=bb(d,h,x,null,{hv:h.hv,boundingMode:h.bounding},w);if(!Li(d).isNew&&S){for(var T=h.transition,M={},A=0;A=0)?M[N]=P:d[N]=P}lt(d,M,r,0)}else d.attr(w)}}},t.prototype._clear=function(){var r=this,n=this._elMap;n.each(function(i){w_(i,Li(i).option,n,r._lastGraphicModel)}),this._elMap=pe()},t.prototype.dispose=function(){this._clear()},t.type="graphic",t}(Nt);function EA(e){var t=ge(Bz,e)?Bz[e]:ug(e),r=new t({});return Li(r).type=e,r}function Fz(e,t,r,n){var i=EA(r);return t.add(i),n.set(e,i),Li(i).id=e,Li(i).isNew=!0,i}function w_(e,t,r,n){var i=e&&e.parent;i&&(e.type==="group"&&e.traverse(function(a){w_(a,t,r,n)}),Wb(e,t,n),r.removeKey(Li(e).id))}function Vz(e,t,r,n){e.isGroup||E([["cursor",Zi.prototype.cursor],["zlevel",n||0],["z",r||0],["z2",0]],function(i){var a=i[0];ge(t,a)?e[a]=_e(t[a],i[1]):e[a]==null&&(e[a]=i[1])}),E(tt(t),function(i){if(i.indexOf("on")===0){var a=t[i];e[i]=Ce(a)?a:null}}),ge(t,"draggable")&&(e.draggable=t.draggable),t.name!=null&&(e.name=t.name),t.id!=null&&(e.id=t.id)}function R0e(e){return e=ee({},e),E(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(RH),function(t){delete e[t]}),e}function j0e(e,t,r){var n=Re(e).eventData;!e.silent&&!e.ignore&&!n&&(n=Re(e).eventData={componentType:"graphic",componentIndex:t.componentIndex,name:e.name}),n&&(n.info=r.info)}function O0e(e){e.registerComponentModel(D0e),e.registerComponentView(E0e),e.registerPreprocessor(function(t){var r=t.graphic;ne(r)?!r[0]||!r[0].elements?t.graphic=[{elements:r}]:t.graphic=[t.graphic[0]]:r&&!r.elements&&(t.graphic=[{elements:[r]}])})}var Gz=["x","y","radius","angle","single"],z0e=Ue(),B0e=["cartesian2d","polar","singleAxis"];function F0e(e){var t=e.get("coordinateSystem");return Be(B0e,t)>=0}function tl(e){return e+"Axis"}function V0e(e,t){var r=pe(),n=[],i=pe();e.eachComponent({mainType:"dataZoom",query:t},function(c){i.get(c.uid)||s(c)});var a;do a=!1,e.eachComponent("dataZoom",o);while(a);function o(c){!i.get(c.uid)&&l(c)&&(s(c),a=!0)}function s(c){i.set(c.uid,!0),n.push(c),u(c)}function l(c){var h=!1;return c.eachTargetAxis(function(f,d){var g=r.get(f);g&&g[d]&&(h=!0)}),h}function u(c){c.eachTargetAxis(function(h,f){(r.get(h)||r.set(h,[]))[f]=!0})}return n}function K9(e){var t=e.ecModel,r={infoList:[],infoMap:pe()};return e.eachTargetAxis(function(n,i){var a=t.getComponent(tl(n),i);if(a){var o=a.getCoordSysModel();if(o){var s=o.uid,l=r.infoMap.get(s);l||(l={model:o,axisModels:[]},r.infoList.push(l),r.infoMap.set(s,l)),l.axisModels.push(a)}}}),r}function J9(e){var t=z0e(DU(e));return t.axisProxyMap||(t.axisProxyMap=pe())}function f1(e){if(e)return J9(e.ecModel).get(e.uid)}function G0e(e,t){J9(e.ecModel).set(e.uid,t)}function Q9(e,t){var r=t.getAxisModel().axis.__alignTo;return r&&e.getAxisProxy(r.dim,r.model.componentIndex)?f1(r.model):null}var yT=function(){function e(){this.indexList=[],this.indexMap=[]}return e.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},e}(),Og=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._autoThrottle=!0,r._noTarget=!0,r._rangePropMode=["percent","percent"],r}return t.prototype.init=function(r,n,i){var a=Hz(r);this.settledOption=a,this.mergeDefaultAndTheme(r,i),this._doInit(a)},t.prototype.mergeOption=function(r){var n=Hz(r);He(this.option,r,!0),He(this.settledOption,n,!0),this._doInit(n)},t.prototype._doInit=function(r){var n=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var i=this.settledOption;E([["start","startValue"],["end","endValue"]],function(a,o){this._rangePropMode[o]==="value"&&(n[a[0]]=i[a[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var r=this.get("orient",!0),n=this._targetAxisInfoMap=pe(),i=this._fillSpecifiedTargetAxis(n);i?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(n,this._orient)),this._noTarget=!0,n.each(function(a){a.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(r){var n=!1;return E(Gz,function(i){var a=this.getReferringComponents(tl(i),Lee);if(a.specified){n=!0;var o=new yT;E(a.models,function(s){o.add(s.componentIndex)}),r.set(i,o)}},this),n},t.prototype._fillAutoTargetAxisByOrient=function(r,n){var i=this.ecModel,a=!0;if(a){var o=n==="vertical"?"y":"x",s=i.findComponents({mainType:o+"Axis"});l(s,o)}if(a){var s=i.findComponents({mainType:"singleAxis",filter:function(c){return c.get("orient",!0)===n}});l(s,"single")}function l(u,c){var h=u[0];if(h){var f=new yT;if(f.add(h.componentIndex),r.set(c,f),a=!1,c==="x"||c==="y"){var d=h.getReferringComponents("grid",Qt).models[0];d&&E(u,function(g){h.componentIndex!==g.componentIndex&&d===g.getReferringComponents("grid",Qt).models[0]&&f.add(g.componentIndex)})}}}a&&E(Gz,function(u){if(a){var c=i.findComponents({mainType:tl(u),filter:function(f){return f.get("type",!0)==="category"}});if(c[0]){var h=new yT;h.add(c[0].componentIndex),r.set(u,h),a=!1}}},this)},t.prototype._makeAutoOrientByTargetAxis=function(){var r;return this.eachTargetAxis(function(n){!r&&(r=n)},this),r==="y"?"vertical":"horizontal"},t.prototype._setDefaultThrottle=function(r){if(r.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var n=this.ecModel.option;this.option.throttle=n.animation&&n.animationDurationUpdate>0?100:20}},t.prototype._updateRangeUse=function(r){var n=this._rangePropMode,i=this.get("rangeMode");E([["start","startValue"],["end","endValue"]],function(a,o){var s=r[a[0]]!=null,l=r[a[1]]!=null;s&&!l?n[o]="percent":!s&&l?n[o]="value":i?n[o]=i[o]:s&&(n[o]="percent")})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(n,i){r==null&&(r=this.ecModel.getComponent(tl(n),i))},this),r},t.prototype.eachTargetAxis=function(r,n){this._targetAxisInfoMap.each(function(i,a){E(i.indexList,function(o){r.call(n,a,o)})})},t.prototype.getAxisProxy=function(r,n){return f1(this.getAxisModel(r,n))},t.prototype.getAxisModel=function(r,n){var i=this._targetAxisInfoMap.get(r);if(i&&i.indexMap[n])return this.ecModel.getComponent(tl(r),n)},t.prototype.setRawRange=function(r){var n=this.option,i=this.settledOption;E([["start","startValue"],["end","endValue"]],function(a){(r[a[0]]!=null||r[a[1]]!=null)&&(n[a[0]]=i[a[0]]=r[a[0]],n[a[1]]=i[a[1]]=r[a[1]])},this),this._updateRangeUse(r)},t.prototype.setCalculatedRange=function(r){var n=this.option;E(["start","startValue","end","endValue"],function(i){n[i]=r[i]})},t.prototype.getPercentRange=function(){var r=this.findRepresentativeAxisProxy();if(r)return r.getWindow().percent},t.prototype.getValueRange=function(r,n){if(r==null&&n==null){var i=this.findRepresentativeAxisProxy();if(i)return i.getWindow().value}else return this.getAxisProxy(r,n).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(r){if(r)return f1(r);for(var n,i=this._targetAxisInfoMap.keys(),a=0;ao[1];if(w&&!S&&!T)return!0;w&&(y=!0),S&&(g=!0),T&&(m=!0)}return y&&g&&m})}else E(c,function(d){if(a==="empty")l.setData(u=u.map(d,function(m){return s(m)?m:NaN}));else{var g={};g[d]=o,u.selectRange(g)}});E(c,function(d){u.setApproximateExtent(o,d)})}});function s(l){return l>=o[0]&&l<=o[1]}},e.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},r=this._dataZoomModel,n=this._extent;E(["min","max"],function(i){var a=r.get(i+"Span"),o=r.get(i+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?a=ct(n[0]+o,n,[0,100],!0):a!=null&&(o=ct(a,[0,100],n,!0)-n[0]),t[i+"Span"]=a,t[i+"ValueSpan"]=o},this)},e}(),Z0e={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(i){e.eachComponent("dataZoom",function(a){a.eachTargetAxis(function(o,s){var l=e.getComponent(tl(o),s);i(o,s,l,a)})})}var r=[];t(function(i,a,o,s){if(!f1(o)){var l=new W0e(i,a,s,e);r.push(l),G0e(o,l)}});var n=pe();return E(r,function(i){E(i.getTargetSeriesModels(),function(a){n.set(a.uid,a)})}),n},overallReset:function(e,t){e.eachComponent("dataZoom",function(r){var n=[];r.eachTargetAxis(function(i,a){var o=r.getAxisProxy(i,a),s=Q9(r,o);s?n.push([o,s]):o.reset(r,null)}),E(n,function(i){i[0].reset(r,i[1].getWindow().percentInverted)}),r.eachTargetAxis(function(i,a){r.getAxisProxy(i,a).filterData(r,t)})}),e.eachComponent("dataZoom",function(r){var n=r.findRepresentativeAxisProxy();if(n){var i=n.getWindow(),a=i.percent,o=i.value;r.setCalculatedRange({start:a[0],end:a[1],startValue:o[0],endValue:o[1]})}})}};function $0e(e){e.registerAction("dataZoom",function(t,r){var n=V0e(r,t);E(n,function(i){i.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})}var Y0e=cd();function $N(e){Y0e(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,Z0e),$0e(e),e.registerSubTypeDefaulter("dataZoom",function(){return"slider"})})}function X0e(e){e.registerComponentModel(H0e),e.registerComponentView(U0e),$N(e)}var no=function(){function e(){}return e}(),eZ={};function Bh(e,t){eZ[e]=t}function tZ(e){return eZ[e]}var q0e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n,i){var a=i.getTheme().get("toolbox"),o=a?a.feature:null;o&&(this._themeFeatureOption=ee({},o),a.feature={}),e.prototype.init.call(this,r,n,i),o&&(a.feature=o)},t.prototype.optionUpdated=function(){E(this.option.feature,function(r,n){var i=this._themeFeatureOption,a=tZ(n);a&&(a.getDefaultOption&&(a.defaultOption=a.getDefaultOption(this.ecModel)),i&&i[n]&&(He(r,i[n]),i[n]=null),He(r,a.defaultOption))},this)},t.type="toolbox",t.layoutMode={type:"box",ignoreSize:!0},t.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:K.size.m,itemSize:15,itemGap:K.size.s,showTitle:!0,iconStyle:{borderColor:K.color.accent50,color:"none"},emphasis:{iconStyle:{borderColor:K.color.accent70}},tooltip:{show:!1,position:"bottom"}},t}(qe);function rZ(e,t){var r=_d(t.get("padding")),n=t.getItemStyle(["color","opacity"]);n.fill=t.get("backgroundColor");var i=new Ye({shape:{x:e.x-r[3],y:e.y-r[0],width:e.width+r[1]+r[3],height:e.height+r[0]+r[2],r:t.get("borderRadius")},style:n,silent:!0,z2:-1});return i}var K0e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,i,a){var o=this.group;if(o.removeAll(),!r.get("show"))return;var s=+r.get("itemSize"),l=r.get("orient")==="vertical",u=r.get("feature")||{},c=this._features||(this._features=pe()),h=[];E(u,function(x,w){h.push(w)}),new ds(this._featureNames||[],h).add(f).update(f).remove(Ze(f,null)).execute(),this._featureNames=mt(h,function(x){return c.hasKey(x)});function f(x,w){var S=x!=null&&w==null,T=x!=null&&w!=null,M=x==null,A=S||T?h[x]:h[w],N=u[A],P=S||T?new Je(N,r,n):null,I=P&&P.get("show"),D;if(S){if(!I)return;if(J0e(A))D={onclick:P.option.onclick,featureName:A};else{var O=tZ(A);if(!O)return;D=new O}c.set(A,D)}else D=c.get(A);if(M||!I){Uz(D)&&D.dispose&&D.dispose(n,i),c.removeKey(A);return}a&&a.newTitle!=null&&a.featureName===A&&(N.title=a.newTitle),S&&(D.uid=Zc("toolbox-feature")),D.model=P,D.ecModel=n,D.api=i,d(P,D,A),P.setIconStatus=function(j,B){var U=this.option,H=this.iconPaths;U.iconStatus=U.iconStatus||{},U.iconStatus[j]=B,H[j]&&(B==="emphasis"?hs:fs)(H[j])},Uz(D)&&D.render&&D.render(P,n,i,a)}function d(x,w,S){var T=x.getModel("iconStyle"),M=x.getModel(["emphasis","iconStyle"]),A=w instanceof no&&w.getIcons?w.getIcons():x.get("icon"),N=x.get("title")||{},P,I;ue(A)?(P={},P[S]=A):P=A,ue(N)?(I={},I[S]=N):I=N;var D=x.iconPaths={};E(P,function(O,j){var B=md(O,{},{x:-s/2,y:-s/2,width:s,height:s});B.setStyle(T.getItemStyle());var U=B.ensureState("emphasis");U.style=M.getItemStyle();var H=new it({style:{text:I[j],align:M.get("textAlign"),borderRadius:M.get("textBorderRadius"),padding:M.get("textPadding"),fill:null,font:HL({fontStyle:M.get("textFontStyle"),fontFamily:M.get("textFontFamily"),fontSize:M.get("textFontSize"),fontWeight:M.get("textFontWeight")},n)},ignore:!0});B.setTextContent(H),bs({el:B,componentModel:r,itemName:j,formatterParamsExtra:{title:I[j]}}),B.__title=I[j],B.on("mouseover",function(){var V=M.getItemStyle(),z=l?r.get("right")==null&&r.get("left")!=="right"?"right":"left":r.get("bottom")==null&&r.get("top")!=="bottom"?"bottom":"top";H.setStyle({fill:M.get("textFill")||V.fill||V.stroke||K.color.neutral99,backgroundColor:M.get("textBackgroundColor")}),B.setTextConfig({position:M.get("textPosition")||z}),H.ignore=!r.get("showTitle"),i.enterEmphasis(this)}).on("mouseout",function(){x.get(["iconStatus",j])!=="emphasis"&&i.leaveEmphasis(this),H.hide()}),(x.get(["iconStatus",j])==="emphasis"?hs:fs)(B),o.add(B),B.on("click",de(w.onclick,w,n,i,j)),D[j]=B})}var g=Lr(r,i).refContainer,m=r.getBoxLayoutParams(),y=r.get("padding"),_=Bt(m,g,y);Ju(r.get("orient"),o,r.get("itemGap"),_.width,_.height),bb(o,m,g,y),o.add(rZ(o.getBoundingRect(),r)),l||o.eachChild(function(x){var w=x.__title,S=x.ensureState("emphasis"),T=S.textConfig||(S.textConfig={}),M=x.getTextContent(),A=M&&M.ensureState("emphasis");if(A&&!Ce(A)&&w){var N=A.style||(A.style={}),P=nb(w,it.makeFont(N)),I=x.x+o.x,D=x.y+o.y+s,O=!1;D+P.height>i.getHeight()&&(T.position="top",O=!0);var j=O?-5-P.height:s+10;I+P.width/2>i.getWidth()?(T.position=["100%",j],N.align="right"):I-P.width/2<0&&(T.position=[0,j],N.align="left")}})},t.prototype.updateView=function(r,n,i,a){E(this._features,function(o){o&&o instanceof no&&o.updateView&&o.updateView(o.model,n,i,a)})},t.prototype.dispose=function(r,n){E(this._features,function(i){i&&i instanceof no&&i.dispose&&i.dispose(r,n)})},t.type="toolbox",t}(Nt);function J0e(e){return e.indexOf("my")===0}function Uz(e){return e instanceof no}var Q0e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){var i=this.model,a=i.get("name")||r.get("title.0.text")||"echarts",o=n.getZr().painter.getType()==="svg",s=o?"svg":i.get("type",!0)||"png",l=n.getConnectedDataURL({type:s,backgroundColor:i.get("backgroundColor",!0)||r.get("backgroundColor")||K.color.neutral00,connectedBackgroundColor:i.get("connectedBackgroundColor"),excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")}),u=rt.browser;if(typeof MouseEvent=="function"&&(u.newEdge||!u.ie&&!u.edge)){var c=document.createElement("a");c.download=a+"."+s,c.target="_blank",c.href=l;var h=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});c.dispatchEvent(h)}else if(window.navigator.msSaveOrOpenBlob||o){var f=l.split(","),d=f[0].indexOf("base64")>-1,g=o?decodeURIComponent(f[1]):f[1];d&&(g=window.atob(g));var m=a+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var y=g.length,_=new Uint8Array(y);y--;)_[y]=g.charCodeAt(y);var x=new Blob([_]);window.navigator.msSaveOrOpenBlob(x,m)}else{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow,T=S.document;T.open("image/svg+xml","replace"),T.write(g),T.close(),S.focus(),T.execCommand("SaveAs",!0,m),document.body.removeChild(w)}}else{var M=i.get("lang"),A='',N=window.open();N.document.write(A),N.document.title=a}},t.getDefaultOption=function(r){var n={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:r.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:K.color.neutral00,name:"",excludeComponents:["toolbox"],lang:r.getLocaleModel().get(["toolbox","saveAsImage","lang"])};return n},t}(no),Wz="__ec_magicType_stack__",e_e=[["line","bar"],["stack"]],t_e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getIcons=function(){var r=this.model,n=r.get("icon"),i={};return E(r.get("type"),function(a){n[a]&&(i[a]=n[a])}),i},t.getDefaultOption=function(r){var n={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z"},title:r.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}};return n},t.prototype.onclick=function(r,n,i){var a=this.model,o=a.get(["seriesIndex",i]);if(Zz[i]){var s={series:[]},l=function(h){var f=h.subType,d=h.id,g=Zz[i](f,d,h,a);g&&(ke(g,h.option),s.series.push(g));var m=h.coordinateSystem;if(m&&m.type==="cartesian2d"&&(i==="line"||i==="bar")){var y=m.getAxesByScale("ordinal")[0];if(y){var _=y.dim,x=_+"Axis",w=h.getReferringComponents(x,Qt).models[0],S=w.componentIndex;s[x]=s[x]||[];for(var T=0;T<=S;T++)s[x][S]=s[x][S]||{};s[x][S].boundaryGap=i==="bar"}}};E(e_e,function(h){Be(h,i)>=0&&E(h,function(f){a.setIconStatus(f,"normal")})}),a.setIconStatus(i,"emphasis"),r.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=i;i==="stack"&&(u=He({stack:a.option.title.tiled,tiled:a.option.title.stack},a.option.title),a.get(["iconStatus",i])!=="emphasis"&&(c="tiled")),n.dispatchAction({type:"changeMagicType",currentType:c,newOption:s,newTitle:u,featureName:"magicType"})}},t}(no),Zz={line:function(e,t,r,n){if(e==="bar")return He({id:t,type:"line",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","line"])||{},!0)},bar:function(e,t,r,n){if(e==="line")return He({id:t,type:"bar",data:r.get("data"),stack:r.get("stack"),markPoint:r.get("markPoint"),markLine:r.get("markLine")},n.get(["option","bar"])||{},!0)},stack:function(e,t,r,n){var i=r.get("stack")===Wz;if(e==="line"||e==="bar")return n.setIconStatus("stack",i?"normal":"emphasis"),He({id:t,stack:i?"":Wz},n.get(["option","stack"])||{},!0)}};wa({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(e,t){t.mergeOption(e.newOption)});var Zb=new Array(60).join("-"),Jf=" ";function r_e(e){var t={},r=[],n=[];return e.eachRawSeries(function(i){var a=i.coordinateSystem;if(a&&(a.type==="cartesian2d"||a.type==="polar")){var o=a.getBaseAxis();if(o.type==="category"){var s=zue(o);t[s]||(t[s]={categoryAxis:o,valueAxis:a.getOtherAxis(o),series:[]},n.push({axisDim:o.dim,axisIndex:o.index})),t[s].series.push(i)}else r.push(i)}else r.push(i)}),{seriesGroupByCategoryAxis:t,other:r,meta:n}}function n_e(e){var t=[];return E(e,function(r,n){var i=r.categoryAxis,a=r.valueAxis,o=a.dim,s=[" "].concat(ae(r.series,function(d){return d.name})),l=[i.model.getCategories()];E(r.series,function(d){var g=d.getRawData();l.push(d.getRawData().mapArray(g.mapDimension(o),function(m){return m}))});for(var u=[s.join(Jf)],c=0;c=0)return!0}var RA=new RegExp("["+Jf+"]+","g");function s_e(e){for(var t=e.split(/\n+/g),r=d1(t.shift()).split(RA),n=[],i=ae(r,function(l){return{name:l,data:[]}}),a=0;a=0;a--){var o=r[a];if(o[i])break}if(a<0){var s=e.queryComponents({mainType:"dataZoom",subType:"select",id:i})[0];if(s){var l=s.getPercentRange();r[0][i]={dataZoomId:i,start:l[0],end:l[1]}}}}),r.push(t)}function d_e(e){var t=YN(e),r=t[t.length-1];t.length>1&&t.pop();var n={};return nZ(r,function(i,a){for(var o=t.length-1;o>=0;o--)if(i=t[o][a],i){n[a]=i;break}}),n}function v_e(e){iZ(e).snapshots=null}function p_e(e){return YN(e).length}function YN(e){var t=iZ(e);return t.snapshots||(t.snapshots=[{}]),t.snapshots}var g_e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){v_e(r),n.dispatchAction({type:"restore",from:this.uid})},t.getDefaultOption=function(r){var n={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:r.getLocaleModel().get(["toolbox","restore","title"])};return n},t}(no);wa({type:"restore",event:"restore",update:"prepareAndUpdate"},function(e,t){t.resetOption("recreate")});var m_e=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],XN=function(){function e(t,r,n){var i=this;this._targetInfoList=[];var a=$z(r,t);E(y_e,function(o,s){(!n||!n.include||Be(n.include,s)>=0)&&o(a,i._targetInfoList)})}return e.prototype.setOutputRanges=function(t,r){return this.matchOutputRanges(t,r,function(n,i,a){if((n.coordRanges||(n.coordRanges=[])).push(i),!n.coordRange){n.coordRange=i;var o=_T[n.brushType](0,a,i);n.__rangeOffset={offset:Kz[n.brushType](o.values,n.range,[1,1]),xyMinMax:o.xyMinMax}}}),t},e.prototype.matchOutputRanges=function(t,r,n){E(t,function(i){var a=this.findTargetInfo(i,r);a&&a!==!0&&E(a.coordSyses,function(o){var s=_T[i.brushType](1,o,i.range,!0);n(i,s.values,o,r)})},this)},e.prototype.setInputRanges=function(t,r){E(t,function(n){var i=this.findTargetInfo(n,r);if(n.range=n.range||[],i&&i!==!0){n.panelId=i.panelId;var a=_T[n.brushType](0,i.coordSys,n.coordRange),o=n.__rangeOffset;n.range=o?Kz[n.brushType](a.values,o.offset,__e(a.xyMinMax,o.xyMinMax)):a.values}},this)},e.prototype.makePanelOpts=function(t,r){return ae(this._targetInfoList,function(n){var i=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:r?r(n):null,clipPath:c9(i),isTargetByCursor:f9(i,t,n.coordSysModel),getLinearBrushOtherExtent:h9(i)}})},e.prototype.controlSeries=function(t,r,n){var i=this.findTargetInfo(t,n);return i===!0||i&&Be(i.coordSyses,r.coordinateSystem)>=0},e.prototype.findTargetInfo=function(t,r){for(var n=this._targetInfoList,i=$z(r,t),a=0;ae[1]&&e.reverse(),e}function $z(e,t){return pf(e,t,{includeMainTypes:m_e})}var y_e={grid:function(e,t){var r=e.xAxisModels,n=e.yAxisModels,i=e.gridModels,a=pe(),o={},s={};!r&&!n&&!i||(E(r,function(l){var u=l.axis.grid.model;a.set(u.id,u),o[u.id]=!0}),E(n,function(l){var u=l.axis.grid.model;a.set(u.id,u),s[u.id]=!0}),E(i,function(l){a.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),a.each(function(l){var u=l.coordinateSystem,c=[];E(u.getCartesians(),function(h,f){(Be(r,h.getAxis("x").model)>=0||Be(n,h.getAxis("y").model)>=0)&&c.push(h)}),t.push({panelId:"grid--"+l.id,gridModel:l,coordSysModel:l,coordSys:c[0],coordSyses:c,getPanelRect:Xz.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(e,t){E(e.geoModels,function(r){var n=r.coordinateSystem;t.push({panelId:"geo--"+r.id,geoModel:r,coordSysModel:r,coordSys:n,coordSyses:[n],getPanelRect:Xz.geo})})}},Yz=[function(e,t){var r=e.xAxisModel,n=e.yAxisModel,i=e.gridModel;return!i&&r&&(i=r.axis.grid.model),!i&&n&&(i=n.axis.grid.model),i&&i===t.gridModel},function(e,t){var r=e.geoModel;return r&&r===t.geoModel}],Xz={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys.view,t=u7(null,e);return N6(t,t,qx(null,e)),t}},_T={lineX:Ze(qz,0),lineY:Ze(qz,1),rect:function(e,t,r,n){var i=e?t.pointToData([r[0][0],r[1][0]],n):t.dataToPoint([r[0][0],r[1][0]],n),a=e?t.pointToData([r[0][1],r[1][1]],n):t.dataToPoint([r[0][1],r[1][1]],n),o=[jA([i[0],a[0]]),jA([i[1],a[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,r,n){var i=[Qr(),Qr()],a=ae(r,function(o){var s=e?t.pointToData(o,n):t.dataToPoint(o,n);return i[0][0]=Math.min(i[0][0],s[0]),i[1][0]=Math.min(i[1][0],s[1]),i[0][1]=Math.max(i[0][1],s[0]),i[1][1]=Math.max(i[1][1],s[1]),s});return{values:a,xyMinMax:i}}};function qz(e,t,r,n){var i=r.getAxis(["x","y"][e]),a=jA(ae([0,1],function(s){return t?i.coordToData(i.toLocalCoord(n[s]),!0):i.toGlobalCoord(i.dataToCoord(n[s]))})),o=[];return o[e]=a,o[1-e]=[NaN,NaN],{values:a,xyMinMax:o}}var Kz={lineX:Ze(Jz,0),lineY:Ze(Jz,1),rect:function(e,t,r){return[[e[0][0]-r[0]*t[0][0],e[0][1]-r[0]*t[0][1]],[e[1][0]-r[1]*t[1][0],e[1][1]-r[1]*t[1][1]]]},polygon:function(e,t,r){return ae(e,function(n,i){return[n[0]-r[0]*t[i][0],n[1]-r[1]*t[i][1]]})}};function Jz(e,t,r,n){return[t[0]-n[e]*r[0],t[1]-n[e]*r[1]]}function __e(e,t){var r=Qz(e),n=Qz(t),i=[r[0]/n[0],r[1]/n[1]];return isNaN(i[0])&&(i[0]=1),isNaN(i[1])&&(i[1]=1),i}function Qz(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var OA=E,x_e=Cee("toolbox-dataZoom_"),b_e={x:"width",y:"height"},w_e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,i,a){this._brushController||(this._brushController=new yN(i.getZr()),this._brushController.on("brush",de(this._onBrush,this)).mount()),T_e(r,n,this,a,i),C_e(r,n)},t.prototype.onclick=function(r,n,i){S_e[i].call(this)},t.prototype.dispose=function(r,n){this._brushController&&this._brushController.dispose()},t.prototype._onBrush=function(r){var n=r.areas;if(!r.isEnd||!n.length)return;var i={},a=this.ecModel;this._brushController.updateCovers([]);var o=new XN(qN(this.model),a,{include:["grid"]});o.matchOutputRanges(n,a,function(u,c,h){if(h.type==="cartesian2d"){var f=h.master.getRect().clone(),d=u.brushType;d==="rect"?(s("x",h,f,c[0]),s("y",h,f,c[1])):s({lineX:"x",lineY:"y"}[d],h,f,c)}}),f_e(a,i),this._dispatchZoomAction(i);function s(u,c,h,f){var d=c.getAxis(u),g=d.model,m=l(u,g,a),y=m.findRepresentativeAxisProxy(g).getMinMaxSpan(),_=d.scale.getExtent();(y.minValueSpan!=null||y.maxValueSpan!=null)&&(f=Ll(0,f.slice(),_,0,y.minValueSpan,y.maxValueSpan));var x=mL(_,h[b_e[u]],.5);m&&(i[m.id]={dataZoomId:m.id,startValue:isFinite(x)?st(f[0],x):f[0],endValue:isFinite(x)?st(f[1],x):f[1]})}function l(u,c,h){var f;return h.eachComponent({mainType:"dataZoom",subType:"select"},function(d){var g=d.getAxisModel(u,c.componentIndex);g&&(f=d)}),f}},t.prototype._dispatchZoomAction=function(r){var n=[];OA(r,function(i,a){n.push(Se(i))}),n.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:n})},t.getDefaultOption=function(r){var n={show:!0,filterMode:"filter",icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:r.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:K.color.backgroundTint}};return n},t}(no),S_e={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(d_e(this.ecModel))}};function qN(e){var t={xAxisIndex:e.get("xAxisIndex",!0),yAxisIndex:e.get("yAxisIndex",!0),xAxisId:e.get("xAxisId",!0),yAxisId:e.get("yAxisId",!0)};return t.xAxisIndex==null&&t.xAxisId==null&&(t.xAxisIndex="all"),t.yAxisIndex==null&&t.yAxisId==null&&(t.yAxisIndex="all"),t}function C_e(e,t){e.setIconStatus("back",p_e(t)>1?"emphasis":"normal")}function T_e(e,t,r,n,i){var a=r._isZoomActive;n&&n.type==="takeGlobalCursor"&&(a=n.key==="dataZoomSelect"?n.dataZoomSelectActive:!1),r._isZoomActive=a,e.setIconStatus("zoom",a?"emphasis":"normal");var o=new XN(qN(e),t,{include:["grid"]}),s=o.makePanelOpts(i,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});r._brushController.setPanels(s).enableBrush(a&&s.length?{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()}:!1)}fne("dataZoom",function(e){var t=e.getComponent("toolbox",0),r=["feature","dataZoom"];if(!t||t.get(r)==null)return;var n=t.getModel(r),i=[],a=qN(n),o=pf(e,a);OA(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),OA(o.yAxisModels,function(l){return s(l,"yAxis","yAxisIndex")});function s(l,u,c){var h=l.componentIndex,f={type:"select",$fromToolbox:!0,filterMode:n.get("filterMode",!0)||"filter",id:x_e+u+h};f[c]=h,i.push(f)}return i});function M_e(e){e.registerComponentModel(q0e),e.registerComponentView(K0e),Bh("saveAsImage",Q0e),Bh("magicType",t_e),Bh("dataView",c_e),Bh("dataZoom",w_e),Bh("restore",g_e),We(X0e)}var A_e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="tooltip",t.dependencies=["axisPointer"],t.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click|mousewheel",alwaysShowContent:!1,renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,displayTransition:!0,enterable:!1,backgroundColor:K.color.neutral00,shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,defaultBorderColor:K.color.border,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:K.color.borderShade,width:1,type:"dashed",textStyle:{}}},textStyle:{color:K.color.tertiary,fontSize:14}},t}(qe);function aZ(e){var t=e.get("confine");return t!=null?!!t:e.get("renderMode")==="richText"}function oZ(e){if(rt.domSupported){for(var t=document.documentElement.style,r=0,n=e.length;r-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=a==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=a==="top"?225:45)+"deg)");var c=u*Math.PI/180,h=o+i,f=h*Math.abs(Math.cos(c))+h*Math.abs(Math.sin(c)),d=Math.round(((f-Math.SQRT2*i)/2+Math.SQRT2*i-(f-h)/2)*100)/100;s+=";"+a+":-"+d+"px";var g=t+" solid "+i+"px;",m=["position:absolute;width:"+o+"px;height:"+o+"px;z-index:-1;",s+";"+l+";","border-bottom:"+g,"border-right:"+g,"background-color:"+n+";"];return'
'}function E_e(e,t,r){var n="cubic-bezier(0.23,1,0.32,1)",i="",a="";return r&&(i=" "+e/2+"s "+n,a="opacity"+i+",visibility"+i),t||(i=" "+e+"s "+n,a+=(a.length?",":"")+(rt.transformSupported?""+KN+i:",left"+i+",top"+i)),I_e+":"+a}function e4(e,t,r){var n=e.toFixed(0)+"px",i=t.toFixed(0)+"px";if(!rt.transformSupported)return r?"top:"+i+";left:"+n+";":[["top",i],["left",n]];var a=rt.transform3dSupported,o="translate"+(a?"3d":"")+"("+n+","+i+(a?",0":"")+")";return r?"top:0;left:0;"+KN+":"+o+";":[["top",0],["left",0],[sZ,o]]}function R_e(e){var t=[],r=e.get("fontSize"),n=e.getTextColor();n&&t.push("color:"+n),t.push("font:"+e.getFont());var i=_e(e.get("lineHeight"),Math.round(r*3/2));r&&t.push("line-height:"+i+"px");var a=e.get("textShadowColor"),o=e.get("textShadowBlur")||0,s=e.get("textShadowOffsetX")||0,l=e.get("textShadowOffsetY")||0;return a&&o&&t.push("text-shadow:"+s+"px "+l+"px "+o+"px "+a),E(["decoration","align"],function(u){var c=e.get(u);c&&t.push("text-"+u+":"+c)}),t.join(";")}function j_e(e,t,r,n){var i=[],a=e.get("transitionDuration"),o=e.get("backgroundColor"),s=e.get("shadowBlur"),l=e.get("shadowColor"),u=e.get("shadowOffsetX"),c=e.get("shadowOffsetY"),h=e.getModel("textStyle"),f=mU(e,"html"),d=u+"px "+c+"px "+s+"px "+l;return i.push("box-shadow:"+d),t&&a>0&&i.push(E_e(a,r,n)),o&&i.push("background-color:"+o),E(["width","color","radius"],function(g){var m="border-"+g,y=rI(m),_=e.get(y);_!=null&&i.push(m+":"+_+(g==="color"?"":"px"))}),i.push(R_e(h)),f!=null&&i.push("padding:"+_d(f).join("px ")+"px"),i.join(";")+";"}function t4(e,t,r,n,i){var a=t&&t.painter;if(r){var o=a&&a.getViewportRoot();o&&zJ(e,o,r,n,i)}else{e[0]=n,e[1]=i;var s=a&&a.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var O_e=function(){function e(t,r){if(this._show=!1,this._styleCoord=[0,0,0,0],this._enterable=!0,this._alwaysShowContent=!1,this._firstShow=!0,this._longHide=!0,rt.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var i=this._zr=t.getZr(),a=r.appendTo,o=a&&(ue(a)?document.querySelector(a):cc(a)?a:Ce(a)&&a(t.getDom()));t4(this._styleCoord,i,o,t.getWidth()/2,t.getHeight()/2),(o||t.getDom()).appendChild(n),this._api=t,this._container=o;var s=this;n.onmouseenter=function(){s._enterable&&(clearTimeout(s._hideTimeout),s._show=!0),s._inContent=!0},n.onmousemove=function(l){if(l=l||window.event,!s._enterable){var u=i.handler,c=i.painter.getViewportRoot();Mi(c,l,!0),u.dispatch("mousemove",l)}},n.onmouseleave=function(){s._inContent=!1,s._enterable&&s._show&&s.hideLater(s._hideDelay)}}return e.prototype.update=function(t){if(!this._container){var r=this._api.getDom(),n=L_e(r,"position"),i=r.style;i.position!=="absolute"&&n!=="absolute"&&(i.position="relative")}var a=t.get("alwaysShowContent");a&&this._moveIfResized(),this._alwaysShowContent=a,this._enableDisplayTransition=t.get("displayTransition")&&t.get("transitionDuration")>0,this.el.className=t.get("className")||""},e.prototype.show=function(t,r){clearTimeout(this._hideTimeout),clearTimeout(this._longHideTimeout);var n=this.el,i=n.style,a=this._styleCoord;n.innerHTML?i.cssText=N_e+j_e(t,!this._firstShow,this._longHide,this._enableDisplayTransition)+e4(a[0],a[1],!0)+("border-color:"+xc(r)+";")+(t.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):i.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(t,r,n,i,a){var o=this.el;if(t==null){o.innerHTML="";return}var s="";if(ue(a)&&n.get("trigger")==="item"&&!aZ(n)&&(s=D_e(n,i,a)),ue(t))o.innerHTML=t+s;else if(t){o.innerHTML="",ne(t)||(t=[t]);for(var l=0;l=0?this._tryShow(a,o):i==="leave"&&this._hide(o))},this))},t.prototype._keepShow=function(){var r=this._tooltipModel,n=this._ecModel,i=this._api,a=r.get("triggerOn");if(r.get("trigger")!=="axis"&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&a!=="none"&&a!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!i.isDisposed()&&o.manuallyShowTip(r,n,i,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(r,n,i,a){if(!(a.from===this.uid||rt.node||!i.getDom())){var o=i4(a,i);this._ticket="";var s=a.dataByCoordSys,l=U_e(a,n,i);if(l){var u=l.el.getBoundingRect().clone();u.applyTransform(l.el.transform),this._tryShow({offsetX:u.x+u.width/2,offsetY:u.y+u.height/2,target:l.el,position:a.position,positionDefault:"bottom"},o)}else if(a.tooltip&&a.x!=null&&a.y!=null){var c=B_e;c.x=a.x,c.y=a.y,c.update(),Re(c).tooltipConfig={name:null,option:a.tooltip},this._tryShow({offsetX:a.x,offsetY:a.y,target:c},o)}else if(s)this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,dataByCoordSys:s,tooltipOption:a.tooltipOption},o);else if(a.seriesIndex!=null){if(this._manuallyAxisShowTip(r,n,i,a))return;var h=H9(a,n),f=h.point[0],d=h.point[1];f!=null&&d!=null&&this._tryShow({offsetX:f,offsetY:d,target:h.el,position:a.position,positionDefault:"bottom"},o)}else a.x!=null&&a.y!=null&&(i.dispatchAction({type:"updateAxisPointer",x:a.x,y:a.y}),this._tryShow({offsetX:a.x,offsetY:a.y,position:a.position,target:i.getZr().findHover(a.x,a.y).target},o))}},t.prototype.manuallyHideTip=function(r,n,i,a){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,a.from!==this.uid&&this._hide(i4(a,i))},t.prototype._manuallyAxisShowTip=function(r,n,i,a){var o=a.seriesIndex,s=a.dataIndex,l=n.getComponent("axisPointer").coordSysAxesInfo;if(!(o==null||s==null||l==null)){var u=n.getSeriesByIndex(o);if(u){var c=u.getData(),h=Ev([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.get("trigger")==="axis")return i.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:a.position}),!0}}},t.prototype._tryShow=function(r,n){var i=r.target,a=this._tooltipModel;if(a){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(i){var s=Re(i);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null,this._cbParamsList=null;var l,u;Hu(i,function(c){if(c.tooltipDisabled)return l=u=null,!0;l||u||(Re(c).dataIndex!=null?l=c:Re(c).tooltipConfig!=null&&(u=c))},!0),l?this._showSeriesItemTooltip(r,l,n):u?this._showComponentItemTooltip(r,u,n):this._hide(n)}else this._lastDataByCoordSys=null,this._cbParamsList=null,this._hide(n)}},t.prototype._showOrMove=function(r,n){var i=r.get("showDelay");n=de(n,this),clearTimeout(this._showTimout),i>0?this._showTimout=setTimeout(n,i):n()},t.prototype._showAxisTooltip=function(r,n){var i=this._ecModel,a=this._tooltipModel,o=[n.offsetX,n.offsetY],s=Ev([n.tooltipOption],a),l=this._renderMode,u=[],c=_r("section",{blocks:[],noHeader:!0}),h=[],f=new XS;E(r,function(x){E(x.dataByAxis,function(w){var S=i.getComponent(w.axisDim+"Axis",w.axisIndex),T=w.value,M=S.axis,A=M.scale.parse(T);if(!(!S||T==null)){var N=B9(T,M,i,w.seriesDataIndices,w.valueLabelOpt),P=_r("section",{header:N,noHeader:!oi(N),sortBlocks:!0,blocks:[]});c.blocks.push(P),E(w.seriesDataIndices,function(I){var D=i.getSeriesByIndex(I.seriesIndex),O=I.dataIndexInside,j=D.getDataParams(O);if(!(j.dataIndex<0)){j.axisDim=w.axisDim,j.axisIndex=w.axisIndex,j.axisType=w.axisType,j.axisId=w.axisId,j.axisValue=jx(S.axis,{value:A}),j.axisValueLabel=N,j.marker=f.makeTooltipMarker("item",xc(j.color),l);var B=hj(D.formatTooltip(O,!0,null)),U=B.frag;if(U){var H=Ev([D],a).get("valueFormatter");P.blocks.push(H?ee({valueFormatter:H},U):U)}B.text&&h.push(B.text),u.push(j)}})}})}),c.blocks.reverse(),h.reverse();var d=n.position,g=s.get("order"),m=mj(c,f,l,g,i.get("useUTC"),s.get("textStyle"));m&&h.unshift(m);var y=l==="richText"?` - -`:"
",_=h.join(y);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,u)?this._updatePosition(s,d,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,_,u,Math.random()+"",o[0],o[1],d,null,f)})},t.prototype._showSeriesItemTooltip=function(r,n,i){var a=this._ecModel,o=Re(n),s=o.seriesIndex,l=a.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,h=o.dataType,f=u.getData(h),d=this._renderMode,g=r.positionDefault,m=Ev([f.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,g?{position:g}:null),y=m.get("trigger");if(!(y!=null&&y!=="item")){var _=u.getDataParams(c,h),x=new XS;_.marker=x.makeTooltipMarker("item",xc(_.color),d);var w=hj(u.formatTooltip(c,!1,h)),S=m.get("order"),T=m.get("valueFormatter"),M=w.frag,A=M?mj(T?ee({valueFormatter:T},M):M,x,d,S,a.get("useUTC"),m.get("textStyle")):w.text,N="item_"+u.name+"_"+c;this._showOrMove(m,function(){this._showTooltipContent(m,A,_,N,r.offsetX,r.offsetY,r.position,r.target,x)}),i({type:"showTip",dataIndexInside:c,dataIndex:f.getRawIndex(c),seriesIndex:s,from:this.uid})}},t.prototype._showComponentItemTooltip=function(r,n,i){var a=this._renderMode==="html",o=Re(n),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(ue(l)){var c=l;l={content:c,formatter:c},u=!0}u&&a&&l.content&&(l=Se(l),l.content=gn(l.content));var h=[l],f=this._ecModel.getComponent(o.componentMainType,o.componentIndex);f&&h.push(f),h.push({formatter:l.content});var d=r.positionDefault,g=Ev(h,this._tooltipModel,d?{position:d}:null),m=g.get("content"),y=Math.random()+"",_=new XS;this._showOrMove(g,function(){var x=Se(g.get("formatterParams")||{});this._showTooltipContent(g,m,x,y,r.offsetX,r.offsetY,r.position,n,_)}),i({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(r,n,i,a,o,s,l,u,c){if(this._ticket="",!(!r.get("showContent")||!r.get("show"))){var h=this._tooltipContent;h.setEnterable(r.get("enterable"));var f=r.get("formatter");l=l||r.get("position");var d=n,g=this._getNearestPoint([o,s],i,r.get("trigger"),r.get("borderColor"),r.get("defaultBorderColor",!0)),m=g.color;if(f)if(ue(f)){var y=r.ecModel.get("useUTC"),_=ne(i)?i[0]:i,x=_&&_.axisType&&_.axisType.indexOf("time")>=0;d=f,x&&(d=am(_.axisValue,d,y)),d=nI(d,i,!0)}else if(Ce(f)){var w=de(function(S,T){S===this._ticket&&(h.setContent(T,c,r,m,l),this._updatePosition(r,l,o,s,h,i,u))},this);this._ticket=a,d=f(i,a,w)}else d=f;h.setContent(d,c,r,m,l),h.show(r,m),this._updatePosition(r,l,o,s,h,i,u)}},t.prototype._getNearestPoint=function(r,n,i,a,o){if(i==="axis"||ne(n))return{color:a||o};if(!ne(n))return{color:a||n.color||n.borderColor}},t.prototype._updatePosition=function(r,n,i,a,o,s,l){var u=this._api.getWidth(),c=this._api.getHeight();n=n||r.get("position");var h=o.getSize(),f=r.get("align"),d=r.get("verticalAlign"),g=l&&l.getBoundingRect().clone();if(l&&g.applyTransform(l.transform),Ce(n)&&(n=n([i,a],s,o.el,g,{viewSize:[u,c],contentSize:h.slice()})),ne(n))i=he(n[0],u),a=he(n[1],c);else if(Ie(n)){var m=n;m.width=h[0],m.height=h[1];var y=Bt(m,{width:u,height:c});i=y.x,a=y.y,f=null,d=null}else if(ue(n)&&l){var _=H_e(n,g,h,r.get("borderWidth"));i=_[0],a=_[1]}else{var _=V_e(i,a,o,u,c,f?null:20,d?null:20);i=_[0],a=_[1]}if(f&&(i-=a4(f)?h[0]/2:f==="right"?h[0]:0),d&&(a-=a4(d)?h[1]/2:d==="bottom"?h[1]:0),aZ(r)){var _=G_e(i,a,o,u,c);i=_[0],a=_[1]}o.moveTo(i,a)},t.prototype._updateContentNotChangedOnAxis=function(r,n){var i=this._lastDataByCoordSys,a=this._cbParamsList,o=!!i&&i.length===r.length;return o&&E(i,function(s,l){var u=s.dataByAxis||[],c=r[l]||{},h=c.dataByAxis||[];o=o&&u.length===h.length,o&&E(u,function(f,d){var g=h[d]||{},m=f.seriesDataIndices||[],y=g.seriesDataIndices||[];o=o&&f.value===g.value&&f.axisType===g.axisType&&f.axisId===g.axisId&&m.length===y.length,o&&E(m,function(_,x){var w=y[x];o=o&&_.seriesIndex===w.seriesIndex&&_.dataIndex===w.dataIndex}),a&&E(f.seriesDataIndices,function(_){var x=_.seriesIndex,w=n[x],S=a[x];w&&S&&S.data!==w.data&&(o=!1)})})}),this._lastDataByCoordSys=r,this._cbParamsList=n,!!o},t.prototype._hide=function(r){this._lastDataByCoordSys=null,this._cbParamsList=null,r({type:"hideTip",from:this.uid})},t.prototype.dispose=function(r,n){rt.node||!n.getDom()||(dg(this,"_updatePosition"),this._tooltipContent.dispose(),LA("itemTooltip",n),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type="tooltip",t}(Nt);function Ev(e,t,r){var n=t.ecModel,i;r?(i=new Je(r,n,n),i=new Je(t.option,i,n)):i=t;for(var a=e.length-1;a>=0;a--){var o=e[a];o&&(o instanceof Je&&(o=o.get("tooltip",!0)),ue(o)&&(o={formatter:o}),o&&(i=new Je(o,i,n)))}return i}function i4(e,t){return e.dispatchAction||de(t.dispatchAction,t)}function V_e(e,t,r,n,i,a,o){var s=r.getSize(),l=s[0],u=s[1];return a!=null&&(e+l+a+2>n?e-=l+a:e+=a),o!=null&&(t+u+o>i?t-=u+o:t+=o),[e,t]}function G_e(e,t,r,n,i){var a=r.getSize(),o=a[0],s=a[1];return e=Math.min(e+o,n)-o,t=Math.min(t+s,i)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function H_e(e,t,r,n){var i=r[0],a=r[1],o=Math.ceil(Math.SQRT2*n)+8,s=0,l=0,u=t.width,c=t.height;switch(e){case"inside":s=t.x+u/2-i/2,l=t.y+c/2-a/2;break;case"top":s=t.x+u/2-i/2,l=t.y-a-o;break;case"bottom":s=t.x+u/2-i/2,l=t.y+c+o;break;case"left":s=t.x-i-o,l=t.y+c/2-a/2;break;case"right":s=t.x+u+o,l=t.y+c/2-a/2}return[s,l]}function a4(e){return e==="center"||e==="middle"}function U_e(e,t,r){var n=SL(e).queryOptionMap,i=n.keys()[0];if(!(!i||i==="series")){var a=ud(t,i,n.get(i),{useDefault:!1,enableAll:!1,enableNone:!1}),o=a.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=Re(u).tooltipConfig;if(c&&c.name===e.name)return l=u,!0}),l)return{componentMainType:i,componentIndex:o.componentIndex,el:l}}}}function W_e(e){We(mm),e.registerComponentModel(A_e),e.registerComponentView(F_e),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},qt),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},qt)}var Z_e=["rect","polygon","keep","clear"];function $_e(e,t){var r=It(e?e.brush:[]);if(r.length){var n=[];E(r,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(n=n.concat(u))});var i=e&&e.toolbox;ne(i)&&(i=i[0]),i||(i={feature:{}},e.toolbox=[i]);var a=i.feature||(i.feature={}),o=a.brush||(a.brush={}),s=o.type||(o.type=[]);s.push.apply(s,n),lb(s,function(l){return l+""},null),t&&!s.length&&s.push.apply(s,Z_e)}}var o4=E;function s4(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function zA(e,t,r){var n={};return o4(t,function(a){var o=n[a]=i();o4(e[a],function(s,l){if(jr.isValidType(l)){var u={type:l,visual:s};r&&r(u,a),o[l]=new jr(u),l==="opacity"&&(u=Se(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new jr(u))}})}),n;function i(){var a=function(){};a.prototype.__hidden=a.prototype;var o=new a;return o}}function uZ(e,t,r){var n;E(r,function(i){t.hasOwnProperty(i)&&s4(t[i])&&(n=!0)}),n&&E(r,function(i){t.hasOwnProperty(i)&&s4(t[i])?e[i]=Se(t[i]):delete e[i]})}function Y_e(e,t,r,n,i,a){var o={};E(e,function(h){var f=jr.prepareVisualTypes(t[h]);o[h]=f});var s;function l(h){return dI(r,s,h)}function u(h,f){AU(r,s,h,f)}r.each(c);function c(h,f){s=h;var d=r.getRawDataItem(s);if(!(d&&d.visualMap===!1))for(var g=n.call(i,h),m=t[g],y=o[g],_=0,x=y.length;_t[0][1]&&(t[0][1]=a[0]),a[1]t[1][1]&&(t[1][1]=a[1])}return t&&f4(t)}};function f4(e){return new Ae(e[0][0],e[1][0],e[0][1]-e[0][0],e[1][1]-e[1][0])}var nxe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.ecModel=r,this.api=n,this.model,(this._brushController=new yN(n.getZr())).on("brush",de(this._onBrush,this)).mount()},t.prototype.render=function(r,n,i,a){this.model=r,this._updateController(r,n,i,a)},t.prototype.updateTransform=function(r,n,i,a){cZ(n),this._updateController(r,n,i,a)},t.prototype.updateVisual=function(r,n,i,a){this.updateTransform(r,n,i,a)},t.prototype.updateView=function(r,n,i,a){this._updateController(r,n,i,a)},t.prototype._updateController=function(r,n,i,a){(!a||a.$from!==r.id)&&this._brushController.setPanels(r.brushTargetManager.makePanelOpts(i)).enableBrush(r.brushOption).updateCovers(r.areas.slice())},t.prototype.dispose=function(){this._brushController.dispose()},t.prototype._onBrush=function(r){var n=this.model.id,i=this.model.brushTargetManager.setOutputRanges(r.areas,this.ecModel);(!r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:Se(i),$from:n}),r.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:n,areas:Se(i),$from:n})},t.type="brush",t}(Nt),ixe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.areas=[],r.brushOption={},r}return t.prototype.optionUpdated=function(r,n){var i=this.option;!n&&uZ(i,r,["inBrush","outOfBrush"]);var a=i.inBrush=i.inBrush||{};i.outOfBrush=i.outOfBrush||{color:this.option.defaultOutOfBrushColor},a.hasOwnProperty("liftZ")||(a.liftZ=5)},t.prototype.setAreas=function(r){r&&(this.areas=ae(r,function(n){return d4(this.option,n)},this))},t.prototype.setBrushOption=function(r){this.brushOption=d4(this.option,r),this.brushType=this.brushOption.brushType},t.type="brush",t.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],t.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:K.color.backgroundTint,borderColor:K.color.borderTint},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4,defaultOutOfBrushColor:K.color.disabled},t}(qe);function d4(e,t){return He({brushType:e.brushType,brushMode:e.brushMode,transformable:e.transformable,brushStyle:new Je(e.brushStyle).getItemStyle(),removeOnClick:e.removeOnClick,z:e.z},t,!0)}var axe=["rect","polygon","lineX","lineY","keep","clear"],oxe=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,i){var a,o,s;n.eachComponent({mainType:"brush"},function(l){a=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=a,this._brushMode=o,E(r.get("type",!0),function(l){r.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===a)?"emphasis":"normal")})},t.prototype.updateView=function(r,n,i){this.render(r,n,i)},t.prototype.getIcons=function(){var r=this.model,n=r.get("icon",!0),i={};return E(r.get("type",!0),function(a){n[a]&&(i[a]=n[a])}),i},t.prototype.onclick=function(r,n,i){var a=this._brushType,o=this._brushMode;i==="clear"?(n.dispatchAction({type:"axisAreaSelect",intervals:[]}),n.dispatchAction({type:"brush",command:"clear",areas:[]})):n.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:i==="keep"?a:a===i?!1:i,brushMode:i==="keep"?o==="multiple"?"single":"multiple":o}})},t.getDefaultOption=function(r){var n={show:!0,type:axe.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:r.getLocaleModel().get(["toolbox","brush","title"])};return n},t}(no);function sxe(e){e.registerComponentView(nxe),e.registerComponentModel(ixe),e.registerPreprocessor($_e),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,K_e),e.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(t,r){r.eachComponent({mainType:"brush",query:t},function(n){n.setAreas(t.areas)})}),e.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},qt),e.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},qt),Bh("brush",oxe)}var lxe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode={type:"box",ignoreSize:!0},r}return t.type="title",t.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:"center",top:K.size.m,backgroundColor:K.color.transparent,borderColor:K.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:K.color.primary},subtextStyle:{fontSize:12,color:K.color.quaternary}},t}(qe),uxe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){if(this.group.removeAll(),!!r.get("show")){var a=this.group,o=r.getModel("textStyle"),s=r.getModel("subtextStyle"),l=r.get("textAlign"),u=_e(r.get("textBaseline"),r.get("textVerticalAlign")),c=new it({style:Lt(o,{text:r.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),h=c.getBoundingRect(),f=r.get("subtext"),d=new it({style:Lt(s,{text:f,fill:s.getTextColor(),y:h.height+r.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),g=r.get("link"),m=r.get("sublink"),y=r.get("triggerEvent",!0);c.silent=!g&&!y,d.silent=!m&&!y,g&&c.on("click",function(){Sx(g,"_"+r.get("target"))}),m&&d.on("click",function(){Sx(m,"_"+r.get("subtarget"))}),Re(c).eventData=Re(d).eventData=y?{componentType:"title",componentIndex:r.componentIndex}:null,a.add(c),f&&a.add(d);var _=a.getBoundingRect(),x=r.getBoxLayoutParams();x.width=_.width,x.height=_.height;var w=Lr(r,i),S=Bt(x,w.refContainer,r.get("padding"));l||(l=r.get("left")||r.get("right"),l==="middle"&&(l="center"),l==="right"?S.x+=S.width:l==="center"&&(S.x+=S.width/2)),u||(u=r.get("top")||r.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?S.y+=S.height:u==="middle"&&(S.y+=S.height/2),u=u||"top"),a.x=S.x,a.y=S.y,a.markRedraw();var T={align:l,verticalAlign:u};c.setStyle(T),d.setStyle(T),_=a.getBoundingRect();var M=S.margin,A=r.getItemStyle(["color","opacity"]);A.fill=r.get("backgroundColor");var N=new Ye({shape:{x:_.x-M[3],y:_.y-M[0],width:_.width+M[1]+M[3],height:_.height+M[0]+M[2],r:r.get("borderRadius")},style:A,subPixelOptimize:!0,silent:!0});a.add(N)}},t.type="title",t}(Nt);function cxe(e){e.registerComponentModel(lxe),e.registerComponentView(uxe)}var v4=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.layoutMode="box",r}return t.prototype.init=function(r,n,i){this.mergeDefaultAndTheme(r,i),this._initData()},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),this._initData()},t.prototype.setCurrentIndex=function(r){r==null&&(r=this.option.currentIndex);var n=this._data.count();this.option.loop?r=(r%n+n)%n:(r>=n&&(r=n-1),r<0&&(r=0)),this.option.currentIndex=r},t.prototype.getCurrentIndex=function(){return this.option.currentIndex},t.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},t.prototype.setPlayState=function(r){this.option.autoPlay=!!r},t.prototype.getPlayState=function(){return!!this.option.autoPlay},t.prototype._initData=function(){var r=this.option,n=r.data||[],i=r.axisType,a=this._names=[],o;i==="category"?(o=[],E(n,function(u,c){var h=Cr(ld(u),""),f;Ie(u)?(f=Se(u),f.value=c):f=c,o.push(f),a.push(h)})):o=n;var s={category:"ordinal",time:"time",value:"number"}[i]||"number",l=this._data=new _n([{name:"value",type:s}],this);l.initData(o,a)},t.prototype.getData=function(){return this._data},t.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},t.type="timeline",t.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:K.size.m,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:K.color.secondary},data:[]},t}(qe),hZ=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline.slider",t.defaultOption=Bl(v4.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:K.color.border,borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:K.color.accent10},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:K.color.tertiary},itemStyle:{color:K.color.accent20,borderWidth:0},checkpointStyle:{symbol:"circle",symbolSize:15,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(0, 0, 0, 0)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10.6699C11.5 9.90014 12.3333 9.41887 13 9.80371L20.5 14.1338C21.1667 14.5187 21.1667 15.4813 20.5 15.8662L13 20.1963C12.3333 20.5811 11.5 20.0999 11.5 19.3301V10.6699Z",stopIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10C12.3284 10 13 10.6716 13 11.5V18.5C13 19.3284 12.3284 20 11.5 20C10.6716 20 10 19.3284 10 18.5V11.5C10 10.6716 10.6716 10 11.5 10ZM18.5 10C19.3284 10 20 10.6716 20 11.5V18.5C20 19.3284 19.3284 20 18.5 20C17.6716 20 17 19.3284 17 18.5V11.5C17 10.6716 17.6716 10 18.5 10Z",nextIcon:"path://M0.838834 18.7383C0.253048 18.1525 0.253048 17.2028 0.838834 16.617L7.55635 9.89949L0.838834 3.18198C0.253048 2.59619 0.253048 1.64645 0.838834 1.06066C1.42462 0.474874 2.37437 0.474874 2.96015 1.06066L10.7383 8.83883L10.8412 8.95277C11.2897 9.50267 11.2897 10.2963 10.8412 10.8462L10.7383 10.9602L2.96015 18.7383C2.37437 19.3241 1.42462 19.3241 0.838834 18.7383Z",prevIcon:"path://M10.9602 1.06066C11.5459 1.64645 11.5459 2.59619 10.9602 3.18198L4.24264 9.89949L10.9602 16.617C11.5459 17.2028 11.5459 18.1525 10.9602 18.7383C10.3744 19.3241 9.42462 19.3241 8.83883 18.7383L1.06066 10.9602L0.957771 10.8462C0.509245 10.2963 0.509245 9.50267 0.957771 8.95277L1.06066 8.83883L8.83883 1.06066C9.42462 0.474874 10.3744 0.474874 10.9602 1.06066Z",prevBtnSize:18,nextBtnSize:18,color:K.color.accent50,borderColor:K.color.accent50,borderWidth:0},emphasis:{label:{show:!0,color:K.color.accent60},itemStyle:{color:K.color.accent60,borderColor:K.color.accent60},controlStyle:{color:K.color.accent70,borderColor:K.color.accent70}},progress:{lineStyle:{color:K.color.accent30},itemStyle:{color:K.color.accent40}},data:[]}),t}(v4);vr(hZ,Sb.prototype);var hxe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline",t}(Nt),fxe=function(e){q(t,e);function t(r,n,i,a){var o=e.call(this,r,n,i)||this;return o.type=a||"value",o}return t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},t}(Ki),bT=Math.PI,p4=Ue(),dxe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(r,n){this.api=n},t.prototype.render=function(r,n,i){if(this.model=r,this.api=i,this.ecModel=n,this.group.removeAll(),r.get("show",!0)){var a=this._layout(r,i),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(a,r);r.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return _r("nameValue",{noName:!0,value:c})},E(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](a,o,l,r)},this),this._renderAxisLabel(a,s,l,r),this._position(a,r)}this._doPlayStop(),this._updateTicksStatus()},t.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},t.prototype.dispose=function(){this._clearTimer()},t.prototype._layout=function(r,n){var i=r.get(["label","position"]),a=r.get("orient"),o=vxe(r,n),s;i==null||i==="auto"?s=a==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:bT/2},h=a==="vertical"?o.height:o.width,f=r.getModel("controlStyle"),d=f.get("show",!0),g=d?f.get("itemSize"):0,m=d?f.get("itemGap"):0,y=g+m,_=r.get(["label","rotate"])||0;_=_*bT/180;var x,w,S,T=f.get("position",!0),M=d&&f.get("showPlayBtn",!0),A=d&&f.get("showPrevBtn",!0),N=d&&f.get("showNextBtn",!0),P=0,I=h;T==="left"||T==="bottom"?(M&&(x=[0,0],P+=y),A&&(w=[P,0],P+=y),N&&(S=[I-g,0],I-=y)):(M&&(x=[I-g,0],I-=y),A&&(w=[0,0],P+=y),N&&(S=[I-g,0],I-=y));var D=[P,I];return r.get("inverse")&&D.reverse(),{viewRect:o,mainLength:h,orient:a,rotation:c[a],labelRotation:_,labelPosOpt:s,labelAlign:r.get(["label","align"])||l[a],labelBaseline:r.get(["label","verticalAlign"])||r.get(["label","baseline"])||u[a],playPosition:x,prevBtnPosition:w,nextBtnPosition:S,axisExtent:D,controlSize:g,controlGap:m}},t.prototype._position=function(r,n){var i=this._mainGroup,a=this._labelGroup,o=r.viewRect;if(r.orient==="vertical"){var s=Ft(),l=o.x,u=o.y+o.height;_a(s,s,[-l,-u]),_s(s,s,-bT/2),_a(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=x(o),h=x(i.getBoundingRect()),f=x(a.getBoundingRect()),d=[i.x,i.y],g=[a.x,a.y];g[0]=d[0]=c[0][0];var m=r.labelPosOpt;if(m==null||ue(m)){var y=m==="+"?0:1;w(d,h,c,1,y),w(g,f,c,1,1-y)}else{var y=m>=0?0:1;w(d,h,c,1,y),g[1]=d[1]+m}i.setPosition(d),a.setPosition(g),i.rotation=a.rotation=r.rotation,_(i),_(a);function _(S){S.originX=c[0][0]-S.x,S.originY=c[1][0]-S.y}function x(S){return[[S.x,S.x+S.width],[S.y,S.y+S.height]]}function w(S,T,M,A,N){S[A]+=M[A][N]-T[A][N]}},t.prototype._createAxis=function(r,n){var i=n.getData(),a=n.get("axisType")||n.get("type");a!=="category"&&a!=="time"&&(a="value");var o=Td(n,a,!1);o.getTicks=function(){return i.mapArray(["value"],function(u){return{value:u}})};var s=i.getDataExtent("value");o.setExtent(s[0],s[1]),I8(o,{fixMinMax:[!0,!0]});var l=new fxe("value",o,r.axisExtent,a);return l.model=n,l},t.prototype._createGroup=function(r){var n=this[r]=new Me;return this.group.add(n),n},t.prototype._renderAxisLine=function(r,n,i,a){var o=i.getExtent();if(a.get(["lineStyle","show"])){var s=new cr({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:ee({lineCap:"round"},a.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});n.add(s);var l=this._progressLine=new cr({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:ke({lineCap:"round",lineWidth:s.style.lineWidth},a.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});n.add(l)}},t.prototype._renderAxisTick=function(r,n,i,a){var o=this,s=a.getData(),l=i.scale.getTicks();this._tickSymbols=[],E(l,function(u){var c=i.dataToCoord(u.value),h=s.getItemModel(u.value),f=h.getModel("itemStyle"),d=h.getModel(["emphasis","itemStyle"]),g=h.getModel(["progress","itemStyle"]),m={x:c,y:0,onclick:de(o._changeTimeline,o,u.value)},y=g4(h,f,n,m);y.ensureState("emphasis").style=d.getItemStyle(),y.ensureState("progress").style=g.getItemStyle(),pl(y);var _=Re(y);h.get("tooltip")?(_.dataIndex=u.value,_.dataModel=a):_.dataIndex=_.dataModel=null,o._tickSymbols.push(y)})},t.prototype._renderAxisLabel=function(r,n,i,a){var o=this,s=i.getLabelModel();if(s.get("show")){var l=a.getData(),u=i.getViewLabels();this._tickLabels=[],E(u,function(c){if(!c.tick.offInterval){var h=c.tick.value,f=l.getItemModel(h),d=f.getModel("label"),g=f.getModel(["emphasis","label"]),m=f.getModel(["progress","label"]),y=i.dataToCoord(h),_=new it({x:y,y:0,rotation:r.labelRotation-r.rotation,onclick:de(o._changeTimeline,o,h),silent:!1,style:Lt(d,{text:c.formattedLabel,align:r.labelAlign,verticalAlign:r.labelBaseline})});_.ensureState("emphasis").style=Lt(g),_.ensureState("progress").style=Lt(m),n.add(_),pl(_),p4(_).dataIndex=h,o._tickLabels.push(_)}})}},t.prototype._renderControl=function(r,n,i,a){var o=r.controlSize,s=r.rotation,l=a.getModel("controlStyle").getItemStyle(),u=a.getModel(["emphasis","controlStyle"]).getItemStyle(),c=a.getPlayState(),h=a.get("inverse",!0);f(r.nextBtnPosition,"next",de(this._changeTimeline,this,h?"-":"+")),f(r.prevBtnPosition,"prev",de(this._changeTimeline,this,h?"+":"-")),f(r.playPosition,c?"stop":"play",de(this._handlePlayClick,this,!c),!0);function f(d,g,m,y){if(d){var _=lo(_e(a.get(["controlStyle",g+"BtnSize"]),o),o),x=[0,-_/2,_,_],w=pxe(a,g+"Icon",x,{x:d[0],y:d[1],originX:o/2,originY:0,rotation:y?-s:0,rectHover:!0,style:l,onclick:m});w.ensureState("emphasis").style=u,n.add(w),pl(w)}}},t.prototype._renderCurrentPointer=function(r,n,i,a){var o=a.getData(),s=a.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(h){h.draggable=!0,h.drift=de(u._handlePointerDrag,u),h.ondragend=de(u._handlePointerDragend,u),m4(h,u._progressLine,s,i,a,!0)},onUpdate:function(h){m4(h,u._progressLine,s,i,a)}};this._currentPointer=g4(l,l,this._mainGroup,{},this._currentPointer,c)},t.prototype._handlePlayClick=function(r){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:r,from:this.uid})},t.prototype._handlePointerDrag=function(r,n,i){this._clearTimer(),this._pointerChangeTimeline([i.offsetX,i.offsetY])},t.prototype._handlePointerDragend=function(r){this._pointerChangeTimeline([r.offsetX,r.offsetY],!0)},t.prototype._pointerChangeTimeline=function(r,n){var i=this._toAxisCoord(r)[0],a=this._axis,o=Ur(a.getExtent().slice());i>o[1]&&(i=o[1]),i=0&&(s[o]=+s[o].toFixed(g)),[s,d]}var E0={min:Ze(D0,"min"),max:Ze(D0,"max"),average:Ze(D0,"average"),median:Ze(D0,"median")};function zg(e,t){if(t){var r=e.getData(),n=e.coordinateSystem,i=n&&n.dimensions;if(!bxe(t)&&!ne(t.coord)&&ne(i)){var a=fZ(t,r,n,e);if(t=Se(t),t.type&&E0[t.type]&&a.baseAxis&&a.valueAxis){var o=Be(i,a.baseAxis.dim),s=Be(i,a.valueAxis.dim),l=E0[t.type](r,a.valueAxis.dim,a.baseDataDim,a.valueDataDim,o,s);t.coord=l[0],t.value=l[1]}else t.coord=[t.xAxis!=null?t.xAxis:t.radiusAxis,t.yAxis!=null?t.yAxis:t.angleAxis]}if(t.coord==null||!ne(i)){t.coord=[];var u=e.getBaseAxis();if(u&&t.type&&E0[t.type]){var c=n.getOtherAxis(u);c&&(t.value=v1(r,r.mapDimension(c.dim),t.type))}}else for(var h=t.coord,f=0;f<2;f++)E0[h[f]]&&(h[f]=v1(r,r.mapDimension(i[f]),h[f]));return t}}function fZ(e,t,r,n){var i={};return e.valueIndex!=null||e.valueDim!=null?(i.valueDataDim=e.valueIndex!=null?t.getDimension(e.valueIndex):e.valueDim,i.valueAxis=r.getAxis(wxe(n,i.valueDataDim)),i.baseAxis=r.getOtherAxis(i.valueAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim)):(i.baseAxis=n.getBaseAxis(),i.valueAxis=r.getOtherAxis(i.baseAxis),i.baseDataDim=t.mapDimension(i.baseAxis.dim),i.valueDataDim=t.mapDimension(i.valueAxis.dim)),i}function wxe(e,t){var r=e.getData().getDimensionInfo(t);return r&&r.coordDim}function Bg(e,t){return e&&e.containData&&t.coord&&!FA(t)?e.containData(t.coord):!0}function Sxe(e,t,r){return e&&e.containZone&&t.coord&&r.coord&&!FA(t)&&!FA(r)?e.containZone(t.coord,r.coord):!0}function dZ(e,t){return e?function(r,n,i,a){var o=a<2?r.coord&&r.coord[a]:r.value;return gl(o,t[a])}:function(r,n,i,a){return gl(r.value,t[a])}}function v1(e,t,r){if(r==="average"){var n=0,i=0;return e.each(t,function(a,o){isNaN(a)||(n+=a,i++)}),n/i}else return r==="median"?e.getMedian(t):e.getDataExtent(t)[r==="max"?1:0]}var wT=Ue(),QN=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.init=function(){this.markerGroupMap=pe()},t.prototype.render=function(r,n,i){var a=this,o=this.markerGroupMap;o.each(function(s){wT(s).keep=!1}),n.eachSeries(function(s){var l=mo.getMarkerModelFromSeries(s,a.type);l&&a.renderSeries(s,l,n,i)}),o.each(function(s){!wT(s).keep&&a.group.remove(s.group)}),Cxe(n,o,this.type)},t.prototype.markKeep=function(r){wT(r).keep=!0},t.prototype.toggleBlurSeries=function(r,n){var i=this;E(r,function(a){var o=mo.getMarkerModelFromSeries(a,i.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(n?VG(l):PL(l))})}})},t.type="marker",t}(Nt);function Cxe(e,t,r){e.eachSeries(function(n){var i=mo.getMarkerModelFromSeries(n,r),a=t.get(n.id);if(i&&a&&a.group){var o=_c(i),s=o.z,l=o.zlevel;yb(a.group,s,l)}})}function _4(e,t,r){var n=t.coordinateSystem,i=r.getWidth(),a=r.getHeight(),o=n&&n.getArea&&n.getArea();e.each(function(s){var l=e.getItemModel(s),u=l.get("relativeTo")==="coordinate",c=u?o?o.width:0:i,h=u?o?o.height:0:a,f=u&&o?o.x:0,d=u&&o?o.y:0,g,m=he(l.get("x"),c)+f,y=he(l.get("y"),h)+d;if(!isNaN(m)&&!isNaN(y))g=[m,y];else if(t.getMarkerPosition)g=t.getMarkerPosition(e.getValues(e.dimensions,s));else if(n){var _=e.get(n.dimensions[0],s),x=e.get(n.dimensions[1],s);g=n.dataToPoint([_,x])}isNaN(m)||(g[0]=m),isNaN(y)||(g[1]=y),e.setItemLayout(s,g)})}var Txe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,i){n.eachSeries(function(a){var o=mo.getMarkerModelFromSeries(a,"markPoint");o&&(_4(o.getData(),a,i),this.markerGroupMap.get(a.id).updateLayout())},this)},t.prototype.renderSeries=function(r,n,i,a){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new dm),h=Mxe(o,r,n);n.setData(h),_4(n.getData(),r,a),h.each(function(f){var d=h.getItemModel(f),g=d.getShallow("symbol"),m=d.getShallow("symbolSize"),y=d.getShallow("symbolRotate"),_=d.getShallow("symbolOffset"),x=d.getShallow("symbolKeepAspect");if(Ce(g)||Ce(m)||Ce(y)||Ce(_)){var w=n.getRawValue(f),S=n.getDataParams(f);Ce(g)&&(g=g(w,S)),Ce(m)&&(m=m(w,S)),Ce(y)&&(y=y(w,S)),Ce(_)&&(_=_(w,S))}var T=d.getModel("itemStyle").getItemStyle(),M=d.get("z2"),A=sm(l,"color");T.fill||(T.fill=A),h.setItemVisual(f,{z2:_e(M,0),symbol:g,symbolSize:m,symbolRotate:y,symbolOffset:_,symbolKeepAspect:x,style:T})}),c.updateData(h),this.group.add(c.group),h.eachItemGraphicEl(function(f){f.traverse(function(d){Re(d).dataModel=n})}),this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markPoint",t}(QN);function Mxe(e,t,r){var n;e?n=ae(e&&e.dimensions,function(s){var l=t.getData(),u=l.getDimensionInfo(l.mapDimension(s))||{};return ee(ee({},u),{name:s,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var i=new _n(n,r),a=ae(r.get("data"),Ze(zg,t));e&&(a=mt(a,Ze(Bg,e)));var o=dZ(!!e,n);return i.initData(a,null,o),i}function Axe(e){e.registerComponentModel(xxe),e.registerComponentView(Txe),e.registerPreprocessor(function(t){JN(t.series,"markPoint")&&(t.markPoint=t.markPoint||{})})}var kxe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,i){return new t(r,n,i)},t.type="markLine",t.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},t}(mo),R0=Ue(),Lxe=function(e,t,r,n){var i=e.getData(),a;if(ne(n))a=n;else{var o=n.type;if(o==="min"||o==="max"||o==="average"||o==="median"||n.xAxis!=null||n.yAxis!=null){var s=void 0,l=void 0;if(n.yAxis!=null||n.xAxis!=null)s=t.getAxis(n.yAxis!=null?"y":"x"),l=mn(n.yAxis,n.xAxis);else{var u=fZ(n,i,t,e);s=u.valueAxis;var c=AI(i,u.valueDataDim);l=v1(i,c,o)}var h=s.dim==="x"?0:1,f=1-h,d=Se(n),g={coord:[]};d.type=null,d.coord=[],d.coord[f]=-1/0,g.coord[f]=1/0;var m=r.get("precision");m>=0&&at(l)&&(l=+l.toFixed(Math.min(m,20))),d.coord[h]=g.coord[h]=l,a=[d,g,{type:o,valueIndex:n.valueIndex,value:l}]}else a=[]}var y=[zg(e,a[0]),zg(e,a[1]),ee({},a[2])];return y[2].type=y[2].type||null,He(y[2],y[0]),He(y[2],y[1]),y};function p1(e){return!isNaN(e)&&!isFinite(e)}function x4(e,t,r,n){var i=1-e,a=n.dimensions[e];return p1(t[i])&&p1(r[i])&&t[e]===r[e]&&n.getAxis(a).containData(t[e])}function Ixe(e,t){if(e.type==="cartesian2d"){var r=t[0].coord,n=t[1].coord;if(r&&n&&(x4(1,r,n,e)||x4(0,r,n,e)))return!0}return Bg(e,t[0])&&Bg(e,t[1])}function ST(e,t,r,n,i){var a=n.coordinateSystem,o=e.getItemModel(t),s,l=he(o.get("x"),i.getWidth()),u=he(o.get("y"),i.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition)s=n.getMarkerPosition(e.getValues(e.dimensions,t));else{var c=a.dimensions,h=e.get(c[0],t),f=e.get(c[1],t);s=a.dataToPoint([h,f])}if(Mc(a,"cartesian2d")){var d=a.getAxis("x"),g=a.getAxis("y"),c=a.dimensions;p1(e.get(c[0],t))?s[0]=d.toGlobalCoord(d.getExtent()[r?0:1]):p1(e.get(c[1],t))&&(s[1]=g.toGlobalCoord(g.getExtent()[r?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}e.setItemLayout(t,s)}var Nxe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,i){n.eachSeries(function(a){var o=mo.getMarkerModelFromSeries(a,"markLine");if(o){var s=o.getData(),l=R0(o).from,u=R0(o).to;l.each(function(c){ST(l,c,!0,a,i),ST(u,c,!1,a,i)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(a.id).updateLayout()}},this)},t.prototype.renderSeries=function(r,n,i,a){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new mN);this.group.add(c.group);var h=Pxe(o,r,n),f=h.from,d=h.to,g=h.line;R0(n).from=f,R0(n).to=d,n.setData(g);var m=n.get("symbol"),y=n.get("symbolSize"),_=n.get("symbolRotate"),x=n.get("symbolOffset");ne(m)||(m=[m,m]),ne(y)||(y=[y,y]),ne(_)||(_=[_,_]),ne(x)||(x=[x,x]),h.from.each(function(S){w(f,S,!0),w(d,S,!1)}),g.each(function(S){var T=g.getItemModel(S),M=T.getModel("lineStyle").getLineStyle();g.setItemLayout(S,[f.getItemLayout(S),d.getItemLayout(S)]);var A=T.get("z2");M.stroke==null&&(M.stroke=f.getItemVisual(S,"style").fill),g.setItemVisual(S,{z2:_e(A,0),fromSymbolKeepAspect:f.getItemVisual(S,"symbolKeepAspect"),fromSymbolOffset:f.getItemVisual(S,"symbolOffset"),fromSymbolRotate:f.getItemVisual(S,"symbolRotate"),fromSymbolSize:f.getItemVisual(S,"symbolSize"),fromSymbol:f.getItemVisual(S,"symbol"),toSymbolKeepAspect:d.getItemVisual(S,"symbolKeepAspect"),toSymbolOffset:d.getItemVisual(S,"symbolOffset"),toSymbolRotate:d.getItemVisual(S,"symbolRotate"),toSymbolSize:d.getItemVisual(S,"symbolSize"),toSymbol:d.getItemVisual(S,"symbol"),style:M})}),c.updateData(g),h.line.eachItemGraphicEl(function(S){Re(S).dataModel=n,S.traverse(function(T){Re(T).dataModel=n})});function w(S,T,M){var A=S.getItemModel(T);ST(S,T,M,r,a);var N=A.getModel("itemStyle").getItemStyle();N.fill==null&&(N.fill=sm(l,"color")),S.setItemVisual(T,{symbolKeepAspect:A.get("symbolKeepAspect"),symbolOffset:_e(A.get("symbolOffset",!0),x[M?0:1]),symbolRotate:_e(A.get("symbolRotate",!0),_[M?0:1]),symbolSize:_e(A.get("symbolSize"),y[M?0:1]),symbol:_e(A.get("symbol",!0),m[M?0:1]),style:N})}this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markLine",t}(QN);function Pxe(e,t,r){var n;e?n=ae(e&&e.dimensions,function(u){var c=t.getData(),h=c.getDimensionInfo(c.mapDimension(u))||{};return ee(ee({},h),{name:u,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var i=new _n(n,r),a=new _n(n,r),o=new _n([],r),s=ae(r.get("data"),Ze(Lxe,t,e,r));e&&(s=mt(s,Ze(Ixe,e)));var l=dZ(!!e,n);return i.initData(ae(s,function(u){return u[0]}),null,l),a.initData(ae(s,function(u){return u[1]}),null,l),o.initData(ae(s,function(u){return u[2]})),o.hasItemOption=!0,{from:i,to:a,line:o}}function Dxe(e){e.registerComponentModel(kxe),e.registerComponentView(Nxe),e.registerPreprocessor(function(t){JN(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var Exe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.createMarkerModelFromSeries=function(r,n,i){return new t(r,n,i)},t.type="markArea",t.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},t}(mo),j0=Ue(),Rxe=function(e,t,r,n){var i=n[0],a=n[1];if(!(!i||!a)){var o=zg(e,i),s=zg(e,a),l=o.coord,u=s.coord;l[0]=mn(l[0],-1/0),l[1]=mn(l[1],-1/0),u[0]=mn(u[0],1/0),u[1]=mn(u[1],1/0);var c=J1([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function g1(e){return!isNaN(e)&&!isFinite(e)}function b4(e,t,r,n){var i=1-e;return g1(t[i])&&g1(r[i])}function jxe(e,t){var r=t.coord[0],n=t.coord[1],i={coord:r,x:t.x0,y:t.y0},a={coord:n,x:t.x1,y:t.y1};return Mc(e,"cartesian2d")?r&&n&&(b4(1,r,n)||b4(0,r,n))?!0:Sxe(e,i,a):Bg(e,i)||Bg(e,a)}function w4(e,t,r,n,i){var a=n.coordinateSystem,o=e.getItemModel(t),s,l=he(o.get(r[0]),i.getWidth()),u=he(o.get(r[1]),i.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition){var c=e.getValues(["x0","y0"],t),h=e.getValues(["x1","y1"],t),f=a.clampData(c),d=a.clampData(h),g=[];r[0]==="x0"?g[0]=f[0]>d[0]?h[0]:c[0]:g[0]=f[0]>d[0]?c[0]:h[0],r[1]==="y0"?g[1]=f[1]>d[1]?h[1]:c[1]:g[1]=f[1]>d[1]?c[1]:h[1],s=n.getMarkerPosition(g,r,!0)}else{var m=e.get(r[0],t),y=e.get(r[1],t),_=[m,y];a.clampData&&a.clampData(_,_),s=a.dataToPoint(_,!0)}if(Mc(a,"cartesian2d")){var x=a.getAxis("x"),w=a.getAxis("y"),m=e.get(r[0],t),y=e.get(r[1],t);g1(m)?s[0]=x.toGlobalCoord(x.getExtent()[r[0]==="x0"?0:1]):g1(y)&&(s[1]=w.toGlobalCoord(w.getExtent()[r[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var S4=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],Oxe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.updateTransform=function(r,n,i){n.eachSeries(function(a){var o=mo.getMarkerModelFromSeries(a,"markArea");if(o){var s=o.getData();s.each(function(l){var u=ae(S4,function(h){return w4(s,l,h,a,i)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},t.prototype.renderSeries=function(r,n,i,a){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new Me});this.group.add(c.group),this.markKeep(c);var h=zxe(o,r,n);n.setData(h),h.each(function(f){var d=ae(S4,function(I){return w4(h,f,I,r,a)}),g=o.getAxis("x").scale,m=o.getAxis("y").scale,y=g.getExtent(),_=m.getExtent(),x=[g.parse(h.get("x0",f)),g.parse(h.get("x1",f))],w=[m.parse(h.get("y0",f)),m.parse(h.get("y1",f))];Ur(x),Ur(w);var S=!(y[0]>x[1]||y[1]w[1]||_[1]=0},t.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},t.type="legend.plain",t.dependencies=["series"],t.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",bottom:K.size.m,align:"auto",backgroundColor:K.color.transparent,borderColor:K.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:K.color.disabled,inactiveBorderColor:K.color.disabled,inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:K.color.disabled,inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:K.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:K.color.tertiary,borderWidth:1,borderColor:K.color.border},emphasis:{selectorLabel:{show:!0,color:K.color.quaternary}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},t}(qe),Nh=Ze,GA=E,O0=Me,vZ=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.newlineDisabled=!1,r}return t.prototype.init=function(){this.group.add(this._contentGroup=new O0),this.group.add(this._selectorGroup=new O0),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(r,n,i){var a=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!r.get("show",!0)){var o=r.get("align"),s=r.get("orient");(!o||o==="auto")&&(o=r.get("left")==="right"&&s==="vertical"?"right":"left");var l=r.get("selector",!0),u=r.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,r,n,i,l,s,u);var c=Lr(r,i).refContainer,h=r.getBoxLayoutParams(),f=r.get("padding"),d=Bt(h,c,f),g=this.layoutInner(r,o,d,a,l,u),m=Bt(ke({width:g.width,height:g.height},h),c,f);this.group.x=m.x-g.x,this.group.y=m.y-g.y,this.group.markRedraw(),this.group.add(this._backgroundEl=rZ(g,r))}},t.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},t.prototype.renderInner=function(r,n,i,a,o,s,l){var u=this.getContentGroup(),c=pe(),h=n.get("selectedMode"),f=n.get("triggerEvent"),d=[];i.eachRawSeries(function(g){!g.get("legendHoverLink")&&d.push(g.id)}),GA(n.getData(),function(g,m){var y=this,_=g.get("name");if(!this.newlineDisabled&&(_===""||_===` -`)){var x=new O0;x.newline=!0,u.add(x);return}var w=i.getSeriesByName(_)[0];if(!c.get(_))if(w){var S=w.getData(),T=S.getVisual("legendLineStyle")||{},M=S.getVisual("legendIcon"),A=S.getVisual("style"),N=this._createItem(w,_,m,g,n,r,T,A,M,h,a);N.on("click",Nh(C4,_,null,a,d)).on("mouseover",Nh(HA,w.name,null,a,d)).on("mouseout",Nh(UA,w.name,null,a,d)),i.ssr&&N.eachChild(function(P){var I=Re(P);I.seriesIndex=w.seriesIndex,I.dataIndex=m,I.ssrType="legend"}),f&&N.eachChild(function(P){y.packEventData(P,n,w,m,_)}),c.set(_,!0)}else i.eachRawSeries(function(P){var I=this;if(!c.get(_)&&P.legendVisualProvider){var D=P.legendVisualProvider;if(!D.containName(_))return;var O=D.indexOfName(_),j=D.getItemVisual(O,"style"),B=D.getItemVisual(O,"legendIcon"),U=yn(j.fill);U&&U[3]===0&&(U[3]=.2,j=ee(ee({},j),{fill:Oi(U,"rgba")}));var H=this._createItem(P,_,m,g,n,r,{},j,B,h,a);H.on("click",Nh(C4,null,_,a,d)).on("mouseover",Nh(HA,null,_,a,d)).on("mouseout",Nh(UA,null,_,a,d)),i.ssr&&H.eachChild(function(V){var z=Re(V);z.seriesIndex=P.seriesIndex,z.dataIndex=m,z.ssrType="legend"}),f&&H.eachChild(function(V){I.packEventData(V,n,P,m,_)}),c.set(_,!0)}},this)},this),o&&this._createSelector(o,n,a,s,l)},t.prototype.packEventData=function(r,n,i,a,o){var s={componentType:"legend",componentIndex:n.componentIndex,dataIndex:a,value:o,seriesIndex:i.seriesIndex};Re(r).eventData=s},t.prototype._createSelector=function(r,n,i,a,o){var s=this.getSelectorGroup();GA(r,function(u){var c=u.type,h=new it({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){i.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect",legendId:n.id})}});s.add(h);var f=n.getModel("selectorLabel"),d=n.getModel(["emphasis","selectorLabel"]);Or(h,{normal:f,emphasis:d},{defaultText:u.title}),pl(h)})},t.prototype._createItem=function(r,n,i,a,o,s,l,u,c,h,f){var d=r.visualDrawType,g=o.get("itemWidth"),m=o.get("itemHeight"),y=o.isSelected(n),_=a.get("symbolRotate"),x=a.get("symbolKeepAspect"),w=a.get("icon");c=w||c||"roundRect";var S=Vxe(c,a,l,u,d,y,f),T=new O0,M=a.getModel("textStyle");if(Ce(r.getLegendIcon)&&(!w||w==="inherit"))T.add(r.getLegendIcon({itemWidth:g,itemHeight:m,icon:c,iconRotate:_,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:x}));else{var A=w==="inherit"&&r.getData().getVisual("symbol")?_==="inherit"?r.getData().getVisual("symbolRotate"):_:0;T.add(Gxe({itemWidth:g,itemHeight:m,icon:c,iconRotate:A,itemStyle:S.itemStyle,symbolKeepAspect:x}))}var N=s==="left"?g+5:-5,P=s,I=o.get("formatter"),D=n;ue(I)&&I?D=I.replace("{name}",n??""):Ce(I)&&(D=I(n));var O=y?M.getTextColor():a.get("inactiveColor");T.add(new it({style:Lt(M,{text:D,x:N,y:m/2,fill:O,align:P,verticalAlign:"middle"},{inheritColor:O})}));var j=new Ye({shape:T.getBoundingRect(),style:{fill:"transparent"}}),B=a.getModel("tooltip");return B.get("show")&&bs({el:j,componentModel:o,itemName:n,itemTooltipOption:B.option}),T.add(j),T.eachChild(function(U){U.silent=!0}),j.silent=!h,this.getContentGroup().add(T),pl(T),T.__legendDataIndex=i,T},t.prototype.layoutInner=function(r,n,i,a,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();Ju(r.get("orient"),l,r.get("itemGap"),i.width,i.height);var c=l.getBoundingRect(),h=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){Ju("horizontal",u,r.get("selectorItemGap",!0));var f=u.getBoundingRect(),d=[-f.x,-f.y],g=r.get("selectorButtonGap",!0),m=r.getOrient().index,y=m===0?"width":"height",_=m===0?"height":"width",x=m===0?"y":"x";s==="end"?d[m]+=c[y]+g:h[m]+=f[y]+g,d[1-m]+=c[_]/2-f[_]/2,u.x=d[0],u.y=d[1],l.x=h[0],l.y=h[1];var w={x:0,y:0};return w[y]=c[y]+g+f[y],w[_]=Math.max(c[_],f[_]),w[x]=Math.min(0,f[x]+d[1-m]),w}else return l.x=h[0],l.y=h[1],this.group.getBoundingRect()},t.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},t.type="legend.plain",t}(Nt);function Vxe(e,t,r,n,i,a,o){function s(y,_){y.lineWidth==="auto"&&(y.lineWidth=_.lineWidth>0?2:0),GA(y,function(x,w){y[w]==="inherit"&&(y[w]=_[w])})}var l=t.getModel("itemStyle"),u=l.getItemStyle(),c=e.lastIndexOf("empty",0)===0?"fill":"stroke",h=l.getShallow("decal");u.decal=!h||h==="inherit"?n.decal:Vf(h,o),u.fill==="inherit"&&(u.fill=n[i]),u.stroke==="inherit"&&(u.stroke=n[c]),u.opacity==="inherit"&&(u.opacity=(i==="fill"?n:r).opacity),s(u,n);var f=t.getModel("lineStyle"),d=f.getLineStyle();if(s(d,r),u.fill==="auto"&&(u.fill=n.fill),u.stroke==="auto"&&(u.stroke=n.fill),d.stroke==="auto"&&(d.stroke=n.fill),!a){var g=t.get("inactiveBorderWidth"),m=u[c];u.lineWidth=g==="auto"?n.lineWidth>0&&m?2:0:u.lineWidth,u.fill=t.get("inactiveColor"),u.stroke=t.get("inactiveBorderColor"),d.stroke=f.get("inactiveColor"),d.lineWidth=f.get("inactiveWidth")}return{itemStyle:u,lineStyle:d}}function Gxe(e){var t=e.icon||"roundRect",r=dr(t,0,0,e.itemWidth,e.itemHeight,e.itemStyle.fill,e.symbolKeepAspect);return r.setStyle(e.itemStyle),r.rotation=(e.iconRotate||0)*Math.PI/180,r.setOrigin([e.itemWidth/2,e.itemHeight/2]),t.indexOf("empty")>-1&&(r.style.stroke=r.style.fill,r.style.fill=K.color.neutral00,r.style.lineWidth=2),r}function C4(e,t,r,n){UA(e,t,r,n),r.dispatchAction({type:"legendToggleSelect",name:e??t}),HA(e,t,r,n)}function HA(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"highlight",seriesName:e,name:t,excludeSeriesId:n})}function UA(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"downplay",seriesName:e,name:t,excludeSeriesId:n})}function jv(e,t,r){var n=e==="allSelect"||e==="inverseSelect",i={},a=[];r.eachComponent({mainType:"legend",query:t},function(s){n?s[e]():s[e](t.name),T4(s,i),a.push(s.componentIndex)});var o={};return r.eachComponent("legend",function(s){E(i,function(l,u){s[l?"select":"unSelect"](u)}),T4(s,o)}),n?{selected:o,legendIndex:a}:{name:t.name,selected:o}}function T4(e,t){var r=t||{};return E(e.getData(),function(n){var i=n.get("name");if(!(i===` -`||i==="")){var a=e.isSelected(i);ge(r,i)?r[i]=r[i]&&a:r[i]=a}}),r}function Hxe(e){e.registerAction("legendToggleSelect","legendselectchanged",Ze(jv,"toggleSelected")),e.registerAction("legendAllSelect","legendselectall",Ze(jv,"allSelect")),e.registerAction("legendInverseSelect","legendinverseselect",Ze(jv,"inverseSelect")),e.registerAction("legendSelect","legendselected",Ze(jv,"select")),e.registerAction("legendUnSelect","legendunselected",Ze(jv,"unSelect"))}var Uxe=Qg(Wxe);function Wxe(e){var t=e.findComponents({mainType:"legend"});t&&t.length&&e.filterSeries(function(r){for(var n=0;ni[o],y=[-d.x,-d.y];n||(y[a]=c[u]);var _=[0,0],x=[-g.x,-g.y],w=_e(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(m){var S=r.get("pageButtonPosition",!0);S==="end"?x[a]+=i[o]-g[o]:_[a]+=g[o]+w}x[1-a]+=d[s]/2-g[s]/2,c.setPosition(y),h.setPosition(_),f.setPosition(x);var T={x:0,y:0};if(T[o]=m?i[o]:d[o],T[s]=Math.max(d[s],g[s]),T[l]=Math.min(0,g[l]+x[1-a]),h.__rectSize=i[o],m){var M={x:0,y:0};M[o]=Math.max(i[o]-g[o]-w,0),M[s]=T[s],h.setClipPath(new Ye({shape:M})),h.__rectSize=M[o]}else f.eachChild(function(N){N.attr({invisible:!0,silent:!0})});var A=this._getPageInfo(r);return A.pageIndex!=null&<(c,{x:A.contentPosition[0],y:A.contentPosition[1]},m?r:null),this._updatePageInfoView(r,A),T},t.prototype._pageGo=function(r,n,i){var a=this._getPageInfo(n)[r];a!=null&&i.dispatchAction({type:"legendScroll",scrollDataIndex:a,legendId:n.id})},t.prototype._updatePageInfoView=function(r,n){var i=this._controllerGroup;E(["pagePrev","pageNext"],function(c){var h=c+"DataIndex",f=n[h]!=null,d=i.childOfName(c);d&&(d.setStyle("fill",f?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),d.cursor=f?"pointer":"default")});var a=i.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;a&&o&&a.setStyle("text",ue(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},t.prototype._getPageInfo=function(r){var n=r.get("scrollDataIndex",!0),i=this.getContentGroup(),a=this._containerGroup.__rectSize,o=r.getOrient().index,s=CT[o],l=TT[o],u=this._findTargetItemIndex(n),c=i.children(),h=c[u],f=c.length,d=f?1:0,g={contentPosition:[i.x,i.y],pageCount:d,pageIndex:d-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return g;var m=S(h);g.contentPosition[o]=-m.s;for(var y=u+1,_=m,x=m,w=null;y<=f;++y)w=S(c[y]),(!w&&x.e>_.s+a||w&&!T(w,_.s))&&(x.i>_.i?_=x:_=w,_&&(g.pageNextDataIndex==null&&(g.pageNextDataIndex=_.i),++g.pageCount)),x=w;for(var y=u-1,_=m,x=m,w=null;y>=-1;--y)w=S(c[y]),(!w||!T(x,w.s))&&_.i=A&&M.s<=A+a}},t.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,i=this.getContentGroup(),a;return i.eachChild(function(o,s){var l=o.__legendDataIndex;a==null&&l!=null&&(a=s),l===r&&(n=s)}),n??a},t.type="legend.scroll",t}(vZ);function Yxe(e){e.registerAction("legendScroll","legendscroll",function(t,r){var n=t.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:t},function(i){i.setScrollDataIndex(n)})})}function Xxe(e){We(pZ),e.registerComponentModel(Zxe),e.registerComponentView($xe),Yxe(e)}function qxe(e){We(pZ),We(Xxe)}var Kxe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.inside",t.defaultOption=Bl(Og.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(Og),eP=Ue();function Jxe(e,t,r){eP(e).coordSysRecordMap.each(function(n){var i=n.dataZoomInfoMap.get(t.uid);i&&(i.getRange=r)})}function Qxe(e,t){for(var r=eP(e).coordSysRecordMap,n=r.keys(),i=0;ia[i+n]&&(n=h),o=o&&c.get("preventDefaultMouseMove",!0),s=_e(c.get("cursorGrab",!0),s),l=_e(c.get("cursorGrabbing",!0),l)}),{controlType:n,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:r,zInfo:{component:t.model},triggerInfo:{roamTrigger:null,isInSelf:t.containsPoint},cursorGrab:s,cursorGrabbing:l}}}function i1e(e){e.registerUpdateLifecycle("coordsys:aftercreate",function(t,r){var n=eP(r),i=n.coordSysRecordMap||(n.coordSysRecordMap=pe());i.each(function(a){a.dataZoomInfoMap=null}),t.eachComponent({mainType:"dataZoom",subType:"inside"},function(a){var o=K9(a);E(o.infoList,function(s){var l=s.model.uid,u=i.get(l)||i.set(l,e1e(r,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=pe());c.set(a.uid,{dzReferCoordSysInfo:s,model:a,getRange:null})})}),i.each(function(a){var o=a.controller,s,l=a.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){gZ(i,a);return}var c=n1e(l,a,r);o.enable(c.controlType,c.opt),bd(a,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var a1e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type="dataZoom.inside",r}return t.prototype.render=function(r,n,i){if(e.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),Jxe(i,r,{pan:de(MT.pan,this),zoom:de(MT.zoom,this),scrollMove:de(MT.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){Qxe(this.api,this.dataZoomModel),this.range=null},t.type="dataZoom.inside",t}(ZN),MT={zoom:function(e,t,r,n){var i=this.range,a=i.slice(),o=e.axisModels[0];if(o){var s=AT[t](null,[n.originX,n.originY],o,r,e),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],u=Math.max(1/n.scale,0);a[0]=(a[0]-l)*u+l,a[1]=(a[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Ll(0,a,[0,100],0,c.minSpan,c.maxSpan),this.range=a,i[0]!==a[0]||i[1]!==a[1])return a}},pan:k4(function(e,t,r,n,i,a){var o=AT[n]([a.oldX,a.oldY],[a.newX,a.newY],t,i,r);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:k4(function(e,t,r,n,i,a){var o=AT[n]([0,0],[a.scrollDelta,a.scrollDelta],t,i,r);return o.signal*(e[1]-e[0])*a.scrollDelta})};function k4(e){return function(t,r,n,i){var a=this.range,o=a.slice(),s=t.axisModels[0];if(s){var l=e(o,s,t,r,n,i);if(Ll(l,o,[0,100],"all"),this.range=o,a[0]!==o[0]||a[1]!==o[1])return o}}}var AT={grid:function(e,t,r,n,i){var a=r.axis,o={},s=i.model.coordinateSystem.getRect();return e=e||[0,0],a.dim==="x"?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=a.inverse?-1:1),o},polar:function(e,t,r,n,i){var a=r.axis,o={},s=i.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return e=e?s.pointToCoord(e):[0,0],t=s.pointToCoord(t),r.mainType==="radiusAxis"?(o.pixel=t[0]-e[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=a.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=a.inverse?-1:1),o},singleAxis:function(e,t,r,n,i){var a=r.axis,o=i.model.coordinateSystem.getRect(),s={};return e=e||[0,0],a.orient==="horizontal"?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=a.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=a.inverse?-1:1),s}};function mZ(e){$N(e),e.registerComponentModel(Kxe),e.registerComponentView(a1e),i1e(e)}var o1e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="dataZoom.slider",t.layoutMode="box",t.defaultOption=Bl(Og.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:K.color.accent10,borderRadius:0,backgroundColor:K.color.transparent,dataBackground:{lineStyle:{color:K.color.accent30,width:.5},areaStyle:{color:K.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:K.color.accent40,width:.5},areaStyle:{color:K.color.accent20,opacity:.3}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:K.color.neutral00,borderColor:K.color.accent20},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:K.color.accent40,opacity:.5},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:K.color.tertiary},brushSelect:!0,brushStyle:{color:K.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:K.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),t}(Og),Ov=Ye,s1e=1,kT=30,l1e=7,zv="horizontal",L4="vertical",u1e=5,c1e=["line","bar","candlestick","scatter"],h1e={easing:"cubicOut",duration:100,delay:0},f1e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._displayables={},r}return t.prototype.init=function(r,n){this.api=n,this._onBrush=de(this._onBrush,this),this._onBrushEnd=de(this._onBrushEnd,this)},t.prototype.render=function(r,n,i,a){if(e.prototype.render.apply(this,arguments),bd(this,"_dispatchZoomAction",r.get("throttle"),"fixRate"),this._orient=r.getOrient(),r.get("show")===!1){this.group.removeAll();return}if(r.noTarget()){this._clear(),this.group.removeAll();return}(!a||a.type!=="dataZoom"||a.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){dg(this,"_dispatchZoomAction");var r=this.api.getZr();r.off("mousemove",this._onBrush),r.off("mouseup",this._onBrushEnd)},t.prototype._buildView=function(){var r=this.group;r.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var n=this._displayables.sliderGroup=new Me;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),r.add(n),this._positionGroup()},t.prototype._resetLocation=function(){var r=this.dataZoomModel,n=this.api,i=r.get("brushSelect"),a=i?l1e:0,o=Lr(r,n).refContainer,s=this._findCoordRect(),l=r.get("defaultLocationEdgeGap",!0)||0,u=this._orient===zv?{right:o.width-s.x-s.width,top:o.height-kT-l-a,width:s.width,height:kT}:{right:l,top:s.y,width:kT,height:s.height},c=$c(r.option);E(["right","top","width","height"],function(f){c[f]==="ph"&&(c[f]=u[f])});var h=Bt(c,o);this._location={x:h.x,y:h.y},this._size=[h.width,h.height],this._orient===L4&&this._size.reverse()},t.prototype._positionGroup=function(){var r=this.group,n=this._location,i=this._orient,a=this.dataZoomModel.getFirstTargetAxisModel(),o=a&&a.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(i===zv&&!o?{scaleY:l?1:-1,scaleX:1}:i===zv&&o?{scaleY:l?1:-1,scaleX:-1}:i===L4&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=r.getBoundingRect([s]),c=isNaN(u.x)?0:u.x,h=isNaN(u.y)?0:u.y;r.x=n.x-c,r.y=n.y-h,r.markRedraw()},t.prototype._getViewExtent=function(){return[0,this._size[0]]},t.prototype._renderBackground=function(){var r=this.dataZoomModel,n=this._size,i=this._displayables.sliderGroup,a=r.get("brushSelect");i.add(new Ov({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:r.get("backgroundColor")},z2:-40}));var o=new Ov({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:de(this._onClickPanel,this)}),s=this.api.getZr();a?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),i.add(o)},t.prototype._renderDataShadow=function(){var r=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!r)return;var n=this._size,i=this._shadowSize||[],a=r.series,o=a.getRawData(),s=a.getShadowDim&&a.getShadowDim(),l=s&&o.getDimensionInfo(s)?a.getShadowDim():r.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==i[0]||n[1]!==i[1]){var h=o.getDataExtent(r.thisDim),f=o.getDataExtent(l),d=(f[1]-f[0])*.3;f=[f[0]-d,f[1]+d];var g=[0,n[1]],m=[0,n[0]],y=[[n[0],0],[0,0]],_=[],x=m[1]/Math.max(1,o.count()-1),w=n[0]/(h[1]-h[0]),S=r.thisAxis.type==="time",T=-x,M=Math.round(o.count()/n[0]),A;o.each([r.thisDim,l],function(O,j,B){if(M>0&&B%M){S||(T+=x);return}T=S?(+O-h[0])*w:T+x;var U=j==null||isNaN(j)||j==="",H=U?0:ct(j,f,g,!0);U&&!A&&B?(y.push([y[y.length-1][0],0]),_.push([_[_.length-1][0],0])):!U&&A&&(y.push([T,0]),_.push([T,0])),U||(y.push([T,H]),_.push([T,H])),A=U}),u=this._shadowPolygonPts=y,c=this._shadowPolylinePts=_}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var N=this.dataZoomModel;function P(O){var j=N.getModel(O?"selectedDataBackground":"dataBackground"),B=new Me,U=new sn({shape:{points:u},segmentIgnoreThreshold:1,style:j.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),H=new $r({shape:{points:c},segmentIgnoreThreshold:1,style:j.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return B.add(U),B.add(H),B}for(var I=0;I<3;I++){var D=P(I===1);this._displayables.sliderGroup.add(D),this._displayables.dataShadowSegs.push(D)}},t.prototype._prepareDataShadowInfo=function(){var r=this.dataZoomModel,n=r.get("showDataShadow");if(n!==!1){var i,a=this.ecModel;return r.eachTargetAxis(function(o,s){var l=r.getAxisProxy(o,s).getTargetSeriesModels();E(l,function(u){if(!i&&!(n!==!0&&Be(c1e,u.get("type"))<0)){var c=a.getComponent(tl(o),s).axis,h=d1e(o),f,d=u.coordinateSystem;h!=null&&d.getOtherAxis&&(f=d.getOtherAxis(c).inverse),h=u.getData().mapDimension(h);var g=u.getData().mapDimension(o);i={thisAxis:c,series:u,thisDim:g,otherDim:h,otherAxisInverse:f}}},this)},this),i}},t.prototype._renderHandle=function(){var r=this.group,n=this._displayables,i=n.handles=[null,null],a=n.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,h=l.get("brushSelect"),f=n.filler=new Ov({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(f),o.add(new Ov({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:s1e,fill:K.color.transparent}})),E([0,1],function(w){var S=l.get("handleIcon");!Mx[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var T=dr(S,-1,0,2,2,null,!0);T.attr({cursor:v1e(this._orient),draggable:!0,drift:de(this._onDragMove,this,w),ondragend:de(this._onDragEnd,this),onmouseover:de(this._onOverDataInfoTriggerArea,this,!0),onmouseout:de(this._onOverDataInfoTriggerArea,this,!1),z2:5});var M=T.getBoundingRect(),A=l.get("handleSize");this._handleHeight=he(A,this._size[1]),this._handleWidth=M.width/M.height*this._handleHeight,T.setStyle(l.getModel("handleStyle").getItemStyle()),T.style.strokeNoScale=!0,T.rectHover=!0,T.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),pl(T);var N=l.get("handleColor");N!=null&&(T.style.fill=N),o.add(i[w]=T);var P=l.getModel("textStyle"),I=l.get("handleLabel")||{},D=I.show||!1;r.add(a[w]=new it({silent:!0,invisible:!D,style:Lt(P,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:P.getTextColor(),font:P.getFont()}),z2:10}))},this);var d=f;if(h){var g=he(l.get("moveHandleSize"),s[1]),m=n.moveHandle=new Ye({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:g}}),y=g*.8,_=n.moveHandleIcon=dr(l.get("moveHandleIcon"),-y/2,-y/2,y,y,K.color.neutral00,!0);_.silent=!0,_.y=s[1]+g/2-.5,m.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var x=Math.min(s[1]/2,Math.max(g,10));d=n.moveZone=new Ye({invisible:!0,shape:{y:s[1]-x,height:g+x}}),d.on("mouseover",function(){u.enterEmphasis(m)}).on("mouseout",function(){u.leaveEmphasis(m)}),o.add(m),o.add(_),o.add(d)}d.attr({draggable:!0,cursor:"grab",drift:de(this._onActualMoveZoneDrift,this),ondragstart:de(this._onActualMoveZoneDragStart,this),ondragend:de(this._onActualMoveZoneDragEnd,this),onmouseover:de(this._onOverDataInfoTriggerArea,this,!0),onmouseout:de(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var r=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[ct(r[0],[0,100],n,!0),ct(r[1],[0,100],n,!0)]},t.prototype._updateInterval=function(r,n){var i=this.dataZoomModel,a=this._handleEnds,o=this._getViewExtent(),s=i.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];Ll(n,a,o,i.get("zoomLock")?"all":r,s.minSpan!=null?ct(s.minSpan,l,o,!0):null,s.maxSpan!=null?ct(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=Ur([ct(a[0],o,l,!0),ct(a[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},t.prototype._updateView=function(r){var n=this._displayables,i=this._handleEnds,a=Ur(i.slice()),o=this._size;E([0,1],function(d){var g=n.handles[d],m=this._handleHeight;g.attr({scaleX:m/2,scaleY:m/2,x:i[d]+(d?-1:1),y:o[1]/2-m/2})},this),n.filler.setShape({x:a[0],y:0,width:a[1]-a[0],height:o[1]});var s={x:a[0],width:a[1]-a[0]};n.moveHandle&&(n.moveHandle.setShape(s),n.moveZone.setShape(s),n.moveZone.getBoundingRect(),n.moveHandleIcon&&n.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=n.dataShadowSegs,u=[0,a[0],a[1],o[0]],c=0;cn[0]||i[1]<0||i[1]>n[1])){var a=this._handleEnds,o=(a[0]+a[1])/2,s=this._updateInterval("all",i[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(r){var n=r.offsetX,i=r.offsetY;this._brushStart=new Pe(n,i),this._brushing=!0,this._brushStartTime=+new Date},t.prototype._onBrushEnd=function(r){if(this._brushing){var n=this._displayables.brushRect;if(this._brushing=!1,!!n){n.attr("ignore",!0);var i=n.shape,a=+new Date;if(!(a-this._brushStartTime<200&&Math.abs(i.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[i.x,i.x+i.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();Ll(0,l,o,0,u.minSpan!=null?ct(u.minSpan,s,o,!0):null,u.maxSpan!=null?ct(u.maxSpan,s,o,!0):null),this._range=Ur([ct(l[0],o,s,!0),ct(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(r){this._brushing&&(ls(r.event),this._updateBrushRect(r.offsetX,r.offsetY))},t.prototype._updateBrushRect=function(r,n){var i=this._displayables,a=this.dataZoomModel,o=i.brushRect;o||(o=i.brushRect=new Ov({silent:!0,style:a.getModel("brushStyle").getItemStyle()}),i.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(r,n),c=l.transformCoordToLocal(s.x,s.y),h=this._size;u[0]=Math.max(Math.min(h[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:h[1]})},t.prototype._dispatchZoomAction=function(r){var n=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:r?h1e:null,start:n[0],end:n[1]})},t.prototype._findCoordRect=function(){var r,n=K9(this.dataZoomModel).infoList;if(!r&&n.length){var i=n[0].model.coordinateSystem;r=i.getRect&&i.getRect()}if(!r){var a=this.api.getWidth(),o=this.api.getHeight();r={x:a*.2,y:o*.2,width:a*.6,height:o*.6}}return r},t.type="dataZoom.slider",t}(ZN);function I4(e,t,r,n){var i=e.get("labelFormatter"),a=e.get("labelPrecision");(a==null||a==="auto")&&(a=r.valuePrecision);var o=r.value[t],s=o==null||isNaN(o)?"":bn(n)||lm(n)?n.getLabel({value:Math.round(o)}):isFinite(a)?st(o,a,!0):o+"";return Ce(i)?i(o,s):ue(i)?i.replace("{value}",s):s}function d1e(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}function v1e(e){return e==="vertical"?"ns-resize":"ew-resize"}function yZ(e){e.registerComponentModel(o1e),e.registerComponentView(f1e),$N(e)}function p1e(e){We(mZ),We(yZ)}var _Z={get:function(e,t,r){var n=Se((g1e[e]||{})[t]);return r&&ne(n)?n[n.length-1]:n}},g1e={color:{active:["#006edd","#e0ffff"],inactive:[K.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},N4=jr.mapVisual,m1e=jr.eachVisual,y1e=ne,LT=E,_1e=Ur,x1e=ct,m1=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.stateList=["inRange","outOfRange"],r.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],r.layoutMode={type:"box",ignoreSize:!0},r.dataBound=[-1/0,1/0],r.targetVisuals={},r.controllerVisuals={},r}return t.prototype.init=function(r,n,i){this.mergeDefaultAndTheme(r,i)},t.prototype.optionUpdated=function(r,n){var i=this.option;!n&&uZ(i,r,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(r){var n=this.stateList;r=de(r,this),this.controllerVisuals=zA(this.option.controller,n,r),this.targetVisuals=zA(this.option.target,n,r)},t.prototype.getItemSymbol=function(){return null},t.prototype.getTargetSeriesIndices=function(){var r=this,n=this.option.seriesTargets;if(n){var i=[];return LT(n,function(l){if(l.seriesIndex!=null)i.push(l.seriesIndex);else if(l.seriesId!=null){var u;r.ecModel.eachSeries(function(c){c.id===l.seriesId&&(u=c)}),u&&i.push(u.componentIndex)}}),i}var a=this.option.seriesId,o=this.option.seriesIndex;o==null&&a==null&&(o="all");var s=ud(this.ecModel,"series",{index:o,id:a},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return ae(s,function(l){return l.componentIndex})},t.prototype.eachTargetSeries=function(r,n){E(this.getTargetSeriesIndices(),function(i){var a=this.ecModel.getSeriesByIndex(i);a&&r.call(n,a)},this)},t.prototype.isTargetSeries=function(r){var n=!1;return this.eachTargetSeries(function(i){i===r&&(n=!0)}),n},t.prototype.formatValueText=function(r,n,i){var a=this.option,o=a.precision,s=this.dataBound,l=a.formatter,u;i=i||["<",">"],ne(r)&&(r=r.slice(),u=!0);var c=n?r:u?[h(r[0]),h(r[1])]:h(r);if(ue(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(Ce(l))return u?l(r[0],r[1]):l(r);if(u)return r[0]===s[0]?i[0]+" "+c[1]:r[1]===s[1]?i[1]+" "+c[0]:c[0]+" - "+c[1];return c;function h(f){return f===s[0]?"min":f===s[1]?"max":(+f).toFixed(Math.min(o,20))}},t.prototype.resetExtent=function(){var r=this.option,n=_1e([r.min,r.max]);this._dataExtent=n},t.prototype.getDimension=function(r){var n=this,i=this.option.seriesTargets;if(i){var a=ys(i,function(o){return o.seriesIndex!=null&&o.seriesIndex===r||o.seriesId!=null&&o.seriesId===n.ecModel.getSeriesByIndex(r).id});if(a)return a.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(r){var n=r.hostModel.seriesIndex,i=this.getDimension(n);if(i!=null)return r.getDimensionIndex(i);for(var a=r.dimensions,o=a.length-1;o>=0;o--){var s=a[o],l=r.getDimensionInfo(s);if(!l.isCalculationCoord)return l.storeDimIndex}},t.prototype.getExtent=function(){return this._dataExtent.slice()},t.prototype.completeVisualOption=function(){var r=this.ecModel,n=this.option,i={inRange:n.inRange,outOfRange:n.outOfRange},a=n.target||(n.target={}),o=n.controller||(n.controller={});He(a,i),He(o,i);var s=this.isCategory();l.call(this,a),l.call(this,o),u.call(this,a,"inRange","outOfRange"),c.call(this,o);function l(h){y1e(n.color)&&!h.inRange&&(h.inRange={color:n.color.slice().reverse()}),h.inRange=h.inRange||{color:r.get("gradientColor")}}function u(h,f,d){var g=h[f],m=h[d];g&&!m&&(m=h[d]={},LT(g,function(y,_){if(jr.isValidType(_)){var x=_Z.get(_,"inactive",s);x!=null&&(m[_]=x,_==="color"&&!m.hasOwnProperty("opacity")&&!m.hasOwnProperty("colorAlpha")&&(m.opacity=[0,0]))}}))}function c(h){var f=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,d=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,g=this.get("inactiveColor"),m=this.getItemSymbol(),y=m||"roundRect";LT(this.stateList,function(_){var x=this.itemSize,w=h[_];w||(w=h[_]={color:s?g:[g]}),w.symbol==null&&(w.symbol=f&&Se(f)||(s?y:[y])),w.symbolSize==null&&(w.symbolSize=d&&Se(d)||(s?x[0]:[x[0],x[0]])),w.symbol=N4(w.symbol,function(M){return M==="none"?y:M});var S=w.symbolSize;if(S!=null){var T=-1/0;m1e(S,function(M){M>T&&(T=M)}),w.symbolSize=N4(S,function(M){return x1e(M,[0,T],[0,x[0]],!0)})}},this)}},t.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},t.prototype.isCategory=function(){return!!this.option.categories},t.prototype.setSelected=function(r){},t.prototype.getSelected=function(){return null},t.prototype.getValueState=function(r){return null},t.prototype.getVisualMeta=function(r){return null},t.type="visualMap",t.dependencies=["series"],t.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:K.color.transparent,borderColor:K.color.borderTint,contentColor:K.color.theme[0],inactiveColor:K.color.disabled,borderWidth:0,padding:K.size.m,textGap:10,precision:0,textStyle:{color:K.color.secondary}},t}(qe),P4=[20,140],b1e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(i){i.mappingMethod="linear",i.dataExtent=this.getExtent()}),this._resetRange()},t.prototype.resetItemSize=function(){e.prototype.resetItemSize.apply(this,arguments);var r=this.itemSize;(r[0]==null||isNaN(r[0]))&&(r[0]=P4[0]),(r[1]==null||isNaN(r[1]))&&(r[1]=P4[1])},t.prototype._resetRange=function(){var r=this.getExtent(),n=this.option.range;!n||n.auto?(r.auto=1,this.option.range=r):ne(n)&&(n[0]>n[1]&&n.reverse(),n[0]=Math.max(n[0],r[0]),n[1]=Math.min(n[1],r[1]))},t.prototype.completeVisualOption=function(){e.prototype.completeVisualOption.apply(this,arguments),E(this.stateList,function(r){var n=this.option.controller[r].symbolSize;n&&n[0]!==n[1]&&(n[0]=n[1]/3)},this)},t.prototype.setSelected=function(r){this.option.range=r.slice(),this._resetRange()},t.prototype.getSelected=function(){var r=this.getExtent(),n=Ur((this.get("range")||[]).slice());return n[0]>r[1]&&(n[0]=r[1]),n[1]>r[1]&&(n[1]=r[1]),n[0]=i[1]||r<=n[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[];return this.eachTargetSeries(function(i){var a=[],o=i.getData();o.each(this.getDataDimensionIndex(o),function(s,l){r[0]<=s&&s<=r[1]&&a.push(l)},this),n.push({seriesId:i.id,dataIndex:a})},this),n},t.prototype.getVisualMeta=function(r){var n=D4(this,"outOfRange",this.getExtent()),i=D4(this,"inRange",this.option.range.slice()),a=[];function o(d,g){a.push({value:d,color:r(d,g)})}for(var s=0,l=0,u=i.length,c=n.length;lr[1])break;a.push({color:this.getControllerVisual(l,"color",n),offset:s/i})}return a.push({color:this.getControllerVisual(r[1],"color",n),offset:1}),a},t.prototype._createBarPoints=function(r,n){var i=this.visualMapModel.itemSize;return[[i[0]-n[0],r[0]],[i[0],r[0]],[i[0],r[1]],[i[0]-n[1],r[1]]]},t.prototype._createBarGroup=function(r){var n=this._orient,i=this.visualMapModel.get("inverse");return new Me(n==="horizontal"&&!i?{scaleX:r==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&i?{scaleX:r==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!i?{scaleX:r==="left"?1:-1,scaleY:-1}:{scaleX:r==="left"?1:-1})},t.prototype._updateHandle=function(r,n){if(this._useHandle){var i=this._shapes,a=this.visualMapModel,o=i.handleThumbs,s=i.handleLabels,l=a.itemSize,u=a.getExtent(),c=this._applyTransform("left",i.mainGroup);w1e([0,1],function(h){var f=o[h];f.setStyle("fill",n.handlesColor[h]),f.y=r[h];var d=Oa(r[h],[0,l[1]],u,!0),g=this.getControllerVisual(d,"symbolSize");f.scaleX=f.scaleY=g/l[0],f.x=l[0]-g/2;var m=pa(i.handleLabelPoints[h],Ku(f,this.group));if(this._orient==="horizontal"){var y=c==="left"||c==="top"?(l[0]-g)/2:(l[0]-g)/-2;m[1]+=y}s[h].setStyle({x:m[0],y:m[1],text:a.formatValueText(this._dataInterval[h]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",i.mainGroup):"center"})},this)}},t.prototype._showIndicator=function(r,n,i,a){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,h=c.indicator;if(h){h.attr("invisible",!1);var f={convertOpacityToAlpha:!0},d=this.getControllerVisual(r,"color",f),g=this.getControllerVisual(r,"symbolSize"),m=Oa(r,s,u,!0),y=l[0]-g/2,_={x:h.x,y:h.y};h.y=m,h.x=y;var x=pa(c.indicatorLabelPoint,Ku(h,this.group)),w=c.indicatorLabel;w.attr("invisible",!1);var S=this._applyTransform("left",c.mainGroup),T=this._orient,M=T==="horizontal";w.setStyle({text:(i||"")+o.formatValueText(n),verticalAlign:M?S:"middle",align:M?"center":S});var A={x:y,y:m,style:{fill:d}},N={style:{x:x[0],y:x[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var P={duration:100,easing:"cubicInOut",additive:!0};h.x=_.x,h.y=_.y,h.animateTo(A,P),w.animateTo(N,P)}else h.attr(A),w.attr(N);this._firstShowIndicator=!1;var I=this._shapes.handleLabels;if(I)for(var D=0;Do[1]&&(h[1]=1/0),n&&(h[0]===-1/0?this._showIndicator(c,h[1],"< ",l):h[1]===1/0?this._showIndicator(c,h[0],"> ",l):this._showIndicator(c,c,"≈ ",l));var f=this._hoverLinkDataIndices,d=[];(n||O4(i))&&(d=this._hoverLinkDataIndices=i.findTargetDataIndices(h));var g=Aee(f,d);this._dispatchHighDown("downplay",S_(g[0],i)),this._dispatchHighDown("highlight",S_(g[1],i))}},t.prototype._hoverLinkFromSeriesMouseOver=function(r){var n;if(Hu(r.target,function(l){var u=Re(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var i=this.ecModel.getSeriesByIndex(n.seriesIndex),a=this.visualMapModel;if(a.isTargetSeries(i)){var o=i.getData(n.dataType),s=o.getStore().get(a.getDataDimensionIndex(o),n.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},t.prototype._hideIndicator=function(){var r=this._shapes;r.indicator&&r.indicator.attr("invisible",!0),r.indicatorLabel&&r.indicatorLabel.attr("invisible",!0);var n=this._shapes.handleLabels;if(n)for(var i=0;i=0&&(a.dimension=o,n.push(a))}}),e.getData().setVisual("visualMeta",n)}}];function I1e(e,t,r,n){for(var i=t.targetVisuals[n],a=jr.prepareVisualTypes(i),o={color:sm(e.getData(),"color")},s=0,l=a.length;s0:t.splitNumber>0)||t.calculable)?"continuous":"piecewise"}),e.registerAction(A1e,k1e),E(L1e,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(N1e))}function SZ(e){e.registerComponentModel(b1e),e.registerComponentView(T1e),wZ(e)}var P1e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r._pieceList=[],r}return t.prototype.optionUpdated=function(r,n){e.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var i=this._mode=this._determineMode();this._pieceList=[],D1e[this._mode].call(this,this._pieceList),this._resetSelected(r,n);var a=this.option.categories;this.resetVisual(function(o,s){i==="categories"?(o.mappingMethod="category",o.categories=Se(a)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=ae(this._pieceList,function(l){return l=Se(l),s!=="inRange"&&(l.visual=null),l}))})},t.prototype.completeVisualOption=function(){var r=this.option,n={},i=jr.listVisualTypes(),a=this.isCategory();E(r.pieces,function(s){E(i,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),E(n,function(s,l){var u=!1;E(this.stateList,function(c){u=u||o(r,c,l)||o(r.target,c,l)},this),!u&&E(this.stateList,function(c){(r[c]||(r[c]={}))[l]=_Z.get(l,c==="inRange"?"active":"inactive",a)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}e.prototype.completeVisualOption.apply(this,arguments)},t.prototype._resetSelected=function(r,n){var i=this.option,a=this._pieceList,o=(n?i:r).selected||{};if(i.selected=o,E(a,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),i.selectedMode==="single"){var s=!1;E(a,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},t.prototype.getItemSymbol=function(){return this.get("itemSymbol")},t.prototype.getSelectedMapKey=function(r){return this._mode==="categories"?r.value+"":r.index+""},t.prototype.getPieceList=function(){return this._pieceList},t.prototype._determineMode=function(){var r=this.option;return r.pieces&&r.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},t.prototype.setSelected=function(r){this.option.selected=Se(r)},t.prototype.getValueState=function(r){var n=jr.findPieceIndex(r,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[],i=this._pieceList;return this.eachTargetSeries(function(a){var o=[],s=a.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=jr.findPieceIndex(l,i);c===r&&o.push(u)},this),n.push({seriesId:a.id,dataIndex:o})},this),n},t.prototype.getRepresentValue=function(r){var n;if(this.isCategory())n=r.value;else if(r.value!=null)n=r.value;else{var i=r.interval||[];n=i[0]===-1/0&&i[1]===1/0?0:(i[0]+i[1])/2}return n},t.prototype.getVisualMeta=function(r){if(this.isCategory())return;var n=[],i=["",""],a=this;function o(c,h){var f=a.getRepresentValue({interval:c});h||(h=a.getValueState(f));var d=r(f,h);c[0]===-1/0?i[0]=d:c[1]===1/0?i[1]=d:n.push({value:c[0],color:d},{value:c[1],color:d})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return E(s,function(c){var h=c.interval;h&&(h[0]>u&&o([u,h[0]],"outOfRange"),o(h.slice()),u=h[1])},this),{stops:n,outerColors:i}},t.type="visualMap.piecewise",t.defaultOption=Bl(m1.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),t}(m1),D1e={splitNumber:function(e){var t=this.option,r=Math.min(t.precision,20),n=this.getExtent(),i=t.splitNumber;i=Math.max(parseInt(i,10),1),t.splitNumber=i;for(var a=(n[1]-n[0])/i;+a.toFixed(r)!==a&&r<5;)r++;t.precision=r,a=+a.toFixed(r),t.minOpen&&e.push({interval:[-1/0,n[0]],close:[0,0]});for(var o=0,s=n[0];o","≥"][n[0]]];r.text=r.text||this.formatValueText(r.value!=null?r.value:r.interval,!1,i)},this)}};function V4(e,t){var r=e.inverse;(e.orient==="vertical"?!r:r)&&t.reverse()}var E1e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.doRender=function(){var r=this.group;r.removeAll();var n=this.visualMapModel,i=n.get("textGap"),a=n.textStyleModel,o=this._getItemAlign(),s=n.itemSize,l=this._getViewData(),u=l.endsText,c=mn(n.get("showLabel",!0),!u),h=!n.get("selectedMode");u&&this._renderEndsText(r,u[0],s,c,o),E(l.viewPieceList,function(f){var d=f.piece,g=new Me;g.onclick=de(this._onItemClick,this,d),this._enableHoverLink(g,f.indexInModelPieceList);var m=n.getRepresentValue(d);if(this._createItemSymbol(g,m,[0,0,s[0],s[1]],h),c){var y=this.visualMapModel.getValueState(m),_=a.get("align")||o;g.add(new it({style:Lt(a,{x:_==="right"?-i:s[0]+i,y:s[1]/2,text:d.text,verticalAlign:a.get("verticalAlign")||"middle",align:_,opacity:_e(a.get("opacity"),y==="outOfRange"?.5:1)}),silent:h}))}r.add(g)},this),u&&this._renderEndsText(r,u[1],s,c,o),Ju(n.get("orient"),r,n.get("itemGap")),this.renderBackground(r),this.positionGroup(r)},t.prototype._enableHoverLink=function(r,n){var i=this;r.on("mouseover",function(){return a("highlight")}).on("mouseout",function(){return a("downplay")});var a=function(o){var s=i.visualMapModel;s.option.hoverLink&&i.api.dispatchAction({type:o,batch:S_(s.findTargetDataIndices(n),s)})}},t.prototype._getItemAlign=function(){var r=this.visualMapModel,n=r.option;if(n.orient==="vertical")return bZ(r,this.api,r.itemSize);var i=n.align;return(!i||i==="auto")&&(i="left"),i},t.prototype._renderEndsText=function(r,n,i,a,o){if(n){var s=new Me,l=this.visualMapModel.textStyleModel;s.add(new it({style:Lt(l,{x:a?o==="right"?i[0]:0:i[0]/2,y:i[1]/2,verticalAlign:"middle",align:a?o:"center",text:n})})),r.add(s)}},t.prototype._getViewData=function(){var r=this.visualMapModel,n=ae(r.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),i=r.get("text"),a=r.get("orient"),o=r.get("inverse");return(a==="horizontal"?o:!o)?n.reverse():i&&(i=i.slice().reverse()),{viewPieceList:n,endsText:i}},t.prototype._createItemSymbol=function(r,n,i,a){var o=dr(this.getControllerVisual(n,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(n,"color"));o.silent=a,r.add(o)},t.prototype._onItemClick=function(r){var n=this.visualMapModel,i=n.option,a=i.selectedMode;if(a){var o=Se(i.selected),s=n.getSelectedMapKey(r);a==="single"||a===!0?(o[s]=!0,E(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},t.type="visualMap.piecewise",t}(xZ);function CZ(e){e.registerComponentModel(P1e),e.registerComponentView(E1e),wZ(e)}function R1e(e){We(SZ),We(CZ)}var j1e=function(){function e(t){this._thumbnailModel=t}return e.prototype.reset=function(t){this._renderVersion=t.getECUpdateCycleVersion()},e.prototype.renderContent=function(t){var r=t.api.getViewOfComponentModel(this._thumbnailModel);r&&(t.group.silent=!0,r.renderContent({group:t.group,targetTrans:t.targetTrans,z2Range:hH(t.group),roamType:t.roamType,viewportRect:t.viewportRect,renderVersion:this._renderVersion}))},e.prototype.updateWindow=function(t,r){var n=r.getViewOfComponentModel(this._thumbnailModel);n&&n.updateWindow({targetTrans:t,renderVersion:this._renderVersion})},e}(),O1e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r.preventAutoZ=!0,r}return t.prototype.optionUpdated=function(r,n){this._updateBridge()},t.prototype._updateBridge=function(){var r=this._birdge=this._birdge||new j1e(this);if(this._target=null,this.ecModel.eachSeries(function(i){_3(i,null)}),this.shouldShow()){var n=this.getTarget();_3(n.baseMapProvider,r)}},t.prototype.shouldShow=function(){return this.getShallow("show",!0)},t.prototype.getBridge=function(){return this._birdge},t.prototype.getTarget=function(){if(this._target)return this._target;var r=this.getReferringComponents("series",{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];return r?r.subType!=="graph"&&(r=null):r=this.ecModel.queryComponents({mainType:"series",subType:"graph"})[0],this._target={baseMapProvider:r},this._target},t.type="thumbnail",t.layoutMode="box",t.dependencies=["series","geo"],t.defaultOption={show:!0,right:1,bottom:1,height:"25%",width:"25%",itemStyle:{borderColor:K.color.border,borderWidth:2},windowStyle:{borderWidth:1,color:K.color.neutral30,borderColor:K.color.neutral40,opacity:.3},z:10},t}(qe),z1e=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.prototype.render=function(r,n,i){if(this._api=i,this._model=r,this._coordSys||(this._coordSys=new Bb),!this._isEnabled()){this._clear();return}this._renderVersion=i.getECUpdateCycleVersion();var a=this.group;a.removeAll();var o=r.getModel("itemStyle"),s=o.getItemStyle();s.fill==null&&(s.fill=n.get("backgroundColor")||K.color.neutral00);var l=Lr(r,i).refContainer,u=Bt(jH(r,!0),l),c=s.lineWidth||0,h=this._contentRect=yc(u.clone(),c/2,!0,!0),f=new Me;a.add(f),f.setClipPath(new Ye({shape:h.plain()}));var d=this._targetGroup=new Me;f.add(d);var g=u.plain();g.r=o.getShallow("borderRadius",!0),a.add(this._bgRect=new Ye({style:s,shape:g,silent:!1,cursor:"grab"}));var m=r.getModel("windowStyle"),y=m.getShallow("borderRadius",!0);f.add(this._windowRect=new Ye({shape:{x:0,y:0,width:0,height:0,r:y},style:m.getItemStyle(),silent:!1,cursor:"grab"})),this._dealRenderContent(),this._dealUpdateWindow(),H4(r,this)},t.prototype.renderContent=function(r){this._bridgeRendered=r,this._isEnabled()&&(this._dealRenderContent(),this._dealUpdateWindow(),H4(this._model,this))},t.prototype._dealRenderContent=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=this._targetGroup,i=this._coordSys,a=this._contentRect;if(n.removeAll(),!!r){var o=r.group,s=o.getBoundingRect();n.add(o),this._bgRect.z2=r.z2Range.min-10,Fb(i,s.x,s.y,s.width,s.height);var l=Bt({left:"center",top:"center",aspect:s.width/s.height},a);Kx(i,l.x,l.y,l.width,l.height),Lg(o,i,kc),o.dirty(),this._windowRect.z2=r.z2Range.max+10,this._resetRoamController(r.roamType)}}},t.prototype.updateWindow=function(r){var n=this._bridgeRendered;n&&n.renderVersion===r.renderVersion&&(n.targetTrans=r.targetTrans),this._isEnabled()&&this._dealUpdateWindow()},t.prototype._dealUpdateWindow=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=fi([],r.targetTrans),i=ci([],qx(null,this._coordSys),n);this._transThisToTarget=fi([],i);var a=r.viewportRect;a?a=a.clone():a=new Ae(0,0,this._api.getWidth(),this._api.getHeight()),a.applyTransform(i);var o=this._windowRect,s=o.shape.r;o.setShape(ke({r:s},a))}},t.prototype._resetRoamController=function(r){var n=this,i=this._api,a=this._roamController;if(a||(a=this._roamController=new Jc(i.getZr())),!r||!this._isEnabled()){a.disable();return}a.enable(r,{api:i,zInfo:{component:this._model},triggerInfo:{roamTrigger:null,isInSelf:function(o,s,l){return n._contentRect.contain(s,l)}}}),a.off("pan").off("zoom").on("pan",de(this._onPan,this)).on("zoom",de(this._onZoom,this))},t.prototype._onPan=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var i=Kt([],[r.oldX,r.oldY],n),a=Kt([],[r.oldX-r.dx,r.oldY-r.dy],n);this._api.dispatchAction(G4(this._model.getTarget().baseMapProvider,{dx:a[0]-i[0],dy:a[1]-i[1]}))}},t.prototype._onZoom=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var i=Kt([],[r.originX,r.originY],n);this._api.dispatchAction(G4(this._model.getTarget().baseMapProvider,{zoom:1/r.scale,originX:i[0],originY:i[1]}))}},t.prototype._isEnabled=function(){var r=this._model;if(!r||!r.shouldShow())return!1;var n=r.getTarget().baseMapProvider;return!!n},t.prototype._clear=function(){this.group.removeAll(),this._bridgeRendered=null,this._roamController&&this._roamController.disable()},t.prototype.remove=function(){this._clear()},t.prototype.dispose=function(){this._clear()},t.type="thumbnail",t}(Nt);function G4(e,t){var r=e.mainType==="series"?e.subType+"Roam":e.mainType+"Roam",n={type:r};return n[e.mainType+"Id"]=e.id,ee(n,t),n}function H4(e,t){var r=_c(e);yb(t.group,r.z,r.zlevel)}function B1e(e){e.registerComponentModel(O1e),e.registerComponentView(z1e)}var F1e={label:{enabled:!0},decal:{show:!1}},U4=Ue(),W4=Ue(),V1e=Qg(G1e);function G1e(e,t){var r=e.getModel("aria");if(!r.get("enabled"))return;var n=W4(e).scope||(W4(e).scope={}),i=Se(F1e);He(i.label,e.getLocaleModel().get("aria"),!1),He(r.option,i,!1),a(),o();function a(){var c=r.getModel("decal"),h=c.get("show");if(h){var f=pe();e.eachSeries(function(d){d.isColorBySeries()||(U4(d).scope=f.get(d.type)||f.set(d.type,{}))}),e.eachSeries(function(d){if(Ce(d.enableAriaDecal)){d.enableAriaDecal();return}var g=d.getData();if(d.isColorBySeries()){var w=kM(d.ecModel,d.name,n,e.getSeriesCount()),S=g.getVisual("decal");g.setVisual("decal",T(S,w))}else{var m=d.getRawData(),y={},_=U4(d).scope;g.each(function(M){var A=g.getRawIndex(M);y[A]=M});var x=m.count();m.each(function(M){var A=y[M],N=m.getName(M)||M+"",P=kM(d.ecModel,N,_,x),I=g.getItemVisual(A,"decal");g.setItemVisual(A,"decal",T(I,P))})}function T(M,A){var N=M?ee(ee({},A),M):A;return N.dirty=!0,N}})}}function o(){var c=t.getZr().dom;if(c){var h=e.getLocaleModel().get("aria"),f=r.getModel("label");if(f.option=ke(f.option,h),!!f.get("enabled")){if(c.setAttribute("role","img"),f.get("description")){c.setAttribute("aria-label",f.get("description"));return}var d=e.getSeriesCount(),g=f.get(["data","maxCount"])||10,m=f.get(["series","maxCount"])||10,y=Math.min(d,m),_;if(!(d<1)){var x=l();if(x){var w=f.get(["general","withTitle"]);_=s(w,{title:x})}else _=f.get(["general","withoutTitle"]);var S=[],T=d>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);_+=s(T,{seriesCount:d}),e.eachSeries(function(P,I){if(I1?f.get(["series","multiple",j]):f.get(["series","single",j]),D=s(D,{seriesId:P.seriesIndex,seriesName:P.get("name"),seriesType:u(P.subType)});var B=P.getData();if(B.count()>g){var U=f.get(["data","partialData"]);D+=s(U,{displayCnt:g})}else D+=f.get(["data","allData"]);for(var H=f.get(["data","separator","middle"]),V=f.get(["data","separator","end"]),z=f.get(["data","excludeDimensionId"]),$=[],W=0;W":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},W1e=function(){function e(t){var r=this._condVal=ue(t)?new RegExp(t):S6(t)?t:null;if(r==null){var n="";gt(n)}}return e.prototype.evaluate=function(t){var r=typeof t;return ue(r)?this._condVal.test(t):at(r)?this._condVal.test(t+""):!1},e}(),Z1e=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),$1e=function(){function e(){}return e.prototype.evaluate=function(){for(var t=this.children,r=0;r2&&n.push(i),i=[j,B]}function c(j,B,U,H){af(j,U)&&af(B,H)||i.push(j,B,U,H,U,H)}function h(j,B,U,H,V,z){var $=Math.abs(B-j),W=Math.tan($/4)*4/3,Z=BN:D2&&n.push(i),n}function ZA(e,t,r,n,i,a,o,s,l,u){if(af(e,r)&&af(t,n)&&af(i,o)&&af(a,s)){l.push(o,s);return}var c=2/u,h=c*c,f=o-e,d=s-t,g=Math.sqrt(f*f+d*d);f/=g,d/=g;var m=r-e,y=n-t,_=i-o,x=a-s,w=m*m+y*y,S=_*_+x*x;if(w=0&&N=0){l.push(o,s);return}var P=[],I=[];Tl(e,r,i,o,.5,P),Tl(t,n,a,s,.5,I),ZA(P[0],I[0],P[1],I[1],P[2],I[2],P[3],I[3],l,u),ZA(P[4],I[4],P[5],I[5],P[6],I[6],P[7],I[7],l,u)}function sbe(e,t){var r=WA(e),n=[];t=t||1;for(var i=0;i0)for(var u=0;uMath.abs(u),h=MZ([l,u],c?0:1,t),f=(c?s:u)/h.length,d=0;di,o=MZ([n,i],a?0:1,t),s=a?"width":"height",l=a?"height":"width",u=a?"x":"y",c=a?"y":"x",h=e[s]/o.length,f=0;f1?null:new Pe(m*l+e,m*u+t)}function cbe(e,t,r){var n=new Pe;Pe.sub(n,r,t),n.normalize();var i=new Pe;Pe.sub(i,e,t);var a=i.dot(n);return a}function Dh(e,t){var r=e[e.length-1];r&&r[0]===t[0]&&r[1]===t[1]||e.push(t)}function hbe(e,t,r){for(var n=e.length,i=[],a=0;ao?(u.x=c.x=s+a/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+a),hbe(t,u,c)}function y1(e,t,r,n){if(r===1)n.push(t);else{var i=Math.floor(r/2),a=e(t);y1(e,a[0],i,n),y1(e,a[1],r-i,n)}return n}function fbe(e,t){for(var r=[],n=0;n0;u/=2){var c=0,h=0;(e&u)>0&&(c=1),(t&u)>0&&(h=1),s+=u*u*(3*c^h),h===0&&(c===1&&(e=u-1-e,t=u-1-t),l=e,e=t,t=l)}return s}function b1(e){var t=1/0,r=1/0,n=-1/0,i=-1/0,a=ae(e,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),h=l.y+l.height/2+(u?u[5]:0);return t=Math.min(c,t),r=Math.min(h,r),n=Math.max(c,n),i=Math.max(h,i),[c,h]}),o=ae(a,function(s,l){return{cp:s,z:bbe(s[0],s[1],t,r,n,i),path:e[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function LZ(e){return pbe(e.path,e.count)}function $A(){return{fromIndividuals:[],toIndividuals:[],count:0}}function wbe(e,t,r){var n=[];function i(T){for(var M=0;M=0;i--)if(!r[i].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var a=l.length,u=Math.ceil(a/2);r[i].many=l.slice(u,a),r[s].many=l.slice(0,u),s++}return r}var Cbe={clone:function(e){for(var t=[],r=1-Math.pow(1-e.path.style.opacity,1/e.count),n=0;n0))return;var s=n.getModel("universalTransition").get("delay"),l=ee({setToFinal:!0},o),u,c;eB(e)&&(u=e,c=t),eB(t)&&(u=t,c=e);function h(_,x,w,S,T){var M=_.many,A=_.one;if(M.length===1&&!T){var N=x?M[0]:A,P=x?A:M[0];if(_1(N))h({many:[N],one:P},!0,w,S,!0);else{var I=s?ke({delay:s(w,S)},l):l;rP(N,P,I),a(N,P,N,P,I)}}else for(var D=ke({dividePath:Cbe[r],individualDelay:s&&function(V,z,$,W){return s(V+w,S)}},l),O=x?wbe(M,A,D):Sbe(A,M,D),j=O.fromIndividuals,B=O.toIndividuals,U=j.length,H=0;Ht.length,d=u?tB(c,u):tB(f?t:e,[f?e:t]),g=0,m=0;mIZ))for(var a=n.getIndices(),o=0;o0&&M.group.traverse(function(N){N instanceof Qe&&!N.animators.length&&N.animateFrom({style:{opacity:0}},A)})})}function oB(e){var t=e.getModel("universalTransition").get("seriesKey");return t||e.id}function sB(e){return ne(e)?e.sort().join(","):e}function Gs(e){if(e.hostModel)return e.hostModel.getModel("universalTransition").get("divideShape")}function Nbe(e,t){var r=pe(),n=pe(),i=pe();return E(e.oldSeries,function(a,o){var s=e.oldDataGroupIds[o],l=e.oldData[o],u=oB(a),c=sB(u);n.set(c,{dataGroupId:s,data:l}),ne(u)&&E(u,function(h){i.set(h,{key:c,dataGroupId:s,data:l})})}),E(t.updatedSeries,function(a){if(a.isUniversalTransitionEnabled()&&a.isAnimationEnabled()){var o=a.get("dataGroupId"),s=a.getData(),l=oB(a),u=sB(l),c=n.get(u);if(c)r.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:Gs(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:Gs(s),data:s}]});else if(ne(l)){var h=[];E(l,function(g){var m=n.get(g);m.data&&h.push({dataGroupId:m.dataGroupId,divide:Gs(m.data),data:m.data})}),h.length&&r.set(u,{oldSeries:h,newSeries:[{dataGroupId:o,data:s,divide:Gs(s)}]})}else{var f=i.get(l);if(f){var d=r.get(f.key);d||(d={oldSeries:[{dataGroupId:f.dataGroupId,data:f.data,divide:Gs(f.data)}],newSeries:[]},r.set(f.key,d)),d.newSeries.push({dataGroupId:o,data:s,divide:Gs(s)})}}}}),r}function lB(e,t){for(var r=0;r=0&&i.push({dataGroupId:t.oldDataGroupIds[s],data:t.oldData[s],divide:Gs(t.oldData[s]),groupIdDim:o.dimension})}),E(It(e.to),function(o){var s=lB(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();a.push({dataGroupId:t.oldDataGroupIds[s],data:l,divide:Gs(l),groupIdDim:o.dimension})}}),i.length>0&&a.length>0&&NZ(i,a,n)}function Dbe(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){E(It(n.seriesTransition),function(i){E(It(i.to),function(a){for(var o=n.updatedSeries,s=0;ss.vmin?n+=s.vmin-i+(t-s.vmin)/(s.vmax-s.vmin)*s.gapReal:n+=t-i,i=s.vmax,a=!1;break}n+=s.vmin-i+s.gapReal,i=s.vmax}return a&&(n+=t-i),n},transformOut:function(t,r){if(r&&r.depth===Jo)return t;for(var n=uB,i=cB,a=!0,o=0,s=0;su?o=l.vmin+(t-u)/(c-u)*(l.vmax-l.vmin):o=i+t-n,i=l.vmax,a=!1;break}n=c,i=l.vmax}return a&&(o=i+t-n),o}},e}();function Rbe(e,t){return new Ebe(e,t)}var uB=0,cB=0;function jbe(e,t){var r=0,n={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},i=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},a={S:{tpAbs:i(),tpPrct:i()},E:{tpAbs:i(),tpPrct:i()}};E(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(r+=l.val);var u=nP(s,t);if(u){var c=u.vmin!==s.vmin,h=u.vmax!==s.vmax,f=u.vmax-u.vmin;if(!(c&&h))if(c||h){var d=c?"S":"E";a[d][l.type].has=!0,a[d][l.type].span=f,a[d][l.type].inExtFrac=f/(s.vmax-s.vmin),a[d][l.type].val=l.val}else n[l.type].span+=f,n[l.type].val+=l.val}});var o=r*(0+(t[1]-t[0])+(n.tpAbs.val-n.tpAbs.span)+(a.S.tpAbs.has?(a.S.tpAbs.val-a.S.tpAbs.span)*a.S.tpAbs.inExtFrac:0)+(a.E.tpAbs.has?(a.E.tpAbs.val-a.E.tpAbs.span)*a.E.tpAbs.inExtFrac:0)-n.tpPrct.span-(a.S.tpPrct.has?a.S.tpPrct.span*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.span*a.E.tpPrct.inExtFrac:0))/(1-n.tpPrct.val-(a.S.tpPrct.has?a.S.tpPrct.val*a.S.tpPrct.inExtFrac:0)-(a.E.tpPrct.has?a.E.tpPrct.val*a.E.tpPrct.inExtFrac:0));E(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(s.gapReal=r!==0?$e(o,0)*l.val/r:0),l.type==="tpAbs"&&(s.gapReal=l.val),s.gapReal==null&&(s.gapReal=0)})}function Obe(e,t,r,n,i,a){e!=="no"&&E(r,function(o){var s=nP(o,a);if(s)for(var l=t.length-1;l>=0;l--){var u=t[l],c=n(u),h=i*3/4;c>s.vmin-h&&ct[0]&&r=0&&o<1-1e-5}E(e,function(o){if(!(!o||o.start==null||o.end==null)&&!o.isExpanded){var s={breakOption:Se(o),vmin:t.parse(o.start),vmax:t.parse(o.end),gapParsed:{type:"tpAbs",val:0},gapReal:null};if(o.gap!=null){var l=!1;if(ue(o.gap)){var u=oi(o.gap);if(u.match(/%$/)){var c=parseFloat(u)/100;i(c)||(c=0),s.gapParsed.type="tpPrct",s.gapParsed.val=c,l=!0}}if(!l){var h=t.parse(o.gap);(!isFinite(h)||h<0)&&(h=0),s.gapParsed.type="tpAbs",s.gapParsed.val=h}}if(s.vmin===s.vmax&&(s.gapParsed.type="tpAbs",s.gapParsed.val=0),r&&r.noNegative&&E(["vmin","vmax"],function(d){s[d]<0&&(s[d]=0)}),s.vmin>s.vmax){var f=s.vmax;s.vmax=s.vmin,s.vmin=f}n.push(s)}}),n.sort(function(o,s){return o.vmin-s.vmin});var a=-1/0;return E(n,function(o,s){a>o.vmin&&(n[s]=null),a=o.vmax}),{breaks:mt(n,function(o){return!!o})}}function iP(e,t){return XA(t)===XA(e)}function XA(e){return e.start+"_\0_"+e.end}function Bbe(e,t,r){var n=[];E(e,function(a,o){var s=t(a);s&&s.type==="vmin"&&n.push([o])}),E(e,function(a,o){var s=t(a);if(s&&s.type==="vmax"){var l=ys(n,function(u){return iP(t(e[u[0]]).parsedBreak.breakOption,s.parsedBreak.breakOption)});l&&l.push(o)}});var i=[];return E(n,function(a){a.length===2&&i.push(r?a:[e[a[0]],e[a[1]]])}),i}function Fbe(e,t,r,n){if(t.break){var i=t.break.parsedBreak,a=ys(r,function(c){return iP(c.breakOption,t.break.parsedBreak.breakOption)}),o={lookup:n,depth:Jo},s=e.transformOut(i.vmin,o),l=e.transformOut(i.vmax,o),u={vmin:s,vmax:l,breakOption:i.breakOption,gapParsed:Se(a.gapParsed),gapReal:i.gapReal};return{tickVal:u[t.break.type],vBreak:{type:t.break.type,parsedBreak:u}}}}function Vbe(e,t,r,n,i){i.original=YA(e,t,r);var a=i.transformed=YA(e,t,r),o=i.lookup;a.breaks=ae(a.breaks,function(s,l){var u={depth:Jo},c=t.transformIn(s.vmin,u),h=t.transformIn(s.vmax,u),f={type:s.gapParsed.type,val:s.gapParsed.type==="tpAbs"?t.transformIn(s.vmin+s.gapParsed.val,u)-c:s.gapParsed.val};return o.from[n+l]=c,o.to[n+l]=s.vmin,o.from[n+l+1]=h,o.to[n+l+1]=s.vmax,{vmin:c,vmax:h,gapParsed:f,gapReal:s.gapReal,breakOption:s.breakOption}})}var Gbe={vmin:"start",vmax:"end"};function Hbe(e,t){return t&&(e=e||{},e.break={type:Gbe[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function Ube(){Hre({createBreakScaleMapper:Rbe,pruneTicksByBreak:Obe,addBreaksToTicks:zbe,parseAxisBreakOption:YA,identifyAxisBreak:iP,serializeAxisBreakIdentifier:XA,retrieveAxisBreakPairs:Bbe,getTicksBreakOutwardTransform:Fbe,parseAxisBreakOptionInwardTransform:Vbe,makeAxisLabelFormatterParamBreak:Hbe})}var hB=Ue();function Wbe(e,t){var r=ys(e,function(n){return hr().identifyAxisBreak(n.parsedBreak.breakOption,t.breakOption)});return r||e.push(r={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),r}function Zbe(e){E(e,function(t){return t.shouldRemove=!0})}function $be(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function Ybe(e,t,r,n,i){var a=r.axis;if(a.scale.isBlank()||!hr())return;var o=hr().retrieveAxisBreakPairs(a.scale.getTicks({breakTicks:"only_break"}),function(P){return P.break},!1);if(!o.length)return;var s=r.getModel("breakArea"),l=s.get("zigzagAmplitude"),u=s.get("zigzagMinSpan"),c=s.get("zigzagMaxSpan");u=Math.max(2,u||0),c=Math.max(u,c||0);var h=s.get("expandOnClick"),f=s.get("zigzagZ"),d=s.getModel("itemStyle"),g=d.getItemStyle(),m=g.stroke,y=g.lineWidth,_=g.lineDash,x=g.fill,w=new Me({ignoreModelZ:!0}),S=a.isHorizontal(),T=hB(t).visualList||(hB(t).visualList=[]);Zbe(T);for(var M=function(P){var I=o[P][0].break.parsedBreak,D=[];D[0]=a.toGlobalCoord(a.dataToCoord(I.vmin,!0)),D[1]=a.toGlobalCoord(a.dataToCoord(I.vmax,!0)),D[1]=z;le&&(re=z);var De=[],we=[];De[H]=D,we[H]=O,!oe&&!le&&(De[H]+=X?-l:l,we[H]-=X?l:-l),De[V]=re,we[V]=re,W.push(De),Z.push(we);var ve=void 0;if(Jx[1]&&x.reverse(),{coordPair:x,brkId:hr().serializeAxisBreakIdentifier(_.breakOption)}});l.sort(function(y,_){return y.coordPair[0]-_.coordPair[0]});for(var u=o[0],c=null,h=0;h=0?l[0].width:l[1].width),f=(h+c.x)/2-u.x,d=Math.min(f,f-c.x),g=Math.max(f,f-c.x),m=g<0?g:d>0?d:0;s=(f-m)/c.x}var y=new Pe,_=new Pe;Pe.scale(y,n,-s),Pe.scale(_,n,1-s),YM(r[0],y),YM(r[1],_)}function Kbe(e,t){var r={breaks:[]};return E(t.breaks,function(n){if(n){var i=ys(e.get("breaks",!0),function(s){return hr().identifyAxisBreak(s,n)});if(i){var a=t.type,o={isExpanded:!!i.isExpanded};i.isExpanded=a===Eb?!0:a===wW?!1:a===SW?!i.isExpanded:i.isExpanded,r.breaks.push({start:i.start,end:i.end,isExpanded:!!i.isExpanded,old:o})}}}),r}function Jbe(){vue({adjustBreakLabelPair:qbe,buildAxisBreakLine:Xbe,rectCoordBuildBreakAxis:Ybe,updateModelAxisBreak:Kbe})}function Qbe(e){yue(e),Ube(),Jbe()}function ewe(){Ece(twe)}function twe(e,t){E(e,function(r){if(!r.model.get(["axisLabel","inside"])){var n=rwe(r);if(n){var i=r.isHorizontal()?"height":"width",a=r.model.get(["axisLabel","margin"]);t[i]-=n[i]+a,r.position==="top"?t.y+=n.height+a:r.position==="left"&&(t.x+=n.width+a)}}})}function rwe(e){var t=e.model,r=e.scale;if(!t.get(["axisLabel","show"])||r.isBlank())return;var n,i,a=r.getExtent();r instanceof yg?i=r.count():(n=r.getTicks(),i=n.length);var o=e.getLabelModel(),s=cm(e),l,u=1;i>40&&(u=Math.ceil(i/40));for(var c=0;c1&&arguments[1]!==void 0?arguments[1]:60,i=null;return function(){for(var a=this,o=arguments.length,s=new Array(o),l=0;l12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function _we(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function xwe(e){return e==="ROUTER"||e==="ROUTER_LATE"?30:e==="REPEATER"||e==="TRACKER"?25:e==="CLIENT_MUTE"?7:e==="CLIENT_BASE"?12:15}function bwe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const i=G.useRef(null),[a,o]=G.useState("connected"),s=G.useMemo(()=>{const y=new Set;return t.forEach(_=>{y.add(_.from_node),y.add(_.to_node)}),y},[t]),l=G.useMemo(()=>{let y=e;return a==="connected"?y=y.filter(_=>s.has(_.node_num)):a==="infra"&&(y=y.filter(_=>vB.includes(_.role))),y},[e,a,s]),u=G.useMemo(()=>new Map(l.map(y=>[y.node_num,y])),[l]),c=G.useMemo(()=>t.filter(y=>u.has(y.from_node)&&u.has(y.to_node)),[t,u]),h=G.useMemo(()=>{const y=new Set;return r!==null&&c.forEach(_=>{_.from_node===r&&y.add(_.to_node),_.to_node===r&&y.add(_.from_node)}),y},[r,c]),f=G.useMemo(()=>{const y=l.map(x=>{const w=_we(x.latitude),S=dB[w%dB.length],T=vB.includes(x.role),M=x.node_num===r,A=h.has(x.node_num),N=r===null||M||A;return{id:String(x.node_num),name:x.short_name,value:x.node_num,symbolSize:xwe(x.role),itemStyle:{color:T?S:"#111827",borderColor:S,borderWidth:T?0:2,opacity:N?1:.15},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace",color:N?"#94a3b8":"#94a3b820"},nodeNum:x.node_num,longName:x.long_name,role:x.role}}),_=c.map(x=>{const w=r===null||x.from_node===r||x.to_node===r;return{source:String(x.from_node),target:String(x.to_node),value:x.snr,lineStyle:{color:ywe(x.snr),width:w&&r!==null?2:1,opacity:r===null?.4:w?.6:.04}}});return{nodes:y,links:_}},[l,c,r,h]),d=G.useMemo(()=>({backgroundColor:"#111827",tooltip:{trigger:"item",backgroundColor:"#1e293b",borderColor:"#334155",textStyle:{color:"#e2e8f0",fontFamily:"JetBrains Mono, monospace",fontSize:11},formatter:y=>{if(y.data&&y.data.longName){const _=y.data;return`${_.name}
${_.longName}
Role: ${_.role}`}return""}},series:[{type:"graph",layout:"force",roam:!0,draggable:!0,animation:!1,data:f.nodes,links:f.links,force:{repulsion:200,edgeLength:[80,120],gravity:.1},emphasis:{focus:"adjacency",blurScope:"coordinateSystem",scale:1.1,lineStyle:{width:2}},blur:{itemStyle:{opacity:.15},lineStyle:{opacity:.04}},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace"},edgeLabel:{show:!1},edgeSymbol:["none","none"]}]}),[f]),g=G.useCallback(y=>{if(y.data&&"nodeNum"in y.data){const _=y.data.nodeNum;n(r===_?null:_??null)}},[r,n]),m=G.useMemo(()=>({click:g}),[g]);return G.useEffect(()=>{var _;const y=(_=i.current)==null?void 0:_.getEchartsInstance();y&&y.setOption(d,{notMerge:!1,lazyUpdate:!0})},[d]),v.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[v.jsx(mwe,{ref:i,option:d,style:{height:"540px",width:"100%"},onEvents:m,opts:{renderer:"canvas"}}),v.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2",children:[v.jsx(eL,{size:14,className:"text-slate-500"}),v.jsx("div",{className:"flex gap-1",children:[{key:"connected",label:"Connected"},{key:"infra",label:"Infra"},{key:"all",label:"All"}].map(({key:y,label:_})=>v.jsx("button",{onClick:()=>o(y),className:`px-2 py-1 text-xs rounded transition-colors ${a===y?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:_},y))}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[l.length," nodes • ",c.length," edges"]})]}),v.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[v.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Edge Quality (SNR)"}),v.jsx("div",{className:"space-y-1",children:[{label:"Excellent (>12)",color:"#22c55e"},{label:"Good (8-12)",color:"#4ade80"},{label:"Fair (5-8)",color:"#f59e0b"},{label:"Marginal (3-5)",color:"#f97316"},{label:"Poor (<3)",color:"#ef4444"}].map(y=>v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:y.color}}),v.jsx("span",{className:"text-xs text-slate-500",children:y.label})]},y.label))})]}),v.jsxs("div",{className:"absolute bottom-4 right-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[v.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Node Type"}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-3 h-3 rounded-full bg-sky-400"}),v.jsx("span",{className:"text-xs text-slate-500",children:"Infrastructure"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-900 border-2 border-sky-400"}),v.jsx("span",{className:"text-xs text-slate-500",children:"Client"})]})]})]})]})}function EZ(e,t){const r=G.useRef(t);G.useEffect(function(){t!==r.current&&e.attributionControl!=null&&(r.current!=null&&e.attributionControl.removeAttribution(r.current),t!=null&&e.attributionControl.addAttribution(t)),r.current=t},[e,t])}function wwe(e,t,r){t.center!==r.center&&e.setLatLng(t.center),t.radius!=null&&t.radius!==r.radius&&e.setRadius(t.radius)}const Swe=1;function Cwe(e){return Object.freeze({__version:Swe,map:e})}function RZ(e,t){return Object.freeze({...e,...t})}const jZ=G.createContext(null),OZ=jZ.Provider;function qb(){const e=G.useContext(jZ);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function Twe(e){function t(r,n){const{instance:i,context:a}=e(r).current;return G.useImperativeHandle(n,()=>i),r.children==null?null:Sf.createElement(OZ,{value:a},r.children)}return G.forwardRef(t)}function Mwe(e){function t(r,n){const[i,a]=G.useState(!1),{instance:o}=e(r,a).current;G.useImperativeHandle(n,()=>o),G.useEffect(function(){i&&o.update()},[o,i,r.children]);const s=o._contentNode;return s?BV.createPortal(r.children,s):null}return G.forwardRef(t)}function Awe(e){function t(r,n){const{instance:i}=e(r).current;return G.useImperativeHandle(n,()=>i),null}return G.forwardRef(t)}function lP(e,t){const r=G.useRef();G.useEffect(function(){return t!=null&&e.instance.on(t),r.current=t,function(){r.current!=null&&e.instance.off(r.current),r.current=null}},[e,t])}function Kb(e,t){const r=e.pane??t.pane;return r?{...e,pane:r}:e}function kwe(e,t){return function(n,i){const a=qb(),o=e(Kb(n,a),a);return EZ(a.map,n.attribution),lP(o.current,n.eventHandlers),t(o.current,a,n,i),o}}var JA={exports:{}};/* @preserve - * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com - * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade - */(function(e,t){(function(r,n){n(t)})(G$,function(r){var n="1.9.4";function i(p){var b,C,k,R;for(C=1,k=arguments.length;C"u"||!L||!L.Mixin)){p=w(p)?p:[p];for(var b=0;b0?Math.floor(p):Math.ceil(p)};z.prototype={clone:function(){return new z(this.x,this.y)},add:function(p){return this.clone()._add(W(p))},_add:function(p){return this.x+=p.x,this.y+=p.y,this},subtract:function(p){return this.clone()._subtract(W(p))},_subtract:function(p){return this.x-=p.x,this.y-=p.y,this},divideBy:function(p){return this.clone()._divideBy(p)},_divideBy:function(p){return this.x/=p,this.y/=p,this},multiplyBy:function(p){return this.clone()._multiplyBy(p)},_multiplyBy:function(p){return this.x*=p,this.y*=p,this},scaleBy:function(p){return new z(this.x*p.x,this.y*p.y)},unscaleBy:function(p){return new z(this.x/p.x,this.y/p.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=$(this.x),this.y=$(this.y),this},distanceTo:function(p){p=W(p);var b=p.x-this.x,C=p.y-this.y;return Math.sqrt(b*b+C*C)},equals:function(p){return p=W(p),p.x===this.x&&p.y===this.y},contains:function(p){return p=W(p),Math.abs(p.x)<=Math.abs(this.x)&&Math.abs(p.y)<=Math.abs(this.y)},toString:function(){return"Point("+f(this.x)+", "+f(this.y)+")"}};function W(p,b,C){return p instanceof z?p:w(p)?new z(p[0],p[1]):p==null?p:typeof p=="object"&&"x"in p&&"y"in p?new z(p.x,p.y):new z(p,b,C)}function Z(p,b){if(p)for(var C=b?[p,b]:p,k=0,R=C.length;k=this.min.x&&C.x<=this.max.x&&b.y>=this.min.y&&C.y<=this.max.y},intersects:function(p){p=X(p);var b=this.min,C=this.max,k=p.min,R=p.max,F=R.x>=b.x&&k.x<=C.x,Y=R.y>=b.y&&k.y<=C.y;return F&&Y},overlaps:function(p){p=X(p);var b=this.min,C=this.max,k=p.min,R=p.max,F=R.x>b.x&&k.xb.y&&k.y=b.lat&&R.lat<=C.lat&&k.lng>=b.lng&&R.lng<=C.lng},intersects:function(p){p=J(p);var b=this._southWest,C=this._northEast,k=p.getSouthWest(),R=p.getNorthEast(),F=R.lat>=b.lat&&k.lat<=C.lat,Y=R.lng>=b.lng&&k.lng<=C.lng;return F&&Y},overlaps:function(p){p=J(p);var b=this._southWest,C=this._northEast,k=p.getSouthWest(),R=p.getNorthEast(),F=R.lat>b.lat&&k.latb.lng&&k.lng1,ye=function(){var p=!1;try{var b=Object.defineProperty({},"passive",{get:function(){p=!0}});window.addEventListener("testPassiveEventSupport",h,b),window.removeEventListener("testPassiveEventSupport",h,b)}catch{}return p}(),er=function(){return!!document.createElement("canvas").getContext}(),wn=!!(document.createElementNS&&nt("svg").createSVGRect),mi=!!wn&&function(){var p=document.createElement("div");return p.innerHTML="",(p.firstChild&&p.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),Ji=!wn&&function(){try{var p=document.createElement("div");p.innerHTML='';var b=p.firstChild;return b.style.behavior="url(#default#VML)",b&&typeof b.adj=="object"}catch{return!1}}(),Vl=navigator.platform.indexOf("Mac")===0,te=navigator.platform.indexOf("Linux")===0;function et(p){return navigator.userAgent.toLowerCase().indexOf(p)>=0}var be={ie:Xe,ielt9:Zt,edge:On,webkit:Qn,android:So,android23:Nd,androidStock:xm,opera:eh,chrome:Pd,gecko:Dd,safari:bm,phantom:Ed,opera12:Rd,win:Jb,ie3d:kt,webkit3d:jd,gecko3d:wm,any3d:Qb,mobile:Ve,mobileWebkit:ew,mobileWebkit3d:tw,msPointer:Co,pointer:Ir,touch:Cm,touchNative:Sm,mobileOpera:Tm,mobileGecko:Mm,retina:Am,passiveEvents:ye,canvas:er,svg:wn,vml:Ji,inlineSvg:mi,mac:Vl,linux:te},dt=be.msPointer?"MSPointerDown":"pointerdown",or=be.msPointer?"MSPointerMove":"pointermove",Ca=be.msPointer?"MSPointerUp":"pointerup",ws=be.msPointer?"MSPointerCancel":"pointercancel",th={touchstart:dt,touchmove:or,touchend:Ca,touchcancel:ws},Od={touchstart:Dm,touchmove:Gl,touchend:Gl,touchcancel:Gl},To={},zd=!1;function km(p,b,C){return b==="touchstart"&&Pm(),Od[b]?(C=Od[b].bind(this,C),p.addEventListener(th[b],C,!1),C):(console.warn("wrong event specified:",b),h)}function Lm(p,b,C){if(!th[b]){console.warn("wrong event specified:",b);return}p.removeEventListener(th[b],C,!1)}function Im(p){To[p.pointerId]=p}function Nm(p){To[p.pointerId]&&(To[p.pointerId]=p)}function Bd(p){delete To[p.pointerId]}function Pm(){zd||(document.addEventListener(dt,Im,!0),document.addEventListener(or,Nm,!0),document.addEventListener(Ca,Bd,!0),document.addEventListener(ws,Bd,!0),zd=!0)}function Gl(p,b){if(b.pointerType!==(b.MSPOINTER_TYPE_MOUSE||"mouse")){b.touches=[];for(var C in To)b.touches.push(To[C]);b.changedTouches=[b],p(b)}}function Dm(p,b){b.MSPOINTER_TYPE_TOUCH&&b.pointerType===b.MSPOINTER_TYPE_TOUCH&&Yr(b),Gl(p,b)}function Em(p){var b={},C,k;for(k in p)C=p[k],b[k]=C&&C.bind?C.bind(p):C;return p=b,b.type="dblclick",b.detail=2,b.isTrusted=!1,b._simulated=!0,b}var Rm=200;function jm(p,b){p.addEventListener("dblclick",b);var C=0,k;function R(F){if(F.detail!==1){k=F.detail;return}if(!(F.pointerType==="mouse"||F.sourceCapabilities&&!F.sourceCapabilities.firesTouchEvents)){var Y=vP(F);if(!(Y.some(function(ie){return ie instanceof HTMLLabelElement&&ie.attributes.for})&&!Y.some(function(ie){return ie instanceof HTMLInputElement||ie instanceof HTMLSelectElement}))){var Q=Date.now();Q-C<=Rm?(k++,k===2&&b(Em(F))):k=1,C=Q}}}return p.addEventListener("click",R),{dblclick:b,simDblclick:R}}function Om(p,b){p.removeEventListener("dblclick",b.dblclick),p.removeEventListener("click",b.simDblclick)}var Hl=Fm(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Ss=Fm(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Dt=Ss==="webkitTransition"||Ss==="OTransition"?Ss+"End":"transitionend";function St(p){return typeof p=="string"?document.getElementById(p):p}function yt(p,b){var C=p.style[b]||p.currentStyle&&p.currentStyle[b];if((!C||C==="auto")&&document.defaultView){var k=document.defaultView.getComputedStyle(p,null);C=k?k[b]:null}return C==="auto"?null:C}function xt(p,b,C){var k=document.createElement(p);return k.className=b||"",C&&C.appendChild(k),k}function Gt(p){var b=p.parentNode;b&&b.removeChild(p)}function zm(p){for(;p.firstChild;)p.removeChild(p.firstChild)}function rh(p){var b=p.parentNode;b&&b.lastChild!==p&&b.appendChild(p)}function nh(p){var b=p.parentNode;b&&b.firstChild!==p&&b.insertBefore(p,b.firstChild)}function rw(p,b){if(p.classList!==void 0)return p.classList.contains(b);var C=Bm(p);return C.length>0&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(C)}function ut(p,b){if(p.classList!==void 0)for(var C=g(b),k=0,R=C.length;k0?2*window.devicePixelRatio:1;function gP(p){return be.edge?p.wheelDeltaY/2:p.deltaY&&p.deltaMode===0?-p.deltaY/YZ:p.deltaY&&p.deltaMode===1?-p.deltaY*20:p.deltaY&&p.deltaMode===2?-p.deltaY*60:p.deltaX||p.deltaZ?0:p.wheelDelta?(p.wheelDeltaY||p.wheelDelta)/2:p.detail&&Math.abs(p.detail)<32765?-p.detail*20:p.detail?p.detail/-32765*60:0}function vw(p,b){var C=b.relatedTarget;if(!C)return!0;try{for(;C&&C!==p;)C=C.parentNode}catch{return!1}return C!==p}var XZ={__proto__:null,on:ot,off:Ht,stopPropagation:Zl,disableScrollPropagation:dw,disableClickPropagation:Hd,preventDefault:Yr,stop:$l,getPropagationPath:vP,getMousePosition:pP,getWheelDelta:gP,isExternalTarget:vw,addListener:ot,removeListener:Ht},mP=V.extend({run:function(p,b,C,k){this.stop(),this._el=p,this._inProgress=!0,this._duration=C||.25,this._easeOutPower=1/Math.max(k||.5,.2),this._startPos=Wl(p),this._offset=b.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=D(this._animate,this),this._step()},_step:function(p){var b=+new Date-this._startTime,C=this._duration*1e3;bthis.options.maxZoom)?this.setZoom(p):this},panInsideBounds:function(p,b){this._enforcingBounds=!0;var C=this.getCenter(),k=this._limitCenter(C,this._zoom,J(p));return C.equals(k)||this.panTo(k,b),this._enforcingBounds=!1,this},panInside:function(p,b){b=b||{};var C=W(b.paddingTopLeft||b.padding||[0,0]),k=W(b.paddingBottomRight||b.padding||[0,0]),R=this.project(this.getCenter()),F=this.project(p),Y=this.getPixelBounds(),Q=X([Y.min.add(C),Y.max.subtract(k)]),ie=Q.getSize();if(!Q.contains(F)){this._enforcingBounds=!0;var ce=F.subtract(Q.getCenter()),Ee=Q.extend(F).getSize().subtract(ie);R.x+=ce.x<0?-Ee.x:Ee.x,R.y+=ce.y<0?-Ee.y:Ee.y,this.panTo(this.unproject(R),b),this._enforcingBounds=!1}return this},invalidateSize:function(p){if(!this._loaded)return this;p=i({animate:!1,pan:!0},p===!0?{animate:!0}:p);var b=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var C=this.getSize(),k=b.divideBy(2).round(),R=C.divideBy(2).round(),F=k.subtract(R);return!F.x&&!F.y?this:(p.animate&&p.pan?this.panBy(F):(p.pan&&this._rawPanBy(F),this.fire("move"),p.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:b,newSize:C}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(p){if(p=this._locateOptions=i({timeout:1e4,watch:!1},p),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var b=o(this._handleGeolocationResponse,this),C=o(this._handleGeolocationError,this);return p.watch?this._locationWatchId=navigator.geolocation.watchPosition(b,C,p):navigator.geolocation.getCurrentPosition(b,C,p),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(p){if(this._container._leaflet_id){var b=p.code,C=p.message||(b===1?"permission denied":b===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:b,message:"Geolocation error: "+C+"."})}},_handleGeolocationResponse:function(p){if(this._container._leaflet_id){var b=p.coords.latitude,C=p.coords.longitude,k=new oe(b,C),R=k.toBounds(p.coords.accuracy*2),F=this._locateOptions;if(F.setView){var Y=this.getBoundsZoom(R);this.setView(k,F.maxZoom?Math.min(Y,F.maxZoom):Y)}var Q={latlng:k,bounds:R,timestamp:p.timestamp};for(var ie in p.coords)typeof p.coords[ie]=="number"&&(Q[ie]=p.coords[ie]);this.fire("locationfound",Q)}},addHandler:function(p,b){if(!b)return this;var C=this[p]=new b(this);return this._handlers.push(C),this.options[p]&&C.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Gt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(O(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var p;for(p in this._layers)this._layers[p].remove();for(p in this._panes)Gt(this._panes[p]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(p,b){var C="leaflet-pane"+(p?" leaflet-"+p.replace("Pane","")+"-pane":""),k=xt("div",C,b||this._mapPane);return p&&(this._panes[p]=k),k},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var p=this.getPixelBounds(),b=this.unproject(p.getBottomLeft()),C=this.unproject(p.getTopRight());return new re(b,C)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(p,b,C){p=J(p),C=W(C||[0,0]);var k=this.getZoom()||0,R=this.getMinZoom(),F=this.getMaxZoom(),Y=p.getNorthWest(),Q=p.getSouthEast(),ie=this.getSize().subtract(C),ce=X(this.project(Q,k),this.project(Y,k)).getSize(),Ee=be.any3d?this.options.zoomSnap:1,Ke=ie.x/ce.x,vt=ie.y/ce.y,Sn=b?Math.max(Ke,vt):Math.min(Ke,vt);return k=this.getScaleZoom(Sn,k),Ee&&(k=Math.round(k/(Ee/100))*(Ee/100),k=b?Math.ceil(k/Ee)*Ee:Math.floor(k/Ee)*Ee),Math.max(R,Math.min(F,k))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new z(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(p,b){var C=this._getTopLeftPoint(p,b);return new Z(C,C.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(p){return this.options.crs.getProjectedBounds(p===void 0?this.getZoom():p)},getPane:function(p){return typeof p=="string"?this._panes[p]:p},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(p,b){var C=this.options.crs;return b=b===void 0?this._zoom:b,C.scale(p)/C.scale(b)},getScaleZoom:function(p,b){var C=this.options.crs;b=b===void 0?this._zoom:b;var k=C.zoom(p*C.scale(b));return isNaN(k)?1/0:k},project:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.latLngToPoint(le(p),b)},unproject:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.pointToLatLng(W(p),b)},layerPointToLatLng:function(p){var b=W(p).add(this.getPixelOrigin());return this.unproject(b)},latLngToLayerPoint:function(p){var b=this.project(le(p))._round();return b._subtract(this.getPixelOrigin())},wrapLatLng:function(p){return this.options.crs.wrapLatLng(le(p))},wrapLatLngBounds:function(p){return this.options.crs.wrapLatLngBounds(J(p))},distance:function(p,b){return this.options.crs.distance(le(p),le(b))},containerPointToLayerPoint:function(p){return W(p).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(p){return W(p).add(this._getMapPanePos())},containerPointToLatLng:function(p){var b=this.containerPointToLayerPoint(W(p));return this.layerPointToLatLng(b)},latLngToContainerPoint:function(p){return this.layerPointToContainerPoint(this.latLngToLayerPoint(le(p)))},mouseEventToContainerPoint:function(p){return pP(p,this._container)},mouseEventToLayerPoint:function(p){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(p))},mouseEventToLatLng:function(p){return this.layerPointToLatLng(this.mouseEventToLayerPoint(p))},_initContainer:function(p){var b=this._container=St(p);if(b){if(b._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");ot(b,"scroll",this._onScroll,this),this._containerId=l(b)},_initLayout:function(){var p=this._container;this._fadeAnimated=this.options.fadeAnimation&&be.any3d,ut(p,"leaflet-container"+(be.touch?" leaflet-touch":"")+(be.retina?" leaflet-retina":"")+(be.ielt9?" leaflet-oldie":"")+(be.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var b=yt(p,"position");b!=="absolute"&&b!=="relative"&&b!=="fixed"&&b!=="sticky"&&(p.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var p=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),xr(this._mapPane,new z(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(ut(p.markerPane,"leaflet-zoom-hide"),ut(p.shadowPane,"leaflet-zoom-hide"))},_resetView:function(p,b,C){xr(this._mapPane,new z(0,0));var k=!this._loaded;this._loaded=!0,b=this._limitZoom(b),this.fire("viewprereset");var R=this._zoom!==b;this._moveStart(R,C)._move(p,b)._moveEnd(R),this.fire("viewreset"),k&&this.fire("load")},_moveStart:function(p,b){return p&&this.fire("zoomstart"),b||this.fire("movestart"),this},_move:function(p,b,C,k){b===void 0&&(b=this._zoom);var R=this._zoom!==b;return this._zoom=b,this._lastCenter=p,this._pixelOrigin=this._getNewPixelOrigin(p),k?C&&C.pinch&&this.fire("zoom",C):((R||C&&C.pinch)&&this.fire("zoom",C),this.fire("move",C)),this},_moveEnd:function(p){return p&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return O(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(p){xr(this._mapPane,this._getMapPanePos().subtract(p))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(p){this._targets={},this._targets[l(this._container)]=this;var b=p?Ht:ot;b(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&b(window,"resize",this._onResize,this),be.any3d&&this.options.transform3DLimit&&(p?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){O(this._resizeRequest),this._resizeRequest=D(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var p=this._getMapPanePos();Math.max(Math.abs(p.x),Math.abs(p.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(p,b){for(var C=[],k,R=b==="mouseout"||b==="mouseover",F=p.target||p.srcElement,Y=!1;F;){if(k=this._targets[l(F)],k&&(b==="click"||b==="preclick")&&this._draggableMoved(k)){Y=!0;break}if(k&&k.listens(b,!0)&&(R&&!vw(F,p)||(C.push(k),R))||F===this._container)break;F=F.parentNode}return!C.length&&!Y&&!R&&this.listens(b,!0)&&(C=[this]),C},_isClickDisabled:function(p){for(;p&&p!==this._container;){if(p._leaflet_disable_click)return!0;p=p.parentNode}},_handleDOMEvent:function(p){var b=p.target||p.srcElement;if(!(!this._loaded||b._leaflet_disable_events||p.type==="click"&&this._isClickDisabled(b))){var C=p.type;C==="mousedown"&&lw(b),this._fireDOMEvent(p,C)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(p,b,C){if(p.type==="click"){var k=i({},p);k.type="preclick",this._fireDOMEvent(k,k.type,C)}var R=this._findEventTargets(p,b);if(C){for(var F=[],Y=0;Y0?Math.round(p-b)/2:Math.max(0,Math.ceil(p))-Math.max(0,Math.floor(b))},_limitZoom:function(p){var b=this.getMinZoom(),C=this.getMaxZoom(),k=be.any3d?this.options.zoomSnap:1;return k&&(p=Math.round(p/k)*k),Math.max(b,Math.min(C,p))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){pr(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(p,b){var C=this._getCenterOffset(p)._trunc();return(b&&b.animate)!==!0&&!this.getSize().contains(C)?!1:(this.panBy(C,b),!0)},_createAnimProxy:function(){var p=this._proxy=xt("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(p),this.on("zoomanim",function(b){var C=Hl,k=this._proxy.style[C];Ul(this._proxy,this.project(b.center,b.zoom),this.getZoomScale(b.zoom,1)),k===this._proxy.style[C]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Gt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var p=this.getCenter(),b=this.getZoom();Ul(this._proxy,this.project(p,b),this.getZoomScale(b,1))},_catchTransitionEnd:function(p){this._animatingZoom&&p.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(p,b,C){if(this._animatingZoom)return!0;if(C=C||{},!this._zoomAnimated||C.animate===!1||this._nothingToAnimate()||Math.abs(b-this._zoom)>this.options.zoomAnimationThreshold)return!1;var k=this.getZoomScale(b),R=this._getCenterOffset(p)._divideBy(1-1/k);return C.animate!==!0&&!this.getSize().contains(R)?!1:(D(function(){this._moveStart(!0,C.noMoveStart||!1)._animateZoom(p,b,!0)},this),!0)},_animateZoom:function(p,b,C,k){this._mapPane&&(C&&(this._animatingZoom=!0,this._animateToCenter=p,this._animateToZoom=b,ut(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:p,zoom:b,noUpdate:k}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(o(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&pr(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function qZ(p,b){return new Ct(p,b)}var Qi=B.extend({options:{position:"topright"},initialize:function(p){m(this,p)},getPosition:function(){return this.options.position},setPosition:function(p){var b=this._map;return b&&b.removeControl(this),this.options.position=p,b&&b.addControl(this),this},getContainer:function(){return this._container},addTo:function(p){this.remove(),this._map=p;var b=this._container=this.onAdd(p),C=this.getPosition(),k=p._controlCorners[C];return ut(b,"leaflet-control"),C.indexOf("bottom")!==-1?k.insertBefore(b,k.firstChild):k.appendChild(b),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Gt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(p){this._map&&p&&p.screenX>0&&p.screenY>0&&this._map.getContainer().focus()}}),Ud=function(p){return new Qi(p)};Ct.include({addControl:function(p){return p.addTo(this),this},removeControl:function(p){return p.remove(),this},_initControlPos:function(){var p=this._controlCorners={},b="leaflet-",C=this._controlContainer=xt("div",b+"control-container",this._container);function k(R,F){var Y=b+R+" "+b+F;p[R+F]=xt("div",Y,C)}k("top","left"),k("top","right"),k("bottom","left"),k("bottom","right")},_clearControlPos:function(){for(var p in this._controlCorners)Gt(this._controlCorners[p]);Gt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var yP=Qi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(p,b,C,k){return C1,this._baseLayersList.style.display=p?"":"none"),this._separator.style.display=b&&p?"":"none",this},_onLayerChange:function(p){this._handlingClick||this._update();var b=this._getLayer(l(p.target)),C=b.overlay?p.type==="add"?"overlayadd":"overlayremove":p.type==="add"?"baselayerchange":null;C&&this._map.fire(C,b)},_createRadioElement:function(p,b){var C='",k=document.createElement("div");return k.innerHTML=C,k.firstChild},_addItem:function(p){var b=document.createElement("label"),C=this._map.hasLayer(p.layer),k;p.overlay?(k=document.createElement("input"),k.type="checkbox",k.className="leaflet-control-layers-selector",k.defaultChecked=C):k=this._createRadioElement("leaflet-base-layers_"+l(this),C),this._layerControlInputs.push(k),k.layerId=l(p.layer),ot(k,"click",this._onInputClick,this);var R=document.createElement("span");R.innerHTML=" "+p.name;var F=document.createElement("span");b.appendChild(F),F.appendChild(k),F.appendChild(R);var Y=p.overlay?this._overlaysList:this._baseLayersList;return Y.appendChild(b),this._checkDisabledLayers(),b},_onInputClick:function(){if(!this._preventClick){var p=this._layerControlInputs,b,C,k=[],R=[];this._handlingClick=!0;for(var F=p.length-1;F>=0;F--)b=p[F],C=this._getLayer(b.layerId).layer,b.checked?k.push(C):b.checked||R.push(C);for(F=0;F=0;R--)b=p[R],C=this._getLayer(b.layerId).layer,b.disabled=C.options.minZoom!==void 0&&kC.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var p=this._section;this._preventClick=!0,ot(p,"click",Yr),this.expand();var b=this;setTimeout(function(){Ht(p,"click",Yr),b._preventClick=!1})}}),KZ=function(p,b,C){return new yP(p,b,C)},pw=Qi.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(p){var b="leaflet-control-zoom",C=xt("div",b+" leaflet-bar"),k=this.options;return this._zoomInButton=this._createButton(k.zoomInText,k.zoomInTitle,b+"-in",C,this._zoomIn),this._zoomOutButton=this._createButton(k.zoomOutText,k.zoomOutTitle,b+"-out",C,this._zoomOut),this._updateDisabled(),p.on("zoomend zoomlevelschange",this._updateDisabled,this),C},onRemove:function(p){p.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(p){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(p.shiftKey?3:1))},_createButton:function(p,b,C,k,R){var F=xt("a",C,k);return F.innerHTML=p,F.href="#",F.title=b,F.setAttribute("role","button"),F.setAttribute("aria-label",b),Hd(F),ot(F,"click",$l),ot(F,"click",R,this),ot(F,"click",this._refocusOnMap,this),F},_updateDisabled:function(){var p=this._map,b="leaflet-disabled";pr(this._zoomInButton,b),pr(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||p._zoom===p.getMinZoom())&&(ut(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||p._zoom===p.getMaxZoom())&&(ut(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});Ct.mergeOptions({zoomControl:!0}),Ct.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new pw,this.addControl(this.zoomControl))});var JZ=function(p){return new pw(p)},_P=Qi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(p){var b="leaflet-control-scale",C=xt("div",b),k=this.options;return this._addScales(k,b+"-line",C),p.on(k.updateWhenIdle?"moveend":"move",this._update,this),p.whenReady(this._update,this),C},onRemove:function(p){p.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(p,b,C){p.metric&&(this._mScale=xt("div",b,C)),p.imperial&&(this._iScale=xt("div",b,C))},_update:function(){var p=this._map,b=p.getSize().y/2,C=p.distance(p.containerPointToLatLng([0,b]),p.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(C)},_updateScales:function(p){this.options.metric&&p&&this._updateMetric(p),this.options.imperial&&p&&this._updateImperial(p)},_updateMetric:function(p){var b=this._getRoundNum(p),C=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,C,b/p)},_updateImperial:function(p){var b=p*3.2808399,C,k,R;b>5280?(C=b/5280,k=this._getRoundNum(C),this._updateScale(this._iScale,k+" mi",k/C)):(R=this._getRoundNum(b),this._updateScale(this._iScale,R+" ft",R/b))},_updateScale:function(p,b,C){p.style.width=Math.round(this.options.maxWidth*C)+"px",p.innerHTML=b},_getRoundNum:function(p){var b=Math.pow(10,(Math.floor(p)+"").length-1),C=p/b;return C=C>=10?10:C>=5?5:C>=3?3:C>=2?2:1,b*C}}),QZ=function(p){return new _P(p)},e$='',gw=Qi.extend({options:{position:"bottomright",prefix:''+(be.inlineSvg?e$+" ":"")+"Leaflet"},initialize:function(p){m(this,p),this._attributions={}},onAdd:function(p){p.attributionControl=this,this._container=xt("div","leaflet-control-attribution"),Hd(this._container);for(var b in p._layers)p._layers[b].getAttribution&&this.addAttribution(p._layers[b].getAttribution());return this._update(),p.on("layeradd",this._addAttribution,this),this._container},onRemove:function(p){p.off("layeradd",this._addAttribution,this)},_addAttribution:function(p){p.layer.getAttribution&&(this.addAttribution(p.layer.getAttribution()),p.layer.once("remove",function(){this.removeAttribution(p.layer.getAttribution())},this))},setPrefix:function(p){return this.options.prefix=p,this._update(),this},addAttribution:function(p){return p?(this._attributions[p]||(this._attributions[p]=0),this._attributions[p]++,this._update(),this):this},removeAttribution:function(p){return p?(this._attributions[p]&&(this._attributions[p]--,this._update()),this):this},_update:function(){if(this._map){var p=[];for(var b in this._attributions)this._attributions[b]&&p.push(b);var C=[];this.options.prefix&&C.push(this.options.prefix),p.length&&C.push(p.join(", ")),this._container.innerHTML=C.join(' ')}}});Ct.mergeOptions({attributionControl:!0}),Ct.addInitHook(function(){this.options.attributionControl&&new gw().addTo(this)});var t$=function(p){return new gw(p)};Qi.Layers=yP,Qi.Zoom=pw,Qi.Scale=_P,Qi.Attribution=gw,Ud.layers=KZ,Ud.zoom=JZ,Ud.scale=QZ,Ud.attribution=t$;var Ma=B.extend({initialize:function(p){this._map=p},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});Ma.addTo=function(p,b){return p.addHandler(b,this),this};var r$={Events:H},xP=be.touch?"touchstart mousedown":"mousedown",Cs=V.extend({options:{clickTolerance:3},initialize:function(p,b,C,k){m(this,k),this._element=p,this._dragStartTarget=b||p,this._preventOutline=C},enable:function(){this._enabled||(ot(this._dragStartTarget,xP,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Cs._dragging===this&&this.finishDrag(!0),Ht(this._dragStartTarget,xP,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(p){if(this._enabled&&(this._moved=!1,!rw(this._element,"leaflet-zoom-anim"))){if(p.touches&&p.touches.length!==1){Cs._dragging===this&&this.finishDrag();return}if(!(Cs._dragging||p.shiftKey||p.which!==1&&p.button!==1&&!p.touches)&&(Cs._dragging=this,this._preventOutline&&lw(this._element),aw(),Fd(),!this._moving)){this.fire("down");var b=p.touches?p.touches[0]:p,C=fP(this._element);this._startPoint=new z(b.clientX,b.clientY),this._startPos=Wl(this._element),this._parentScale=uw(C);var k=p.type==="mousedown";ot(document,k?"mousemove":"touchmove",this._onMove,this),ot(document,k?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(p){if(this._enabled){if(p.touches&&p.touches.length>1){this._moved=!0;return}var b=p.touches&&p.touches.length===1?p.touches[0]:p,C=new z(b.clientX,b.clientY)._subtract(this._startPoint);!C.x&&!C.y||Math.abs(C.x)+Math.abs(C.y)F&&(Y=Q,F=ie);F>C&&(b[Y]=1,yw(p,b,C,k,Y),yw(p,b,C,Y,R))}function o$(p,b){for(var C=[p[0]],k=1,R=0,F=p.length;kb&&(C.push(p[k]),R=k);return Rb.max.x&&(C|=2),p.yb.max.y&&(C|=8),C}function s$(p,b){var C=b.x-p.x,k=b.y-p.y;return C*C+k*k}function Wd(p,b,C,k){var R=b.x,F=b.y,Y=C.x-R,Q=C.y-F,ie=Y*Y+Q*Q,ce;return ie>0&&(ce=((p.x-R)*Y+(p.y-F)*Q)/ie,ce>1?(R=C.x,F=C.y):ce>0&&(R+=Y*ce,F+=Q*ce)),Y=p.x-R,Q=p.y-F,k?Y*Y+Q*Q:new z(R,F)}function _i(p){return!w(p[0])||typeof p[0][0]!="object"&&typeof p[0][0]<"u"}function AP(p){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),_i(p)}function kP(p,b){var C,k,R,F,Y,Q,ie,ce;if(!p||p.length===0)throw new Error("latlngs not passed");_i(p)||(console.warn("latlngs are not flat! Only the first ring will be used"),p=p[0]);var Ee=le([0,0]),Ke=J(p),vt=Ke.getNorthWest().distanceTo(Ke.getSouthWest())*Ke.getNorthEast().distanceTo(Ke.getNorthWest());vt<1700&&(Ee=mw(p));var Sn=p.length,Br=[];for(C=0;Ck){ie=(F-k)/R,ce=[Q.x-ie*(Q.x-Y.x),Q.y-ie*(Q.y-Y.y)];break}var zn=b.unproject(W(ce));return le([zn.lat+Ee.lat,zn.lng+Ee.lng])}var l$={__proto__:null,simplify:SP,pointToSegmentDistance:CP,closestPointOnSegment:i$,clipSegment:MP,_getEdgeIntersection:Hm,_getBitCode:Yl,_sqClosestPointOnSegment:Wd,isFlat:_i,_flat:AP,polylineCenter:kP},_w={project:function(p){return new z(p.lng,p.lat)},unproject:function(p){return new oe(p.y,p.x)},bounds:new Z([-180,-90],[180,90])},xw={R:6378137,R_MINOR:6356752314245179e-9,bounds:new Z([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(p){var b=Math.PI/180,C=this.R,k=p.lat*b,R=this.R_MINOR/C,F=Math.sqrt(1-R*R),Y=F*Math.sin(k),Q=Math.tan(Math.PI/4-k/2)/Math.pow((1-Y)/(1+Y),F/2);return k=-C*Math.log(Math.max(Q,1e-10)),new z(p.lng*b*C,k)},unproject:function(p){for(var b=180/Math.PI,C=this.R,k=this.R_MINOR/C,R=Math.sqrt(1-k*k),F=Math.exp(-p.y/C),Y=Math.PI/2-2*Math.atan(F),Q=0,ie=.1,ce;Q<15&&Math.abs(ie)>1e-7;Q++)ce=R*Math.sin(Y),ce=Math.pow((1-ce)/(1+ce),R/2),ie=Math.PI/2-2*Math.atan(F*ce)-Y,Y+=ie;return new oe(Y*b,p.x*b/C)}},u$={__proto__:null,LonLat:_w,Mercator:xw,SphericalMercator:Ne},c$=i({},we,{code:"EPSG:3395",projection:xw,transformation:function(){var p=.5/(Math.PI*xw.R);return Le(p,.5,-p,.5)}()}),LP=i({},we,{code:"EPSG:4326",projection:_w,transformation:Le(1/180,1,-1/180,.5)}),h$=i({},De,{projection:_w,transformation:Le(1,0,-1,0),scale:function(p){return Math.pow(2,p)},zoom:function(p){return Math.log(p)/Math.LN2},distance:function(p,b){var C=b.lng-p.lng,k=b.lat-p.lat;return Math.sqrt(C*C+k*k)},infinite:!0});De.Earth=we,De.EPSG3395=c$,De.EPSG3857=ht,De.EPSG900913=Fe,De.EPSG4326=LP,De.Simple=h$;var ea=V.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(p){return p.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(p){return p&&p.removeLayer(this),this},getPane:function(p){return this._map.getPane(p?this.options[p]||p:this.options.pane)},addInteractiveTarget:function(p){return this._map._targets[l(p)]=this,this},removeInteractiveTarget:function(p){return delete this._map._targets[l(p)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(p){var b=p.target;if(b.hasLayer(this)){if(this._map=b,this._zoomAnimated=b._zoomAnimated,this.getEvents){var C=this.getEvents();b.on(C,this),this.once("remove",function(){b.off(C,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});Ct.include({addLayer:function(p){if(!p._layerAdd)throw new Error("The provided object is not a Layer.");var b=l(p);return this._layers[b]?this:(this._layers[b]=p,p._mapToAdd=this,p.beforeAdd&&p.beforeAdd(this),this.whenReady(p._layerAdd,p),this)},removeLayer:function(p){var b=l(p);return this._layers[b]?(this._loaded&&p.onRemove(this),delete this._layers[b],this._loaded&&(this.fire("layerremove",{layer:p}),p.fire("remove")),p._map=p._mapToAdd=null,this):this},hasLayer:function(p){return l(p)in this._layers},eachLayer:function(p,b){for(var C in this._layers)p.call(b,this._layers[C]);return this},_addLayers:function(p){p=p?w(p)?p:[p]:[];for(var b=0,C=p.length;bthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&b[0]instanceof oe&&b[0].equals(b[C-1])&&b.pop(),b},_setLatLngs:function(p){Ao.prototype._setLatLngs.call(this,p),_i(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return _i(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var p=this._renderer._bounds,b=this.options.weight,C=new z(b,b);if(p=new Z(p.min.subtract(C),p.max.add(C)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(p))){if(this.options.noClip){this._parts=this._rings;return}for(var k=0,R=this._rings.length,F;kp.y!=R.y>p.y&&p.x<(R.x-k.x)*(p.y-k.y)/(R.y-k.y)+k.x&&(b=!b);return b||Ao.prototype._containsPoint.call(this,p,!0)}});function _$(p,b){return new oh(p,b)}var ko=Mo.extend({initialize:function(p,b){m(this,b),this._layers={},p&&this.addData(p)},addData:function(p){var b=w(p)?p:p.features,C,k,R;if(b){for(C=0,k=b.length;C0&&R.push(R[0].slice()),R}function sh(p,b){return p.feature?i({},p.feature,{geometry:b}):Xm(b)}function Xm(p){return p.type==="Feature"||p.type==="FeatureCollection"?p:{type:"Feature",properties:{},geometry:p}}var Cw={toGeoJSON:function(p){return sh(this,{type:"Point",coordinates:Sw(this.getLatLng(),p)})}};Um.include(Cw),bw.include(Cw),Wm.include(Cw),Ao.include({toGeoJSON:function(p){var b=!_i(this._latlngs),C=Ym(this._latlngs,b?1:0,!1,p);return sh(this,{type:(b?"Multi":"")+"LineString",coordinates:C})}}),oh.include({toGeoJSON:function(p){var b=!_i(this._latlngs),C=b&&!_i(this._latlngs[0]),k=Ym(this._latlngs,C?2:b?1:0,!0,p);return b||(k=[k]),sh(this,{type:(C?"Multi":"")+"Polygon",coordinates:k})}}),ih.include({toMultiPoint:function(p){var b=[];return this.eachLayer(function(C){b.push(C.toGeoJSON(p).geometry.coordinates)}),sh(this,{type:"MultiPoint",coordinates:b})},toGeoJSON:function(p){var b=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(b==="MultiPoint")return this.toMultiPoint(p);var C=b==="GeometryCollection",k=[];return this.eachLayer(function(R){if(R.toGeoJSON){var F=R.toGeoJSON(p);if(C)k.push(F.geometry);else{var Y=Xm(F);Y.type==="FeatureCollection"?k.push.apply(k,Y.features):k.push(Y)}}}),C?sh(this,{geometries:k,type:"GeometryCollection"}):{type:"FeatureCollection",features:k}}});function PP(p,b){return new ko(p,b)}var x$=PP,qm=ea.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(p,b,C){this._url=p,this._bounds=J(b),m(this,C)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(ut(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Gt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(p){return this.options.opacity=p,this._image&&this._updateOpacity(),this},setStyle:function(p){return p.opacity&&this.setOpacity(p.opacity),this},bringToFront:function(){return this._map&&rh(this._image),this},bringToBack:function(){return this._map&&nh(this._image),this},setUrl:function(p){return this._url=p,this._image&&(this._image.src=p),this},setBounds:function(p){return this._bounds=J(p),this._map&&this._reset(),this},getEvents:function(){var p={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(p.zoomanim=this._animateZoom),p},setZIndex:function(p){return this.options.zIndex=p,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var p=this._url.tagName==="IMG",b=this._image=p?this._url:xt("img");if(ut(b,"leaflet-image-layer"),this._zoomAnimated&&ut(b,"leaflet-zoom-animated"),this.options.className&&ut(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onload=o(this.fire,this,"load"),b.onerror=o(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(b.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),p){this._url=b.src;return}b.src=this._url,b.alt=this.options.alt},_animateZoom:function(p){var b=this._map.getZoomScale(p.zoom),C=this._map._latLngBoundsToNewLayerBounds(this._bounds,p.zoom,p.center).min;Ul(this._image,C,b)},_reset:function(){var p=this._image,b=new Z(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),C=b.getSize();xr(p,b.min),p.style.width=C.x+"px",p.style.height=C.y+"px"},_updateOpacity:function(){yi(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var p=this.options.errorOverlayUrl;p&&this._url!==p&&(this._url=p,this._image.src=p)},getCenter:function(){return this._bounds.getCenter()}}),b$=function(p,b,C){return new qm(p,b,C)},DP=qm.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var p=this._url.tagName==="VIDEO",b=this._image=p?this._url:xt("video");if(ut(b,"leaflet-image-layer"),this._zoomAnimated&&ut(b,"leaflet-zoom-animated"),this.options.className&&ut(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onloadeddata=o(this.fire,this,"load"),p){for(var C=b.getElementsByTagName("source"),k=[],R=0;R0?k:[b.src];return}w(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(b.style,"objectFit")&&(b.style.objectFit="fill"),b.autoplay=!!this.options.autoplay,b.loop=!!this.options.loop,b.muted=!!this.options.muted,b.playsInline=!!this.options.playsInline;for(var F=0;FR?(b.height=R+"px",ut(p,F)):pr(p,F),this._containerWidth=this._container.offsetWidth},_animateZoom:function(p){var b=this._map._latLngToNewLayerPoint(this._latlng,p.zoom,p.center),C=this._getAnchor();xr(this._container,b.add(C))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var p=this._map,b=parseInt(yt(this._container,"marginBottom"),10)||0,C=this._container.offsetHeight+b,k=this._containerWidth,R=new z(this._containerLeft,-C-this._containerBottom);R._add(Wl(this._container));var F=p.layerPointToContainerPoint(R),Y=W(this.options.autoPanPadding),Q=W(this.options.autoPanPaddingTopLeft||Y),ie=W(this.options.autoPanPaddingBottomRight||Y),ce=p.getSize(),Ee=0,Ke=0;F.x+k+ie.x>ce.x&&(Ee=F.x+k-ce.x+ie.x),F.x-Ee-Q.x<0&&(Ee=F.x-Q.x),F.y+C+ie.y>ce.y&&(Ke=F.y+C-ce.y+ie.y),F.y-Ke-Q.y<0&&(Ke=F.y-Q.y),(Ee||Ke)&&(this.options.keepInView&&(this._autopanning=!0),p.fire("autopanstart").panBy([Ee,Ke]))}},_getAnchor:function(){return W(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),C$=function(p,b){return new Km(p,b)};Ct.mergeOptions({closePopupOnClick:!0}),Ct.include({openPopup:function(p,b,C){return this._initOverlay(Km,p,b,C).openOn(this),this},closePopup:function(p){return p=arguments.length?p:this._popup,p&&p.close(),this}}),ea.include({bindPopup:function(p,b){return this._popup=this._initOverlay(Km,this._popup,p,b),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(p){return this._popup&&(this instanceof Mo||(this._popup._source=this),this._popup._prepareOpen(p||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(p){return this._popup&&this._popup.setContent(p),this},getPopup:function(){return this._popup},_openPopup:function(p){if(!(!this._popup||!this._map)){$l(p);var b=p.layer||p.target;if(this._popup._source===b&&!(b instanceof Ts)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(p.latlng);return}this._popup._source=b,this.openPopup(p.latlng)}},_movePopup:function(p){this._popup.setLatLng(p.latlng)},_onKeyPress:function(p){p.originalEvent.keyCode===13&&this._openPopup(p)}});var Jm=Aa.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(p){Aa.prototype.onAdd.call(this,p),this.setOpacity(this.options.opacity),p.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(p){Aa.prototype.onRemove.call(this,p),p.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var p=Aa.prototype.getEvents.call(this);return this.options.permanent||(p.preclick=this.close),p},_initLayout:function(){var p="leaflet-tooltip",b=p+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=xt("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(p){var b,C,k=this._map,R=this._container,F=k.latLngToContainerPoint(k.getCenter()),Y=k.layerPointToContainerPoint(p),Q=this.options.direction,ie=R.offsetWidth,ce=R.offsetHeight,Ee=W(this.options.offset),Ke=this._getAnchor();Q==="top"?(b=ie/2,C=ce):Q==="bottom"?(b=ie/2,C=0):Q==="center"?(b=ie/2,C=ce/2):Q==="right"?(b=0,C=ce/2):Q==="left"?(b=ie,C=ce/2):Y.xthis.options.maxZoom||Ck?this._retainParent(R,F,Y,k):!1)},_retainChildren:function(p,b,C,k){for(var R=2*p;R<2*p+2;R++)for(var F=2*b;F<2*b+2;F++){var Y=new z(R,F);Y.z=C+1;var Q=this._tileCoordsToKey(Y),ie=this._tiles[Q];if(ie&&ie.active){ie.retain=!0;continue}else ie&&ie.loaded&&(ie.retain=!0);C+1this.options.maxZoom||this.options.minZoom!==void 0&&R1){this._setView(p,C);return}for(var Ke=R.min.y;Ke<=R.max.y;Ke++)for(var vt=R.min.x;vt<=R.max.x;vt++){var Sn=new z(vt,Ke);if(Sn.z=this._tileZoom,!!this._isValidTile(Sn)){var Br=this._tiles[this._tileCoordsToKey(Sn)];Br?Br.current=!0:Y.push(Sn)}}if(Y.sort(function(zn,uh){return zn.distanceTo(F)-uh.distanceTo(F)}),Y.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var xi=document.createDocumentFragment();for(vt=0;vtC.max.x)||!b.wrapLat&&(p.yC.max.y))return!1}if(!this.options.bounds)return!0;var k=this._tileCoordsToBounds(p);return J(this.options.bounds).overlaps(k)},_keyToBounds:function(p){return this._tileCoordsToBounds(this._keyToTileCoords(p))},_tileCoordsToNwSe:function(p){var b=this._map,C=this.getTileSize(),k=p.scaleBy(C),R=k.add(C),F=b.unproject(k,p.z),Y=b.unproject(R,p.z);return[F,Y]},_tileCoordsToBounds:function(p){var b=this._tileCoordsToNwSe(p),C=new re(b[0],b[1]);return this.options.noWrap||(C=this._map.wrapLatLngBounds(C)),C},_tileCoordsToKey:function(p){return p.x+":"+p.y+":"+p.z},_keyToTileCoords:function(p){var b=p.split(":"),C=new z(+b[0],+b[1]);return C.z=+b[2],C},_removeTile:function(p){var b=this._tiles[p];b&&(Gt(b.el),delete this._tiles[p],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(p)}))},_initTile:function(p){ut(p,"leaflet-tile");var b=this.getTileSize();p.style.width=b.x+"px",p.style.height=b.y+"px",p.onselectstart=h,p.onmousemove=h,be.ielt9&&this.options.opacity<1&&yi(p,this.options.opacity)},_addTile:function(p,b){var C=this._getTilePos(p),k=this._tileCoordsToKey(p),R=this.createTile(this._wrapCoords(p),o(this._tileReady,this,p));this._initTile(R),this.createTile.length<2&&D(o(this._tileReady,this,p,null,R)),xr(R,C),this._tiles[k]={el:R,coords:p,current:!0},b.appendChild(R),this.fire("tileloadstart",{tile:R,coords:p})},_tileReady:function(p,b,C){b&&this.fire("tileerror",{error:b,tile:C,coords:p});var k=this._tileCoordsToKey(p);C=this._tiles[k],C&&(C.loaded=+new Date,this._map._fadeAnimated?(yi(C.el,0),O(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(C.active=!0,this._pruneTiles()),b||(ut(C.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:C.el,coords:p})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),be.ielt9||!this._map._fadeAnimated?D(this._pruneTiles,this):setTimeout(o(this._pruneTiles,this),250)))},_getTilePos:function(p){return p.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(p){var b=new z(this._wrapX?c(p.x,this._wrapX):p.x,this._wrapY?c(p.y,this._wrapY):p.y);return b.z=p.z,b},_pxBoundsToTileRange:function(p){var b=this.getTileSize();return new Z(p.min.unscaleBy(b).floor(),p.max.unscaleBy(b).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var p in this._tiles)if(!this._tiles[p].loaded)return!1;return!0}});function A$(p){return new $d(p)}var lh=$d.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(p,b){this._url=p,b=m(this,b),b.detectRetina&&be.retina&&b.maxZoom>0?(b.tileSize=Math.floor(b.tileSize/2),b.zoomReverse?(b.zoomOffset--,b.minZoom=Math.min(b.maxZoom,b.minZoom+1)):(b.zoomOffset++,b.maxZoom=Math.max(b.minZoom,b.maxZoom-1)),b.minZoom=Math.max(0,b.minZoom)):b.zoomReverse?b.minZoom=Math.min(b.maxZoom,b.minZoom):b.maxZoom=Math.max(b.minZoom,b.maxZoom),typeof b.subdomains=="string"&&(b.subdomains=b.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(p,b){return this._url===p&&b===void 0&&(b=!0),this._url=p,b||this.redraw(),this},createTile:function(p,b){var C=document.createElement("img");return ot(C,"load",o(this._tileOnLoad,this,b,C)),ot(C,"error",o(this._tileOnError,this,b,C)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(C.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(C.referrerPolicy=this.options.referrerPolicy),C.alt="",C.src=this.getTileUrl(p),C},getTileUrl:function(p){var b={r:be.retina?"@2x":"",s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var C=this._globalTileRange.max.y-p.y;this.options.tms&&(b.y=C),b["-y"]=C}return x(this._url,i(b,this.options))},_tileOnLoad:function(p,b){be.ielt9?setTimeout(o(p,this,null,b),0):p(null,b)},_tileOnError:function(p,b,C){var k=this.options.errorTileUrl;k&&b.getAttribute("src")!==k&&(b.src=k),p(C,b)},_onTileRemove:function(p){p.tile.onload=null},_getZoomForUrl:function(){var p=this._tileZoom,b=this.options.maxZoom,C=this.options.zoomReverse,k=this.options.zoomOffset;return C&&(p=b-p),p+k},_getSubdomain:function(p){var b=Math.abs(p.x+p.y)%this.options.subdomains.length;return this.options.subdomains[b]},_abortLoading:function(){var p,b;for(p in this._tiles)if(this._tiles[p].coords.z!==this._tileZoom&&(b=this._tiles[p].el,b.onload=h,b.onerror=h,!b.complete)){b.src=T;var C=this._tiles[p].coords;Gt(b),delete this._tiles[p],this.fire("tileabort",{tile:b,coords:C})}},_removeTile:function(p){var b=this._tiles[p];if(b)return b.el.setAttribute("src",T),$d.prototype._removeTile.call(this,p)},_tileReady:function(p,b,C){if(!(!this._map||C&&C.getAttribute("src")===T))return $d.prototype._tileReady.call(this,p,b,C)}});function jP(p,b){return new lh(p,b)}var OP=lh.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(p,b){this._url=p;var C=i({},this.defaultWmsParams);for(var k in b)k in this.options||(C[k]=b[k]);b=m(this,b);var R=b.detectRetina&&be.retina?2:1,F=this.getTileSize();C.width=F.x*R,C.height=F.y*R,this.wmsParams=C},onAdd:function(p){this._crs=this.options.crs||p.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var b=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[b]=this._crs.code,lh.prototype.onAdd.call(this,p)},getTileUrl:function(p){var b=this._tileCoordsToNwSe(p),C=this._crs,k=X(C.project(b[0]),C.project(b[1])),R=k.min,F=k.max,Y=(this._wmsVersion>=1.3&&this._crs===LP?[R.y,R.x,F.y,F.x]:[R.x,R.y,F.x,F.y]).join(","),Q=lh.prototype.getTileUrl.call(this,p);return Q+y(this.wmsParams,Q,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+Y},setParams:function(p,b){return i(this.wmsParams,p),b||this.redraw(),this}});function k$(p,b){return new OP(p,b)}lh.WMS=OP,jP.wms=k$;var Lo=ea.extend({options:{padding:.1},initialize:function(p){m(this,p),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),ut(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var p={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(p.zoomanim=this._onAnimZoom),p},_onAnimZoom:function(p){this._updateTransform(p.center,p.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(p,b){var C=this._map.getZoomScale(b,this._zoom),k=this._map.getSize().multiplyBy(.5+this.options.padding),R=this._map.project(this._center,b),F=k.multiplyBy(-C).add(R).subtract(this._map._getNewPixelOrigin(p,b));be.any3d?Ul(this._container,F,C):xr(this._container,F)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var p in this._layers)this._layers[p]._reset()},_onZoomEnd:function(){for(var p in this._layers)this._layers[p]._project()},_updatePaths:function(){for(var p in this._layers)this._layers[p]._update()},_update:function(){var p=this.options.padding,b=this._map.getSize(),C=this._map.containerPointToLayerPoint(b.multiplyBy(-p)).round();this._bounds=new Z(C,C.add(b.multiplyBy(1+p*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),zP=Lo.extend({options:{tolerance:0},getEvents:function(){var p=Lo.prototype.getEvents.call(this);return p.viewprereset=this._onViewPreReset,p},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Lo.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var p=this._container=document.createElement("canvas");ot(p,"mousemove",this._onMouseMove,this),ot(p,"click dblclick mousedown mouseup contextmenu",this._onClick,this),ot(p,"mouseout",this._handleMouseOut,this),p._leaflet_disable_events=!0,this._ctx=p.getContext("2d")},_destroyContainer:function(){O(this._redrawRequest),delete this._ctx,Gt(this._container),Ht(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var p;this._redrawBounds=null;for(var b in this._layers)p=this._layers[b],p._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Lo.prototype._update.call(this);var p=this._bounds,b=this._container,C=p.getSize(),k=be.retina?2:1;xr(b,p.min),b.width=k*C.x,b.height=k*C.y,b.style.width=C.x+"px",b.style.height=C.y+"px",be.retina&&this._ctx.scale(2,2),this._ctx.translate(-p.min.x,-p.min.y),this.fire("update")}},_reset:function(){Lo.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(p){this._updateDashArray(p),this._layers[l(p)]=p;var b=p._order={layer:p,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=b),this._drawLast=b,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(p){this._requestRedraw(p)},_removePath:function(p){var b=p._order,C=b.next,k=b.prev;C?C.prev=k:this._drawLast=k,k?k.next=C:this._drawFirst=C,delete p._order,delete this._layers[l(p)],this._requestRedraw(p)},_updatePath:function(p){this._extendRedrawBounds(p),p._project(),p._update(),this._requestRedraw(p)},_updateStyle:function(p){this._updateDashArray(p),this._requestRedraw(p)},_updateDashArray:function(p){if(typeof p.options.dashArray=="string"){var b=p.options.dashArray.split(/[, ]+/),C=[],k,R;for(R=0;R')}}catch{}return function(p){return document.createElement("<"+p+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),L$={_initContainer:function(){this._container=xt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Lo.prototype._update.call(this),this.fire("update"))},_initPath:function(p){var b=p._container=Yd("shape");ut(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",p._path=Yd("path"),b.appendChild(p._path),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){var b=p._container;this._container.appendChild(b),p.options.interactive&&p.addInteractiveTarget(b)},_removePath:function(p){var b=p._container;Gt(b),p.removeInteractiveTarget(b),delete this._layers[l(p)]},_updateStyle:function(p){var b=p._stroke,C=p._fill,k=p.options,R=p._container;R.stroked=!!k.stroke,R.filled=!!k.fill,k.stroke?(b||(b=p._stroke=Yd("stroke")),R.appendChild(b),b.weight=k.weight+"px",b.color=k.color,b.opacity=k.opacity,k.dashArray?b.dashStyle=w(k.dashArray)?k.dashArray.join(" "):k.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=k.lineCap.replace("butt","flat"),b.joinstyle=k.lineJoin):b&&(R.removeChild(b),p._stroke=null),k.fill?(C||(C=p._fill=Yd("fill")),R.appendChild(C),C.color=k.fillColor||k.color,C.opacity=k.fillOpacity):C&&(R.removeChild(C),p._fill=null)},_updateCircle:function(p){var b=p._point.round(),C=Math.round(p._radius),k=Math.round(p._radiusY||C);this._setPath(p,p._empty()?"M0 0":"AL "+b.x+","+b.y+" "+C+","+k+" 0,"+65535*360)},_setPath:function(p,b){p._path.v=b},_bringToFront:function(p){rh(p._container)},_bringToBack:function(p){nh(p._container)}},Qm=be.vml?Yd:nt,Xd=Lo.extend({_initContainer:function(){this._container=Qm("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Qm("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Gt(this._container),Ht(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Lo.prototype._update.call(this);var p=this._bounds,b=p.getSize(),C=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,C.setAttribute("width",b.x),C.setAttribute("height",b.y)),xr(C,p.min),C.setAttribute("viewBox",[p.min.x,p.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(p){var b=p._path=Qm("path");p.options.className&&ut(b,p.options.className),p.options.interactive&&ut(b,"leaflet-interactive"),this._updateStyle(p),this._layers[l(p)]=p},_addPath:function(p){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(p._path),p.addInteractiveTarget(p._path)},_removePath:function(p){Gt(p._path),p.removeInteractiveTarget(p._path),delete this._layers[l(p)]},_updatePath:function(p){p._project(),p._update()},_updateStyle:function(p){var b=p._path,C=p.options;b&&(C.stroke?(b.setAttribute("stroke",C.color),b.setAttribute("stroke-opacity",C.opacity),b.setAttribute("stroke-width",C.weight),b.setAttribute("stroke-linecap",C.lineCap),b.setAttribute("stroke-linejoin",C.lineJoin),C.dashArray?b.setAttribute("stroke-dasharray",C.dashArray):b.removeAttribute("stroke-dasharray"),C.dashOffset?b.setAttribute("stroke-dashoffset",C.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),C.fill?(b.setAttribute("fill",C.fillColor||C.color),b.setAttribute("fill-opacity",C.fillOpacity),b.setAttribute("fill-rule",C.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(p,b){this._setPath(p,ft(p._parts,b))},_updateCircle:function(p){var b=p._point,C=Math.max(Math.round(p._radius),1),k=Math.max(Math.round(p._radiusY),1)||C,R="a"+C+","+k+" 0 1,0 ",F=p._empty()?"M0 0":"M"+(b.x-C)+","+b.y+R+C*2+",0 "+R+-C*2+",0 ";this._setPath(p,F)},_setPath:function(p,b){p._path.setAttribute("d",b)},_bringToFront:function(p){rh(p._path)},_bringToBack:function(p){nh(p._path)}});be.vml&&Xd.include(L$);function FP(p){return be.svg||be.vml?new Xd(p):null}Ct.include({getRenderer:function(p){var b=p.options.renderer||this._getPaneRenderer(p.options.pane)||this.options.renderer||this._renderer;return b||(b=this._renderer=this._createRenderer()),this.hasLayer(b)||this.addLayer(b),b},_getPaneRenderer:function(p){if(p==="overlayPane"||p===void 0)return!1;var b=this._paneRenderers[p];return b===void 0&&(b=this._createRenderer({pane:p}),this._paneRenderers[p]=b),b},_createRenderer:function(p){return this.options.preferCanvas&&BP(p)||FP(p)}});var VP=oh.extend({initialize:function(p,b){oh.prototype.initialize.call(this,this._boundsToLatLngs(p),b)},setBounds:function(p){return this.setLatLngs(this._boundsToLatLngs(p))},_boundsToLatLngs:function(p){return p=J(p),[p.getSouthWest(),p.getNorthWest(),p.getNorthEast(),p.getSouthEast()]}});function I$(p,b){return new VP(p,b)}Xd.create=Qm,Xd.pointsToPath=ft,ko.geometryToLayer=Zm,ko.coordsToLatLng=ww,ko.coordsToLatLngs=$m,ko.latLngToCoords=Sw,ko.latLngsToCoords=Ym,ko.getFeature=sh,ko.asFeature=Xm,Ct.mergeOptions({boxZoom:!0});var GP=Ma.extend({initialize:function(p){this._map=p,this._container=p._container,this._pane=p._panes.overlayPane,this._resetStateTimeout=0,p.on("unload",this._destroy,this)},addHooks:function(){ot(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Ht(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Gt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(p){if(!p.shiftKey||p.which!==1&&p.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Fd(),aw(),this._startPoint=this._map.mouseEventToContainerPoint(p),ot(document,{contextmenu:$l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(p){this._moved||(this._moved=!0,this._box=xt("div","leaflet-zoom-box",this._container),ut(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(p);var b=new Z(this._point,this._startPoint),C=b.getSize();xr(this._box,b.min),this._box.style.width=C.x+"px",this._box.style.height=C.y+"px"},_finish:function(){this._moved&&(Gt(this._box),pr(this._container,"leaflet-crosshair")),Vd(),ow(),Ht(document,{contextmenu:$l,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(p){if(!(p.which!==1&&p.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(o(this._resetState,this),0);var b=new re(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(b).fire("boxzoomend",{boxZoomBounds:b})}},_onKeyDown:function(p){p.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Ct.addInitHook("addHandler","boxZoom",GP),Ct.mergeOptions({doubleClickZoom:!0});var HP=Ma.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(p){var b=this._map,C=b.getZoom(),k=b.options.zoomDelta,R=p.originalEvent.shiftKey?C-k:C+k;b.options.doubleClickZoom==="center"?b.setZoom(R):b.setZoomAround(p.containerPoint,R)}});Ct.addInitHook("addHandler","doubleClickZoom",HP),Ct.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var UP=Ma.extend({addHooks:function(){if(!this._draggable){var p=this._map;this._draggable=new Cs(p._mapPane,p._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),p.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),p.on("zoomend",this._onZoomEnd,this),p.whenReady(this._onZoomEnd,this))}ut(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){pr(this._map._container,"leaflet-grab"),pr(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var p=this._map;if(p._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var b=J(this._map.options.maxBounds);this._offsetLimit=X(this._map.latLngToContainerPoint(b.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(b.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;p.fire("movestart").fire("dragstart"),p.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(p){if(this._map.options.inertia){var b=this._lastTime=+new Date,C=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(C),this._times.push(b),this._prunePositions(b)}this._map.fire("move",p).fire("drag",p)},_prunePositions:function(p){for(;this._positions.length>1&&p-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var p=this._map.getSize().divideBy(2),b=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=b.subtract(p).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(p,b){return p-(p-b)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var p=this._draggable._newPos.subtract(this._draggable._startPos),b=this._offsetLimit;p.xb.max.x&&(p.x=this._viscousLimit(p.x,b.max.x)),p.y>b.max.y&&(p.y=this._viscousLimit(p.y,b.max.y)),this._draggable._newPos=this._draggable._startPos.add(p)}},_onPreDragWrap:function(){var p=this._worldWidth,b=Math.round(p/2),C=this._initialWorldOffset,k=this._draggable._newPos.x,R=(k-b+C)%p+b-C,F=(k+b+C)%p-b-C,Y=Math.abs(R+C)0?F:-F))-b;this._delta=0,this._startTime=null,Y&&(p.options.scrollWheelZoom==="center"?p.setZoom(b+Y):p.setZoomAround(this._lastMousePos,b+Y))}});Ct.addInitHook("addHandler","scrollWheelZoom",ZP);var N$=600;Ct.mergeOptions({tapHold:be.touchNative&&be.safari&&be.mobile,tapTolerance:15});var $P=Ma.extend({addHooks:function(){ot(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Ht(this._map._container,"touchstart",this._onDown,this)},_onDown:function(p){if(clearTimeout(this._holdTimeout),p.touches.length===1){var b=p.touches[0];this._startPos=this._newPos=new z(b.clientX,b.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(ot(document,"touchend",Yr),ot(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),N$),ot(document,"touchend touchcancel contextmenu",this._cancel,this),ot(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function p(){Ht(document,"touchend",Yr),Ht(document,"touchend touchcancel",p)},_cancel:function(){clearTimeout(this._holdTimeout),Ht(document,"touchend touchcancel contextmenu",this._cancel,this),Ht(document,"touchmove",this._onMove,this)},_onMove:function(p){var b=p.touches[0];this._newPos=new z(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(p,b){var C=new MouseEvent(p,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});C._simulated=!0,b.target.dispatchEvent(C)}});Ct.addInitHook("addHandler","tapHold",$P),Ct.mergeOptions({touchZoom:be.touch,bounceAtZoomLimits:!0});var YP=Ma.extend({addHooks:function(){ut(this._map._container,"leaflet-touch-zoom"),ot(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){pr(this._map._container,"leaflet-touch-zoom"),Ht(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(p){var b=this._map;if(!(!p.touches||p.touches.length!==2||b._animatingZoom||this._zooming)){var C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]);this._centerPoint=b.getSize()._divideBy(2),this._startLatLng=b.containerPointToLatLng(this._centerPoint),b.options.touchZoom!=="center"&&(this._pinchStartLatLng=b.containerPointToLatLng(C.add(k)._divideBy(2))),this._startDist=C.distanceTo(k),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),ot(document,"touchmove",this._onTouchMove,this),ot(document,"touchend touchcancel",this._onTouchEnd,this),Yr(p)}},_onTouchMove:function(p){if(!(!p.touches||p.touches.length!==2||!this._zooming)){var b=this._map,C=b.mouseEventToContainerPoint(p.touches[0]),k=b.mouseEventToContainerPoint(p.touches[1]),R=C.distanceTo(k)/this._startDist;if(this._zoom=b.getScaleZoom(R,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoomb.getMaxZoom()&&R>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,R===1)return}else{var F=C._add(k)._divideBy(2)._subtract(this._centerPoint);if(R===1&&F.x===0&&F.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(F),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),O(this._animRequest);var Y=o(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=D(Y,this,!0),Yr(p)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,O(this._animRequest),Ht(document,"touchmove",this._onTouchMove,this),Ht(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Ct.addInitHook("addHandler","touchZoom",YP),Ct.BoxZoom=GP,Ct.DoubleClickZoom=HP,Ct.Drag=UP,Ct.Keyboard=WP,Ct.ScrollWheelZoom=ZP,Ct.TapHold=$P,Ct.TouchZoom=YP,r.Bounds=Z,r.Browser=be,r.CRS=De,r.Canvas=zP,r.Circle=bw,r.CircleMarker=Wm,r.Class=B,r.Control=Qi,r.DivIcon=RP,r.DivOverlay=Aa,r.DomEvent=XZ,r.DomUtil=$Z,r.Draggable=Cs,r.Evented=V,r.FeatureGroup=Mo,r.GeoJSON=ko,r.GridLayer=$d,r.Handler=Ma,r.Icon=ah,r.ImageOverlay=qm,r.LatLng=oe,r.LatLngBounds=re,r.Layer=ea,r.LayerGroup=ih,r.LineUtil=l$,r.Map=Ct,r.Marker=Um,r.Mixin=r$,r.Path=Ts,r.Point=z,r.PolyUtil=n$,r.Polygon=oh,r.Polyline=Ao,r.Popup=Km,r.PosAnimation=mP,r.Projection=u$,r.Rectangle=VP,r.Renderer=Lo,r.SVG=Xd,r.SVGOverlay=EP,r.TileLayer=lh,r.Tooltip=Jm,r.Transformation=xe,r.Util=j,r.VideoOverlay=DP,r.bind=o,r.bounds=X,r.canvas=BP,r.circle=m$,r.circleMarker=g$,r.control=Ud,r.divIcon=M$,r.extend=i,r.featureGroup=d$,r.geoJSON=PP,r.geoJson=x$,r.gridLayer=A$,r.icon=v$,r.imageOverlay=b$,r.latLng=le,r.latLngBounds=J,r.layerGroup=f$,r.map=qZ,r.marker=p$,r.point=W,r.polygon=_$,r.polyline=y$,r.popup=C$,r.rectangle=I$,r.setOptions=m,r.stamp=l,r.svg=FP,r.svgOverlay=S$,r.tileLayer=jP,r.tooltip=T$,r.transformation=Le,r.version=n,r.videoOverlay=w$;var P$=window.L;r.noConflict=function(){return window.L=P$,this},window.L=r})})(JA,JA.exports);var Qc=JA.exports;const zZ=ek(Qc);function ym(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function uP(e,t){return t==null?function(n,i){const a=G.useRef();return a.current||(a.current=e(n,i)),a}:function(n,i){const a=G.useRef();a.current||(a.current=e(n,i));const o=G.useRef(n),{instance:s}=a.current;return G.useEffect(function(){o.current!==n&&(t(s,n,o.current),o.current=n)},[s,n,i]),a}}function BZ(e,t){G.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var a;(a=t.layerContainer)==null||a.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function Lwe(e){return function(r){const n=qb(),i=e(Kb(r,n),n);return EZ(n.map,r.attribution),lP(i.current,r.eventHandlers),BZ(i.current,n),i}}function Iwe(e,t){const r=G.useRef();G.useEffect(function(){if(t.pathOptions!==r.current){const i=t.pathOptions??{};e.instance.setStyle(i),r.current=i}},[e,t])}function Nwe(e){return function(r){const n=qb(),i=e(Kb(r,n),n);return lP(i.current,r.eventHandlers),BZ(i.current,n),Iwe(i.current,r),i}}function FZ(e,t){const r=uP(e),n=kwe(r,t);return Mwe(n)}function VZ(e,t){const r=uP(e,t),n=Nwe(r);return Twe(n)}function Pwe(e,t){const r=uP(e,t),n=Lwe(r);return Awe(n)}function Dwe(e,t,r){const{opacity:n,zIndex:i}=t;n!=null&&n!==r.opacity&&e.setOpacity(n),i!=null&&i!==r.zIndex&&e.setZIndex(i)}function Ewe(){return qb().map}const Rwe=VZ(function({center:t,children:r,...n},i){const a=new Qc.CircleMarker(t,n);return ym(a,RZ(i,{overlayContainer:a}))},wwe);function QA(){return QA=Object.assign||function(e){for(var t=1;t(d==null?void 0:d.map)??null,[d]);const m=G.useCallback(_=>{if(_!==null&&d===null){const x=new Qc.Map(_,c);r!=null&&u!=null?x.setView(r,u):e!=null&&x.fitBounds(e,t),l!=null&&x.whenReady(l),g(Cwe(x))}},[]);G.useEffect(()=>()=>{d==null||d.map.remove()},[d]);const y=d?Sf.createElement(OZ,{value:d},n):o??null;return Sf.createElement("div",QA({},f,{ref:m}),y)}const Owe=G.forwardRef(jwe),zwe=VZ(function({positions:t,...r},n){const i=new Qc.Polyline(t,r);return ym(i,RZ(n,{overlayContainer:i}))},function(t,r,n){r.positions!==n.positions&&t.setLatLngs(r.positions)}),Bwe=FZ(function(t,r){const n=new Qc.Popup(t,r.overlayContainer);return ym(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const{instance:o}=t;function s(u){u.popup===o&&(o.update(),i(!0))}function l(u){u.popup===o&&i(!1)}return r.map.on({popupopen:s,popupclose:l}),r.overlayContainer==null?(n!=null&&o.setLatLng(n),o.openOn(r.map)):r.overlayContainer.bindPopup(o),function(){var c;r.map.off({popupopen:s,popupclose:l}),(c=r.overlayContainer)==null||c.unbindPopup(),r.map.removeLayer(o)}},[t,r,i,n])}),Fwe=Pwe(function({url:t,...r},n){const i=new Qc.TileLayer(t,Kb(r,n));return ym(i,n)},function(t,r,n){Dwe(t,r,n);const{url:i}=r;i!=null&&i!==n.url&&t.setUrl(i)}),Vwe=FZ(function(t,r){const n=new Qc.Tooltip(t,r.overlayContainer);return ym(n,r)},function(t,r,{position:n},i){G.useEffect(function(){const o=r.overlayContainer;if(o==null)return;const{instance:s}=t,l=c=>{c.tooltip===s&&(n!=null&&s.setLatLng(n),s.update(),i(!0))},u=c=>{c.tooltip===s&&i(!1)};return o.on({tooltipopen:l,tooltipclose:u}),o.bindTooltip(s),function(){o.off({tooltipopen:l,tooltipclose:u}),o._map!=null&&o.unbindTooltip()}},[t,r,i,n])}),Gwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",Hwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",Uwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete zZ.Icon.Default.prototype._getIconUrl;zZ.Icon.Default.mergeOptions({iconUrl:Gwe,iconRetinaUrl:Hwe,shadowUrl:Uwe});const pB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],Wwe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function Zwe(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function $we(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function Ywe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function Xwe({bounds:e}){const t=Ewe();return G.useEffect(()=>{e&&t.fitBounds(e,{padding:[50,50]})},[t,e]),null}function qwe({node:e}){const t=e.latitude!==null&&e.longitude!==null,r=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`:"Unknown";return v.jsxs("div",{className:"min-w-[200px]",children:[v.jsx("div",{className:"font-semibold text-slate-800",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-600 mb-2",children:e.long_name}),v.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[v.jsx("div",{className:"text-slate-500",children:"Role"}),v.jsx("div",{className:"text-slate-700 font-medium",children:e.role}),v.jsx("div",{className:"text-slate-500",children:"Hardware"}),v.jsx("div",{className:"text-slate-700",children:e.hardware||"Unknown"}),v.jsx("div",{className:"text-slate-500",children:"Battery"}),v.jsx("div",{className:"text-slate-700",children:r}),v.jsx("div",{className:"text-slate-500",children:"Last Heard"}),v.jsx("div",{className:"text-slate-700",children:Ywe(e.last_heard)})]}),t&&v.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-200 flex gap-2",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Nf,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 hover:text-blue-800",children:[v.jsx(Nf,{size:10}),"OSM"]})]})]})}function Kwe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const i=G.useMemo(()=>e.filter(h=>h.latitude!==null&&h.longitude!==null),[e]),a=e.length-i.length,o=G.useMemo(()=>new Map(i.map(h=>[h.node_num,h])),[i]),s=G.useMemo(()=>t.filter(h=>o.has(h.from_node)&&o.has(h.to_node)),[t,o]),l=G.useMemo(()=>{if(i.length===0)return null;const h=i.map(d=>d.latitude),f=i.map(d=>d.longitude);return[[Math.min(...h),Math.min(...f)],[Math.max(...h),Math.max(...f)]]},[i]),u=[43.6,-114.4],c=G.useMemo(()=>{const h=new Set;return r!==null&&t.forEach(f=>{f.from_node===r&&h.add(f.to_node),f.to_node===r&&h.add(f.from_node)}),h},[r,t]);return v.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[v.jsxs(Owe,{center:u,zoom:7,style:{width:"100%",height:"540px"},className:"z-0",children:[v.jsx(Fwe,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),v.jsx(Xwe,{bounds:l}),s.map((h,f)=>{const d=o.get(h.from_node),g=o.get(h.to_node),m=r===null||h.from_node===r||h.to_node===r;return v.jsx(zwe,{positions:[[d.latitude,d.longitude],[g.latitude,g.longitude]],color:Zwe(h.snr),weight:m&&r!==null?2.5:1.5,opacity:r===null?.3:m?.6:.08},f)}),i.map(h=>{const f=h.node_num===r,d=c.has(h.node_num),g=r===null||f||d,m=Wwe.includes(h.role),y=$we(h.latitude),_=pB[y%pB.length];return v.jsxs(Rwe,{center:[h.latitude,h.longitude],radius:m?8:5,fillColor:m?_:"#111827",fillOpacity:g?.9:.2,stroke:!0,color:f?"#ffffff":_,weight:f?3:m?0:2,opacity:g?1:.3,eventHandlers:{click:()=>n(f?null:h.node_num)},children:[v.jsx(Vwe,{direction:"top",offset:[0,-8],children:v.jsx("span",{className:"font-mono text-xs",children:h.short_name})}),v.jsx(Bwe,{children:v.jsx(qwe,{node:h})})]},h.node_num)})]}),v.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded px-3 py-2 text-xs text-slate-400 flex items-center gap-2",children:[v.jsx(ad,{size:12}),v.jsxs("span",{children:["Showing ",i.length," of ",e.length," nodes",a>0&&v.jsxs("span",{className:"text-slate-500",children:[" (",a," without coordinates)"]})]})]})]})}const gB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],Jwe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function mB(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function Qwe(e){return e>12?"excellent":e>8?"good":e>5?"fair":e>3?"marginal":"poor"}function eSe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function tSe(e){return["Northern ID","Central ID","SW Idaho","SC Idaho"][e]||"Unknown"}function rSe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function nSe(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function iSe({node:e,edges:t,nodes:r,onSelectNode:n}){const i=G.useMemo(()=>{if(!e)return[];const h=new Map(r.map(d=>[d.node_num,d])),f=[];return t.forEach(d=>{if(d.from_node===e.node_num){const g=h.get(d.to_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}else if(d.to_node===e.node_num){const g=h.get(d.from_node);g&&f.push({node:g,snr:d.snr,quality:d.quality})}}),f.sort((d,g)=>g.snr-d.snr)},[e,t,r]);if(!e)return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border p-4 flex flex-col items-center justify-center h-[540px]",children:[v.jsx("div",{className:"w-12 h-12 rounded-full bg-bg-hover border border-border flex items-center justify-center mb-3",children:v.jsx(Gi,{size:24,className:"text-slate-500"})}),v.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Click a node to inspect"})]});const a=Jwe.includes(e.role),o=eSe(e.latitude),s=gB[o%gB.length],l=e.latitude!==null&&e.longitude!==null,u=e.battery_level!==null?e.battery_level>100||e.voltage&&e.voltage>4.1?"USB":`${e.battery_level.toFixed(0)}%`:"—",c=e.battery_level!==null&&(e.battery_level>100||e.voltage&&e.voltage>4.1);return v.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border flex flex-col h-[540px] overflow-hidden",children:[v.jsxs("div",{className:"p-4 border-b border-border",children:[v.jsx("div",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-mono mb-2",style:{backgroundColor:`${s}20`,color:s},children:e.node_id_hex}),v.jsx("div",{className:"font-mono text-lg text-slate-100",children:e.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:e.long_name})]}),v.jsxs("div",{className:"p-4 border-b border-border grid grid-cols-2 gap-3",children:[v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Role"}),v.jsx("div",{className:`text-sm font-medium ${a?"text-accent":"text-slate-300"}`,children:e.role})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Region"}),v.jsx("div",{className:"text-sm text-slate-300",children:tSe(o)})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Battery"}),v.jsxs("div",{className:"text-sm text-slate-300 flex items-center gap-1",children:[c&&v.jsx(Pf,{size:12,className:"text-amber-400"}),u]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Status"}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${nSe(e.last_heard)}`}),v.jsx("span",{className:"text-sm text-slate-300",children:rSe(e.last_heard)})]})]}),v.jsxs("div",{className:"col-span-2",children:[v.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Hardware"}),v.jsx("div",{className:"text-sm text-slate-300 font-mono truncate",children:e.hardware||"Unknown"})]})]}),l&&v.jsxs("div",{className:"px-4 py-3 border-b border-border flex gap-3",children:[v.jsxs("a",{href:`https://www.google.com/maps?q=${e.latitude},${e.longitude}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[v.jsx(Nf,{size:10}),"Google Maps"]}),v.jsxs("a",{href:`https://www.openstreetmap.org/?mlat=${e.latitude}&mlon=${e.longitude}&zoom=14`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300",children:[v.jsx(Nf,{size:10}),"OSM"]})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto",children:[v.jsxs("div",{className:"px-4 py-2 text-xs text-slate-500 font-medium sticky top-0 bg-bg-card border-b border-border",children:["Neighbors (",i.length,")"]}),i.length>0?v.jsx("div",{className:"divide-y divide-border",children:i.map(h=>v.jsxs("button",{onClick:()=>n(h.node.node_num),className:"w-full px-4 py-2 text-left hover:bg-bg-hover transition-colors flex items-center gap-2",style:{borderLeftWidth:3,borderLeftColor:mB(h.snr)},children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200 font-mono truncate",children:h.node.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate",children:h.node.long_name})]}),v.jsxs("div",{className:"text-right flex-shrink-0",children:[v.jsxs("div",{className:"text-xs font-mono",style:{color:mB(h.snr)},children:[h.snr.toFixed(1)," dB"]}),v.jsx("div",{className:"text-xs text-slate-500",children:Qwe(h.snr)})]})]},h.node.node_num))}):v.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No known neighbors"})]})]})}const yB=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function aSe(e){if(!e)return"bg-slate-500";const t=new Date(e),n=(new Date().getTime()-t.getTime())/36e5;return n<1?"bg-green-500":n<24?"bg-amber-500":"bg-slate-500"}function oSe(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/6e4),a=Math.floor(n/36e5),o=Math.floor(n/864e5);return i<1?"Just now":i<60?`${i}m ago`:a<24?`${a}h ago`:`${o}d ago`}function sSe(e){return e.battery_level===null?"—":e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`}function _B(e){return e===null?"—":e>46?"Northern":e>44.5?"Central":e>43?"SW Idaho":"SC Idaho"}function lSe({nodes:e,selectedNodeId:t,onSelectNode:r}){const[n,i]=G.useState(""),[a,o]=G.useState("short_name"),[s,l]=G.useState("asc"),[u,c]=G.useState("all"),h=G.useMemo(()=>{let g=[...e];if(u==="infra"?g=g.filter(m=>yB.includes(m.role)):u==="online"&&(g=g.filter(m=>{if(!m.last_heard)return!1;const y=new Date(m.last_heard);return(new Date().getTime()-y.getTime())/36e5<1})),n){const m=n.toLowerCase();g=g.filter(y=>y.short_name.toLowerCase().includes(m)||y.long_name.toLowerCase().includes(m)||y.role.toLowerCase().includes(m)||_B(y.latitude).toLowerCase().includes(m))}return g.sort((m,y)=>{let _="",x="";switch(a){case"short_name":_=m.short_name.toLowerCase(),x=y.short_name.toLowerCase();break;case"role":_=m.role,x=y.role;break;case"battery_level":_=m.battery_level??-1,x=y.battery_level??-1;break;case"last_heard":_=m.last_heard?new Date(m.last_heard).getTime():0,x=y.last_heard?new Date(y.last_heard).getTime():0;break;case"hardware":_=m.hardware.toLowerCase(),x=y.hardware.toLowerCase();break}return _x?s==="asc"?1:-1:0}),g},[e,n,a,s,u]),f=g=>{a===g?l(s==="asc"?"desc":"asc"):(o(g),l("asc"))},d=({field:g})=>a!==g?null:s==="asc"?v.jsx(MK,{size:14,className:"inline ml-1"}):v.jsx(jl,{size:14,className:"inline ml-1"});return v.jsxs("div",{className:"bg-bg-card border border-border overflow-hidden",children:[v.jsxs("div",{className:"p-3 border-b border-border flex items-center gap-3",children:[v.jsxs("div",{className:"relative flex-1 max-w-xs",children:[v.jsx($1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",placeholder:"Search nodes...",value:n,onChange:g=>i(g.target.value),className:"w-full pl-9 pr-3 py-1.5 bg-bg-hover border border-border rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-accent"})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(eL,{size:14,className:"text-slate-500 mr-1"}),["all","infra","online"].map(g=>v.jsx("button",{onClick:()=>c(g),className:`px-2 py-1 text-xs rounded transition-colors ${u===g?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:g==="all"?"All":g==="infra"?"Infra":"Online"},g))]}),v.jsxs("div",{className:"text-xs text-slate-500 ml-auto",children:[h.length," of ",e.length," nodes"]})]}),v.jsxs("div",{className:"overflow-x-auto",children:[v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"bg-bg-hover text-slate-400 text-xs",children:[v.jsx("th",{className:"w-8 px-3 py-2"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("short_name"),children:["Name ",v.jsx(d,{field:"short_name"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("role"),children:["Role ",v.jsx(d,{field:"role"})]}),v.jsx("th",{className:"px-3 py-2 text-left",children:"Region"}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("battery_level"),children:[v.jsx("span",{title:"Battery percent (4.20V = 100%, 3.60V ~ 30% warning, 3.30V ~ 3% critical). USB ⚡ = USB-powered (>100% or >4.1V); no battery management applies.",children:"Battery"})," ",v.jsx(d,{field:"battery_level"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("last_heard"),children:[v.jsx("span",{title:"Status dot: green = heard in the last hour; amber = within 24h; slate = offline (past the configured threshold). See Reference → Mesh Health for thresholds by node type.",children:"Last Heard"})," ",v.jsx(d,{field:"last_heard"})]}),v.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("hardware"),children:["Hardware ",v.jsx(d,{field:"hardware"})]})]})}),v.jsx("tbody",{className:"divide-y divide-border",children:h.slice(0,100).map(g=>{const m=yB.includes(g.role),y=g.node_num===t;return v.jsxs("tr",{onClick:()=>r(g.node_num),className:`cursor-pointer transition-colors ${y?"bg-accent/10":"hover:bg-bg-hover"}`,children:[v.jsx("td",{className:"px-3 py-2",children:v.jsx("div",{className:`w-2 h-2 rounded-full ${aSe(g.last_heard)}`})}),v.jsxs("td",{className:"px-3 py-2",children:[v.jsx("div",{className:"font-mono text-slate-200",children:g.short_name}),v.jsx("div",{className:"text-xs text-slate-500 truncate max-w-[200px]",children:g.long_name})]}),v.jsx("td",{className:"px-3 py-2",children:v.jsx("span",{className:`inline-block px-1.5 py-0.5 rounded text-xs font-medium ${m?"bg-cyan-500/20 text-accent":"bg-slate-500/20 text-slate-400"}`,children:g.role})}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:_B(g.latitude)}),v.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:sSe(g)}),v.jsx("td",{className:"px-3 py-2 text-slate-400",children:oSe(g.last_heard)}),v.jsx("td",{className:"px-3 py-2 font-mono text-xs text-slate-400 truncate max-w-[150px]",children:g.hardware||"—"})]},g.node_num)})})]}),h.length>100&&v.jsxs("div",{className:"px-3 py-2 text-xs text-slate-500 text-center border-t border-border",children:["Showing first 100 of ",h.length," nodes"]}),h.length===0&&v.jsx("div",{className:"px-3 py-8 text-sm text-slate-500 text-center",children:"No nodes match your filters"})]})]})}function uSe(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState(null),[l,u]=G.useState("topo"),[c,h]=G.useState(!0),[f,d]=G.useState(null);G.useEffect(()=>{document.title="Mesh — MeshAI",Promise.all([FK(),VK(),WK()]).then(([y,_,x])=>{t(y),n(_),a(x),h(!1)}).catch(y=>{d(y.message),h(!1)})},[]);const g=G.useMemo(()=>e.find(y=>y.node_num===o)||null,[e,o]),m=G.useCallback(y=>{s(y)},[]);return c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading mesh data..."})}):f?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",f]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"text-sm text-slate-400",children:[e.length," nodes • ",r.length," edges"]}),v.jsxs("div",{className:"flex items-center bg-bg-card border border-border p-1",children:[v.jsxs("button",{onClick:()=>u("topo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="topo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(s6,{size:14}),v.jsx("span",{title:"Force-directed graph of nodes + neighbor links. Edge weight reflects SNR; node color reflects status (green = active, amber = stale, slate = offline).",children:"Topology"})]}),v.jsxs("button",{onClick:()=>u("geo"),className:`flex items-center gap-2 px-3 py-1.5 rounded text-sm transition-colors ${l==="geo"?"bg-accent text-white":"text-slate-400 hover:text-slate-200"}`,children:[v.jsx(EK,{size:14}),v.jsx("span",{title:"Nodes plotted by lat/lon on a basemap. Nodes without a reported position are clustered at the top edge.",children:"Geographic"})]})]})]}),v.jsxs("div",{className:"flex gap-0",children:[v.jsx("div",{className:"flex-1 min-w-0",children:l==="topo"?v.jsx(bwe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m}):v.jsx(Kwe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m})}),v.jsx(iSe,{node:g,edges:r,nodes:e,onSelectNode:m})]}),v.jsx(lSe,{nodes:e,selectedNodeId:o,onSelectNode:m})]})}function cP({label:e,value:t,onChange:r,helper:n,info:i,roleFilter:a,valueType:o="short_name"}){const[s,l]=G.useState([]),[u,c]=G.useState(!0),[h,f]=G.useState(""),[d,g]=G.useState(!1);G.useEffect(()=>{fetch("/api/nodes").then(S=>S.json()).then(S=>{l(S),c(!1)}).catch(()=>{l([]),c(!1)})},[]);const m=G.useMemo(()=>{let S=s;if(a&&(S=S.filter(T=>a==="ROUTER"||a==="infrastructure"?T.is_infrastructure||T.role==="ROUTER"||T.role==="ROUTER_CLIENT"||T.role==="REPEATER":T.role===a)),h.trim()){const T=h.toLowerCase();S=S.filter(M=>{var A,N,P,I;return((A=M.short_name)==null?void 0:A.toLowerCase().includes(T))||((N=M.long_name)==null?void 0:N.toLowerCase().includes(T))||((P=M.role)==null?void 0:P.toLowerCase().includes(T))||((I=M.node_id_hex)==null?void 0:I.toLowerCase().includes(T))})}return S.sort((T,M)=>(T.short_name||"").localeCompare(M.short_name||""))},[s,h,a]),y=S=>{switch(o){case"node_num":return String(S.node_num);case"node_id_hex":return S.node_id_hex;default:return S.short_name||String(S.node_num)}},_=S=>{const T=y(S);return t.includes(T)},x=S=>{const T=y(S);t.includes(T)?r(t.filter(M=>M!==T)):r([...t,T])},w=S=>{const T=[S.short_name];return S.long_name&&S.long_name!==S.short_name&&T.push(`— ${S.long_name}`),S.role&&T.push(`(${S.role})`),T.join(" ")};return!u&&s.length===0?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),v.jsx("input",{type:"text",value:t.join(", "),onChange:S=>r(S.target.value.split(",").map(T=>T.trim()).filter(Boolean)),placeholder:"Enter node IDs separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(S=>{const T=s.find(M=>y(M)===S);return v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-accent/20 text-accent rounded text-sm",children:[T?T.short_name:S,v.jsx("button",{type:"button",onClick:()=>r(t.filter(M=>M!==S)),className:"hover:text-white",children:v.jsx(ya,{size:14})})]},S)})}),v.jsxs("div",{className:"relative",children:[v.jsxs("div",{className:"relative",children:[v.jsx($1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:h,onChange:S=>f(S.target.value),onFocus:()=>g(!0),placeholder:u?"Loading nodes...":"Search nodes...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"})]}),d&&!u&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 max-h-64 overflow-y-auto bg-[#0a0e17] border border-[#1e2a3a] shadow-xl",children:m.length===0?v.jsx("div",{className:"p-3 text-sm text-slate-500 text-center",children:"No nodes found"}):m.map(S=>v.jsxs("button",{type:"button",onClick:()=>x(S),className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[#1e2a3a] ${_(S)?"bg-accent/10":""}`,children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${_(S)?"bg-accent border-accent":"border-slate-600"}`,children:_(S)&&v.jsx(ao,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-slate-200",children:w(S)})]},S.node_num))})]})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function hP(e){const[t,r]=G.useState([]),[n,i]=G.useState(!0);G.useEffect(()=>{fetch("/api/channels").then(f=>f.json()).then(f=>{r(f),i(!1)}).catch(()=>{r([]),i(!1)})},[]);const a=f=>{const d=f.role==="PRIMARY"?"Primary":f.role==="SECONDARY"?"Secondary":"";return`${f.index}: ${f.name}${d?` (${d})`:""}`};if(!n&&t.length===0)return e.mode==="single"?v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"number",value:e.value,onChange:f=>e.onChange(Number(f.target.value)),min:e.includeDisabled?-1:0,max:7,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]}):v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),v.jsx("input",{type:"text",value:e.value.join(", "),onChange:f=>{const d=f.target.value.split(",").map(g=>parseInt(g.trim())).filter(g=>!isNaN(g));e.onChange(d)},placeholder:"Enter channel numbers separated by commas",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),e.helper&&v.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]});if(e.mode==="single"){const{value:f,onChange:d,label:g,helper:m,includeDisabled:y}=e,_=t.filter(x=>x.enabled);return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:g}),v.jsxs("select",{value:f,onChange:x=>d(Number(x.target.value)),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:[y&&v.jsx("option",{value:-1,children:"Disabled"}),_.map(x=>v.jsx("option",{value:x.index,children:a(x)},x.index))]}),m&&v.jsx("p",{className:"text-xs text-slate-600",children:m})]})}const{value:o,onChange:s,label:l,helper:u}=e,c=t.filter(f=>f.enabled),h=f=>{o.includes(f)?s(o.filter(d=>d!==f)):s([...o,f].sort((d,g)=>d-g))};return v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:l}),v.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[c.map(f=>v.jsxs("label",{onClick:()=>h(f.index),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${o.includes(f.index)?"bg-accent border-accent":"border-slate-600"}`,children:o.includes(f.index)&&v.jsx(ao,{size:12,className:"text-white"})}),v.jsx("span",{className:"text-sm text-slate-200",children:a(f)})]},f.index)),c.length===0&&v.jsx("div",{className:"text-sm text-slate-500 p-2",children:"No channels available"})]}),u&&v.jsx("p",{className:"text-xs text-slate-600",children:u})]})}const xB=[{key:"bot",label:"Bot",icon:wK},{key:"connection",label:"Connection",icon:Y1},{key:"response",label:"Response",icon:tL},{key:"history",label:"History",icon:n6},{key:"memory",label:"Memory",icon:SK},{key:"context",label:"Context",icon:Qk},{key:"commands",label:"Commands",icon:c6},{key:"llm",label:"LLM",icon:r6},{key:"weather",label:"Weather",icon:uc},{key:"meshmonitor",label:"MeshMonitor",icon:Gi},{key:"knowledge",label:"Knowledge",icon:e6},{key:"mesh_sources",label:"Mesh Sources",icon:a6},{key:"mesh_intelligence",label:"Intelligence",icon:id},{key:"dashboard",label:"Dashboard",icon:o6}],Kn={bot:"Identity and behavior settings for the bot on the mesh network.",connection:"How MeshAI connects to your Meshtastic radio.",response:"Controls how quickly and how much the bot responds on the mesh.",history:"Conversation history storage and cleanup.",memory:"Short-term conversation memory management. Controls how the bot maintains context within a conversation.",context:"Passive channel monitoring. The bot listens to mesh channels and uses recent messages as context when responding.",commands:"Mesh commands available via the configured prefix. Toggle individual commands on or off.",llm:"AI model configuration. MeshAI uses an LLM to understand questions and generate responses.",weather:"Weather data for the !weather command. This is separate from NWS environmental alerts.",meshmonitor:"AIDA MeshMonitor integration. An additional data source for mesh network monitoring.",knowledge:"Knowledge base for answering questions from stored documents. Connects to Qdrant vector database or local SQLite.",mesh_sources:"Data sources for mesh network information. MeshAI can pull data from multiple sources simultaneously and merge them into a unified view.",mesh_intelligence:"Advanced mesh analysis: health scoring, region management, and automated alerting. The intelligence engine monitors your mesh and detects problems automatically.",dashboard:"Web dashboard settings. You're looking at it right now."},cSe=[{name:"help",description:"Show available commands and usage"},{name:"health",description:"Mesh network health overview with status dots"},{name:"status",description:"Quick mesh status summary"},{name:"region",description:"List regions or get detailed region breakdown"},{name:"neighbors",description:"Show top infrastructure neighbors with signal quality"},{name:"ping",description:"Test bot responsiveness"},{name:"clear",description:"Clear your conversation history"},{name:"reset",description:"Reset conversation context"},{name:"sub",description:"Subscribe to scheduled reports or alerts"},{name:"unsub",description:"Remove a subscription"},{name:"mysubs",description:"List your active subscriptions"},{name:"alerts",description:"Active NWS weather alerts for mesh area"},{name:"solar",description:"Space weather and HF propagation conditions"},{name:"hf",description:"HF radio propagation (alias for !solar)"},{name:"fire",description:"Active wildfires near the mesh"},{name:"avy",description:"Avalanche advisories for configured zones"},{name:"hotspots",description:"NASA FIRMS satellite fire detections"},{name:"streams",description:"USGS stream gauge readings"},{name:"roads",description:"Road conditions and closures"},{name:"traffic",description:"Traffic flow on monitored corridors"}],hSe=[{value:"US-AL",label:"Alabama"},{value:"US-AK",label:"Alaska"},{value:"US-AZ",label:"Arizona"},{value:"US-AR",label:"Arkansas"},{value:"US-CA",label:"California"},{value:"US-CO",label:"Colorado"},{value:"US-CT",label:"Connecticut"},{value:"US-DE",label:"Delaware"},{value:"US-FL",label:"Florida"},{value:"US-GA",label:"Georgia"},{value:"US-HI",label:"Hawaii"},{value:"US-ID",label:"Idaho"},{value:"US-IL",label:"Illinois"},{value:"US-IN",label:"Indiana"},{value:"US-IA",label:"Iowa"},{value:"US-KS",label:"Kansas"},{value:"US-KY",label:"Kentucky"},{value:"US-LA",label:"Louisiana"},{value:"US-ME",label:"Maine"},{value:"US-MD",label:"Maryland"},{value:"US-MA",label:"Massachusetts"},{value:"US-MI",label:"Michigan"},{value:"US-MN",label:"Minnesota"},{value:"US-MS",label:"Mississippi"},{value:"US-MO",label:"Missouri"},{value:"US-MT",label:"Montana"},{value:"US-NE",label:"Nebraska"},{value:"US-NV",label:"Nevada"},{value:"US-NH",label:"New Hampshire"},{value:"US-NJ",label:"New Jersey"},{value:"US-NM",label:"New Mexico"},{value:"US-NY",label:"New York"},{value:"US-NC",label:"North Carolina"},{value:"US-ND",label:"North Dakota"},{value:"US-OH",label:"Ohio"},{value:"US-OK",label:"Oklahoma"},{value:"US-OR",label:"Oregon"},{value:"US-PA",label:"Pennsylvania"},{value:"US-RI",label:"Rhode Island"},{value:"US-SC",label:"South Carolina"},{value:"US-SD",label:"South Dakota"},{value:"US-TN",label:"Tennessee"},{value:"US-TX",label:"Texas"},{value:"US-UT",label:"Utah"},{value:"US-VT",label:"Vermont"},{value:"US-VA",label:"Virginia"},{value:"US-WA",label:"Washington"},{value:"US-WV",label:"West Virginia"},{value:"US-WI",label:"Wisconsin"},{value:"US-WY",label:"Wyoming"}];function yo({info:e,link:t,linkText:r="Learn more"}){const[n,i]=G.useState(!1),a=G.useRef(null);return G.useEffect(()=>{if(!n)return;function o(l){a.current&&!a.current.contains(l.target)&&i(!1)}const s=setTimeout(()=>document.addEventListener("mousedown",o),0);return()=>{clearTimeout(s),document.removeEventListener("mousedown",o)}},[n]),v.jsxs("div",{className:"relative inline-block",ref:a,children:[v.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),i(!n)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),n&&v.jsxs("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:[v.jsx("button",{type:"button",onClick:()=>i(!1),className:"absolute top-1 right-1 w-5 h-5 rounded hover:bg-slate-700 text-slate-500 hover:text-slate-300 inline-flex items-center justify-center transition-colors","aria-label":"Close",children:v.jsx(ya,{size:12})}),v.jsx("div",{className:"pr-4",children:e}),t&&v.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-accent hover:underline",onClick:o=>o.stopPropagation(),children:[r," ",v.jsx(Nf,{size:10})]})]})]})}function Jn({text:e}){return v.jsx("p",{className:"text-sm text-slate-500 mb-6 pb-4 border-b border-[#1e2a3a]",children:e})}function pt({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o="",infoLink:s=""}){const[l,u]=G.useState(!1),c=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(yo,{info:o,link:s})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:c&&!l?"password":"text",value:t,onChange:h=>r(h.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),c&&v.jsx("button",{type:"button",onClick:()=>u(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:l?v.jsx(i6,{size:16}):v.jsx(Qk,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function Ge({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s="",infoLink:l=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(yo,{info:s,link:l})]}),v.jsx("input",{type:"number",value:t,onChange:u=>r(Number(u.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function fr({label:e,checked:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(yo,{info:i,link:a})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Fn({label:e,value:t,onChange:r,options:n,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(yo,{info:a,link:o})]}),v.jsx("select",{value:t,onChange:s=>r(s.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:n.map(s=>v.jsx("option",{value:s.value,children:s.label},s.value))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function fSe({label:e,value:t,onChange:r,rows:n=4,helper:i="",info:a="",infoLink:o=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(yo,{info:a,link:o})]}),v.jsx("textarea",{value:t,onChange:s=>r(s.target.value),rows:n,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent resize-y"}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function zo({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>c.trim()).filter(Boolean);r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(yo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"item1, item2, item3",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function dSe({label:e,value:t,onChange:r,helper:n="",info:i="",infoLink:a=""}){const[o,s]=G.useState(t.join(", "));G.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>parseInt(c.trim(),10)).filter(c=>!isNaN(c));r(u)};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(yo,{info:i,link:a})]}),v.jsx("input",{type:"text",value:o,onChange:u=>s(u.target.value),onBlur:l,placeholder:"0, 1, 2",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function dn({label:e,description:t,checked:r,onChange:n,threshold:i,onThresholdChange:a,thresholdLabel:o,thresholdMin:s,thresholdMax:l,thresholdStep:u=1,thresholdSuffix:c=""}){return v.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex-1",children:[v.jsx("span",{className:"text-sm text-slate-300",children:e}),v.jsx("p",{className:"text-xs text-slate-600",children:t})]}),v.jsx("button",{type:"button",onClick:()=>n(!r),className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${r?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${r?"translate-x-5":""}`})})]}),r&&i!==void 0&&a&&v.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-[#1e2a3a]",children:[v.jsxs("span",{className:"text-xs text-slate-500",children:[o||"Threshold",":"]}),v.jsx("input",{type:"number",value:i,onChange:h=>a(Number(h.target.value)),min:s,max:l,step:u,className:"w-20 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono"}),c&&v.jsx("span",{className:"text-xs text-slate-500",children:c})]})]})}function vSe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.bot}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(pt,{label:"Bot Name",value:e.name,onChange:r=>t({...e,name:r}),helper:"Name the bot responds to on the mesh",info:"When someone sends a message containing this name, the bot will respond. Also used as the sender name in broadcasts. Changing this requires a restart."}),v.jsx(pt,{label:"Owner",value:e.owner,onChange:r=>t({...e,owner:r}),helper:"Your callsign or identifier",info:"Identifies the bot operator. Shown in !help responses and used for admin-level commands."})]}),v.jsx(fr,{label:"Respond to DMs",checked:e.respond_to_dms,onChange:r=>t({...e,respond_to_dms:r}),helper:"Reply when someone sends a direct message",info:"When enabled, the bot responds to direct messages from any node. When disabled, the bot only responds to channel messages that mention its name."}),v.jsx(fr,{label:"Filter BBS Protocols",checked:e.filter_bbs_protocols,onChange:r=>t({...e,filter_bbs_protocols:r}),helper:"Ignore BBS bulletin board traffic",info:"Filters out automated BBS protocol messages (advBBS, MAIL*, BOARD*) so the bot doesn't try to respond to machine-to-machine traffic."})]})}function pSe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.connection}),v.jsx(Fn,{label:"Connection Type",value:e.type,onChange:r=>t({...e,type:r}),options:[{value:"serial",label:"Serial (USB)"},{value:"tcp",label:"TCP (Network)"}],helper:"Serial for USB-connected radios, TCP for network or meshtasticd",info:"Serial: direct USB connection to a Meshtastic radio. TCP: connect over the network to a radio's IP or to meshtasticd running on another machine."}),e.type==="serial"?v.jsx(pt,{label:"Serial Port",value:e.serial_port,onChange:r=>t({...e,serial_port:r}),placeholder:"/dev/ttyUSB0",helper:"Device path for your USB radio",info:"Usually /dev/ttyUSB0 on Linux or /dev/ttyACM0. Check with 'ls /dev/tty*' after plugging in your radio."}):v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(pt,{label:"TCP Host",value:e.tcp_host,onChange:r=>t({...e,tcp_host:r}),placeholder:"192.168.1.100",helper:"IP address or hostname of the radio/meshtasticd"}),v.jsx(Ge,{label:"TCP Port",value:e.tcp_port,onChange:r=>t({...e,tcp_port:r}),min:1,max:65535,helper:"Default 4403 for meshtasticd"})]})]})}function gSe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.response}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Delay Min (sec)",value:e.delay_min,onChange:r=>t({...e,delay_min:r}),min:0,step:.1,helper:"Minimum wait before responding",info:"Adds a random delay between min and max before the bot sends a response. Prevents the bot from appearing to respond instantly, which can feel unnatural on a radio network."}),v.jsx(Ge,{label:"Delay Max (sec)",value:e.delay_max,onChange:r=>t({...e,delay_max:r}),min:0,step:.1,helper:"Maximum wait before responding",info:"Also prevents collisions with other traffic by staggering transmissions."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Max Length",value:e.max_length,onChange:r=>t({...e,max_length:r}),min:50,max:500,helper:"Maximum characters per response message",info:"Meshtastic packets have limited size. This caps how long each message chunk can be. The bot will split longer responses into multiple messages up to Max Messages."}),v.jsx(Ge,{label:"Max Messages",value:e.max_messages,onChange:r=>t({...e,max_messages:r}),min:1,max:10,helper:"Maximum chunks per response",info:"If a response is longer than Max Length, the bot splits it into this many chunks at most. Higher values = more complete answers but more airtime used."})]})]})}function mSe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.history}),v.jsx(pt,{label:"Database Path",value:e.database,onChange:r=>t({...e,database:r}),helper:"SQLite file for storing conversation history",info:"Path to the SQLite database file. Created automatically if it doesn't exist. Stores all conversation history for context."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Max Messages Per User",value:e.max_messages_per_user,onChange:r=>t({...e,max_messages_per_user:r}),min:0,helper:"History limit per user (0 = unlimited)",info:"Limits how many messages are stored per user. Older messages are pruned when the limit is reached. Set to 0 for no limit."}),v.jsx(Ge,{label:"Conversation Timeout (sec)",value:e.conversation_timeout,onChange:r=>t({...e,conversation_timeout:r}),min:0,helper:"Seconds before context resets",info:"If a user doesn't message for this long, their next message starts a new conversation context. The bot won't remember the previous topic."})]}),v.jsx(fr,{label:"Auto Cleanup",checked:e.auto_cleanup,onChange:r=>t({...e,auto_cleanup:r}),helper:"Automatically prune old conversations"}),e.auto_cleanup&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Cleanup Interval (hours)",value:e.cleanup_interval_hours,onChange:r=>t({...e,cleanup_interval_hours:r}),min:1,helper:"Hours between cleanup runs"}),v.jsx(Ge,{label:"Max Age (days)",value:e.max_age_days,onChange:r=>t({...e,max_age_days:r}),min:1,helper:"Delete conversations older than this"})]})]})}function ySe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.memory}),v.jsx(fr,{label:"Enable Memory",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Keep conversation context between messages"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Window Size",value:e.window_size,onChange:r=>t({...e,window_size:r}),min:1,helper:"Recent message pairs kept in full",info:"The bot keeps this many recent exchanges (user message + bot response pairs) as full text in context. Older messages are summarized to save token space."}),v.jsx(Ge,{label:"Summarize Threshold",value:e.summarize_threshold,onChange:r=>t({...e,summarize_threshold:r}),min:1,helper:"Messages before older context is summarized",info:"When the conversation exceeds this many messages, older ones outside the window are compressed into a summary by the LLM."})]})]})}function _Se({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.context}),v.jsx(fr,{label:"Enable Passive Context",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Listen to channel traffic for context",info:"When enabled, the bot monitors mesh channels and includes recent messages in its context. This lets the bot reference things other people said on the channel."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(hP,{label:"Observe Channels",value:e.observe_channels,onChange:r=>t({...e,observe_channels:r}),helper:"Channels to monitor (empty = all)",info:"Meshtastic channels to listen on. Leave empty to monitor all channels.",mode:"multi"}),v.jsx(cP,{label:"Ignore Nodes",value:e.ignore_nodes,onChange:r=>t({...e,ignore_nodes:r}),helper:"Nodes to exclude from context",info:"Messages from these nodes won't be included in passive context. Useful for filtering out noisy automated nodes."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Max Age (sec)",value:e.max_age,onChange:r=>t({...e,max_age:r}),min:0,helper:"Ignore messages older than this"}),v.jsx(Ge,{label:"Max Context Items",value:e.max_context_items,onChange:r=>t({...e,max_context_items:r}),min:1,helper:"Maximum recent messages to include"})]})]})]})}function xSe({data:e,onChange:t}){const r=new Set(e.disabled_commands.map(i=>i.toLowerCase())),n=i=>{const a=i.toLowerCase();r.has(a)?t({...e,disabled_commands:e.disabled_commands.filter(o=>o.toLowerCase()!==a)}):t({...e,disabled_commands:[...e.disabled_commands,i]})};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.commands}),v.jsx(fr,{label:"Enable Commands",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Allow !commands on the mesh"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(pt,{label:"Command Prefix",value:e.prefix,onChange:i=>t({...e,prefix:i}),helper:"Character that triggers commands (e.g. ! for !help)",info:"Users type this character followed by the command name. Only single characters recommended."}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Available Commands",v.jsx(yo,{info:"Toggle commands on or off. Disabled commands won't respond when users invoke them."})]}),v.jsx("div",{className:"grid gap-1",children:cSe.map(i=>{const a=!r.has(i.name.toLowerCase());return v.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#0a0e17] border border-[#1e2a3a] rounded hover:border-[#2a3a4a] transition-colors",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("code",{className:"text-accent text-sm",children:["!",i.name]}),v.jsx("span",{className:"text-xs text-slate-500",children:i.description})]}),v.jsx("button",{type:"button",onClick:()=>n(i.name),className:`relative w-9 h-5 rounded-full transition-colors ${a?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${a?"translate-x-4":""}`})})]},i.name)})})]})]})]})}function bSe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.llm}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Fn,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"openai",label:"OpenAI"},{value:"anthropic",label:"Anthropic"},{value:"google",label:"Google (Gemini)"}],helper:"LLM provider to use",info:"OpenAI: GPT models (gpt-4o, gpt-4o-mini). Anthropic: Claude models (claude-sonnet-4-20250514). Google: Gemini models. Can also point to compatible APIs like Ollama, LM Studio, or Open WebUI by changing the Base URL."}),v.jsx(pt,{label:"Model",value:e.model,onChange:r=>t({...e,model:r}),placeholder:"gpt-4o-mini",helper:"Specific model name",info:"The specific model to use. Common choices: gpt-4o-mini (fast, cheap), gpt-4o (better, costs more), claude-sonnet-4-20250514 (Anthropic equivalent). For local models via Ollama, use the model name you pulled (e.g. llama3.1)."})]}),v.jsx(pt,{label:"API Key",value:e.api_key,onChange:r=>t({...e,api_key:r}),type:"password",helper:"Supports ${ENV_VAR} syntax",info:"Your API key from the provider. You can also use ${ENV_VAR} syntax to read from an environment variable instead of storing the key in the config file."}),v.jsx(pt,{label:"Base URL",value:e.base_url,onChange:r=>t({...e,base_url:r}),placeholder:"https://api.openai.com/v1",helper:"API endpoint (change for local LLMs)",info:"Default API endpoint for the selected backend. Change this to point to a local LLM server (Ollama at http://localhost:11434/v1, Open WebUI, LM Studio, etc.) or a proxy."}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Timeout (sec)",value:e.timeout,onChange:r=>t({...e,timeout:r}),min:5,max:120,helper:"Maximum seconds to wait for response"}),v.jsx(Ge,{label:"Max Response Tokens",value:e.max_response_tokens,onChange:r=>t({...e,max_response_tokens:r}),min:100,helper:"Token limit for LLM responses"})]}),v.jsx(fr,{label:"Use System Prompt",checked:e.use_system_prompt,onChange:r=>t({...e,use_system_prompt:r}),helper:"Enable custom system instructions"}),e.use_system_prompt&&v.jsx(fSe,{label:"System Prompt",value:e.system_prompt,onChange:r=>t({...e,system_prompt:r}),rows:6,helper:"Instructions that shape the bot's personality",info:"Instructions that shape the bot's personality and behavior. The bot always follows these instructions. MeshAI adds mesh health data and environmental context automatically — you don't need to include those here."}),v.jsx(fr,{label:"Web Search",checked:e.web_search,onChange:r=>t({...e,web_search:r}),helper:"Enable web search tool (Open WebUI feature)"}),v.jsx(fr,{label:"Google Grounding",checked:e.google_grounding,onChange:r=>t({...e,google_grounding:r}),helper:"Ground responses in web search (Gemini only)"})]})}function wSe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.weather}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Fn,{label:"Primary Provider",value:e.primary,onChange:r=>t({...e,primary:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"}],helper:"Main weather data source"}),v.jsx(Fn,{label:"Fallback Provider",value:e.fallback,onChange:r=>t({...e,fallback:r}),options:[{value:"openmeteo",label:"Open-Meteo"},{value:"wttr",label:"wttr.in"},{value:"llm",label:"LLM"},{value:"none",label:"None"}],helper:"Backup if primary fails"})]}),v.jsx(pt,{label:"Default Location",value:e.default_location,onChange:r=>t({...e,default_location:r}),placeholder:"Your city, state",helper:"Location when none specified"})]})}function SSe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.meshmonitor}),v.jsx(fr,{label:"Enable MeshMonitor",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Connect to AIDA MeshMonitor instance",info:"MeshMonitor by Yeraze provides node data, battery info, telemetry, and auto-responder patterns. MeshAI uses this as a data source and avoids duplicate responses."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(pt,{label:"URL",value:e.url,onChange:r=>t({...e,url:r}),placeholder:"http://192.168.1.100:8080",helper:"MeshMonitor API endpoint",info:"Full URL to your MeshMonitor instance. Usually runs on port 8080."}),v.jsx(fr,{label:"Inject Into Prompt",checked:e.inject_into_prompt,onChange:r=>t({...e,inject_into_prompt:r}),helper:"Tell LLM about MeshMonitor commands",info:"Adds MeshMonitor's auto-responder patterns to the LLM context so it knows what commands MeshMonitor handles."}),v.jsx(Ge,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:r=>t({...e,refresh_interval:r}),min:10,helper:"How often to fetch patterns"}),v.jsx(fr,{label:"Polite Mode",checked:e.polite_mode,onChange:r=>t({...e,polite_mode:r}),helper:"Reduce polling frequency",info:"Reduces polling frequency for shared instances to be a good neighbor."})]})]})}function CSe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.knowledge}),v.jsx(fr,{label:"Enable Knowledge Base",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Answer questions from stored documents",info:"Uses RAG (Retrieval-Augmented Generation) to answer questions from a knowledge base. Supports Qdrant vector database or local SQLite with FTS5."}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsx(Fn,{label:"Backend",value:e.backend,onChange:r=>t({...e,backend:r}),options:[{value:"auto",label:"Auto (Qdrant -> SQLite)"},{value:"qdrant",label:"Qdrant"},{value:"sqlite",label:"SQLite"}],helper:"Knowledge storage backend",info:"Auto tries Qdrant first, falls back to SQLite. Qdrant provides hybrid search with dense+sparse embeddings. SQLite uses FTS5 keyword search."}),(e.backend==="qdrant"||e.backend==="auto")&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(pt,{label:"Qdrant Host",value:e.qdrant_host,onChange:r=>t({...e,qdrant_host:r}),helper:"Qdrant server hostname",info:"IP or hostname of your Qdrant vector database server."}),v.jsx(Ge,{label:"Qdrant Port",value:e.qdrant_port,onChange:r=>t({...e,qdrant_port:r}),helper:"Default 6333"})]}),v.jsx(pt,{label:"Collection",value:e.qdrant_collection,onChange:r=>t({...e,qdrant_collection:r}),helper:"Qdrant collection name"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(pt,{label:"TEI Host",value:e.tei_host,onChange:r=>t({...e,tei_host:r}),helper:"Text Embeddings Inference host",info:"TEI service for generating dense embeddings. Uses BAAI/bge-m3 model."}),v.jsx(Ge,{label:"TEI Port",value:e.tei_port,onChange:r=>t({...e,tei_port:r}),helper:"Default 8090"})]}),v.jsx(fr,{label:"Use Sparse Embeddings",checked:e.use_sparse,onChange:r=>t({...e,use_sparse:r}),helper:"Enable hybrid search with sparse vectors",info:"Combines dense embeddings with sparse (keyword-based) embeddings using Reciprocal Rank Fusion for better search results."})]}),v.jsx(pt,{label:"SQLite DB Path",value:e.db_path,onChange:r=>t({...e,db_path:r}),helper:"Local knowledge database file"}),v.jsx(Ge,{label:"Top K Results",value:e.top_k,onChange:r=>t({...e,top_k:r}),min:1,max:20,helper:"Number of documents to retrieve"})]})]})}function TSe({source:e,onChange:t,onDelete:r}){const[n,i]=G.useState(!1),a={meshview:"Web-based mesh monitoring tool. Enter the full URL of a MeshView instance. No API key typically required.",meshmonitor:"AIDA MeshMonitor API. Provides node data and network statistics. Requires API token.",mqtt:"Subscribe directly to a Meshtastic MQTT broker for real-time packet data. This is push-based (instant) vs the polling approach of MeshView/MeshMonitor."};return v.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>i(!n),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[n?v.jsx(jl,{size:16}):v.jsx(Sl,{size:16}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`}),v.jsx("span",{className:"font-mono text-sm text-slate-200",children:e.name||"Unnamed Source"}),v.jsx("span",{className:"text-xs text-slate-500 bg-[#1e2a3a] px-2 py-0.5 rounded",children:e.type})]}),v.jsx("button",{onClick:o=>{o.stopPropagation(),r()},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Yg,{size:14})})]}),n&&v.jsxs("div",{className:"p-4 space-y-4 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(pt,{label:"Name",value:e.name,onChange:o=>t({...e,name:o}),helper:"Friendly name for this source"}),v.jsx(Fn,{label:"Type",value:e.type,onChange:o=>t({...e,type:o}),options:[{value:"meshview",label:"MeshView"},{value:"meshmonitor",label:"MeshMonitor"},{value:"mqtt",label:"MQTT Broker"}],info:a[e.type]||""})]}),e.type!=="mqtt"&&v.jsx(pt,{label:"URL",value:e.url,onChange:o=>t({...e,url:o}),helper:"Full URL including protocol"}),e.type==="meshmonitor"&&v.jsx(pt,{label:"API Token",value:e.api_token,onChange:o=>t({...e,api_token:o}),type:"password",helper:"Bearer token for authentication"}),e.type==="mqtt"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(pt,{label:"Host",value:e.host||"",onChange:o=>t({...e,host:o}),helper:"MQTT broker hostname"}),v.jsx(Ge,{label:"Port",value:e.port||1883,onChange:o=>t({...e,port:o}),min:1,max:65535,helper:"1883 plain, 8883 TLS"})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(pt,{label:"Username",value:e.username||"",onChange:o=>t({...e,username:o})}),v.jsx(pt,{label:"Password",value:e.password||"",onChange:o=>t({...e,password:o}),type:"password"})]}),v.jsx(pt,{label:"Topic Root",value:e.topic_root||"msh/US",onChange:o=>t({...e,topic_root:o}),helper:"Base topic to subscribe to"}),v.jsx(fr,{label:"Use TLS",checked:e.use_tls||!1,onChange:o=>t({...e,use_tls:o}),helper:"Encrypt MQTT connection"})]}),v.jsx(Ge,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:o=>t({...e,refresh_interval:o}),min:10,helper:"Polling frequency"}),v.jsx(fr,{label:"Enabled",checked:e.enabled,onChange:o=>t({...e,enabled:o})}),v.jsx(fr,{label:"Polite Mode",checked:e.polite_mode,onChange:o=>t({...e,polite_mode:o}),helper:"Reduce polling for shared instances"})]})]})}function MSe({data:e,onChange:t}){const r=()=>{t([...e,{name:"New Source",type:"meshview",url:"",api_token:"",refresh_interval:30,polite_mode:!1,enabled:!0,host:"",port:1883,username:"",password:"",topic_root:"msh/US",use_tls:!1}])};return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.mesh_sources}),e.map((n,i)=>v.jsx(TSe,{source:n,onChange:a=>{const o=[...e];o[i]=a,t(o)},onDelete:()=>{confirm(`Delete source "${n.name}"?`)&&t(e.filter((a,o)=>o!==i))}},i)),v.jsxs("button",{onClick:r,className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(od,{size:16})," Add Source"]})]})}function ASe({data:e,onChange:t}){const[r,n]=G.useState(null);return v.jsxs("div",{className:"space-y-6",children:[v.jsx(Jn,{text:Kn.mesh_intelligence}),v.jsx(fr,{label:"Enable Mesh Intelligence",checked:e.enabled,onChange:i=>t({...e,enabled:i}),helper:"Activate health scoring and alerting"}),e.enabled&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Locality Radius (miles)",value:e.locality_radius_miles,onChange:i=>t({...e,locality_radius_miles:i}),min:1,step:.5,helper:"Region assignment radius",info:"Nodes within this distance of a region anchor point are assigned to that region."}),v.jsx(Ge,{label:"Offline Threshold (hours)",value:e.offline_threshold_hours,onChange:i=>t({...e,offline_threshold_hours:i}),min:1,helper:"Time until node marked offline",info:"A node is considered offline after not being heard for this many hours."})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Packet Threshold",value:e.packet_threshold,onChange:i=>t({...e,packet_threshold:i}),min:0,helper:"Min packets per 24h to flag",info:"Minimum packets per 24 hours. Nodes below this are flagged as low activity."}),v.jsx(Ge,{label:"Battery Warning %",value:e.battery_warning_percent,onChange:i=>t({...e,battery_warning_percent:i}),min:1,max:100,helper:"Global battery warning level"})]}),v.jsx(cP,{label:"Critical Nodes",value:e.critical_nodes,onChange:i=>t({...e,critical_nodes:i}),helper:"Critical infrastructure nodes",info:"Nodes that get priority alerting when they go offline.",roleFilter:"infrastructure"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(hP,{label:"Alert Channel",value:e.alert_channel,onChange:i=>t({...e,alert_channel:i}),helper:"Channel for broadcast alerts",info:"Meshtastic channel for broadcast alerts. Select Disabled to turn off channel broadcasting.",mode:"single",includeDisabled:!0}),v.jsx(Ge,{label:"Alert Cooldown (min)",value:e.alert_cooldown_minutes,onChange:i=>t({...e,alert_cooldown_minutes:i}),min:1,helper:"Min time between repeat alerts",info:"Minimum minutes between repeated alerts for the same condition. Uses scaling cooldown (12h, 24h, 48h)."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Regions",v.jsx(yo,{info:"Regions group mesh nodes by geographic area. Each region has an anchor point (lat/lon) and nodes within the region radius are automatically assigned. Regions enable localized reports, alerts, and health scoring."})]}),e.regions.map((i,a)=>v.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>n(r===a?null:a),children:[v.jsxs("div",{className:"flex items-center gap-3",children:[r===a?v.jsx(jl,{size:16}):v.jsx(Sl,{size:16}),v.jsx("span",{className:"font-medium text-slate-200",children:i.name||"Unnamed Region"}),v.jsx("span",{className:"text-xs text-slate-500",children:i.local_name})]}),v.jsx("button",{onClick:o=>{if(o.stopPropagation(),confirm(`Delete region "${i.name||"Unnamed Region"}"?`)){const s=e.regions.filter((l,u)=>u!==a);t({...e,regions:s})}},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:v.jsx(Yg,{size:14})})]}),r===a&&v.jsxs("div",{className:"p-4 space-y-3 border-t border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(pt,{label:"Name",value:i.name,onChange:o=>{const s=[...e.regions];s[a]={...i,name:o},t({...e,regions:s})}}),v.jsx(pt,{label:"Local Name",value:i.local_name,onChange:o=>{const s=[...e.regions];s[a]={...i,local_name:o},t({...e,regions:s})}})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Latitude",value:i.lat,onChange:o=>{const s=[...e.regions];s[a]={...i,lat:o},t({...e,regions:s})},step:1e-4}),v.jsx(Ge,{label:"Longitude",value:i.lon,onChange:o=>{const s=[...e.regions];s[a]={...i,lon:o},t({...e,regions:s})},step:1e-4})]}),v.jsx(pt,{label:"Description",value:i.description,onChange:o=>{const s=[...e.regions];s[a]={...i,description:o},t({...e,regions:s})}}),v.jsx(zo,{label:"Aliases",value:i.aliases,onChange:o=>{const s=[...e.regions];s[a]={...i,aliases:o},t({...e,regions:s})}}),v.jsx(zo,{label:"Cities",value:i.cities,onChange:o=>{const s=[...e.regions];s[a]={...i,cities:o},t({...e,regions:s})}})]})]},a)),v.jsxs("button",{onClick:()=>{const i={name:"",local_name:"",lat:0,lon:0,description:"",aliases:[],cities:[]};t({...e,regions:[...e.regions,i]}),n(e.regions.length)},className:"w-full py-2 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(od,{size:16})," Add Region"]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Rules",v.jsx(yo,{info:"Configure which conditions trigger alerts. Each rule can have an optional threshold value."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Infrastructure"}),v.jsx(dn,{label:"Infra Offline",description:"Alert when an infrastructure node (router/repeater) goes offline",checked:e.alert_rules.infra_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_offline:i}})}),v.jsx(dn,{label:"Infra Recovery",description:"Alert when an offline infrastructure node comes back online",checked:e.alert_rules.infra_recovery,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_recovery:i}})}),v.jsx(dn,{label:"New Router",description:"Alert when a new router/repeater appears on the mesh",checked:e.alert_rules.new_router,onChange:i=>t({...e,alert_rules:{...e.alert_rules,new_router:i}})}),v.jsx(dn,{label:"Feeder Offline",description:"Alert when a data source (MeshView/MeshMonitor) stops responding",checked:e.alert_rules.feeder_offline,onChange:i=>t({...e,alert_rules:{...e.alert_rules,feeder_offline:i}})}),v.jsx(dn,{label:"Single Gateway",description:"Alert when an infrastructure node has only one connection path",checked:e.alert_rules.infra_single_gateway,onChange:i=>t({...e,alert_rules:{...e.alert_rules,infra_single_gateway:i}})}),v.jsx(dn,{label:"Region Blackout",description:"Alert when all infrastructure in a region goes offline",checked:e.alert_rules.region_total_blackout,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_total_blackout:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Power"}),v.jsx(dn,{label:"Battery Warning",description:"Alert when infra node battery drops below warning threshold",checked:e.alert_rules.battery_warning,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning:i}}),threshold:e.alert_rules.battery_warning_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_warning_threshold:i}}),thresholdLabel:"Below",thresholdMin:10,thresholdMax:90,thresholdSuffix:"%"}),v.jsx(dn,{label:"Battery Critical",description:"Alert at critical battery level",checked:e.alert_rules.battery_critical,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical:i}}),threshold:e.alert_rules.battery_critical_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_critical_threshold:i}}),thresholdLabel:"Below",thresholdMin:5,thresholdMax:50,thresholdSuffix:"%"}),v.jsx(dn,{label:"Battery Emergency",description:"Alert at emergency battery level",checked:e.alert_rules.battery_emergency,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency:i}}),threshold:e.alert_rules.battery_emergency_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_emergency_threshold:i}}),thresholdLabel:"Below",thresholdMin:1,thresholdMax:25,thresholdSuffix:"%"}),v.jsx(dn,{label:"Battery Trend Declining",description:"Alert when battery shows a declining trend over 7 days",checked:e.alert_rules.battery_trend_declining,onChange:i=>t({...e,alert_rules:{...e.alert_rules,battery_trend_declining:i}})}),v.jsx(dn,{label:"Power Source Change",description:"Alert when a node switches between battery and USB power",checked:e.alert_rules.power_source_change,onChange:i=>t({...e,alert_rules:{...e.alert_rules,power_source_change:i}})}),v.jsx(dn,{label:"Solar Not Charging",description:"Alert when a solar-powered node isn't charging during daylight",checked:e.alert_rules.solar_not_charging,onChange:i=>t({...e,alert_rules:{...e.alert_rules,solar_not_charging:i}})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Utilization"}),v.jsx(dn,{label:"High Utilization",description:"Alert when channel utilization stays high for extended periods",checked:e.alert_rules.sustained_high_util,onChange:i=>t({...e,alert_rules:{...e.alert_rules,sustained_high_util:i}}),threshold:e.alert_rules.high_util_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,high_util_threshold:i}}),thresholdLabel:"Above",thresholdMin:5,thresholdMax:50,thresholdSuffix:`% for ${e.alert_rules.high_util_hours}h`}),v.jsx(dn,{label:"Packet Flood",description:"Alert when a single node sends excessive packets",checked:e.alert_rules.packet_flood,onChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood:i}}),threshold:e.alert_rules.packet_flood_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,packet_flood_threshold:i}}),thresholdLabel:"Over",thresholdMin:100,thresholdMax:2e3,thresholdSuffix:"pkts/24h"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Health Scores"}),v.jsx(dn,{label:"Mesh Score Alert",description:"Alert when overall mesh health score drops below threshold",checked:e.alert_rules.mesh_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_alert:i}}),threshold:e.alert_rules.mesh_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,mesh_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"}),v.jsx(dn,{label:"Region Score Alert",description:"Alert when a region's health score drops below threshold",checked:e.alert_rules.region_score_alert,onChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_alert:i}}),threshold:e.alert_rules.region_score_threshold,onThresholdChange:i=>t({...e,alert_rules:{...e.alert_rules,region_score_threshold:i}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"})]})]})]})]})}function kSe({data:e,onChange:t}){return v.jsxs("div",{className:"space-y-4",children:[v.jsx(Jn,{text:Kn.dashboard}),v.jsx(fr,{label:"Enable Dashboard",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Run the web dashboard"}),e.enabled&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(pt,{label:"Host",value:e.host,onChange:r=>t({...e,host:r}),placeholder:"0.0.0.0",helper:"Network bind address",info:"0.0.0.0 = accessible from any device on the network. 127.0.0.1 = only accessible from this machine."}),v.jsx(Ge,{label:"Port",value:e.port,onChange:r=>t({...e,port:r}),min:1,max:65535,helper:"Dashboard URL port",info:"Port number for the web dashboard URL. You access the dashboard at http://your-ip:port"})]})]})}function LSe(){var P;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState("bot"),[o,s]=G.useState(!0),[l,u]=G.useState(!1),[c,h]=G.useState(null),[f,d]=G.useState(null),[g,m]=G.useState(!1),[y,_]=G.useState(!1),x=G.useCallback(async()=>{try{const I=await fetch("/api/config");if(!I.ok)throw new Error("Failed to fetch config");const D=await I.json();t(D),n(JSON.parse(JSON.stringify(D))),_(!1),h(null)}catch(I){h(I instanceof Error?I.message:"Unknown error")}finally{s(!1)}},[]);G.useEffect(()=>{document.title="Config — MeshAI",x()},[x]),G.useEffect(()=>{e&&r&&_(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const w=async()=>{if(e){u(!0),h(null),d(null);try{const I=e[i],D=await fetch(`/api/config/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)}),O=await D.json();if(!D.ok)throw new Error(O.detail||"Save failed");d(`${i} saved successfully`),n(JSON.parse(JSON.stringify(e))),_(!1),O.restart_required&&(m(!0),qK(Array.isArray(O.changed_keys)?O.changed_keys:[])),setTimeout(()=>d(null),3e3)}catch(I){h(I instanceof Error?I.message:"Save failed")}finally{u(!1)}}},S=()=>{r&&(t(JSON.parse(JSON.stringify(r))),_(!1))},T=async()=>{try{await fetch("/api/restart",{method:"POST"}),m(!1),d("Restart initiated")}catch{h("Restart failed")}},M=(I,D)=>{e&&t({...e,[I]:D})};if(o)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading configuration..."})});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load configuration"})});const A=()=>{switch(i){case"bot":return v.jsx(vSe,{data:e.bot,onChange:I=>M("bot",I)});case"connection":return v.jsx(pSe,{data:e.connection,onChange:I=>M("connection",I)});case"response":return v.jsx(gSe,{data:e.response,onChange:I=>M("response",I)});case"history":return v.jsx(mSe,{data:e.history,onChange:I=>M("history",I)});case"memory":return v.jsx(ySe,{data:e.memory,onChange:I=>M("memory",I)});case"context":return v.jsx(_Se,{data:e.context,onChange:I=>M("context",I)});case"commands":return v.jsx(xSe,{data:e.commands,onChange:I=>M("commands",I)});case"llm":return v.jsx(bSe,{data:e.llm,onChange:I=>M("llm",I)});case"weather":return v.jsx(wSe,{data:e.weather,onChange:I=>M("weather",I)});case"meshmonitor":return v.jsx(SSe,{data:e.meshmonitor,onChange:I=>M("meshmonitor",I)});case"knowledge":return v.jsx(CSe,{data:e.knowledge,onChange:I=>M("knowledge",I)});case"mesh_sources":return v.jsx(MSe,{data:e.mesh_sources,onChange:I=>M("mesh_sources",I)});case"mesh_intelligence":return v.jsx(ASe,{data:e.mesh_intelligence,onChange:I=>M("mesh_intelligence",I)});case"dashboard":return v.jsx(kSe,{data:e.dashboard,onChange:I=>M("dashboard",I)});default:return null}},N=((P=xB.find(I=>I.key===i))==null?void 0:P.label)||i;return v.jsxs("div",{className:"flex gap-6 h-[calc(100vh-8rem)]",children:[v.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:xB.map(({key:I,label:D,icon:O})=>v.jsxs("button",{onClick:()=>a(I),className:`w-full flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${i===I?"bg-accent text-white":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover"}`,children:[v.jsx(O,{size:16}),v.jsx("span",{children:D}),y&&i===I&&v.jsx("span",{className:"ml-auto w-2 h-2 bg-amber-500 rounded-full"})]},I))}),v.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[v.jsxs("div",{className:"flex items-center justify-between mb-6",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(l6,{size:20,className:"text-slate-500"}),v.jsx("h2",{className:"text-lg font-semibold text-slate-200",children:N})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[y&&v.jsxs("button",{onClick:S,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-slate-400 hover:text-slate-200 bg-bg-hover rounded transition-colors",children:[v.jsx(W1,{size:14}),"Discard"]}),v.jsxs("button",{onClick:w,disabled:l||!y,className:"flex items-center gap-1.5 px-4 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[l?v.jsx(qp,{size:14,className:"animate-spin"}):v.jsx(rL,{size:14}),"Save"]})]})]}),g&&v.jsxs("div",{className:"flex items-center justify-between p-3 mb-4 bg-amber-500/10 border border-amber-500/30",children:[v.jsxs("div",{className:"flex items-center gap-2 text-amber-400",children:[v.jsx(oo,{size:16}),v.jsx("span",{className:"text-sm",children:"Restart required for changes to take effect"})]}),v.jsx("button",{onClick:T,className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",children:"Restart Now"})]}),c&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-red-500/10 border border-red-500/30 text-red-400",children:[v.jsx(ya,{size:16}),v.jsx("span",{className:"text-sm",children:c})]}),f&&v.jsxs("div",{className:"flex items-center gap-2 p-3 mb-4 bg-green-500/10 border border-green-500/30 text-green-400",children:[v.jsx(ao,{size:16}),v.jsx("span",{className:"text-sm",children:f})]}),v.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:v.jsx("div",{className:"bg-bg-card border border-border p-6",children:A()})})]})]})}function ISe({feed:e}){const t=e.is_loaded?e.consecutive_errors>0?"bg-amber-500":"bg-green-500":"bg-red-500",r=e.is_loaded?e.consecutive_errors>0?`${e.consecutive_errors} errors`:"Healthy":"Not loaded",n=e.last_fetch?new Date(e.last_fetch*1e3).toLocaleTimeString():"Never";return v.jsxs("div",{className:"bg-bg-hover p-4",children:[v.jsxs("div",{className:"flex items-center justify-between mb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("div",{className:`w-2 h-2 rounded-full ${t}`}),v.jsx("span",{className:"text-sm font-medium text-white uppercase",children:e.source})]}),v.jsx("span",{className:"text-xs text-[#777]",children:r})]}),v.jsxs("div",{className:"text-xs font-mono text-[#666] space-y-1",children:[v.jsxs("div",{children:["Events: ",e.event_count]}),v.jsxs("div",{children:["Last fetch: ",n]}),e.last_error&&v.jsx("div",{className:"text-accent truncate",children:e.last_error})]})]})}function NSe({event:e}){const t=e.severity.toLowerCase(),r=t==="extreme"||t==="severe"||t==="immediate"?{bg:"bg-red-500/10",border:"border-red-500",Icon:os,color:"text-red-500"}:t==="moderate"||t==="warning"||t==="priority"?{bg:"bg-accent/10",border:"border-amber-500",Icon:oo,color:"text-accent"}:{bg:"bg-sky-400/10",border:"border-sky-400",Icon:H1,color:"text-sky-400"},n=r.Icon;return v.jsx("div",{className:`p-3 ${r.bg} border-l-2 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:16,className:r.color}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:"text-sm font-medium text-white",children:e.event_type}),v.jsx("span",{className:`text-xs px-1.5 py-0.5 ${r.bg} ${r.color}`,children:e.severity})]}),v.jsx("div",{className:"text-sm font-sans text-[#e0e0e0]",children:e.headline})]})]})})}function GZ({value:e,onChange:t,disabled:r,centralDisabled:n}){const i="px-2 py-1 text-xs transition-colors";return v.jsxs("div",{className:`flex border border-border overflow-hidden ${r?"opacity-40":""}`,children:[v.jsx("button",{type:"button",disabled:r,onClick:()=>t("native"),className:`${i} ${e==="native"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"native"}),v.jsx("button",{type:"button",disabled:r||n,title:n?"Central not available for this adapter":"",onClick:()=>{n||t("central")},className:`${i} ${n?"text-[#666] cursor-not-allowed":e==="central"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"central"})]})}function PSe({title:e,subtitle:t,enabled:r,onEnabled:n,feedSource:i,onFeedSource:a,hasCentral:o,nativeOnly:s,hasKey:l,health:u,events:c,children:h}){const f=s||!o;return v.jsxs("div",{className:"border border-border p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:e}),t&&v.jsx("p",{className:"text-xs text-[#666]",children:t})]}),v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),v.jsx(GZ,{value:i,onChange:a,disabled:!r,centralDisabled:f})]}),v.jsx(fr,{label:"",checked:r,onChange:n})]})]}),!l&&v.jsx("div",{className:"text-xs text-accent bg-accent/10 p-2",children:"API key not configured — contact admin"}),s&&v.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available for this adapter — native only"}),v.jsx("div",{className:r?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:h}),(u||c&&c.length>0)&&v.jsxs("div",{className:"pt-2 border-t border-border space-y-3",children:[v.jsx("div",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"Live status"}),u?v.jsx(ISe,{feed:u}):v.jsx("div",{className:"text-xs text-[#666]",children:"No status reported."}),c&&c.length>0&&v.jsx("div",{className:"space-y-2",children:c.slice(0,5).map((d,g)=>v.jsx(NSe,{event:d},g))})]})]})}const Rs={nws:{label:"NWS Weather Alerts",subtitle:"National Weather Service alerts",health:"nws",hasCentral:!0,nativeOnly:!1,hasKey:!0},fires:{label:"NIFC Fire Perimeters",subtitle:"Active wildfires (National Interagency Fire Center)",health:"nifc",hasCentral:!0,nativeOnly:!1,hasKey:!0},firms:{label:"NASA FIRMS Hotspots",subtitle:"Satellite thermal-anomaly detections",health:"firms",hasCentral:!0,nativeOnly:!1,hasKey:!1},swpc:{label:"NOAA Space Weather (SWPC)",subtitle:"Solar indices, geomagnetic storms",health:"swpc",hasCentral:!0,nativeOnly:!1,hasKey:!0},ducting:{label:"Tropospheric Ducting",subtitle:"VHF/UHF extended-range conditions",health:"ducting",hasCentral:!1,nativeOnly:!0,hasKey:!0},traffic:{label:"TomTom Traffic",subtitle:"Traffic flow on monitored corridors",health:"traffic",hasCentral:!0,nativeOnly:!1,hasKey:!0},roads511:{label:"511 Road Conditions",subtitle:"State DOT road events and closures",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!1},wzdx:{label:"WZDx Work Zones",subtitle:"Planned road work and construction events from ITD",health:"roads511",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs_quake:{label:"USGS Earthquakes",subtitle:"Seismic events from the USGS feed",health:"usgs_quake",hasCentral:!0,nativeOnly:!1,hasKey:!0},usgs:{label:"USGS Stream Gauges",subtitle:"River and stream water levels",health:"usgs",hasCentral:!0,nativeOnly:!1,hasKey:!0},avalanche:{label:"Avalanche Advisories",subtitle:"Backcountry avalanche danger ratings",health:"avalanche",hasCentral:!0,nativeOnly:!1,hasKey:!0},satpass:{label:"Satellite Passes",subtitle:"Observer pass alerts via Central",health:"satpass",hasCentral:!0,nativeOnly:!1,hasKey:!0}},jT=[{key:"central",label:"Central",icon:jK,adapters:[]},{key:"weather",label:"Weather",icon:uc,adapters:["nws"]},{key:"fire",label:"Fire",icon:G1,adapters:["fires","firms"]},{key:"rf",label:"RF Propagation",icon:Gi,adapters:["swpc","ducting"]},{key:"roads",label:"Roads",icon:F1,adapters:["traffic","roads511","wzdx"]},{key:"geohazards",label:"Geohazards",icon:U1,adapters:["usgs_quake","usgs","avalanche"]},{key:"tracking",label:"Tracking",icon:Z1,adapters:["satpass"]},{key:"mesh",label:"Mesh Health",icon:id,adapters:[]}];function DSe(){var Mm,Am;const[e,t]=G.useState(null),[r,n]=G.useState(""),[i,a]=G.useState(null),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,_]=G.useState(!1),[x,w]=G.useState("weather"),[S,T]=G.useState("nws"),[M,A]=G.useState({allowed_incident_types:["WF"],freshness_seconds:0,cooldown_seconds:28800,broadcast_on_acres:!0,broadcast_on_contained:!0}),[N,P]=G.useState(""),[I,D]=G.useState({digest_enabled:!0,digest_schedule:["06:00","18:00"],digest_timezone:"America/Boise"}),[O,j]=G.useState(""),[B,U]=G.useState({min_magnitude:4,drop_non_present:!0,drop_zero_magnitude:!0}),[H,V]=G.useState(""),[z,$]=G.useState({min_severity:"None",enabled_categories:["incident","closure"],enabled_sub_types:["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]}),[W,Z]=G.useState(""),[X,re]=G.useState({broadcast:!1,min_severity:"Minor",sub_types:["road_works","lane_closed","road_closed"]}),[J,oe]=G.useState(""),[le,De]=G.useState({broadcast_severities:["Extreme","Severe"],duplicate_allowed_after_seconds:3600}),[we,ve]=G.useState(""),[Ne,xe]=G.useState({min_danger_level:3}),[Le,ht]=G.useState(""),[Fe,nt]=G.useState({geomag_kp_floor:7,flare_class_floor:"X1",proton_pfu_floor:10}),[ft,Ot]=G.useState(""),[Xe,Zt]=G.useState({enabled:!1,observers:[],min_elevation:30,norad_ids:[],max_broadcasts_per_hour:4,dry_run:!0}),[On,Qn]=G.useState("");G.useEffect(()=>{document.title="Environment — MeshAI",(async()=>{var ye,er,wn,mi,Ji,Vl,te,et,be,dt,or,Ca,ws,th,Od,To,zd,km,Lm,Im,Nm,Bd,Pm,Gl,Dm,Em,Rm,jm,Om;try{const Ss=await(await fetch("/api/config/environmental")).json();t(Ss),n(JSON.stringify(Ss));try{const Dt=await fetch("/api/adapter-config/wfigs");if(Dt.ok){const St=await Dt.json(),yt={allowed_incident_types:((ye=St.allowed_incident_types)==null?void 0:ye.value)??["WF"],freshness_seconds:((er=St.freshness_seconds)==null?void 0:er.value)??0,cooldown_seconds:((wn=St.cooldown_seconds)==null?void 0:wn.value)??28800,broadcast_on_acres:((mi=St.broadcast_on_acres)==null?void 0:mi.value)??!0,broadcast_on_contained:((Ji=St.broadcast_on_contained)==null?void 0:Ji.value)??!0};A(yt),P(JSON.stringify(yt))}}catch{}try{const Dt=await fetch("/api/adapter-config/fires");if(Dt.ok){const St=await Dt.json(),yt={digest_enabled:((Vl=St.digest_enabled)==null?void 0:Vl.value)??!0,digest_schedule:((te=St.digest_schedule)==null?void 0:te.value)??["06:00","18:00"],digest_timezone:((et=St.digest_timezone)==null?void 0:et.value)??"America/Boise"};D(yt),j(JSON.stringify(yt))}}catch{}try{const Dt=await fetch("/api/adapter-config/tomtom_incidents");if(Dt.ok){const St=await Dt.json(),yt={min_magnitude:((be=St.min_magnitude)==null?void 0:be.value)??4,drop_non_present:((dt=St.drop_non_present)==null?void 0:dt.value)??!0,drop_zero_magnitude:((or=St.drop_zero_magnitude)==null?void 0:or.value)??!0};U(yt),V(JSON.stringify(yt))}}catch{}try{const Dt=await fetch("/api/adapter-config/itd_511");if(Dt.ok){const St=await Dt.json(),yt={min_severity:((Ca=St.min_severity)==null?void 0:Ca.value)??"None",enabled_categories:((ws=St.enabled_categories)==null?void 0:ws.value)??["incident","closure"],enabled_sub_types:((th=St.enabled_sub_types)==null?void 0:th.value)??["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]};$(yt),Z(JSON.stringify(yt))}}catch{}try{const Dt=await fetch("/api/adapter-config/wzdx");if(Dt.ok){const St=await Dt.json(),yt={broadcast:((Od=St.broadcast)==null?void 0:Od.value)??!1,min_severity:((To=St.min_severity)==null?void 0:To.value)??"Minor",sub_types:((zd=St.sub_types)==null?void 0:zd.value)??["road_works","lane_closed","road_closed"]};re(yt),oe(JSON.stringify(yt))}}catch{}try{const Dt=await fetch("/api/adapter-config/nws");if(Dt.ok){const St=await Dt.json(),yt={broadcast_severities:((km=St.broadcast_severities)==null?void 0:km.value)??["Extreme","Severe"],duplicate_allowed_after_seconds:((Lm=St.duplicate_allowed_after_seconds)==null?void 0:Lm.value)??3600};De(yt),ve(JSON.stringify(yt))}}catch{}try{const Dt=await fetch("/api/adapter-config/avalanche");if(Dt.ok){const yt={min_danger_level:((Im=(await Dt.json()).min_danger_level)==null?void 0:Im.value)??3};xe(yt),ht(JSON.stringify(yt))}}catch{}try{const Dt=await fetch("/api/adapter-config/swpc");if(Dt.ok){const St=await Dt.json(),yt={geomag_kp_floor:((Nm=St.geomag_kp_floor)==null?void 0:Nm.value)??7,flare_class_floor:((Bd=St.flare_class_floor)==null?void 0:Bd.value)??"X1",proton_pfu_floor:((Pm=St.proton_pfu_floor)==null?void 0:Pm.value)??10};nt(yt),Ot(JSON.stringify(yt))}}catch{}try{const Dt=await fetch("/api/adapter-config/satpass");if(Dt.ok){const St=await Dt.json(),yt={};for(const Gt of St)yt[Gt.key]=Gt;const xt={enabled:((Gl=yt.enabled)==null?void 0:Gl.value)??!1,observers:((Dm=yt.observers)==null?void 0:Dm.value)??[],min_elevation:((Em=yt.min_elevation)==null?void 0:Em.value)??30,norad_ids:((Rm=yt.norad_ids)==null?void 0:Rm.value)??[],max_broadcasts_per_hour:((jm=yt.max_broadcasts_per_hour)==null?void 0:jm.value)??4,dry_run:((Om=yt.dry_run)==null?void 0:Om.value)??!0};Zt(xt),Qn(JSON.stringify(xt))}}catch{}}catch(Hl){d(Hl instanceof Error?Hl.message:"Failed to load config")}finally{u(!1)}})()},[]),G.useEffect(()=>{const ye=async()=>{try{a(await d6()),s(await v6())}catch{}};ye();const er=setInterval(ye,3e4);return()=>clearInterval(er)},[]);const So=e!==null&&JSON.stringify(e)!==r,Nd=JSON.stringify(M)!==N,_m=JSON.stringify(I)!==O,xm=JSON.stringify(B)!==H,eh=JSON.stringify(z)!==W,Pd=JSON.stringify(X)!==J,Dd=JSON.stringify(le)!==we,bm=JSON.stringify(Ne)!==Le,Ed=JSON.stringify(Fe)!==ft,Rd=JSON.stringify(Xe)!==On,Jb=So||Nd||_m||xm||eh||Pd||Dd||bm||Ed||Rd,kt=async(ye,er,wn)=>{const mi=await fetch(`/api/adapter-config/${ye}/${er}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:wn})});if(!mi.ok){const Ji=await mi.json().catch(()=>({}));throw new Error(Ji.detail||`Failed to save ${ye}.${er}`)}},jd=async()=>{if(e){h(!0),d(null),m(null);try{if(So){const ye=await fetch("/api/config/environmental",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),er=await ye.json();if(!ye.ok)throw new Error(er.detail||"Save failed");n(JSON.stringify(e)),er.restart_required&&_(!0)}if(Nd){const ye=JSON.parse(N);M.freshness_seconds!==ye.freshness_seconds&&await kt("wfigs","freshness_seconds",M.freshness_seconds),JSON.stringify(M.allowed_incident_types)!==JSON.stringify(ye.allowed_incident_types)&&await kt("wfigs","allowed_incident_types",M.allowed_incident_types),M.cooldown_seconds!==ye.cooldown_seconds&&await kt("wfigs","cooldown_seconds",M.cooldown_seconds),M.broadcast_on_acres!==ye.broadcast_on_acres&&await kt("wfigs","broadcast_on_acres",M.broadcast_on_acres),M.broadcast_on_contained!==ye.broadcast_on_contained&&await kt("wfigs","broadcast_on_contained",M.broadcast_on_contained),P(JSON.stringify(M))}if(_m){const ye=JSON.parse(O);I.digest_enabled!==ye.digest_enabled&&await kt("fires","digest_enabled",I.digest_enabled),JSON.stringify(I.digest_schedule)!==JSON.stringify(ye.digest_schedule)&&await kt("fires","digest_schedule",I.digest_schedule),I.digest_timezone!==ye.digest_timezone&&await kt("fires","digest_timezone",I.digest_timezone),j(JSON.stringify(I))}if(xm){const ye=JSON.parse(H);B.min_magnitude!==ye.min_magnitude&&await kt("tomtom_incidents","min_magnitude",B.min_magnitude),B.drop_non_present!==ye.drop_non_present&&await kt("tomtom_incidents","drop_non_present",B.drop_non_present),B.drop_zero_magnitude!==ye.drop_zero_magnitude&&await kt("tomtom_incidents","drop_zero_magnitude",B.drop_zero_magnitude),V(JSON.stringify(B))}if(eh){const ye=JSON.parse(W);z.min_severity!==ye.min_severity&&await kt("itd_511","min_severity",z.min_severity),JSON.stringify(z.enabled_categories)!==JSON.stringify(ye.enabled_categories)&&await kt("itd_511","enabled_categories",z.enabled_categories),JSON.stringify(z.enabled_sub_types)!==JSON.stringify(ye.enabled_sub_types)&&await kt("itd_511","enabled_sub_types",z.enabled_sub_types),Z(JSON.stringify(z))}if(Pd){const ye=JSON.parse(J);X.broadcast!==ye.broadcast&&await kt("wzdx","broadcast",X.broadcast),X.min_severity!==ye.min_severity&&await kt("wzdx","min_severity",X.min_severity),JSON.stringify(X.sub_types)!==JSON.stringify(ye.sub_types)&&await kt("wzdx","sub_types",X.sub_types),oe(JSON.stringify(X))}if(Dd){const ye=JSON.parse(we);JSON.stringify(le.broadcast_severities)!==JSON.stringify(ye.broadcast_severities)&&await kt("nws","broadcast_severities",le.broadcast_severities),le.duplicate_allowed_after_seconds!==ye.duplicate_allowed_after_seconds&&await kt("nws","duplicate_allowed_after_seconds",le.duplicate_allowed_after_seconds),ve(JSON.stringify(le))}if(bm){const ye=JSON.parse(Le);Ne.min_danger_level!==ye.min_danger_level&&await kt("avalanche","min_danger_level",Ne.min_danger_level),ht(JSON.stringify(Ne))}if(Ed){const ye=JSON.parse(ft);Fe.geomag_kp_floor!==ye.geomag_kp_floor&&await kt("swpc","geomag_kp_floor",Fe.geomag_kp_floor),Fe.flare_class_floor!==ye.flare_class_floor&&await kt("swpc","flare_class_floor",Fe.flare_class_floor),Fe.proton_pfu_floor!==ye.proton_pfu_floor&&await kt("swpc","proton_pfu_floor",Fe.proton_pfu_floor),Ot(JSON.stringify(Fe))}if(Rd){const ye=JSON.parse(On);Xe.enabled!==ye.enabled&&await kt("satpass","enabled",Xe.enabled),JSON.stringify(Xe.observers)!==JSON.stringify(ye.observers)&&await kt("satpass","observers",Xe.observers),Xe.min_elevation!==ye.min_elevation&&await kt("satpass","min_elevation",Xe.min_elevation),JSON.stringify(Xe.norad_ids)!==JSON.stringify(ye.norad_ids)&&await kt("satpass","norad_ids",Xe.norad_ids),Xe.max_broadcasts_per_hour!==ye.max_broadcasts_per_hour&&await kt("satpass","max_broadcasts_per_hour",Xe.max_broadcasts_per_hour),Xe.dry_run!==ye.dry_run&&await kt("satpass","dry_run",Xe.dry_run),Qn(JSON.stringify(Xe))}m("Config saved"),setTimeout(()=>m(null),3e3)}catch(ye){d(ye instanceof Error?ye.message:"Save failed")}finally{h(!1)}}},wm=()=>{e&&t(JSON.parse(r)),A(JSON.parse(N||JSON.stringify(M))),D(JSON.parse(O||JSON.stringify(I))),U(JSON.parse(H||JSON.stringify(B))),$(JSON.parse(W||JSON.stringify(z))),re(JSON.parse(J||JSON.stringify(X))),De(JSON.parse(we||JSON.stringify(le))),xe(JSON.parse(Le||JSON.stringify(Ne))),nt(JSON.parse(ft||JSON.stringify(Fe))),Zt(JSON.parse(On||JSON.stringify(Xe)))},Qb=async()=>{try{await fetch("/api/restart",{method:"POST"}),_(!1),m("Restart initiated")}catch{d("Restart failed")}},Ve=ye=>e&&t({...e,...ye});if(l)return v.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading environmental config…"});if(!e)return v.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:f||"No config"});const ew=ye=>i==null?void 0:i.feeds.find(er=>er.source===Rs[ye].health),tw=ye=>o.filter(er=>er.source===Rs[ye].health),Co=jT.find(ye=>ye.key===x),Ir=Co.adapters.length===0?null:S&&Co.adapters.includes(S)?S:Co.adapters[0],Sm=ye=>{var er,wn,mi,Ji,Vl;switch(ye){case"nws":return v.jsxs(v.Fragment,{children:[v.jsx(zo,{label:"NWS Zones",value:e.nws_zones,onChange:te=>Ve({nws_zones:te}),helper:"Zone IDs like IDZ016, IDZ030",infoLink:"https://www.weather.gov/pimar/PubZone"}),e.nws.feed_source!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(pt,{label:"User Agent",value:e.nws.user_agent,onChange:te=>Ve({nws:{...e.nws,user_agent:te}}),placeholder:"(MeshAI, you@email.com)",helper:"Format: (app_name, contact_email)"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Tick Seconds",value:e.nws.tick_seconds,onChange:te=>Ve({nws:{...e.nws,tick_seconds:te}}),min:30}),v.jsx(Fn,{label:"Min Severity",value:e.nws.severity_min,onChange:te=>Ve({nws:{...e.nws,severity_min:te}}),options:[{value:"minor",label:"Minor"},{value:"moderate",label:"Moderate"},{value:"severe",label:"Severe"},{value:"extreme",label:"Extreme"}]})]})]}),e.nws.feed_source==="central"&&v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),v.jsxs("div",{className:"mb-3",children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Severities to broadcast"}),v.jsx("div",{className:"flex gap-6",children:["Extreme","Severe","Moderate","Minor"].map(te=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:le.broadcast_severities.includes(te),onChange:et=>{const be=le.broadcast_severities;De({...le,broadcast_severities:et.target.checked?[...be,te]:be.filter(dt=>dt!==te)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:te})]},te))})]}),v.jsx(Ge,{label:"Re-broadcast Cooldown (seconds)",value:le.duplicate_allowed_after_seconds,onChange:te=>De({...le,duplicate_allowed_after_seconds:te}),min:0,helper:"Minimum seconds before the same alert ID can be re-broadcast"})]})]});case"swpc":return v.jsx("div",{className:"space-y-6",children:v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Thresholds"}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(Fn,{label:"Geomag Kp Floor",value:String(Fe.geomag_kp_floor),onChange:te=>nt({...Fe,geomag_kp_floor:Number(te)}),options:[{value:"5",label:"5 — G1 Minor"},{value:"6",label:"6 — G2 Moderate"},{value:"7",label:"7 — G3 Strong"},{value:"8",label:"8 — G4 Severe"},{value:"9",label:"9 — G5 Extreme"}],helper:"Kp at or above this triggers geomag broadcast"}),v.jsx(Fn,{label:"Flare Class Floor",value:Fe.flare_class_floor,onChange:te=>nt({...Fe,flare_class_floor:te}),options:[{value:"M1",label:"M1 — R1 Minor"},{value:"M5",label:"M5 — R2 Moderate"},{value:"X1",label:"X1 — R3 Strong"},{value:"X10",label:"X10 — R4 Severe"}],helper:"X-ray flare class floor for broadcast"}),v.jsx(Fn,{label:"Proton pfu Floor",value:String(Fe.proton_pfu_floor),onChange:te=>nt({...Fe,proton_pfu_floor:Number(te)}),options:[{value:"10",label:"10 — S1 Minor"},{value:"100",label:"100 — S2 Moderate"},{value:"1000",label:"1000 — S3 Strong"},{value:"10000",label:"10000 — S4 Severe"}],helper:"Proton flux (pfu) at ≥10 MeV for broadcast"})]})]})});case"ducting":return v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(Ge,{label:"Tick Seconds",value:e.ducting.tick_seconds,onChange:te=>Ve({ducting:{...e.ducting,tick_seconds:te}}),min:60}),v.jsx(Ge,{label:"Latitude",value:e.ducting.latitude,onChange:te=>Ve({ducting:{...e.ducting,latitude:te}}),step:.01}),v.jsx(Ge,{label:"Longitude",value:e.ducting.longitude,onChange:te=>Ve({ducting:{...e.ducting,longitude:te}}),step:.01})]});case"fires":return v.jsxs("div",{className:"space-y-6",children:[e.fires.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Tick Seconds",value:e.fires.tick_seconds,onChange:te=>Ve({fires:{...e.fires,tick_seconds:te}}),min:60}),v.jsx(Fn,{label:"State",value:e.fires.state,onChange:te=>Ve({fires:{...e.fires,state:te}}),options:hSe})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Incident Types"}),v.jsx("div",{className:"flex gap-6",children:[["WF","Wildfire"],["RX","Prescribed Burn"],["OTHER","Other"]].map(([te,et])=>{var be;return v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:((be=M.allowed_incident_types)==null?void 0:be.includes(te))??te==="WF",onChange:dt=>{const or=M.allowed_incident_types??["WF"];A({...M,allowed_incident_types:dt.target.checked?[...or,te]:or.filter(Ca=>Ca!==te)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:et})]},te)})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Triggers"}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on acres increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_acres,onChange:te=>A({...M,broadcast_on_acres:te.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on containment increase"}),v.jsx("input",{type:"checkbox",checked:M.broadcast_on_contained,onChange:te=>A({...M,broadcast_on_contained:te.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Update Cooldown (hours)",value:Math.round(M.cooldown_seconds/3600),onChange:te=>A({...M,cooldown_seconds:te*3600}),min:0,helper:"Minimum hours between updates for the same fire"}),v.jsx(Ge,{label:"Freshness Window (hours)",value:Math.round(M.freshness_seconds/3600),onChange:te=>A({...M,freshness_seconds:te*3600}),min:0,helper:"0 = always broadcast regardless of event age"})]})]});case"avalanche":return v.jsxs("div",{className:"space-y-6",children:[e.avalanche.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Tick Seconds",value:e.avalanche.tick_seconds,onChange:te=>Ve({avalanche:{...e.avalanche,tick_seconds:te}}),min:60}),v.jsx(dSe,{label:"Season Months",value:e.avalanche.season_months,onChange:te=>Ve({avalanche:{...e.avalanche,season_months:te}}),helper:"e.g., 12, 1, 2, 3, 4"})]}),v.jsx(zo,{label:"Center IDs",value:e.avalanche.center_ids,onChange:te=>Ve({avalanche:{...e.avalanche,center_ids:te}}),helper:"e.g., SNFAC",infoLink:"https://avalanche.org/avalanche-centers/"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsx(Fn,{label:"Min Danger Level",value:String(Ne.min_danger_level),onChange:te=>xe({...Ne,min_danger_level:Number(te)}),options:[{value:"3",label:"3 — Considerable"},{value:"4",label:"4 — High"},{value:"5",label:"5 — Extreme"}],helper:"Minimum avalanche danger level to broadcast"})})]})]});case"usgs":return v.jsxs(v.Fragment,{children:[v.jsx(Ge,{label:"Tick Seconds",value:e.usgs.tick_seconds,onChange:te=>Ve({usgs:{...e.usgs,tick_seconds:te}}),min:900,helper:"Minimum 15 min (900s). tick_seconds is the native-mode poll interval; ignored when this adapter is set to feed_source=central."}),v.jsx(zo,{label:"Site IDs",value:e.usgs.sites,onChange:te=>Ve({usgs:{...e.usgs,sites:te}}),helper:"USGS gauge site numbers",infoLink:"https://waterdata.usgs.gov/nwis"})]});case"usgs_quake":return v.jsxs("div",{className:"space-y-6",children:[e.usgs_quake.feed_source!=="central"&&v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Tick Seconds",value:e.usgs_quake.tick_seconds,onChange:te=>Ve({usgs_quake:{...e.usgs_quake,tick_seconds:te}}),min:60}),v.jsx(pt,{label:"Region Tag",value:e.usgs_quake.region,onChange:te=>Ve({usgs_quake:{...e.usgs_quake,region:te}})})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Magnitude Thresholds"}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Ge,{label:"Global Floor",value:e.usgs_quake.global_mag_floor,onChange:te=>Ve({usgs_quake:{...e.usgs_quake,global_mag_floor:te}}),step:.1,min:0,helper:"Broadcast anywhere at or above this magnitude"}),v.jsx(Ge,{label:"Regional Floor",value:e.usgs_quake.regional_mag_floor,onChange:te=>Ve({usgs_quake:{...e.usgs_quake,regional_mag_floor:te}}),step:.1,min:0,helper:"Reduced floor within regional radius"}),v.jsx(Ge,{label:"Regional Radius (mi)",value:e.usgs_quake.regional_radius_mi,onChange:te=>Ve({usgs_quake:{...e.usgs_quake,regional_radius_mi:te}}),min:50,helper:"Radius around region centroid for reduced floor"}),v.jsx(Ge,{label:"Escalation Floor",value:e.usgs_quake.escalate_mag_floor,onChange:te=>Ve({usgs_quake:{...e.usgs_quake,escalate_mag_floor:te}}),step:.1,min:0,helper:"Magnitude at which broadcast uses warning emoji"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"PAGER Alert Levels"}),v.jsx("div",{className:"text-xs text-[#666] mb-2",children:"Broadcast at any magnitude when USGS PAGER alert reaches these levels"}),v.jsx("div",{className:"flex gap-6",children:["green","yellow","orange","red"].map(te=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:(e.usgs_quake.broadcast_pager_alerts??[]).includes(te),onChange:et=>{const be=e.usgs_quake.broadcast_pager_alerts??[];Ve({usgs_quake:{...e.usgs_quake,broadcast_pager_alerts:et.target.checked?[...be,te]:be.filter(dt=>dt!==te)}})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0] capitalize",children:te})]},te))})]})]});case"traffic":return v.jsxs(v.Fragment,{children:[v.jsx(pt,{label:"API Key",value:e.traffic.api_key,onChange:te=>Ve({traffic:{...e.traffic,api_key:te}}),type:"password",helper:"developer.tomtom.com"}),v.jsx(Ge,{label:"Tick Seconds",value:e.traffic.tick_seconds,onChange:te=>Ve({traffic:{...e.traffic,tick_seconds:te}}),min:60}),v.jsx("div",{className:"text-xs text-[#666] mt-2",children:"Corridors:"}),(e.traffic.corridors||[]).map((te,et)=>v.jsxs("div",{className:"grid grid-cols-4 gap-2 items-end",children:[v.jsx(pt,{label:"Name",value:te.name,onChange:be=>{const dt=[...e.traffic.corridors];dt[et]={...te,name:be},Ve({traffic:{...e.traffic,corridors:dt}})}}),v.jsx(Ge,{label:"Lat",value:te.lat,onChange:be=>{const dt=[...e.traffic.corridors];dt[et]={...te,lat:be},Ve({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx(Ge,{label:"Lon",value:te.lon,onChange:be=>{const dt=[...e.traffic.corridors];dt[et]={...te,lon:be},Ve({traffic:{...e.traffic,corridors:dt}})},step:.01}),v.jsx("button",{onClick:()=>Ve({traffic:{...e.traffic,corridors:e.traffic.corridors.filter((be,dt)=>dt!==et)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},et)),v.jsx("button",{onClick:()=>Ve({traffic:{...e.traffic,corridors:[...e.traffic.corridors||[],{name:"",lat:0,lon:0}]}}),className:"text-xs text-accent hover:underline",children:"+ Add Corridor"}),v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Magnitude"}),v.jsxs("select",{value:B.min_magnitude,onChange:te=>U({...B,min_magnitude:parseInt(te.target.value)}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[v.jsx("option",{value:1,children:"1 — Minor (all)"}),v.jsx("option",{value:2,children:"2 — Moderate (yellow+)"}),v.jsx("option",{value:3,children:"3 — Major (orange+)"}),v.jsx("option",{value:4,children:"4 — Severe (red only)"})]}),v.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop TomTom incidents below this severity level"})]})}),v.jsxs("div",{className:"mt-3 space-y-2",children:[v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop non-present time validity"}),v.jsx("input",{type:"checkbox",checked:B.drop_non_present,onChange:te=>U({...B,drop_non_present:te.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop zero-magnitude events"}),v.jsx("input",{type:"checkbox",checked:B.drop_zero_magnitude,onChange:te=>U({...B,drop_zero_magnitude:te.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]})]});case"roads511":return v.jsxs(v.Fragment,{children:[v.jsx(pt,{label:"Base URL",value:e.roads511.base_url,onChange:te=>Ve({roads511:{...e.roads511,base_url:te}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(pt,{label:"API Key",value:e.roads511.api_key,onChange:te=>Ve({roads511:{...e.roads511,api_key:te}}),type:"password",helper:"Leave empty if not required"}),v.jsx(Ge,{label:"Tick Seconds",value:e.roads511.tick_seconds,onChange:te=>Ve({roads511:{...e.roads511,tick_seconds:te}}),min:60}),v.jsx(zo,{label:"Endpoints",value:e.roads511.endpoints,onChange:te=>Ve({roads511:{...e.roads511,endpoints:te}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((te,et)=>{var be;return v.jsx(Ge,{label:te,value:((be=e.roads511.bbox)==null?void 0:be[et])??0,onChange:dt=>{const or=[...e.roads511.bbox||[0,0,0,0]];or[et]=dt,Ve({roads511:{...e.roads511,bbox:or}})},step:.01},te)})}),v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Severity"}),v.jsxs("select",{value:z.min_severity,onChange:te=>$({...z,min_severity:te.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]}),v.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop ITD 511 events below this severity"})]})}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Categories"}),v.jsx("div",{className:"flex gap-6",children:[["incident","Incident"],["closure","Closure"],["special_event","Special Event"]].map(([te,et])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_categories.includes(te),onChange:be=>{const dt=z.enabled_categories;$({...z,enabled_categories:be.target.checked?[...dt,te]:dt.filter(or=>or!==te)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:et})]},te))})]}),v.jsxs("div",{className:"mt-4",children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),v.jsx("div",{className:"grid grid-cols-2 gap-2",children:[["accident","Crash"],["road_closed","Road Closed"],["lane_closed","Lane Closure"],["vehicle_on_fire","Vehicle Fire"],["flooding","Flooding"],["debris","Debris"],["road_works","Road Works"],["disabled_vehicle","Disabled Vehicle"]].map(([te,et])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:z.enabled_sub_types.includes(te),onChange:be=>{const dt=z.enabled_sub_types;$({...z,enabled_sub_types:be.target.checked?[...dt,te]:dt.filter(or=>or!==te)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:et})]},te))})]})]})]});case"wzdx":return v.jsxs(v.Fragment,{children:[((er=e.wzdx)==null?void 0:er.feed_source)!=="central"&&v.jsxs(v.Fragment,{children:[v.jsx(pt,{label:"Base URL",value:((wn=e.wzdx)==null?void 0:wn.base_url)??"",onChange:te=>Ve({wzdx:{...e.wzdx,base_url:te}}),placeholder:"https://511.yourstate.gov/api/v2"}),v.jsx(pt,{label:"API Key",value:((mi=e.wzdx)==null?void 0:mi.api_key)??"",onChange:te=>Ve({wzdx:{...e.wzdx,api_key:te}}),type:"password",helper:"Leave empty if not required"}),v.jsx(Ge,{label:"Tick Seconds",value:((Ji=e.wzdx)==null?void 0:Ji.tick_seconds)??300,onChange:te=>Ve({wzdx:{...e.wzdx,tick_seconds:te}}),min:60}),v.jsx(zo,{label:"Endpoints",value:((Vl=e.wzdx)==null?void 0:Vl.endpoints)??["/get/event"],onChange:te=>Ve({wzdx:{...e.wzdx,endpoints:te}}),helper:"e.g., /get/event"}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((te,et)=>{var be,dt;return v.jsx(Ge,{label:te,value:((dt=(be=e.wzdx)==null?void 0:be.bbox)==null?void 0:dt[et])??0,onChange:or=>{var ws;const Ca=[...((ws=e.wzdx)==null?void 0:ws.bbox)||[0,0,0,0]];Ca[et]=or,Ve({wzdx:{...e.wzdx,bbox:Ca}})},step:.01},te)})}),v.jsx("div",{className:"text-xs text-[#666]",children:"Bounding box [W,S,E,N] geographic filter"})]}),v.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),v.jsxs("label",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast work zone events"}),v.jsx("input",{type:"checkbox",checked:X.broadcast,onChange:te=>re({...X,broadcast:te.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),X.broadcast?v.jsxs("div",{className:"space-y-3 mt-3",children:[v.jsxs("div",{children:[v.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Min Severity"}),v.jsxs("select",{value:X.min_severity,onChange:te=>re({...X,min_severity:te.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[v.jsx("option",{value:"None",children:"None (all)"}),v.jsx("option",{value:"Minor",children:"Minor+"}),v.jsx("option",{value:"Major",children:"Major only"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),v.jsx("div",{className:"flex gap-6",children:[["road_works","Road Works"],["lane_closed","Lane Closure"],["road_closed","Road Closed"]].map(([te,et])=>v.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[v.jsx("input",{type:"checkbox",checked:X.sub_types.includes(te),onChange:be=>{const dt=X.sub_types;re({...X,sub_types:be.target.checked?[...dt,te]:dt.filter(or=>or!==te)})},className:"w-4 h-4 accent-[#f59e0b]"}),v.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:et})]},te))})]})]}):v.jsxs("p",{className:"text-xs text-[#666] mt-2",children:["Work zone events stored for LLM context only ","—"," no mesh broadcasts."]})]})]});case"firms":return v.jsxs(v.Fragment,{children:[v.jsx(pt,{label:"MAP Key",value:e.firms.map_key,onChange:te=>Ve({firms:{...e.firms,map_key:te}}),type:"password",helper:"firms.modaps.eosdis.nasa.gov/api/area/",infoLink:"https://firms.modaps.eosdis.nasa.gov/api/area/"}),v.jsx(Ge,{label:"Tick Seconds",value:e.firms.tick_seconds,onChange:te=>Ve({firms:{...e.firms,tick_seconds:te}}),min:300}),v.jsx(Fn,{label:"Satellite Source",value:e.firms.source,onChange:te=>Ve({firms:{...e.firms,source:te}}),options:[{value:"VIIRS_SNPP_NRT",label:"VIIRS SNPP (NRT)"},{value:"VIIRS_NOAA20_NRT",label:"VIIRS NOAA-20 (NRT)"},{value:"MODIS_NRT",label:"MODIS (NRT)"}]}),v.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[v.jsx(Ge,{label:"Day Range",value:e.firms.day_range,onChange:te=>Ve({firms:{...e.firms,day_range:te}}),min:1,max:10}),v.jsx(Fn,{label:"Min Confidence",value:e.firms.confidence_min,onChange:te=>Ve({firms:{...e.firms,confidence_min:te}}),options:[{value:"low",label:"Low"},{value:"nominal",label:"Nominal"},{value:"high",label:"High"}]}),v.jsx(Ge,{label:"Proximity (km)",value:e.firms.proximity_km,onChange:te=>Ve({firms:{...e.firms,proximity_km:te}}),step:.5})]}),v.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((te,et)=>{var be;return v.jsx(Ge,{label:te,value:((be=e.firms.bbox)==null?void 0:be[et])??0,onChange:dt=>{const or=[...e.firms.bbox||[0,0,0,0]];or[et]=dt,Ve({firms:{...e.firms,bbox:or}})},step:.01},te)})})]});case"satpass":{const te=Xe.enabled?Xe.dry_run?{label:"DRY RUN",color:"text-sky-400 bg-sky-400/10 border border-sky-400/30",desc:" — logging only, nothing transmits"}:{label:"⚠ LIVE",color:"text-amber-400 bg-amber-500/20 border-2 border-amber-500 font-bold animate-pulse",desc:" — transmitting to mesh"}:{label:"OFF",color:"text-[#777] bg-[#1a1a1a]",desc:""};return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:`px-4 py-2.5 text-sm rounded ${te.color}`,children:[v.jsx("span",{className:"font-semibold",children:te.label}),te.desc&&v.jsx("span",{className:"font-normal",children:te.desc})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Safety Controls"}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm text-[#e0e0e0]",children:"Dry run — log instead of transmit"}),v.jsx("p",{className:"text-xs text-[#666]",children:"When enabled, passes are logged but never broadcast to mesh"})]}),v.jsx("button",{onClick:()=>Zt({...Xe,dry_run:!Xe.dry_run}),className:`relative w-10 h-5 rounded-full transition-colors ${Xe.dry_run?"bg-sky-500":"bg-[#333]"}`,children:v.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${Xe.dry_run?"translate-x-5":""}`})})]}),v.jsx(Ge,{label:"Max broadcasts / hour",value:Xe.max_broadcasts_per_hour,onChange:et=>Zt({...Xe,max_broadcasts_per_hour:et}),min:1,max:60,helper:"Rate cap — broadcasts exceeding this limit are dropped"})]})]}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Pass Filters"}),v.jsx("div",{className:"grid grid-cols-2 gap-4",children:v.jsx(Ge,{label:"Min Elevation (deg)",value:Xe.min_elevation,onChange:et=>Zt({...Xe,min_elevation:et}),min:0,max:90,helper:"Minimum max elevation for a pass to be broadcast"})})]}),v.jsx(zo,{label:"Observer Locations",value:Xe.observers,onChange:et=>Zt({...Xe,observers:et}),helper:"Observer names to include (empty = all)"}),v.jsx(zo,{label:"NORAD IDs",value:Xe.norad_ids,onChange:et=>Zt({...Xe,norad_ids:et}),helper:"NORAD catalog IDs to broadcast (empty = broadcast nothing, opt-in only)"})]})}}},Cm=e,Tm=(ye,er)=>{const wn=e[ye]||{};Ve({[ye]:{...wn,...er}})};return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h1",{className:"text-xl font-semibold text-white",children:"Environment"}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(fr,{label:"Feeds Enabled",checked:e.enabled,onChange:ye=>Ve({enabled:ye})}),Jb&&v.jsxs(v.Fragment,{children:[v.jsxs("button",{onClick:wm,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[v.jsx(W1,{size:14})," Discard"]}),v.jsxs("button",{onClick:jd,disabled:c,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[v.jsx(rL,{size:14})," ",c?"Saving…":"Save"]})]})]})]}),f&&v.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:f}),g&&v.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:g}),y&&v.jsxs("div",{className:"flex items-center justify-between text-sm text-accent bg-accent/10 border border-accent/30 p-3",children:[v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx(qp,{size:14})," A restart is required for some changes to take effect."]}),v.jsx("button",{onClick:Qb,className:"px-3 py-1 bg-accent/20 hover:bg-amber-500/30",children:"Restart now"})]}),v.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:jT.map(({key:ye,label:er,icon:wn})=>v.jsxs("button",{onClick:()=>{w(ye);const mi=jT.find(Ji=>Ji.key===ye);T(mi.adapters[0]??null)},className:`flex items-center gap-2 px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${x===ye?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[v.jsx(wn,{size:15})," ",er]},ye))}),x==="central"&&e.central&&v.jsxs("div",{className:"border border-border p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Central Connection"}),v.jsx("p",{className:"text-xs text-[#666]",children:'NATS JetStream source for any adapter set to "central"'})]}),v.jsx(fr,{label:"",checked:!!e.central.enabled,onChange:ye=>Ve({central:{...e.central,enabled:ye}})})]}),v.jsxs("div",{className:e.central.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[v.jsx(pt,{label:"URL",value:e.central.url||"",onChange:ye=>Ve({central:{...e.central,url:ye}}),placeholder:"nats://central.echo6.mesh:4222"}),v.jsx(pt,{label:"Durable",value:e.central.durable||"",onChange:ye=>Ve({central:{...e.central,durable:ye}}),placeholder:"meshai-v04"}),v.jsx(pt,{label:"Region",value:e.central.region||"",onChange:ye=>Ve({central:{...e.central,region:ye}}),placeholder:"us.id",helper:"Central v0.9.20 region token (dotted, e.g. 'us.id'). Empty = bare wildcards (all-US firehose). Each adapter is either Central or native, never both — see Reference → OR-not-AND Architecture for why."})]})]}),x==="mesh"&&v.jsxs("div",{className:"border border-border p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Mesh Health"}),v.jsx("p",{className:"text-xs text-[#666]",children:"Node/infra telemetry — sourced from the mesh, not an environmental feed."})]}),v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),v.jsx(GZ,{value:"native",onChange:()=>{},disabled:!1,centralDisabled:!0})]})]}),v.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available — reserved for a future migration."})]}),Co.adapters.length>0&&Ir&&v.jsxs(v.Fragment,{children:[Co.adapters.length>1&&v.jsx("div",{className:"flex gap-1",children:Co.adapters.map(ye=>v.jsx("button",{onClick:()=>T(ye),className:`px-3 py-1.5 text-sm ${Ir===ye?"bg-bg-hover text-white":"text-[#777] hover:text-white"}`,children:Rs[ye].label},ye))}),v.jsx(PSe,{title:Rs[Ir].label,subtitle:Rs[Ir].subtitle,enabled:Ir==="satpass"?Xe.enabled:((Mm=Cm[Ir])==null?void 0:Mm.enabled)??!1,onEnabled:ye=>Ir==="satpass"?Zt({...Xe,enabled:ye}):Tm(Ir,{enabled:ye}),feedSource:((Am=Cm[Ir])==null?void 0:Am.feed_source)??"native",onFeedSource:ye=>Tm(Ir,{feed_source:ye}),hasCentral:Rs[Ir].hasCentral,nativeOnly:Rs[Ir].nativeOnly,hasKey:Rs[Ir].hasKey,health:ew(Ir),events:tw(Ir),children:Sm(Ir)})]})]})}const bB={infra_offline:h6,infra_recovery:Y1,battery_warning:Qw,battery_critical:Qw,battery_emergency:Qw,hf_blackout:Pf,uhf_ducting:Gi,weather_warning:uc,weather_watch:uc,new_router:Gi,packet_flood:oo,sustained_high_util:oo,region_blackout:os,default:Xp};function ESe(e){return bB[e]||bB.default}function HZ(e){switch(e==null?void 0:e.toLowerCase()){case"immediate":return{bg:"bg-red-500/10",border:"border-red-500",badge:"bg-red-500/20 text-red-400",iconColor:"text-red-500"};case"priority":return{bg:"bg-amber-500/10",border:"border-amber-500",badge:"bg-amber-500/20 text-amber-400",iconColor:"text-amber-500"};case"routine":default:return{bg:"bg-[#f59e0b]/10",border:"border-[#f59e0b]",badge:"bg-[#f59e0b]/20 text-[#f59e0b]",iconColor:"text-[#f59e0b]"}}}function RSe(e){const t=typeof e=="number"?new Date(e*1e3):new Date(e),n=new Date().getTime()-t.getTime(),i=Math.floor(n/1e3),a=Math.floor(i/60),o=Math.floor(a/60),s=Math.floor(o/24);return i<60?"Just now":a<60?`${a}m ago`:o<24?`${o}h ago`:`${s}d ago`}function jSe(e){return(typeof e=="number"?new Date(e*1e3):new Date(e)).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1})}function OSe(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`${Math.floor(e/86400)}d`}function zSe({alert:e,onAcknowledge:t}){var i;const r=HZ(e.severity),n=ESe(e.type);return v.jsx("div",{className:`p-4 ${r.bg} border-l-4 ${r.border}`,children:v.jsxs("div",{className:"flex items-start gap-3",children:[v.jsx(n,{size:20,className:r.iconColor}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${r.badge}`,children:(i=e.severity)==null?void 0:i.toUpperCase()}),v.jsx("span",{className:"text-xs text-slate-500",children:e.type})]}),v.jsx("div",{className:"text-sm text-slate-200",children:e.message}),v.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-slate-500",children:[v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(lc,{size:12}),e.timestamp?RSe(e.timestamp):"Just now"]}),e.scope_value&&v.jsxs("span",{children:[e.scope_type,": ",e.scope_value]})]})]}),v.jsx("button",{onClick:()=>t(e),className:"px-3 py-1 text-xs text-slate-400 hover:text-slate-200 border border-border rounded hover:bg-bg-hover transition-colors",children:"Acknowledge"})]})})}function BSe({history:e,typeFilter:t,severityFilter:r,onTypeFilterChange:n,onSeverityFilterChange:i,page:a,totalPages:o,onPageChange:s}){const l=["all","infra_offline","infra_recovery","battery_warning","battery_critical","hf_blackout","uhf_ducting","weather_warning","new_router","packet_flood"],u=["all","immediate","priority","routine"];return v.jsxs("div",{className:"bg-bg-card border border-border",children:[v.jsxs("div",{className:"p-4 border-b border-border flex items-center gap-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(eL,{size:14,className:"text-slate-400"}),v.jsx("span",{className:"text-sm text-slate-400",children:"Filter:"})]}),v.jsx("select",{value:t,onChange:c=>n(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-[#f59e0b]",children:l.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Types":c.replace(/_/g," ")},c))}),v.jsx("select",{value:r,onChange:c=>i(c.target.value),className:"bg-bg border border-border rounded px-3 py-1.5 text-sm text-slate-200 focus:outline-none focus:border-[#f59e0b]",children:u.map(c=>v.jsx("option",{value:c,children:c==="all"?"All Severities":c.charAt(0).toUpperCase()+c.slice(1)},c))})]}),v.jsx("div",{className:"overflow-x-auto",children:v.jsxs("table",{className:"w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"border-b border-border",children:[v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Time"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Type"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Severity"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Message"}),v.jsx("th",{className:"text-left text-xs font-medium text-slate-400 p-4",children:"Duration"})]})}),v.jsx("tbody",{children:e.length>0?e.map((c,h)=>{const f=HZ(c.severity);return v.jsxs("tr",{className:"border-b border-border hover:bg-bg-hover",children:[v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono whitespace-nowrap",children:jSe(c.timestamp)}),v.jsx("td",{className:"p-4 text-sm text-slate-300",children:c.type.replace(/_/g," ")}),v.jsx("td",{className:"p-4",children:v.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${f.badge}`,children:c.severity})}),v.jsx("td",{className:"p-4 text-sm text-slate-200 max-w-md truncate",children:c.message}),v.jsx("td",{className:"p-4 text-sm text-slate-400 font-mono",children:c.duration?OSe(c.duration):"-"})]},c.id||h)}):v.jsx("tr",{children:v.jsx("td",{colSpan:5,className:"p-8 text-center text-slate-500",children:"No alert history available"})})})]})}),o>1&&v.jsxs("div",{className:"p-4 border-t border-border flex items-center justify-between",children:[v.jsxs("span",{className:"text-sm text-slate-400",children:["Page ",a," of ",o]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:()=>s(a-1),disabled:a<=1,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(TK,{size:16})}),v.jsx("button",{onClick:()=>s(a+1),disabled:a>=o,className:"p-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed",children:v.jsx(Sl,{size:16})})]})]})]})}function FSe({subscription:e,nodes:t}){const r=o=>{const s=t.find(l=>l.node_id_hex===o||String(l.node_num)===o||l.short_name===o);return s?s.long_name&&s.long_name!==s.short_name?`${s.short_name} (${s.long_name})`:s.short_name:o},n=()=>{if(e.sub_type==="alerts")return"Real-time";const o=e.schedule_time||"0000",s=parseInt(o.slice(0,2)),l=o.slice(2),u=s>=12?"PM":"AM";let h=`${s%12||12}:${l} ${u}`;return e.sub_type==="weekly"&&e.schedule_day&&(h+=` ${e.schedule_day.charAt(0).toUpperCase()}${e.schedule_day.slice(1)}`),h},a=(()=>{switch(e.sub_type){case"alerts":return Xp;case"daily":return lc;case"weekly":return lc;default:return Xp}})();return v.jsx("div",{className:"p-4 bg-bg-hover border border-border",children:v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-10 h-10 bg-[#f59e0b]/10 flex items-center justify-center",children:v.jsx(a,{size:18,className:"text-[#f59e0b]"})}),v.jsxs("div",{className:"flex-1",children:[v.jsxs("div",{className:"text-sm text-slate-200 font-medium",children:[e.sub_type.charAt(0).toUpperCase()+e.sub_type.slice(1),e.scope_type!=="mesh"&&e.scope_value&&v.jsxs("span",{className:"text-slate-400 font-normal ml-2",children:["(",e.scope_type,": ",e.scope_value,")"]})]}),v.jsxs("div",{className:"text-xs text-slate-500 mt-0.5",children:[n()," • ",r(e.user_id)]})]}),v.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`})]})})}function VSe(){const[e,t]=G.useState([]),[r,n]=G.useState([]),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(null),[f,d]=G.useState("all"),[g,m]=G.useState("all"),[y,_]=G.useState(1),[x,w]=G.useState(1),S=20,[T,M]=G.useState(new Set),{lastAlert:A}=iL();G.useEffect(()=>{document.title="Alerts — MeshAI"},[]),G.useEffect(()=>{Promise.all([f6().catch(()=>[]),mE(S,0).catch(()=>({items:[],total:0})),HK().catch(()=>[]),fetch("/api/nodes").then(I=>I.json()).catch(()=>[])]).then(([I,D,O,j])=>{t(I),Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S))),a(O),s(j),u(!1)}).catch(I=>{h(I.message),u(!1)})},[]),G.useEffect(()=>{A&&t(I=>I.some(O=>O.type===A.type&&O.message===A.message)?I:[A,...I])},[A]),G.useEffect(()=>{const I=(y-1)*S;mE(S,I,f,g).then(D=>{Array.isArray(D)?(n(D),w(1)):(n(D.items||[]),w(Math.ceil((D.total||0)/S)))}).catch(()=>{})},[y,f,g]);const N=G.useCallback(I=>{const D=`${I.type}-${I.message}-${I.timestamp}`;M(O=>new Set([...O,D]))},[]),P=e.filter(I=>{const D=`${I.type}-${I.message}-${I.timestamp}`;return!T.has(D)});return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading alerts..."})}):c?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsxs("div",{className:"text-red-400",children:["Error: ",c]})}):v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"bg-bg-card border border-border p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(oo,{size:14}),"Active Alerts (",P.length,")"]}),P.length>0?v.jsx("div",{className:"space-y-3",children:P.map((I,D)=>v.jsx(zSe,{alert:I,onAcknowledge:N},`${I.type}-${I.timestamp}-${D}`))}):v.jsxs("div",{className:"flex items-center gap-2 text-slate-500 py-8",children:[v.jsx(Jk,{size:20,className:"text-green-500"}),v.jsx("span",{children:"No active alerts — all systems nominal"})]})]}),v.jsxs("div",{children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(lc,{size:14}),"Alert History"]}),v.jsx(BSe,{history:r,typeFilter:f,severityFilter:g,onTypeFilterChange:I=>{d(I),_(1)},onSeverityFilterChange:I=>{m(I),_(1)},page:y,totalPages:x,onPageChange:_})]}),v.jsxs("div",{className:"bg-bg-card border border-border p-6",children:[v.jsxs("h2",{className:"text-sm font-medium text-slate-400 mb-4 flex items-center gap-2",children:[v.jsx(zK,{size:14}),"Mesh Subscriptions (",i.length,")"]}),i.length>0?v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:i.map(I=>v.jsx(FSe,{subscription:I,nodes:o},I.id))}):v.jsxs("div",{className:"text-slate-500 py-4",children:[v.jsx("p",{children:"No active subscriptions."}),v.jsxs("p",{className:"text-xs mt-2",children:["Manage subscriptions via ",v.jsx("code",{className:"text-[#f59e0b]",children:"!subscribe"})," on mesh. Broadcasts arrive with one of three prefixes — ",v.jsx("strong",{children:"New:"})," (first sight), ",v.jsx("strong",{children:"Update:"})," (material change), or ",v.jsx("strong",{children:"Active:"})," (clock-driven reminder while the event is still live). See ",v.jsx("a",{href:"/reference#broadcast-types",className:"text-[#f59e0b] hover:underline",children:"Broadcast Types"})," and ",v.jsx("a",{href:"/reference#reminders",className:"text-[#f59e0b] hover:underline",children:"Reminder System"})," in Reference."]})]})]})]})}const C_=[{value:"routine",label:"Routine",description:"Informational, no time pressure (ducting, new node, weather advisory, battery declining)"},{value:"priority",label:"Priority",description:"Needs attention soon (severe weather, fire nearby, node offline, HF blackout)"},{value:"immediate",label:"Immediate",description:"Act now, drop everything (fire at infrastructure, extreme weather, region blackout)"}],wB=[{id:"mesh_health",name:"Mesh Health Monitoring",description:"Infrastructure problems - offline nodes, low battery, channel congestion",rule:{name:"Mesh Health Monitoring",enabled:!0,trigger_type:"condition",categories:["infra_offline","critical_node_down","infra_recovery","battery_warning","battery_critical","battery_emergency","high_utilization","packet_flood","mesh_score_low"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"weather_fire",name:"Weather & Fire Alerts",description:"Environmental threats - severe weather, nearby wildfires, new ignitions, flooding",rule:{name:"Weather & Fire Alerts",enabled:!0,trigger_type:"condition",categories:["weather_warning","fire_proximity","new_ignition","stream_flood_warning"],min_severity:"priority",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:15,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"rf_conditions",name:"RF Conditions",description:"Propagation changes - solar events, HF blackouts, tropospheric ducting",rule:{name:"RF Conditions",enabled:!0,trigger_type:"condition",categories:["hf_blackout","tropospheric_ducting","geomagnetic_storm"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:60,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"road_traffic",name:"Road & Traffic",description:"Road closures and severe congestion",rule:{name:"Road & Traffic",enabled:!0,trigger_type:"condition",categories:["road_closure","traffic_congestion"],min_severity:"routine",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:30,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"everything_critical",name:"Everything Critical",description:"All emergency-level events regardless of type",rule:{name:"Everything Critical",enabled:!0,trigger_type:"condition",categories:[],min_severity:"immediate",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:5,schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"",custom_message:"",node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}},{id:"morning_briefing",name:"Morning Briefing",description:"Daily health and conditions summary at 7am",rule:{name:"Morning Briefing",enabled:!0,trigger_type:"schedule",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"",schedule_days:[],message_type:"mesh_health_summary",custom_message:"",delivery_type:"mesh_broadcast",broadcast_channel:0,cooldown_minutes:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{}}}];function z0(e){if(!e)return"Never";const r=Date.now()/1e3-e;return r<60?"Just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:r<604800?`${Math.floor(r/86400)}d ago`:new Date(e*1e3).toLocaleDateString()}function Ri({info:e}){const[t,r]=G.useState(!1);return v.jsxs("div",{className:"relative inline-block",children:[v.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),r(!t)},className:"ml-1.5 w-4 h-4 rounded-full bg-slate-700 hover:bg-slate-600 text-slate-400 hover:text-slate-200 inline-flex items-center justify-center text-xs transition-colors",title:"More info",children:"?"}),t&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),v.jsx("div",{className:"absolute left-0 top-6 z-50 w-72 p-3 bg-[#1a2332] border border-[#2a3a4a] shadow-xl text-xs text-slate-300 leading-relaxed",children:e})]})]})}function Hs({label:e,value:t,onChange:r,type:n="text",placeholder:i="",helper:a="",info:o=""}){const[s,l]=G.useState(!1),u=n==="password";return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&v.jsx(Ri,{info:o})]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:u&&!s?"password":"text",value:t,onChange:c=>r(c.target.value),placeholder:i,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"}),u&&v.jsx("button",{type:"button",onClick:()=>l(!s),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-500 hover:text-slate-300",children:s?v.jsx(i6,{size:16}):v.jsx(Qk,{size:16})})]}),a&&v.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function Fg({label:e,value:t,onChange:r,min:n,max:i,step:a=1,helper:o="",info:s=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&v.jsx(Ri,{info:s})]}),v.jsx("input",{type:"number",value:t,onChange:l=>r(Number(l.target.value)),min:n,max:i,step:a,className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent"}),o&&v.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function w1({label:e,checked:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"flex items-center justify-between py-2",children:[v.jsxs("div",{children:[v.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,i&&v.jsx(Ri,{info:i})]}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]}),v.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:v.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Lp({label:e,value:t,onChange:r,helper:n="",info:i=""}){return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&v.jsx(Ri,{info:i})]}),v.jsx("input",{type:"time",value:t,onChange:a=>r(a.target.value),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent"}),n&&v.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function T_({label:e,value:t,onChange:r,placeholder:n="Add item...",helper:i="",info:a=""}){const[o,s]=G.useState(""),l=()=>{o.trim()&&!t.includes(o.trim())&&(r([...t,o.trim()]),s(""))},u=c=>{r(t.filter((h,f)=>f!==c))};return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&v.jsx(Ri,{info:a})]}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{type:"text",value:o,onChange:c=>s(c.target.value),onKeyDown:c=>c.key==="Enter"&&(c.preventDefault(),l()),className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent",placeholder:n}),v.jsx("button",{type:"button",onClick:l,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm text-white transition-colors",children:v.jsx(od,{size:16})})]}),t.length>0&&v.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.map((c,h)=>v.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-[#1e2a3a] rounded text-sm text-slate-300",children:[c,v.jsx("button",{type:"button",onClick:()=>u(h),className:"text-slate-500 hover:text-red-400",children:v.jsx(ya,{size:14})})]},h))}),i&&v.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function UZ({value:e,onChange:t}){const[r,n]=G.useState(!1),i=C_.find(a=>a.value===e)||C_[0];return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Severity Threshold",v.jsx(Ri,{info:"Only alerts at or above this severity trigger this rule. ROUTINE = informational, PRIORITY = needs attention, IMMEDIATE = act now."})]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{type:"button",onClick:()=>n(!r),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-left flex items-center justify-between hover:border-accent transition-colors",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-slate-200",children:i.label}),v.jsxs("span",{className:"text-slate-500 ml-2",children:["- ",i.description]})]}),v.jsx(jl,{size:16,className:`text-slate-500 transition-transform ${r?"rotate-180":""}`})]}),r&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>n(!1)}),v.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-[#0a0e17] border border-[#1e2a3a] shadow-xl overflow-hidden",children:C_.map(a=>v.jsxs("button",{type:"button",onClick:()=>{t(a.value),n(!1)},className:`w-full px-3 py-2.5 text-left text-sm hover:bg-[#1e2a3a] transition-colors ${e===a.value?"bg-accent/10":""}`,children:[v.jsx("div",{className:"font-medium text-slate-200",children:a.label}),v.jsx("div",{className:"text-xs text-slate-500",children:a.description})]},a.value))})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:'Lower = more notifications. "Warning" recommended for most rules.'})]})}function B0({rule:e}){const[t,r]=G.useState(!1),[n,i]=G.useState(null),a=async()=>{r(!0),i(null);try{let s={type:e.delivery_type};e.delivery_type==="mesh_broadcast"?s.channel_index=e.broadcast_channel:e.delivery_type==="mesh_dm"?s.node_ids=e.node_ids:e.delivery_type==="email"?s={type:"email",smtp_host:e.smtp_host,smtp_port:e.smtp_port,smtp_user:e.smtp_user,smtp_password:e.smtp_password,smtp_tls:e.smtp_tls,from_address:e.from_address,recipients:e.recipients}:e.delivery_type==="webhook"&&(s={type:"webhook",url:e.webhook_url,headers:e.webhook_headers});const u=await(await fetch("/api/notifications/channels/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();i(u)}catch(s){i({success:!1,message:"Test failed",error:s instanceof Error?s.message:"Unknown error",details:{}})}finally{r(!1)}};if(!e.delivery_type)return null;const o={mesh_broadcast:v.jsx(Gi,{size:14}),mesh_dm:v.jsx(tL,{size:14}),email:v.jsx(DK,{size:14}),webhook:v.jsx(NK,{size:14})}[e.delivery_type]||v.jsx(Y1,{size:14});return v.jsxs("div",{className:"space-y-2",children:[v.jsx("button",{type:"button",onClick:a,disabled:t,className:"flex items-center gap-2 px-3 py-1.5 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",children:t?v.jsxs(v.Fragment,{children:[v.jsx(qp,{size:14,className:"animate-spin"}),"Testing..."]}):v.jsxs(v.Fragment,{children:[o,"Test Channel"]})}),n&&v.jsx("div",{className:`p-2 rounded text-xs ${n.success?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[n.success?v.jsx(ao,{size:14,className:"mt-0.5 flex-shrink-0"}):v.jsx(ya,{size:14,className:"mt-0.5 flex-shrink-0"}),v.jsxs("div",{children:[v.jsx("div",{className:"font-medium",children:n.message}),n.error&&v.jsx("div",{className:"mt-1 text-red-300",children:n.error})]})]})})]})}function GSe({rule:e,ruleIndex:t,categories:r,regions:n,onChange:i,onDelete:a,onDuplicate:o,onTest:s}){var O,j,B,U,H;const[l,u]=G.useState(!e.name),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null);G.useEffect(()=>{var V;e.name&&t>=0&&(fetch(`/api/notifications/rules/${t}/stats`).then(z=>z.json()).then(z=>d(z)).catch(()=>{}),(V=e.categories)!=null&&V.length&&fetch("/api/notifications/rules/sources",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categories:e.categories})}).then(z=>z.json()).then(z=>m(z)).catch(()=>{}))},[e.name,t,e.categories]);const y=[{value:"",label:"(None)",description:"Rule matches but does not deliver"},{value:"mesh_broadcast",label:"Mesh Broadcast",description:"Send to a mesh radio channel"},{value:"mesh_dm",label:"Mesh DM",description:"Direct message to specific nodes"},{value:"email",label:"Email",description:"Send via SMTP"},{value:"webhook",label:"Webhook",description:"POST to any URL"}],_=[{value:"daily",label:"Daily"},{value:"twice_daily",label:"Twice Daily"},{value:"weekly",label:"Weekly"}],x=[{value:"mesh_health_summary",label:"Mesh Health Summary",description:"Current health score, pillar breakdown, problem nodes"},{value:"rf_propagation_report",label:"RF Propagation Report",description:"Solar indices, Kp, ducting conditions"},{value:"alerts_digest",label:"Active Alerts Digest",description:"Summary of all active environmental alerts"},{value:"environmental_conditions",label:"Environmental Conditions",description:"Full conditions: weather, fire, streams, roads"},{value:"custom",label:"Custom Message",description:"Write your own with template tokens"}],w=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],S=V=>{const z=e.categories||[];z.includes(V)?i({...e,categories:z.filter($=>$!==V)}):i({...e,categories:[...z,V]})},T=(V,z)=>{const $=e.categories||[];if(z==="add"){const W=Array.from(new Set([...$,...V]));i({...e,categories:W})}else{const W=new Set(V);i({...e,categories:$.filter(Z=>!W.has(Z))})}},M=V=>{const z=e.region_scope||[];z.includes(V)?i({...e,region_scope:z.filter($=>$!==V)}):i({...e,region_scope:[...z,V]})},A=V=>{const z=e.schedule_days||[];z.includes(V)?i({...e,schedule_days:z.filter($=>$!==V)}):i({...e,schedule_days:[...z,V]})},N=async()=>{h(!0),await s(),h(!1)},P=()=>{if(e.trigger_type==="schedule")return"[Scheduled report preview would appear here]";const V=e.categories||[];if(V.length===0&&r.length>0)return r[0].example_message||"Alert notification";const z=r.find($=>V.includes($.id));return(z==null?void 0:z.example_message)||"Alert notification"},I=()=>{var z,$,W,Z,X,re,J,oe;const V=[];if(e.trigger_type==="schedule"){const le=((z=_.find(we=>we.value===e.schedule_frequency))==null?void 0:z.label)||e.schedule_frequency,De=(($=x.find(we=>we.value===e.message_type))==null?void 0:$.label)||e.message_type;V.push(`${le} at ${e.schedule_time||"??:??"}`),V.push(De)}else{const le=((W=e.categories)==null?void 0:W.length)||0,De=le===0?"All":r.filter(ve=>{var Ne;return(Ne=e.categories)==null?void 0:Ne.includes(ve.id)}).map(ve=>ve.name).slice(0,2).join(", ")+(le>2?` +${le-2}`:""),we=((Z=C_.find(ve=>ve.value===e.min_severity))==null?void 0:Z.label)||e.min_severity;V.push(`${De} at ${we}+`)}if(!e.delivery_type)V.push("No delivery");else{const le=((X=y.find(we=>we.value===e.delivery_type))==null?void 0:X.label)||e.delivery_type;let De="";if(e.delivery_type==="mesh_broadcast")De=`Ch ${e.broadcast_channel}`;else if(e.delivery_type==="mesh_dm")De=`${((re=e.node_ids)==null?void 0:re.length)||0} nodes`;else if(e.delivery_type==="email")De=(J=e.recipients)!=null&&J.length?e.recipients[0]+(e.recipients.length>1?` +${e.recipients.length-1}`:""):"no recipients";else if(e.delivery_type==="webhook")try{De=new URL(e.webhook_url).hostname}catch{De=((oe=e.webhook_url)==null?void 0:oe.slice(0,20))||"no URL"}V.push(`${le}${De?` (${De})`:""}`)}return V.join(" -> ")},D=()=>{var z;if(!g||!((z=e.categories)!=null&&z.length))return null;const V=new Map;for(const[,$]of Object.entries(g)){const W=V.get($.source);W?(W.events+=$.active_events,W.enabled=W.enabled&&$.enabled):V.set($.source,{enabled:$.enabled,events:$.active_events})}return Array.from(V.entries()).map(([$,{enabled:W,events:Z}])=>v.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs ${W?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,title:W?`${Z} active`:"Not enabled",children:[W?v.jsx(Y1,{size:10}):v.jsx(h6,{size:10}),$.toUpperCase(),W&&Z>0&&` (${Z})`]},$))};return v.jsxs("div",{className:`border overflow-hidden ${e.enabled?"border-[#1e2a3a]":"border-slate-700 opacity-60"}`,children:[v.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>u(!l),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[l?v.jsx(jl,{size:16,className:"text-slate-500 flex-shrink-0"}):v.jsx(Sl,{size:16,className:"text-slate-500 flex-shrink-0"}),v.jsx("button",{onClick:V=>{V.stopPropagation(),i({...e,enabled:!e.enabled})},className:`w-2 h-2 rounded-full flex-shrink-0 ${e.enabled?"bg-green-500":"bg-slate-500"}`,title:e.enabled?"Enabled":"Disabled"}),e.trigger_type==="schedule"?v.jsx(lc,{size:14,className:"text-[#f59e0b] flex-shrink-0"}):v.jsx(Pf,{size:14,className:"text-yellow-400 flex-shrink-0"}),v.jsx("span",{className:"font-medium text-slate-200 truncate",title:e.name||void 0,children:e.name||"New Rule"}),!l&&v.jsx("span",{className:`text-xs truncate hidden sm:block ${e.delivery_type?"text-slate-500":"text-amber-400"}`,children:I()})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[!l&&(()=>{const V="hidden sm:inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs mr-2";if(!e.enabled)return v.jsx("span",{className:`${V} bg-slate-800 text-slate-500`,children:"Disabled"});if(!f)return null;const z=f.fire_count||0,$=f.last_fired,W=Date.now()/1e3-7*86400;return z>0&&$&&$>=W?v.jsx("span",{className:`${V} bg-green-500/10 text-green-400`,title:`Last fired ${z0($)}`,children:"Active"}):z>0&&$?v.jsx("span",{className:`${V} bg-yellow-500/10 text-yellow-400`,title:`Last fired ${z0($)}`,children:"Idle (no recent activity)"}):v.jsx("span",{className:`${V} bg-slate-800 text-slate-400`,children:"No activity yet"})})(),!l&&v.jsx("div",{className:"hidden md:flex items-center gap-1 mr-2",children:D()}),v.jsx("button",{onClick:V=>{V.stopPropagation(),N()},disabled:c||!e.name,className:"p-1.5 text-[#f59e0b] hover:text-[#d97706] hover:bg-[#f59e0b]/10 rounded disabled:opacity-50",title:"Test rule",children:v.jsx(j2,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),o()},className:"p-1.5 text-slate-400 hover:text-slate-200 hover:bg-slate-500/10 rounded",title:"Duplicate",children:v.jsx(LK,{size:14})}),v.jsx("button",{onClick:V=>{V.stopPropagation(),a()},className:"p-1.5 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",title:"Delete",children:v.jsx(Yg,{size:14})})]})]}),!l&&e.name&&v.jsxs("div",{className:"px-3 pb-2 pt-0 bg-[#0a0e17] flex items-center gap-2 flex-wrap text-xs",children:[!e.delivery_type&&v.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 bg-amber-500/10 text-amber-400 rounded",children:[v.jsx(os,{size:10}),"No delivery method"]}),(f==null?void 0:f.fire_count)!==void 0&&f.fire_count>0&&v.jsxs("span",{className:"text-slate-500",children:["Fired ",f.fire_count,"x"]})]}),l&&v.jsxs("div",{className:"p-4 space-y-6 border-t border-[#1e2a3a]",children:[v.jsx(Hs,{label:"Rule Name",value:e.name,onChange:V=>i({...e,name:V}),placeholder:"e.g., Emergency Broadcast, Daily Health Report",helper:"A descriptive name for this rule"}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Trigger Type"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"condition"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 border transition-colors ${e.trigger_type!=="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(Pf,{size:16}),v.jsx("span",{children:"Condition"})]}),v.jsxs("button",{type:"button",onClick:()=>i({...e,trigger_type:"schedule"}),className:`flex-1 flex items-center justify-center gap-2 px-4 py-3 border transition-colors ${e.trigger_type==="schedule"?"bg-accent/10 border-accent text-accent":"bg-[#0a0e17] border-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:[v.jsx(lc,{size:16}),v.jsx("span",{children:"Schedule"})]})]}),v.jsx("p",{className:"text-xs text-slate-600",children:e.trigger_type==="schedule"?"Send reports on a schedule (daily briefings, weekly digests)":"React to alert conditions (fires, outages, weather warnings)"})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(oo,{size:14}),"WHEN (Condition)"]}),v.jsx(UZ,{value:e.min_severity,onChange:V=>i({...e,min_severity:V})}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Categories",v.jsx(Ri,{info:"Select which types of alerts trigger this rule. Leave all unchecked to match ALL categories. Categories are grouped by family — use the 'All' / 'Clear' buttons in each header to bulk-toggle."})]}),v.jsx("div",{className:"text-xs text-slate-500 mb-2",children:(((O=e.categories)==null?void 0:O.length)||0)===0?"All categories (none selected)":`${(j=e.categories)==null?void 0:j.length} selected`}),v.jsx(HSe,{categories:r,selected:e.categories||[],onToggle:S,onSelectMany:T})]}),g&&Object.keys(g).length>0&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Data Sources"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:D()})]})]}),e.trigger_type==="schedule"&&v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(CK,{size:14}),"WHEN (Schedule)"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Frequency"}),v.jsx("select",{value:e.schedule_frequency||"daily",onChange:V=>i({...e,schedule_frequency:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:_.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Lp,{label:"Time",value:e.schedule_time||"07:00",onChange:V=>i({...e,schedule_time:V})}),e.schedule_frequency==="twice_daily"&&v.jsx(Lp,{label:"Second Time",value:e.schedule_time_2||"19:00",onChange:V=>i({...e,schedule_time_2:V})})]}),e.schedule_frequency==="weekly"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Days"}),v.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(V=>{var z;return v.jsx("button",{type:"button",onClick:()=>A(V),className:`px-3 py-1.5 rounded text-sm capitalize transition-colors ${(z=e.schedule_days)!=null&&z.includes(V)?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:V.slice(0,3)},V)})})]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Report Type"}),v.jsx("select",{value:e.message_type||"mesh_health_summary",onChange:V=>i({...e,message_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:x.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(B=x.find(V=>V.value===e.message_type))==null?void 0:B.description})]}),e.message_type==="custom"&&v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Custom Message",v.jsx(Ri,{info:"Available tokens: {MESH_SCORE}, {NODE_COUNT}, {NODES_ONLINE}, {ACTIVE_ALERTS}, {KP}, {SFI}, {DATE}, {TIME}"})]}),v.jsx("textarea",{value:e.custom_message||"",onChange:V=>i({...e,custom_message:V.target.value}),rows:4,placeholder:"Good morning! Mesh health: {MESH_SCORE}/100 with {NODE_COUNT} nodes online.",className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent placeholder-slate-600"})]})]}),v.jsxs("div",{className:"space-y-2 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(ad,{size:14}),"REGIONS",v.jsx(Ri,{info:"Limit this rule to alerts from specific regions. Empty selection = all regions (backward compatible). Region names come from /api/regions."})]}),v.jsx("div",{className:"text-xs text-slate-500",children:(((U=e.region_scope)==null?void 0:U.length)||0)===0?"All regions (none selected)":`${e.region_scope.length} of ${n.length} selected`}),n.length===0?v.jsx("div",{className:"text-xs text-slate-600 italic",children:"No regions configured."}):v.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(V=>{const z=(e.region_scope||[]).includes(V.name);return v.jsx("button",{type:"button",onClick:()=>M(V.name),className:`px-3 py-1.5 rounded text-sm transition-colors ${z?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,title:V.local_name||V.name,children:V.local_name||V.name},V.name)})})]}),v.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[v.jsx(j2,{size:14}),"SEND VIA"]}),v.jsxs("div",{className:"space-y-1",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Delivery Method",v.jsx(Ri,{info:"Where this notification gets delivered. Select (None) to save the rule without delivery - it will match conditions but won't send until you configure a delivery method."})]}),v.jsx("select",{value:e.delivery_type||"",onChange:V=>i({...e,delivery_type:V.target.value}),className:"w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent",children:y.map(V=>v.jsx("option",{value:V.value,children:V.label},V.value))}),v.jsx("p",{className:"text-xs text-slate-600",children:(H=y.find(V=>V.value===(e.delivery_type||"")))==null?void 0:H.description})]}),!e.delivery_type&&v.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20",children:[v.jsx(os,{size:16,className:"text-amber-400 mt-0.5 flex-shrink-0"}),v.jsx("div",{className:"text-sm text-amber-300",children:"Rule will log matches but not deliver until a delivery method is configured."})]}),e.delivery_type==="mesh_broadcast"&&v.jsxs(v.Fragment,{children:[v.jsx(hP,{label:"Broadcast Channel",value:e.broadcast_channel??0,onChange:V=>i({...e,broadcast_channel:V}),helper:"Select the mesh radio channel",mode:"single"}),v.jsx(B0,{rule:e})]}),e.delivery_type==="mesh_dm"&&v.jsxs(v.Fragment,{children:[v.jsx(cP,{label:"Recipient Nodes",value:e.node_ids||[],onChange:V=>i({...e,node_ids:V}),helper:"Nodes that receive direct messages",valueType:"node_id_hex"}),v.jsx(B0,{rule:e})]}),e.delivery_type==="email"&&v.jsxs("div",{className:"space-y-4",children:[v.jsx(T_,{label:"Recipients",value:e.recipients||[],onChange:V=>i({...e,recipients:V}),placeholder:"email@example.com",helper:"Email addresses to receive alerts"}),v.jsxs("details",{className:"group",children:[v.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[v.jsx(Sl,{size:14,className:"group-open:rotate-90 transition-transform"}),"SMTP Configuration"]}),v.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Hs,{label:"SMTP Host",value:e.smtp_host||"",onChange:V=>i({...e,smtp_host:V}),placeholder:"smtp.gmail.com"}),v.jsx(Fg,{label:"SMTP Port",value:e.smtp_port??587,onChange:V=>i({...e,smtp_port:V}),min:1,max:65535})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Hs,{label:"Username",value:e.smtp_user||"",onChange:V=>i({...e,smtp_user:V})}),v.jsx(Hs,{label:"Password",value:e.smtp_password||"",onChange:V=>i({...e,smtp_password:V}),type:"password",info:"Gmail users: use an App Password from myaccount.google.com/apppasswords"})]}),v.jsx(w1,{label:"Use TLS",checked:e.smtp_tls??!0,onChange:V=>i({...e,smtp_tls:V})}),v.jsx(Hs,{label:"From Address",value:e.from_address||"",onChange:V=>i({...e,from_address:V}),placeholder:"alerts@yourdomain.com"})]})]}),v.jsx(B0,{rule:e})]}),e.delivery_type==="webhook"&&v.jsxs(v.Fragment,{children:[v.jsx(Hs,{label:"Webhook URL",value:e.webhook_url||"",onChange:V=>i({...e,webhook_url:V}),placeholder:"https://discord.com/api/webhooks/...",helper:"POST alert as JSON",info:"Works with Discord webhooks, ntfy.sh, Slack, Home Assistant, Pushover, or any HTTP POST endpoint."}),v.jsx(B0,{rule:e})]})]}),v.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[v.jsx(Fg,{label:"Cooldown (minutes)",value:e.cooldown_minutes??10,onChange:V=>i({...e,cooldown_minutes:V}),min:0,helper:"Min time between repeat sends",info:"Prevents alert spam. Same condition won't re-trigger this rule within this window."})," "]}),f&&v.jsxs("div",{className:"flex items-center gap-4 text-xs text-slate-500",children:[v.jsxs("span",{children:["Last fired: ",z0(f.last_fired)]}),v.jsxs("span",{children:["Last tested: ",z0(f.last_test)]}),v.jsxs("span",{children:["Total fires: ",f.fire_count]})]}),e.trigger_type!=="schedule"&&v.jsxs("div",{className:"space-y-2",children:[v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Example Message"}),v.jsx("div",{className:"p-3 bg-[#1e2a3a]/50 border border-[#1e2a3a]",children:v.jsx("p",{className:"text-sm text-slate-300 font-mono",children:P()})}),v.jsx("p",{className:"text-xs text-slate-600",children:"This is an example of what this rule would send."})]})]})]})}const M_=[{key:"mesh_health",label:"Mesh Health",Icon:id},{key:"weather",label:"Weather",Icon:uc},{key:"fire",label:"Fire",Icon:G1},{key:"rf_propagation",label:"RF Propagation",Icon:Gi},{key:"roads",label:"Roads",Icon:F1},{key:"avalanche",label:"Avalanche",Icon:OK},{key:"satpass",label:"Satellite Passes",Icon:Z1},{key:"seismic",label:"Seismic",Icon:U1},{key:"tracking",label:"Tracking",Icon:ad}];function HSe({categories:e,selected:t,onToggle:r,onSelectMany:n}){const i=new Set(M_.map(f=>f.key)),a=new Map;M_.forEach(f=>a.set(f.key,[]));const o=[];for(const f of e){const d=f.toggle;d&&i.has(d)?a.get(d).push(f):o.push(f)}const s=new Set;for(const[f,d]of a)d.some(g=>t.includes(g.id))&&s.add(f);o.some(f=>t.includes(f.id))&&s.add("other");const[l,u]=G.useState(s),c=f=>{u(d=>{const g=new Set(d);return g.has(f)?g.delete(f):g.add(f),g})},h=(f,d,g,m)=>{if(!m.length)return null;const y=l.has(f),_=m.map(w=>w.id),x=_.filter(w=>t.includes(w)).length;return v.jsxs("div",{className:"border border-[#1e2a3a] rounded",children:[v.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-[#0d1420]",children:[v.jsxs("button",{type:"button",onClick:()=>c(f),className:"flex items-center gap-2 text-sm text-slate-200 flex-1 min-w-0",children:[y?v.jsx(jl,{size:14,className:"text-slate-500 flex-shrink-0"}):v.jsx(Sl,{size:14,className:"text-slate-500 flex-shrink-0"}),g&&v.jsx(g,{size:14,className:"text-slate-400 flex-shrink-0"}),v.jsxs("span",{className:"truncate",children:[d," (",m.length,")"]}),x>0&&v.jsxs("span",{className:"ml-1 text-xs text-accent",children:[x," selected"]})]}),v.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(_,"add")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-accent hover:bg-accent/10",title:"Select all in family",children:"All"}),v.jsx("button",{type:"button",onClick:w=>{w.stopPropagation(),n(_,"remove")},className:"text-xs px-2 py-0.5 rounded text-slate-400 hover:text-red-400 hover:bg-red-500/10",title:"Clear family",children:"Clear"})]})]}),y&&v.jsx("div",{className:"p-1 space-y-1",children:m.map(w=>v.jsxs("label",{onClick:()=>r(w.id),className:"flex items-start gap-2 p-2 rounded hover:bg-[#1e2a3a]/50 cursor-pointer",children:[v.jsx("div",{className:`w-4 h-4 mt-0.5 rounded border flex items-center justify-center flex-shrink-0 ${t.includes(w.id)?"bg-accent border-accent":"border-slate-600"}`,children:t.includes(w.id)&&v.jsx(ao,{size:12,className:"text-white"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-sm text-slate-200",children:w.name}),v.jsx("div",{className:"text-xs text-slate-500",children:w.description})]})]},w.id))})]},f)};return v.jsxs("div",{className:"max-h-96 overflow-y-auto border border-[#1e2a3a] p-2 space-y-2",children:[M_.map(f=>h(f.key,f.label,f.Icon,a.get(f.key)||[])),h("other","Other",null,o)]})}const SB=["digest","mesh_broadcast","mesh_dm","email","webhook"],USe=["routine","priority","immediate"];function WSe({toggles:e,onChange:t}){const[r,n]=G.useState(null),i=(a,o)=>t({...e,[a]:{...e[a]||{},name:a,...o}});return v.jsxs("div",{className:"space-y-3 mb-8",children:[v.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Master Toggles",v.jsx(Ri,{info:"Per-family notification policy: enable a family, set its severity threshold, choose which channels fire at each severity, and scope to regions (PagerDuty/Grafana-style)."})]}),v.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:M_.map(({key:a,label:o,Icon:s})=>{const l=e[a]||{},u=r===a,c=Object.values(l.severity_channels||{}).reduce((f,d)=>f+((d==null?void 0:d.length)||0),0),h=(l.regions||[]).length;return v.jsxs("div",{className:"border border-[#1e2a3a] p-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("button",{type:"button",onClick:()=>n(u?null:a),className:"flex items-center gap-2 text-sm text-slate-200",children:[v.jsx(s,{size:15})," ",o,u?v.jsx(jl,{size:14}):v.jsx(Sl,{size:14})]}),v.jsx(w1,{label:"",checked:!!l.enabled,onChange:f=>i(a,{enabled:f})})]}),!u&&v.jsx("div",{className:"text-xs text-slate-600 mt-1",children:l.enabled?`${h||"all"} region${h===1?"":"s"}, ${c} channel${c===1?"":"s"} at ${l.min_severity||"priority"}+`:"OFF"}),u&&v.jsxs("div",{className:`mt-3 space-y-3 ${l.enabled?"":"opacity-40 pointer-events-none select-none"}`,children:[v.jsx(UZ,{value:l.min_severity||"priority",onChange:f=>i(a,{min_severity:f})}),v.jsx("div",{className:"text-xs text-slate-500",children:"Severity → channels"}),v.jsxs("table",{className:"text-xs w-full",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{}),SB.map(f=>v.jsx("th",{className:"text-slate-500 font-normal px-1",children:f.replace("_"," ")},f))]})}),v.jsx("tbody",{children:USe.map(f=>v.jsxs("tr",{children:[v.jsx("td",{className:"text-slate-400 pr-2",children:f}),SB.map(d=>{var m;const g=(((m=l.severity_channels)==null?void 0:m[f])||[]).includes(d);return v.jsx("td",{className:"text-center",children:v.jsx("input",{type:"checkbox",checked:g,onChange:y=>{const _={...l.severity_channels||{}},x=new Set(_[f]||[]);y.target.checked?x.add(d):x.delete(d),_[f]=Array.from(x),i(a,{severity_channels:_})}})},d)})]},f))})]}),v.jsx(T_,{label:"Regions (empty = all)",value:l.regions||[],onChange:f=>i(a,{regions:f}),placeholder:"Add region..."})," ",v.jsx("div",{className:"text-xs text-slate-500 pt-1",children:"Channel config"}),v.jsx(Fg,{label:"Broadcast channel",value:l.broadcast_channel??0,onChange:f=>i(a,{broadcast_channel:f})}),v.jsx(T_,{label:"DM node IDs",value:l.node_ids||[],onChange:f=>i(a,{node_ids:f}),placeholder:"!nodeid"}),v.jsx(T_,{label:"Email recipients",value:l.recipients||[],onChange:f=>i(a,{recipients:f}),placeholder:"ops@example.com"}),v.jsx(Hs,{label:"SMTP host",value:l.smtp_host||"",onChange:f=>i(a,{smtp_host:f}),placeholder:"smtp.example.com"}),v.jsx(Fg,{label:"SMTP port",value:l.smtp_port??587,onChange:f=>i(a,{smtp_port:f})}),v.jsx(Hs,{label:"Webhook URL",value:l.webhook_url||"",onChange:f=>i(a,{webhook_url:f}),placeholder:"https://..."})]})]},a)})})]})}function ZSe(){var z,$,W;const[e,t]=G.useState(null),[r,n]=G.useState(null),[i,a]=G.useState([]),[o,s]=G.useState([]),[l,u]=G.useState(!0),[c,h]=G.useState(!1),[f,d]=G.useState(null),[g,m]=G.useState(null),[y,_]=G.useState(null),[x,w]=G.useState({open:!1,ruleIndex:-1,loading:!1,action:""}),[S,T]=G.useState(!1),[M,A]=G.useState(!1),N=G.useCallback(async()=>{try{const[Z,X,re]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/categories"),fetch("/api/regions")]);if(!Z.ok)throw new Error("Failed to fetch notifications config");const J=await Z.json(),oe=await X.json(),le=re.ok?await re.json():[];t(J),n(JSON.parse(JSON.stringify(J))),a(oe),s(Array.isArray(le)?le:[]),A(!1),d(null)}catch(Z){d(Z instanceof Error?Z.message:"Unknown error")}finally{u(!1)}},[]);G.useEffect(()=>{document.title="Notifications - MeshAI",N()},[N]),G.useEffect(()=>{e&&r&&A(JSON.stringify(e)!==JSON.stringify(r))},[e,r]);const P=async()=>{if(e){h(!0),d(null),m(null);try{const Z=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),X=await Z.json();if(!Z.ok)throw new Error(X.detail||"Save failed");m("Notifications config saved successfully"),n(JSON.parse(JSON.stringify(e))),A(!1),setTimeout(()=>m(null),3e3)}catch(Z){d(Z instanceof Error?Z.message:"Save failed")}finally{h(!1)}}},I=()=>{r&&(t(JSON.parse(JSON.stringify(r))),A(!1))},D=()=>({name:"",enabled:!0,trigger_type:"condition",categories:[],min_severity:"routine",schedule_frequency:"daily",schedule_time:"07:00",schedule_time_2:"19:00",schedule_days:["monday"],message_type:"mesh_health_summary",custom_message:"",delivery_type:"",broadcast_channel:0,node_ids:[],smtp_host:"",smtp_port:587,smtp_user:"",smtp_password:"",smtp_tls:!0,from_address:"",recipients:[],webhook_url:"",webhook_headers:{},cooldown_minutes:10,region_scope:[]}),O=()=>{e&&t({...e,rules:[...e.rules||[],D()]})},j=Z=>{if(!e)return;const X=wB.find(re=>re.id===Z);X&&(t({...e,rules:[...e.rules||[],{...D(),...X.rule}]}),T(!1))},B=Z=>{if(!e)return;const X=e.rules[Z],re={...JSON.parse(JSON.stringify(X)),name:`${X.name} (copy)`},J=[...e.rules];J.splice(Z+1,0,re),t({...e,rules:J})},U=async Z=>{w({open:!0,ruleIndex:Z,loading:!0,action:""});try{const re=await(await fetch(`/api/notifications/rules/${Z}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"preview"})})).json();_(re),w(J=>({...J,loading:!1}))}catch{_({success:!1,message:"Failed to get preview"}),w(X=>({...X,loading:!1}))}},H=async Z=>{const X=x.ruleIndex;w(re=>({...re,loading:!0,action:Z}));try{const J=await(await fetch(`/api/notifications/rules/${X}/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:Z})})).json();_(J),w(oe=>({...oe,loading:!1}))}catch{_({success:!1,message:`Failed to ${Z}`}),w(re=>({...re,loading:!1}))}},V=()=>{w({open:!1,ruleIndex:-1,loading:!1,action:""}),_(null)};return l?v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-slate-400",children:"Loading notifications config..."})}):e?v.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[x.open&&v.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:v.jsxs("div",{className:"bg-[#1a2332] border border-[#2a3a4a] shadow-xl max-w-2xl w-full mx-4 max-h-[85vh] overflow-auto",children:[v.jsxs("div",{className:"p-4 border-b border-[#2a3a4a] flex items-center justify-between sticky top-0 bg-[#1a2332]",children:[v.jsx("h3",{className:"text-lg font-semibold",children:"Test Notification Rule"}),v.jsx("button",{onClick:V,className:"text-slate-500 hover:text-slate-300",children:v.jsx(ya,{size:20})})]}),v.jsx("div",{className:"p-4 space-y-4",children:x.loading?v.jsxs("div",{className:"flex items-center justify-center py-8",children:[v.jsx(qp,{size:20,className:"animate-spin text-slate-400 mr-2"}),v.jsx("div",{className:"text-slate-400",children:x.action?`${x.action.replace("_"," ").replace("send ","Sending ")}...`:"Loading current data..."})]}):y?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Current Data"}),y.live_data_summary&&y.live_data_summary.length>0?v.jsx("div",{className:"p-3 bg-slate-800/50 rounded space-y-1",children:y.live_data_summary.map((Z,X)=>v.jsx("div",{className:`text-sm font-mono ${Z.startsWith("[!]")?"text-amber-400":""}`,children:Z},X))}):v.jsx("div",{className:"p-3 bg-slate-800/50 rounded text-sm text-slate-500",children:"No live data available for this rule's categories"})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:"Rule Matching"}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[y.conditions_matched&&y.conditions_matched>0?v.jsxs("span",{className:"px-2 py-1 bg-green-500/20 text-green-400 rounded text-sm",children:[y.conditions_matched," condition",y.conditions_matched!==1?"s":""," match - this rule WOULD fire"]}):v.jsx("span",{className:"px-2 py-1 bg-slate-700 text-slate-400 rounded text-sm",children:"No conditions trigger this rule right now"}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("span",{className:"px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded text-sm",children:[y.conditions_below_threshold," below threshold"]})]}),y.conditions_below_threshold&&y.conditions_below_threshold>0&&v.jsxs("div",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-sm space-y-2",children:[v.jsx("div",{className:"text-yellow-300",children:y.below_threshold_summary}),y.below_threshold_events&&y.below_threshold_events.length>0&&v.jsx("div",{className:"space-y-1 text-yellow-200/80",children:y.below_threshold_events.slice(0,3).map((Z,X)=>v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"text-xs px-1.5 py-0.5 bg-yellow-500/20 rounded",children:Z.severity}),v.jsx("span",{children:Z.headline})]},X))}),y.suggestion&&v.jsxs("div",{className:"text-yellow-400 text-xs mt-2",children:["Tip: ",y.suggestion]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"text-sm font-medium text-slate-400 uppercase tracking-wide",children:y.is_example?"Example Messages":"Messages That Would Fire"}),(z=y.preview_messages)==null?void 0:z.map((Z,X)=>v.jsx("div",{className:"p-3 bg-slate-800 rounded text-sm font-mono break-words",children:Z},X))]}),y.delivered!==void 0&&y.delivery_result&&v.jsx("div",{className:`p-3 rounded text-sm ${y.delivered?"bg-green-500/10 border border-green-500/30 text-green-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:v.jsxs("div",{className:"flex items-start gap-2",children:[y.delivered?v.jsx(ao,{size:16,className:"mt-0.5"}):v.jsx(ya,{size:16,className:"mt-0.5"}),v.jsxs("div",{children:[v.jsx("div",{children:y.delivery_result}),y.delivery_error&&v.jsx("div",{className:"mt-1 text-red-300",children:y.delivery_error})]})]})}),y.message&&!y.preview_messages&&v.jsx("div",{className:`p-3 rounded text-sm ${y.success?"bg-green-500/10 text-green-400":"bg-red-500/10 text-red-400"}`,children:y.message})]}):null}),v.jsxs("div",{className:"p-4 border-t border-[#2a3a4a] flex justify-between sticky bottom-0 bg-[#1a2332]",children:[v.jsx("button",{onClick:V,className:"px-4 py-2 text-slate-400 hover:text-slate-200",children:"Close"}),y&&!y.delivered&&v.jsx("div",{className:"flex gap-2",children:y.delivery_method?v.jsxs(v.Fragment,{children:[y.live_data_summary&&y.live_data_summary.length>0&&v.jsx("button",{onClick:()=>H("send_status"),disabled:x.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send current conditions summary",children:"Send Current Conditions"}),v.jsx("button",{onClick:()=>H("send_test"),disabled:x.loading,className:"px-3 py-2 bg-slate-700 hover:bg-slate-600 rounded text-sm disabled:opacity-50",title:"Send example alert message",children:"Send Example Alert"}),y.can_send_live&&v.jsx("button",{onClick:()=>H("send_live"),disabled:x.loading,className:"px-3 py-2 bg-accent hover:bg-accent/80 rounded text-sm disabled:opacity-50",title:"Send actual live alert",children:"Send Live Alert"})]}):v.jsx("span",{className:"px-3 py-2 text-amber-400 text-sm",children:"Configure a delivery method to send test messages"})})]})]})}),v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{children:v.jsx("p",{className:"text-sm text-slate-500",children:"Alert delivery and scheduled reports. Rules define what triggers a notification and where it gets sent."})}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("button",{onClick:N,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:v.jsx(qp,{size:18})}),v.jsxs("button",{onClick:I,disabled:!M,className:"flex items-center gap-2 px-3 py-2 text-slate-400 hover:text-slate-200 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[v.jsx(W1,{size:16}),"Discard"]}),v.jsxs("button",{onClick:P,disabled:c||!M,className:"flex items-center gap-2 px-4 py-2 bg-accent hover:bg-accent/80 disabled:bg-slate-700 disabled:cursor-not-allowed rounded text-white transition-colors",children:[v.jsx(rL,{size:16}),c?"Saving...":"Save"]})]})]}),f&&v.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:f}),g&&v.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[v.jsx(ao,{size:14,className:"inline mr-2"}),g]}),v.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-6",children:[v.jsx(w1,{label:"Enable Notifications",checked:e.enabled,onChange:Z=>t({...e,enabled:Z}),helper:"Master switch for all notification delivery",info:"When disabled, no alerts or scheduled messages will be delivered. Alerts still get recorded to history."}),e.enabled&&v.jsxs(v.Fragment,{children:[" ",v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Cold-start grace"})}),v.jsx(Fg,{label:"Grace period (seconds)",value:e.cold_start_grace_seconds??60,onChange:Z=>t({...e,cold_start_grace_seconds:Z}),min:0,max:600,helper:"Suppress broadcasts for this many seconds after the first event arrives",info:"When meshai starts seeing events for the first time, suppress mesh broadcasts for this many seconds to absorb any JetStream backlog. Persistence rows still get written; only broadcasts are suppressed."})]}),v.jsxs("div",{className:"space-y-3 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[v.jsx("div",{className:"flex items-center gap-2",children:v.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Band Conditions (HF propagation)"})}),v.jsx(w1,{label:"Enable scheduled band-conditions broadcasts",checked:e.band_conditions_enabled??!0,onChange:Z=>t({...e,band_conditions_enabled:Z}),helper:"3x/day HF propagation summary (Day/Night ratings per band group). The daily fire digest (twice-daily LLM summary of active fires + the last 24h of growth/spotting) is configured separately under Adapter Config -> fires.digest_*. See Reference -> Fire Tracker (Fusion) and Reference -> Broadcast Types for the New/Update/Active prefix system.",info:"Source priority: (1) recent SWPC readings persisted locally; (2) HamQSL.com fallback; (3) silent skip if both fail. Persistence rows are written either way for an audit trail."}),(e.band_conditions_enabled??!0)&&v.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[v.jsx(Lp,{label:"Slot 1",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[0]||"06:00",onChange:Z=>{const X=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];X[0]=Z,t({...e,band_conditions_schedule:X})},helper:"Morning (default 06:00 MT)"}),v.jsx(Lp,{label:"Slot 2",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[1]||"14:00",onChange:Z=>{const X=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];X[1]=Z,t({...e,band_conditions_schedule:X})},helper:"Afternoon (default 14:00 MT)"}),v.jsx(Lp,{label:"Slot 3",value:(e.band_conditions_schedule??["06:00","14:00","22:00"])[2]||"22:00",onChange:Z=>{const X=[...e.band_conditions_schedule??["06:00","14:00","22:00"]];X[2]=Z,t({...e,band_conditions_schedule:X})},helper:"Night (default 22:00 MT)"})]}),v.jsx("p",{className:"text-xs text-slate-600",children:"All times are Mountain Time (America/Boise). DST handled automatically."})]}),e.toggles&&v.jsx(WSe,{toggles:e.toggles,onChange:Z=>t({...e,toggles:Z})}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Notification Rules",v.jsx(Ri,{info:"Each rule is self-contained: define what triggers it (condition or schedule), where to send it (mesh, email, webhook), and behavior settings."})]}),v.jsxs("span",{className:"text-xs text-slate-500",children:[(($=e.rules)==null?void 0:$.length)||0," rule",(((W=e.rules)==null?void 0:W.length)||0)!==1?"s":""]})]}),(e.rules||[]).map((Z,X)=>v.jsx(GSe,{rule:Z,ruleIndex:X,categories:i,regions:o,onChange:re=>{const J=[...e.rules||[]];J[X]=re,t({...e,rules:J})},onDelete:()=>{confirm(`Delete rule "${Z.name||"New Rule"}"?`)&&t({...e,rules:(e.rules||[]).filter((re,J)=>J!==X)})},onDuplicate:()=>B(X),onTest:()=>U(X)},X)),v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("button",{onClick:O,className:"flex-1 py-3 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center justify-center gap-2 transition-colors",children:[v.jsx(od,{size:16})," Add Rule"]}),v.jsxs("div",{className:"relative",children:[v.jsxs("button",{onClick:()=>T(!S),className:"py-3 px-4 border border-dashed border-[#1e2a3a] text-slate-500 hover:text-slate-300 hover:border-accent flex items-center gap-2 transition-colors",children:[v.jsx(a6,{size:16})," Add from Template"]}),S&&v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>T(!1)}),v.jsxs("div",{className:"absolute right-0 top-full mt-2 z-50 w-80 bg-[#1a2332] border border-[#2a3a4a] shadow-xl overflow-hidden",children:[v.jsx("div",{className:"p-2 border-b border-[#2a3a4a] text-xs text-slate-500 uppercase",children:"Rule Templates"}),wB.map(Z=>v.jsxs("button",{onClick:()=>j(Z.id),className:"w-full p-3 text-left hover:bg-[#2a3a4a] transition-colors",children:[v.jsx("div",{className:"font-medium text-slate-200",children:Z.name}),v.jsx("div",{className:"text-xs text-slate-500 mt-0.5",children:Z.description})]},Z.id))]})]})]})]})]})]})]})]}):v.jsx("div",{className:"flex items-center justify-center h-64",children:v.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})})}const CB=[{id:"stream-gauges",label:"Stream Gauges",icon:V1},{id:"wildfire",label:"Wildfire",icon:G1},{id:"firms",label:"Satellite Fire Detection (FIRMS)",icon:Z1},{id:"fire-tracker",label:"Fire Tracker (Fusion)",icon:IK},{id:"weather-alerts",label:"Weather Alerts",icon:AK},{id:"solar",label:"Solar & Geomagnetic",icon:u6},{id:"ducting",label:"Tropospheric Ducting",icon:Gi},{id:"avalanche",label:"Avalanche Danger",icon:U1},{id:"traffic",label:"Traffic Flow",icon:F1},{id:"roads-511",label:"Road Conditions (511)",icon:t6},{id:"mesh-health",label:"Mesh Health",icon:id},{id:"broadcast-types",label:"Broadcast Types",icon:j2},{id:"reminders",label:"Reminder System",icon:lc},{id:"notifications",label:"Notifications",icon:Xp},{id:"commands",label:"Commands",icon:c6},{id:"llm-dm",label:"LLM DM Queries",icon:tL},{id:"or-not-and",label:"OR-not-AND Architecture",icon:s6},{id:"adapter-config",label:"Adapter Config & CODE Rule",icon:nL},{id:"curation",label:"Curation: Gauges & Towns",icon:n6},{id:"schema",label:"Schema Migrations",icon:PK},{id:"api",label:"API Reference",icon:kK}];function tr({color:e}){const t={green:"bg-green-500",yellow:"bg-yellow-500",orange:"bg-orange-500",red:"bg-red-500",black:"bg-slate-800 border border-slate-600"};return v.jsx("span",{className:`inline-block w-3 h-3 rounded-full ${t[e]}`})}function Tt({headers:e,rows:t}){return v.jsx("div",{className:"overflow-x-auto my-4",children:v.jsxs("table",{className:"w-full text-sm",children:[v.jsx("thead",{children:v.jsx("tr",{className:"bg-[#1a2332] border-b border-[#2a3a4a]",children:e.map((r,n)=>v.jsx("th",{className:"px-4 py-2 text-left text-slate-400 font-medium",children:r},n))})}),v.jsx("tbody",{children:t.map((r,n)=>v.jsx("tr",{className:`border-b border-[#1e2a3a] ${n%2===0?"bg-[#0d1219]":"bg-[#0a0e17]"}`,children:r.map((i,a)=>v.jsx("td",{className:"px-4 py-2 text-slate-300",children:i},a))},n))})]})})}function zt({href:e,children:t}){return v.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:[t," ",v.jsx(Nf,{size:12})]})}function fe({children:e}){return v.jsx("h3",{className:"text-lg font-semibold text-slate-200 mt-6 mb-3",children:e})}function js({children:e}){return v.jsx("h4",{className:"text-base font-medium text-slate-300 mt-4 mb-2",children:e})}function se({children:e}){return v.jsx("code",{className:"font-mono text-accent bg-[#1a2332] px-1 rounded",children:e})}function gr({id:e,title:t,children:r}){return v.jsxs("section",{id:e,className:"mb-12 scroll-mt-6",children:[v.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-4 pb-2 border-b border-[#2a3a4a]",children:t}),v.jsx("div",{className:"text-slate-300 leading-relaxed space-y-4",children:r})]})}function $Se(){const e=nd(),[t,r]=G.useState(""),[n,i]=G.useState("stream-gauges"),a=G.useRef(null);G.useEffect(()=>{const l=e.hash.replace("#","");if(l&&CB.find(u=>u.id===l)){i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"})}},[e.hash]);const o=CB.filter(l=>l.label.toLowerCase().includes(t.toLowerCase())),s=l=>{i(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"",`#${l}`)};return v.jsxs("div",{className:"flex h-full -m-6",children:[v.jsxs("aside",{className:"w-64 flex-shrink-0 bg-bg-card border-r border-border overflow-y-auto",children:[v.jsx("div",{className:"p-4 border-b border-border",children:v.jsxs("div",{className:"relative",children:[v.jsx($1,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),v.jsx("input",{type:"text",value:t,onChange:l=>r(l.target.value),placeholder:"Search topics...",className:"w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"})]})}),v.jsx("nav",{className:"py-2",children:o.map(l=>{const u=l.icon,c=n===l.id;return v.jsxs("button",{onClick:()=>s(l.id),className:`w-full flex items-center gap-3 px-4 py-2.5 text-sm text-left transition-colors ${c?"text-accent bg-accent/10 border-l-2 border-accent":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover border-l-2 border-transparent"}`,children:[v.jsx(u,{size:16}),l.label]},l.id)})})]}),v.jsx("div",{ref:a,className:"flex-1 overflow-y-auto p-6",children:v.jsxs("div",{className:"max-w-4xl",children:[v.jsx("p",{className:"text-slate-400 mb-8",children:"Everything you need to understand and configure MeshAI's monitoring and alerting systems."}),v.jsxs(gr,{id:"stream-gauges",title:"Stream Gauges",children:[v.jsx(fe,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches river and stream levels at gauges you configure. Each gauge reports two things:"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Water Level (Gage Height)"}),` — how high the water is, measured in feet. Important: this is NOT the depth of the river. It's the height above a fixed measuring point that's different at every gauge. A reading of "10 feet" at one gauge means something completely different than "10 feet" at another. You can only compare readings from the SAME gauge over time.`]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Flow (Discharge)"}),` — how much water is moving past the gauge, in cubic feet per second (CFS). Think of it as the river's "throughput." For scale:`]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"A small creek: 50-200 CFS"}),v.jsx("li",{children:"A mid-size river: 1,000-5,000 CFS"}),v.jsx("li",{children:"A big river in spring runoff: 10,000+ CFS"})]}),v.jsx(fe,{children:"When Does It Flood?"}),v.jsxs("p",{children:["Flood levels are set by the ",v.jsx("strong",{children:"National Weather Service"}),', not USGS. NWS looks at each specific gauge location and decides "at what water level does the road flood? At what level do buildings get water?" Those levels are different everywhere.']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Action Stage"})," — water is rising, time to start paying attention. Usually still inside the riverbanks."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Minor Flood"})," — low-lying roads start getting water on them. NWS issues a Flood Advisory."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate Flood"})," — water in buildings near the river. Some people need to evacuate. NWS issues a Flood Warning."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Major Flood"})," — widespread flooding. Many people evacuating. Serious property damage."]}),v.jsx("p",{children:"MeshAI automatically looks up the flood levels for your gauge from NWS when you add a site. Some remote gauges don't have flood levels assigned — for those, you set them manually if you know what water levels cause problems in your area."}),v.jsx(fe,{children:"Low Water / Drought"}),v.jsx("p",{children:`There's no official "drought stage" for most gauges. If you need to monitor low water (irrigation, fish habitat), set a manual low-water threshold based on what you know about your local river.`}),v.jsx(fe,{children:"Setting It Up"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Find your gauge at ",v.jsx(zt,{href:"https://waterdata.usgs.gov/nwis",children:"waterdata.usgs.gov/nwis"})]}),v.jsxs("li",{children:["Copy the site number (like ",v.jsx(se,{children:"13090500"}),")"]}),v.jsx("li",{children:"Add it in Config → Environmental → USGS"}),v.jsx("li",{children:"MeshAI auto-fills the gauge name and flood levels from NWS"})]}),v.jsx("p",{children:"If NWS flood levels don't populate, your gauge may not have them. Set manual thresholds if you know your local conditions."}),v.jsx(fe,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(zt,{href:"https://waterdata.usgs.gov/nwis",children:"USGS Water Data"})," — find gauges near you"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://water.noaa.gov",children:"NWS Water Prediction Service"})," — flood forecasts and thresholds"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://www.usgs.gov/special-topics/water-science-school/science/how-streamflow-measured",children:"Understanding Streamflow"})," — USGS explainer"]})]})]}),v.jsxs(gr,{id:"wildfire",title:"Wildfire",children:[v.jsx(fe,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks active wildfire perimeters from the National Interagency Fire Center (NIFC). For each fire, you see the name, size, how much is contained, and how far it is from your mesh nodes."}),v.jsx(fe,{children:"Fire Size — How Big Is It?"}),v.jsx(Tt,{headers:["Size","What That Means"],rows:[["10 acres","Small fire. Usually handled quickly by initial crews."],["100 acres","Notable fire. Active firefighting effort."],["1,000 acres","Large fire. Major resources being deployed."],["10,000+ acres","Very large fire. Multiple teams, aircraft, heavy equipment."],["100,000+ acres","Mega-fire. These make the national news."]]}),v.jsx("p",{children:"For reference, 1,000 acres is about 1.5 square miles."}),v.jsx(fe,{children:"Containment — Is It Under Control?"}),v.jsx("p",{children:"Containment means the percentage of the fire's edge where firefighters have built a control line (a cleared strip to stop the fire from spreading further). It does NOT mean the fire is out inside that line."}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"0-30%"})," — Essentially uncontrolled. The fire goes where it wants."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"50%"})," — Good progress, but half the edge can still grow."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"80%+"})," — Well controlled. Major growth unlikely."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"100%"}),' — The edge is fully controlled. But the fire may STILL be actively burning inside. "100% contained" does NOT mean "out."']})]}),v.jsx(fe,{children:"How Far Away Should I Worry?"}),v.jsx(Tt,{headers:["Distance","What To Do"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"red"})," Under 5 km (3 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Immediate threat."})," This is evacuation-order range. Embers can fly this far in wind."]})],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"orange"})," 5-15 km (3-10 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Prepare."})," The fire could reach you in hours under bad conditions. Have a plan."]})],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"yellow"})," 15-30 km (10-20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Watch."})," Smoke is likely. Wind shifts could change things fast."]})],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"green"})," Over 30 km (20 miles)"]}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Awareness."})," Keep an eye on it, but no immediate threat."]})]]}),v.jsx("p",{children:"How fast can a fire travel? In grass with wind: up to 14 mph. In heavy timber: 1-6 mph. A fire 10 miles away could theoretically reach you in 1-2 hours under worst-case conditions, but typical spread is much slower."}),v.jsx(fe,{children:"Which Matters More — Size or Distance?"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Distance is the immediate concern."})," A small uncontained fire 10 km away is more dangerous right now than a huge fire 50 km away. But big fires have more energy and can grow fast under wind shifts — keep watching them."]}),v.jsx(fe,{children:"Setting It Up"}),v.jsxs("p",{children:["Just configure your state code (like ",v.jsx(se,{children:"US-ID"})," for Idaho) in Config → Environmental → Fires. MeshAI polls NIFC every 10 minutes for active fires in that state and computes the distance to your mesh nodes automatically."]}),v.jsx(fe,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(zt,{href:"https://inciweb.nwcg.gov",children:"InciWeb"})," — detailed incident information"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://data-nifc.opendata.arcgis.com",children:"NIFC Fire Map"})," — raw perimeter data"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://www.ready.gov/wildfires",children:"Ready.gov Wildfires"})," — preparedness guide"]})]})]}),v.jsxs(gr,{id:"firms",title:"Satellite Fire Detection (FIRMS)",children:[v.jsx(fe,{children:"What You're Looking At"}),v.jsx("p",{children:`NASA's VIIRS satellites orbit the Earth and look for heat signatures on the ground. When they see something hot — a fire, a factory, a sunlit building — they flag it as a "hotspot." MeshAI checks these detections for your area.`}),v.jsxs("p",{children:[v.jsx("strong",{children:"Why this matters"}),": satellite hotspots show up ",v.jsx("strong",{children:"hours before"})," official fire perimeters are mapped. If a new fire starts near your mesh, the satellite might see it before anyone on the ground reports it."]}),v.jsx(fe,{children:"Confidence — Is It Really a Fire?"}),v.jsx("p",{children:"Each detection gets a confidence rating:"}),v.jsx(Tt,{headers:["Confidence","What It Means"],rows:[["High","Almost certainly a real fire. Strong heat signature."],["Nominal","Probably a real fire. Most actual fires get this rating."],["Low","Maybe a fire, maybe not. Could be a hot roof, sun reflecting off water, a factory, or a gas flare. Lots of false alarms."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Recommendation"}),`: Set the filter to "Nominal + High." If you include "Low" you'll get alerts for every hot parking lot on a summer day.`]}),v.jsx(fe,{children:"FRP — How Intense Is It?"}),v.jsx("p",{children:'FRP (Fire Radiative Power) measures the heat output in megawatts. Think of it as "how hot is this thing":'}),v.jsx(Tt,{headers:["FRP","What It Probably Is"],rows:[["Under 5 MW","Hot surface, small agricultural burn, gas flare, or warm ground"],["5-50 MW","An actual fire — brush fire, grass fire, typical wildfire"],["50-300 MW","Intense fire — trees fully burning, active fire front"],["Over 300 MW","Extreme fire — major wildfire in full force"]]}),v.jsx("p",{children:"Setting the minimum FRP to 5 MW filters out most industrial and agricultural false alarms."}),v.jsx(fe,{children:"New Ignition Detection"}),v.jsxs("p",{children:["MeshAI cross-references satellite hotspots against known NIFC fire perimeters. If a hotspot is NOT near any known fire, it gets flagged as a ",v.jsx("strong",{children:"potential new ignition"})," — maybe a new fire just started. These get elevated priority regardless of confidence level."]}),v.jsx(fe,{children:"Timing"}),v.jsxs("p",{children:["Satellite data arrives ",v.jsx("strong",{children:"1-3 hours"})," after the satellite passes overhead. Each location gets observed about ",v.jsx("strong",{children:"6 times per day"}),` across all satellites, so there are multi-hour gaps. This is not real-time — it's "pretty recent."`]}),v.jsx(fe,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(zt,{href:"https://firms.modaps.eosdis.nasa.gov/api/area/",children:"FIRMS API page"})]}),v.jsx("li",{children:'Click "Get MAP_KEY"'}),v.jsx("li",{children:"Register for a free Earthdata account"}),v.jsx("li",{children:"Your key arrives by email"}),v.jsx("li",{children:"Enter it in Config → Environmental → FIRMS"})]}),v.jsx(fe,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(zt,{href:"https://firms.modaps.eosdis.nasa.gov",children:"FIRMS Fire Map"})," — see hotspots on a map"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://earthdata.nasa.gov/data/tools/firms/faq",children:"FIRMS FAQ"})," — how it works"]})]})]}),v.jsxs(gr,{id:"fire-tracker",title:"Fire Tracker (Fusion)",children:[v.jsx("p",{children:"FIRMS hotspots are fast but noisy; WFIGS incidents are accurate but slow. The Fire Tracker fuses both feeds and a per-pixel attribution graph so a single fire's name, declared acreage, real-time perimeter movement, and spotting events all land as separate broadcasts on the mesh."}),v.jsx(fe,{children:"What you'll see on the mesh"}),v.jsx("p",{children:"Six fire-family alert categories, in order of when they fire during an incident's lifecycle:"}),v.jsx(Tt,{headers:["Category","Severity","Trigger","Example broadcast"],rows:[[v.jsx(se,{children:"unattributed_hotspot_cluster"}),"Priority","3+ FIRMS pixels within 1 mi over 60 min, no WFIGS match — possible new ignition before NIFC declares it",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible new fire: 3 hotspots within 1 mi @ 42.93,-114.45 (combined 78 MW)"})],[v.jsx(se,{children:"wildfire_declared"}),"Priority","WFIGS first-sight of a new IRWIN incident — the official 'this is a fire and here is its name' record",v.jsx("span",{className:"text-amber-300",children:"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained"})],[v.jsx(se,{children:"wildfire_growth"}),"Priority","Per-pass centroid drift >= 0.5 mi (configurable) between consecutive satellite passes — the fire's footprint moved",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire moving NE 1.2 mi/h, ~3 mi from Almo"})],[v.jsx(se,{children:"wildfire_spotting"}),"Immediate","FIRMS pixel attributed to a tracked fire but >= 1.5 mi (configurable) outside its prior-pass convex-hull perimeter — ember spread",v.jsx("span",{className:"text-amber-300",children:"🔥 Possible spotting 2.1 mi NE of Cache Peak Fire perimeter"})],[v.jsx(se,{children:"wildfire_incident"}),"Priority","WFIGS acreage or containment increased on a fire already broadcast once (the Update path; the New path uses wildfire_declared)",v.jsx("span",{className:"text-amber-300",children:"🔥 Update: Cache Peak Fire: 1,847 ac, 23% contained"})],[v.jsx(se,{children:"wildfire_halted"}),"Routine","No FIRMS pixels attributed for 12+ hours (configurable) — fire stalled or out",v.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire no growth in 14h"})]]}),v.jsx(fe,{children:"Daily LLM digest"}),v.jsxs("p",{children:["Twice a day (default 06:00 and 18:00 Mountain Time) the bot runs an LLM summary across every active fire and the last 24 h of growth + spotting events, then broadcasts one terse line to the mesh. Shape:"," ",v.jsx("span",{className:"text-amber-300",children:'"Fires today: Cache Peak 1,847 ac +200 NE; Twin Peaks 320 ac stable; possible new fire 15 mi from Cache Peak."'})," ","Configure the schedule and timezone under ",v.jsx(se,{children:"fires.digest_*"})," ","keys on the Adapter Config page."]}),v.jsx(fe,{children:"How attribution works"}),v.jsxs("p",{children:["When a FIRMS hotspot lands, the bot walks every active fire (those not yet tombstoned) and matches by Haversine distance to that fire's running centroid. If the pixel is within the fire's ",v.jsx(se,{children:"spread_radius_mi"})," ","(default 5 mi, per-fire override available) the pixel is attributed and appended to that fire's growth history. The centroid then re-computes as the median of the last 24 h of attributed pixels, so single-pixel outliers don't drag the perimeter around."]}),v.jsxs("p",{children:["Pixels that match no fire feed the cluster detector instead: if at least"," ",v.jsx(se,{children:"cluster_min_pixels"})," (default 3) lie within"," ",v.jsx(se,{children:"cluster_max_radius_mi"})," (default 1.0) over"," ",v.jsx(se,{children:"cluster_time_window_minutes"})," (default 60), the bot fires a single ",v.jsx(se,{children:"unattributed_hotspot_cluster"})," broadcast and marks the member pixels so a fourth arrival doesn't re-fire the same cluster."]}),v.jsx(fe,{children:"How movement is computed"}),v.jsxs("p",{children:["Each VIIRS pass groups pixels into a ",v.jsx(se,{children:"pass_id"})," (satellite + 90-min bucket). When a pixel from a different bucket arrives, the prior pass closes: its convex hull becomes the perimeter, its median centroid becomes the comparison anchor, and the bot computes drift (Haversine to the previous pass's centroid), an 8-way compass bearing, and a wall-clock mi/h speed. If drift ≥ ",v.jsx(se,{children:"growth_drift_threshold_mi"})," the"," ",v.jsx(se,{children:"wildfire_growth"})," broadcast fires."]}),v.jsx(fe,{children:"How spotting is detected"}),v.jsxs("p",{children:["Once a pass closes its perimeter (a GeoJSON polygon stored on the fire), every subsequent attributed pixel runs a point-in-polygon test. Pixels outside the polygon with a vertex distance ≥"," ",v.jsx(se,{children:"spotting_distance_threshold_mi"})," (default 1.5) fire the"," ",v.jsx(se,{children:"wildfire_spotting"})," broadcast at ",v.jsx("em",{children:"immediate"})," severity — spread beyond the existing perimeter is the most actionable fire signal we emit. A per-fire cooldown (",v.jsx(se,{children:"spotting_cooldown_seconds"}),", default 1 h) prevents an ember burst in the same area from spamming the mesh."]}),v.jsx(fe,{children:"Tunable knobs (Adapter Config → fires)"}),v.jsx(Tt,{headers:["Key","Default","What it does"],rows:[[v.jsx(se,{children:"spread_radius_mi_default"}),"5.0 mi","Attribution radius for FIRMS → fire matching. Per-fire override in the fires.spread_radius_mi column."],[v.jsx(se,{children:"growth_drift_threshold_mi"}),"0.5 mi","Per-pass centroid drift at or above this fires wildfire_growth."],[v.jsx(se,{children:"halt_passes_threshold"}),"2","Consecutive empty satellite passes before wildfire_halted (documented; the time gate below is the operational rule)."],[v.jsx(se,{children:"halt_minimum_seconds"}),"43,200 (12 h)","Minimum elapsed seconds since the most recent attributed pixel before wildfire_halted can fire."],[v.jsx(se,{children:"spotting_distance_threshold_mi"}),"1.5 mi","Distance from prior-pass perimeter that fires wildfire_spotting."],[v.jsx(se,{children:"spotting_cooldown_seconds"}),"3,600 (1 h)","Minimum seconds between consecutive spotting broadcasts per fire."],[v.jsx(se,{children:"digest_enabled"}),"true","Master toggle for the twice-daily digest."],[v.jsx(se,{children:"digest_schedule"}),'["06:00","18:00"]',"Local-time slots for the digest."],[v.jsx(se,{children:"digest_timezone"}),"America/Boise","IANA tz for digest_schedule."],[v.jsx(se,{children:"digest_max_chars"}),"200","Hard cap on the digest wire (the LLM is told to fit; the chunker enforces)."]]})]}),v.jsxs(gr,{id:"weather-alerts",title:"Weather Alerts",children:[v.jsx(fe,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI watches for NWS (National Weather Service) alerts affecting your area — warnings, watches, and advisories."}),v.jsx(fe,{children:"Alert Severity — How Serious Is It?"}),v.jsx(Tt,{headers:["Severity","What It Means","Example"],rows:[["Extreme","Life-threatening. The most serious events.","Tornado Emergency, Hurricane Warning, Tsunami Warning"],["Severe","Dangerous. Take protective action.","Tornado Warning, Flash Flood Warning, Blizzard Warning, Red Flag Warning"],["Moderate","Be prepared. Could become dangerous.","Winter Weather Advisory, Wind Advisory, Flood Watch, Heat Advisory"],["Minor","Good to know. Probably won't hurt anyone.","Special Weather Statement, Air Quality Alert"]]}),v.jsx(fe,{children:"When Should I Act? (Urgency)"}),v.jsx(Tt,{headers:["Urgency","What It Means"],rows:[["Immediate","Do something NOW"],["Expected","Do something within the hour"],["Future","Coming in the next several hours"],["Past","It's over — NWS is clearing the alert"]]}),v.jsx(fe,{children:"How Sure Are They? (Certainty)"}),v.jsx(Tt,{headers:["Certainty","What It Means"],rows:[["Observed","It's happening right now. Verified."],["Likely","More than 50% chance"],["Possible","Could happen, but less than 50%"],["Unlikely","Probably won't, but mentioned for awareness"]]}),v.jsx(fe,{children:"These Are Separate Scales"}),v.jsx("p",{children:'A single alert has all three. A hurricane warning for next week is "Severe + Future + Likely." A tornado spotted on the ground is "Extreme + Immediate + Observed." An air quality advisory is "Minor + Expected + Possible."'}),v.jsx(fe,{children:"What Minimum Severity Should I Set?"}),v.jsx(Tt,{headers:["Setting","What You Get","What You Miss"],rows:[["Minor","Everything — high volume","Nothing"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate"})," ✓"]}),"Watches, Advisories, and Warnings","Special Weather Statements"],["Severe","Only Warnings — things happening NOW","Watches (which give you hours of advance warning)"],["Extreme","Only the rarest events","Most Tornado and Severe Thunderstorm Warnings"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Moderate is recommended."})," It catches Watches (advance warning that conditions may worsen) and Advisories (conditions exist but aren't severe) while filtering out the informational stuff."]}),v.jsx(fe,{children:"Finding Your NWS Zone"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Go to ",v.jsx(zt,{href:"https://www.weather.gov",children:"weather.gov"})]}),v.jsx("li",{children:"Enter your location"}),v.jsxs("li",{children:["Find your zone code at ",v.jsx(zt,{href:"https://www.weather.gov/pimar/PubZone",children:"NWS Zone Map"})]}),v.jsxs("li",{children:["Zone codes look like: ",v.jsx(se,{children:"IDZ016"}),", ",v.jsx(se,{children:"UTZ040"}),", etc."]})]}),v.jsx(fe,{children:"The User-Agent Field"}),v.jsx("p",{children:"NWS wants to know who's using their API — not for approval, just so they can contact you if something breaks. You make it up:"}),v.jsx("p",{children:v.jsx(se,{children:"(meshai, you@email.com)"})}),v.jsx("p",{children:"No registration. No waiting. Just type it in."}),v.jsx(fe,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(zt,{href:"https://alerts.weather.gov",children:"NWS Active Alerts"})," — see current alerts"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://www.weather.gov/documentation/services-web-api",children:"NWS API Docs"})," — technical details"]})]})]}),v.jsxs(gr,{id:"solar",title:"Solar & Geomagnetic Conditions",children:[v.jsx(fe,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI tracks space weather — solar activity and its effects on Earth's magnetic field. This matters for radio operators because the sun directly controls how well HF radio works, and major solar events can affect all radio communications."}),v.jsx(fe,{children:"Solar Flux Index (SFI)"}),v.jsx("p",{children:'Think of SFI as a "how active is the sun" number. Higher = better for HF radio, but also higher risk of solar flares.'}),v.jsx(Tt,{headers:["SFI","What It Means for You"],rows:[["Below 70","Quiet sun. Higher HF bands (10m, 15m) are probably dead. Stick to lower bands."],["70-90","Getting better. Some openings on 15m and above, but inconsistent."],["90-120","Good. Most HF bands work. Reliable contacts on 20m and 15m."],["120-170","Great. All HF bands open. 10m works for worldwide contacts."],["Above 170","Excellent. Best HF conditions — but watch for flares."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quick rule"}),": SFI above 90 and Kp below 4 = good day for HF radio."]}),v.jsx(fe,{children:"Kp Index"}),v.jsx("p",{children:"Kp measures how disturbed Earth's magnetic field is, on a 0-9 scale. Higher = more disturbance = worse for HF radio but better for aurora viewing."}),v.jsx(Tt,{headers:["Kp","What It Means for You"],rows:[["0-2","Quiet. Best HF conditions."],["3","Slightly unsettled. You probably won't notice."],["4","Active. Some noise and fading on HF, especially if you're at higher latitudes."],[v.jsx("strong",{children:"5"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Minor storm (G1)."})," HF noticeably degraded. Aurora visible at high latitudes (~60°N)."]})],[v.jsx("strong",{children:"6"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Moderate storm (G2)."})," HF getting rough. Aurora moving south (~55°N)."]})],[v.jsx("strong",{children:"7"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Strong storm (G3)."})," HF unreliable for 1-2 days. Aurora at mid-latitudes."]})],[v.jsx("strong",{children:"8-9"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Severe/Extreme storm."})," HF may black out completely. Aurora visible at very low latitudes. Power grid stress possible."]})]]}),v.jsx(fe,{children:"R / S / G Scales"}),v.jsx("p",{children:"NOAA's shorthand for three types of space weather events:"}),v.jsx(js,{children:"R (Radio Blackouts) — from solar flares:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"R1-R2: Brief HF disruption. You might not notice."}),v.jsx("li",{children:"R3: HF goes out for about an hour on the sunlit side of Earth."}),v.jsx("li",{children:"R4-R5: HF dead for hours. Serious."})]}),v.jsx(js,{children:"S (Solar Radiation Storms) — from energetic particles:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Mostly affects polar regions and satellites"}),v.jsx("li",{children:"S3+: Polar HF goes out entirely"})]}),v.jsx(js,{children:"G (Geomagnetic Storms) — from solar wind disturbances:"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsx("li",{children:"Same as the Kp scale: G1 = Kp 5, up to G5 = Kp 9"})}),v.jsx(fe,{children:"Bz — The Storm Predictor"}),v.jsx("p",{children:"Bz measures the direction of the solar wind's magnetic field. When it points south (negative values), the solar wind can dump energy into Earth's magnetic field, causing storms."}),v.jsx(Tt,{headers:["Bz","What It Means"],rows:[["Positive","All good. Solar wind bouncing off."],["0 to -5","Slight coupling. Nothing dramatic."],["-5 to -10","Things starting to pick up. Storm possible."],["Below -10","Storm likely. Kp will start climbing."],["Below -20","Severe storm probable."]]}),v.jsx("p",{children:"Bz can change fast — minute to minute. What matters is whether it stays negative for hours, not brief dips."}),v.jsx(fe,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(zt,{href:"https://www.swpc.noaa.gov",children:"SWPC Space Weather Dashboard"})," — live data"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://www.swpc.noaa.gov/noaa-scales-explanation",children:"NOAA Space Weather Scales"})," — what R/S/G mean"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://www.hamqsl.com/solar.html",children:"HamQSL Solar Page"})," — ham-friendly display"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://www.swpc.noaa.gov/products/planetary-k-index",children:"Planetary K-Index"})," — live Kp"]})]})]}),v.jsxs(gr,{id:"ducting",title:"Tropospheric Ducting",children:[v.jsx(fe,{children:"What You're Looking At"}),v.jsx("p",{children:'Sometimes the atmosphere creates an invisible "pipe" that traps radio signals and carries them much farther than normal. This is called tropospheric ducting. It mostly affects VHF and UHF frequencies.'}),v.jsx("p",{children:"MeshAI watches for these conditions by analyzing weather data (temperature and humidity at different altitudes) over your mesh area."}),v.jsx(fe,{children:"How Do I Know If Ducting Is Happening?"}),v.jsx("p",{children:'MeshAI reports a "condition" based on the atmospheric profile:'}),v.jsx(Tt,{headers:["Condition","What It Means"],rows:[["Normal","Standard propagation. Nothing unusual."],["Super-refraction","Slightly enhanced range. You might hear a few more distant stations than usual."],["Surface Duct","Radio signals trapped near the ground. You may hear stations hundreds of km away that you've never heard before."],["Elevated Duct",'Same effect but the "pipe" is up in the atmosphere. Affects signals passing through that altitude.']]}),v.jsx(fe,{children:"What You'll Actually Notice"}),v.jsx("p",{children:"When ducting happens on your mesh:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Distant repeaters you've never heard suddenly come in"}),v.jsx("li",{children:"Nodes appear from far outside your normal range"}),v.jsx("li",{children:"You hear FM radio stations from other cities"}),v.jsx("li",{children:"ADS-B flight tracking range gets much longer"}),v.jsx("li",{children:"There might be interference from distant stations on your frequency"})]}),v.jsx(fe,{children:"The dM/dz Number"}),v.jsx("p",{children:`The dashboard shows a "dM/dz" value in "M-units/km." You don't need to understand the math — just know:`}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Around 118"})," = normal atmosphere"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 79"})," = enhanced propagation starting"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below 0 (negative)"})," = ducting is happening"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Below -50"})," = strong ducting — classic VHF/UHF DX event"]})]}),v.jsx(fe,{children:"When Does Ducting Happen?"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Under high-pressure weather systems (clear, stable air)"}),v.jsx("li",{children:"When warm air sits on top of cool air (temperature inversion)"}),v.jsx("li",{children:"Most common in late summer and early fall"}),v.jsx("li",{children:"Strongest along coastlines and over water"}),v.jsx("li",{children:"In mountain valleys: cold air pooling in fall/winter can create surface ducts"})]}),v.jsx(fe,{children:"Setting It Up"}),v.jsx("p",{children:"Just configure the latitude and longitude of the center of your mesh area in Config → Environmental → Ducting. MeshAI checks the atmospheric conditions there every 3 hours using free weather model data. No API key needed."}),v.jsx(fe,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(zt,{href:"https://dxinfocentre.com/tropo.html",children:"Tropo Forecast Maps (Hepburn)"})," — 6-day tropo prediction"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://dxmaps.com",children:"DX Maps"})," — real-time VHF/UHF propagation reports"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://en.wikipedia.org/wiki/Tropospheric_propagation",children:"Wikipedia: Tropospheric Propagation"})," — background"]})]})]}),v.jsxs(gr,{id:"avalanche",title:"Avalanche Danger",children:[v.jsx(fe,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI pulls avalanche forecasts from your regional avalanche center during winter months. The danger scale has 5 levels and it's the same across all of North America."}),v.jsx(fe,{children:"The Danger Scale"}),v.jsx(Tt,{headers:["Level","Name","Color","What To Do"],rows:[["1","Low",v.jsx(tr,{color:"green"}),"Generally safe. Normal caution in steep terrain."],["2","Moderate",v.jsx(tr,{color:"yellow"}),"Be careful on specific terrain features. Evaluate conditions."],["3","Considerable",v.jsx(tr,{color:"orange"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"DANGEROUS."}),` This is where most people die in avalanches — they see "3 out of 5" and think it's fine. It's not. Use extreme caution.`]})],["4","High",v.jsx(tr,{color:"red"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Very dangerous."})," Stay off anything steep."]})],["5","Extreme",v.jsx(tr,{color:"black"}),v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Don't go out."})," Avalanches are happening on their own."]})]]}),v.jsx(fe,{children:"The Most Important Thing to Know"}),v.jsxs("p",{children:[v.jsx("strong",{children:"Level 3 (Considerable) kills more people than any other level."}),' People look at "3 out of 5" and think "middle of the road, probably okay." In reality, the risk roughly doubles at each step up the scale. Level 3 is where dangerous conditions overlap with people thinking they can handle it.']}),v.jsx(fe,{children:"Seasonal"}),v.jsx("p",{children:'MeshAI only checks avalanche conditions during winter months (configurable, default December through April). Outside season, it shows "off season" and saves API calls.'}),v.jsx(fe,{children:"Finding Your Avalanche Center"}),v.jsxs("p",{children:["Go to ",v.jsx(zt,{href:"https://avalanche.org/avalanche-centers/",children:"avalanche.org/avalanche-centers/"})," for a map. Common center codes:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(se,{children:"SNFAC"})," — Sawtooth (central Idaho)"]}),v.jsxs("li",{children:[v.jsx(se,{children:"UAC"})," — Utah"]}),v.jsxs("li",{children:[v.jsx(se,{children:"NWAC"})," — Cascades/Olympics (WA/OR)"]}),v.jsxs("li",{children:[v.jsx(se,{children:"CAIC"})," — Colorado"]}),v.jsxs("li",{children:[v.jsx(se,{children:"SAC"})," — Sierra Nevada (CA)"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GNFAC"})," — Gallatin (SW Montana)"]})]}),v.jsx(fe,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(zt,{href:"https://avalanche.org",children:"Avalanche.org"})," — US forecasts"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://avalanche.org/avalanche-encyclopedia/human/resources/north-american-public-avalanche-danger-scale/",children:"Avalanche Danger Scale"})," — full scale explanation"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://kbyg.org",children:"Know Before You Go"})," — avalanche awareness"]})]})]}),v.jsxs(gr,{id:"traffic",title:"Traffic Flow",children:[v.jsx(fe,{children:"What You're Looking At"}),v.jsx("p",{children:"MeshAI monitors traffic speed on road segments you configure, using data from TomTom (real vehicles with navigation apps reporting their speed)."}),v.jsx(fe,{children:"Speed Ratio — The Key Number"}),v.jsx("p",{children:'MeshAI compares current speed to "free-flow speed" (what traffic normally does when the road is empty). The ratio tells you how congested it is:'}),v.jsx(Tt,{headers:["Ratio","What It Means"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"green"})," Above 85%"]}),"Normal. Traffic flowing fine."],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"yellow"})," 65-85%"]}),"Slow. Heavier than usual but moving."],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"orange"})," 40-65%"]}),"Congested. Significant delays."],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"red"})," Below 40%"]}),"Gridlock. Barely moving."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Note"}),`: "free-flow speed" is NOT the speed limit. It's what traffic actually does on that road when nobody's in the way. Drivers often exceed speed limits on open highways.`]}),v.jsx(fe,{children:"Confidence — Can You Trust the Data?"}),v.jsx("p",{children:"TomTom's confidence score tells you how much of the reading comes from real vehicles right now vs historical averages:"}),v.jsx(Tt,{headers:["Confidence","What It Means"],rows:[["Above 0.9","Very reliable — lots of real-time probe data"],["0.7-0.9","Good — mix of real-time and historical"],["Below 0.7",v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Unreliable"})," — mostly guessing from historical patterns. Don't alert on this."]})]]}),v.jsx("p",{children:"Set minimum confidence to 0.7 to avoid false congestion alerts at night or on rural roads where few probe vehicles drive."}),v.jsx(fe,{children:"Setting Up Corridors"}),v.jsx("p",{children:'Each "corridor" is a point on a road you want to monitor. To add one:'}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:"Go to Google Maps, find the road"}),v.jsx("li",{children:`Right-click the road → "What's here?" → copy the coordinates`}),v.jsx("li",{children:"Add the corridor in Config with a name and those coordinates"}),v.jsx("li",{children:"TomTom finds the nearest road segment automatically"})]}),v.jsx(fe,{children:"Getting an API Key"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Sign up at ",v.jsx(zt,{href:"https://developer.tomtom.com",children:"developer.tomtom.com"})," (free)"]}),v.jsx("li",{children:"Create an app → get your API key"}),v.jsx("li",{children:"Free tier: 2,500 requests/day (plenty for 5-10 corridors)"})]}),v.jsx(fe,{children:"Learn More"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(zt,{href:"https://developer.tomtom.com",children:"TomTom Developer Portal"})," — API docs and key signup"]}),v.jsxs("li",{children:[v.jsx(zt,{href:"https://www.tomtom.com/traffic-index/",children:"TomTom Traffic Index"})," — city congestion rankings"]})]})]}),v.jsxs(gr,{id:"roads-511",title:"Road Conditions (511)",children:[v.jsx(fe,{children:"What You're Looking At"}),v.jsx("p",{children:"511 systems report road closures, construction, weather events, mountain pass conditions, and incidents. Every state runs their own 511 system — there is no national API."}),v.jsx(fe,{children:"Setting It Up"}),v.jsx("p",{children:"You need to find YOUR state's 511 developer API. MeshAI does not include a default URL because every state is different. Some states have free public APIs, some require registration, and some don't have developer APIs at all."}),v.jsx("p",{children:"Configure in Config → Environmental → 511:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Base URL"})," — your state's API endpoint"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"API Key"})," — if required by your state"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Endpoints"})," — which data feeds to poll (varies by state)"]})]}),v.jsx(fe,{children:"Learn More"}),v.jsx("p",{children:"Check your state's 511 or DOT website for developer information."})]}),v.jsxs(gr,{id:"mesh-health",title:"Mesh Health",children:[v.jsx(fe,{children:"Health Score"}),v.jsx("p",{children:"MeshAI computes a 0-100 health score for your mesh network by looking at five areas, each weighted differently:"}),v.jsx(Tt,{headers:["Pillar","Weight","What It Measures"],rows:[[v.jsx("strong",{children:"Infrastructure"}),"30%","Are your routers online?"],[v.jsx("strong",{children:"Utilization"}),"25%","Is the radio channel congested?"],[v.jsx("strong",{children:"Coverage"}),"20%","Do nodes have redundant paths to gateways?"],[v.jsx("strong",{children:"Behavior"}),"15%","Are any nodes flooding the channel?"],[v.jsx("strong",{children:"Power"}),"10%","Are battery-powered nodes running low?"]]}),v.jsx("p",{children:"The overall score is the weighted sum:"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"Score = (Infrastructure × 30%) + (Utilization × 25%) + (Coverage × 20%) + (Behavior × 15%) + (Power × 10%)"}),v.jsx(fe,{children:"How Each Pillar Is Calculated"}),v.jsx(js,{children:"Infrastructure (30%)"}),v.jsx("p",{children:"This is the simplest pillar — what percentage of your infrastructure nodes are currently online?"}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"(routers online ÷ total routers) × 100"}),v.jsxs("p",{children:["Only nodes with the ",v.jsx(se,{children:"ROUTER"}),", ",v.jsx(se,{children:"ROUTER_LATE"}),", or ",v.jsx(se,{children:"ROUTER_CLIENT"})," role count as infrastructure. Regular client nodes going offline doesn't affect this score. If you have 5 routers and 3 are online, infrastructure scores 60."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If you have no routers at all (all clients), this pillar scores 100. You're not penalized for not having infrastructure — you just don't have any to track."]}),v.jsx(js,{children:"Utilization (25%)"}),v.jsxs("p",{children:["MeshAI reads the channel utilization that each router reports in its telemetry — this is the firmware's own measurement of how busy the radio channel is. MeshAI uses the ",v.jsx("strong",{children:"highest"})," value from any infrastructure node because the busiest router is the bottleneck for the whole mesh."]}),v.jsx("p",{children:v.jsx("strong",{children:"How it works:"})}),v.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-4",children:[v.jsxs("li",{children:["Collect ",v.jsx(se,{children:"channel_utilization"})," from all infrastructure nodes that report it"]}),v.jsx("li",{children:"If no infra nodes have telemetry, try all nodes"}),v.jsxs("li",{children:["Use the ",v.jsx("strong",{children:"maximum"})," value for scoring (busiest node = bottleneck)"]}),v.jsx("li",{children:"If no nodes report utilization (older firmware), fall back to packet count estimate"})]}),v.jsxs("p",{className:"mt-4",children:[v.jsx("strong",{children:"Fallback method"})," (when telemetry unavailable): estimates from packet counts using 200ms/packet airtime. This is less accurate — it assumes MediumFast preset and sums packets across all nodes."]}),v.jsx(Tt,{headers:["Channel Utilization","Score","What It Means"],rows:[["Under 20%","100","Channel is clear — this is the goal"],["20-25%","75-100","Slight degradation, occasional collisions"],["25-35%","50-75","Severe degradation — firmware throttling active"],["35-45%","25-50","Mesh struggling badly — reliability dropping"],["Over 45%","0-25","Mesh is effectively unusable"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," If no utilization data is available (no telemetry and no packet data), this pillar scores 100. You're not penalized for missing data."]}),v.jsx(js,{children:"Coverage (20%)"}),v.jsx("p",{children:'Measures gateway redundancy — how many of your data sources can "see" each node. A node reported by all 3 of your gateways has full coverage. A node only seen by 1 gateway is a single point of failure.'}),v.jsxs("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:["coverage_ratio = average_gateways_per_node ÷ total_sources",v.jsx("br",{}),"single_gw_penalty = (single_gateway_nodes ÷ total_nodes) × 40"]}),v.jsx("p",{children:"If a node is seen by 2 out of 3 sources, its coverage ratio is 0.67. Infrastructure nodes with only single-gateway coverage get an extra penalty — they're critical but have no backup path."}),v.jsx(Tt,{headers:["Coverage Ratio","Base Score","After Penalty"],rows:[["100% (all sources)","100","100 minus single-gw penalty"],["70-99%","90","Minus penalties"],["50-69%","70","Minus penalties"],["Under 50%","50 or less","Heavy penalty"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Special case:"})," With only 1 data source, this pillar can't score well — there's no redundancy to measure. Coverage becomes meaningful when you have 2+ sources (MeshMonitor + MQTT, multiple gateways, etc.)."]}),v.jsx(js,{children:"Behavior (15%)"}),v.jsx("p",{children:"Counts how many nodes are sending an unusually high number of non-text packets. This catches firmware bugs, stuck transmitters, and misconfigured nodes that are flooding the channel."}),v.jsxs("p",{children:[v.jsx("strong",{children:"What counts as flooding:"})," More than 500 non-text packets in 24 hours. Text messages don't count — the behavior pillar only flags telemetry, position, and routing packet floods."]}),v.jsx(Tt,{headers:["Flagged Nodes","Score"],rows:[["0","100"],["1","80"],["2-3","60"],["4-5","40"],["6+","20"]]}),v.jsx("p",{children:"A single misbehaving node only drops the score to 80. It takes multiple problem nodes to seriously hurt the behavior pillar."}),v.jsx(js,{children:"Power (10%)"}),v.jsx("p",{children:"Measures what fraction of battery-powered nodes are below the warning threshold (default 20%)."}),v.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"100 × (1 − low_battery_nodes ÷ total_battery_nodes)"}),v.jsx("p",{children:"If 2 out of 10 battery nodes are below 20%, power scores 80."}),v.jsxs("p",{children:[v.jsx("strong",{children:"Important:"})," USB-powered nodes are excluded from this calculation. Many nodes report 100% battery even when running on wall power with no battery installed. Only nodes actually running on batteries affect this pillar."]}),v.jsx(fe,{children:"Health Tiers"}),v.jsx(Tt,{headers:["Score","Tier","What It Means"],rows:[["90-100",v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"green"})," Healthy"]}),"Everything's working well."],["75-89",v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"yellow"})," Slight degradation"]}),"Some issues but the mesh is functional."],["50-74",v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"orange"})," Unhealthy"]}),"Multiple problems. Reliability is affected."],["25-49",v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"red"})," Warning"]}),"Significant issues. The mesh is struggling."],["0-24",v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"black"})," Critical"]}),"Major failures. Barely functional."]]}),v.jsx(fe,{children:"Channel Utilization — Is the Radio Channel Full?"}),v.jsx("p",{children:"Meshtastic radios share one LoRa channel. If too many nodes are transmitting too often, they step on each other and messages get lost."}),v.jsx(Tt,{headers:["Utilization","What's Happening"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"green"})," Under 25%"]}),"Healthy. The firmware itself starts throttling above 25% to protect the channel — so under 25% is the target."],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"yellow"})," 25-40%"]}),"Getting busy. Common on larger meshes. Worth watching."],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"orange"})," 40-50%"]}),"Congested. The firmware throttles GPS updates above 40%. Messages are colliding and retrying."],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"red"})," Over 50%"]}),"Serious problem. More time is spent retrying than communicating. Mesh reliability drops fast."],[v.jsxs(v.Fragment,{children:[v.jsx(tr,{color:"black"})," Over 65%"]}),"Documented failure point on busy LONG_FAST meshes. The mesh becomes unusable."]]}),v.jsx(fe,{children:"Packet Flooding"}),v.jsx("p",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-yellow-200",children:v.jsx("strong",{children:'⚠️ "Packet flooding" means a node sending too many RADIO PACKETS. This has nothing to do with water flooding.'})}),v.jsx("p",{children:"A normal Meshtastic node sends a packet every few minutes (announcing itself, reporting telemetry, updating position). If a node starts blasting packets every few seconds, something is wrong — firmware bug, stuck transmitter, or misconfiguration."}),v.jsx(Tt,{headers:["Packets per Minute","What It Means"],rows:[["1-5","Normal"],["5-10","Elevated — might be someone chatting a lot"],["10-20","Suspicious — worth investigating"],["Over 30","Something is broken. This node is actively hurting the mesh."]]}),v.jsx(fe,{children:"Battery Levels"}),v.jsx("p",{children:"Most Meshtastic radios (T-Beam, RAK4631, Heltec V3) use a single lithium battery cell. The voltage tells you how much charge is left:"}),v.jsx(Tt,{headers:["Voltage","Charge","What To Do"],rows:[["4.20V","100%","Full"],["3.80V","~60%","Fine"],[v.jsx("strong",{children:"3.60V"}),v.jsx("strong",{children:"~30%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚠️ Warning — charge it soon"})})],[v.jsx("strong",{children:"3.50V"}),v.jsx("strong",{children:"~15%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"🔴 Low — charge it now"})})],[v.jsx("strong",{children:"3.40V"}),v.jsx("strong",{children:"~7%"}),v.jsx(v.Fragment,{children:v.jsx("strong",{children:"⚫ About to die"})})],["3.30V","~3%","Device shutting down"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"USB-powered nodes"})," report 100% battery even if there's no battery installed. Battery alerts only matter for nodes actually running on battery power."]}),v.jsx(fe,{children:"Node Offline Detection"}),v.jsx("p",{children:`MeshAI marks a node as "offline" when it hasn't been heard for a configurable time period. Different node types need different thresholds:`}),v.jsx(Tt,{headers:["Node Type","Recommended Threshold","Why"],rows:[["Fixed infrastructure (wall power)",v.jsx("strong",{children:"2 hours"}),"These should always be transmitting. 2 hours of silence means something is wrong."],["Fixed client (wall power)","2-4 hours","Same logic, slightly more lenient."],["Mobile / vehicle","4-8 hours","They go behind mountains, into garages, out of range. Normal."],["Solar-powered","12-24 hours","May shut down at night when solar stops charging."]]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Rule of thumb"}),`: set the threshold to about 4× the node's beacon interval. Too tight and nodes will constantly flap "offline/online" from normal gaps. Too loose and real outages go unnoticed.`]})]}),v.jsxs(gr,{id:"broadcast-types",title:"Broadcast Types",children:[v.jsx("p",{children:"Every broadcast the bot sends to the mesh carries a one-word prefix that tells you what kind of update it is. Three types:"}),v.jsx(Tt,{headers:["Prefix","What it means","When you see it"],rows:[[v.jsx(se,{children:"New:"}),"The first time the bot has ever broadcast about this event","Cache Peak Fire's WFIGS first-sight; FIRMS cluster's first 3-pixel detection; first NWS warning for a CAP id"],[v.jsx(se,{children:"Update:"}),"A material change on something the bot already announced","Cache Peak Fire's acreage grew; ITD 511 work zone's lane status changed; quake event's magnitude was revised"],[v.jsx(se,{children:"Active:"}),"A clock-driven reminder that an already-announced event is still live","Cache Peak Fire is still burning 8 hours later; an SWPC G3 storm is still in progress"]]}),v.jsx("p",{children:"The bot tracks first-broadcast time and last-broadcast time separately on every event row, so a New: prefix is only emitted once even after a container restart. Update: respects per-adapter cooldowns (WFIGS is 8 h by default; ITD 511 is per-incident). Active: is the reminder system, covered in the next section."})]}),v.jsxs(gr,{id:"reminders",title:"Reminder System",children:[v.jsxs("p",{children:["Some events stay live for days. A wildfire doesn't go out because WFIGS stopped publishing updates; a geomagnetic storm doesn't end because SWPC went quiet on the wire. The reminder system fires a clock-driven"," ",v.jsx(se,{children:"Active:"}),"-prefixed re-broadcast on a human-scale cadence so an operator who came on shift after the original announcement still sees the event."]}),v.jsx(fe,{children:"Cadences"}),v.jsx(Tt,{headers:["Adapter","Reminder cadence","Termination"],rows:[[v.jsxs(v.Fragment,{children:[v.jsx(se,{children:"wfigs"})," (wildfires)"]}),"Every 8 h while the fire is still active","WFIGS publishes a tombstone (incident closed) → fires.tombstoned_at is stamped → reminder loop stops"],[v.jsxs(v.Fragment,{children:[v.jsx(se,{children:"swpc"})," (space weather)"]}),"Every 8 h while a Kp >= floor / X-class flare / proton-storm event is ongoing","The next SWPC envelope shows the storm has subsided"],[v.jsx(se,{children:"itd_511_work_zone"}),"Per-zone, configurable in the rule UI","WZDx publishes the zone with end_date in the past"]]}),v.jsx(fe,{children:"The tombstone"}),v.jsxs("p",{children:["When a WFIGS update declares an incident closed, the bot stamps"," ",v.jsx(se,{children:"fires.tombstoned_at"})," with the close time. The reminder scheduler treats ",v.jsx(se,{children:"tombstoned_at IS NOT NULL"}),` as "stop broadcasting Active: for this fire," and the LLM context layer treats it as "this fire is in the closed-out archive." A subsequent FIRMS pixel inside that fire's spread radius does not re-open it — closure is authoritative from NIFC.`]}),v.jsx(fe,{children:"Turning reminders off"}),v.jsxs("p",{children:["Per-adapter on/off lives in ",v.jsx(se,{children:"adapter_meta.reminder_enabled"})," ","and is exposed on the Adapter Config page. The reminders themselves flow through the same dispatcher gates as everything else, so they still respect cooldowns, the cold-start grace window, and your notification rules."]})]}),v.jsxs(gr,{id:"notifications",title:"Notifications",children:[v.jsx(fe,{children:"How It Works"}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Something happens"})," — a fire is detected, weather warning issued, node goes offline, etc."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"MeshAI checks your rules"})," — does this event match any of your notification rules? Is it severe enough?"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"If a rule matches"})," — MeshAI sends the notification through whatever delivery method that rule is configured for."]})]}),v.jsx(fe,{children:"Building Rules"}),v.jsx("p",{children:"Each rule answers three questions:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"WHEN"})," does it trigger? (which categories, what severity)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"WHERE"})," does it send? (mesh broadcast, email, webhook, etc.)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"HOW OFTEN"})," at most? (cooldown period)"]})]}),v.jsx("p",{children:'Use "Add from Template" to start with a pre-built rule and customize it, or build from scratch with "Add Rule."'}),v.jsx(fe,{children:"Severity Levels — What Should I Set?"}),v.jsx(Tt,{headers:["Level","When It's Used","Notification Volume"],rows:[["Info","Routine stuff (ducting detected, new router appeared)","High — lots of messages"],["Advisory","Worth knowing (weather advisory, slow traffic, battery declining)","Moderate"],["Watch","Pay attention (fire within 50km, weather watch, stream rising)","Low-moderate"],[v.jsxs(v.Fragment,{children:[v.jsx("strong",{children:"Warning"})," ✓"]}),"Take action (fire within 15km, severe weather, critical battery)","Low — recommended for most rules"],["Emergency","Life safety (extreme weather, fire at infrastructure, total blackout)","Very rare"]]}),v.jsxs("p",{children:[v.jsx("strong",{children:'"Warning" is the sweet spot for most rules.'})," You get alerted when something actually needs your attention without being overwhelmed by every minor event."]}),v.jsx(fe,{children:"Webhook — The Swiss Army Knife"}),v.jsx("p",{children:"A webhook sends your alert as an HTTP POST to any URL. This one delivery method works with:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Discord"})," — use a Discord webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Slack"})," — use a Slack incoming webhook URL"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"ntfy.sh"})," — POST to ",v.jsx(se,{children:"https://ntfy.sh/your-topic"})]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Pushover"})," — POST to the Pushover API"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Home Assistant"})," — POST to an automation webhook URL"]}),v.jsx("li",{children:"Anything else that accepts HTTP POST"})]}),v.jsx("p",{children:"MeshAI doesn't need to know what's on the other end. Give it the URL and it works."})]}),v.jsxs(gr,{id:"commands",title:"Commands",children:[v.jsxs("p",{children:["All commands use the ",v.jsx(se,{children:"!"})," prefix (configurable). Send these as a direct message to MeshAI on your mesh."]}),v.jsx(fe,{children:"Basic Commands"}),v.jsx(Tt,{headers:["Command","What It Does"],rows:[[v.jsx(se,{children:"!help"}),"Shows all available commands"],[v.jsx(se,{children:"!ping"}),"Tests if the bot is alive"],[v.jsx(se,{children:"!status"}),"Quick mesh summary (nodes online, health score)"],[v.jsx(se,{children:"!health"}),"Detailed health report with pillar scores"],[v.jsx(se,{children:"!weather"}),"Current weather for your area"]]}),v.jsx(fe,{children:"Environmental Commands"}),v.jsx(Tt,{headers:["Command","What It Does"],rows:[[v.jsx(se,{children:"!alerts"}),"Active NWS weather alerts for your area"],[v.jsxs(v.Fragment,{children:[v.jsx(se,{children:"!solar"})," (or ",v.jsx(se,{children:"!hf"}),")"]}),"Current solar indices and RF conditions"],[v.jsx(se,{children:"!fire"}),"Active wildfires near your mesh"],[v.jsx(se,{children:"!avy"}),'Avalanche advisory (seasonal — shows "off season" in summer)'],[v.jsxs(v.Fragment,{children:[v.jsx(se,{children:"!streams"})," (or ",v.jsx(se,{children:"!gauges"}),")"]}),"Stream gauge readings"],[v.jsxs(v.Fragment,{children:[v.jsx(se,{children:"!roads"})," (or ",v.jsx(se,{children:"!traffic"}),")"]}),"Road conditions and traffic flow"],[v.jsx(se,{children:"!hotspots"}),"Satellite fire detections"]]}),v.jsx(fe,{children:"Subscription Commands"}),v.jsx(Tt,{headers:["Command","What It Does"],rows:[[v.jsx(se,{children:"!subscribe"}),"Lists all alert categories you can subscribe to"],[v.jsx(se,{children:"!subscribe fire_proximity"}),"Subscribe to a specific category"],[v.jsx(se,{children:"!subscribe all"}),"Subscribe to everything"],[v.jsx(se,{children:"!unsubscribe fire_proximity"}),"Unsubscribe from a category"],[v.jsx(se,{children:"!subscriptions"}),"Shows what you're currently subscribed to"]]}),v.jsx(fe,{children:"Conversational"}),v.jsxs("p",{children:[`Bang commands are the short, predictable interface. For anything that doesn't map cleanly to a single command — "how's the mesh doing?", "is there any ducting?", "why didn\\'t I hear about anything today?" — you can DM the bot in plain English. The LLM DM path covers the same data the commands cover, plus the dispatcher drop audit, with honest "no data" answers when a feed is quiet. Full catalog under`," ",v.jsx("a",{href:"#llm-dm",className:"text-accent hover:underline",children:"LLM DM Queries"}),"."]})]}),v.jsxs(gr,{id:"llm-dm",title:"LLM DM (Natural-Language Queries)",children:[v.jsxs("p",{children:["Bang commands like ",v.jsx(se,{children:"!fire"})," are short and predictable — the right tool on a mesh-constrained interface. For anything else, you can DM the bot in plain English and it will answer from the same live environmental data the broadcast pipeline uses. Both paths work; pick whichever fits the question."]}),v.jsx(fe,{children:"What it can answer"}),v.jsx("p",{children:"When you DM the bot a question, the env_reporter layer assembles up to seven data blocks and injects them into the LLM's system prompt. Each block maps to one adapter:"}),v.jsx(Tt,{headers:["Adapter block","Example question that hits it","What you get back"],rows:[[v.jsx(se,{children:"build_fires_detail"}),'"are there any fires near me?"',"Active WFIGS-declared fires, acreage, containment, declared_at, county/state"],[v.jsx(se,{children:"build_alerts_detail"}),'"any weather alerts?"',"Active NWS CAP alerts: type, severity, area, expiry"],[v.jsx(se,{children:"build_quakes_detail"}),'"any earthquakes nearby?"',"USGS quakes in the last 24h: magnitude, depth, place"],[v.jsx(se,{children:"build_traffic_detail"}),'"how is traffic on I-84?" / "any road closures?"',"TomTom + ITD 511 active incidents"],[v.jsx(se,{children:"build_gauges_detail"}),'"what is the snake river level?"',"USGS NWIS latest readings + flood stages"],[v.jsx(se,{children:"build_swpc_detail"}),'"what are the band conditions?" / "any space weather?"',"Recent SWPC events + band-conditions ratings"],[v.jsx(se,{children:"build_drop_audit"}),`"why didn't I hear about anything today?"`,"Event log: what envelopes the dispatcher filtered, by adapter + category"]]}),v.jsx(fe,{children:"The grounding rule"}),v.jsxs("p",{children:["The bot is told to answer ",v.jsx("em",{children:"only"}),' from the blocks in the system prompt. If a block is empty (no recent quakes, no active NWS alerts), the response is honest about it: "No active weather alerts right now," not a fabricated "144 earthquakes worldwide in the past 24 hours." That clamp closes the failure mode where the LLM defaulted to its training data when local tables were quiet.']}),v.jsx(fe,{children:"Excluding an adapter from LLM context"}),v.jsxs("p",{children:["The ",v.jsx(se,{children:"include_in_llm_context"})," toggle on each adapter's row in Adapter Config decides whether that adapter's ",v.jsx(se,{children:"build_*"})," ","block lands in the system prompt. Turn an adapter off here if you don't want the bot's natural-language answers to draw on it (e.g. you ingest TomTom for situational awareness but don't want it cited in DM answers). Broadcasts are unaffected — this toggle gates LLM context only."]}),v.jsx(fe,{children:"What it can't answer"}),v.jsx("p",{children:`The bot has no general internet access. Questions that need data the env_reporter doesn't carry ("what's the weather forecast tomorrow", "who's the current president") fall back to whatever the configured LLM backend knows from training. The grounding clamp keeps the bot from inventing local data, but it can't keep the LLM from speculating about non-local topics.`})]}),v.jsxs(gr,{id:"or-not-and",title:"OR-not-AND Architecture",children:[v.jsx("p",{children:"Every environmental adapter pulls its data from one of two places:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Central"})," (canonical) — Central polls the upstream feed once on behalf of the whole fleet and re-publishes normalized envelopes over NATS JetStream. MeshAI subscribes. One Central poll, one canonical normalization, many subscribers."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Native"})," — MeshAI polls the upstream feed directly. Stays around for adapters Central doesn't carry yet (currently Tropospheric Ducting and Avalanche Center advisories) and for operators who don't run Central."]})]}),v.jsx(fe,{children:"Why mutually exclusive"}),v.jsxs("p",{children:["An adapter is set to ",v.jsx("strong",{children:"either"})," Central ",v.jsx("strong",{children:"or"})," ","native, never both. Running both at the same time is what the codebase calls the ",v.jsx("em",{children:"AND-mode anti-pattern"}),": two independent poll loops on the same upstream feed, duplicate broadcasts, duplicate cursor state, no shared dedup. The Spokane-class leak (cross-state broadcasts that escaped the bbox filter in May 2026) was caused by an inadvertent AND-mode on the traffic adapter; the fix made the gate enforce mutual exclusion at boot and on every config save."]}),v.jsx(fe,{children:"The per-adapter source toggle"}),v.jsxs("p",{children:["Set ",v.jsx(se,{children:"feed_source"})," on each adapter's row in Environment:"]}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(se,{children:"central"})," — disable the native poll loop, subscribe to the matching Central subject pattern."]}),v.jsxs("li",{children:[v.jsx(se,{children:"native"})," — disable the Central subscription for this adapter, run the native poller."]})]}),v.jsxs("p",{children:["On the GUI, adapters with ",v.jsx("em",{children:"no Central counterpart yet"}),` show their Central button disabled with a "native only" tooltip. That's not an AND state; the adapter is still single-source, just locked to native by upstream availability.`]}),v.jsx(fe,{children:"Where this surfaces in tooltips"}),v.jsxs("p",{children:[`You'll see "AND-model anti-pattern" referenced in two places: the USGS-lookup button on Gauge Sites (disabled when the USGS adapter is on Central, because doing a one-off direct USGS poll from the GUI while the runtime is on Central is precisely the AND-mode this rule forbids) and the env_routes 404 response on`," ",v.jsxs(se,{children:["/api/env/usgs/lookup/","{site_id}"]})," in central-feed mode. Both surfaces refuse to fall back to a direct upstream call; the right answer is to enter values manually or source them from Central."]})]}),v.jsxs(gr,{id:"adapter-config",title:"Adapter Config & the CODE Rule",children:[v.jsx("p",{children:"The Adapter Config page is the single hub for ~50 GUI-editable knobs across the 13 adapters that touch the broadcast pipeline. Changes take effect on the next handler call — no container restart needed for most keys."}),v.jsx(fe,{children:"The CONFIG-vs-CODE rule"}),v.jsx("p",{children:"Not everything tunable becomes a GUI row. The codebase splits along one rule:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"CONFIG"})," (lives on this page) — where you send (channels), how often (cadences, schedules), thresholds (magnitude floors, severity gates, distance radii, cooldown durations, freshness windows), curation data (which sites, states, codes), toggles (enabled, include_in_llm_context)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"CODE"})," (stays in the handlers, not on the GUI) — sentence templates, emoji choices, mapping / translation functions (TomTom icon_map, ITD sub_type_map, Central adapter_map and category_map), rendering logic (anchor priority order, expires-buckets formatting, threshold-state labels), heuristic logic (band_conditions Kp/SFI → Good/Fair/Poor function)."]})]}),v.jsx("p",{children:"If you find yourself wanting to add a wire-string template or an emoji to the GUI, stop — that's CODE. If you want to change a threshold or a curation list, the GUI is the right place."}),v.jsx(fe,{children:"Restart-required vs live"}),v.jsx("p",{children:"Most keys take effect on the next handler call (the env_store re-reads from the database). A short list requires a container restart, because they govern startup-only wiring:"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:["Anything under the ",v.jsx(se,{children:"environmental"})," section on the Config page (feed_source, central URL, etc.). The Spokane-fix gate runs at env_store boot and at CentralConsumer subscribe — both happen only at startup."]}),v.jsx("li",{children:"The LLM backend swap (Google → Anthropic → OpenAI)."}),v.jsx("li",{children:"The dispatcher cold-start grace window."})]}),v.jsx("p",{children:`When you save one of those keys via the GUI, a yellow Restart-Required banner surfaces at the top of the page with a "Restart now" button. Until you click it, the on-disk config and the running config intentionally disagree — that's the OR-not-AND gate refusing to transition mid-flight.`}),v.jsxs(fe,{children:["The ",v.jsx(se,{children:"include_in_llm_context"})," toggle"]}),v.jsxs("p",{children:[`Each adapter's card on Adapter Config carries a per-adapter "LLM context" switch. When off, that adapter's `,v.jsx(se,{children:"build_*"})," ","env_reporter block is skipped during system-prompt assembly. Broadcasts are unaffected; this toggle is purely about what the LLM sees when you DM it. See the LLM DM section above for the seven adapter blocks this gates."]})]}),v.jsxs(gr,{id:"curation",title:"Curation: Gauge Sites & Town Anchors",children:[v.jsx("p",{children:"Two curation tables drive the broadcast text the bot puts on the mesh. Both are CRUD UIs with per-row enable/disable; both fall through to fallback chains when a row is missing or disabled."}),v.jsx(fe,{children:"Gauge Sites"}),v.jsx("p",{children:"Stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four NWS-AHPS flood thresholds in feet: Action, Minor, Moderate, Major. The handler compares an incoming gauge reading to those thresholds and emits the right broadcast severity."}),v.jsxs("p",{children:[v.jsx("strong",{children:"USGS lookup button"})," — when you add a new row in native-feed mode, the lookup queries the USGS Site Service plus NWS NWPS to auto-populate name, coordinates, and flood stages. In central-feed mode the button is disabled with a tooltip: a one-off direct USGS poll from the GUI while the runtime is on Central is the AND-mode anti-pattern the architecture forbids. Enter values manually or pull them from Central."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Disabled rows"})," are ignored at dispatch time. The corresponding gauge still ingests into ",v.jsx(se,{children:"gauge_readings"})," ","(so historical queries still work), it just doesn't broadcast."]}),v.jsx(fe,{children:"Town Anchors"}),v.jsxs("p",{children:['Lookup table for the "X mi ',"<","bearing",">"," of ","<","town",">",'" suffix in broadcast text. When a fire or NWS alert renders, the bot walks an anchor chain to figure out where to say it is:']}),v.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[v.jsx("li",{children:'Photon nearest-town lookup (the WFIGS path uses this — produces "near Long Creek Summit Home" style anchors)'}),v.jsx("li",{children:"Town Anchors table (your curated list)"}),v.jsx("li",{children:"Landclass label (county / federal-land identifier)"}),v.jsx("li",{children:"County + state fallback"}),v.jsx("li",{children:"Bare lat/lon coords"})]}),v.jsx("p",{children:'Each row carries a name (lowercased on save), state, lat/lon, and an enable flag. The "lowercased on save" rule keeps "Almo" / "ALMO" / "almo" from being three distinct rows. Disabled rows fall through to the next anchor in the chain — the broadcast text still goes out, it just uses a different anchor.'}),v.jsxs("p",{children:["Example broadcast text rendered from a Town Anchors row:"," ",v.jsx("span",{className:"text-amber-300",children:'"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained, @ 42.118,-113.643"'})]})]}),v.jsxs(gr,{id:"schema",title:"Schema Migrations",children:[v.jsxs("p",{children:["MeshAI persists state in a single SQLite database (",v.jsx(se,{children:"/data/meshai.sqlite"}),") with WAL journaling. Schema migrations live in ",v.jsx(se,{children:"meshai/persistence/migrations/v*.sql"})," ","and apply automatically on container start. The runner reads the migrations directory, sorts by version, and applies anything past the current ",v.jsx(se,{children:"schema_meta.version"})," in order. Idempotent re-runs are no-ops."]}),v.jsx(fe,{children:"v0.6 + v0.7 additions"}),v.jsx(Tt,{headers:["Migration","What it added"],rows:[[v.jsx(se,{children:"v11"}),"first_broadcast_at + last_broadcast_at split + reminder_enabled per adapter (the schema basis for New / Update / Active)"],[v.jsx(se,{children:"v12"}),"fires.tombstoned_at (WFIGS closure stamp; terminates the reminder loop)"],[v.jsx(se,{children:"v13"}),"Fire Tracker Phase 1 — fire_pixels table + spread_radius_mi + current_centroid_lat/lon + last_hotspot_at; firms_pixels attributed_at + cluster_broadcast_at"],[v.jsx(se,{children:"v14"}),"Fire Tracker Phase 2 — fire_passes table (per-satellite-pass centroid + drift) + last_pass_id + halt_broadcast_at on fires"],[v.jsx(se,{children:"v15"}),"Fire Tracker Phase 3 — fire_passes.perimeter_geojson (convex hull) + fires.last_spotting_broadcast_at"],[v.jsx(se,{children:"v16"}),"Fire Tracker Phase 4 — fire_digest_broadcasts table (idempotent twice-daily LLM digest)"]]}),v.jsx(fe,{children:"When migrations fail"}),v.jsxs("p",{children:["A migration failure leaves the database at the prior version and raises in the runner. Container logs surface the SQL error;"," ",v.jsx(se,{children:"schema_meta.version"})," tells you where the last successful migration stopped. Re-running the container after the underlying issue is fixed picks up from there."]})]}),v.jsxs(gr,{id:"api",title:"API Reference",children:[v.jsxs("p",{children:["MeshAI's REST API is available at ",v.jsx(se,{children:"http://your-host:8080"}),". All endpoints return JSON."]}),v.jsx(fe,{children:"System"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/status"})," — version, uptime, node count"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/channels"})," — radio channel list"]}),v.jsxs("li",{children:[v.jsx(se,{children:"POST /api/restart"})," — restart the bot"]})]}),v.jsx(fe,{children:"Mesh Data"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/health"})," — health score and pillars"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/nodes"})," — all nodes with positions and telemetry"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/edges"})," — neighbor links with signal quality"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/regions"})," — region summaries"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/sources"})," — data source health"]})]}),v.jsx(fe,{children:"Configuration"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/config"})," — full config"]}),v.jsxs("li",{children:[v.jsxs(se,{children:["GET /api/config/","{section}"]})," — one section"]}),v.jsxs("li",{children:[v.jsxs(se,{children:["PUT /api/config/","{section}"]})," — update a section"]})]}),v.jsx(fe,{children:"Environmental"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/env/status"})," — per-feed health"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/env/active"})," — all active events"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/env/swpc"})," — solar/geomagnetic data"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/env/ducting"})," — atmospheric profile"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/env/fires"})," — wildfire perimeters"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/env/hotspots"})," — satellite fire detections"]})]}),v.jsx(fe,{children:"Alerts"}),v.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/alerts/active"})," — current alerts"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/alerts/history"})," — past alerts"]}),v.jsxs("li",{children:[v.jsx(se,{children:"GET /api/notifications/categories"})," — available alert categories"]})]}),v.jsx(fe,{children:"Real-time"}),v.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(se,{children:"ws://your-host:8080/ws/live"})," — WebSocket for live updates"]})})]})]})})]})}const YSe=1500;function XSe(){const[e,t]=G.useState({}),[r,n]=G.useState({}),[i,a]=G.useState(!0),[o,s]=G.useState(null),[l,u]=G.useState({}),[c,h]=G.useState({}),[f,d]=G.useState({}),g=G.useCallback(async()=>{a(!0),s(null);try{const[S,T]=await Promise.all([fetch("/api/adapter-config"),fetch("/api/adapter-meta")]);if(!S.ok)throw new Error(`GET /adapter-config: ${S.status}`);if(!T.ok)throw new Error(`GET /adapter-meta: ${T.status}`);t(await S.json()),n(await T.json())}catch(S){s(String(S))}finally{a(!1)}},[]);G.useEffect(()=>{g()},[g]);const m=G.useCallback((S,T,M)=>{h(A=>({...A,[S]:T})),M&&d(A=>({...A,[S]:M})),T==="saved"&&setTimeout(()=>{h(A=>A[S]==="saved"?{...A,[S]:"idle"}:A)},YSe)},[]),y=G.useCallback(async(S,T,M)=>{const A=`${S}.${T}`;m(A,"saving");try{const N=await fetch(`/api/adapter-config/${S}/${T}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:M})});if(!N.ok){const D=(await N.json().catch(()=>({}))).detail||N.statusText;m(A,"error",String(D));return}const P=await N.json();t(I=>({...I,[S]:(I[S]||[]).map(D=>D.key===T?P:D)})),m(A,"saved")}catch(N){m(A,"error",String(N))}},[m]),_=G.useCallback(async(S,T)=>{const M=`${S}.${T}`;m(M,"saving");try{const A=await fetch(`/api/adapter-config/${S}/${T}/reset`,{method:"POST"});if(!A.ok){m(M,"error",`reset failed (${A.status})`);return}const N=await A.json();t(P=>({...P,[S]:(P[S]||[]).map(I=>I.key===T?N:I)})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]),x=G.useCallback(async(S,T)=>{const M=`meta:${S}`;m(M,"saving");try{const A=await fetch(`/api/adapter-meta/${S}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});if(!A.ok){const P=await A.json().catch(()=>({}));m(M,"error",String(P.detail||A.statusText));return}const N=await A.json();n(P=>({...P,[S]:N})),m(M,"saved")}catch(A){m(M,"error",String(A))}},[m]);if(i)return v.jsxs("div",{className:"p-6 flex items-center gap-2 text-[#777]",children:[v.jsx($g,{className:"w-5 h-5 animate-spin"})," Loading adapter config…"]});if(o)return v.jsxs("div",{className:"p-6 text-red-400",children:[v.jsx(os,{className:"w-5 h-5 inline mr-2"}),"Failed to load: ",o]});const w=Array.from(new Set([...Object.keys(r),...Object.keys(e)])).sort();return v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2 text-white",children:[v.jsx(nL,{className:"w-5 h-5"}),v.jsx("h1",{className:"text-xl font-semibold",children:"Adapter Config"}),v.jsxs("span",{className:"text-xs text-[#666] ml-2",children:[Object.values(e).reduce((S,T)=>S+T.length,0)," settings across ",w.length," adapters"]})]}),v.jsxs("p",{className:"text-xs text-[#777] max-w-3xl",children:["Per-adapter tunables (thresholds, freshness windows, toggles, curation lists). Changes take effect on the next handler call -- no container restart needed. Sentence templates, emoji, and translation maps live in code by design — see the CODE rule under ",v.jsx("a",{href:"/reference#adapter-config",className:"text-accent hover:underline",children:"Adapter Config & the CODE Rule"})," in Reference. The ",v.jsx("strong",{children:"LLM context"})," toggle on each card gates whether that adapter's data lands in the system prompt when you DM the bot; broadcasts are unaffected."]}),w.map(S=>{const T=r[S]||{display_name:S,include_in_llm_context:!0,description:""},M=e[S]||[],A=l[S]??!1,N=`meta:${S}`,P=c[N]||"idle";return v.jsxs("div",{className:"bg-bg-card border border-border",children:[v.jsxs("div",{className:"p-4 flex items-start gap-4",children:[v.jsx("button",{onClick:()=>u(I=>({...I,[S]:!I[S]})),className:"text-[#777] hover:text-white","aria-label":"toggle expand",children:A?v.jsx(jl,{className:"w-5 h-5"}):v.jsx(Sl,{className:"w-5 h-5"})}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("h2",{className:"text-base font-semibold text-white",children:T.display_name}),v.jsx("code",{className:"text-xs text-[#666]",children:S}),M.length>0&&v.jsxs("span",{className:"text-xs text-[#777] ml-1",children:["(",M.length," settings)"]}),M.length===0&&v.jsx("span",{className:"text-xs text-[#666] ml-1 italic",children:"(meta only)"})]}),T.description&&v.jsx("p",{className:"text-xs text-[#777] mt-1",children:T.description})]}),v.jsxs("label",{className:"flex items-center gap-2 text-xs text-[#e0e0e0] select-none",children:[v.jsx("input",{type:"checkbox",checked:T.include_in_llm_context,onChange:I=>x(S,{include_in_llm_context:I.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"}),"LLM context",v.jsx(WZ,{status:P,error:f[N]})]})]}),A&&M.length>0&&v.jsx("div",{className:"border-t border-border divide-y divide-border",children:M.map(I=>v.jsx(qSe,{row:I,status:c[`${S}.${I.key}`]||"idle",error:f[`${S}.${I.key}`],onCommit:D=>y(S,I.key,D),onReset:()=>_(S,I.key)},I.key))})]},S)})]})}function qSe({row:e,status:t,error:r,onCommit:n,onReset:i}){const[a,o]=G.useState(OT(e));G.useEffect(()=>{o(OT(e))},[e.value,e.type]);const s=a!==OT(e),l=JSON.stringify(e.value)===JSON.stringify(e.default),u=()=>{const c=KSe(a,e.type);c.error||c.changed(e.value)&&n(c.value)};return v.jsxs("div",{className:"px-6 py-3 flex items-start gap-4",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("code",{className:"text-sm font-mono text-accent",children:e.key}),v.jsxs("span",{className:"text-xs text-[#666]",children:["[",e.type,"]"]}),!l&&v.jsx("span",{className:"text-xs text-accent",children:"edited"})]}),e.description&&v.jsx("p",{className:"text-xs text-[#777] mt-1",children:e.description})]}),v.jsxs("div",{className:"flex items-center gap-2 min-w-[280px] justify-end",children:[e.type==="bool"?v.jsx("input",{type:"checkbox",checked:e.value===!0,onChange:c=>n(c.target.checked),className:"w-5 h-5 accent-[#f59e0b]"}):e.type==="json"?v.jsx("textarea",{className:"w-72 h-20 bg-[#0d0d0d] border border-border px-2 py-1 text-xs font-mono text-white",value:a,onChange:c=>o(c.target.value),onBlur:u}):v.jsx("input",{type:e.type==="int"||e.type==="float"?"number":"text",step:e.type==="float"?"any":"1",className:"w-48 bg-[#0d0d0d] border border-border px-2 py-1 text-sm text-white",value:a,onChange:c=>o(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&c.target.blur()}}),v.jsx(WZ,{status:t,error:r,dirty:s}),v.jsx("button",{onClick:i,disabled:l,className:"text-[#777] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Reset to default",children:v.jsx(W1,{className:"w-4 h-4"})})]})]})}function WZ({status:e,error:t,dirty:r}){return e==="saving"?v.jsx($g,{className:"w-4 h-4 text-accent animate-spin"}):e==="saved"?v.jsx(ao,{className:"w-4 h-4 text-green-500"}):e==="error"?v.jsx("span",{title:t,className:"text-red-400 cursor-help",children:v.jsx(os,{className:"w-4 h-4"})}):r?v.jsx("span",{className:"w-2 h-2 bg-accent rounded-full",title:"unsaved"}):v.jsx("span",{className:"w-4 h-4"})}function OT(e){return e.type==="bool"?String(e.value===!0):e.type==="json"?JSON.stringify(e.value,null,2):e.value===null||e.value===void 0?"":String(e.value)}function KSe(e,t){if(t==="int"){const r=Number(e);return!Number.isFinite(r)||!Number.isInteger(r)?{error:"expected integer",value:null,changed:()=>!1}:{error:null,value:r,changed:n=>n!==r}}if(t==="float"){const r=Number(e);return Number.isFinite(r)?{error:null,value:r,changed:n=>n!==r}:{error:"expected number",value:null,changed:()=>!1}}if(t==="str")return{error:null,value:e,changed:r=>r!==e};if(t==="json")try{const r=JSON.parse(e);return{error:null,value:r,changed:n=>JSON.stringify(n)!==JSON.stringify(r)}}catch{return{error:"invalid JSON",value:null,changed:()=>!1}}return{error:null,value:e,changed:()=>!0}}const zT={site_id:"",gauge_name:"",lat:0,lon:0,action_ft:null,flood_minor_ft:null,flood_moderate_ft:null,flood_major_ft:null,enabled:!0,updated_at:0};function JSe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(zT),[c,h]=G.useState(!1),[f,d]=G.useState("unknown"),g=G.useCallback(async()=>{n(!0),a(null);try{const S=await fetch("/api/gauge-sites");if(!S.ok)throw new Error(`GET: ${S.status}`);t(await S.json())}catch(S){a(String(S))}finally{n(!1)}},[]);G.useEffect(()=>{g()},[g]),G.useEffect(()=>{fetch("/api/config/environmental").then(S=>S.json()).then(S=>{var T;return d(((T=S==null?void 0:S.usgs)==null?void 0:T.feed_source)||"unknown")}).catch(()=>d("unknown"))},[]);const m=S=>{s(S.site_id),u({...S}),h(!1)},y=()=>{h(!0),s(null),u({...zT})},_=()=>{s(null),h(!1),u(zT)},x=async()=>{try{const S=c?"/api/gauge-sites":`/api/gauge-sites/${o}`,M=await fetch(S,{method:c?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!M.ok){const A=await M.json().catch(()=>({}));alert(`save failed: ${A.detail||M.statusText}`);return}_(),g()}catch(S){alert(String(S))}},w=async S=>{if(!confirm(`Delete ${S}?`))return;const T=await fetch(`/api/gauge-sites/${S}`,{method:"DELETE"});if(!T.ok){alert(`delete failed: ${T.status}`);return}g()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx($g,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(V1,{className:"w-5 h-5 text-accent"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Gauge Sites"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," sites"]}),v.jsxs("button",{onClick:y,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[v.jsx(od,{className:"w-4 h-4"})," Add site"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:"NWS-AHPS stream gauge thresholds for the USGS NWIS handler. Each row pairs a USGS site_id with a human gauge name, lat/lon, and four flood thresholds (Action / Minor / Moderate / Major, all in feet). Disabled rows still ingest into gauge_readings -- they don't broadcast. The USGS lookup button auto-populates name + coords + thresholds from USGS Site Service + NWS NWPS when this adapter is on native feed_source; Central-feed mode disables it (see Reference → OR-not-AND for why). Changes take effect on the next event."}),c&&v.jsx(TB,{draft:l,setDraft:u,onSave:x,onCancel:_,adding:!0,feedSource:f}),v.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-[#161616] border-b border-border",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Site ID"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat,Lon"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Action"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Minor"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Moderate"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Major"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),v.jsx("tbody",{className:"divide-y divide-border",children:e.map(S=>o===S.site_id?v.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:v.jsx("td",{colSpan:9,className:"px-3 py-2",children:v.jsx(TB,{draft:l,setDraft:u,onSave:x,onCancel:_,feedSource:f})})},S.site_id):v.jsxs("tr",{className:"hover:bg-bg-hover",children:[v.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:S.site_id}),v.jsx("td",{className:"px-3 py-2",children:S.gauge_name}),v.jsxs("td",{className:"px-3 py-2 text-right text-xs",children:[S.lat.toFixed(3),",",S.lon.toFixed(3)]}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.action_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_minor_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_moderate_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_major_ft??"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:S.enabled?v.jsx(ao,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ya,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>m(S),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>w(S.site_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Yg,{className:"w-4 h-4 inline"})})]})]},S.site_id))})]})})]})}function TB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i,feedSource:a}){const o=(g,m)=>t({...e,[g]:m}),[s,l]=G.useState(!1),[u,c]=G.useState(null),h=a!=="native"||!e.site_id.trim(),f=a!=="native"?"USGS lookup not available in central-feed mode (would be AND-model anti-pattern). Enter values manually.":e.site_id.trim()?"Auto-populate from USGS / NWS NWPS":"Enter a site_id first",d=async()=>{if(!h){l(!0),c(null);try{const g=e.site_id.replace(/^USGS-/i,""),m=await fetch(`/api/env/usgs/lookup/${encodeURIComponent(g)}`);if(m.status===404){const x=await m.json().catch(()=>({}));c(x.detail||"Lookup unavailable -- enter values manually"),l(!1);return}if(!m.ok){c(`Lookup failed (${m.status})`),l(!1);return}const y=await m.json(),_={...e};y.name&&!_.gauge_name&&(_.gauge_name=y.name),typeof y.lat=="number"&&(_.lat=y.lat),typeof y.lon=="number"&&(_.lon=y.lon),typeof y.action_ft=="number"&&(_.action_ft=y.action_ft),typeof y.flood_minor_ft=="number"&&(_.flood_minor_ft=y.flood_minor_ft),typeof y.flood_moderate_ft=="number"&&(_.flood_moderate_ft=y.flood_moderate_ft),typeof y.flood_major_ft=="number"&&(_.flood_major_ft=y.flood_major_ft),t(_)}catch(g){c(String(g))}finally{l(!1)}}};return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Site ID",v.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[v.jsx("input",{className:"flex-1 bg-bg border border-border px-2 py-1 text-slate-100 font-mono text-xs",value:e.site_id,onChange:g=>o("site_id",g.target.value),disabled:!i}),v.jsxs("button",{type:"button",onClick:d,disabled:h||s,title:f,className:"px-2 py-1 bg-bg-hover hover:bg-[#333] disabled:opacity-30 disabled:cursor-not-allowed text-xs text-slate-100 flex items-center gap-1",children:[s?v.jsx($g,{className:"w-3 h-3 animate-spin"}):v.jsx($1,{className:"w-3 h-3"}),"USGS lookup"]})]}),u&&v.jsx("span",{className:"text-amber-400 text-xs mt-1 block",children:u})]}),v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Gauge name",v.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.gauge_name,onChange:g=>o("gauge_name",g.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lat,onChange:g=>o("lat",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lon,onChange:g=>o("lon",parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Action ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.action_ft??"",onChange:g=>o("action_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Minor flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_minor_ft??"",onChange:g=>o("flood_minor_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Moderate flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_moderate_ft??"",onChange:g=>o("flood_moderate_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Major flood ft",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.flood_major_ft??"",onChange:g=>o("flood_major_ft",g.target.value===""?null:parseFloat(g.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-300 col-span-2 flex items-center gap-2 mt-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:g=>o("enabled",g.target.checked),className:"accent-[#f59e0b]"}),"Enabled"]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}const BT={anchor_id:0,name:"",lat:0,lon:0,state:"ID",enabled:!0,updated_at:0};function QSe(){const[e,t]=G.useState([]),[r,n]=G.useState(!0),[i,a]=G.useState(null),[o,s]=G.useState(null),[l,u]=G.useState(!1),[c,h]=G.useState(BT),f=G.useCallback(async()=>{n(!0),a(null);try{const x=await fetch("/api/town-anchors");if(!x.ok)throw new Error(`GET: ${x.status}`);t(await x.json())}catch(x){a(String(x))}finally{n(!1)}},[]);G.useEffect(()=>{f()},[f]);const d=x=>{s(x.anchor_id),h({...x}),u(!1)},g=()=>{u(!0),s(null),h({...BT})},m=()=>{s(null),u(!1),h(BT)},y=async()=>{const x=l?"/api/town-anchors":`/api/town-anchors/${o}`,S=await fetch(x,{method:l?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const T=await S.json().catch(()=>({}));alert(`save failed: ${T.detail||S.statusText}`);return}m(),f()},_=async x=>{if(!confirm(`Delete anchor ${x}?`))return;const w=await fetch(`/api/town-anchors/${x}`,{method:"DELETE"});if(!w.ok){alert(`delete failed: ${w.status}`);return}f()};return r?v.jsxs("div",{className:"p-6 text-slate-400",children:[v.jsx($g,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):i?v.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",i]}):v.jsxs("div",{className:"p-6 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(ad,{className:"w-5 h-5 text-accent"}),v.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Town Anchors"}),v.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," towns"]}),v.jsxs("button",{onClick:g,className:"ml-auto flex items-center gap-1 px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:[v.jsx(od,{className:"w-4 h-4"})," Add town"]})]}),v.jsx("p",{className:"text-xs text-slate-400 max-w-3xl",children:`Lookup table for the "X mi of " suffix in the bot's broadcast text. When a fire or NWS alert renders, the bot walks: Photon nearest-town → this table → landclass → county/state → bare coords. Disabled rows fall through to the next anchor in the chain; the broadcast still goes out, it just uses a different anchor. Example: "3 mi N of Almo". See Reference → Curation: Gauges & Towns for the full chain.`}),l&&v.jsx(MB,{draft:c,setDraft:h,onSave:y,onCancel:m,adding:!0}),v.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:v.jsxs("table",{className:"w-full text-sm text-slate-200",children:[v.jsx("thead",{className:"bg-[#161616] border-b border-border",children:v.jsxs("tr",{children:[v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lon"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"State"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),v.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),v.jsx("tbody",{className:"divide-y divide-border",children:e.map(x=>o===x.anchor_id?v.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:v.jsx("td",{colSpan:6,className:"px-3 py-2",children:v.jsx(MB,{draft:c,setDraft:h,onSave:y,onCancel:m})})},x.anchor_id):v.jsxs("tr",{className:"hover:bg-bg-hover",children:[v.jsx("td",{className:"px-3 py-2 capitalize",children:x.name}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:x.lat.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-right text-xs",children:x.lon.toFixed(4)}),v.jsx("td",{className:"px-3 py-2 text-center text-xs",children:x.state||"-"}),v.jsx("td",{className:"px-3 py-2 text-center",children:x.enabled?v.jsx(ao,{className:"w-4 h-4 text-emerald-400 inline"}):v.jsx(ya,{className:"w-4 h-4 text-slate-500 inline"})}),v.jsxs("td",{className:"px-3 py-2 text-right",children:[v.jsx("button",{onClick:()=>d(x),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),v.jsx("button",{onClick:()=>_(x.anchor_id),className:"text-red-400 hover:text-red-300",children:v.jsx(Yg,{className:"w-4 h-4 inline"})})]})]},x.anchor_id))})]})})]})}function MB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:i}){const a=(o,s)=>t({...e,[o]:s});return v.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[v.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Name (lowercased on save)",v.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.name,onChange:o=>a("name",o.target.value),disabled:!i})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["State",v.jsx("input",{className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.state??"",onChange:o=>a("state",o.target.value)})]}),v.jsxs("label",{className:"text-xs text-slate-400 flex items-center gap-2",children:[v.jsx("input",{type:"checkbox",checked:e.enabled,onChange:o=>a("enabled",o.target.checked),className:"accent-[#f59e0b] mt-4"}),"Enabled"]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lat,onChange:o=>a("lat",parseFloat(o.target.value))})]}),v.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",v.jsx("input",{type:"number",step:"any",className:"block w-full mt-1 bg-bg border border-border px-2 py-1 text-slate-100",value:e.lon,onChange:o=>a("lon",parseFloat(o.target.value))})]}),v.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[v.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),v.jsx("button",{onClick:r,className:"px-3 py-1 bg-[#f59e0b] hover:bg-[#d97706] text-black font-sans font-medium text-sm",children:"Save"})]})]})}function eCe(){return v.jsx(XK,{children:v.jsx(eJ,{children:v.jsxs(oK,{children:[v.jsx(na,{path:"/",element:v.jsx(uJ,{})}),v.jsx(na,{path:"/mesh",element:v.jsx(uSe,{})}),v.jsx(na,{path:"/environment",element:v.jsx(DSe,{})}),v.jsx(na,{path:"/config",element:v.jsx(LSe,{})}),v.jsx(na,{path:"/alerts",element:v.jsx(VSe,{})}),v.jsx(na,{path:"/notifications",element:v.jsx(ZSe,{})}),v.jsx(na,{path:"/reference",element:v.jsx($Se,{})}),v.jsx(na,{path:"/adapter-config",element:v.jsx(XSe,{})}),v.jsx(na,{path:"/gauge-sites",element:v.jsx(JSe,{})}),v.jsx(na,{path:"/town-anchors",element:v.jsx(QSe,{})})]})})})}FT.createRoot(document.getElementById("root")).render(v.jsx(Sf.StrictMode,{children:v.jsx(dK,{children:v.jsx(eCe,{})})})); diff --git a/meshai/dashboard/static/assets/index-WwNJt5S-.css b/meshai/dashboard/static/assets/index-WwNJt5S-.css deleted file mode 100644 index 4a23133..0000000 --- a/meshai/dashboard/static/assets/index-WwNJt5S-.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap";@import"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap";.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::-moz-selection{background:transparent}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:#ffffff80}.leaflet-container{font-family:Helvetica Neue,Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px #000000a6;border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:700 18px Lucida Console,Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px #0006;background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=)}.leaflet-container .leaflet-control-attribution{background:#fff;background:#fffc;margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;box-sizing:border-box;background:#fffc;text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px #0006}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=.70710678,M12=.70710678,M21=-.70710678,M22=.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px #0006}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,-apple-system,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-3{left:.75rem}.left-4{left:1rem}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-4{top:1rem}.top-6{top:1.5rem}.top-full{top:100%}.z-0{z-index:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2 / span 2}.-m-6{margin:-1.5rem}.-my-4{margin-top:-1rem;margin-bottom:-1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.-mb-px{margin-bottom:-1px}.-ml-2{margin-left:-.5rem}.-ml-4{margin-left:-1rem}.-mr-1{margin-right:-.25rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-20{height:5rem}.h-3{height:.75rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-\[540px\]{height:540px}.h-\[calc\(100vh-8rem\)\]{height:calc(100vh - 8rem)}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:12rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-96{max-height:24rem}.max-h-\[85vh\]{max-height:85vh}.min-h-\[36px\]{min-height:36px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-2{width:.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-\[190px\]{width:190px}.w-\[220px\]{width:220px}.w-\[250px\]{width:250px}.w-\[2px\]{width:2px}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.grow{flex-grow:1}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-5{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-help{cursor:help}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.scroll-mt-6{scroll-margin-top:1.5rem}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-y-1{row-gap:.25rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-border>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 30 30 / var(--tw-divide-opacity, 1))}.self-start{align-self:flex-start}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:0}.rounded-full{border-radius:9999px}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#1e2a3a\]{--tw-border-opacity: 1;border-color:rgb(30 42 58 / var(--tw-border-opacity, 1))}.border-\[\#222\]{--tw-border-opacity: 1;border-color:rgb(34 34 34 / var(--tw-border-opacity, 1))}.border-\[\#2a3a4a\]{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.border-\[\#333\]{--tw-border-opacity: 1;border-color:rgb(51 51 51 / var(--tw-border-opacity, 1))}.border-\[\#f59e0b\],.border-accent{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-accent-dim\/30{border-color:#d977064d}.border-accent\/30{border-color:#f59e0b4d}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-border{--tw-border-opacity: 1;border-color:rgb(30 30 30 / var(--tw-border-opacity, 1))}.border-border\/50{border-color:#1e1e1e80}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-red-400\/30{border-color:#f871714d}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-sky-400{--tw-border-opacity: 1;border-color:rgb(56 189 248 / var(--tw-border-opacity, 1))}.border-sky-400\/30{border-color:#38bdf84d}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-500\/30{border-color:#eab3084d}.border-yellow-700{--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity, 1))}.border-l-accent{--tw-border-opacity: 1;border-left-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.bg-\[\#000000\]{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0e17\]{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0d0d0d\]{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1219\]{--tw-bg-opacity: 1;background-color:rgb(13 18 25 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1420\]{--tw-bg-opacity: 1;background-color:rgb(13 20 32 / var(--tw-bg-opacity, 1))}.bg-\[\#161616\]{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a2332\]{--tw-bg-opacity: 1;background-color:rgb(26 35 50 / var(--tw-bg-opacity, 1))}.bg-\[\#1e1e1e\]{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.bg-\[\#1e2a3a\]\/50{background-color:#1e2a3a80}.bg-\[\#333\]{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-\[\#f59e0b\]\/10{background-color:#f59e0b1a}.bg-\[\#f59e0b\]\/20{background-color:#f59e0b33}.bg-accent{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-accent-dim{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-accent\/10{background-color:#f59e0b1a}.bg-accent\/20{background-color:#f59e0b33}.bg-accent\/5{background-color:#f59e0b0d}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-bg{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity, 1))}.bg-bg-card{--tw-bg-opacity: 1;background-color:rgb(13 13 13 / var(--tw-bg-opacity, 1))}.bg-bg-card\/90{background-color:#0d0d0de6}.bg-bg-hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-border{--tw-bg-opacity: 1;background-color:rgb(30 30 30 / var(--tw-bg-opacity, 1))}.bg-cyan-500\/20{background-color:#06b6d433}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-sky-400{--tw-bg-opacity: 1;background-color:rgb(56 189 248 / var(--tw-bg-opacity, 1))}.bg-sky-400\/10{background-color:#38bdf81a}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/50{background-color:#1e293b80}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-700{--tw-bg-opacity: 1;background-color:rgb(161 98 7 / var(--tw-bg-opacity, 1))}.bg-yellow-900\/40{background-color:#713f1266}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-4{padding-bottom:1rem}.pl-2{padding-left:.5rem}.pl-6{padding-left:1.5rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,monospace}.font-sans{font-family:Inter,system-ui,-apple-system,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-\[\#555\]{--tw-text-opacity: 1;color:rgb(85 85 85 / var(--tw-text-opacity, 1))}.text-\[\#666\]{--tw-text-opacity: 1;color:rgb(102 102 102 / var(--tw-text-opacity, 1))}.text-\[\#777\]{--tw-text-opacity: 1;color:rgb(119 119 119 / var(--tw-text-opacity, 1))}.text-\[\#e0e0e0\]{--tw-text-opacity: 1;color:rgb(224 224 224 / var(--tw-text-opacity, 1))}.text-\[\#f59e0b\],.text-accent{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-accent-dim{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-100{--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.text-yellow-200{--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.text-yellow-200\/80{color:#fef08acc}.text-yellow-300{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.text-yellow-300\/80{color:#fde047cc}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.placeholder-slate-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(100 116 139 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.placeholder-slate-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(71 85 105 / var(--tw-placeholder-opacity, 1))}.accent-\[\#f59e0b\]{accent-color:#f59e0b}.opacity-40{opacity:.4}.opacity-60{opacity:.6}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}body{background:#111;margin:0;font-family:Inter,system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:#111}::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:0}::-webkit-scrollbar-thumb:hover{background:#2a2a2a}.font-mono{font-family:JetBrains Mono,monospace}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse-slow{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes slide-in{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}.animate-slide-in{animation:slide-in .3s ease-out}.line-clamp-2{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.last\:border-0:last-child{border-width:0px}.hover\:border-\[\#2a3a4a\]:hover{--tw-border-opacity: 1;border-color:rgb(42 58 74 / var(--tw-border-opacity, 1))}.hover\:border-accent:hover{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#0a0e17\]:hover{--tw-bg-opacity: 1;background-color:rgb(10 14 23 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]:hover{--tw-bg-opacity: 1;background-color:rgb(30 42 58 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#1e2a3a\]\/50:hover{background-color:#1e2a3a80}.hover\:bg-\[\#2a3a4a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 58 74 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#d97706\]:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#f59e0b\]\/10:hover,.hover\:bg-accent\/10:hover{background-color:#f59e0b1a}.hover\:bg-accent\/80:hover{background-color:#f59e0bcc}.hover\:bg-amber-500\/30:hover{background-color:#f59e0b4d}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-bg-hover:hover{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-slate-500\/10:hover{background-color:#64748b1a}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-\[\#d97706\]:hover{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.hover\:text-accent:hover{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-sky-300:hover{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.focus\:border-\[\#f59e0b\]:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:border-accent:focus{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-slate-700:disabled{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 640px){.sm\:block{display:block}.sm\:inline-flex{display:inline-flex}}@media (min-width: 768px){.md\:flex{display:flex}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}} diff --git a/work/Dockerfile b/work/Dockerfile new file mode 100644 index 0000000..a2a867f --- /dev/null +++ b/work/Dockerfile @@ -0,0 +1,99 @@ +# MeshAI Dockerfile +# LLM-powered Meshtastic assistant +# +# Build: docker build -t meshai . +# Run: docker run -d --name meshai \ +# --device=/dev/ttyUSB0 \ +# -p 7681:7681 \ +# -v meshai_data:/data \ +# meshai + +# ── Stage 1: Build frontend ── +FROM node:20-alpine AS frontend +WORKDIR /build +COPY dashboard-frontend/ ./dashboard-frontend/ +WORKDIR /build/dashboard-frontend +RUN npm ci && npm run build +# Output lands at /build/meshai/dashboard/static/ (via vite outDir) + +# ── Stage 2: Python runtime ── +FROM python:3.11-slim-bookworm + +LABEL maintainer="K7ZVX " +LABEL description="MeshAI - LLM-powered Meshtastic assistant" +LABEL version="0.1.0" +LABEL org.opencontainers.image.source=https://github.com/zvx-echo6/meshai +LABEL org.opencontainers.image.description="MeshAI - LLM-powered Meshtastic assistant" +LABEL org.opencontainers.image.licenses=MIT + +# Build arguments +ARG UID=1000 +ARG GID=1000 + +# Environment variables +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 \ + PIP_NO_CACHE_DIR=1 \ + PIP_DISABLE_PIP_VERSION_CHECK=1 + +# Install system dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc \ + libc6-dev \ + # For serial communication + udev \ + # For health checks + curl \ + # For process management + procps \ + && rm -rf /var/lib/apt/lists/* \ + # Install ttyd for web-based config interface (arch-aware) + && TTYD_ARCH=$(dpkg --print-architecture | sed 's/amd64/x86_64/' | sed 's/arm64/aarch64/') \ + && curl -sL "https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.${TTYD_ARCH}" -o /usr/local/bin/ttyd \ + && chmod +x /usr/local/bin/ttyd + +# Create non-root user +RUN groupadd -g ${GID} meshai && \ + useradd -u ${UID} -g ${GID} -m -s /bin/bash meshai && \ + # Add to dialout group for serial access + usermod -aG dialout meshai + +# Create directories +RUN mkdir -p /app /data && \ + chown -R meshai:meshai /app /data + +WORKDIR /app + +# Copy requirements first for layer caching +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt +# Pre-download embedding model for hybrid search +RUN python3 -c "from fastembed import TextEmbedding; TextEmbedding('BAAI/bge-small-en-v1.5')" + +# Copy application code +COPY --chown=meshai:meshai meshai/ ./meshai/ +# Overwrite with freshly built frontend assets from stage 1 +COPY --from=frontend --chown=meshai:meshai /build/meshai/dashboard/static/ ./meshai/dashboard/static/ +COPY --chown=meshai:meshai pyproject.toml . +COPY --chown=meshai:meshai README.md . +COPY --chown=meshai:meshai config.example.yaml . +COPY --chown=meshai:meshai docker-entrypoint.sh . + +# Install the package +RUN pip install --no-cache-dir -e . + +# Switch to non-root user +USER meshai + +# Data volume mount point +VOLUME ["/data"] + +# Expose ttyd web config port +EXPOSE 7682 8080 + +# Health check - verify bot process is alive via PID file +HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ + CMD test -f /tmp/meshai.pid && kill -0 $(cat /tmp/meshai.pid) 2>/dev/null || exit 1 + +# Entrypoint handles config and ttyd +ENTRYPOINT ["/app/docker-entrypoint.sh"] diff --git a/work/config.example.yaml b/work/config.example.yaml new file mode 100644 index 0000000..92de160 --- /dev/null +++ b/work/config.example.yaml @@ -0,0 +1,352 @@ +# MeshAI Configuration +# LLM-powered Meshtastic assistant +# +# Copy this to config.yaml and customize as needed +# For Docker: mount as /data/config.yaml + +# === BOT IDENTITY === +bot: + name: ai # Bot's display name + owner: "" # Owner's callsign (optional) + respond_to_dms: true # Respond to direct messages + filter_bbs_protocols: true # Ignore advBBS sync/notification messages + +# === MESHTASTIC CONNECTION === +connection: + type: tcp # serial | tcp + serial_port: /dev/ttyUSB0 # For serial connection + tcp_host: localhost # For TCP connection (meshtasticd) + tcp_port: 4403 + +# === RESPONSE BEHAVIOR === +response: + delay_min: 2.2 # Min delay before responding (seconds) + delay_max: 3.0 # Max delay before responding + max_length: 200 # Max chars per message chunk + max_messages: 3 # Max message chunks per response + +# === CONVERSATION HISTORY === +history: + database: /data/conversations.db + max_messages_per_user: 50 # Messages to keep per user + conversation_timeout: 86400 # Conversation expiry (seconds, 86400=24h) + auto_cleanup: true # Auto-delete old conversations + cleanup_interval_hours: 24 # How often to run cleanup + max_age_days: 30 # Delete conversations older than this + +# === MEMORY OPTIMIZATION === +memory: + enabled: true # Enable rolling summary memory + window_size: 4 # Recent message pairs to keep in full + summarize_threshold: 8 # Messages before re-summarizing + +# === MESH CONTEXT === +context: + enabled: true # Observe channel traffic for LLM context + observe_channels: [] # Channel indices to observe (empty = all) + ignore_nodes: [] # Node IDs to exclude from observation + max_age: 2592000 # Max age in seconds (default 30 days) + max_context_items: 20 # Max observations injected into LLM context + +# === LLM BACKEND === +llm: + backend: openai # openai | anthropic | google + api_key: "" # API key (or use LLM_API_KEY env var) + base_url: https://api.openai.com/v1 # API base URL + model: gpt-4o-mini # Model name + timeout: 30 # Request timeout (seconds) + system_prompt: >- + You are a helpful assistant on a Meshtastic mesh network. + Keep responses very brief - 1-2 short sentences, under 300 characters. + Only give longer answers if the user explicitly asks for detail or explanation. + Be concise but friendly. No markdown formatting. + google_grounding: false # Enable Google Search grounding (Gemini only, $35/1k queries) + +# === WEATHER === +weather: + primary: openmeteo # openmeteo | wttr | llm + fallback: llm # openmeteo | wttr | llm | none + default_location: "" # Default location for !weather (optional) + +# === MESHMONITOR INTEGRATION === +meshmonitor: + enabled: false # Enable MeshMonitor trigger sync + url: "" # MeshMonitor web UI URL (e.g. http://192.168.1.100:3333) + inject_into_prompt: true # Include trigger list in LLM prompt + refresh_interval: 300 # Seconds between trigger refreshes + +# === KNOWLEDGE BASE (RAG) === +knowledge: + enabled: false # Enable knowledge base search + db_path: "" # Path to knowledge SQLite database + top_k: 5 # Number of chunks to retrieve per query + +# === MESH DATA SOURCES === +# Connect to Meshview and/or MeshMonitor instances for live mesh +# network analysis. Supports multiple sources. Configure via TUI +# with meshai --config (Mesh Sources menu). +# +# mesh_sources: +# - name: "my-meshview" +# type: meshview +# url: "https://meshview.example.com" +# refresh_interval: 300 +# enabled: true +# +# - name: "my-meshmonitor" +# type: meshmonitor +# url: "http://192.168.1.100:3333" +# api_token: "${MM_API_TOKEN}" +# refresh_interval: 300 +# enabled: true +# +# - name: "mqtt-broker" +# type: mqtt +# host: "mqtt.meshtastic.org" +# port: 1883 +# username: "meshdev" +# password: "large4cats" +# topic_root: "msh/US" +# use_tls: false +# enabled: true +mesh_sources: [] + +# === MESH INTELLIGENCE === +# Geographic clustering and health scoring for mesh analysis. +# Requires mesh_sources to be configured with at least one data source. +# +# mesh_intelligence: +# enabled: true +# region_radius_miles: 40.0 # Radius for region clustering +# locality_radius_miles: 8.0 # Radius for locality clustering +# offline_threshold_hours: 2 # Hours before node considered offline +# packet_threshold: 500 # Non-text packets per 24h to flag +# battery_warning_percent: 30 # Battery level for warnings +# infra_overrides: [] # Node IDs to exclude from infrastructure +# region_labels: {} # Override auto-names: {"Twin Falls": "Magic Valley"} +mesh_intelligence: + enabled: false + region_radius_miles: 40.0 + locality_radius_miles: 8.0 + offline_threshold_hours: 2 + packet_threshold: 500 + battery_warning_percent: 30 + infra_overrides: [] + region_labels: {} + +# === ENVIRONMENTAL FEEDS === +# Live situational awareness from NWS, NOAA Space Weather, and Open-Meteo. +# Provides weather alerts, HF propagation assessment, and tropospheric ducting. +# +environmental: + enabled: false + nws_zones: + - "IDZ016" # Western Magic Valley + - "IDZ030" # Southern Twin Falls County + + # NWS Weather Alerts (api.weather.gov) + nws: + enabled: true + tick_seconds: 60 + areas: ["ID"] + severity_min: "moderate" + user_agent: "(meshai.example.com, ops@example.com)" # REQUIRED by NWS + + # NOAA Space Weather (services.swpc.noaa.gov) + swpc: + enabled: true + + # Tropospheric ducting assessment (Open-Meteo GFS, no auth) + ducting: + enabled: true + tick_seconds: 10800 # 3 hours + latitude: 42.56 # center of mesh coverage area + longitude: -114.47 + + # NIFC Fire Perimeters (Phase 2) + fires: + enabled: false + tick_seconds: 600 + state: "US-ID" + + # Avalanche Advisories (Phase 2) + avalanche: + enabled: false + tick_seconds: 1800 + center_ids: ["SNFAC"] + season_months: [12, 1, 2, 3, 4] + + # USGS Stream Gauges (waterservices.usgs.gov) + # Find site IDs at https://waterdata.usgs.gov/nwis + usgs: + enabled: false + tick_seconds: 900 # Min 15 min per USGS guidelines + sites: [] # e.g. ["13090500", "13088000"] + + # TomTom Traffic Flow (api.tomtom.com, requires API key) + traffic: + enabled: false + tick_seconds: 300 + api_key: "" # Get key at developer.tomtom.com + corridors: [] + # Example corridors: + # - name: "I-84 Twin Falls" + # lat: 42.56 + # lon: -114.47 + + # 511 Road Conditions (state-specific, configurable base URL) + roads511: + enabled: false + tick_seconds: 300 + api_key: "" + base_url: "" # e.g. "https://511.idaho.gov/api/v2" + endpoints: ["/get/event"] + bbox: [] # [west, south, east, north] + + # NASA FIRMS Satellite Fire Detection + # Early warning via satellite hotspots, hours before official perimeters + # Get MAP_KEY at: https://firms.modaps.eosdis.nasa.gov/api/area/ + firms: + enabled: false + tick_seconds: 1800 # 30 min default + map_key: "" # Required - NASA FIRMS MAP_KEY + source: "VIIRS_SNPP_NRT" # VIIRS_SNPP_NRT, VIIRS_NOAA20_NRT, MODIS_NRT + bbox: [] # [west, south, east, north] - Required + day_range: 1 # 1-10 days of data + confidence_min: "nominal" # low, nominal, high + proximity_km: 10.0 # km to match known fire perimeters + + +# === NOTIFICATION DELIVERY (TRANSITIONAL) === +# NOTE: This notifications schema will be replaced in v0.3 by the 8-toggle model. +# These rule examples are transitional until Phase 1.2 lands. Do not extend. +# Severity levels: routine (informational), priority (needs attention), immediate (act now) +# +# Route alerts to channels (mesh, email, webhook) based on rules. +# Categories match alert types from alert_engine.py. +notifications: + enabled: false + quiet_hours_enabled: true # Master toggle for quiet hours feature + quiet_hours_start: "22:00" # Suppress non-emergency alerts during quiet hours + quiet_hours_end: "06:00" + + # Digest scheduler settings + # The digest collects priority/routine events and delivers a summary + # at the configured time to rules with trigger_type='schedule' and + # schedule_match='digest'. + digest: + schedule: "07:00" # HH:MM local time to fire digest + include: [] # Toggle names to include (empty = default set) + # Default set: weather, fire, seismic, avalanche, roads, mesh_health, tracking, other + # Excludes rf_propagation by default + # Example: include: ["weather", "fire", "mesh_health"] + + # Notification rules - each rule is self-contained with its own delivery config + # Default baseline rules are created on fresh install + rules: + # Emergency Broadcast - all emergencies go out immediately + - name: "Emergency Broadcast" + enabled: true + trigger_type: condition + categories: [] # Empty = all categories + min_severity: "immediate" + delivery_type: mesh_broadcast + broadcast_channel: 0 + cooldown_minutes: 5 + override_quiet: true # Send even during quiet hours + + # Infrastructure Down - critical node and infrastructure offline alerts + - name: "Infrastructure Down" + enabled: true + trigger_type: condition + categories: ["infra_offline", "critical_node_down"] + min_severity: "priority" + delivery_type: mesh_broadcast + broadcast_channel: 0 + cooldown_minutes: 30 + override_quiet: false + + # Fire Alert - wildfire proximity and new ignition + - name: "Fire Alert" + enabled: true + trigger_type: condition + categories: ["wildfire_proximity", "new_ignition"] + min_severity: "routine" + delivery_type: mesh_broadcast + broadcast_channel: 0 + cooldown_minutes: 60 + override_quiet: false + + # Severe Weather - weather warnings + - name: "Severe Weather" + enabled: true + trigger_type: condition + categories: ["weather_warning"] + min_severity: "priority" + delivery_type: mesh_broadcast + broadcast_channel: 0 + cooldown_minutes: 30 + override_quiet: false + + # Example: Morning Digest -> mesh broadcast + # Delivers the accumulated digest at the configured schedule time + # - name: "Morning Digest Mesh" + # enabled: false + # trigger_type: schedule + # schedule_match: "digest" # Required for digest delivery + # delivery_type: mesh_broadcast + # broadcast_channel: 0 + + # Example: Morning Digest -> email + # - name: "Morning Digest Email" + # enabled: false + # trigger_type: schedule + # schedule_match: "digest" + # delivery_type: email + # smtp_host: "smtp.gmail.com" + # smtp_port: 587 + # smtp_user: "you@gmail.com" + # smtp_password: "${SMTP_PASSWORD}" + # smtp_tls: true + # from_address: "meshai@yourdomain.com" + # recipients: ["admin@yourdomain.com"] + + # Example: Fire alerts -> email + # - name: "Fire Alerts Email" + # enabled: true + # trigger_type: condition + # categories: ["wildfire_proximity", "new_ignition"] + # min_severity: "routine" + # delivery_type: email + # smtp_host: "smtp.gmail.com" + # smtp_port: 587 + # smtp_user: "you@gmail.com" + # smtp_password: "${SMTP_PASSWORD}" + # smtp_tls: true + # from_address: "meshai@yourdomain.com" + # recipients: ["admin@yourdomain.com"] + # cooldown_minutes: 30 + + # Example: All warnings -> Discord webhook + # - name: "Discord Alerts" + # enabled: true + # trigger_type: condition + # categories: [] + # min_severity: "priority" + # delivery_type: webhook + # webhook_url: "https://discord.com/api/webhooks/..." + # cooldown_minutes: 10 + + # Example: Rule with no delivery (matches and logs, but doesn't send) + # - name: "Monitor Only" + # enabled: true + # trigger_type: condition + # categories: ["battery_warning"] + # min_severity: "priority" + # delivery_type: "" # Empty = no delivery, just tracks matches + +# === WEB DASHBOARD === +dashboard: + enabled: true + port: 8080 + host: "0.0.0.0" diff --git a/work/config/.env.example b/work/config/.env.example new file mode 100644 index 0000000..9d24d13 --- /dev/null +++ b/work/config/.env.example @@ -0,0 +1,19 @@ +# MeshAI Secrets Template +# Copy to /data/secrets/.env and fill in your values +# This file is gitignored - never commit real secrets + +# LLM API Keys (only one needed based on your backend choice) +OPENAI_API_KEY= +ANTHROPIC_API_KEY= +GOOGLE_API_KEY= + +# Mesh Source Credentials +MESHMONITOR_API_TOKEN= +MQTT_PASSWORD= + +# Environmental Feed Keys +TOMTOM_API_KEY= +FIRMS_MAP_KEY= + +# Notification Credentials +SMTP_PASSWORD= diff --git a/work/config/local.yaml.example b/work/config/local.yaml.example new file mode 100644 index 0000000..d78d3cb --- /dev/null +++ b/work/config/local.yaml.example @@ -0,0 +1,57 @@ +# MeshAI Local Configuration Template +# Copy to /data/config/local.yaml and customize for your deployment +# This file is gitignored - contains operator-identifying values + +# Operator Identity +identity: + name: "" # Bot display name + owner: "" # Owner callsign/name + primary_node_id: "" # Your main mesh node ID + contact_email: "" # For NWS user_agent, SMTP from + +# Region Coordinates +# Map your region names to their lat/lon center points +regions: + "Example Region": + lat: 0.0 + lon: 0.0 + # Add more regions as needed: + # "Another Region": + # lat: 42.5 + # lon: -114.5 + +# Mesh Data Source URLs +mesh_sources: + meshmonitor_url: "" # Your MeshMonitor instance + sources: + # Per-source URL overrides (matches names in mesh_sources.yaml) + "My-Meshview": + url: "" + # "My-MeshMonitor": + # url: "" + +# Infrastructure Hosts +infrastructure: + tcp_host: "" # Meshtastic TCP host (meshtasticd) + qdrant_host: "" # Qdrant vector DB (optional) + tei_host: "" # TEI embedding service (optional) + sparse_host: "" # Sparse embedding service (optional) + +# Environmental Feed Center Point +env_center: + latitude: 0.0 # Center of your coverage area + longitude: 0.0 + +# Notification Targets +notification_targets: + smtp_from: "" # Email from address + smtp_recipients: [] # Default email recipients + webhook_urls: [] # Webhook endpoints + alert_node_ids: [] # Node IDs for mesh DM alerts + +# Critical Infrastructure Nodes (short names) +critical_nodes: [] +# Example: +# critical_nodes: +# - "MHR" +# - "HPR" diff --git a/meshai/dashboard/static/index.html b/work/dashboard-frontend/index.html similarity index 79% rename from meshai/dashboard/static/index.html rename to work/dashboard-frontend/index.html index 5343e3f..f34f295 100644 --- a/meshai/dashboard/static/index.html +++ b/work/dashboard-frontend/index.html @@ -8,10 +8,9 @@ - -
+ diff --git a/work/dashboard-frontend/package.json b/work/dashboard-frontend/package.json new file mode 100644 index 0000000..9bd3910 --- /dev/null +++ b/work/dashboard-frontend/package.json @@ -0,0 +1,35 @@ +{ + "name": "meshai-dashboard", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "dependencies": { + "@types/d3": "^7.4.3", + "@types/leaflet": "^1.9.21", + "d3": "^7.9.0", + "echarts": "^6.0.0", + "echarts-for-react": "^3.0.6", + "leaflet": "^1.9.4", + "lucide-react": "^0.383.0", + "react": "^18.3.0", + "react-dom": "^18.3.0", + "react-leaflet": "^4.2.1", + "react-router-dom": "^6.23.0", + "recharts": "^2.12.0" + }, + "devDependencies": { + "@types/react": "^18.3.0", + "@types/react-dom": "^18.3.0", + "@vitejs/plugin-react": "^4.3.0", + "autoprefixer": "^10.4.0", + "postcss": "^8.4.0", + "tailwindcss": "^3.4.0", + "typescript": "^5.4.0", + "vite": "^5.4.0" + } +} diff --git a/work/dashboard-frontend/postcss.config.js b/work/dashboard-frontend/postcss.config.js new file mode 100644 index 0000000..2e7af2b --- /dev/null +++ b/work/dashboard-frontend/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/meshai/dashboard/static/meshai-icon.png b/work/dashboard-frontend/public/meshai-icon.png similarity index 100% rename from meshai/dashboard/static/meshai-icon.png rename to work/dashboard-frontend/public/meshai-icon.png diff --git a/meshai/dashboard/static/meshai-logo.png b/work/dashboard-frontend/public/meshai-logo.png similarity index 100% rename from meshai/dashboard/static/meshai-logo.png rename to work/dashboard-frontend/public/meshai-logo.png diff --git a/work/dashboard-frontend/src/App.tsx b/work/dashboard-frontend/src/App.tsx new file mode 100644 index 0000000..f66e17a --- /dev/null +++ b/work/dashboard-frontend/src/App.tsx @@ -0,0 +1,36 @@ +import { Routes, Route } from 'react-router-dom' +import Layout from './components/Layout' +import Dashboard from './pages/Dashboard' +import Mesh from './pages/Mesh' +import Environment from './pages/Environment' +import Config from './pages/Config' +import Alerts from './pages/Alerts' +import Notifications from './pages/Notifications' +import Reference from './pages/Reference' +import AdapterConfig from './pages/AdapterConfig' +import GaugeSites from './pages/GaugeSites' +import TownAnchors from './pages/TownAnchors' +import { ToastProvider } from './components/ToastProvider' + +function App() { + return ( + + + + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + + + ) +} + +export default App diff --git a/work/dashboard-frontend/src/components/ChannelPicker.tsx b/work/dashboard-frontend/src/components/ChannelPicker.tsx new file mode 100644 index 0000000..4b8577d --- /dev/null +++ b/work/dashboard-frontend/src/components/ChannelPicker.tsx @@ -0,0 +1,156 @@ +import { useState, useEffect } from 'react' +import { Check } from 'lucide-react' + +interface Channel { + index: number + name: string + role: string + enabled: boolean +} + +interface ChannelPickerSingleProps { + label: string + value: number + onChange: (value: number) => void + helper?: string + info?: string + mode: 'single' + includeDisabled?: boolean // Include a "Disabled (-1)" option +} + +interface ChannelPickerMultiProps { + label: string + value: number[] + onChange: (value: number[]) => void + helper?: string + info?: string + mode: 'multi' +} + +type ChannelPickerProps = ChannelPickerSingleProps | ChannelPickerMultiProps + +export default function ChannelPicker(props: ChannelPickerProps) { + const [channels, setChannels] = useState([]) + const [loading, setLoading] = useState(true) + + useEffect(() => { + fetch('/api/channels') + .then(res => res.json()) + .then(data => { + setChannels(data) + setLoading(false) + }) + .catch(() => { + setChannels([]) + setLoading(false) + }) + }, []) + + const formatChannel = (ch: Channel): string => { + const roleLabel = ch.role === 'PRIMARY' ? 'Primary' : + ch.role === 'SECONDARY' ? 'Secondary' : '' + return `${ch.index}: ${ch.name}${roleLabel ? ` (${roleLabel})` : ''}` + } + + // Fallback to number input if no channels loaded + if (!loading && channels.length === 0) { + if (props.mode === 'single') { + return ( +
+ + props.onChange(Number(e.target.value))} + min={props.includeDisabled ? -1 : 0} + max={7} + className="w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent" + /> + {props.helper &&

{props.helper}

} +
+ ) + } else { + return ( +
+ + { + const nums = e.target.value.split(',').map(s => parseInt(s.trim())).filter(n => !isNaN(n)) + props.onChange(nums) + }} + placeholder="Enter channel numbers separated by commas" + className="w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent" + /> + {props.helper &&

{props.helper}

} +
+ ) + } + } + + // Single select mode - dropdown + if (props.mode === 'single') { + const { value, onChange, label, helper, includeDisabled } = props + const enabledChannels = channels.filter(ch => ch.enabled) + + return ( +
+ + + {helper &&

{helper}

} +
+ ) + } + + // Multi select mode - checkboxes + const { value, onChange, label, helper } = props + const enabledChannels = channels.filter(ch => ch.enabled) + + const toggleChannel = (index: number) => { + if (value.includes(index)) { + onChange(value.filter(v => v !== index)) + } else { + onChange([...value, index].sort((a, b) => a - b)) + } + } + + return ( +
+ +
+ {enabledChannels.map((ch) => ( + + ))} + {enabledChannels.length === 0 && ( +
No channels available
+ )} +
+ {helper &&

{helper}

} +
+ ) +} diff --git a/work/dashboard-frontend/src/components/GeoMap.tsx b/work/dashboard-frontend/src/components/GeoMap.tsx new file mode 100644 index 0000000..b206ea5 --- /dev/null +++ b/work/dashboard-frontend/src/components/GeoMap.tsx @@ -0,0 +1,267 @@ +import { useEffect, useMemo } from 'react' +import { MapContainer, TileLayer, CircleMarker, Polyline, Popup, Tooltip, useMap } from 'react-leaflet' +import type { LatLngBoundsExpression, LatLngTuple } from 'leaflet' +import 'leaflet/dist/leaflet.css' +import type { NodeInfo, EdgeInfo } from '@/lib/api' +import { ExternalLink, MapPin } from 'lucide-react' + +// Fix Leaflet default marker icon issue with Vite +import L from 'leaflet' +import markerIcon from 'leaflet/dist/images/marker-icon.png' +import markerIcon2x from 'leaflet/dist/images/marker-icon-2x.png' +import markerShadow from 'leaflet/dist/images/marker-shadow.png' + +// @ts-expect-error - Leaflet icon fix +delete L.Icon.Default.prototype._getIconUrl +L.Icon.Default.mergeOptions({ + iconUrl: markerIcon, + iconRetinaUrl: markerIcon2x, + shadowUrl: markerShadow, +}) + +interface GeoMapProps { + nodes: NodeInfo[] + edges: EdgeInfo[] + selectedNodeId: number | null + onSelectNode: (nodeId: number | null) => void +} + +const REGION_COLORS = ['#3b82f6', '#a78bfa', '#06b6d4', '#f59e0b', '#22c55e', '#ec4899', '#8b5cf6', '#14b8a6'] +const INFRA_ROLES = ['ROUTER', 'ROUTER_LATE', 'REPEATER', 'TRACKER'] + +function getQualityColor(snr: number): string { + if (snr > 12) return '#22c55e' + if (snr > 8) return '#4ade80' + if (snr > 5) return '#f59e0b' + if (snr > 3) return '#f97316' + return '#ef4444' +} + +function getRegionIndex(lat: number | null): number { + if (lat === null) return 0 + if (lat > 46) return 0 + if (lat > 44.5) return 1 + if (lat > 43) return 2 + return 3 +} + +function formatLastHeard(lastHeard: string | null): string { + if (!lastHeard) return 'Unknown' + const date = new Date(lastHeard) + const now = new Date() + const diffMs = now.getTime() - date.getTime() + const diffMins = Math.floor(diffMs / 60000) + const diffHours = Math.floor(diffMs / 3600000) + const diffDays = Math.floor(diffMs / 86400000) + + if (diffMins < 1) return 'Just now' + if (diffMins < 60) return `${diffMins}m ago` + if (diffHours < 24) return `${diffHours}h ago` + return `${diffDays}d ago` +} + +// Component to fit bounds on mount +function FitBounds({ bounds }: { bounds: LatLngBoundsExpression | null }) { + const map = useMap() + + useEffect(() => { + if (bounds) { + map.fitBounds(bounds, { padding: [50, 50] }) + } + }, [map, bounds]) + + return null +} + +interface NodePopupProps { + node: NodeInfo +} + +function NodePopup({ node }: NodePopupProps) { + const hasCoords = node.latitude !== null && node.longitude !== null + const batteryText = node.battery_level !== null + ? (node.battery_level > 100 || (node.voltage && node.voltage > 4.1) ? 'USB ⚡' : `${node.battery_level.toFixed(0)}%`) + : 'Unknown' + + return ( +
+
{node.short_name}
+
{node.long_name}
+ +
+
Role
+
{node.role}
+ +
Hardware
+
{node.hardware || 'Unknown'}
+ +
Battery
+
{batteryText}
+ +
Last Heard
+
{formatLastHeard(node.last_heard)}
+
+ + {hasCoords && ( + + )} +
+ ) +} + +export default function GeoMap({ + nodes, + edges, + selectedNodeId, + onSelectNode, +}: GeoMapProps) { + // Filter nodes with valid coordinates + const geoNodes = useMemo(() => + nodes.filter((n) => n.latitude !== null && n.longitude !== null), + [nodes] + ) + + const nodesWithoutCoords = nodes.length - geoNodes.length + + // Create node map for edge lookup + const nodeMap = useMemo(() => + new Map(geoNodes.map((n) => [n.node_num, n])), + [geoNodes] + ) + + // Filter edges where both nodes have coordinates + const geoEdges = useMemo(() => + edges.filter((e) => nodeMap.has(e.from_node) && nodeMap.has(e.to_node)), + [edges, nodeMap] + ) + + // Calculate bounds + const bounds = useMemo((): LatLngBoundsExpression | null => { + if (geoNodes.length === 0) return null + const lats = geoNodes.map((n) => n.latitude!) + const lons = geoNodes.map((n) => n.longitude!) + return [ + [Math.min(...lats), Math.min(...lons)], + [Math.max(...lats), Math.max(...lons)], + ] + }, [geoNodes]) + + // Default center (Idaho) + const defaultCenter: LatLngTuple = [43.6, -114.4] + + // Get neighbors of selected node + const selectedNeighbors = useMemo(() => { + const neighbors = new Set() + if (selectedNodeId !== null) { + edges.forEach((e) => { + if (e.from_node === selectedNodeId) neighbors.add(e.to_node) + if (e.to_node === selectedNodeId) neighbors.add(e.from_node) + }) + } + return neighbors + }, [selectedNodeId, edges]) + + return ( +
+ + + + + + {/* Edges */} + {geoEdges.map((edge, i) => { + const fromNode = nodeMap.get(edge.from_node)! + const toNode = nodeMap.get(edge.to_node)! + const isRelated = selectedNodeId === null || + edge.from_node === selectedNodeId || + edge.to_node === selectedNodeId + + return ( + + ) + })} + + {/* Nodes */} + {geoNodes.map((node) => { + const isSelected = node.node_num === selectedNodeId + const isNeighbor = selectedNeighbors.has(node.node_num) + const isRelated = selectedNodeId === null || isSelected || isNeighbor + const isInfra = INFRA_ROLES.includes(node.role) + const regionIndex = getRegionIndex(node.latitude) + const color = REGION_COLORS[regionIndex % REGION_COLORS.length] + + return ( + onSelectNode(isSelected ? null : node.node_num), + }} + > + + {node.short_name} + + + + + + ) + })} + + + {/* Stats overlay */} +
+ + + Showing {geoNodes.length} of {nodes.length} nodes + {nodesWithoutCoords > 0 && ( + ({nodesWithoutCoords} without coordinates) + )} + +
+
+ ) +} diff --git a/work/dashboard-frontend/src/components/Layout.tsx b/work/dashboard-frontend/src/components/Layout.tsx new file mode 100644 index 0000000..07fa702 --- /dev/null +++ b/work/dashboard-frontend/src/components/Layout.tsx @@ -0,0 +1,185 @@ +import { ReactNode, useEffect, useState } from 'react' +import { Link, useLocation } from 'react-router-dom' +import { + LayoutDashboard, + Radio, + Cloud, + Settings, + Bell, + BellRing, + BookOpen, + Sliders, + Droplets, + MapPin, +} from 'lucide-react' +import { fetchStatus, type SystemStatus } from '@/lib/api' +import { useWebSocket } from '@/hooks/useWebSocket' +import { useToast } from './ToastProvider' +import RestartBanner from './RestartBanner' + +interface LayoutProps { + children: ReactNode +} + +const navItems = [ + { path: '/', label: 'Dashboard', icon: LayoutDashboard }, + { path: '/mesh', label: 'Mesh', icon: Radio }, + { path: '/environment', label: 'Environment', icon: Cloud }, + { path: '/config', label: 'Config', icon: Settings }, + { path: '/alerts', label: 'Alerts', icon: Bell }, + { path: '/notifications', label: 'Notifications', icon: BellRing }, + { path: '/reference', label: 'Reference', icon: BookOpen }, + { path: '/adapter-config', label: 'Adapter Config', icon: Sliders }, + { path: '/gauge-sites', label: 'Gauge Sites', icon: Droplets }, + { path: '/town-anchors', label: 'Town Anchors', icon: MapPin }, +] + +function formatUptime(seconds: number): string { + const days = Math.floor(seconds / 86400) + const hours = Math.floor((seconds % 86400) / 3600) + const mins = Math.floor((seconds % 3600) / 60) + + if (days > 0) return `${days}d ${hours}h` + if (hours > 0) return `${hours}h ${mins}m` + return `${mins}m` +} + +function getPageTitle(pathname: string): string { + const item = navItems.find((i) => i.path === pathname) + return item?.label || 'Dashboard' +} + +export default function Layout({ children }: LayoutProps) { + const location = useLocation() + const { connected, lastAlert } = useWebSocket() + const { addToast } = useToast() + const [status, setStatus] = useState(null) + const [lastAlertId, setLastAlertId] = useState(null) + + // Trigger toast on new alerts + useEffect(() => { + if (lastAlert) { + const alertId = `${lastAlert.type}-${lastAlert.message}-${lastAlert.timestamp}` + if (alertId !== lastAlertId) { + setLastAlertId(alertId) + addToast(lastAlert) + } + } + }, [lastAlert, lastAlertId, addToast]) + const [currentTime, setCurrentTime] = useState(new Date()) + + useEffect(() => { + fetchStatus().then(setStatus).catch(console.error) + const interval = setInterval(() => { + fetchStatus().then(setStatus).catch(console.error) + }, 30000) + return () => clearInterval(interval) + }, []) + + useEffect(() => { + const interval = setInterval(() => setCurrentTime(new Date()), 1000) + return () => clearInterval(interval) + }, []) + + const timeStr = currentTime.toLocaleTimeString('en-US', { + hour12: false, + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + }) + + return ( +
+ {/* Sidebar */} + + + {/* Main content */} +
+ {/* Header */} +
+

+ {getPageTitle(location.pathname)} +

+
+ {/* Live indicator */} +
+
+ + {connected ? 'Live' : 'Offline'} + +
+ {/* Clock */} +
+ {timeStr} MT +
+
+
+ + {/* Page content */} +
+ {children}
+
+
+ ) +} diff --git a/work/dashboard-frontend/src/components/NodeDetail.tsx b/work/dashboard-frontend/src/components/NodeDetail.tsx new file mode 100644 index 0000000..0090144 --- /dev/null +++ b/work/dashboard-frontend/src/components/NodeDetail.tsx @@ -0,0 +1,248 @@ +import { useMemo } from 'react' +import { ExternalLink, Radio, Zap } from 'lucide-react' +import type { NodeInfo, EdgeInfo } from '@/lib/api' + +interface NodeDetailProps { + node: NodeInfo | null + edges: EdgeInfo[] + nodes: NodeInfo[] + onSelectNode: (nodeId: number) => void +} + +const REGION_COLORS = ['#3b82f6', '#a78bfa', '#06b6d4', '#f59e0b', '#22c55e', '#ec4899', '#8b5cf6', '#14b8a6'] +const INFRA_ROLES = ['ROUTER', 'ROUTER_LATE', 'REPEATER', 'TRACKER'] + +function getQualityColor(snr: number): string { + if (snr > 12) return '#22c55e' + if (snr > 8) return '#4ade80' + if (snr > 5) return '#f59e0b' + if (snr > 3) return '#f97316' + return '#ef4444' +} + +function getQualityLabel(snr: number): string { + if (snr > 12) return 'excellent' + if (snr > 8) return 'good' + if (snr > 5) return 'fair' + if (snr > 3) return 'marginal' + return 'poor' +} + +function getRegionIndex(lat: number | null): number { + if (lat === null) return 0 + if (lat > 46) return 0 + if (lat > 44.5) return 1 + if (lat > 43) return 2 + return 3 +} + +function getRegionName(index: number): string { + const names = ['Northern ID', 'Central ID', 'SW Idaho', 'SC Idaho'] + return names[index] || 'Unknown' +} + +function formatLastHeard(lastHeard: string | null): string { + if (!lastHeard) return 'Unknown' + const date = new Date(lastHeard) + const now = new Date() + const diffMs = now.getTime() - date.getTime() + const diffMins = Math.floor(diffMs / 60000) + const diffHours = Math.floor(diffMs / 3600000) + const diffDays = Math.floor(diffMs / 86400000) + + if (diffMins < 1) return 'Just now' + if (diffMins < 60) return `${diffMins}m ago` + if (diffHours < 24) return `${diffHours}h ago` + return `${diffDays}d ago` +} + +function getStatusColor(lastHeard: string | null): string { + if (!lastHeard) return 'bg-slate-500' + const date = new Date(lastHeard) + const now = new Date() + const diffHours = (now.getTime() - date.getTime()) / 3600000 + if (diffHours < 1) return 'bg-green-500' + if (diffHours < 24) return 'bg-amber-500' + return 'bg-slate-500' +} + +export default function NodeDetail({ + node, + edges, + nodes, + onSelectNode, +}: NodeDetailProps) { + // Get neighbors with edge info + const neighbors = useMemo(() => { + if (!node) return [] + + const nodeMap = new Map(nodes.map((n) => [n.node_num, n])) + const neighborData: Array<{ + node: NodeInfo + snr: number + quality: string + }> = [] + + edges.forEach((e) => { + if (e.from_node === node.node_num) { + const neighbor = nodeMap.get(e.to_node) + if (neighbor) { + neighborData.push({ node: neighbor, snr: e.snr, quality: e.quality }) + } + } else if (e.to_node === node.node_num) { + const neighbor = nodeMap.get(e.from_node) + if (neighbor) { + neighborData.push({ node: neighbor, snr: e.snr, quality: e.quality }) + } + } + }) + + // SNR quality bands (also the legend behind the colored quality dots): + // >12 excellent — reliable mesh hop + // 8-12 good + // 5-8 fair — works in clear conditions + // 3-5 marginal — will drop under load + // <3 poor — intermittent + // Sort by SNR descending + return neighborData.sort((a, b) => b.snr - a.snr) + }, [node, edges, nodes]) + + if (!node) { + return ( +
+
+ +
+

+ Click a node to inspect +

+
+ ) + } + + const isInfra = INFRA_ROLES.includes(node.role) + const regionIndex = getRegionIndex(node.latitude) + const regionColor = REGION_COLORS[regionIndex % REGION_COLORS.length] + const hasCoords = node.latitude !== null && node.longitude !== null + const batteryText = node.battery_level !== null + ? (node.battery_level > 100 || (node.voltage && node.voltage > 4.1) ? 'USB' : `${node.battery_level.toFixed(0)}%`) + : '—' + const isPowered = node.battery_level !== null && (node.battery_level > 100 || (node.voltage && node.voltage > 4.1)) + + return ( +
+ {/* Header */} +
+ {/* Node ID badge */} +
+ {node.node_id_hex} +
+ + {/* Name */} +
{node.short_name}
+
{node.long_name}
+
+ + {/* Info grid */} +
+
+
Role
+
+ {node.role} +
+
+
+
Region
+
{getRegionName(regionIndex)}
+
+
+
Battery
+
+ {isPowered && } + {batteryText} +
+
+
+
Status
+
+
+ {formatLastHeard(node.last_heard)} +
+
+
+
Hardware
+
+ {node.hardware || 'Unknown'} +
+
+
+ + {/* External links */} + {hasCoords && ( + + )} + + {/* Neighbors */} +
+
+ Neighbors ({neighbors.length}) +
+ {neighbors.length > 0 ? ( +
+ {neighbors.map((n) => ( + + ))} +
+ ) : ( +
+ No known neighbors +
+ )} +
+
+ ) +} diff --git a/work/dashboard-frontend/src/components/NodePicker.tsx b/work/dashboard-frontend/src/components/NodePicker.tsx new file mode 100644 index 0000000..9d1063b --- /dev/null +++ b/work/dashboard-frontend/src/components/NodePicker.tsx @@ -0,0 +1,210 @@ +import { useState, useEffect, useMemo } from 'react' +import { Search, X, Check } from 'lucide-react' + +interface Node { + node_num: number + node_id_hex: string + short_name: string + long_name: string + role: string + is_infrastructure?: boolean +} + +interface NodePickerProps { + label: string + value: string[] + onChange: (value: string[]) => void + helper?: string + info?: string + roleFilter?: string // e.g., "ROUTER" to show only infrastructure + valueType?: 'short_name' | 'node_num' | 'node_id_hex' // What to store in value +} + +export default function NodePicker({ + label, + value, + onChange, + helper, + info: _info, + roleFilter, + valueType = 'short_name', +}: NodePickerProps) { + const [nodes, setNodes] = useState([]) + const [loading, setLoading] = useState(true) + const [search, setSearch] = useState('') + const [isOpen, setIsOpen] = useState(false) + + useEffect(() => { + fetch('/api/nodes') + .then(res => res.json()) + .then(data => { + setNodes(data) + setLoading(false) + }) + .catch(() => { + setNodes([]) + setLoading(false) + }) + }, []) + + const filteredNodes = useMemo(() => { + let result = nodes + + // Filter by role if specified + if (roleFilter) { + result = result.filter(n => { + if (roleFilter === 'ROUTER' || roleFilter === 'infrastructure') { + return n.is_infrastructure || + n.role === 'ROUTER' || + n.role === 'ROUTER_CLIENT' || + n.role === 'REPEATER' + } + return n.role === roleFilter + }) + } + + // Filter by search + if (search.trim()) { + const s = search.toLowerCase() + result = result.filter(n => + n.short_name?.toLowerCase().includes(s) || + n.long_name?.toLowerCase().includes(s) || + n.role?.toLowerCase().includes(s) || + n.node_id_hex?.toLowerCase().includes(s) + ) + } + + return result.sort((a, b) => (a.short_name || '').localeCompare(b.short_name || '')) + }, [nodes, search, roleFilter]) + + const getNodeValue = (node: Node): string => { + switch (valueType) { + case 'node_num': + return String(node.node_num) + case 'node_id_hex': + return node.node_id_hex + default: + return node.short_name || String(node.node_num) + } + } + + const isSelected = (node: Node): boolean => { + const nodeVal = getNodeValue(node) + return value.includes(nodeVal) + } + + const toggleNode = (node: Node) => { + const nodeVal = getNodeValue(node) + if (value.includes(nodeVal)) { + onChange(value.filter(v => v !== nodeVal)) + } else { + onChange([...value, nodeVal]) + } + } + + const formatNodeDisplay = (node: Node): string => { + const parts = [node.short_name] + if (node.long_name && node.long_name !== node.short_name) { + parts.push(`— ${node.long_name}`) + } + if (node.role) { + parts.push(`(${node.role})`) + } + return parts.join(' ') + } + + // Fallback to text input if no nodes loaded + if (!loading && nodes.length === 0) { + return ( +
+ + onChange(e.target.value.split(',').map(s => s.trim()).filter(Boolean))} + placeholder="Enter node IDs separated by commas" + className="w-full px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 font-mono focus:outline-none focus:border-accent" + /> + {helper &&

{helper}

} +
+ ) + } + + return ( +
+ + + {/* Selected nodes display */} + {value.length > 0 && ( +
+ {value.map((v) => { + const node = nodes.find(n => getNodeValue(n) === v) + return ( + + {node ? node.short_name : v} + + + ) + })} +
+ )} + + {/* Search and dropdown */} +
+
+ + setSearch(e.target.value)} + onFocus={() => setIsOpen(true)} + placeholder={loading ? "Loading nodes..." : "Search nodes..."} + className="w-full pl-9 pr-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent" + /> +
+ + {isOpen && !loading && ( + <> +
setIsOpen(false)} /> +
+ {filteredNodes.length === 0 ? ( +
+ No nodes found +
+ ) : ( + filteredNodes.map((node) => ( + + )) + )} +
+ + )} +
+ + {helper &&

{helper}

} +
+ ) +} diff --git a/work/dashboard-frontend/src/components/NodeTable.tsx b/work/dashboard-frontend/src/components/NodeTable.tsx new file mode 100644 index 0000000..8e060cf --- /dev/null +++ b/work/dashboard-frontend/src/components/NodeTable.tsx @@ -0,0 +1,296 @@ +import { useState, useMemo } from 'react' +import { ChevronUp, ChevronDown, Search, Filter } from 'lucide-react' +import type { NodeInfo } from '@/lib/api' + +interface NodeTableProps { + nodes: NodeInfo[] + selectedNodeId: number | null + onSelectNode: (nodeId: number) => void +} + +type SortField = 'short_name' | 'role' | 'battery_level' | 'last_heard' | 'hardware' +type SortDir = 'asc' | 'desc' +type QuickFilter = 'all' | 'infra' | 'online' + +const INFRA_ROLES = ['ROUTER', 'ROUTER_LATE', 'REPEATER', 'TRACKER'] + +function getStatusColor(lastHeard: string | null): string { + if (!lastHeard) return 'bg-slate-500' + const date = new Date(lastHeard) + const now = new Date() + const diffHours = (now.getTime() - date.getTime()) / 3600000 + if (diffHours < 1) return 'bg-green-500' + if (diffHours < 24) return 'bg-amber-500' + return 'bg-slate-500' +} + +function formatLastHeard(lastHeard: string | null): string { + if (!lastHeard) return '—' + const date = new Date(lastHeard) + const now = new Date() + const diffMs = now.getTime() - date.getTime() + const diffMins = Math.floor(diffMs / 60000) + const diffHours = Math.floor(diffMs / 3600000) + const diffDays = Math.floor(diffMs / 86400000) + + if (diffMins < 1) return 'Just now' + if (diffMins < 60) return `${diffMins}m ago` + if (diffHours < 24) return `${diffHours}h ago` + return `${diffDays}d ago` +} + +function formatBattery(node: NodeInfo): string { + if (node.battery_level === null) return '—' + if (node.battery_level > 100 || (node.voltage && node.voltage > 4.1)) { + return 'USB ⚡' + } + return `${node.battery_level.toFixed(0)}%` +} + +function getRegionName(lat: number | null): string { + if (lat === null) return '—' + if (lat > 46) return 'Northern' + if (lat > 44.5) return 'Central' + if (lat > 43) return 'SW Idaho' + return 'SC Idaho' +} + +export default function NodeTable({ + nodes, + selectedNodeId, + onSelectNode, +}: NodeTableProps) { + const [searchTerm, setSearchTerm] = useState('') + const [sortField, setSortField] = useState('short_name') + const [sortDir, setSortDir] = useState('asc') + const [quickFilter, setQuickFilter] = useState('all') + + // Filter and sort nodes + const filteredNodes = useMemo(() => { + let result = [...nodes] + + // Quick filter + if (quickFilter === 'infra') { + result = result.filter((n) => INFRA_ROLES.includes(n.role)) + } else if (quickFilter === 'online') { + result = result.filter((n) => { + if (!n.last_heard) return false + const date = new Date(n.last_heard) + const now = new Date() + const diffHours = (now.getTime() - date.getTime()) / 3600000 + return diffHours < 1 + }) + } + + // Search filter + if (searchTerm) { + const term = searchTerm.toLowerCase() + result = result.filter((n) => + n.short_name.toLowerCase().includes(term) || + n.long_name.toLowerCase().includes(term) || + n.role.toLowerCase().includes(term) || + getRegionName(n.latitude).toLowerCase().includes(term) + ) + } + + // Sort + result.sort((a, b) => { + let aVal: string | number = '' + let bVal: string | number = '' + + switch (sortField) { + case 'short_name': + aVal = a.short_name.toLowerCase() + bVal = b.short_name.toLowerCase() + break + case 'role': + aVal = a.role + bVal = b.role + break + case 'battery_level': + aVal = a.battery_level ?? -1 + bVal = b.battery_level ?? -1 + break + case 'last_heard': + aVal = a.last_heard ? new Date(a.last_heard).getTime() : 0 + bVal = b.last_heard ? new Date(b.last_heard).getTime() : 0 + break + case 'hardware': + aVal = a.hardware.toLowerCase() + bVal = b.hardware.toLowerCase() + break + } + + if (aVal < bVal) return sortDir === 'asc' ? -1 : 1 + if (aVal > bVal) return sortDir === 'asc' ? 1 : -1 + return 0 + }) + + return result + }, [nodes, searchTerm, sortField, sortDir, quickFilter]) + + const handleSort = (field: SortField) => { + if (sortField === field) { + setSortDir(sortDir === 'asc' ? 'desc' : 'asc') + } else { + setSortField(field) + setSortDir('asc') + } + } + + const SortIcon = ({ field }: { field: SortField }) => { + if (sortField !== field) return null + return sortDir === 'asc' ? ( + + ) : ( + + ) + } + + return ( +
+ {/* Filter bar */} +
+ {/* Search */} +
+ + setSearchTerm(e.target.value)} + className="w-full pl-9 pr-3 py-1.5 bg-bg-hover border border-border rounded text-sm text-slate-200 placeholder-slate-500 focus:outline-none focus:border-accent" + /> +
+ + {/* Quick filters */} +
+ + {(['all', 'infra', 'online'] as QuickFilter[]).map((filter) => ( + + ))} +
+ + {/* Count */} +
+ {filteredNodes.length} of {nodes.length} nodes +
+
+ + {/* Table */} +
+ + + + + + + + + + + + + + {filteredNodes.slice(0, 100).map((node) => { + const isInfra = INFRA_ROLES.includes(node.role) + const isSelected = node.node_num === selectedNodeId + + return ( + onSelectNode(node.node_num)} + className={`cursor-pointer transition-colors ${ + isSelected + ? 'bg-accent/10' + : 'hover:bg-bg-hover' + }`} + > + + + + + + + + + ) + })} + +
handleSort('short_name')} + > + Name + handleSort('role')} + > + Role + Region handleSort('battery_level')} + > + Battery + handleSort('last_heard')} + > + Last Heard + handleSort('hardware')} + > + Hardware +
+
+
+
{node.short_name}
+
+ {node.long_name} +
+
+ + {node.role} + + + {getRegionName(node.latitude)} + + {formatBattery(node)} + + {formatLastHeard(node.last_heard)} + + {node.hardware || '—'} +
+ + {filteredNodes.length > 100 && ( +
+ Showing first 100 of {filteredNodes.length} nodes +
+ )} + + {filteredNodes.length === 0 && ( +
+ No nodes match your filters +
+ )} +
+
+ ) +} diff --git a/work/dashboard-frontend/src/components/RestartBanner.tsx b/work/dashboard-frontend/src/components/RestartBanner.tsx new file mode 100644 index 0000000..db1c2e9 --- /dev/null +++ b/work/dashboard-frontend/src/components/RestartBanner.tsx @@ -0,0 +1,136 @@ +// v0.6-tail-3 RestartBanner.tsx +// +// Sticky top banner that becomes visible when any /api/config/
PUT +// returns restart_required:true. Reads from localStorage so the banner +// persists across page navigations until the user explicitly restarts or +// dismisses. +// +// Producer: pages doing a config PUT call notifyRestartRequired(...). +// Consumer: this component, mounted once at the Layout level, listens to +// the 'meshai:restart-required' window CustomEvent and to the 'storage' +// event so a tab opened in two windows stays in sync. + +import { useEffect, useState, useCallback } from 'react' +import { AlertTriangle, RotateCw, X } from 'lucide-react' + +const LS_KEY = 'meshai.restartRequired.v1' + +interface RestartState { + required: boolean + changedKeys: string[] + ts: number // when the most recent restart-required PUT happened +} + + +function readState(): RestartState { + try { + const raw = localStorage.getItem(LS_KEY) + if (!raw) return { required: false, changedKeys: [], ts: 0 } + const parsed = JSON.parse(raw) + return { + required: Boolean(parsed.required), + changedKeys: Array.isArray(parsed.changedKeys) ? parsed.changedKeys : [], + ts: Number(parsed.ts) || 0, + } + } catch { + return { required: false, changedKeys: [], ts: 0 } + } +} + + +export function notifyRestartRequired(changedKeys: string[]) { + const state: RestartState = { + required: true, + changedKeys: [...new Set(changedKeys)], + ts: Date.now(), + } + localStorage.setItem(LS_KEY, JSON.stringify(state)) + window.dispatchEvent(new CustomEvent('meshai:restart-required', { detail: state })) +} + + +export function clearRestartRequired() { + localStorage.removeItem(LS_KEY) + window.dispatchEvent(new CustomEvent('meshai:restart-required', + { detail: { required: false, changedKeys: [], ts: 0 } })) +} + + +export default function RestartBanner() { + const [state, setState] = useState(() => readState()) + const [restarting, setRestarting] = useState(false) + const [error, setError] = useState(null) + + // Subscribe to both same-tab CustomEvent and cross-tab storage event. + useEffect(() => { + const onCustom = (e: Event) => { + const detail = (e as CustomEvent).detail as RestartState + setState(detail) + } + const onStorage = (e: StorageEvent) => { + if (e.key === LS_KEY) setState(readState()) + } + window.addEventListener('meshai:restart-required', onCustom) + window.addEventListener('storage', onStorage) + return () => { + window.removeEventListener('meshai:restart-required', onCustom) + window.removeEventListener('storage', onStorage) + } + }, []) + + const onRestart = useCallback(async () => { + setRestarting(true) + setError(null) + try { + const res = await fetch('/api/system/restart', { method: 'POST' }) + if (!res.ok && res.status !== 202) { + const body = await res.json().catch(() => ({})) + throw new Error(body.detail || `HTTP ${res.status}`) + } + // Clear the banner immediately; the container will tear down and the + // dashboard will need a refresh anyway. + clearRestartRequired() + } catch (e) { + setError(String(e)) + setRestarting(false) + } + }, []) + + const onDismiss = useCallback(() => { + clearRestartRequired() + }, []) + + if (!state.required) return null + + return ( +
+ +
+ Container restart required + {state.changedKeys.length > 0 && ( + + ({state.changedKeys.length} key{state.changedKeys.length === 1 ? '' : 's'}:{' '} + {state.changedKeys.slice(0, 3).join(', ')}{state.changedKeys.length > 3 ? ', …' : ''}) + + )} + + for these changes to take effect. Until then the runtime keeps its boot-time configuration. Restart-required keys include anything under Config → environmental (feed_source, central URL), the LLM backend swap, and the dispatcher cold-start grace window. Other keys take effect on the next handler call. + + {error &&
{error}
} +
+ + +
+ ) +} diff --git a/work/dashboard-frontend/src/components/ToastProvider.tsx b/work/dashboard-frontend/src/components/ToastProvider.tsx new file mode 100644 index 0000000..52d3697 --- /dev/null +++ b/work/dashboard-frontend/src/components/ToastProvider.tsx @@ -0,0 +1,141 @@ +import { createContext, useContext, useState, useCallback, useEffect, ReactNode } from 'react' +import { useNavigate } from 'react-router-dom' +import { AlertTriangle, AlertCircle, Info, X } from 'lucide-react' +import type { Alert } from '@/lib/api' + +interface Toast { + id: string + alert: Alert + dismissedAt?: number +} + +interface ToastContextValue { + addToast: (alert: Alert) => void +} + +const ToastContext = createContext(null) + +export function useToast() { + const context = useContext(ToastContext) + if (!context) { + throw new Error('useToast must be used within a ToastProvider') + } + return context +} + +function getSeverityStyles(severity: string) { + switch (severity?.toLowerCase()) { + case 'critical': + case 'emergency': + return { + bg: 'bg-red-500/10', + border: 'border-red-500', + icon: AlertCircle, + iconColor: 'text-red-500', + } + case 'warning': + return { + bg: 'bg-amber-500/10', + border: 'border-amber-500', + icon: AlertTriangle, + iconColor: 'text-amber-500', + } + default: + return { + bg: 'bg-sky-400/10', + border: 'border-sky-400', + icon: Info, + iconColor: 'text-sky-400', + } + } +} + +function ToastItem({ + toast, + onDismiss, + onNavigate, +}: { + toast: Toast + onDismiss: () => void + onNavigate: () => void +}) { + const styles = getSeverityStyles(toast.alert.severity) + const Icon = styles.icon + + // Auto-dismiss after 8 seconds + useEffect(() => { + const timer = setTimeout(onDismiss, 8000) + return () => clearTimeout(timer) + }, [onDismiss]) + + return ( +
+
+ {/* Severity bar */} +
+ + + +
+
+ {toast.alert.type.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())} +
+
+ {toast.alert.message} +
+
+ + +
+
+ ) +} + +export function ToastProvider({ children }: { children: ReactNode }) { + const [toasts, setToasts] = useState([]) + const navigate = useNavigate() + + const addToast = useCallback((alert: Alert) => { + const id = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}` + setToasts((prev) => [...prev, { id, alert }]) + }, []) + + const dismissToast = useCallback((id: string) => { + setToasts((prev) => prev.filter((t) => t.id !== id)) + }, []) + + const handleNavigate = useCallback(() => { + navigate('/alerts') + }, [navigate]) + + return ( + + {children} + + {/* Toast container - fixed bottom right */} +
+ {toasts.map((toast) => ( +
+ dismissToast(toast.id)} + onNavigate={handleNavigate} + /> +
+ ))} +
+
+ ) +} diff --git a/work/dashboard-frontend/src/components/TopologyGraph.tsx b/work/dashboard-frontend/src/components/TopologyGraph.tsx new file mode 100644 index 0000000..07dc603 --- /dev/null +++ b/work/dashboard-frontend/src/components/TopologyGraph.tsx @@ -0,0 +1,316 @@ +import { useEffect, useRef, useMemo, useState, useCallback } from 'react' +import ReactECharts from 'echarts-for-react' +import type { EChartsOption } from 'echarts' +import { Filter } from 'lucide-react' +import type { NodeInfo, EdgeInfo } from '@/lib/api' + +interface TopologyGraphProps { + nodes: NodeInfo[] + edges: EdgeInfo[] + selectedNodeId: number | null + onSelectNode: (nodeId: number | null) => void +} + +const REGION_COLORS = ['#3b82f6', '#a78bfa', '#06b6d4', '#f59e0b', '#22c55e', '#ec4899', '#8b5cf6', '#14b8a6'] +const INFRA_ROLES = ['ROUTER', 'ROUTER_LATE', 'REPEATER', 'TRACKER'] + +function getQualityColor(snr: number): string { + if (snr > 12) return '#22c55e' + if (snr > 8) return '#4ade80' + if (snr > 5) return '#f59e0b' + if (snr > 3) return '#f97316' + return '#ef4444' +} + +function getRegionIndex(lat: number | null): number { + if (lat === null) return 0 + if (lat > 46) return 0 + if (lat > 44.5) return 1 + if (lat > 43) return 2 + return 3 +} + +function getNodeSize(role: string): number { + if (role === 'ROUTER' || role === 'ROUTER_LATE') return 30 + if (role === 'REPEATER' || role === 'TRACKER') return 25 + if (role === 'CLIENT_MUTE') return 7 + if (role === 'CLIENT_BASE') return 12 + return 15 // CLIENT and others +} + +type FilterMode = 'all' | 'infra' | 'connected' + +export default function TopologyGraph({ + nodes, + edges, + selectedNodeId, + onSelectNode, +}: TopologyGraphProps) { + const chartRef = useRef(null) + const [filterMode, setFilterMode] = useState('connected') + + // Build set of node IDs that have at least one edge + const connectedNodeIds = useMemo(() => { + const ids = new Set() + edges.forEach((e) => { + ids.add(e.from_node) + ids.add(e.to_node) + }) + return ids + }, [edges]) + + // Filter nodes based on mode + const filteredNodes = useMemo(() => { + let result = nodes + + if (filterMode === 'connected') { + // Only nodes with edges (like Meshview) + result = result.filter((n) => connectedNodeIds.has(n.node_num)) + } else if (filterMode === 'infra') { + // Only infrastructure nodes + result = result.filter((n) => INFRA_ROLES.includes(n.role)) + } + + return result + }, [nodes, filterMode, connectedNodeIds]) + + // Build node map for quick lookup + const nodeMap = useMemo(() => { + return new Map(filteredNodes.map((n) => [n.node_num, n])) + }, [filteredNodes]) + + // Filter edges to only include those between filtered nodes + const filteredEdges = useMemo(() => { + return edges.filter((e) => nodeMap.has(e.from_node) && nodeMap.has(e.to_node)) + }, [edges, nodeMap]) + + // Get neighbors of selected node + const selectedNeighbors = useMemo(() => { + const neighbors = new Set() + if (selectedNodeId !== null) { + filteredEdges.forEach((e) => { + if (e.from_node === selectedNodeId) neighbors.add(e.to_node) + if (e.to_node === selectedNodeId) neighbors.add(e.from_node) + }) + } + return neighbors + }, [selectedNodeId, filteredEdges]) + + // Build ECharts data + const chartData = useMemo(() => { + const graphNodes = filteredNodes.map((n) => { + const regionIndex = getRegionIndex(n.latitude) + const color = REGION_COLORS[regionIndex % REGION_COLORS.length] + const isInfra = INFRA_ROLES.includes(n.role) + const isSelected = n.node_num === selectedNodeId + const isNeighbor = selectedNeighbors.has(n.node_num) + const isRelated = selectedNodeId === null || isSelected || isNeighbor + + return { + id: String(n.node_num), + name: n.short_name, + value: n.node_num, + symbolSize: getNodeSize(n.role), + itemStyle: { + color: isInfra ? color : '#111827', + borderColor: color, + borderWidth: isInfra ? 0 : 2, + opacity: isRelated ? 1 : 0.15, + }, + label: { + show: true, + position: 'bottom' as const, + distance: 5, + fontSize: 10, + fontFamily: 'JetBrains Mono, monospace', + color: isRelated ? '#94a3b8' : '#94a3b820', + }, + // Store extra data for click handler + nodeNum: n.node_num, + longName: n.long_name, + role: n.role, + } + }) + + const graphLinks = filteredEdges.map((e) => { + const isRelated = selectedNodeId === null || + e.from_node === selectedNodeId || + e.to_node === selectedNodeId + + return { + source: String(e.from_node), + target: String(e.to_node), + value: e.snr, + lineStyle: { + color: getQualityColor(e.snr), + width: isRelated && selectedNodeId !== null ? 2 : 1, + opacity: selectedNodeId === null ? 0.4 : (isRelated ? 0.6 : 0.04), + }, + } + }) + + return { nodes: graphNodes, links: graphLinks } + }, [filteredNodes, filteredEdges, selectedNodeId, selectedNeighbors]) + + // ECharts option + const option: EChartsOption = useMemo(() => ({ + backgroundColor: '#111827', + tooltip: { + trigger: 'item', + backgroundColor: '#1e293b', + borderColor: '#334155', + textStyle: { + color: '#e2e8f0', + fontFamily: 'JetBrains Mono, monospace', + fontSize: 11, + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + formatter: (params: any) => { + if (params.data && params.data.longName) { + const d = params.data + return `${d.name}
${d.longName}
Role: ${d.role}` + } + return '' + }, + }, + series: [ + { + type: 'graph', + layout: 'force', + roam: true, + draggable: true, + animation: false, + data: chartData.nodes, + links: chartData.links, + force: { + repulsion: 200, + edgeLength: [80, 120], + gravity: 0.1, + }, + // Only nodes trigger hover/click - edges are not interactive + emphasis: { + focus: 'adjacency', + blurScope: 'coordinateSystem', + scale: 1.1, + lineStyle: { + width: 2, + }, + }, + blur: { + itemStyle: { + opacity: 0.15, + }, + lineStyle: { + opacity: 0.04, + }, + }, + label: { + show: true, + position: 'bottom', + distance: 5, + fontSize: 10, + fontFamily: 'JetBrains Mono, monospace', + }, + edgeLabel: { + show: false, + }, + // Edges not interactive - no hover, no tooltip, no click + edgeSymbol: ['none', 'none'], + // Selection styling handled via data opacity + }, + ], + }), [chartData]) + + // Handle chart events + const onChartClick = useCallback((params: { data?: { nodeNum?: number } }) => { + if (params.data && 'nodeNum' in params.data) { + const nodeNum = params.data.nodeNum + onSelectNode(selectedNodeId === nodeNum ? null : nodeNum ?? null) + } + }, [selectedNodeId, onSelectNode]) + + const onChartEvents = useMemo(() => ({ + click: onChartClick, + }), [onChartClick]) + + // Update chart when selection changes + useEffect(() => { + const chart = chartRef.current?.getEchartsInstance() + if (chart) { + chart.setOption(option, { notMerge: false, lazyUpdate: true }) + } + }, [option]) + + return ( +
+ + + {/* Filter controls */} +
+ +
+ {([ + { key: 'connected', label: 'Connected' }, + { key: 'infra', label: 'Infra' }, + { key: 'all', label: 'All' }, + ] as { key: FilterMode; label: string }[]).map(({ key, label }) => ( + + ))} +
+ + {filteredNodes.length} nodes • {filteredEdges.length} edges + +
+ + {/* Legend */} +
+
Edge Quality (SNR)
+
+ {[ + { label: 'Excellent (>12)', color: '#22c55e' }, + { label: 'Good (8-12)', color: '#4ade80' }, + { label: 'Fair (5-8)', color: '#f59e0b' }, + { label: 'Marginal (3-5)', color: '#f97316' }, + { label: 'Poor (<3)', color: '#ef4444' }, + ].map((item) => ( +
+
+ {item.label} +
+ ))} +
+
+ + {/* Node type legend */} +
+
Node Type
+
+
+
+ Infrastructure +
+
+
+ Client +
+
+
+
+ ) +} diff --git a/work/dashboard-frontend/src/hooks/useWebSocket.ts b/work/dashboard-frontend/src/hooks/useWebSocket.ts new file mode 100644 index 0000000..852363b --- /dev/null +++ b/work/dashboard-frontend/src/hooks/useWebSocket.ts @@ -0,0 +1,109 @@ +import { useEffect, useRef, useState, useCallback } from 'react' +import type { MeshHealth, Alert, EnvEvent } from '@/lib/api' + +interface WebSocketMessage { + type: string + data?: unknown + event?: EnvEvent +} + +interface UseWebSocketReturn { + connected: boolean + lastHealth: MeshHealth | null + lastAlert: Alert | null + lastMessage: WebSocketMessage | null +} + +export function useWebSocket(): UseWebSocketReturn { + const [connected, setConnected] = useState(false) + const [lastHealth, setLastHealth] = useState(null) + const [lastAlert, setLastAlert] = useState(null) + const [lastMessage, setLastMessage] = useState(null) + const wsRef = useRef(null) + const reconnectTimeoutRef = useRef(null) + const reconnectDelayRef = useRef(1000) + + const connect = useCallback(() => { + if (wsRef.current?.readyState === WebSocket.OPEN) { + return + } + + const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:' + const wsUrl = `${protocol}//${window.location.host}/ws/live` + + try { + const ws = new WebSocket(wsUrl) + wsRef.current = ws + + ws.onopen = () => { + setConnected(true) + reconnectDelayRef.current = 1000 // Reset backoff on successful connection + } + + ws.onmessage = (event) => { + try { + const message: WebSocketMessage = JSON.parse(event.data) + + // Store all messages for generic handling + setLastMessage(message) + + switch (message.type) { + case 'health_update': + setLastHealth(message.data as MeshHealth) + break + case 'alert_fired': + setLastAlert(message.data as Alert) + break + // env_update messages are handled via lastMessage + } + } catch (e) { + console.error('Failed to parse WebSocket message:', e) + } + } + + ws.onclose = () => { + setConnected(false) + wsRef.current = null + + // Schedule reconnect with exponential backoff + const delay = Math.min(reconnectDelayRef.current, 30000) + reconnectTimeoutRef.current = window.setTimeout(() => { + reconnectDelayRef.current = Math.min(delay * 2, 30000) + connect() + }, delay) + } + + ws.onerror = () => { + ws.close() + } + + // Keepalive ping every 30 seconds + const pingInterval = setInterval(() => { + if (ws.readyState === WebSocket.OPEN) { + ws.send('ping') + } + }, 30000) + + ws.addEventListener('close', () => { + clearInterval(pingInterval) + }) + } catch (e) { + console.error('Failed to create WebSocket:', e) + } + }, []) + + useEffect(() => { + connect() + + return () => { + if (reconnectTimeoutRef.current) { + clearTimeout(reconnectTimeoutRef.current) + } + if (wsRef.current) { + wsRef.current.close() + } + } + }, [connect]) + + return { connected, lastHealth, lastAlert, lastMessage } +} diff --git a/work/dashboard-frontend/src/index.css b/work/dashboard-frontend/src/index.css new file mode 100644 index 0000000..f6ff1b7 --- /dev/null +++ b/work/dashboard-frontend/src/index.css @@ -0,0 +1,76 @@ +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap'); + +@tailwind base; +@tailwind components; +@tailwind utilities; + +body { + background: #111111; + margin: 0; + font-family: 'Inter', system-ui, -apple-system, sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +/* Custom scrollbar — sharp */ +::-webkit-scrollbar { + width: 8px; + height: 8px; +} + +::-webkit-scrollbar-track { + background: #111111; +} + +::-webkit-scrollbar-thumb { + background: #2a2a2a; + border-radius: 0; +} + +::-webkit-scrollbar-thumb:hover { + background: #2a2a2a; +} + +/* Data values use JetBrains Mono */ +.font-mono { + font-family: 'JetBrains Mono', monospace; +} + +/* Pulsing animation for live indicator */ +@keyframes pulse { + 0%, 100% { + opacity: 1; + } + 50% { + opacity: 0.5; + } +} + +.animate-pulse-slow { + animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; +} + +/* Toast slide-in animation */ +@keyframes slide-in { + from { + transform: translateX(100%); + opacity: 0; + } + to { + transform: translateX(0); + opacity: 1; + } +} + +.animate-slide-in { + animation: slide-in 0.3s ease-out; +} + +/* Line clamp utility */ +.line-clamp-2 { + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; +} diff --git a/work/dashboard-frontend/src/lib/api.ts b/work/dashboard-frontend/src/lib/api.ts new file mode 100644 index 0000000..631d051 --- /dev/null +++ b/work/dashboard-frontend/src/lib/api.ts @@ -0,0 +1,483 @@ +// API types matching actual backend responses + +export interface SystemStatus { + version: string + uptime_seconds: number + bot_name: string + connection_type: string + connection_target: string + connected: boolean + node_count: number + source_count: number + env_feeds_enabled: boolean + dashboard_port: number +} + +export interface MeshHealth { + score: number + tier: string + pillars: { + infrastructure: number + utilization: number + coverage: number + behavior: number + power: number + } + infra_online: number + infra_total: number + util_percent: number + flagged_nodes: number + battery_warnings: number + total_nodes: number + total_regions: number + unlocated_count: number + last_computed: string + recommendations: string[] +} + +export interface NodeInfo { + node_num: number + node_id_hex: string + short_name: string + long_name: string + role: string + latitude: number | null + longitude: number | null + last_heard: string | null + battery_level: number | null + voltage: number | null + snr: number | null + firmware: string + hardware: string + uptime: number | null + sources: string[] +} + +export interface EdgeInfo { + from_node: number + to_node: number + snr: number + quality: string +} + +export interface RegionInfo { + name: string + local_name: string + node_count: number + infra_count: number + infra_online: number + online_count: number + score: number + tier: string + center_lat: number + center_lon: number +} + +export interface SourceHealth { + name: string + type: string + url: string + is_loaded: boolean + last_error: string | null + consecutive_errors: number + response_time_ms: number | null + tick_count: number + node_count: number +} + +export interface Alert { + type: string + severity: string + message: string + timestamp: string + scope_type?: string + scope_value?: string +} + +export interface AlertHistoryItem { + id?: number + type: string + severity: string + message: string + timestamp: string + duration?: number + scope_type?: string + scope_value?: string + resolved_at?: string +} + +export interface AlertHistoryResponse { + items: AlertHistoryItem[] + total: number +} + +export interface Subscription { + id: number + user_id: string + sub_type: string + schedule_time?: string + schedule_day?: string + scope_type: string + scope_value?: string + enabled: boolean +} + +export interface EnvStatus { + enabled: boolean + feeds: EnvFeedHealth[] +} + +export interface EnvFeedHealth { + source: string + is_loaded: boolean + last_error: string | null + consecutive_errors: number + event_count: number + last_fetch: number +} + +export interface EnvEvent { + source: string + event_id: string + event_type: string + severity: string + headline: string + description?: string + expires?: number + fetched_at: number + [key: string]: unknown +} + +// Kp history entry for charting +export interface KpHistoryEntry { + time: string + value: number +} + +// SFI history entry for charting +export interface SfiHistoryEntry { + time: string + value: number +} + +// Refractivity profile entry +export interface ProfileEntry { + level_hPa: number + height_m: number + N: number + M: number + T_C: number + RH: number +} + +// Gradient entry +export interface GradientEntry { + from_level: number + to_level: number + from_height_m: number + to_height_m: number + gradient: number +} + +export interface BandConditionsStatus { + enabled: boolean + ratings?: { + "80-40m"?: string + "30-20m"?: string + "17-15m"?: string + "12-10m"?: string + } + slot_label?: string + sent_at?: number + source?: string +} + +// Kept for backward compat references +export type SWPCStatus = BandConditionsStatus + +export interface DuctingStatus { + enabled: boolean + condition?: string + min_gradient?: number + duct_thickness_m?: number | null + duct_base_m?: number | null + last_update?: string + profile?: ProfileEntry[] + gradients?: GradientEntry[] + assessment?: string + location?: { lat: number; lon: number } +} + +export interface RFPropagation { + hf: { + kp_current?: number + sfi?: number + r_scale?: number + s_scale?: number + g_scale?: number + active_warnings?: string[] + kp_history?: KpHistoryEntry[] + } + uhf_ducting: { + condition?: string + min_gradient?: number + duct_thickness_m?: number | null + profile?: ProfileEntry[] + } +} + +// API fetch helpers + +async function fetchJson(url: string): Promise { + const response = await fetch(url) + if (!response.ok) { + throw new Error(`API error: ${response.status} ${response.statusText}`) + } + return response.json() +} + +export async function fetchStatus(): Promise { + return fetchJson('/api/status') +} + +export async function fetchHealth(): Promise { + return fetchJson('/api/health') +} + +export async function fetchNodes(): Promise { + return fetchJson('/api/nodes') +} + +export async function fetchEdges(): Promise { + return fetchJson('/api/edges') +} + +export async function fetchSources(): Promise { + return fetchJson('/api/sources') +} + +export async function fetchConfig(section?: string): Promise { + const url = section ? `/api/config/${section}` : '/api/config' + return fetchJson(url) +} + +export async function updateConfig( + section: string, + data: unknown +): Promise<{ saved: boolean; restart_required: boolean }> { + const response = await fetch(`/api/config/${section}`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(data), + }) + if (!response.ok) { + throw new Error(`API error: ${response.status} ${response.statusText}`) + } + return response.json() +} + +export async function fetchAlerts(): Promise { + return fetchJson('/api/alerts/active') +} + +export async function fetchAlertHistory( + limit: number = 50, + offset: number = 0, + type?: string, + severity?: string +): Promise { + const params = new URLSearchParams() + params.set('limit', limit.toString()) + params.set('offset', offset.toString()) + if (type && type !== 'all') params.set('type', type) + if (severity && severity !== 'all') params.set('severity', severity) + return fetchJson(`/api/alerts/history?${params.toString()}`) +} + +export async function fetchSubscriptions(): Promise { + return fetchJson('/api/subscriptions') +} + +export async function fetchEnvStatus(): Promise { + return fetchJson('/api/env/status') +} + +export async function fetchEnvActive(): Promise { + return fetchJson('/api/env/active') +} + +export async function fetchRFPropagation(): Promise { + return fetchJson('/api/env/propagation') +} + +export async function fetchSWPC(): Promise { + return fetchJson('/api/env/swpc') +} + +export async function fetchDucting(): Promise { + return fetchJson('/api/env/ducting') +} + +export interface FireEvent { + source: string + event_id: string + event_type: string + severity: string + headline: string + name: string + acres: number + pct_contained: number + lat: number | null + lon: number | null + distance_km: number | null + nearest_anchor: string | null + state: string + expires: number + fetched_at: number + polygon?: number[][][] +} + +export interface AvalancheEvent { + source: string + event_id: string + event_type: string + severity: string + headline: string + zone_name: string + center: string + center_id: string + center_link: string + forecast_link: string + danger: string + danger_level: number + danger_name: string + travel_advice: string + state: string + lat: number | null + lon: number | null + expires: number + fetched_at: number +} + +export interface StreamGaugeEvent { + source: string + event_id: string + event_type: string + headline: string + severity: string + lat?: number + lon?: number + expires: number + fetched_at: number + properties: { + site_id: string + site_name: string + parameter: string + value: number + unit: string + timestamp: string + } +} + +export interface TrafficEvent { + source: string + event_id: string + event_type: string + headline: string + severity: string + lat?: number + lon?: number + expires: number + fetched_at: number + properties: { + corridor: string + currentSpeed: number + freeFlowSpeed: number + speedRatio: number + currentTravelTime: number + freeFlowTravelTime: number + confidence: number + roadClosure: boolean + } +} + +export interface RoadEvent { + source: string + event_id: string + event_type: string + headline: string + description?: string + severity: string + lat?: number + lon?: number + expires: number + fetched_at: number + properties: { + roadway: string + is_closure: boolean + last_updated?: string + } +} + +export interface HotspotEvent { + source: string + event_id: string + event_type: string + headline: string + severity: string + lat?: number + lon?: number + expires: number + fetched_at: number + properties: { + new_ignition: boolean + confidence: string + frp?: number + brightness?: number + acq_date: string + acq_time: string + near_fire?: string + distance_to_fire_km?: number + distance_km?: number + nearest_anchor?: string + } +} + +export interface HotspotsResponse { + enabled: boolean + hotspots: HotspotEvent[] + new_ignitions: number +} + +export interface AvalancheResponse { + off_season: boolean + advisories: AvalancheEvent[] +} + +export async function fetchFires(): Promise { + return fetchJson('/api/env/fires') +} + +export async function fetchAvalanche(): Promise { + return fetchJson('/api/env/avalanche') +} + +export async function fetchStreams(): Promise { + return fetchJson('/api/env/streams') +} + +export async function fetchTraffic(): Promise { + return fetchJson('/api/env/traffic') +} + +export async function fetchRoads(): Promise { + return fetchJson('/api/env/roads') +} + +export async function fetchHotspots(): Promise { + return fetchJson('/api/env/hotspots') +} + +export async function fetchRegions(): Promise { + return fetchJson('/api/regions') +} diff --git a/work/dashboard-frontend/src/main.tsx b/work/dashboard-frontend/src/main.tsx new file mode 100644 index 0000000..fa94fac --- /dev/null +++ b/work/dashboard-frontend/src/main.tsx @@ -0,0 +1,13 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import { BrowserRouter } from 'react-router-dom' +import App from './App' +import './index.css' + +ReactDOM.createRoot(document.getElementById('root')!).render( + + + + + , +) diff --git a/work/dashboard-frontend/src/pages/AdapterConfig.tsx b/work/dashboard-frontend/src/pages/AdapterConfig.tsx new file mode 100644 index 0000000..aa04cfc --- /dev/null +++ b/work/dashboard-frontend/src/pages/AdapterConfig.tsx @@ -0,0 +1,416 @@ +// v0.6-3c Adapter Config editor. +// +// Renders one card per adapter. Each card shows: +// - display_name + include_in_llm_context toggle at the top +// - expandable list of (config key, type-aware widget, reset button) +// +// Auto-saves on blur (text/number inputs) or change (bool toggle + select). +// Cache invalidation is server-side -- every PUT triggers it. The handler +// reads via the in-process accessor on its next call. + +import { useEffect, useState, useCallback } from 'react' +import { + ChevronDown, ChevronRight, RotateCcw, Loader2, Check, AlertCircle, + Sliders, +} from 'lucide-react' + +interface ConfigRow { + adapter: string + key: string + value: unknown + default: unknown + type: 'int' | 'float' | 'str' | 'bool' | 'json' + description: string + updated_at: number +} + +interface MetaRow { + display_name: string + include_in_llm_context: boolean + description: string +} + +type GroupedConfig = Record +type MetaMap = Record + +type SaveStatus = 'idle' | 'saving' | 'saved' | 'error' + +// Brief animation after a successful save. +const SAVED_BADGE_MS = 1500 + +export default function AdapterConfig() { + const [config, setConfig] = useState({}) + const [meta, setMeta] = useState({}) + const [loading, setLoading] = useState(true) + const [error, setError] = useState(null) + const [expanded, setExpanded] = useState>({}) + + // Per-key save status: keyed on `${adapter}.${key}` or `meta:${adapter}`. + const [saveStatus, setSaveStatus] = useState>({}) + const [saveError, setSaveError] = useState>({}) + + const refresh = useCallback(async () => { + setLoading(true) + setError(null) + try { + const [cfgRes, metaRes] = await Promise.all([ + fetch('/api/adapter-config'), + fetch('/api/adapter-meta'), + ]) + if (!cfgRes.ok) throw new Error(`GET /adapter-config: ${cfgRes.status}`) + if (!metaRes.ok) throw new Error(`GET /adapter-meta: ${metaRes.status}`) + setConfig(await cfgRes.json()) + setMeta(await metaRes.json()) + } catch (e) { + setError(String(e)) + } finally { + setLoading(false) + } + }, []) + + useEffect(() => { refresh() }, [refresh]) + + const markStatus = useCallback((id: string, status: SaveStatus, errMsg?: string) => { + setSaveStatus((s) => ({ ...s, [id]: status })) + if (errMsg) setSaveError((s) => ({ ...s, [id]: errMsg })) + if (status === 'saved') { + setTimeout(() => { + setSaveStatus((s) => (s[id] === 'saved' ? { ...s, [id]: 'idle' } : s)) + }, SAVED_BADGE_MS) + } + }, []) + + // ---------- key-level mutations ---------------------------------------- + + const putValue = useCallback(async (adapter: string, key: string, value: unknown) => { + const id = `${adapter}.${key}` + markStatus(id, 'saving') + try { + const res = await fetch(`/api/adapter-config/${adapter}/${key}`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ value }), + }) + if (!res.ok) { + const body = await res.json().catch(() => ({})) + const detail = body.detail || res.statusText + markStatus(id, 'error', String(detail)) + return + } + const updated: ConfigRow = await res.json() + setConfig((c) => ({ + ...c, + [adapter]: (c[adapter] || []).map((row) => row.key === key ? updated : row), + })) + markStatus(id, 'saved') + } catch (e) { + markStatus(id, 'error', String(e)) + } + }, [markStatus]) + + const resetValue = useCallback(async (adapter: string, key: string) => { + const id = `${adapter}.${key}` + markStatus(id, 'saving') + try { + const res = await fetch(`/api/adapter-config/${adapter}/${key}/reset`, { + method: 'POST', + }) + if (!res.ok) { + markStatus(id, 'error', `reset failed (${res.status})`) + return + } + const updated: ConfigRow = await res.json() + setConfig((c) => ({ + ...c, + [adapter]: (c[adapter] || []).map((row) => row.key === key ? updated : row), + })) + markStatus(id, 'saved') + } catch (e) { + markStatus(id, 'error', String(e)) + } + }, [markStatus]) + + const putMeta = useCallback(async (adapter: string, body: Partial) => { + const id = `meta:${adapter}` + markStatus(id, 'saving') + try { + const res = await fetch(`/api/adapter-meta/${adapter}`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(body), + }) + if (!res.ok) { + const b = await res.json().catch(() => ({})) + markStatus(id, 'error', String(b.detail || res.statusText)) + return + } + const updated: MetaRow = await res.json() + setMeta((m) => ({ ...m, [adapter]: updated })) + markStatus(id, 'saved') + } catch (e) { + markStatus(id, 'error', String(e)) + } + }, [markStatus]) + + // ---------- render ------------------------------------------------------ + + if (loading) { + return ( +
+ Loading adapter config… +
+ ) + } + + if (error) { + return ( +
+ + Failed to load: {error} +
+ ) + } + + // Union of all adapters: any meta row + any config-having adapter. + const allAdapters = Array.from(new Set([ + ...Object.keys(meta), + ...Object.keys(config), + ])).sort() + + return ( +
+
+ +

Adapter Config

+ + {Object.values(config).reduce((n, l) => n + l.length, 0)} settings across {allAdapters.length} adapters + +
+

+ Per-adapter tunables (thresholds, freshness windows, toggles, curation lists). + Changes take effect on the next handler call -- no container restart needed. + Sentence templates, emoji, and translation maps live in code by design — see the CODE rule under Adapter Config & the CODE Rule in Reference. The LLM context toggle on each card gates whether that adapter's data lands in the system prompt when you DM the bot; broadcasts are unaffected. +

+ + {allAdapters.map((adapter) => { + const m = meta[adapter] || { + display_name: adapter, + include_in_llm_context: true, + description: '', + } + const rows = config[adapter] || [] + const isExpanded = expanded[adapter] ?? false + const metaId = `meta:${adapter}` + const metaStatus = saveStatus[metaId] || 'idle' + return ( +
+ {/* Card header */} +
+ +
+
+

{m.display_name}

+ {adapter} + {rows.length > 0 && ( + ({rows.length} settings) + )} + {rows.length === 0 && ( + (meta only) + )} +
+ {m.description && ( +

{m.description}

+ )} +
+ + {/* include_in_llm_context toggle */} + +
+ + {/* Expanded body */} + {isExpanded && rows.length > 0 && ( +
+ {rows.map((row) => ( + putValue(adapter, row.key, v)} + onReset={() => resetValue(adapter, row.key)} + /> + ))} +
+ )} +
+ ) + })} +
+ ) +} + + +// ---------- KeyRow --------------------------------------------------------- + + +interface KeyRowProps { + row: ConfigRow + status: SaveStatus + error?: string + onCommit: (v: unknown) => void + onReset: () => void +} + +function KeyRow({ row, status, error, onCommit, onReset }: KeyRowProps) { + // Use a local draft so number/text inputs don't fight the parent state + // mid-edit. Commit on blur. + const [draft, setDraft] = useState(stringifyForInput(row)) + + // If the parent value changes (e.g. via reset), refresh the local draft. + useEffect(() => { + setDraft(stringifyForInput(row)) + }, [row.value, row.type]) + + const isDirty = draft !== stringifyForInput(row) + const isDefault = JSON.stringify(row.value) === JSON.stringify(row.default) + + const commit = () => { + const parsed = parseFromInput(draft, row.type) + if (parsed.error) return // error shown inline; do not PUT + if (!parsed.changed(row.value)) return + onCommit(parsed.value) + } + + return ( +
+
+
+ {row.key} + [{row.type}] + {!isDefault && ( + edited + )} +
+ {row.description && ( +

{row.description}

+ )} +
+ +
+ {row.type === 'bool' ? ( + onCommit(e.target.checked)} + className="w-5 h-5 accent-[#f59e0b]" + /> + ) : row.type === 'json' ? ( +