From 47d7ef7e7810d751e26262cc2529d2a47f6e65b2 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Fri, 17 Jul 2026 17:06:00 +0000 Subject: [PATCH] feat(dashboard): bring ipaws adapter + emergency family to full GUI parity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The IPAWS civil-alert adapter shipped backend-complete but frontend-partial: it rendered only in the generic adapter-config page and the Advanced (raw) Data Feeds tab, and the `emergency` family was absent from the curated Data Feeds panel, the family-settings toggles, and the MeshCore routing matrix. Adapter (ipaws), benchmarked against firms/nws: - Environment.tsx: add `ipaws` to AdapterKey union, EnvConfig interface, META (native-only, keyless), a new `emergency` FAMILIES group, PANEL_META_KEY (LLM toggle), and a hand-written renderSettings panel exposing base_url, user_agent, tick_seconds, state_fips, same_codes, exclude_weather, status_actual_only — with coverage-scope handling like the other adapters. - Environment.tsx: IPAWS_DEFAULT backfill so pre-ipaws GET payloads don't crash. - Dashboard.tsx: SOURCE_ICONS entry (Siren/IPAWS) so ipaws events aren't a slug. - ActivityLog.tsx: TABLE_LABELS + CATEGORIES + text-hint so ipaws_alerts rows show labeled "Emergency" and honor the category filter. - dispatcher.py: _SOURCE_TO_TABLE fallback ipaws -> ipaws_alerts so region-routed emergency sends land labeled in the audit feed (not NULL). Family (emergency), benchmarked against fire: - Notifications.tsx: add `emergency` to TOGGLE_FAMILY_META (Siren icon). This cascades to Family Settings, the Meshtastic delivery matrix, and the MeshCore routing matrix (the last was hardcoded to the static list and previously omitted emergency entirely). Backend VALID_TOGGLES/gating/categories were already complete — no backend family change needed. Tests: update the _SOURCE_TO_TABLE exact-match guard and add an ipaws audit-row parity test. Full suite 2407 passed / 6 pre-existing unrelated failures. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/pages/ActivityLog.tsx | 3 + .../src/pages/Dashboard.tsx | 2 + .../src/pages/Environment.tsx | 71 +++++++- .../src/pages/Notifications.tsx | 3 +- .../{index-dwX3LKqm.js => index-FgUiz9s3.js} | 159 +++++++++--------- work/meshai/dashboard/static/index.html | 2 +- .../notifications/pipeline/dispatcher.py | 4 + work/tests/test_dispatcher_persistence.py | 45 ++++- 8 files changed, 207 insertions(+), 82 deletions(-) rename work/meshai/dashboard/static/assets/{index-dwX3LKqm.js => index-FgUiz9s3.js} (61%) diff --git a/work/dashboard-frontend/src/pages/ActivityLog.tsx b/work/dashboard-frontend/src/pages/ActivityLog.tsx index 00c1523..dc862ae 100644 --- a/work/dashboard-frontend/src/pages/ActivityLog.tsx +++ b/work/dashboard-frontend/src/pages/ActivityLog.tsx @@ -52,6 +52,7 @@ const TABLE_LABELS: Record = { swpc_events: 'Space Wx', gauge_readings: 'Hydro', event_log: 'Avalanche', + ipaws_alerts: 'Emergency', } // Text-prefix / emoji heuristics for legacy NULL-source rows. @@ -66,6 +67,7 @@ const TABLE_LABELS: Record = { // incident_handler.py (legacy) → "⚠️ Road Incident …" | "🚫 Road Closed …" // NOTE: more-specific prefixes must appear before shorter ones that share a leading char. const TEXT_HINTS: Array<[string, string]> = [ + ['🚨', 'Emergency'], // ipaws.py immediate civil alerts (evac/AMBER/HazMat) ['🔥', 'Fire'], ['🚧', 'Traffic'], ['⚠️ Road Incident', 'Traffic'], // legacy road-incident rows (⚠️ = U+26A0+FE0F) @@ -115,6 +117,7 @@ const CATEGORIES = [ { value: 'satpass_events', label: 'Satellite' }, { value: 'band_conditions_broadcasts', label: 'Band' }, { value: 'traffic_events', label: 'Traffic' }, + { value: 'ipaws_alerts', label: 'Emergency' }, ] const PAGE = 100 diff --git a/work/dashboard-frontend/src/pages/Dashboard.tsx b/work/dashboard-frontend/src/pages/Dashboard.tsx index a6637a7..e9bdb82 100644 --- a/work/dashboard-frontend/src/pages/Dashboard.tsx +++ b/work/dashboard-frontend/src/pages/Dashboard.tsx @@ -32,6 +32,7 @@ import { Construction, Satellite, Sun, + Siren, } from 'lucide-react' @@ -357,6 +358,7 @@ const SOURCE_ICONS: Record = { usgs: { label: 'USGS Stream Gauges', subtitle: 'River and stream water levels', health: 'usgs', hasCentral: true, nativeOnly: false, hasKey: true }, avalanche: { label: 'Avalanche Advisories', subtitle: 'Backcountry avalanche danger ratings', health: 'avalanche', hasCentral: true, nativeOnly: false, hasKey: true }, satpass: { label: 'Satellite Passes', subtitle: 'Observer pass alerts via Central', health: 'satpass', hasCentral: true, nativeOnly: false, hasKey: true }, + ipaws: { label: 'FEMA IPAWS civil alerts', subtitle: 'Evacuations, AMBER, HazMat, 911 outages (non-weather)', health: 'ipaws', hasCentral: false, nativeOnly: true, hasKey: false }, } // Keyed adapters → their secret env var (matches secrets_store.SECRET_LABELS). @@ -299,6 +320,7 @@ const FAMILIES: { key: string; label: string; icon: typeof Cloud; adapters: Adap { key: 'rf', label: 'RF Propagation', icon: Radio, adapters: ['swpc', 'ducting'] }, { key: 'roads', label: 'Roads', icon: Car, adapters: ['traffic', 'roads511', 'wzdx'] }, { key: 'geohazards', label: 'Geohazards', icon: Mountain, adapters: ['usgs_quake', 'usgs', 'avalanche'] }, + { key: 'emergency', label: 'Emergency', icon: Siren, adapters: ['ipaws'] }, { key: 'tracking', label: 'Tracking', icon: Satellite, adapters: ['satpass'] }, { key: 'mesh', label: 'Mesh Health', icon: Activity, adapters: [] }, { key: 'family_settings', label: 'Family Settings', icon: Bell, adapters: [] }, @@ -411,6 +433,7 @@ export default function Environment() { // round-trip PUT restores them rather than dropping them). data.satpass = { ...SATPASS_NATIVE_DEFAULT, ...(data.satpass ?? {}) } data.wzdx = { states: ['ID'], registry_url: '', ...(data.wzdx ?? {}) } + data.ipaws = { ...IPAWS_DEFAULT, ...(data.ipaws ?? {}) } setEnv(data) setOriginal(JSON.stringify(data)) @@ -855,6 +878,7 @@ const save = async () => { usgs_quake: 'usgs_quake', avalanche: 'avalanche', satpass: 'satpass', + ipaws: 'ipaws', } // ── Notification family gating helpers ──────────────────────────────────── @@ -1450,6 +1474,49 @@ const save = async () => { )} ) + case 'ipaws': return (<> +
+ Keyless FEMA IPAWS-OPEN EAS feed. Broadcasts NON-weather civil emergencies + (evacuation orders, AMBER, HazMat, 911 outages, law-enforcement/shelter-in-place). + Weather CAP is dropped so it never double-broadcasts the NWS adapter. +
+ up({ ipaws: { ...env.ipaws, base_url: v } })} + placeholder="https://apps.fema.gov/IPAWSOPEN_EAS_SERVICE/rest" + helper="IPAWS-OPEN EAS REST root — Atom index at /feed, per-alert CAP at /eas/. Point at the Conduit proxy in prod." /> + up({ ipaws: { ...env.ipaws, user_agent: v } })} + placeholder="meshai-ipaws/1.0 (you@email.com)" helper="Sent on every FEMA request. Blank uses the built-in default." /> + up({ ipaws: { ...env.ipaws, tick_seconds: v } })} min={30} /> + {scopedByCoverage('ipaws') ? ( +
+ Region scope (state FIPS / SAME codes) is set by the{' '} + Coverage map. +
+ ) : (<> + up({ ipaws: { ...env.ipaws, state_fips: v } })} + helper="Coarse pre-fetch gate — 2-digit state FIPS to keep, e.g. 16 (ID), 41 (OR), 53 (WA)" /> + up({ ipaws: { ...env.ipaws, same_codes: v } })} + helper="Optional fine gate — 6-digit SAME county codes, e.g. 016001. Empty = all counties in the FIPS states." /> + )} +
+
Broadcast Filters
+
+ +

Drop NWS/NOAA-originated CAP so weather stays on the NWS adapter (no double-broadcast).

+ +

Skip Test / Exercise / System messages — broadcast only status=Actual alerts.

+
+
+ ) case 'satpass': { // Armed state keys off the NATIVE enable (environmental.satpass.enabled), // which is what actually gates the native SGP4 broadcaster — consistent diff --git a/work/dashboard-frontend/src/pages/Notifications.tsx b/work/dashboard-frontend/src/pages/Notifications.tsx index 7f6a121..2d354de 100644 --- a/work/dashboard-frontend/src/pages/Notifications.tsx +++ b/work/dashboard-frontend/src/pages/Notifications.tsx @@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react' import { Save, RotateCcw, RefreshCw, Check, Eye as EyeIcon, EyeOff, Plus, X, Radio, - Activity, Cloud, Flame, Car, Snowflake, Mountain, MapPin, Satellite, Layers, + Activity, Cloud, Flame, Car, Snowflake, Mountain, MapPin, Satellite, Layers, Siren, } from 'lucide-react' import { useDirty } from '@/context/DirtyContext' @@ -395,6 +395,7 @@ export const TOGGLE_FAMILY_META: FamilyMeta[] = [ { key: 'mesh_health', label: 'Mesh Health', Icon: Activity }, { key: 'weather', label: 'Weather', Icon: Cloud }, { key: 'fire', label: 'Fire', Icon: Flame }, + { key: 'emergency', label: 'Emergency', Icon: Siren }, { key: 'rf_propagation', label: 'RF Propagation', Icon: Radio }, { key: 'roads', label: 'Roads', Icon: Car }, { key: 'avalanche', label: 'Avalanche', Icon: Snowflake }, diff --git a/work/meshai/dashboard/static/assets/index-dwX3LKqm.js b/work/meshai/dashboard/static/assets/index-FgUiz9s3.js similarity index 61% rename from work/meshai/dashboard/static/assets/index-dwX3LKqm.js rename to work/meshai/dashboard/static/assets/index-FgUiz9s3.js index 9f1ea4c..bb10109 100644 --- a/work/meshai/dashboard/static/assets/index-dwX3LKqm.js +++ b/work/meshai/dashboard/static/assets/index-FgUiz9s3.js @@ -1,4 +1,4 @@ -function DY(e,t){for(var r=0;rn[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var jY=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _N(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nF={exports:{}},$b={},aF={exports:{}},Dt={};/** +function jY(e,t){for(var r=0;rn[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var EY=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _N(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var aF={exports:{}},$b={},iF={exports:{}},Dt={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ function DY(e,t){for(var r=0;r>>1,J=F[Z];if(0>>1;Za(le,$))dea(He,le)?(F[Z]=He,F[de]=$,Z=de):(F[Z]=le,F[Q]=$,Z=Q);else if(dea(He,$))F[Z]=He,F[de]=$,Z=de;else break e}}return W}function a(F,W){var $=F.sortIndex-W.sortIndex;return $!==0?$:F.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.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,v=!1,g=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,_=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(F){for(var W=r(u);W!==null;){if(W.callback===null)n(u);else if(W.startTime<=F)n(u),W.sortIndex=W.expirationTime,t(l,W);else break;W=r(u)}}function S(F){if(m=!1,w(F),!g)if(r(l)!==null)g=!0,V(C);else{var W=r(u);W!==null&&U(S,W.startTime-F)}}function C(F,W){g=!1,m&&(m=!1,x(I),I=-1),v=!0;var $=f;try{for(w(W),h=r(l);h!==null&&(!(h.expirationTime>W)||F&&!D());){var Z=h.callback;if(typeof Z=="function"){h.callback=null,f=h.priorityLevel;var J=Z(h.expirationTime<=W);W=e.unstable_now(),typeof J=="function"?h.callback=J:h===r(l)&&n(l),w(W)}else n(l);h=r(l)}if(h!==null)var re=!0;else{var Q=r(u);Q!==null&&U(S,Q.startTime-W),re=!1}return re}finally{h=null,f=$,v=!1}}var M=!1,A=null,I=-1,k=5,P=-1;function D(){return!(e.unstable_now()-PF||125Z?(F.sortIndex=$,t(u,F),r(l)===null&&F===r(u)&&(m?(x(I),I=-1):m=!0,U(S,$-Z))):(F.sortIndex=J,t(l,F),g||v||(g=!0,V(C))),F},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(F){var W=f;return function(){var $=f;f=W;try{return F.apply(this,arguments)}finally{f=$}}}})(gF);pF.exports=gF;var nX=pF.exports;/** + */(function(e){function t(F,W){var $=F.length;F.push(W);e:for(;0<$;){var Z=$-1>>>1,J=F[Z];if(0>>1;Za(le,$))dea(He,le)?(F[Z]=He,F[de]=$,Z=de):(F[Z]=le,F[Q]=$,Z=Q);else if(dea(He,$))F[Z]=He,F[de]=$,Z=de;else break e}}return W}function a(F,W){var $=F.sortIndex-W.sortIndex;return $!==0?$:F.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.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,v=!1,g=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,x=typeof clearTimeout=="function"?clearTimeout:null,_=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(F){for(var W=r(u);W!==null;){if(W.callback===null)n(u);else if(W.startTime<=F)n(u),W.sortIndex=W.expirationTime,t(l,W);else break;W=r(u)}}function S(F){if(m=!1,w(F),!g)if(r(l)!==null)g=!0,V(C);else{var W=r(u);W!==null&&U(S,W.startTime-F)}}function C(F,W){g=!1,m&&(m=!1,x(k),k=-1),v=!0;var $=f;try{for(w(W),h=r(l);h!==null&&(!(h.expirationTime>W)||F&&!j());){var Z=h.callback;if(typeof Z=="function"){h.callback=null,f=h.priorityLevel;var J=Z(h.expirationTime<=W);W=e.unstable_now(),typeof J=="function"?h.callback=J:h===r(l)&&n(l),w(W)}else n(l);h=r(l)}if(h!==null)var re=!0;else{var Q=r(u);Q!==null&&U(S,Q.startTime-W),re=!1}return re}finally{h=null,f=$,v=!1}}var M=!1,A=null,k=-1,I=5,P=-1;function j(){return!(e.unstable_now()-PF||125Z?(F.sortIndex=$,t(u,F),r(l)===null&&F===r(u)&&(m?(x(k),k=-1):m=!0,U(S,$-Z))):(F.sortIndex=J,t(l,F),g||v||(g=!0,V(C))),F},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(F){var W=f;return function(){var $=f;f=W;try{return F.apply(this,arguments)}finally{f=$}}}})(mF);gF.exports=mF;var aX=gF.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ function DY(e,t){for(var r=0;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oT=Object.prototype.hasOwnProperty,iX=/^[: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]*$/,wD={},SD={};function oX(e){return oT.call(SD,e)?!0:oT.call(wD,e)?!1:iX.test(e)?SD[e]=!0:(wD[e]=!0,!1)}function sX(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 lX(e,t,r,n){if(t===null||typeof t>"u"||sX(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 na(e,t,r,n,a,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var xn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xn[e]=new na(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xn[t]=new na(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){xn[e]=new na(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xn[e]=new na(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){xn[e]=new na(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){xn[e]=new na(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){xn[e]=new na(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){xn[e]=new na(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){xn[e]=new na(e,5,!1,e.toLowerCase(),null,!1,!1)});var TN=/[\-:]([a-z])/g;function MN(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(TN,MN);xn[t]=new na(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(TN,MN);xn[t]=new na(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(TN,MN);xn[t]=new na(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){xn[e]=new na(e,1,!1,e.toLowerCase(),null,!1,!1)});xn.xlinkHref=new na("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){xn[e]=new na(e,1,!1,e.toLowerCase(),null,!0,!0)});function AN(e,t,r,n){var a=xn.hasOwnProperty(t)?xn[t]:null;(a!==null?a.type!==0:n||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oT=Object.prototype.hasOwnProperty,oX=/^[: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]*$/,SD={},CD={};function sX(e){return oT.call(CD,e)?!0:oT.call(SD,e)?!1:oX.test(e)?CD[e]=!0:(SD[e]=!0,!1)}function lX(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 uX(e,t,r,n){if(t===null||typeof t>"u"||lX(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 ia(e,t,r,n,a,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=n,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var xn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){xn[e]=new ia(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];xn[t]=new ia(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){xn[e]=new ia(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){xn[e]=new ia(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){xn[e]=new ia(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){xn[e]=new ia(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){xn[e]=new ia(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){xn[e]=new ia(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){xn[e]=new ia(e,5,!1,e.toLowerCase(),null,!1,!1)});var TN=/[\-:]([a-z])/g;function MN(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(TN,MN);xn[t]=new ia(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(TN,MN);xn[t]=new ia(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(TN,MN);xn[t]=new ia(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){xn[e]=new ia(e,1,!1,e.toLowerCase(),null,!1,!1)});xn.xlinkHref=new ia("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){xn[e]=new ia(e,1,!1,e.toLowerCase(),null,!0,!0)});function AN(e,t,r,n){var a=xn.hasOwnProperty(t)?xn[t]:null;(a!==null?a.type!==0:n||!(2s||a[o]!==i[s]){var l=` -`+a[o].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=s);break}}}finally{Vw=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?kp(e):""}function uX(e){switch(e.tag){case 5:return kp(e.type);case 16:return kp("Lazy");case 13:return kp("Suspense");case 19:return kp("SuspenseList");case 0:case 2:case 15:return e=Gw(e.type,!1),e;case 11:return e=Gw(e.type.render,!1),e;case 1:return e=Gw(e.type,!0),e;default:return""}}function cT(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 zd:return"Fragment";case Od:return"Portal";case sT:return"Profiler";case NN:return"StrictMode";case lT:return"Suspense";case uT:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case xF:return(e.displayName||"Context")+".Consumer";case yF:return(e._context.displayName||"Context")+".Provider";case kN:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case LN:return t=e.displayName||null,t!==null?t:cT(e.type)||"Memo";case bl:t=e._payload,e=e._init;try{return cT(e(t))}catch{}}return null}function cX(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 cT(t);case 8:return t===NN?"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 ru(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function bF(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function hX(e){var t=bF(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 a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(o){n=""+o,i.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 Ay(e){e._valueTracker||(e._valueTracker=hX(e))}function wF(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=bF(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Jx(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 hT(e,t){var r=t.checked;return br({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function TD(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=ru(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 SF(e,t){t=t.checked,t!=null&&AN(e,"checked",t,!1)}function dT(e,t){SF(e,t);var r=ru(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")?fT(e,t.type,r):t.hasOwnProperty("defaultValue")&&fT(e,t.type,ru(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function MD(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 fT(e,t,r){(t!=="number"||Jx(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Lp=Array.isArray;function rf(e,t,r,n){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Ny.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function bg(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Zp={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},dX=["Webkit","ms","Moz","O"];Object.keys(Zp).forEach(function(e){dX.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Zp[t]=Zp[e]})});function AF(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Zp.hasOwnProperty(e)&&Zp[e]?(""+t).trim():t+"px"}function NF(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,a=AF(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,a):e[r]=a}}var fX=br({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 gT(e,t){if(t){if(fX[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ce(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ce(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ce(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ce(62))}}function mT(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 yT=null;function IN(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xT=null,nf=null,af=null;function kD(e){if(e=Pm(e)){if(typeof xT!="function")throw Error(Ce(280));var t=e.stateNode;t&&(t=Kb(t),xT(e.stateNode,e.type,t))}}function kF(e){nf?af?af.push(e):af=[e]:nf=e}function LF(){if(nf){var e=nf,t=af;if(af=nf=null,kD(e),t)for(e=0;e>>=0,e===0?32:31-(CX(e)/TX|0)|0}var ky=64,Ly=4194304;function Ip(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 r_(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,a=e.suspendedLanes,i=e.pingedLanes,o=r&268435455;if(o!==0){var s=o&~a;s!==0?n=Ip(s):(i&=o,i!==0&&(n=Ip(i)))}else o=r&~a,o!==0?n=Ip(o):i!==0&&(n=Ip(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&a)&&(a=n&-n,i=t&-t,a>=i||a===16&&(i&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 Lm(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ri(t),e[t]=r}function kX(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=Xp),zD=" ",BD=!1;function qF(e,t){switch(e){case"keyup":return nq.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function KF(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bd=!1;function iq(e,t){switch(e){case"compositionend":return KF(t);case"keypress":return t.which!==32?null:(BD=!0,zD);case"textInput":return e=t.data,e===zD&&BD?null:e;default:return null}}function oq(e,t){if(Bd)return e==="compositionend"||!BN&&qF(e,t)?(e=YF(),gx=RN=Al=null,Bd=!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=HD(r)}}function t6(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?t6(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function r6(){for(var e=window,t=Jx();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Jx(e.document)}return t}function FN(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 pq(e){var t=r6(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&t6(r.ownerDocument.documentElement,r)){if(n!==null&&FN(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 a=r.textContent.length,i=Math.min(n.start,a);n=n.end===void 0?i:Math.min(n.end,a),!e.extend&&i>n&&(a=n,n=i,i=a),a=UD(r,i);var o=UD(r,n);a&&o&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>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,Fd=null,TT=null,Kp=null,MT=!1;function WD(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;MT||Fd==null||Fd!==Jx(n)||(n=Fd,"selectionStart"in n&&FN(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}),Kp&&Ag(Kp,n)||(Kp=n,n=i_(TT,"onSelect"),0Hd||(e.current=PT[Hd],PT[Hd]=null,Hd--)}function sr(e,t){Hd++,PT[Hd]=e.current,e.current=t}var nu={},Fn=pu(nu),pa=pu(!1),Zc=nu;function Sf(e,t){var r=e.type.contextTypes;if(!r)return nu;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in r)a[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function ga(e){return e=e.childContextTypes,e!=null}function s_(){ur(pa),ur(Fn)}function JD(e,t,r){if(Fn.current!==nu)throw Error(Ce(168));sr(Fn,t),sr(pa,r)}function h6(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var a in n)if(!(a in t))throw Error(Ce(108,cX(e)||"Unknown",a));return br({},r,n)}function l_(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||nu,Zc=Fn.current,sr(Fn,e),sr(pa,pa.current),!0}function QD(e,t,r){var n=e.stateNode;if(!n)throw Error(Ce(169));r?(e=h6(e,t,Zc),n.__reactInternalMemoizedMergedChildContext=e,ur(pa),ur(Fn),sr(Fn,e)):ur(pa),sr(pa,r)}var xs=null,Jb=!1,rS=!1;function d6(e){xs===null?xs=[e]:xs.push(e)}function Aq(e){Jb=!0,d6(e)}function gu(){if(!rS&&xs!==null){rS=!0;var e=0,t=Jt;try{var r=xs;for(Jt=1;e>=o,a-=o,bs=1<<32-Ri(t)+a|r<I?(k=A,A=null):k=A.sibling;var P=f(x,A,w[I],S);if(P===null){A===null&&(A=k);break}e&&A&&P.alternate===null&&t(x,A),_=i(P,_,I),M===null?C=P:M.sibling=P,M=P,A=k}if(I===w.length)return r(x,A),vr&&fc(x,I),C;if(A===null){for(;II?(k=A,A=null):k=A.sibling;var D=f(x,A,P.value,S);if(D===null){A===null&&(A=k);break}e&&A&&D.alternate===null&&t(x,A),_=i(D,_,I),M===null?C=D:M.sibling=D,M=D,A=k}if(P.done)return r(x,A),vr&&fc(x,I),C;if(A===null){for(;!P.done;I++,P=w.next())P=h(x,P.value,S),P!==null&&(_=i(P,_,I),M===null?C=P:M.sibling=P,M=P);return vr&&fc(x,I),C}for(A=n(x,A);!P.done;I++,P=w.next())P=v(A,x,I,P.value,S),P!==null&&(e&&P.alternate!==null&&A.delete(P.key===null?I:P.key),_=i(P,_,I),M===null?C=P:M.sibling=P,M=P);return e&&A.forEach(function(z){return t(x,z)}),vr&&fc(x,I),C}function y(x,_,w,S){if(typeof w=="object"&&w!==null&&w.type===zd&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case My:e:{for(var C=w.key,M=_;M!==null;){if(M.key===C){if(C=w.type,C===zd){if(M.tag===7){r(x,M.sibling),_=a(M,w.props.children),_.return=x,x=_;break e}}else if(M.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===bl&&rj(C)===M.type){r(x,M.sibling),_=a(M,w.props),_.ref=Uv(x,M,w),_.return=x,x=_;break e}r(x,M);break}else t(x,M);M=M.sibling}w.type===zd?(_=Oc(w.props.children,x.mode,S,w.key),_.return=x,x=_):(S=Tx(w.type,w.key,w.props,null,x.mode,S),S.ref=Uv(x,_,w),S.return=x,x=S)}return o(x);case Od:e:{for(M=w.key;_!==null;){if(_.key===M)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){r(x,_.sibling),_=a(_,w.children||[]),_.return=x,x=_;break e}else{r(x,_);break}else t(x,_);_=_.sibling}_=cS(w,x.mode,S),_.return=x,x=_}return o(x);case bl:return M=w._init,y(x,_,M(w._payload),S)}if(Lp(w))return g(x,_,w,S);if(Bv(w))return m(x,_,w,S);Oy(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(r(x,_.sibling),_=a(_,w),_.return=x,x=_):(r(x,_),_=uS(w,x.mode,S),_.return=x,x=_),o(x)):r(x,_)}return y}var Tf=g6(!0),m6=g6(!1),h_=pu(null),d_=null,$d=null,UN=null;function WN(){UN=$d=d_=null}function $N(e){var t=h_.current;ur(h_),e._currentValue=t}function ET(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 sf(e,t){d_=e,UN=$d=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(va=!0),e.firstContext=null)}function di(e){var t=e._currentValue;if(UN!==e)if(e={context:e,memoizedValue:t,next:null},$d===null){if(d_===null)throw Error(Ce(308));$d=e,d_.dependencies={lanes:0,firstContext:e}}else $d=$d.next=e;return t}var Ac=null;function ZN(e){Ac===null?Ac=[e]:Ac.push(e)}function y6(e,t,r,n){var a=t.interleaved;return a===null?(r.next=r,ZN(t)):(r.next=a.next,a.next=r),t.interleaved=r,zs(e,n)}function zs(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 wl=!1;function YN(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function x6(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 As(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Vl(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Ht&2){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,zs(e,r)}return a=n.interleaved,a===null?(t.next=t,ZN(n)):(t.next=a.next,a.next=t),n.interleaved=t,zs(e,r)}function yx(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,DN(e,r)}}function nj(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var a=null,i=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};i===null?a=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?a=i=t:i=i.next=t}else a=i=t;r={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:i,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 f_(e,t,r,n){var a=e.updateQueue;wl=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,s=a.shared.pending;if(s!==null){a.shared.pending=null;var l=s,u=l.next;l.next=null,o===null?i=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(i!==null){var h=a.baseState;o=0,c=u=l=null,s=i;do{var f=s.lane,v=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:v,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var g=e,m=s;switch(f=t,v=r,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(v,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(v,h,f):g,f==null)break e;h=br({},h,f);break e;case 2:wl=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=a.effects,f===null?a.effects=[s]:f.push(s))}else v={eventTime:v,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(u=c=v,l=h):c=c.next=v,o|=f;if(s=s.next,s===null){if(s=a.shared.pending,s===null)break;f=s,s=f.next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}while(!0);if(c===null&&(l=h),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=c,t=a.shared.interleaved,t!==null){a=t;do o|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);qc|=o,e.lanes=o,e.memoizedState=h}}function aj(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=aS.transition;aS.transition={};try{e(!1),t()}finally{Jt=r,aS.transition=n}}function R6(){return fi().memoizedState}function Iq(e,t,r){var n=Hl(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},O6(e))z6(t,r);else if(r=y6(e,t,r,n),r!==null){var a=Kn();Oi(r,e,n,a),B6(r,t,n)}}function Pq(e,t,r){var n=Hl(e),a={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(O6(e))z6(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,s=i(o,r);if(a.hasEagerState=!0,a.eagerState=s,Gi(s,o)){var l=t.interleaved;l===null?(a.next=a,ZN(t)):(a.next=l.next,l.next=a),t.interleaved=a;return}}catch{}finally{}r=y6(e,t,a,n),r!==null&&(a=Kn(),Oi(r,e,n,a),B6(r,t,n))}}function O6(e){var t=e.alternate;return e===xr||t!==null&&t===xr}function z6(e,t){Jp=p_=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function B6(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,DN(e,r)}}var g_={readContext:di,useCallback:Nn,useContext:Nn,useEffect:Nn,useImperativeHandle:Nn,useInsertionEffect:Nn,useLayoutEffect:Nn,useMemo:Nn,useReducer:Nn,useRef:Nn,useState:Nn,useDebugValue:Nn,useDeferredValue:Nn,useTransition:Nn,useMutableSource:Nn,useSyncExternalStore:Nn,useId:Nn,unstable_isNewReconciler:!1},Dq={readContext:di,useCallback:function(e,t){return po().memoizedState=[e,t===void 0?null:t],e},useContext:di,useEffect:oj,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,_x(4194308,4,I6.bind(null,t,e),r)},useLayoutEffect:function(e,t){return _x(4194308,4,e,t)},useInsertionEffect:function(e,t){return _x(4,2,e,t)},useMemo:function(e,t){var r=po();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=po();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=Iq.bind(null,xr,e),[n.memoizedState,e]},useRef:function(e){var t=po();return e={current:e},t.memoizedState=e},useState:ij,useDebugValue:rk,useDeferredValue:function(e){return po().memoizedState=e},useTransition:function(){var e=ij(!1),t=e[0];return e=Lq.bind(null,e[1]),po().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=xr,a=po();if(vr){if(r===void 0)throw Error(Ce(407));r=r()}else{if(r=t(),sn===null)throw Error(Ce(349));Xc&30||S6(n,t,r)}a.memoizedState=r;var i={value:r,getSnapshot:t};return a.queue=i,oj(T6.bind(null,n,i,e),[e]),n.flags|=2048,Eg(9,C6.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=po(),t=sn.identifierPrefix;if(vr){var r=ws,n=bs;r=(n&~(1<<32-Ri(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Dg++,0")&&(l=l.replace("",e.displayName)),l}while(1<=o&&0<=s);break}}}finally{Vw=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?kp(e):""}function cX(e){switch(e.tag){case 5:return kp(e.type);case 16:return kp("Lazy");case 13:return kp("Suspense");case 19:return kp("SuspenseList");case 0:case 2:case 15:return e=Gw(e.type,!1),e;case 11:return e=Gw(e.type.render,!1),e;case 1:return e=Gw(e.type,!0),e;default:return""}}function cT(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 zd:return"Fragment";case Od:return"Portal";case sT:return"Profiler";case NN:return"StrictMode";case lT:return"Suspense";case uT:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _F:return(e.displayName||"Context")+".Consumer";case xF:return(e._context.displayName||"Context")+".Provider";case kN:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case LN:return t=e.displayName||null,t!==null?t:cT(e.type)||"Memo";case bl:t=e._payload,e=e._init;try{return cT(e(t))}catch{}}return null}function hX(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 cT(t);case 8:return t===NN?"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 ru(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function wF(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dX(e){var t=wF(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 a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(o){n=""+o,i.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 Ay(e){e._valueTracker||(e._valueTracker=dX(e))}function SF(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=wF(e)?e.checked?"true":"false":e.value),e=n,e!==r?(t.setValue(e),!0):!1}function Jx(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 hT(e,t){var r=t.checked;return br({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function MD(e,t){var r=t.defaultValue==null?"":t.defaultValue,n=t.checked!=null?t.checked:t.defaultChecked;r=ru(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 CF(e,t){t=t.checked,t!=null&&AN(e,"checked",t,!1)}function dT(e,t){CF(e,t);var r=ru(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")?fT(e,t.type,r):t.hasOwnProperty("defaultValue")&&fT(e,t.type,ru(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 fT(e,t,r){(t!=="number"||Jx(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var Lp=Array.isArray;function rf(e,t,r,n){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=Ny.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function bg(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Zp={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},fX=["Webkit","ms","Moz","O"];Object.keys(Zp).forEach(function(e){fX.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Zp[t]=Zp[e]})});function NF(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Zp.hasOwnProperty(e)&&Zp[e]?(""+t).trim():t+"px"}function kF(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var n=r.indexOf("--")===0,a=NF(r,t[r],n);r==="float"&&(r="cssFloat"),n?e.setProperty(r,a):e[r]=a}}var vX=br({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 gT(e,t){if(t){if(vX[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ce(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ce(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ce(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ce(62))}}function mT(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 yT=null;function IN(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xT=null,nf=null,af=null;function LD(e){if(e=Pm(e)){if(typeof xT!="function")throw Error(Ce(280));var t=e.stateNode;t&&(t=Kb(t),xT(e.stateNode,e.type,t))}}function LF(e){nf?af?af.push(e):af=[e]:nf=e}function IF(){if(nf){var e=nf,t=af;if(af=nf=null,LD(e),t)for(e=0;e>>=0,e===0?32:31-(TX(e)/MX|0)|0}var ky=64,Ly=4194304;function Ip(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 r_(e,t){var r=e.pendingLanes;if(r===0)return 0;var n=0,a=e.suspendedLanes,i=e.pingedLanes,o=r&268435455;if(o!==0){var s=o&~a;s!==0?n=Ip(s):(i&=o,i!==0&&(n=Ip(i)))}else o=r&~a,o!==0?n=Ip(o):i!==0&&(n=Ip(i));if(n===0)return 0;if(t!==0&&t!==n&&!(t&a)&&(a=n&-n,i=t&-t,a>=i||a===16&&(i&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 Lm(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ri(t),e[t]=r}function LX(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=Xp),BD=" ",FD=!1;function KF(e,t){switch(e){case"keyup":return aq.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function JF(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Bd=!1;function oq(e,t){switch(e){case"compositionend":return JF(t);case"keypress":return t.which!==32?null:(FD=!0,BD);case"textInput":return e=t.data,e===BD&&FD?null:e;default:return null}}function sq(e,t){if(Bd)return e==="compositionend"||!BN&&KF(e,t)?(e=XF(),gx=RN=Al=null,Bd=!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=UD(r)}}function r6(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?r6(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function n6(){for(var e=window,t=Jx();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Jx(e.document)}return t}function FN(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 gq(e){var t=n6(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&r6(r.ownerDocument.documentElement,r)){if(n!==null&&FN(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 a=r.textContent.length,i=Math.min(n.start,a);n=n.end===void 0?i:Math.min(n.end,a),!e.extend&&i>n&&(a=n,n=i,i=a),a=WD(r,i);var o=WD(r,n);a&&o&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>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,Fd=null,TT=null,Kp=null,MT=!1;function $D(e,t,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;MT||Fd==null||Fd!==Jx(n)||(n=Fd,"selectionStart"in n&&FN(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}),Kp&&Ag(Kp,n)||(Kp=n,n=i_(TT,"onSelect"),0Hd||(e.current=PT[Hd],PT[Hd]=null,Hd--)}function sr(e,t){Hd++,PT[Hd]=e.current,e.current=t}var nu={},Vn=pu(nu),pa=pu(!1),Zc=nu;function Sf(e,t){var r=e.type.contextTypes;if(!r)return nu;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in r)a[i]=t[i];return n&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function ga(e){return e=e.childContextTypes,e!=null}function s_(){ur(pa),ur(Vn)}function QD(e,t,r){if(Vn.current!==nu)throw Error(Ce(168));sr(Vn,t),sr(pa,r)}function d6(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var a in n)if(!(a in t))throw Error(Ce(108,hX(e)||"Unknown",a));return br({},r,n)}function l_(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||nu,Zc=Vn.current,sr(Vn,e),sr(pa,pa.current),!0}function ej(e,t,r){var n=e.stateNode;if(!n)throw Error(Ce(169));r?(e=d6(e,t,Zc),n.__reactInternalMemoizedMergedChildContext=e,ur(pa),ur(Vn),sr(Vn,e)):ur(pa),sr(pa,r)}var xs=null,Jb=!1,rS=!1;function f6(e){xs===null?xs=[e]:xs.push(e)}function Nq(e){Jb=!0,f6(e)}function gu(){if(!rS&&xs!==null){rS=!0;var e=0,t=Jt;try{var r=xs;for(Jt=1;e>=o,a-=o,bs=1<<32-Ri(t)+a|r<k?(I=A,A=null):I=A.sibling;var P=f(x,A,w[k],S);if(P===null){A===null&&(A=I);break}e&&A&&P.alternate===null&&t(x,A),_=i(P,_,k),M===null?C=P:M.sibling=P,M=P,A=I}if(k===w.length)return r(x,A),vr&&fc(x,k),C;if(A===null){for(;kk?(I=A,A=null):I=A.sibling;var j=f(x,A,P.value,S);if(j===null){A===null&&(A=I);break}e&&A&&j.alternate===null&&t(x,A),_=i(j,_,k),M===null?C=j:M.sibling=j,M=j,A=I}if(P.done)return r(x,A),vr&&fc(x,k),C;if(A===null){for(;!P.done;k++,P=w.next())P=h(x,P.value,S),P!==null&&(_=i(P,_,k),M===null?C=P:M.sibling=P,M=P);return vr&&fc(x,k),C}for(A=n(x,A);!P.done;k++,P=w.next())P=v(A,x,k,P.value,S),P!==null&&(e&&P.alternate!==null&&A.delete(P.key===null?k:P.key),_=i(P,_,k),M===null?C=P:M.sibling=P,M=P);return e&&A.forEach(function(z){return t(x,z)}),vr&&fc(x,k),C}function y(x,_,w,S){if(typeof w=="object"&&w!==null&&w.type===zd&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case My:e:{for(var C=w.key,M=_;M!==null;){if(M.key===C){if(C=w.type,C===zd){if(M.tag===7){r(x,M.sibling),_=a(M,w.props.children),_.return=x,x=_;break e}}else if(M.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===bl&&nj(C)===M.type){r(x,M.sibling),_=a(M,w.props),_.ref=Uv(x,M,w),_.return=x,x=_;break e}r(x,M);break}else t(x,M);M=M.sibling}w.type===zd?(_=Oc(w.props.children,x.mode,S,w.key),_.return=x,x=_):(S=Tx(w.type,w.key,w.props,null,x.mode,S),S.ref=Uv(x,_,w),S.return=x,x=S)}return o(x);case Od:e:{for(M=w.key;_!==null;){if(_.key===M)if(_.tag===4&&_.stateNode.containerInfo===w.containerInfo&&_.stateNode.implementation===w.implementation){r(x,_.sibling),_=a(_,w.children||[]),_.return=x,x=_;break e}else{r(x,_);break}else t(x,_);_=_.sibling}_=cS(w,x.mode,S),_.return=x,x=_}return o(x);case bl:return M=w._init,y(x,_,M(w._payload),S)}if(Lp(w))return g(x,_,w,S);if(Bv(w))return m(x,_,w,S);Oy(x,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,_!==null&&_.tag===6?(r(x,_.sibling),_=a(_,w),_.return=x,x=_):(r(x,_),_=uS(w,x.mode,S),_.return=x,x=_),o(x)):r(x,_)}return y}var Tf=m6(!0),y6=m6(!1),h_=pu(null),d_=null,$d=null,UN=null;function WN(){UN=$d=d_=null}function $N(e){var t=h_.current;ur(h_),e._currentValue=t}function ET(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 sf(e,t){d_=e,UN=$d=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(va=!0),e.firstContext=null)}function fi(e){var t=e._currentValue;if(UN!==e)if(e={context:e,memoizedValue:t,next:null},$d===null){if(d_===null)throw Error(Ce(308));$d=e,d_.dependencies={lanes:0,firstContext:e}}else $d=$d.next=e;return t}var Ac=null;function ZN(e){Ac===null?Ac=[e]:Ac.push(e)}function x6(e,t,r,n){var a=t.interleaved;return a===null?(r.next=r,ZN(t)):(r.next=a.next,a.next=r),t.interleaved=r,zs(e,n)}function zs(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 wl=!1;function YN(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _6(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 As(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Vl(e,t,r){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,Ht&2){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,zs(e,r)}return a=n.interleaved,a===null?(t.next=t,ZN(n)):(t.next=a.next,a.next=t),n.interleaved=t,zs(e,r)}function yx(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,DN(e,r)}}function aj(e,t){var r=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,r===n)){var a=null,i=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};i===null?a=i=o:i=i.next=o,r=r.next}while(r!==null);i===null?a=i=t:i=i.next=t}else a=i=t;r={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:i,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 f_(e,t,r,n){var a=e.updateQueue;wl=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,s=a.shared.pending;if(s!==null){a.shared.pending=null;var l=s,u=l.next;l.next=null,o===null?i=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(i!==null){var h=a.baseState;o=0,c=u=l=null,s=i;do{var f=s.lane,v=s.eventTime;if((n&f)===f){c!==null&&(c=c.next={eventTime:v,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var g=e,m=s;switch(f=t,v=r,m.tag){case 1:if(g=m.payload,typeof g=="function"){h=g.call(v,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(v,h,f):g,f==null)break e;h=br({},h,f);break e;case 2:wl=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=a.effects,f===null?a.effects=[s]:f.push(s))}else v={eventTime:v,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(u=c=v,l=h):c=c.next=v,o|=f;if(s=s.next,s===null){if(s=a.shared.pending,s===null)break;f=s,s=f.next,f.next=null,a.lastBaseUpdate=f,a.shared.pending=null}}while(!0);if(c===null&&(l=h),a.baseState=l,a.firstBaseUpdate=u,a.lastBaseUpdate=c,t=a.shared.interleaved,t!==null){a=t;do o|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);qc|=o,e.lanes=o,e.memoizedState=h}}function ij(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;tr?r:4,e(!0);var n=aS.transition;aS.transition={};try{e(!1),t()}finally{Jt=r,aS.transition=n}}function O6(){return vi().memoizedState}function Pq(e,t,r){var n=Hl(e);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},z6(e))B6(t,r);else if(r=x6(e,t,r,n),r!==null){var a=Qn();Oi(r,e,n,a),F6(r,t,n)}}function Dq(e,t,r){var n=Hl(e),a={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(z6(e))B6(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,s=i(o,r);if(a.hasEagerState=!0,a.eagerState=s,Gi(s,o)){var l=t.interleaved;l===null?(a.next=a,ZN(t)):(a.next=l.next,l.next=a),t.interleaved=a;return}}catch{}finally{}r=x6(e,t,a,n),r!==null&&(a=Qn(),Oi(r,e,n,a),F6(r,t,n))}}function z6(e){var t=e.alternate;return e===xr||t!==null&&t===xr}function B6(e,t){Jp=p_=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function F6(e,t,r){if(r&4194240){var n=t.lanes;n&=e.pendingLanes,r|=n,t.lanes=r,DN(e,r)}}var g_={readContext:fi,useCallback:Nn,useContext:Nn,useEffect:Nn,useImperativeHandle:Nn,useInsertionEffect:Nn,useLayoutEffect:Nn,useMemo:Nn,useReducer:Nn,useRef:Nn,useState:Nn,useDebugValue:Nn,useDeferredValue:Nn,useTransition:Nn,useMutableSource:Nn,useSyncExternalStore:Nn,useId:Nn,unstable_isNewReconciler:!1},jq={readContext:fi,useCallback:function(e,t){return po().memoizedState=[e,t===void 0?null:t],e},useContext:fi,useEffect:sj,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,_x(4194308,4,P6.bind(null,t,e),r)},useLayoutEffect:function(e,t){return _x(4194308,4,e,t)},useInsertionEffect:function(e,t){return _x(4,2,e,t)},useMemo:function(e,t){var r=po();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=po();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=Pq.bind(null,xr,e),[n.memoizedState,e]},useRef:function(e){var t=po();return e={current:e},t.memoizedState=e},useState:oj,useDebugValue:rk,useDeferredValue:function(e){return po().memoizedState=e},useTransition:function(){var e=oj(!1),t=e[0];return e=Iq.bind(null,e[1]),po().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=xr,a=po();if(vr){if(r===void 0)throw Error(Ce(407));r=r()}else{if(r=t(),sn===null)throw Error(Ce(349));Xc&30||C6(n,t,r)}a.memoizedState=r;var i={value:r,getSnapshot:t};return a.queue=i,sj(M6.bind(null,n,i,e),[e]),n.flags|=2048,Eg(9,T6.bind(null,n,i,r,t),void 0,null),r},useId:function(){var e=po(),t=sn.identifierPrefix;if(vr){var r=ws,n=bs;r=(n&~(1<<32-Ri(n)-1)).toString(32)+r,t=":"+t+"R"+r,r=Dg++,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[mo]=t,e[Lg]=n,X6(e,t,!1,!1),t.stateNode=e;e:{switch(o=mT(r,n),r){case"dialog":lr("cancel",e),lr("close",e),a=n;break;case"iframe":case"object":case"embed":lr("load",e),a=n;break;case"video":case"audio":for(a=0;aNf&&(t.flags|=128,n=!0,Wv(i,!1),t.lanes=4194304)}else{if(!n)if(e=v_(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Wv(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!vr)return kn(t),null}else 2*Dr()-i.renderingStartTime>Nf&&r!==1073741824&&(t.flags|=128,n=!0,Wv(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(r=i.last,r!==null?r.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Dr(),t.sibling=null,r=yr.current,sr(yr,n?r&1|2:r&1),t):(kn(t),null);case 22:case 23:return lk(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Ca&1073741824&&(kn(t),t.subtreeFlags&6&&(t.flags|=8192)):kn(t),null;case 24:return null;case 25:return null}throw Error(Ce(156,t.tag))}function Vq(e,t){switch(GN(t),t.tag){case 1:return ga(t.type)&&s_(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Mf(),ur(pa),ur(Fn),KN(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return qN(t),null;case 13:if(ur(yr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ce(340));Cf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ur(yr),null;case 4:return Mf(),null;case 10:return $N(t.type._context),null;case 22:case 23:return lk(),null;case 24:return null;default:return null}}var By=!1,En=!1,Gq=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function Zd(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Sr(e,t,n)}else r.current=null}function UT(e,t,r){try{r()}catch(n){Sr(e,t,n)}}var mj=!1;function Hq(e,t){if(AT=n_,e=r6(),FN(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 a=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.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 v;h!==r||a!==0&&h.nodeType!==3||(s=o+a),h!==i||n!==0&&h.nodeType!==3||(l=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(v=h.firstChild)!==null;)f=h,h=v;for(;;){if(h===e)break t;if(f===r&&++u===a&&(s=o),f===i&&++c===n&&(l=o),(v=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=v}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(NT={focusedElem:e,selectionRange:r},n_=!1,Ve=t;Ve!==null;)if(t=Ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ve=e;else for(;Ve!==null;){t=Ve;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,x=t.stateNode,_=x.getSnapshotBeforeUpdate(t.elementType===t.type?m:Ii(t.type,m),y);x.__reactInternalSnapshotBeforeUpdate=_}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(Ce(163))}}catch(S){Sr(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Ve=e;break}Ve=t.return}return g=mj,mj=!1,g}function Qp(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&UT(t,r,i)}a=a.next}while(a!==n)}}function t1(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 WT(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 J6(e){var t=e.alternate;t!==null&&(e.alternate=null,J6(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[mo],delete t[Lg],delete t[IT],delete t[Tq],delete t[Mq])),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 Q6(e){return e.tag===5||e.tag===3||e.tag===4}function yj(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Q6(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 $T(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=o_));else if(n!==4&&(e=e.child,e!==null))for($T(e,t,r),e=e.sibling;e!==null;)$T(e,t,r),e=e.sibling}function ZT(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(ZT(e,t,r),e=e.sibling;e!==null;)ZT(e,t,r),e=e.sibling}var dn=null,Di=!1;function ul(e,t,r){for(r=r.child;r!==null;)eV(e,t,r),r=r.sibling}function eV(e,t,r){if(To&&typeof To.onCommitFiberUnmount=="function")try{To.onCommitFiberUnmount(Zb,r)}catch{}switch(r.tag){case 5:En||Zd(r,t);case 6:var n=dn,a=Di;dn=null,ul(e,t,r),dn=n,Di=a,dn!==null&&(Di?(e=dn,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):dn.removeChild(r.stateNode));break;case 18:dn!==null&&(Di?(e=dn,r=r.stateNode,e.nodeType===8?tS(e.parentNode,r):e.nodeType===1&&tS(e,r),Tg(e)):tS(dn,r.stateNode));break;case 4:n=dn,a=Di,dn=r.stateNode.containerInfo,Di=!0,ul(e,t,r),dn=n,Di=a;break;case 0:case 11:case 14:case 15:if(!En&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){a=n=n.next;do{var i=a,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&UT(r,t,o),a=a.next}while(a!==n)}ul(e,t,r);break;case 1:if(!En&&(Zd(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Sr(r,t,s)}ul(e,t,r);break;case 21:ul(e,t,r);break;case 22:r.mode&1?(En=(n=En)||r.memoizedState!==null,ul(e,t,r),En=n):ul(e,t,r);break;default:ul(e,t,r)}}function xj(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Gq),t.forEach(function(n){var a=Jq.bind(null,e,n);r.has(n)||(r.add(n),n.then(a,a))})}}function Ai(e,t){var r=t.deletions;if(r!==null)for(var n=0;na&&(a=o),n&=~i}if(n=a,n=Dr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Wq(n/1960))-n,10e?16:e,Nl===null)var n=!1;else{if(e=Nl,Nl=null,x_=0,Ht&6)throw Error(Ce(331));var a=Ht;for(Ht|=4,Ve=e.current;Ve!==null;){var i=Ve,o=i.child;if(Ve.flags&16){var s=i.deletions;if(s!==null){for(var l=0;lDr()-ok?Rc(e,0):ik|=r),ma(e,t)}function lV(e,t){t===0&&(e.mode&1?(t=Ly,Ly<<=1,!(Ly&130023424)&&(Ly=4194304)):t=1);var r=Kn();e=zs(e,t),e!==null&&(Lm(e,t,r),ma(e,r))}function Kq(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),lV(e,r)}function Jq(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Ce(314))}n!==null&&n.delete(t),lV(e,r)}var uV;uV=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||pa.current)va=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return va=!1,Bq(e,t,r);va=!!(e.flags&131072)}else va=!1,vr&&t.flags&1048576&&f6(t,c_,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;bx(e,t),e=t.pendingProps;var a=Sf(t,Fn.current);sf(t,r),a=QN(null,t,n,e,a,r);var i=ek();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ga(n)?(i=!0,l_(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,YN(t),a.updater=e1,t.stateNode=a,a._reactInternals=t,OT(t,n,e,r),t=FT(null,t,n,!0,i,r)):(t.tag=0,vr&&i&&VN(t),$n(null,t,a,r),t=t.child),t;case 16:n=t.elementType;e:{switch(bx(e,t),e=t.pendingProps,a=n._init,n=a(n._payload),t.type=n,a=t.tag=eK(n),e=Ii(n,e),a){case 0:t=BT(null,t,n,e,r);break e;case 1:t=vj(null,t,n,e,r);break e;case 11:t=dj(null,t,n,e,r);break e;case 14:t=fj(null,t,n,Ii(n.type,e),r);break e}throw Error(Ce(306,n,""))}return t;case 0:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),BT(e,t,n,a,r);case 1:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),vj(e,t,n,a,r);case 3:e:{if($6(t),e===null)throw Error(Ce(387));n=t.pendingProps,i=t.memoizedState,a=i.element,x6(e,t),f_(t,n,null,r);var o=t.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Af(Error(Ce(423)),t),t=pj(e,t,n,r,a);break e}else if(n!==a){a=Af(Error(Ce(424)),t),t=pj(e,t,n,r,a);break e}else for(Na=Fl(t.stateNode.containerInfo.firstChild),Pa=t,vr=!0,ji=null,r=m6(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Cf(),n===a){t=Bs(e,t,r);break e}$n(e,t,n,r)}t=t.child}return t;case 5:return _6(t),e===null&&jT(t),n=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,kT(n,a)?o=null:i!==null&&kT(n,i)&&(t.flags|=32),W6(e,t),$n(e,t,o,r),t.child;case 6:return e===null&&jT(t),null;case 13:return Z6(e,t,r);case 4:return XN(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Tf(t,null,n,r):$n(e,t,n,r),t.child;case 11:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),dj(e,t,n,a,r);case 7:return $n(e,t,t.pendingProps,r),t.child;case 8:return $n(e,t,t.pendingProps.children,r),t.child;case 12:return $n(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,a=t.pendingProps,i=t.memoizedProps,o=a.value,sr(h_,n._currentValue),n._currentValue=o,i!==null)if(Gi(i.value,o)){if(i.children===a.children&&!pa.current){t=Bs(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){o=i.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=As(-1,r&-r),l.tag=2;var u=i.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}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),ET(i.return,r,t),s.lanes|=r;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(Ce(341));o.lanes|=r,s=o.alternate,s!==null&&(s.lanes|=r),ET(o,r,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}$n(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,n=t.pendingProps.children,sf(t,r),a=di(a),n=n(a),t.flags|=1,$n(e,t,n,r),t.child;case 14:return n=t.type,a=Ii(n,t.pendingProps),a=Ii(n.type,a),fj(e,t,n,a,r);case 15:return H6(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),bx(e,t),t.tag=1,ga(n)?(e=!0,l_(t)):e=!1,sf(t,r),F6(t,n,a),OT(t,n,a,r),FT(null,t,n,!0,e,r);case 19:return Y6(e,t,r);case 22:return U6(e,t,r)}throw Error(Ce(156,t.tag))};function cV(e,t){return OF(e,t)}function Qq(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 ii(e,t,r,n){return new Qq(e,t,r,n)}function ck(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eK(e){if(typeof e=="function")return ck(e)?1:0;if(e!=null){if(e=e.$$typeof,e===kN)return 11;if(e===LN)return 14}return 2}function Ul(e,t){var r=e.alternate;return r===null?(r=ii(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 Tx(e,t,r,n,a,i){var o=2;if(n=e,typeof e=="function")ck(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case zd:return Oc(r.children,a,i,t);case NN:o=8,a|=8;break;case sT:return e=ii(12,r,t,a|2),e.elementType=sT,e.lanes=i,e;case lT:return e=ii(13,r,t,a),e.elementType=lT,e.lanes=i,e;case uT:return e=ii(19,r,t,a),e.elementType=uT,e.lanes=i,e;case _F:return n1(r,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case yF:o=10;break e;case xF:o=9;break e;case kN:o=11;break e;case LN:o=14;break e;case bl:o=16,n=null;break e}throw Error(Ce(130,e==null?e:typeof e,""))}return t=ii(o,r,t,a),t.elementType=e,t.type=n,t.lanes=i,t}function Oc(e,t,r,n){return e=ii(7,e,n,t),e.lanes=r,e}function n1(e,t,r,n){return e=ii(22,e,n,t),e.elementType=_F,e.lanes=r,e.stateNode={isHidden:!1},e}function uS(e,t,r){return e=ii(6,e,null,t),e.lanes=r,e}function cS(e,t,r){return t=ii(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tK(e,t,r,n,a){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=Uw(0),this.expirationTimes=Uw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uw(0),this.identifierPrefix=n,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function hk(e,t,r,n,a,i,o,s,l){return e=new tK(e,t,r,s,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ii(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},YN(i),e}function rK(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vV)}catch(e){console.error(e)}}vV(),vF.exports=Oa;var pV=vF.exports,Aj=pV;iT.createRoot=Aj.createRoot,iT.hydrateRoot=Aj.hydrateRoot;/** +`+i.stack}return{value:e,source:t,stack:a,digest:null}}function sS(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function zT(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var Oq=typeof WeakMap=="function"?WeakMap:Map;function G6(e,t,r){r=As(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){y_||(y_=!0,YT=n),zT(e,t)},r}function H6(e,t,r){r=As(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var a=t.value;r.payload=function(){return n(a)},r.callback=function(){zT(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){zT(e,t),typeof n!="function"&&(Gl===null?Gl=new Set([this]):Gl.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),r}function cj(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new Oq;var a=new Set;n.set(t,a)}else a=n.get(t),a===void 0&&(a=new Set,n.set(t,a));a.has(r)||(a.add(r),e=Kq.bind(null,e,t,r),t.then(e,e))}function hj(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function dj(e,t,r,n,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=As(-1,1),t.tag=2,Vl(r,t,1))),r.lanes|=1),e)}var zq=qs.ReactCurrentOwner,va=!1;function Yn(e,t,r,n){t.child=e===null?y6(t,null,r,n):Tf(t,e.child,r,n)}function fj(e,t,r,n,a){r=r.render;var i=t.ref;return sf(t,a),n=QN(e,t,r,n,i,a),r=ek(),e!==null&&!va?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Bs(e,t,a)):(vr&&r&&VN(t),t.flags|=1,Yn(e,t,n,a),t.child)}function vj(e,t,r,n,a){if(e===null){var i=r.type;return typeof i=="function"&&!ck(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,U6(e,t,i,n,a)):(e=Tx(r.type,null,n,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&a)){var o=i.memoizedProps;if(r=r.compare,r=r!==null?r:Ag,r(o,n)&&e.ref===t.ref)return Bs(e,t,a)}return t.flags|=1,e=Ul(i,n),e.ref=t.ref,e.return=t,t.child=e}function U6(e,t,r,n,a){if(e!==null){var i=e.memoizedProps;if(Ag(i,n)&&e.ref===t.ref)if(va=!1,t.pendingProps=n=i,(e.lanes&a)!==0)e.flags&131072&&(va=!0);else return t.lanes=e.lanes,Bs(e,t,a)}return BT(e,t,r,n,a)}function W6(e,t,r){var n=t.pendingProps,a=n.children,i=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},sr(Yd,Ta),Ta|=r;else{if(!(r&1073741824))return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,sr(Yd,Ta),Ta|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,sr(Yd,Ta),Ta|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,sr(Yd,Ta),Ta|=n;return Yn(e,t,a,r),t.child}function $6(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function BT(e,t,r,n,a){var i=ga(r)?Zc:Vn.current;return i=Sf(t,i),sf(t,a),r=QN(e,t,r,n,i,a),n=ek(),e!==null&&!va?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Bs(e,t,a)):(vr&&n&&VN(t),t.flags|=1,Yn(e,t,r,a),t.child)}function pj(e,t,r,n,a){if(ga(r)){var i=!0;l_(t)}else i=!1;if(sf(t,a),t.stateNode===null)bx(e,t),V6(t,r,n),OT(t,r,n,a),n=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var l=o.context,u=r.contextType;typeof u=="object"&&u!==null?u=fi(u):(u=ga(r)?Zc:Vn.current,u=Sf(t,u));var c=r.getDerivedStateFromProps,h=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==n||l!==u)&&uj(t,o,n,u),wl=!1;var f=t.memoizedState;o.state=f,f_(t,n,o,a),l=t.memoizedState,s!==n||f!==l||pa.current||wl?(typeof c=="function"&&(RT(t,r,c,n),l=t.memoizedState),(s=wl||lj(t,r,s,n,f,l,u))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=l),o.props=n,o.state=l,o.context=u,n=s):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,_6(e,t),s=t.memoizedProps,u=t.type===t.elementType?s:Ii(t.type,s),o.props=u,h=t.pendingProps,f=o.context,l=r.contextType,typeof l=="object"&&l!==null?l=fi(l):(l=ga(r)?Zc:Vn.current,l=Sf(t,l));var v=r.getDerivedStateFromProps;(c=typeof v=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==h||f!==l)&&uj(t,o,n,l),wl=!1,f=t.memoizedState,o.state=f,f_(t,n,o,a);var g=t.memoizedState;s!==h||f!==g||pa.current||wl?(typeof v=="function"&&(RT(t,r,v,n),g=t.memoizedState),(u=wl||lj(t,r,u,n,f,g,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(n,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(n,g,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=g),o.props=n,o.state=g,o.context=l,n=u):(typeof o.componentDidUpdate!="function"||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),n=!1)}return FT(e,t,r,n,i,a)}function FT(e,t,r,n,a,i){$6(e,t);var o=(t.flags&128)!==0;if(!n&&!o)return a&&ej(t,r,!1),Bs(e,t,i);n=t.stateNode,zq.current=t;var s=o&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&o?(t.child=Tf(t,e.child,null,i),t.child=Tf(t,null,s,i)):Yn(e,t,s,i),t.memoizedState=n.state,a&&ej(t,r,!0),t.child}function Z6(e){var t=e.stateNode;t.pendingContext?QD(e,t.pendingContext,t.pendingContext!==t.context):t.context&&QD(e,t.context,!1),XN(e,t.containerInfo)}function gj(e,t,r,n,a){return Cf(),HN(a),t.flags|=256,Yn(e,t,r,n),t.child}var VT={dehydrated:null,treeContext:null,retryLane:0};function GT(e){return{baseLanes:e,cachePool:null,transitions:null}}function Y6(e,t,r){var n=t.pendingProps,a=yr.current,i=!1,o=(t.flags&128)!==0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(a&2)!==0),s?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),sr(yr,a&1),e===null)return jT(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=n.children,e=n.fallback,i?(n=t.mode,i=t.child,o={mode:"hidden",children:o},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=n1(o,n,0,null),e=Oc(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=GT(r),t.memoizedState=VT,e):nk(t,o));if(a=e.memoizedState,a!==null&&(s=a.dehydrated,s!==null))return Bq(e,t,o,n,s,a,r);if(i){i=n.fallback,o=t.mode,a=e.child,s=a.sibling;var l={mode:"hidden",children:n.children};return!(o&1)&&t.child!==a?(n=t.child,n.childLanes=0,n.pendingProps=l,t.deletions=null):(n=Ul(a,l),n.subtreeFlags=a.subtreeFlags&14680064),s!==null?i=Ul(s,i):(i=Oc(i,o,r,null),i.flags|=2),i.return=t,n.return=t,n.sibling=i,t.child=n,n=i,i=t.child,o=e.child.memoizedState,o=o===null?GT(r):{baseLanes:o.baseLanes|r,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~r,t.memoizedState=VT,n}return i=e.child,e=i.sibling,n=Ul(i,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function nk(e,t){return t=n1({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function zy(e,t,r,n){return n!==null&&HN(n),Tf(t,e.child,null,r),e=nk(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Bq(e,t,r,n,a,i,o){if(r)return t.flags&256?(t.flags&=-257,n=sS(Error(Ce(422))),zy(e,t,o,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,a=t.mode,n=n1({mode:"visible",children:n.children},a,0,null),i=Oc(i,a,o,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&Tf(t,e.child,null,o),t.child.memoizedState=GT(o),t.memoizedState=VT,i);if(!(t.mode&1))return zy(e,t,o,null);if(a.data==="$!"){if(n=a.nextSibling&&a.nextSibling.dataset,n)var s=n.dgst;return n=s,i=Error(Ce(419)),n=sS(i,n,void 0),zy(e,t,o,n)}if(s=(o&e.childLanes)!==0,va||s){if(n=sn,n!==null){switch(o&-o){case 4:a=2;break;case 16:a=8;break;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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(n.suspendedLanes|o)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,zs(e,a),Oi(n,e,a,-1))}return uk(),n=sS(Error(Ce(421))),zy(e,t,o,n)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=Jq.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,ka=Fl(a.nextSibling),Da=t,vr=!0,ji=null,e!==null&&(ri[ni++]=bs,ri[ni++]=ws,ri[ni++]=Yc,bs=e.id,ws=e.overflow,Yc=t),t=nk(t,n.children),t.flags|=4096,t)}function mj(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),ET(e.return,t,r)}function lS(e,t,r,n,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=a)}function X6(e,t,r){var n=t.pendingProps,a=n.revealOrder,i=n.tail;if(Yn(e,t,n.children,r),n=yr.current,n&2)n=n&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&mj(e,r,t);else if(e.tag===19)mj(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(sr(yr,n),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(r=t.child,a=null;r!==null;)e=r.alternate,e!==null&&v_(e)===null&&(a=r),r=r.sibling;r=a,r===null?(a=t.child,t.child=null):(a=r.sibling,r.sibling=null),lS(t,!1,a,r,i);break;case"backwards":for(r=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&v_(e)===null){t.child=a;break}e=a.sibling,a.sibling=r,r=a,a=e}lS(t,!0,r,null,i);break;case"together":lS(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function bx(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Bs(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),qc|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Ce(153));if(t.child!==null){for(e=t.child,r=Ul(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Ul(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Fq(e,t,r){switch(t.tag){case 3:Z6(t),Cf();break;case 5:b6(t);break;case 1:ga(t.type)&&l_(t);break;case 4:XN(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,a=t.memoizedProps.value;sr(h_,n._currentValue),n._currentValue=a;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(sr(yr,yr.current&1),t.flags|=128,null):r&t.child.childLanes?Y6(e,t,r):(sr(yr,yr.current&1),e=Bs(e,t,r),e!==null?e.sibling:null);sr(yr,yr.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return X6(e,t,r);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),sr(yr,yr.current),n)break;return null;case 22:case 23:return t.lanes=0,W6(e,t,r)}return Bs(e,t,r)}var q6,HT,K6,J6;q6=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};HT=function(){};K6=function(e,t,r,n){var a=e.memoizedProps;if(a!==n){e=t.stateNode,Nc(Mo.current);var i=null;switch(r){case"input":a=hT(e,a),n=hT(e,n),i=[];break;case"select":a=br({},a,{value:void 0}),n=br({},n,{value:void 0}),i=[];break;case"textarea":a=vT(e,a),n=vT(e,n),i=[];break;default:typeof a.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=o_)}gT(r,n);var o;r=null;for(u in a)if(!n.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var s=a[u];for(o in s)s.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(_g.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var l=n[u];if(s=a!=null?a[u]:void 0,n.hasOwnProperty(u)&&l!==s&&(l!=null||s!=null))if(u==="style")if(s){for(o in s)!s.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in l)l.hasOwnProperty(o)&&s[o]!==l[o]&&(r||(r={}),r[o]=l[o])}else r||(i||(i=[]),i.push(u,r)),r=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,s=s?s.__html:void 0,l!=null&&s!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(_g.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&lr("scroll",e),i||s===l||(i=[])):(i=i||[]).push(u,l))}r&&(i=i||[]).push("style",r);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};J6=function(e,t,r,n){r!==n&&(t.flags|=4)};function Wv(e,t){if(!vr)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function kn(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var a=e.child;a!==null;)r|=a.lanes|a.childLanes,n|=a.subtreeFlags&14680064,n|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)r|=a.lanes|a.childLanes,n|=a.subtreeFlags,n|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function Vq(e,t,r){var n=t.pendingProps;switch(GN(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kn(t),null;case 1:return ga(t.type)&&s_(),kn(t),null;case 3:return n=t.stateNode,Mf(),ur(pa),ur(Vn),KN(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ry(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ji!==null&&(KT(ji),ji=null))),HT(e,t),kn(t),null;case 5:qN(t);var a=Nc(Pg.current);if(r=t.type,e!==null&&t.stateNode!=null)K6(e,t,r,n,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(Ce(166));return kn(t),null}if(e=Nc(Mo.current),Ry(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[mo]=t,n[Lg]=i,e=(t.mode&1)!==0,r){case"dialog":lr("cancel",n),lr("close",n);break;case"iframe":case"object":case"embed":lr("load",n);break;case"video":case"audio":for(a=0;a<\/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[mo]=t,e[Lg]=n,q6(e,t,!1,!1),t.stateNode=e;e:{switch(o=mT(r,n),r){case"dialog":lr("cancel",e),lr("close",e),a=n;break;case"iframe":case"object":case"embed":lr("load",e),a=n;break;case"video":case"audio":for(a=0;aNf&&(t.flags|=128,n=!0,Wv(i,!1),t.lanes=4194304)}else{if(!n)if(e=v_(o),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Wv(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!vr)return kn(t),null}else 2*Dr()-i.renderingStartTime>Nf&&r!==1073741824&&(t.flags|=128,n=!0,Wv(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(r=i.last,r!==null?r.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Dr(),t.sibling=null,r=yr.current,sr(yr,n?r&1|2:r&1),t):(kn(t),null);case 22:case 23:return lk(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Ta&1073741824&&(kn(t),t.subtreeFlags&6&&(t.flags|=8192)):kn(t),null;case 24:return null;case 25:return null}throw Error(Ce(156,t.tag))}function Gq(e,t){switch(GN(t),t.tag){case 1:return ga(t.type)&&s_(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Mf(),ur(pa),ur(Vn),KN(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return qN(t),null;case 13:if(ur(yr),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ce(340));Cf()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ur(yr),null;case 4:return Mf(),null;case 10:return $N(t.type._context),null;case 22:case 23:return lk(),null;case 24:return null;default:return null}}var By=!1,Rn=!1,Hq=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function Zd(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){Sr(e,t,n)}else r.current=null}function UT(e,t,r){try{r()}catch(n){Sr(e,t,n)}}var yj=!1;function Uq(e,t){if(AT=n_,e=n6(),FN(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 a=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.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 v;h!==r||a!==0&&h.nodeType!==3||(s=o+a),h!==i||n!==0&&h.nodeType!==3||(l=o+n),h.nodeType===3&&(o+=h.nodeValue.length),(v=h.firstChild)!==null;)f=h,h=v;for(;;){if(h===e)break t;if(f===r&&++u===a&&(s=o),f===i&&++c===n&&(l=o),(v=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=v}r=s===-1||l===-1?null:{start:s,end:l}}else r=null}r=r||{start:0,end:0}}else r=null;for(NT={focusedElem:e,selectionRange:r},n_=!1,Ve=t;Ve!==null;)if(t=Ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ve=e;else for(;Ve!==null;){t=Ve;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,x=t.stateNode,_=x.getSnapshotBeforeUpdate(t.elementType===t.type?m:Ii(t.type,m),y);x.__reactInternalSnapshotBeforeUpdate=_}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(Ce(163))}}catch(S){Sr(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Ve=e;break}Ve=t.return}return g=yj,yj=!1,g}function Qp(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var a=n=n.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&UT(t,r,i)}a=a.next}while(a!==n)}}function t1(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 WT(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 Q6(e){var t=e.alternate;t!==null&&(e.alternate=null,Q6(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[mo],delete t[Lg],delete t[IT],delete t[Mq],delete t[Aq])),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 eV(e){return e.tag===5||e.tag===3||e.tag===4}function xj(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||eV(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 $T(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=o_));else if(n!==4&&(e=e.child,e!==null))for($T(e,t,r),e=e.sibling;e!==null;)$T(e,t,r),e=e.sibling}function ZT(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(ZT(e,t,r),e=e.sibling;e!==null;)ZT(e,t,r),e=e.sibling}var dn=null,Di=!1;function ul(e,t,r){for(r=r.child;r!==null;)tV(e,t,r),r=r.sibling}function tV(e,t,r){if(To&&typeof To.onCommitFiberUnmount=="function")try{To.onCommitFiberUnmount(Zb,r)}catch{}switch(r.tag){case 5:Rn||Zd(r,t);case 6:var n=dn,a=Di;dn=null,ul(e,t,r),dn=n,Di=a,dn!==null&&(Di?(e=dn,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):dn.removeChild(r.stateNode));break;case 18:dn!==null&&(Di?(e=dn,r=r.stateNode,e.nodeType===8?tS(e.parentNode,r):e.nodeType===1&&tS(e,r),Tg(e)):tS(dn,r.stateNode));break;case 4:n=dn,a=Di,dn=r.stateNode.containerInfo,Di=!0,ul(e,t,r),dn=n,Di=a;break;case 0:case 11:case 14:case 15:if(!Rn&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){a=n=n.next;do{var i=a,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&UT(r,t,o),a=a.next}while(a!==n)}ul(e,t,r);break;case 1:if(!Rn&&(Zd(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(s){Sr(r,t,s)}ul(e,t,r);break;case 21:ul(e,t,r);break;case 22:r.mode&1?(Rn=(n=Rn)||r.memoizedState!==null,ul(e,t,r),Rn=n):ul(e,t,r);break;default:ul(e,t,r)}}function _j(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Hq),t.forEach(function(n){var a=Qq.bind(null,e,n);r.has(n)||(r.add(n),n.then(a,a))})}}function Ai(e,t){var r=t.deletions;if(r!==null)for(var n=0;na&&(a=o),n&=~i}if(n=a,n=Dr()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*$q(n/1960))-n,10e?16:e,Nl===null)var n=!1;else{if(e=Nl,Nl=null,x_=0,Ht&6)throw Error(Ce(331));var a=Ht;for(Ht|=4,Ve=e.current;Ve!==null;){var i=Ve,o=i.child;if(Ve.flags&16){var s=i.deletions;if(s!==null){for(var l=0;lDr()-ok?Rc(e,0):ik|=r),ma(e,t)}function uV(e,t){t===0&&(e.mode&1?(t=Ly,Ly<<=1,!(Ly&130023424)&&(Ly=4194304)):t=1);var r=Qn();e=zs(e,t),e!==null&&(Lm(e,t,r),ma(e,r))}function Jq(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),uV(e,r)}function Qq(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(Ce(314))}n!==null&&n.delete(t),uV(e,r)}var cV;cV=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||pa.current)va=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return va=!1,Fq(e,t,r);va=!!(e.flags&131072)}else va=!1,vr&&t.flags&1048576&&v6(t,c_,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;bx(e,t),e=t.pendingProps;var a=Sf(t,Vn.current);sf(t,r),a=QN(null,t,n,e,a,r);var i=ek();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ga(n)?(i=!0,l_(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,YN(t),a.updater=e1,t.stateNode=a,a._reactInternals=t,OT(t,n,e,r),t=FT(null,t,n,!0,i,r)):(t.tag=0,vr&&i&&VN(t),Yn(null,t,a,r),t=t.child),t;case 16:n=t.elementType;e:{switch(bx(e,t),e=t.pendingProps,a=n._init,n=a(n._payload),t.type=n,a=t.tag=tK(n),e=Ii(n,e),a){case 0:t=BT(null,t,n,e,r);break e;case 1:t=pj(null,t,n,e,r);break e;case 11:t=fj(null,t,n,e,r);break e;case 14:t=vj(null,t,n,Ii(n.type,e),r);break e}throw Error(Ce(306,n,""))}return t;case 0:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),BT(e,t,n,a,r);case 1:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),pj(e,t,n,a,r);case 3:e:{if(Z6(t),e===null)throw Error(Ce(387));n=t.pendingProps,i=t.memoizedState,a=i.element,_6(e,t),f_(t,n,null,r);var o=t.memoizedState;if(n=o.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Af(Error(Ce(423)),t),t=gj(e,t,n,r,a);break e}else if(n!==a){a=Af(Error(Ce(424)),t),t=gj(e,t,n,r,a);break e}else for(ka=Fl(t.stateNode.containerInfo.firstChild),Da=t,vr=!0,ji=null,r=y6(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Cf(),n===a){t=Bs(e,t,r);break e}Yn(e,t,n,r)}t=t.child}return t;case 5:return b6(t),e===null&&jT(t),n=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,o=a.children,kT(n,a)?o=null:i!==null&&kT(n,i)&&(t.flags|=32),$6(e,t),Yn(e,t,o,r),t.child;case 6:return e===null&&jT(t),null;case 13:return Y6(e,t,r);case 4:return XN(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=Tf(t,null,n,r):Yn(e,t,n,r),t.child;case 11:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),fj(e,t,n,a,r);case 7:return Yn(e,t,t.pendingProps,r),t.child;case 8:return Yn(e,t,t.pendingProps.children,r),t.child;case 12:return Yn(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,a=t.pendingProps,i=t.memoizedProps,o=a.value,sr(h_,n._currentValue),n._currentValue=o,i!==null)if(Gi(i.value,o)){if(i.children===a.children&&!pa.current){t=Bs(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){o=i.child;for(var l=s.firstContext;l!==null;){if(l.context===n){if(i.tag===1){l=As(-1,r&-r),l.tag=2;var u=i.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}}i.lanes|=r,l=i.alternate,l!==null&&(l.lanes|=r),ET(i.return,r,t),s.lanes|=r;break}l=l.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(Ce(341));o.lanes|=r,s=o.alternate,s!==null&&(s.lanes|=r),ET(o,r,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Yn(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,n=t.pendingProps.children,sf(t,r),a=fi(a),n=n(a),t.flags|=1,Yn(e,t,n,r),t.child;case 14:return n=t.type,a=Ii(n,t.pendingProps),a=Ii(n.type,a),vj(e,t,n,a,r);case 15:return U6(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,a=t.pendingProps,a=t.elementType===n?a:Ii(n,a),bx(e,t),t.tag=1,ga(n)?(e=!0,l_(t)):e=!1,sf(t,r),V6(t,n,a),OT(t,n,a,r),FT(null,t,n,!0,e,r);case 19:return X6(e,t,r);case 22:return W6(e,t,r)}throw Error(Ce(156,t.tag))};function hV(e,t){return zF(e,t)}function eK(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 oi(e,t,r,n){return new eK(e,t,r,n)}function ck(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tK(e){if(typeof e=="function")return ck(e)?1:0;if(e!=null){if(e=e.$$typeof,e===kN)return 11;if(e===LN)return 14}return 2}function Ul(e,t){var r=e.alternate;return r===null?(r=oi(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 Tx(e,t,r,n,a,i){var o=2;if(n=e,typeof e=="function")ck(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case zd:return Oc(r.children,a,i,t);case NN:o=8,a|=8;break;case sT:return e=oi(12,r,t,a|2),e.elementType=sT,e.lanes=i,e;case lT:return e=oi(13,r,t,a),e.elementType=lT,e.lanes=i,e;case uT:return e=oi(19,r,t,a),e.elementType=uT,e.lanes=i,e;case bF:return n1(r,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xF:o=10;break e;case _F:o=9;break e;case kN:o=11;break e;case LN:o=14;break e;case bl:o=16,n=null;break e}throw Error(Ce(130,e==null?e:typeof e,""))}return t=oi(o,r,t,a),t.elementType=e,t.type=n,t.lanes=i,t}function Oc(e,t,r,n){return e=oi(7,e,n,t),e.lanes=r,e}function n1(e,t,r,n){return e=oi(22,e,n,t),e.elementType=bF,e.lanes=r,e.stateNode={isHidden:!1},e}function uS(e,t,r){return e=oi(6,e,null,t),e.lanes=r,e}function cS(e,t,r){return t=oi(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function rK(e,t,r,n,a){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=Uw(0),this.expirationTimes=Uw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uw(0),this.identifierPrefix=n,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function hk(e,t,r,n,a,i,o,s,l){return e=new rK(e,t,r,s,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=oi(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},YN(i),e}function nK(e,t,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(pV)}catch(e){console.error(e)}}pV(),pF.exports=za;var gV=pF.exports,Nj=gV;iT.createRoot=Nj.createRoot,iT.hydrateRoot=Nj.hydrateRoot;/** * @remix-run/router v1.23.3 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+i.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Og(){return Og=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function pk(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function lK(){return Math.random().toString(36).substr(2,8)}function kj(e,t){return{usr:e.state,key:e.key,idx:t}}function JT(e,t,r,n){return r===void 0&&(r=null),Og({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ev(t):t,{state:r,key:t&&t.key||n||lK()})}function w_(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 ev(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 uK(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,s=kl.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(Og({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function h(){s=kl.Pop;let y=c(),x=y==null?null:y-u;u=y,l&&l({action:s,location:m.location,delta:x})}function f(y,x){s=kl.Push;let _=JT(m.location,y,x);u=c()+1;let w=kj(_,u),S=m.createHref(_);try{o.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(S)}i&&l&&l({action:s,location:m.location,delta:1})}function v(y,x){s=kl.Replace;let _=JT(m.location,y,x);u=c();let w=kj(_,u),S=m.createHref(_);o.replaceState(w,"",S),i&&l&&l({action:s,location:m.location,delta:0})}function g(y){let x=a.location.origin!=="null"?a.location.origin:a.location.href,_=typeof y=="string"?y:w_(y);return _=_.replace(/ $/,"%20"),jr(x,"No window.location.(origin|href) available to create URL for href: "+_),new URL(_,x)}let m={get action(){return s},get location(){return e(a,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(Nj,h),l=y,()=>{a.removeEventListener(Nj,h),l=null}},createHref(y){return t(a,y)},createURL:g,encodeLocation(y){let x=g(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:v,go(y){return o.go(y)}};return m}var Lj;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Lj||(Lj={}));function cK(e,t,r){return r===void 0&&(r="/"),hK(e,t,r)}function hK(e,t,r,n){let a=typeof t=="string"?ev(t):t,i=gk(a.pathname||"/",r);if(i==null)return null;let o=gV(e);dK(o);let s=null,l=CK(i);for(let u=0;s==null&&u{let l={relativePath:s===void 0?i.path||"":s,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(jr(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=Wl([n,l.relativePath]),c=r.concat(l);i.children&&i.children.length>0&&(jr(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),gV(i.children,t,c,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:xK(u,i.index),routesMeta:c})};return e.forEach((i,o)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))a(i,o);else for(let l of mV(i.path))a(i,o,l)}),t}function mV(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=mV(n.join("/")),s=[];return s.push(...o.map(l=>l===""?i:[i,l].join("/"))),a&&s.push(...o),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function dK(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:_K(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const fK=/^:[\w-]+$/,vK=3,pK=2,gK=1,mK=10,yK=-2,Ij=e=>e==="*";function xK(e,t){let r=e.split("/"),n=r.length;return r.some(Ij)&&(n+=yK),t&&(n+=pK),r.filter(a=>!Ij(a)).reduce((a,i)=>a+(fK.test(i)?vK:i===""?gK:mK),n)}function _K(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function bK(e,t,r){let{routesMeta:n}=e,a={},i="/",o=[];for(let s=0;s{let{paramName:f,isOptional:v}=c;if(f==="*"){let m=s[h]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const g=s[h];return v&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function SK(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),pk(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=[],a="^"+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:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function CK(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return pk(!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 gk(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 TK=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,MK=e=>TK.test(e);function AK(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?ev(e):e,i;if(r)if(MK(r))i=r;else{if(r.includes("//")){let o=r;r=yV(r),pk(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=Pj(r.substring(1),"/"):i=Pj(r,t)}else i=t;return{pathname:i,search:LK(n),hash:IK(a)}}function Pj(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function hS(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 NK(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function mk(e,t){let r=NK(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function yk(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=ev(e):(a=Og({},e),jr(!a.pathname||!a.pathname.includes("?"),hS("?","pathname","search",a)),jr(!a.pathname||!a.pathname.includes("#"),hS("#","pathname","hash",a)),jr(!a.search||!a.search.includes("#"),hS("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.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;a.pathname=f.join("/")}s=h>=0?t[h]:"/"}let l=AK(a,s),u=o&&o!=="/"&&o.endsWith("/"),c=(i||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const yV=e=>e.replace(/\/\/+/g,"/"),Wl=e=>yV(e.join("/")),kK=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),LK=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,IK=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function PK(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const xV=["post","put","patch","delete"];new Set(xV);const DK=["get",...xV];new Set(DK);/** + */function Og(){return Og=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function pk(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function uK(){return Math.random().toString(36).substr(2,8)}function Lj(e,t){return{usr:e.state,key:e.key,idx:t}}function JT(e,t,r,n){return r===void 0&&(r=null),Og({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?ev(t):t,{state:r,key:t&&t.key||n||uK()})}function w_(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 ev(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 cK(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,s=kl.Pop,l=null,u=c();u==null&&(u=0,o.replaceState(Og({},o.state,{idx:u}),""));function c(){return(o.state||{idx:null}).idx}function h(){s=kl.Pop;let y=c(),x=y==null?null:y-u;u=y,l&&l({action:s,location:m.location,delta:x})}function f(y,x){s=kl.Push;let _=JT(m.location,y,x);u=c()+1;let w=Lj(_,u),S=m.createHref(_);try{o.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(S)}i&&l&&l({action:s,location:m.location,delta:1})}function v(y,x){s=kl.Replace;let _=JT(m.location,y,x);u=c();let w=Lj(_,u),S=m.createHref(_);o.replaceState(w,"",S),i&&l&&l({action:s,location:m.location,delta:0})}function g(y){let x=a.location.origin!=="null"?a.location.origin:a.location.href,_=typeof y=="string"?y:w_(y);return _=_.replace(/ $/,"%20"),jr(x,"No window.location.(origin|href) available to create URL for href: "+_),new URL(_,x)}let m={get action(){return s},get location(){return e(a,o)},listen(y){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(kj,h),l=y,()=>{a.removeEventListener(kj,h),l=null}},createHref(y){return t(a,y)},createURL:g,encodeLocation(y){let x=g(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:v,go(y){return o.go(y)}};return m}var Ij;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Ij||(Ij={}));function hK(e,t,r){return r===void 0&&(r="/"),dK(e,t,r)}function dK(e,t,r,n){let a=typeof t=="string"?ev(t):t,i=gk(a.pathname||"/",r);if(i==null)return null;let o=mV(e);fK(o);let s=null,l=TK(i);for(let u=0;s==null&&u{let l={relativePath:s===void 0?i.path||"":s,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(jr(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=Wl([n,l.relativePath]),c=r.concat(l);i.children&&i.children.length>0&&(jr(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),mV(i.children,t,c,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:_K(u,i.index),routesMeta:c})};return e.forEach((i,o)=>{var s;if(i.path===""||!((s=i.path)!=null&&s.includes("?")))a(i,o);else for(let l of yV(i.path))a(i,o,l)}),t}function yV(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=yV(n.join("/")),s=[];return s.push(...o.map(l=>l===""?i:[i,l].join("/"))),a&&s.push(...o),s.map(l=>e.startsWith("/")&&l===""?"/":l)}function fK(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:bK(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const vK=/^:[\w-]+$/,pK=3,gK=2,mK=1,yK=10,xK=-2,Pj=e=>e==="*";function _K(e,t){let r=e.split("/"),n=r.length;return r.some(Pj)&&(n+=xK),t&&(n+=gK),r.filter(a=>!Pj(a)).reduce((a,i)=>a+(vK.test(i)?pK:i===""?mK:yK),n)}function bK(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function wK(e,t,r){let{routesMeta:n}=e,a={},i="/",o=[];for(let s=0;s{let{paramName:f,isOptional:v}=c;if(f==="*"){let m=s[h]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const g=s[h];return v&&!g?u[f]=void 0:u[f]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function CK(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),pk(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=[],a="^"+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:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function TK(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return pk(!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 gk(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 MK=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,AK=e=>MK.test(e);function NK(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?ev(e):e,i;if(r)if(AK(r))i=r;else{if(r.includes("//")){let o=r;r=xV(r),pk(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=Dj(r.substring(1),"/"):i=Dj(r,t)}else i=t;return{pathname:i,search:IK(n),hash:PK(a)}}function Dj(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function hS(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 kK(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function mk(e,t){let r=kK(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function yk(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=ev(e):(a=Og({},e),jr(!a.pathname||!a.pathname.includes("?"),hS("?","pathname","search",a)),jr(!a.pathname||!a.pathname.includes("#"),hS("#","pathname","hash",a)),jr(!a.search||!a.search.includes("#"),hS("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.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;a.pathname=f.join("/")}s=h>=0?t[h]:"/"}let l=NK(a,s),u=o&&o!=="/"&&o.endsWith("/"),c=(i||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(u||c)&&(l.pathname+="/"),l}const xV=e=>e.replace(/\/\/+/g,"/"),Wl=e=>xV(e.join("/")),LK=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),IK=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,PK=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function DK(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const _V=["post","put","patch","delete"];new Set(_V);const jK=["get",..._V];new Set(jK);/** * React Router v6.30.4 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+i.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function zg(){return zg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),E.useCallback(function(u,c){if(c===void 0&&(c={}),!s.current)return;if(typeof u=="number"){n.go(u);return}let h=yk(u,JSON.parse(o),i,c.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Wl([t,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[t,n,o,i,e])}function wV(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=E.useContext(mu),{matches:a}=E.useContext(yu),{pathname:i}=xu(),o=JSON.stringify(mk(a,n.v7_relativeSplatPath));return E.useMemo(()=>yk(e,JSON.parse(o),i,r==="path"),[e,o,i,r])}function OK(e,t){return zK(e,t)}function zK(e,t,r,n){tv()||jr(!1);let{navigator:a}=E.useContext(mu),{matches:i}=E.useContext(yu),o=i[i.length-1],s=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=xu(),c;if(t){var h;let y=typeof t=="string"?ev(t):t;l==="/"||(h=y.pathname)!=null&&h.startsWith(l)||jr(!1),c=y}else c=u;let f=c.pathname||"/",v=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");v="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=cK(e,{pathname:v}),m=HK(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},s,y.params),pathname:Wl([l,a.encodeLocation?a.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Wl([l,a.encodeLocation?a.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,r,n);return t&&m?E.createElement(l1.Provider,{value:{location:zg({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:kl.Pop}},m):m}function BK(){let e=ZK(),t=PK(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},t),r?E.createElement("pre",{style:a},r):null,null)}const FK=E.createElement(BK,null);class VK extends E.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?E.createElement(yu.Provider,{value:this.props.routeContext},E.createElement(_V.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function GK(e){let{routeContext:t,match:r,children:n}=e,a=E.useContext(xk);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),E.createElement(yu.Provider,{value:t},n)}function HK(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,s=(a=r)==null?void 0:a.errors;if(s!=null){let c=o.findIndex(h=>h.route.id&&(s==null?void 0:s[h.route.id])!==void 0);c>=0||jr(!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 v,g=!1,m=null,y=null;r&&(v=s&&h.route.id?s[h.route.id]:void 0,m=h.route.errorElement||FK,l&&(u<0&&f===0?(XK("route-fallback"),g=!0,y=null):u===f&&(g=!0,y=h.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,f+1)),_=()=>{let w;return v?w=m:g?w=y:h.route.Component?w=E.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=c,E.createElement(GK,{match:h,routeContext:{outlet:c,matches:x,isDataRoute:r!=null},children:w})};return r&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?E.createElement(VK,{location:r.location,revalidation:r.revalidation,component:m,error:v,children:_(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):_()},null)}var SV=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(SV||{}),CV=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}(CV||{});function UK(e){let t=E.useContext(xk);return t||jr(!1),t}function WK(e){let t=E.useContext(jK);return t||jr(!1),t}function $K(e){let t=E.useContext(yu);return t||jr(!1),t}function TV(e){let t=$K(),r=t.matches[t.matches.length-1];return r.route.id||jr(!1),r.route.id}function ZK(){var e;let t=E.useContext(_V),r=WK(),n=TV();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function YK(){let{router:e}=UK(SV.UseNavigateStable),t=TV(CV.UseNavigateStable),r=E.useRef(!1);return bV(()=>{r.current=!0}),E.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,zg({fromRouteId:t},i)))},[e,t])}const Dj={};function XK(e,t,r){Dj[e]||(Dj[e]=!0)}function qK(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function jj(e){let{to:t,replace:r,state:n,relative:a}=e;tv()||jr(!1);let{future:i,static:o}=E.useContext(mu),{matches:s}=E.useContext(yu),{pathname:l}=xu(),u=jm(),c=yk(t,mk(s,i.v7_relativeSplatPath),l,a==="path"),h=JSON.stringify(c);return E.useEffect(()=>u(JSON.parse(h),{replace:r,state:n,relative:a}),[u,h,a,r,n]),null}function nr(e){jr(!1)}function KK(e){let{basename:t="/",children:r=null,location:n,navigationType:a=kl.Pop,navigator:i,static:o=!1,future:s}=e;tv()&&jr(!1);let l=t.replace(/^\/*/,"/"),u=E.useMemo(()=>({basename:l,navigator:i,static:o,future:zg({v7_relativeSplatPath:!1},s)}),[l,s,i,o]);typeof n=="string"&&(n=ev(n));let{pathname:c="/",search:h="",hash:f="",state:v=null,key:g="default"}=n,m=E.useMemo(()=>{let y=gk(c,l);return y==null?null:{location:{pathname:y,search:h,hash:f,state:v,key:g},navigationType:a}},[l,c,h,f,v,g,a]);return m==null?null:E.createElement(mu.Provider,{value:u},E.createElement(l1.Provider,{children:r,value:m}))}function JK(e){let{children:t,location:r}=e;return OK(QT(t),r)}new Promise(()=>{});function QT(e,t){t===void 0&&(t=[]);let r=[];return E.Children.forEach(e,(n,a)=>{if(!E.isValidElement(n))return;let i=[...t,a];if(n.type===E.Fragment){r.push.apply(r,QT(n.props.children,i));return}n.type!==nr&&jr(!1),!n.props.index||!n.props.children||jr(!1);let o={id:n.props.id||i.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=QT(n.props.children,i)),r.push(o)}),r}/** + */function zg(){return zg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),E.useCallback(function(u,c){if(c===void 0&&(c={}),!s.current)return;if(typeof u=="number"){n.go(u);return}let h=yk(u,JSON.parse(o),i,c.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Wl([t,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[t,n,o,i,e])}function SV(e,t){let{relative:r}=t===void 0?{}:t,{future:n}=E.useContext(mu),{matches:a}=E.useContext(yu),{pathname:i}=xu(),o=JSON.stringify(mk(a,n.v7_relativeSplatPath));return E.useMemo(()=>yk(e,JSON.parse(o),i,r==="path"),[e,o,i,r])}function zK(e,t){return BK(e,t)}function BK(e,t,r,n){tv()||jr(!1);let{navigator:a}=E.useContext(mu),{matches:i}=E.useContext(yu),o=i[i.length-1],s=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let u=xu(),c;if(t){var h;let y=typeof t=="string"?ev(t):t;l==="/"||(h=y.pathname)!=null&&h.startsWith(l)||jr(!1),c=y}else c=u;let f=c.pathname||"/",v=f;if(l!=="/"){let y=l.replace(/^\//,"").split("/");v="/"+f.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=hK(e,{pathname:v}),m=UK(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},s,y.params),pathname:Wl([l,a.encodeLocation?a.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Wl([l,a.encodeLocation?a.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,r,n);return t&&m?E.createElement(l1.Provider,{value:{location:zg({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:kl.Pop}},m):m}function FK(){let e=YK(),t=DK(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},t),r?E.createElement("pre",{style:a},r):null,null)}const VK=E.createElement(FK,null);class GK extends E.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?E.createElement(yu.Provider,{value:this.props.routeContext},E.createElement(bV.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function HK(e){let{routeContext:t,match:r,children:n}=e,a=E.useContext(xk);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),E.createElement(yu.Provider,{value:t},n)}function UK(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,s=(a=r)==null?void 0:a.errors;if(s!=null){let c=o.findIndex(h=>h.route.id&&(s==null?void 0:s[h.route.id])!==void 0);c>=0||jr(!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 v,g=!1,m=null,y=null;r&&(v=s&&h.route.id?s[h.route.id]:void 0,m=h.route.errorElement||VK,l&&(u<0&&f===0?(qK("route-fallback"),g=!0,y=null):u===f&&(g=!0,y=h.route.hydrateFallbackElement||null)));let x=t.concat(o.slice(0,f+1)),_=()=>{let w;return v?w=m:g?w=y:h.route.Component?w=E.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=c,E.createElement(HK,{match:h,routeContext:{outlet:c,matches:x,isDataRoute:r!=null},children:w})};return r&&(h.route.ErrorBoundary||h.route.errorElement||f===0)?E.createElement(GK,{location:r.location,revalidation:r.revalidation,component:m,error:v,children:_(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):_()},null)}var CV=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(CV||{}),TV=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}(TV||{});function WK(e){let t=E.useContext(xk);return t||jr(!1),t}function $K(e){let t=E.useContext(EK);return t||jr(!1),t}function ZK(e){let t=E.useContext(yu);return t||jr(!1),t}function MV(e){let t=ZK(),r=t.matches[t.matches.length-1];return r.route.id||jr(!1),r.route.id}function YK(){var e;let t=E.useContext(bV),r=$K(),n=MV();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function XK(){let{router:e}=WK(CV.UseNavigateStable),t=MV(TV.UseNavigateStable),r=E.useRef(!1);return wV(()=>{r.current=!0}),E.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,zg({fromRouteId:t},i)))},[e,t])}const jj={};function qK(e,t,r){jj[e]||(jj[e]=!0)}function KK(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function Ej(e){let{to:t,replace:r,state:n,relative:a}=e;tv()||jr(!1);let{future:i,static:o}=E.useContext(mu),{matches:s}=E.useContext(yu),{pathname:l}=xu(),u=jm(),c=yk(t,mk(s,i.v7_relativeSplatPath),l,a==="path"),h=JSON.stringify(c);return E.useEffect(()=>u(JSON.parse(h),{replace:r,state:n,relative:a}),[u,h,a,r,n]),null}function nr(e){jr(!1)}function JK(e){let{basename:t="/",children:r=null,location:n,navigationType:a=kl.Pop,navigator:i,static:o=!1,future:s}=e;tv()&&jr(!1);let l=t.replace(/^\/*/,"/"),u=E.useMemo(()=>({basename:l,navigator:i,static:o,future:zg({v7_relativeSplatPath:!1},s)}),[l,s,i,o]);typeof n=="string"&&(n=ev(n));let{pathname:c="/",search:h="",hash:f="",state:v=null,key:g="default"}=n,m=E.useMemo(()=>{let y=gk(c,l);return y==null?null:{location:{pathname:y,search:h,hash:f,state:v,key:g},navigationType:a}},[l,c,h,f,v,g,a]);return m==null?null:E.createElement(mu.Provider,{value:u},E.createElement(l1.Provider,{children:r,value:m}))}function QK(e){let{children:t,location:r}=e;return zK(QT(t),r)}new Promise(()=>{});function QT(e,t){t===void 0&&(t=[]);let r=[];return E.Children.forEach(e,(n,a)=>{if(!E.isValidElement(n))return;let i=[...t,a];if(n.type===E.Fragment){r.push.apply(r,QT(n.props.children,i));return}n.type!==nr&&jr(!1),!n.props.index||!n.props.children||jr(!1);let o={id:n.props.id||i.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=QT(n.props.children,i)),r.push(o)}),r}/** * React Router DOM v6.30.4 * * Copyright (c) Remix Software Inc. @@ -64,27 +64,27 @@ Error generating stack: `+i.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function eM(){return eM=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function rJ(e,t){let r=tM(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const nJ=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],aJ="6";try{window.__reactRouterVersion=aJ}catch{}const iJ="startTransition",Ej=qY[iJ];function oJ(e){let{basename:t,children:r,future:n,window:a}=e,i=E.useRef();i.current==null&&(i.current=sK({window:a,v5Compat:!0}));let o=i.current,[s,l]=E.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},c=E.useCallback(h=>{u&&Ej?Ej(()=>l(h)):l(h)},[l,u]);return E.useLayoutEffect(()=>o.listen(c),[o,c]),E.useEffect(()=>qK(n),[n]),E.createElement(KK,{basename:t,children:r,location:s.location,navigationType:s.action,navigator:o,future:n})}const sJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",lJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,uf=E.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:i,replace:o,state:s,target:l,to:u,preventScrollReset:c,viewTransition:h}=t,f=QK(t,nJ),{basename:v}=E.useContext(mu),g,m=!1;if(typeof u=="string"&&lJ.test(u)&&(g=u,sJ))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=gk(S.pathname,v);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:m=!0}catch{}let y=EK(u,{relative:a}),x=uJ(u,{replace:o,state:s,target:l,preventScrollReset:c,relative:a,viewTransition:h});function _(w){n&&n(w),w.defaultPrevented||x(w)}return E.createElement("a",eM({},f,{href:g||y,onClick:m||i?n:_,ref:r,target:l}))});var Rj;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Rj||(Rj={}));var Oj;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Oj||(Oj={}));function uJ(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:s}=t===void 0?{}:t,l=jm(),u=xu(),c=wV(e,{relative:o});return E.useCallback(h=>{if(tJ(h,r)){h.preventDefault();let f=n!==void 0?n:w_(u)===w_(c);l(e,{replace:f,state:a,preventScrollReset:i,relative:o,viewTransition:s})}},[u,l,c,n,a,r,e,i,o,s])}function cJ(e){let t=E.useRef(tM(e)),r=E.useRef(!1),n=xu(),a=E.useMemo(()=>rJ(n.search,r.current?null:t.current),[n.search]),i=jm(),o=E.useCallback((s,l)=>{const u=tM(typeof s=="function"?s(a):s);r.current=!0,i("?"+u,l)},[i,a]);return[a,o]}const MV=E.createContext({dirty:!1,setDirty:()=>{}});function hJ({children:e}){const[t,r]=E.useState(!1);return E.useEffect(()=>{const n=a=>{t&&(a.preventDefault(),a.returnValue="")};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t]),d.jsx(MV.Provider,{value:{dirty:t,setDirty:r},children:e})}function $i(){return E.useContext(MV)}/** + */function eM(){return eM=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function nJ(e,t){let r=tM(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const aJ=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],iJ="6";try{window.__reactRouterVersion=iJ}catch{}const oJ="startTransition",Rj=KY[oJ];function sJ(e){let{basename:t,children:r,future:n,window:a}=e,i=E.useRef();i.current==null&&(i.current=lK({window:a,v5Compat:!0}));let o=i.current,[s,l]=E.useState({action:o.action,location:o.location}),{v7_startTransition:u}=n||{},c=E.useCallback(h=>{u&&Rj?Rj(()=>l(h)):l(h)},[l,u]);return E.useLayoutEffect(()=>o.listen(c),[o,c]),E.useEffect(()=>KK(n),[n]),E.createElement(JK,{basename:t,children:r,location:s.location,navigationType:s.action,navigator:o,future:n})}const lJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",uJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,uf=E.forwardRef(function(t,r){let{onClick:n,relative:a,reloadDocument:i,replace:o,state:s,target:l,to:u,preventScrollReset:c,viewTransition:h}=t,f=eJ(t,aJ),{basename:v}=E.useContext(mu),g,m=!1;if(typeof u=="string"&&uJ.test(u)&&(g=u,lJ))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=gk(S.pathname,v);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:m=!0}catch{}let y=RK(u,{relative:a}),x=cJ(u,{replace:o,state:s,target:l,preventScrollReset:c,relative:a,viewTransition:h});function _(w){n&&n(w),w.defaultPrevented||x(w)}return E.createElement("a",eM({},f,{href:g||y,onClick:m||i?n:_,ref:r,target:l}))});var Oj;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Oj||(Oj={}));var zj;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(zj||(zj={}));function cJ(e,t){let{target:r,replace:n,state:a,preventScrollReset:i,relative:o,viewTransition:s}=t===void 0?{}:t,l=jm(),u=xu(),c=SV(e,{relative:o});return E.useCallback(h=>{if(rJ(h,r)){h.preventDefault();let f=n!==void 0?n:w_(u)===w_(c);l(e,{replace:f,state:a,preventScrollReset:i,relative:o,viewTransition:s})}},[u,l,c,n,a,r,e,i,o,s])}function hJ(e){let t=E.useRef(tM(e)),r=E.useRef(!1),n=xu(),a=E.useMemo(()=>nJ(n.search,r.current?null:t.current),[n.search]),i=jm(),o=E.useCallback((s,l)=>{const u=tM(typeof s=="function"?s(a):s);r.current=!0,i("?"+u,l)},[i,a]);return[a,o]}const AV=E.createContext({dirty:!1,setDirty:()=>{}});function dJ({children:e}){const[t,r]=E.useState(!1);return E.useEffect(()=>{const n=a=>{t&&(a.preventDefault(),a.returnValue="")};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[t]),d.jsx(AV.Provider,{value:{dirty:t,setDirty:r},children:e})}function $i(){return E.useContext(AV)}/** * @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 dJ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),AV=(...e)=>e.filter((t,r,n)=>!!t&&n.indexOf(t)===r).join(" ");/** + */const fJ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),NV=(...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 fJ={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"};/** + */var vJ={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 vJ=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...s},l)=>E.createElement("svg",{ref:l,...fJ,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:AV("lucide",a),...s},[...o.map(([u,c])=>E.createElement(u,c)),...Array.isArray(i)?i:[i]]));/** + */const pJ=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...s},l)=>E.createElement("svg",{ref:l,...vJ,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:NV("lucide",a),...s},[...o.map(([u,c])=>E.createElement(u,c)),...Array.isArray(i)?i:[i]]));/** * @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 Ge=(e,t)=>{const r=E.forwardRef(({className:n,...a},i)=>E.createElement(vJ,{ref:i,iconNode:t,className:AV(`lucide-${dJ(e)}`,n),...a}));return r.displayName=`${e}`,r};/** + */const Ge=(e,t)=>{const r=E.forwardRef(({className:n,...a},i)=>E.createElement(pJ,{ref:i,iconNode:t,className:NV(`lucide-${fJ(e)}`,n),...a}));return r.displayName=`${e}`,r};/** * @license lucide-react v0.383.0 - ISC * * This source code is licensed under the ISC license. @@ -94,17 +94,17 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zj=Ge("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"}]]);/** + */const Bj=Ge("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 NV=Ge("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"}]]);/** + */const kV=Ge("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 kV=Ge("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"}]]);/** + */const LV=Ge("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. @@ -114,12 +114,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pJ=Ge("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"}]]);/** + */const gJ=Ge("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 Bj=Ge("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"}]]);/** + */const Fj=Ge("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. @@ -144,7 +144,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gJ=Ge("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + */const mJ=Ge("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. @@ -159,17 +159,17 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Fj=Ge("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** + */const Vj=Ge("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @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 LV=Ge("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + */const IV=Ge("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 mJ=Ge("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"}]]);/** + */const yJ=Ge("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. @@ -179,37 +179,37 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yJ=Ge("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + */const xJ=Ge("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 IV=Ge("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"}]]);/** + */const PV=Ge("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 PV=Ge("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"}]]);/** + */const DV=Ge("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 DV=Ge("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"}]]);/** + */const jV=Ge("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 xJ=Ge("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"}]]);/** + */const _J=Ge("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 jV=Ge("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"}]]);/** + */const EV=Ge("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 _J=Ge("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const bJ=Ge("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.383.0 - ISC * * This source code is licensed under the ISC license. @@ -234,7 +234,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const EV=Ge("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + */const RV=Ge("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. @@ -244,17 +244,17 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bJ=Ge("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** + */const wJ=Ge("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** * @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 wJ=Ge("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"}]]);/** + */const SJ=Ge("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 SJ=Ge("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** + */const CJ=Ge("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/** * @license lucide-react v0.383.0 - ISC * * This source code is licensed under the ISC license. @@ -264,12 +264,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RV=Ge("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"}]]);/** + */const OV=Ge("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 OV=Ge("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"}]]);/** + */const zV=Ge("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. @@ -284,7 +284,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zV=Ge("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"}]]);/** + */const BV=Ge("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. @@ -299,7 +299,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CJ=Ge("MousePointer",[["path",{d:"m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z",key:"y2ucgo"}],["path",{d:"m13 13 6 6",key:"1nhxnf"}]]);/** + */const TJ=Ge("MousePointer",[["path",{d:"m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z",key:"y2ucgo"}],["path",{d:"m13 13 6 6",key:"1nhxnf"}]]);/** * @license lucide-react v0.383.0 - ISC * * This source code is licensed under the ISC license. @@ -309,12 +309,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const si=Ge("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const li=Ge("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 _i=Ge("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"}]]);/** + */const bi=Ge("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. @@ -329,7 +329,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TJ=Ge("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"}]]);/** + */const MJ=Ge("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. @@ -349,17 +349,22 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BV=Ge("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** + */const FV=Ge("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 MJ=Ge("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"}]]);/** + */const AJ=Ge("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 FV=Ge("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"}]]);/** + */const VV=Ge("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 Ck=Ge("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** * @license lucide-react v0.383.0 - ISC * * This source code is licensed under the ISC license. @@ -369,37 +374,37 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VV=Ge("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"}]]);/** + */const GV=Ge("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 GV=Ge("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"}]]);/** + */const HV=Ge("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 HV=Ge("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + */const UV=Ge("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 li=Ge("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"}]]);/** + */const ui=Ge("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 vi=Ge("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"}]]);/** + */const pi=Ge("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 UV=Ge("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"}]]);/** + */const WV=Ge("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 AJ=Ge("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"}]]);/** + */const NJ=Ge("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. @@ -409,7 +414,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rM=Ge("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 Nr(e){const t=await fetch(e);if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function NJ(){return Nr("/api/serial-ports")}async function Vj(){return Nr("/api/status")}async function kJ(){return Nr("/api/health")}async function LJ(){return Nr("/api/nodes")}async function IJ(){return Nr("/api/edges")}async function PJ(){return Nr("/api/sources")}async function Ao(e){const t=e?`/api/config/${e}`:"/api/config";return Nr(t)}async function Da(e,t){const r=await fetch(`/api/config/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(`API error: ${r.status} ${r.statusText}`);return r.json()}async function DJ(){return Nr("/api/config/generic_sources")}async function jJ(e){const t=await fetch("/api/config/generic_sources",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw new Error(r.detail||`Save failed (${t.status})`);return r}async function EJ(e,t,r){return(await fetch("/api/generic-sources/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,items_path:t,headers:r})})).json()}async function RJ(){return Nr("/api/alerts/active")}async function OJ(e=100,t,r){const n=new URLSearchParams;return n.set("limit",e.toString()),t&&t!=="all"&&n.set("transport",t),r&&r!=="all"&&n.set("category",r),Nr(`/api/activity?${n.toString()}`)}async function WV(){return Nr("/api/env/status")}async function $V(){return Nr("/api/env/active")}async function zJ(){return Nr("/api/env/swpc")}async function BJ(){return Nr("/api/regions")}async function FJ(){return Nr("/api/meshcore/channels")}async function ZV(){return Nr("/api/meshcore/channels/detail")}async function VJ(e,t){const r=await fetch("/api/meshcore/channels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,key:t||void 0})});if(!r.ok){const n=await r.json().catch(()=>null);throw new Error((n==null?void 0:n.detail)||`API error: ${r.status} ${r.statusText}`)}return r.json()}async function GJ(e){const t=await fetch(`/api/meshcore/channels/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.detail)||`API error: ${t.status} ${t.statusText}`)}return t.json()}async function HJ(){return Nr("/api/meshcore/rooms")}async function UJ(e,t){const r=await fetch(`/api/meshcore/room-password/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:t})});if(!r.ok)throw new Error(`API error: ${r.status} ${r.statusText}`);return r.json()}async function WJ(e){const t=await fetch(`/api/meshcore/room-password/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Gj(){return Nr("/api/meshcore/contacts")}async function Hj(){return Nr("/api/meshcore/self")}async function $J(){const e=await fetch("/api/meshcore/contacts/refresh",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>null);throw new Error((t==null?void 0:t.detail)||`API error: ${e.status} ${e.statusText}`)}return e.json()}async function ZJ(e){const t=await fetch("/api/meshcore/contacts/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contacts:e})});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.detail)||`API error: ${t.status} ${t.statusText}`)}return t.json()}async function YJ(e){const t=await fetch(`/api/meshcore/contacts/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.detail)||`API error: ${t.status} ${t.statusText}`)}return t.json()}async function XJ(){return Nr("/api/meshcore/route-health")}async function qJ(){const e=await fetch("/api/meshcore/advert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!e.ok)throw new Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function KJ(){return Nr("/api/config/connection")}async function JJ(){return Nr("/api/meshcore/telemetry")}async function QJ(e){const t=await fetch("/api/meshcore/telemetry/poll",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contact:e})});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function YV(e){const t=await fetch("/api/mesh/test-send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}function XV(){const[e,t]=E.useState(!1),[r,n]=E.useState(null),[a,i]=E.useState(null),[o,s]=E.useState(null),l=E.useRef(null),u=E.useRef(null),c=E.useRef(1e3),h=E.useCallback(()=>{var g;if(((g=l.current)==null?void 0:g.readyState)===WebSocket.OPEN)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/live`;try{const m=new WebSocket(v);l.current=m,m.onopen=()=>{t(!0),c.current=1e3},m.onmessage=x=>{try{const _=JSON.parse(x.data);switch(s(_),_.type){case"health_update":n(_.data);break;case"alert_fired":i(_.data);break}}catch(_){console.error("Failed to parse WebSocket message:",_)}},m.onclose=()=>{t(!1),l.current=null;const x=Math.min(c.current,3e4);u.current=window.setTimeout(()=>{c.current=Math.min(x*2,3e4),h()},x)},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 E.useEffect(()=>(h(),()=>{u.current&&clearTimeout(u.current),l.current&&l.current.close()}),[h]),{connected:e,lastHealth:r,lastAlert:a,lastMessage:o}}const qV=E.createContext(null);function eQ(){const e=E.useContext(qV);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}function tQ(e){switch(e==null?void 0:e.toLowerCase()){case"critical":case"emergency":return{bg:"bg-red-500/10",border:"border-red-500",icon:Nh,iconColor:"text-red-500"};case"warning":return{bg:"bg-amber-500/10",border:"border-amber-500",icon:vi,iconColor:"text-amber-500"};default:return{bg:"bg-sky-400/10",border:"border-sky-400",icon:d1,iconColor:"text-sky-400"}}}function rQ({toast:e,onDismiss:t,onNavigate:r}){const n=tQ(e.alert.severity),a=n.icon;return E.useEffect(()=>{const i=setTimeout(t,8e3);return()=>clearTimeout(i)},[t]),d.jsx("div",{className:`${n.bg} border ${n.border} shadow-lg overflow-hidden animate-slide-in cursor-pointer`,onClick:r,role:"alert",children:d.jsxs("div",{className:"flex items-start gap-3 p-4",children:[d.jsx("div",{className:`w-1 self-stretch -ml-4 -my-4 ${n.border.replace("border","bg")}`}),d.jsx(a,{size:18,className:n.iconColor}),d.jsxs("div",{className:"flex-1 min-w-0 pr-2",children:[d.jsx("div",{className:"text-sm font-medium text-slate-200 mb-0.5",children:e.alert.type.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}),d.jsx("div",{className:"text-sm text-slate-300 line-clamp-2",children:e.alert.message})]}),d.jsx("button",{onClick:i=>{i.stopPropagation(),t()},className:"text-slate-400 hover:text-slate-200 transition-colors",children:d.jsx(_u,{size:16})})]})})}function nQ({children:e}){const[t,r]=E.useState([]),n=jm(),a=E.useCallback(s=>{const l=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>[...u,{id:l,alert:s}])},[]),i=E.useCallback(s=>{r(l=>l.filter(u=>u.id!==s))},[]),o=E.useCallback(()=>{n("/alerts")},[n]);return d.jsxs(qV.Provider,{value:{addToast:a},children:[e,d.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=>d.jsx("div",{className:"pointer-events-auto",children:d.jsx(rQ,{toast:s,onDismiss:()=>i(s.id),onNavigate:o})},s.id))})]})}const p1="meshai.restartRequired.v1";function Uj(){try{const e=localStorage.getItem(p1);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 bu(e){const t={required:!0,changedKeys:[...new Set(e)],ts:Date.now()};localStorage.setItem(p1,JSON.stringify(t)),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:t}))}function Wj(){localStorage.removeItem(p1),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:{required:!1,changedKeys:[],ts:0}}))}function aQ(){const[e,t]=E.useState(()=>Uj()),[r,n]=E.useState(!1),[a,i]=E.useState(null);E.useEffect(()=>{const l=c=>{const h=c.detail;t(h)},u=c=>{c.key===p1&&t(Uj())};return window.addEventListener("meshai:restart-required",l),window.addEventListener("storage",u),()=>{window.removeEventListener("meshai:restart-required",l),window.removeEventListener("storage",u)}},[]);const o=E.useCallback(async()=>{n(!0),i(null);try{const l=await fetch("/api/restart",{method:"POST"});if(!l.ok&&l.status!==202){const u=await l.json().catch(()=>({}));throw new Error(u.detail||`HTTP ${l.status}`)}Wj()}catch(l){i(String(l)),n(!1)}},[]),s=E.useCallback(()=>{Wj()},[]);return e.required?d.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:[d.jsx(vi,{className:"w-4 h-4 flex-shrink-0 text-yellow-300"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("strong",{children:"Restart required"}),e.changedKeys.length>0&&d.jsxs("span",{className:"text-yellow-300 ml-2",children:["(",e.changedKeys.length," key",e.changedKeys.length===1?"":"s",":"," ",d.jsxs("span",{className:"font-mono text-xs",children:[e.changedKeys.slice(0,3).join(", "),e.changedKeys.length>3?", …":""]}),")"]}),d.jsxs("span",{className:"ml-2 text-yellow-300/80",children:["for these changes to take effect. Click ",d.jsx("strong",{children:"Restart now"})," — it restarts the bot process in place (a few seconds; the dashboard briefly reconnects), NOT the container. Until then the runtime keeps its boot-time configuration. Restart-required keys include transport connections and 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."]}),a&&d.jsx("div",{className:"text-red-400 text-xs mt-1",children:a})]}),d.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:[d.jsx(TJ,{className:`w-3 h-3 ${r?"animate-spin":""}`}),r?"Restarting…":"Restart now"]}),d.jsx("button",{onClick:s,className:"text-yellow-300 hover:text-white px-1",title:"Dismiss (you can still restart later)",children:d.jsx(_u,{className:"w-4 h-4"})})]}):null}const KV=[{header:"General",items:[{path:"/",label:"Dashboard",icon:OV},{path:"/config",label:"Settings",icon:FV},{path:"/environment",label:"Data Feeds",icon:kh},{path:"/activity",label:"Activity Log",icon:Oo},{path:"/places",label:"Places",icon:av},{path:"/coverage",label:"Coverage",icon:zV}]},{header:"Meshtastic",items:[{path:"/meshtastic/connection",label:"Connection",icon:AJ},{path:"/meshtastic/routing",label:"Routing",icon:zj},{path:"/meshtastic/scheduled",label:"Scheduled Broadcasts",icon:Bj},{path:"/meshtastic/nodes",label:"Nodes & Health",icon:Oo},{path:"/meshtastic/danger-zones",label:"Danger Zones",icon:vi}]},{header:"MeshCore",items:[{path:"/meshcore/connection",label:"Connection",icon:Sk},{path:"/meshcore/routing",label:"Routing",icon:zj},{path:"/meshcore/scheduled",label:"Scheduled Broadcasts",icon:Bj},{path:"/meshcore/contacts",label:"Contacts & Companion",icon:UV},{path:"/meshcore/danger-zones",label:"Danger Zones",icon:vi}]},{header:"Documentation",items:[{path:"/reference",label:"Reference",icon:kV}]}],iQ=[{path:"/adapter-config",label:"Adapter Config",icon:Bg},{path:"/gauge-sites",label:"Gauge Sites",icon:c1},{path:"/town-anchors",label:"Town Anchors",icon:av},{path:"/mesh",label:"Mesh",icon:_i},{path:"/meshtastic/sources",label:"Sources",icon:RV},{path:"/meshcore/companion",label:"Companion",icon:_k}],$j=[...KV.flatMap(e=>e.items),...iQ],Zj={"/places":"Places","/meshtastic/scheduled":"Scheduled Broadcasts","/meshcore/scheduled":"Scheduled Broadcasts","/meshtastic/nodes":"Nodes & Health","/meshtastic/danger-zones":"Danger Zones","/meshcore/danger-zones":"Danger Zones","/meshcore/contacts":"Contacts & Companion","/meshcore/companion":"Contacts & Companion"};function oQ(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 sQ(e,t,r,n){const a=e.path.includes("?")?`${t}${r}`===e.path:t===e.path,i=e.icon;return d.jsxs(uf,{to:e.path,onClick:o=>n(e.path,o),className:`flex items-center gap-3 px-5 py-3 text-sm font-sans transition-colors relative ${a?"text-white bg-transparent":"text-[#777] hover:text-white hover:bg-bg-hover"}`,children:[a&&d.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-[2px] bg-[#f59e0b]"}),d.jsx(i,{size:16}),e.label]},e.path)}function lQ(e){const t=e.split("?")[0];if(Zj[t])return Zj[t];const r=$j.find(a=>a.path===e);if(r)return r.label;const n=$j.find(a=>a.path.split("?")[0]===t);return(n==null?void 0:n.label)||"Dashboard"}function uQ({children:e}){var y;const t=xu(),r=jm(),{dirty:n,setDirty:a}=$i(),{connected:i,lastAlert:o}=XV(),{addToast:s}=eQ(),[l,u]=E.useState(null),[c,h]=E.useState(null),f=(x,_)=>{n&&(_.preventDefault(),window.confirm("You have unsaved changes. Discard them?")&&(a(!1),r(x)))};E.useEffect(()=>{if(o){const x=`${o.type}-${o.message}-${o.timestamp}`;x!==c&&(h(x),s(o))}},[o,c,s]);const[v,g]=E.useState(new Date);E.useEffect(()=>{Vj().then(u).catch(console.error);const x=setInterval(()=>{Vj().then(u).catch(console.error)},3e4);return()=>clearInterval(x)},[]),E.useEffect(()=>{const x=setInterval(()=>g(new Date),1e3);return()=>clearInterval(x)},[]);const m=v.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return d.jsxs("div",{className:"flex h-screen overflow-hidden bg-bg text-white",children:[d.jsxs("aside",{className:"w-[220px] flex-shrink-0 bg-bg-card border-r border-border flex flex-col overflow-y-auto",children:[d.jsxs("div",{className:"bg-[#000000] px-4 py-3 border-b border-border flex flex-col items-center",children:[d.jsx("img",{src:"/meshai-logo.png",alt:"MeshAI",className:"w-[190px] block"}),d.jsxs("div",{className:"font-mono text-[10px] text-[#555] mt-1 self-start",children:["v",(l==null?void 0:l.version)||"..."]})]}),d.jsx("nav",{className:"flex-1 py-4",children:KV.map(x=>d.jsxs("div",{className:"mt-4",children:[d.jsx("div",{className:"px-5 pt-2 pb-1 text-[10px] font-sans font-semibold uppercase tracking-wider text-[#555]",children:x.header}),x.items.map(_=>sQ(_,t.pathname,t.search,f))]},x.header))}),d.jsxs("div",{className:"p-5 border-t border-border",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${l!=null&&l.connected?"bg-green-500":"bg-red-500"}`}),d.jsx("span",{className:"text-xs font-sans text-[#777]",children:l!=null&&l.connected?"Connected":"Disconnected"})]}),d.jsxs("div",{className:"text-xs font-mono text-[#666] truncate",children:[(y=l==null?void 0:l.connection_type)==null?void 0:y.toUpperCase(),": ",l==null?void 0:l.connection_target]}),d.jsxs("div",{className:"text-xs font-sans text-[#666] mt-1",children:["Uptime: ",d.jsx("span",{className:"font-mono",children:l?oQ(l.uptime_seconds):"..."})]})]})]}),d.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d.jsxs("header",{className:"h-14 flex-shrink-0 border-b border-border bg-bg-card flex items-center justify-between px-6",children:[d.jsx("h1",{className:"text-lg font-sans font-semibold text-white",children:lQ(t.pathname+t.search)}),d.jsxs("div",{className:"flex items-center gap-6",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${i?"bg-accent animate-pulse-slow":"bg-[#333]"}`}),d.jsx("span",{className:"text-xs font-sans text-[#777]",children:i?"Live":"Offline"})]}),d.jsxs("div",{className:"text-sm font-mono text-[#666]",children:[m," MT"]})]})]}),d.jsxs("main",{className:"flex-1 overflow-y-auto p-6",children:[d.jsx(aQ,{}),e]})]})]})}function cQ({health:e}){const t=e.score,r=e.tier,n=2*Math.PI*45,a=t/100*n;return d.jsx("div",{className:"flex flex-col items-center",children:d.jsxs("svg",{width:"140",height:"140",viewBox:"0 0 100 100",children:[d.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#1e1e1e",strokeWidth:"8"}),d.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#f59e0b",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:n,strokeDashoffset:n-a,transform:"rotate(-90 50 50)",className:"transition-all duration-500"}),d.jsx("text",{x:"50",y:"46",textAnchor:"middle",className:"font-mono font-bold",style:{fontSize:"24px",fill:"#f59e0b"},children:t.toFixed(1)}),d.jsx("text",{x:"50",y:"62",textAnchor:"middle",className:"font-sans",style:{fontSize:"10px",fill:"#444"},children:r})]})})}function Zv({label:e,value:t}){const r=n=>n>66?"bg-accent":n>33?"bg-accent-dim":"bg-red-500";return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-24 text-xs font-sans text-[#777] truncate",children:e}),d.jsx("div",{className:"flex-1 h-2 bg-border overflow-hidden",children:d.jsx("div",{className:`h-full ${r(t)} transition-all duration-300`,style:{width:`${t}%`}})}),d.jsx("div",{className:"w-12 text-right text-xs font-mono text-[#e0e0e0]",children:t.toFixed(1)})]})}function hQ({alert:e}){const r=(a=>{switch(a.toLowerCase()){case"critical":case"emergency":case"immediate":return{bg:"bg-red-500/5",border:"border-red-500",icon:Nh,iconColor:"text-red-500"};case"warning":case"priority":return{bg:"bg-accent/5",border:"border-accent",icon:vi,iconColor:"text-accent"};case"routine":default:return{bg:"bg-[#161616]",border:"border-[#333]",icon:d1,iconColor:"text-[#777]"}}})(e.severity),n=r.icon;return d.jsxs("div",{className:`p-3 ${r.bg} border-l-2 ${r.border} flex items-start gap-3`,children:[d.jsx(n,{size:16,className:r.iconColor}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-sans font-medium text-white",children:e.message}),d.jsx("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:e.timestamp||"Just now"})]})]})}function dQ({source:e}){const t=()=>e.is_loaded?e.last_error?"bg-accent":"bg-green-500":"bg-red-500";return d.jsxs("div",{className:"flex items-center gap-3 p-2 bg-bg-hover",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${t()}`}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-sans font-medium text-white truncate",children:e.name}),d.jsxs("div",{className:"text-[10px] font-sans text-[#666]",children:[e.node_count," nodes · ",e.type]})]})]})}function Gy({icon:e,label:t,value:r,subvalue:n,accent:a}){return d.jsxs("div",{className:"bg-bg-card border border-border p-3",style:a?{borderTopWidth:"2px",borderTopColor:a}:void 0,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(e,{size:14,style:{color:a||"#333"}}),d.jsx("span",{className:"text-[9px] font-sans uppercase tracking-widest text-[#666]",children:t})]}),d.jsx("div",{className:"font-mono text-xl",style:{color:a||"#e0e0e0"},children:r}),n&&d.jsx("div",{className:"text-[9px] font-sans mt-1 text-[#666]",children:n})]})}function fQ({bandConditions:e}){const t=i=>{switch(i){case"Good":return"bg-green-500";case"Fair":return"bg-accent";case"Poor":return"bg-red-500";default:return"bg-[#333]"}},r=i=>{switch(i){case"Good":return"text-green-500";case"Fair":return"text-accent";case"Poor":return"text-red-500";default:return"text-[#666]"}},n=i=>i?i.includes("Night")?"🌙":"☀️":"";if(!(e!=null&&e.enabled)||!(e!=null&&e.ratings))return d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[d.jsx(rM,{size:14}),"RF Propagation"]}),d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsx("div",{className:"text-center py-8",children:d.jsx("div",{className:"font-sans text-[#666]",children:"No band conditions data"})})})]});const a=["80-40m","30-20m","17-15m","12-10m"];return d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[d.jsx(rM,{size:14}),"RF Propagation"]}),d.jsxs("div",{className:"text-center mb-3",children:[d.jsx("span",{className:"text-lg",children:n(e.slot_label)}),d.jsx("span",{className:"text-sm font-sans text-[#777] ml-2",children:e.slot_label})]}),d.jsx("div",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-2 flex items-center gap-1",children:"📡 Band Conditions"}),d.jsx("div",{className:"space-y-1.5",children:a.map(i=>{var s;const o=(s=e.ratings)==null?void 0:s[i];return d.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-bg-hover",children:[d.jsx("span",{className:"text-sm font-mono text-[#777]",children:i}),d.jsxs("span",{className:"text-sm flex items-center gap-2",children:[d.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${t(o)}`}),d.jsx("span",{className:`font-sans ${r(o)}`,children:o||"—"})]})]},i)})}),d.jsxs("div",{className:"mt-auto pt-3 border-t border-border text-[10px] font-sans text-[#666]",children:[e.source&&d.jsx("span",{children:e.source==="swpc_local"?"SWPC":"HamQSL"}),e.sent_at&&d.jsx("span",{className:"font-mono ml-2",children:new Date(e.sent_at*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}const Yj=[{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 vQ(){var c;const[e,t]=E.useState("wam"),[r,n]=E.useState(!1),[a,i]=E.useState(!1);E.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),i(!0),fetch("/api/adapter-config/dashboard/tropo_region",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:h})}).catch(()=>{}).finally(()=>i(!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=Yj.find(h=>h.code===e))==null?void 0:c.label)||e;return d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col",children:[d.jsxs("div",{className:"flex items-center justify-between mb-3",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] flex items-center gap-2",children:[d.jsx(_i,{size:14}),"Tropo Forecast (Hepburn)"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[a&&d.jsx("span",{className:"text-xs font-sans text-[#666]",children:"saving..."}),d.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:Yj.map(h=>d.jsx("option",{value:h.code,children:h.label},h.code))})]})]}),d.jsxs("div",{className:"text-xs font-sans text-[#666] mb-2",children:[u," — 6-day forecast"]}),r?d.jsx("div",{className:"flex items-center justify-center h-48 text-[#666] text-sm font-sans",children:"Failed to load forecast image"}):d.jsx("img",{src:l,alt:`Hepburn tropo forecast — ${u}`,className:"w-full border border-border",onError:()=>n(!0)}),d.jsxs("div",{className:"text-[10px] font-sans text-[#666] mt-2",children:["Source: ",d.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 pQ={nws:{icon:kh,color:"text-sky-400",label:"NWS"},swpc:{icon:GV,color:"text-accent",label:"SWPC"},ducting:{icon:_i,color:"text-sky-500",label:"Tropo"},nifc:{icon:Rm,color:"text-red-500",label:"NIFC"},firms:{icon:f1,color:"text-red-400",label:"FIRMS"},avalanche:{icon:kf,color:"text-[#777]",label:"Avy"},usgs:{icon:c1,color:"text-sky-400",label:"USGS"},traffic:{icon:u1,color:"text-[#777]",label:"Traffic"},roads:{icon:IV,color:"text-accent-dim",label:"511"}},Xj={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 gQ({event:e,isLocal:t}){var h;const r=pQ[e.source]||{icon:d1,color:"text-[#777]",label:e.source},n=r.icon,a=Xj[(h=e.severity)==null?void 0:h.toLowerCase()]||Xj.info,i=f=>{const v=new Date(f*1e3),m=new Date().getTime()-v.getTime(),y=Math.floor(m/6e4);return y<1?"just now":y<60?`${y}m ago`:y<1440?`${Math.floor(y/60)}h ago`:v.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 d.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:[d.jsx(n,{size:14,className:`mt-0.5 flex-shrink-0 ${r.color}`}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[d.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide border ${a}`,children:e.severity||"info"}),t&&d.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"}),d.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:r.label}),d.jsx("span",{className:"text-[10px] font-mono text-[#666] ml-auto",children:i(e.fetched_at)})]}),d.jsx("div",{className:`text-sm font-sans font-medium truncate ${t?"text-white":"text-[#e0e0e0]"}`,children:u}),c&&d.jsx("div",{className:"text-[10px] font-sans text-[#666] truncate mt-0.5",children:c})]})]})}function mQ({events:e,envStatus:t,embedded:r}){const n={immediate:0,priority:1,routine:2},a=E.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 v=n[((m=u.severity)==null?void 0:m.toLowerCase())||"routine"]??2,g=n[((y=c.severity)==null?void 0:y.toLowerCase())||"routine"]??2;return v!==g?v-g:(c.fetched_at||0)-(u.fetched_at||0)})},[e]),i=E.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=d.jsxs(d.Fragment,{children:[a.length>0?d.jsx("div",{className:"flex-1 overflow-y-auto max-h-80 pr-1 -mr-1",children:a.map((s,l)=>d.jsx(gQ,{event:s,isLocal:s.is_local},s.event_id||l))}):d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center py-8",children:[d.jsx(bk,{size:24,className:"text-green-500 mx-auto mb-2"}),d.jsx("div",{className:"font-sans text-[#777]",children:"No active events"}),d.jsx("div",{className:"text-[10px] font-sans text-[#666]",children:"All clear"})]})}),i&&d.jsxs("div",{className:`text-[10px] font-sans mt-3 pt-3 border-t border-border ${i.errors.length>0?"text-red-500":"text-[#666]"}`,children:[d.jsx("span",{className:"font-mono",children:i.active})," of ",d.jsx("span",{className:"font-mono",children:i.total})," feeds active",i.secAgo!==null&&d.jsxs(d.Fragment,{children:[" · Last update ",d.jsxs("span",{className:"font-mono",children:[i.secAgo,"s"]})," ago"]}),i.errors.length>0&&d.jsxs("span",{className:"text-red-500",children:[" · ",i.errors.join(", "),": error"]})]})]});return r?d.jsx("div",{className:"flex flex-col h-full",children:o}):d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[d.jsx(Oo,{size:14}),"Live Event Feed"]}),o]})}function yQ(){var S,C,M,A,I,k;const[e,t]=E.useState(null),[r,n]=E.useState([]),[a,i]=E.useState([]),[o,s]=E.useState(null),[l,u]=E.useState([]),[c,h]=E.useState(null),[f,v]=E.useState("alerts"),[g,m]=E.useState(!0),[y,x]=E.useState(null),{lastHealth:_,lastMessage:w}=XV();return E.useEffect(()=>{Promise.all([kJ(),PJ(),RJ(),WV(),$V().catch(()=>[]),zJ().catch(()=>null)]).then(([P,D,z,j,B,H])=>{t(P),n(D),i(z),s(j),u(B),h(H),m(!1),document.title="Dashboard — MeshAI"}).catch(P=>{x(P.message),m(!1),document.title="Dashboard — MeshAI"})},[]),E.useEffect(()=>{_&&t(_)},[_]),E.useEffect(()=>{(w==null?void 0:w.type)==="env_update"&&w.event&&u(P=>{const D=w.event,z=P.filter(j=>j.event_id!==D.event_id);return[D,...z].slice(0,100)})},[w]),g?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"font-sans text-[#777]",children:"Loading..."})}):y?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsxs("div",{className:"font-sans text-red-500",children:["Error: ",y]})}):d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[d.jsx("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:"Mesh Health"}),e&&d.jsxs(d.Fragment,{children:[d.jsx(cQ,{health:e}),d.jsxs("div",{className:"mt-4 space-y-2",children:[d.jsx(Zv,{label:"Infrastructure",value:((S=e.pillars)==null?void 0:S.infrastructure)??0}),d.jsx(Zv,{label:"Utilization",value:((C=e.pillars)==null?void 0:C.utilization)??0}),d.jsx(Zv,{label:"Coverage",value:((M=e.pillars)==null?void 0:M.coverage)??0}),d.jsx(Zv,{label:"Behavior",value:((A=e.pillars)==null?void 0:A.behavior)??0}),d.jsx(Zv,{label:"Power",value:((I=e.pillars)==null?void 0:I.power)??0})]})]})]}),d.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[d.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[d.jsxs("div",{className:"flex items-center gap-4 mb-3 border-b border-border",children:[d.jsx("button",{onClick:()=>v("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"}),d.jsx("button",{onClick:()=>v("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"?d.jsx(d.Fragment,{children:a.length>0?d.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:a.map((P,D)=>d.jsx(hQ,{alert:P},D))}):(()=>{const P=l.filter(D=>D.severity==="immediate"||D.severity==="priority").sort((D,z)=>{const j={immediate:0,priority:1},B=(j[D.severity]??2)-(j[z.severity]??2);return B!==0?B:(z.fetched_at||0)-(D.fetched_at||0)}).slice(0,5);return P.length>0?d.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:P.map((D,z)=>{const j=D.severity==="immediate"?{bg:"bg-red-500/5",border:"border-red-500",icon:Nh,iconColor:"text-red-500"}:{bg:"bg-accent/5",border:"border-accent",icon:vi,iconColor:"text-accent"},B=j.icon;return d.jsxs("div",{className:`p-3 ${j.bg} border-l-2 ${j.border} flex items-start gap-3`,children:[d.jsx(B,{size:16,className:j.iconColor}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.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"}),d.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:D.severity})]}),d.jsx("div",{className:"text-sm font-sans font-medium text-white mt-1",children:D.headline}),d.jsxs("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:[D.source," · ",new Date(D.fetched_at*1e3).toLocaleTimeString()]})]})]},D.event_id||z)})}):d.jsxs("div",{className:"flex items-center gap-2 text-[#777] py-4",children:[d.jsx(bk,{size:16,className:"text-green-500"}),d.jsx("span",{className:"font-sans",children:"No active alerts"})]})})()}):d.jsx(mQ,{events:l,envStatus:o,embedded:!0})]}),d.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[d.jsx(Gy,{icon:_i,label:"Nodes Online",value:(e==null?void 0:e.total_nodes)||0,accent:"#22c55e",subvalue:`${(e==null?void 0:e.unlocated_count)||0} unlocated`}),d.jsx(Gy,{icon:DV,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"}),d.jsx(Gy,{icon:Oo,label:"Utilization",value:`${((k=e==null?void 0:e.util_percent)==null?void 0:k.toFixed(1))||0}%`,accent:"#f59e0b",subvalue:`${(e==null?void 0:e.flagged_nodes)||0} flagged`}),d.jsx(Gy,{icon:av,label:"Regions",value:(e==null?void 0:e.total_regions)||0,accent:"#333333",subvalue:`${(e==null?void 0:e.battery_warnings)||0} battery warnings`})]})]})]}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:["Mesh Sources (",d.jsx("span",{className:"font-mono",children:r.length}),")"]}),r.length>0?d.jsx("div",{className:"space-y-1",children:r.map((P,D)=>d.jsx(dQ,{source:P},D))}):d.jsx("div",{className:"font-sans text-[#666] py-4",children:"No sources configured"})]}),d.jsx(fQ,{bandConditions:c}),d.jsx(vQ,{})]})]})}/*! ***************************************************************************** + */const rM=Ge("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 Nr(e){const t=await fetch(e);if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function kJ(){return Nr("/api/serial-ports")}async function Gj(){return Nr("/api/status")}async function LJ(){return Nr("/api/health")}async function IJ(){return Nr("/api/nodes")}async function PJ(){return Nr("/api/edges")}async function DJ(){return Nr("/api/sources")}async function Ao(e){const t=e?`/api/config/${e}`:"/api/config";return Nr(t)}async function ja(e,t){const r=await fetch(`/api/config/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let n="";try{const a=await r.json();typeof(a==null?void 0:a.detail)=="string"?n=a.detail:(a==null?void 0:a.detail)!=null&&(n=JSON.stringify(a.detail))}catch{}throw new Error(n?`${n} (${r.status})`:`API error: ${r.status} ${r.statusText}`)}return r.json()}async function jJ(){return Nr("/api/config/generic_sources")}async function EJ(e){const t=await fetch("/api/config/generic_sources",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok)throw new Error(r.detail||`Save failed (${t.status})`);return r}async function RJ(e,t,r){return(await fetch("/api/generic-sources/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e,items_path:t,headers:r})})).json()}async function OJ(){return Nr("/api/alerts/active")}async function zJ(e=100,t,r){const n=new URLSearchParams;return n.set("limit",e.toString()),t&&t!=="all"&&n.set("transport",t),r&&r!=="all"&&n.set("category",r),Nr(`/api/activity?${n.toString()}`)}async function $V(){return Nr("/api/env/status")}async function ZV(){return Nr("/api/env/active")}async function BJ(){return Nr("/api/env/swpc")}async function FJ(){return Nr("/api/regions")}async function VJ(){return Nr("/api/meshcore/channels")}async function YV(){return Nr("/api/meshcore/channels/detail")}async function GJ(e,t){const r=await fetch("/api/meshcore/channels",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,key:t||void 0})});if(!r.ok){const n=await r.json().catch(()=>null);throw new Error((n==null?void 0:n.detail)||`API error: ${r.status} ${r.statusText}`)}return r.json()}async function HJ(e){const t=await fetch(`/api/meshcore/channels/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.detail)||`API error: ${t.status} ${t.statusText}`)}return t.json()}async function UJ(){return Nr("/api/meshcore/rooms")}async function WJ(e,t){const r=await fetch(`/api/meshcore/room-password/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:t})});if(!r.ok)throw new Error(`API error: ${r.status} ${r.statusText}`);return r.json()}async function $J(e){const t=await fetch(`/api/meshcore/room-password/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function Hj(){return Nr("/api/meshcore/contacts")}async function Uj(){return Nr("/api/meshcore/self")}async function ZJ(){const e=await fetch("/api/meshcore/contacts/refresh",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>null);throw new Error((t==null?void 0:t.detail)||`API error: ${e.status} ${e.statusText}`)}return e.json()}async function YJ(e){const t=await fetch("/api/meshcore/contacts/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contacts:e})});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.detail)||`API error: ${t.status} ${t.statusText}`)}return t.json()}async function XJ(e){const t=await fetch(`/api/meshcore/contacts/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.detail)||`API error: ${t.status} ${t.statusText}`)}return t.json()}async function qJ(){return Nr("/api/meshcore/route-health")}async function KJ(){const e=await fetch("/api/meshcore/advert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!e.ok)throw new Error(`API error: ${e.status} ${e.statusText}`);return e.json()}async function JJ(){return Nr("/api/config/connection")}async function QJ(){return Nr("/api/meshcore/telemetry")}async function eQ(e){const t=await fetch("/api/meshcore/telemetry/poll",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({contact:e})});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}async function XV(e){const t=await fetch("/api/mesh/test-send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`API error: ${t.status} ${t.statusText}`);return t.json()}function qV(){const[e,t]=E.useState(!1),[r,n]=E.useState(null),[a,i]=E.useState(null),[o,s]=E.useState(null),l=E.useRef(null),u=E.useRef(null),c=E.useRef(1e3),h=E.useCallback(()=>{var g;if(((g=l.current)==null?void 0:g.readyState)===WebSocket.OPEN)return;const v=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/live`;try{const m=new WebSocket(v);l.current=m,m.onopen=()=>{t(!0),c.current=1e3},m.onmessage=x=>{try{const _=JSON.parse(x.data);switch(s(_),_.type){case"health_update":n(_.data);break;case"alert_fired":i(_.data);break}}catch(_){console.error("Failed to parse WebSocket message:",_)}},m.onclose=()=>{t(!1),l.current=null;const x=Math.min(c.current,3e4);u.current=window.setTimeout(()=>{c.current=Math.min(x*2,3e4),h()},x)},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 E.useEffect(()=>(h(),()=>{u.current&&clearTimeout(u.current),l.current&&l.current.close()}),[h]),{connected:e,lastHealth:r,lastAlert:a,lastMessage:o}}const KV=E.createContext(null);function tQ(){const e=E.useContext(KV);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}function rQ(e){switch(e==null?void 0:e.toLowerCase()){case"critical":case"emergency":return{bg:"bg-red-500/10",border:"border-red-500",icon:Nh,iconColor:"text-red-500"};case"warning":return{bg:"bg-amber-500/10",border:"border-amber-500",icon:pi,iconColor:"text-amber-500"};default:return{bg:"bg-sky-400/10",border:"border-sky-400",icon:d1,iconColor:"text-sky-400"}}}function nQ({toast:e,onDismiss:t,onNavigate:r}){const n=rQ(e.alert.severity),a=n.icon;return E.useEffect(()=>{const i=setTimeout(t,8e3);return()=>clearTimeout(i)},[t]),d.jsx("div",{className:`${n.bg} border ${n.border} shadow-lg overflow-hidden animate-slide-in cursor-pointer`,onClick:r,role:"alert",children:d.jsxs("div",{className:"flex items-start gap-3 p-4",children:[d.jsx("div",{className:`w-1 self-stretch -ml-4 -my-4 ${n.border.replace("border","bg")}`}),d.jsx(a,{size:18,className:n.iconColor}),d.jsxs("div",{className:"flex-1 min-w-0 pr-2",children:[d.jsx("div",{className:"text-sm font-medium text-slate-200 mb-0.5",children:e.alert.type.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}),d.jsx("div",{className:"text-sm text-slate-300 line-clamp-2",children:e.alert.message})]}),d.jsx("button",{onClick:i=>{i.stopPropagation(),t()},className:"text-slate-400 hover:text-slate-200 transition-colors",children:d.jsx(_u,{size:16})})]})})}function aQ({children:e}){const[t,r]=E.useState([]),n=jm(),a=E.useCallback(s=>{const l=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(u=>[...u,{id:l,alert:s}])},[]),i=E.useCallback(s=>{r(l=>l.filter(u=>u.id!==s))},[]),o=E.useCallback(()=>{n("/alerts")},[n]);return d.jsxs(KV.Provider,{value:{addToast:a},children:[e,d.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=>d.jsx("div",{className:"pointer-events-auto",children:d.jsx(nQ,{toast:s,onDismiss:()=>i(s.id),onNavigate:o})},s.id))})]})}const p1="meshai.restartRequired.v1";function Wj(){try{const e=localStorage.getItem(p1);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 bu(e){const t={required:!0,changedKeys:[...new Set(e)],ts:Date.now()};localStorage.setItem(p1,JSON.stringify(t)),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:t}))}function $j(){localStorage.removeItem(p1),window.dispatchEvent(new CustomEvent("meshai:restart-required",{detail:{required:!1,changedKeys:[],ts:0}}))}function iQ(){const[e,t]=E.useState(()=>Wj()),[r,n]=E.useState(!1),[a,i]=E.useState(null);E.useEffect(()=>{const l=c=>{const h=c.detail;t(h)},u=c=>{c.key===p1&&t(Wj())};return window.addEventListener("meshai:restart-required",l),window.addEventListener("storage",u),()=>{window.removeEventListener("meshai:restart-required",l),window.removeEventListener("storage",u)}},[]);const o=E.useCallback(async()=>{n(!0),i(null);try{const l=await fetch("/api/restart",{method:"POST"});if(!l.ok&&l.status!==202){const u=await l.json().catch(()=>({}));throw new Error(u.detail||`HTTP ${l.status}`)}$j()}catch(l){i(String(l)),n(!1)}},[]),s=E.useCallback(()=>{$j()},[]);return e.required?d.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:[d.jsx(pi,{className:"w-4 h-4 flex-shrink-0 text-yellow-300"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("strong",{children:"Restart required"}),e.changedKeys.length>0&&d.jsxs("span",{className:"text-yellow-300 ml-2",children:["(",e.changedKeys.length," key",e.changedKeys.length===1?"":"s",":"," ",d.jsxs("span",{className:"font-mono text-xs",children:[e.changedKeys.slice(0,3).join(", "),e.changedKeys.length>3?", …":""]}),")"]}),d.jsxs("span",{className:"ml-2 text-yellow-300/80",children:["for these changes to take effect. Click ",d.jsx("strong",{children:"Restart now"})," — it restarts the bot process in place (a few seconds; the dashboard briefly reconnects), NOT the container. Until then the runtime keeps its boot-time configuration. Restart-required keys include transport connections and 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."]}),a&&d.jsx("div",{className:"text-red-400 text-xs mt-1",children:a})]}),d.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:[d.jsx(MJ,{className:`w-3 h-3 ${r?"animate-spin":""}`}),r?"Restarting…":"Restart now"]}),d.jsx("button",{onClick:s,className:"text-yellow-300 hover:text-white px-1",title:"Dismiss (you can still restart later)",children:d.jsx(_u,{className:"w-4 h-4"})})]}):null}const JV=[{header:"General",items:[{path:"/",label:"Dashboard",icon:zV},{path:"/config",label:"Settings",icon:VV},{path:"/environment",label:"Data Feeds",icon:kh},{path:"/activity",label:"Activity Log",icon:Oo},{path:"/places",label:"Places",icon:av},{path:"/coverage",label:"Coverage",icon:BV}]},{header:"Meshtastic",items:[{path:"/meshtastic/connection",label:"Connection",icon:NJ},{path:"/meshtastic/routing",label:"Routing",icon:Bj},{path:"/meshtastic/scheduled",label:"Scheduled Broadcasts",icon:Fj},{path:"/meshtastic/nodes",label:"Nodes & Health",icon:Oo},{path:"/meshtastic/danger-zones",label:"Danger Zones",icon:pi}]},{header:"MeshCore",items:[{path:"/meshcore/connection",label:"Connection",icon:Sk},{path:"/meshcore/routing",label:"Routing",icon:Bj},{path:"/meshcore/scheduled",label:"Scheduled Broadcasts",icon:Fj},{path:"/meshcore/contacts",label:"Contacts & Companion",icon:WV},{path:"/meshcore/danger-zones",label:"Danger Zones",icon:pi}]},{header:"Documentation",items:[{path:"/reference",label:"Reference",icon:LV}]}],oQ=[{path:"/adapter-config",label:"Adapter Config",icon:Bg},{path:"/gauge-sites",label:"Gauge Sites",icon:c1},{path:"/town-anchors",label:"Town Anchors",icon:av},{path:"/mesh",label:"Mesh",icon:bi},{path:"/meshtastic/sources",label:"Sources",icon:OV},{path:"/meshcore/companion",label:"Companion",icon:_k}],Zj=[...JV.flatMap(e=>e.items),...oQ],Yj={"/places":"Places","/meshtastic/scheduled":"Scheduled Broadcasts","/meshcore/scheduled":"Scheduled Broadcasts","/meshtastic/nodes":"Nodes & Health","/meshtastic/danger-zones":"Danger Zones","/meshcore/danger-zones":"Danger Zones","/meshcore/contacts":"Contacts & Companion","/meshcore/companion":"Contacts & Companion"};function sQ(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 lQ(e,t,r,n){const a=e.path.includes("?")?`${t}${r}`===e.path:t===e.path,i=e.icon;return d.jsxs(uf,{to:e.path,onClick:o=>n(e.path,o),className:`flex items-center gap-3 px-5 py-3 text-sm font-sans transition-colors relative ${a?"text-white bg-transparent":"text-[#777] hover:text-white hover:bg-bg-hover"}`,children:[a&&d.jsx("div",{className:"absolute right-0 top-0 bottom-0 w-[2px] bg-[#f59e0b]"}),d.jsx(i,{size:16}),e.label]},e.path)}function uQ(e){const t=e.split("?")[0];if(Yj[t])return Yj[t];const r=Zj.find(a=>a.path===e);if(r)return r.label;const n=Zj.find(a=>a.path.split("?")[0]===t);return(n==null?void 0:n.label)||"Dashboard"}function cQ({children:e}){var y;const t=xu(),r=jm(),{dirty:n,setDirty:a}=$i(),{connected:i,lastAlert:o}=qV(),{addToast:s}=tQ(),[l,u]=E.useState(null),[c,h]=E.useState(null),f=(x,_)=>{n&&(_.preventDefault(),window.confirm("You have unsaved changes. Discard them?")&&(a(!1),r(x)))};E.useEffect(()=>{if(o){const x=`${o.type}-${o.message}-${o.timestamp}`;x!==c&&(h(x),s(o))}},[o,c,s]);const[v,g]=E.useState(new Date);E.useEffect(()=>{Gj().then(u).catch(console.error);const x=setInterval(()=>{Gj().then(u).catch(console.error)},3e4);return()=>clearInterval(x)},[]),E.useEffect(()=>{const x=setInterval(()=>g(new Date),1e3);return()=>clearInterval(x)},[]);const m=v.toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return d.jsxs("div",{className:"flex h-screen overflow-hidden bg-bg text-white",children:[d.jsxs("aside",{className:"w-[220px] flex-shrink-0 bg-bg-card border-r border-border flex flex-col overflow-y-auto",children:[d.jsxs("div",{className:"bg-[#000000] px-4 py-3 border-b border-border flex flex-col items-center",children:[d.jsx("img",{src:"/meshai-logo.png",alt:"MeshAI",className:"w-[190px] block"}),d.jsxs("div",{className:"font-mono text-[10px] text-[#555] mt-1 self-start",children:["v",(l==null?void 0:l.version)||"..."]})]}),d.jsx("nav",{className:"flex-1 py-4",children:JV.map(x=>d.jsxs("div",{className:"mt-4",children:[d.jsx("div",{className:"px-5 pt-2 pb-1 text-[10px] font-sans font-semibold uppercase tracking-wider text-[#555]",children:x.header}),x.items.map(_=>lQ(_,t.pathname,t.search,f))]},x.header))}),d.jsxs("div",{className:"p-5 border-t border-border",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${l!=null&&l.connected?"bg-green-500":"bg-red-500"}`}),d.jsx("span",{className:"text-xs font-sans text-[#777]",children:l!=null&&l.connected?"Connected":"Disconnected"})]}),d.jsxs("div",{className:"text-xs font-mono text-[#666] truncate",children:[(y=l==null?void 0:l.connection_type)==null?void 0:y.toUpperCase(),": ",l==null?void 0:l.connection_target]}),d.jsxs("div",{className:"text-xs font-sans text-[#666] mt-1",children:["Uptime: ",d.jsx("span",{className:"font-mono",children:l?sQ(l.uptime_seconds):"..."})]})]})]}),d.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[d.jsxs("header",{className:"h-14 flex-shrink-0 border-b border-border bg-bg-card flex items-center justify-between px-6",children:[d.jsx("h1",{className:"text-lg font-sans font-semibold text-white",children:uQ(t.pathname+t.search)}),d.jsxs("div",{className:"flex items-center gap-6",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${i?"bg-accent animate-pulse-slow":"bg-[#333]"}`}),d.jsx("span",{className:"text-xs font-sans text-[#777]",children:i?"Live":"Offline"})]}),d.jsxs("div",{className:"text-sm font-mono text-[#666]",children:[m," MT"]})]})]}),d.jsxs("main",{className:"flex-1 overflow-y-auto p-6",children:[d.jsx(iQ,{}),e]})]})]})}function hQ({health:e}){const t=e.score,r=e.tier,n=2*Math.PI*45,a=t/100*n;return d.jsx("div",{className:"flex flex-col items-center",children:d.jsxs("svg",{width:"140",height:"140",viewBox:"0 0 100 100",children:[d.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#1e1e1e",strokeWidth:"8"}),d.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"#f59e0b",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:n,strokeDashoffset:n-a,transform:"rotate(-90 50 50)",className:"transition-all duration-500"}),d.jsx("text",{x:"50",y:"46",textAnchor:"middle",className:"font-mono font-bold",style:{fontSize:"24px",fill:"#f59e0b"},children:t.toFixed(1)}),d.jsx("text",{x:"50",y:"62",textAnchor:"middle",className:"font-sans",style:{fontSize:"10px",fill:"#444"},children:r})]})})}function Zv({label:e,value:t}){const r=n=>n>66?"bg-accent":n>33?"bg-accent-dim":"bg-red-500";return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-24 text-xs font-sans text-[#777] truncate",children:e}),d.jsx("div",{className:"flex-1 h-2 bg-border overflow-hidden",children:d.jsx("div",{className:`h-full ${r(t)} transition-all duration-300`,style:{width:`${t}%`}})}),d.jsx("div",{className:"w-12 text-right text-xs font-mono text-[#e0e0e0]",children:t.toFixed(1)})]})}function dQ({alert:e}){const r=(a=>{switch(a.toLowerCase()){case"critical":case"emergency":case"immediate":return{bg:"bg-red-500/5",border:"border-red-500",icon:Nh,iconColor:"text-red-500"};case"warning":case"priority":return{bg:"bg-accent/5",border:"border-accent",icon:pi,iconColor:"text-accent"};case"routine":default:return{bg:"bg-[#161616]",border:"border-[#333]",icon:d1,iconColor:"text-[#777]"}}})(e.severity),n=r.icon;return d.jsxs("div",{className:`p-3 ${r.bg} border-l-2 ${r.border} flex items-start gap-3`,children:[d.jsx(n,{size:16,className:r.iconColor}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-sans font-medium text-white",children:e.message}),d.jsx("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:e.timestamp||"Just now"})]})]})}function fQ({source:e}){const t=()=>e.is_loaded?e.last_error?"bg-accent":"bg-green-500":"bg-red-500";return d.jsxs("div",{className:"flex items-center gap-3 p-2 bg-bg-hover",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${t()}`}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-sans font-medium text-white truncate",children:e.name}),d.jsxs("div",{className:"text-[10px] font-sans text-[#666]",children:[e.node_count," nodes · ",e.type]})]})]})}function Gy({icon:e,label:t,value:r,subvalue:n,accent:a}){return d.jsxs("div",{className:"bg-bg-card border border-border p-3",style:a?{borderTopWidth:"2px",borderTopColor:a}:void 0,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(e,{size:14,style:{color:a||"#333"}}),d.jsx("span",{className:"text-[9px] font-sans uppercase tracking-widest text-[#666]",children:t})]}),d.jsx("div",{className:"font-mono text-xl",style:{color:a||"#e0e0e0"},children:r}),n&&d.jsx("div",{className:"text-[9px] font-sans mt-1 text-[#666]",children:n})]})}function vQ({bandConditions:e}){const t=i=>{switch(i){case"Good":return"bg-green-500";case"Fair":return"bg-accent";case"Poor":return"bg-red-500";default:return"bg-[#333]"}},r=i=>{switch(i){case"Good":return"text-green-500";case"Fair":return"text-accent";case"Poor":return"text-red-500";default:return"text-[#666]"}},n=i=>i?i.includes("Night")?"🌙":"☀️":"";if(!(e!=null&&e.enabled)||!(e!=null&&e.ratings))return d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[d.jsx(rM,{size:14}),"RF Propagation"]}),d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsx("div",{className:"text-center py-8",children:d.jsx("div",{className:"font-sans text-[#666]",children:"No band conditions data"})})})]});const a=["80-40m","30-20m","17-15m","12-10m"];return d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[d.jsx(rM,{size:14}),"RF Propagation"]}),d.jsxs("div",{className:"text-center mb-3",children:[d.jsx("span",{className:"text-lg",children:n(e.slot_label)}),d.jsx("span",{className:"text-sm font-sans text-[#777] ml-2",children:e.slot_label})]}),d.jsx("div",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-2 flex items-center gap-1",children:"📡 Band Conditions"}),d.jsx("div",{className:"space-y-1.5",children:a.map(i=>{var s;const o=(s=e.ratings)==null?void 0:s[i];return d.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 bg-bg-hover",children:[d.jsx("span",{className:"text-sm font-mono text-[#777]",children:i}),d.jsxs("span",{className:"text-sm flex items-center gap-2",children:[d.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${t(o)}`}),d.jsx("span",{className:`font-sans ${r(o)}`,children:o||"—"})]})]},i)})}),d.jsxs("div",{className:"mt-auto pt-3 border-t border-border text-[10px] font-sans text-[#666]",children:[e.source&&d.jsx("span",{children:e.source==="swpc_local"?"SWPC":"HamQSL"}),e.sent_at&&d.jsx("span",{className:"font-mono ml-2",children:new Date(e.sent_at*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})}const Xj=[{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 pQ(){var c;const[e,t]=E.useState("wam"),[r,n]=E.useState(!1),[a,i]=E.useState(!1);E.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),i(!0),fetch("/api/adapter-config/dashboard/tropo_region",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:h})}).catch(()=>{}).finally(()=>i(!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=Xj.find(h=>h.code===e))==null?void 0:c.label)||e;return d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col",children:[d.jsxs("div",{className:"flex items-center justify-between mb-3",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] flex items-center gap-2",children:[d.jsx(bi,{size:14}),"Tropo Forecast (Hepburn)"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[a&&d.jsx("span",{className:"text-xs font-sans text-[#666]",children:"saving..."}),d.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:Xj.map(h=>d.jsx("option",{value:h.code,children:h.label},h.code))})]})]}),d.jsxs("div",{className:"text-xs font-sans text-[#666] mb-2",children:[u," — 6-day forecast"]}),r?d.jsx("div",{className:"flex items-center justify-center h-48 text-[#666] text-sm font-sans",children:"Failed to load forecast image"}):d.jsx("img",{src:l,alt:`Hepburn tropo forecast — ${u}`,className:"w-full border border-border",onError:()=>n(!0)}),d.jsxs("div",{className:"text-[10px] font-sans text-[#666] mt-2",children:["Source: ",d.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 gQ={nws:{icon:kh,color:"text-sky-400",label:"NWS"},swpc:{icon:HV,color:"text-accent",label:"SWPC"},ducting:{icon:bi,color:"text-sky-500",label:"Tropo"},nifc:{icon:Rm,color:"text-red-500",label:"NIFC"},firms:{icon:f1,color:"text-red-400",label:"FIRMS"},avalanche:{icon:kf,color:"text-[#777]",label:"Avy"},usgs:{icon:c1,color:"text-sky-400",label:"USGS"},traffic:{icon:u1,color:"text-[#777]",label:"Traffic"},roads:{icon:PV,color:"text-accent-dim",label:"511"},ipaws:{icon:Ck,color:"text-red-500",label:"IPAWS"}},qj={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 mQ({event:e,isLocal:t}){var h;const r=gQ[e.source]||{icon:d1,color:"text-[#777]",label:e.source},n=r.icon,a=qj[(h=e.severity)==null?void 0:h.toLowerCase()]||qj.info,i=f=>{const v=new Date(f*1e3),m=new Date().getTime()-v.getTime(),y=Math.floor(m/6e4);return y<1?"just now":y<60?`${y}m ago`:y<1440?`${Math.floor(y/60)}h ago`:v.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 d.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:[d.jsx(n,{size:14,className:`mt-0.5 flex-shrink-0 ${r.color}`}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[d.jsx("span",{className:`px-1.5 py-0.5 text-[10px] font-sans uppercase tracking-wide border ${a}`,children:e.severity||"info"}),t&&d.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"}),d.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:r.label}),d.jsx("span",{className:"text-[10px] font-mono text-[#666] ml-auto",children:i(e.fetched_at)})]}),d.jsx("div",{className:`text-sm font-sans font-medium truncate ${t?"text-white":"text-[#e0e0e0]"}`,children:u}),c&&d.jsx("div",{className:"text-[10px] font-sans text-[#666] truncate mt-0.5",children:c})]})]})}function yQ({events:e,envStatus:t,embedded:r}){const n={immediate:0,priority:1,routine:2},a=E.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 v=n[((m=u.severity)==null?void 0:m.toLowerCase())||"routine"]??2,g=n[((y=c.severity)==null?void 0:y.toLowerCase())||"routine"]??2;return v!==g?v-g:(c.fetched_at||0)-(u.fetched_at||0)})},[e]),i=E.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=d.jsxs(d.Fragment,{children:[a.length>0?d.jsx("div",{className:"flex-1 overflow-y-auto max-h-80 pr-1 -mr-1",children:a.map((s,l)=>d.jsx(mQ,{event:s,isLocal:s.is_local},s.event_id||l))}):d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center py-8",children:[d.jsx(bk,{size:24,className:"text-green-500 mx-auto mb-2"}),d.jsx("div",{className:"font-sans text-[#777]",children:"No active events"}),d.jsx("div",{className:"text-[10px] font-sans text-[#666]",children:"All clear"})]})}),i&&d.jsxs("div",{className:`text-[10px] font-sans mt-3 pt-3 border-t border-border ${i.errors.length>0?"text-red-500":"text-[#666]"}`,children:[d.jsx("span",{className:"font-mono",children:i.active})," of ",d.jsx("span",{className:"font-mono",children:i.total})," feeds active",i.secAgo!==null&&d.jsxs(d.Fragment,{children:[" · Last update ",d.jsxs("span",{className:"font-mono",children:[i.secAgo,"s"]})," ago"]}),i.errors.length>0&&d.jsxs("span",{className:"text-red-500",children:[" · ",i.errors.join(", "),": error"]})]})]});return r?d.jsx("div",{className:"flex flex-col h-full",children:o}):d.jsxs("div",{className:"bg-bg-card border border-border p-4 flex flex-col h-full",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3 flex items-center gap-2",children:[d.jsx(Oo,{size:14}),"Live Event Feed"]}),o]})}function xQ(){var S,C,M,A,k,I;const[e,t]=E.useState(null),[r,n]=E.useState([]),[a,i]=E.useState([]),[o,s]=E.useState(null),[l,u]=E.useState([]),[c,h]=E.useState(null),[f,v]=E.useState("alerts"),[g,m]=E.useState(!0),[y,x]=E.useState(null),{lastHealth:_,lastMessage:w}=qV();return E.useEffect(()=>{Promise.all([LJ(),DJ(),OJ(),$V(),ZV().catch(()=>[]),BJ().catch(()=>null)]).then(([P,j,z,D,B,H])=>{t(P),n(j),i(z),s(D),u(B),h(H),m(!1),document.title="Dashboard — MeshAI"}).catch(P=>{x(P.message),m(!1),document.title="Dashboard — MeshAI"})},[]),E.useEffect(()=>{_&&t(_)},[_]),E.useEffect(()=>{(w==null?void 0:w.type)==="env_update"&&w.event&&u(P=>{const j=w.event,z=P.filter(D=>D.event_id!==j.event_id);return[j,...z].slice(0,100)})},[w]),g?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"font-sans text-[#777]",children:"Loading..."})}):y?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsxs("div",{className:"font-sans text-red-500",children:["Error: ",y]})}):d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[d.jsx("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:"Mesh Health"}),e&&d.jsxs(d.Fragment,{children:[d.jsx(hQ,{health:e}),d.jsxs("div",{className:"mt-4 space-y-2",children:[d.jsx(Zv,{label:"Infrastructure",value:((S=e.pillars)==null?void 0:S.infrastructure)??0}),d.jsx(Zv,{label:"Utilization",value:((C=e.pillars)==null?void 0:C.utilization)??0}),d.jsx(Zv,{label:"Coverage",value:((M=e.pillars)==null?void 0:M.coverage)??0}),d.jsx(Zv,{label:"Behavior",value:((A=e.pillars)==null?void 0:A.behavior)??0}),d.jsx(Zv,{label:"Power",value:((k=e.pillars)==null?void 0:k.power)??0})]})]})]}),d.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[d.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[d.jsxs("div",{className:"flex items-center gap-4 mb-3 border-b border-border",children:[d.jsx("button",{onClick:()=>v("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"}),d.jsx("button",{onClick:()=>v("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"?d.jsx(d.Fragment,{children:a.length>0?d.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:a.map((P,j)=>d.jsx(dQ,{alert:P},j))}):(()=>{const P=l.filter(j=>j.severity==="immediate"||j.severity==="priority").sort((j,z)=>{const D={immediate:0,priority:1},B=(D[j.severity]??2)-(D[z.severity]??2);return B!==0?B:(z.fetched_at||0)-(j.fetched_at||0)}).slice(0,5);return P.length>0?d.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:P.map((j,z)=>{const D=j.severity==="immediate"?{bg:"bg-red-500/5",border:"border-red-500",icon:Nh,iconColor:"text-red-500"}:{bg:"bg-accent/5",border:"border-accent",icon:pi,iconColor:"text-accent"},B=D.icon;return d.jsxs("div",{className:`p-3 ${D.bg} border-l-2 ${D.border} flex items-start gap-3`,children:[d.jsx(B,{size:16,className:D.iconColor}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.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"}),d.jsx("span",{className:"text-[10px] font-sans text-[#666]",children:j.severity})]}),d.jsx("div",{className:"text-sm font-sans font-medium text-white mt-1",children:j.headline}),d.jsxs("div",{className:"text-[10px] font-mono text-[#666] mt-1",children:[j.source," · ",new Date(j.fetched_at*1e3).toLocaleTimeString()]})]})]},j.event_id||z)})}):d.jsxs("div",{className:"flex items-center gap-2 text-[#777] py-4",children:[d.jsx(bk,{size:16,className:"text-green-500"}),d.jsx("span",{className:"font-sans",children:"No active alerts"})]})})()}):d.jsx(yQ,{events:l,envStatus:o,embedded:!0})]}),d.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[d.jsx(Gy,{icon:bi,label:"Nodes Online",value:(e==null?void 0:e.total_nodes)||0,accent:"#22c55e",subvalue:`${(e==null?void 0:e.unlocated_count)||0} unlocated`}),d.jsx(Gy,{icon:jV,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"}),d.jsx(Gy,{icon:Oo,label:"Utilization",value:`${((I=e==null?void 0:e.util_percent)==null?void 0:I.toFixed(1))||0}%`,accent:"#f59e0b",subvalue:`${(e==null?void 0:e.flagged_nodes)||0} flagged`}),d.jsx(Gy,{icon:av,label:"Regions",value:(e==null?void 0:e.total_regions)||0,accent:"#333333",subvalue:`${(e==null?void 0:e.battery_warnings)||0} battery warnings`})]})]})]}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsxs("div",{className:"bg-bg-card border border-border p-4",children:[d.jsxs("h2",{className:"text-[10px] font-sans uppercase tracking-widest text-[#666] mb-3",children:["Mesh Sources (",d.jsx("span",{className:"font-mono",children:r.length}),")"]}),r.length>0?d.jsx("div",{className:"space-y-1",children:r.map((P,j)=>d.jsx(fQ,{source:P},j))}):d.jsx("div",{className:"font-sans text-[#666] py-4",children:"No sources configured"})]}),d.jsx(vQ,{bandConditions:c}),d.jsx(pQ,{})]})]})}/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -422,8 +427,8 @@ 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 nM=function(e,t){return nM=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},nM(e,t)};function X(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");nM(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var rg=function(){return rg=Object.assign||function(t){for(var r,n=1,a=arguments.length;n0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]"u"&&typeof self<"u"?xt.worker=!0:!xt.hasGlobalWindow||"Deno"in window||typeof navigator<"u"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Node.js")>-1?(xt.node=!0,xt.svgSupported=!0):wQ(navigator.userAgent,xt);function wQ(e,t){var r=t.browser,n=e.match(/Firefox\/([\d.]+)/),a=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),i=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);n&&(r.firefox=!0,r.version=n[1]),a&&(r.ie=!0,r.version=a[1]),i&&(r.edge=!0,r.version=i[1],r.newEdge=+i[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 Ck=12,JV="sans-serif",Fs=Ck+"px "+JV,SQ=20,CQ=100,TQ="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function MQ(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=IQ&&(dS=0),dS++}function m1(){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",a[u]+":0",n[1-l]+":auto",a[1-u]+":auto",""].join("!important;"),e.appendChild(o),r.push(o)}return t.clearMarkers=function(){R(r,function(c){c.parentNode&&c.parentNode.removeChild(c)})},r}function qQ(e,t,r){for(var n=r?"invTrans":"trans",a=t[n],i=t.srcCoords,o=[],s=[],l=!0,u=0;u<4;u++){var c=e[u].getBoundingClientRect(),h=2*u,f=c.left,v=c.top;o.push(f,v),l=l&&i&&f===i[h]&&v===i[h+1],s.push(e[u].offsetLeft,e[u].offsetTop)}return l&&a?a:(t.srcCoords=o,t[n]=r?Qj(s,o):Qj(o,s))}function uG(e){return e.nodeName.toUpperCase()==="CANVAS"}var KQ=/([&<>"'])/g,JQ={"&":"&","<":"<",">":">",'"':""","'":"'"};function Rn(e){return e==null?"":(e+"").replace(KQ,function(t,r){return JQ[r]})}var QQ=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,vS=[],eee=xt.browser.firefox&&+xt.browser.version.split(".")[0]<39;function lM(e,t,r,n){return r=r||{},n?eE(e,t,r):eee&&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):eE(e,t,r),r}function eE(e,t,r){if(xt.domSupported&&e.getBoundingClientRect){var n=t.clientX,a=t.clientY;if(uG(e)){var i=e.getBoundingClientRect();r.zrX=n-i.left,r.zrY=a-i.top;return}else if(sM(vS,e,n,a)){r.zrX=vS[0],r.zrY=vS[1];return}}r.zrX=r.zrY=0}function Ik(e){return e||window.event}function Ka(e,t,r){if(t=Ik(t),t.zrX!=null)return t;var n=t.type,a=n&&n.indexOf("touch")>=0;if(a){var o=n!=="touchend"?t.targetTouches[0]:t.changedTouches[0];o&&lM(e,o,t,r)}else{lM(e,t,t,r);var i=tee(t);t.zrDelta=i?i/120:-(t.detail||0)/3}var s=t.button;return t.which==null&&s!==void 0&&QQ.test(t.type)&&(t.which=s&1?1:s&2?3:s&4?2:0),t}function tee(e){var t=e.wheelDelta;if(t)return t;var r=e.deltaX,n=e.deltaY;if(r==null||n==null)return t;var a=Math.abs(n!==0?n:r),i=n>0?-1:n<0?1:r>0?-1:1;return 3*a*i}function uM(e,t,r,n){e.addEventListener(t,r,n)}function ree(e,t,r,n){e.removeEventListener(t,r,n)}var Vs=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function tE(e){return e.which===2||e.which===3}var nee=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 a=t.touches;if(a){for(var i={points:[],touches:[],target:r,event:t},o=0,s=a.length;o1&&n&&n.length>1){var i=rE(n)/rE(a);!isFinite(i)&&(i=1),t.pinchScale=i;var o=aee(n);return t.pinchX=o[0],t.pinchY=o[1],{type:"pinch",target:e[0].target,event:t}}}}};function ar(){return[1,0,0,1,0,0]}function Ih(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function au(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 ja(e,t,r){var n=t[0]*r[0]+t[2]*r[1],a=t[1]*r[0]+t[3]*r[1],i=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]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e}function Hi(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 Js(e,t,r,n){n===void 0&&(n=[0,0]);var a=t[0],i=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]=a*h+s*c,e[1]=-a*c+s*h,e[2]=i*h+l*c,e[3]=-i*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 _1(e,t,r){var n=r[0],a=r[1];return e[0]=t[0]*n,e[1]=t[1]*a,e[2]=t[2]*n,e[3]=t[3]*a,e[4]=t[4]*n,e[5]=t[5]*a,e}function Ra(e,t){var r=t[0],n=t[2],a=t[4],i=t[1],o=t[3],s=t[5],l=r*o-i*n;return l?(l=1/l,e[0]=o*l,e[1]=-i*l,e[2]=-n*l,e[3]=r*l,e[4]=(n*s-o*a)*l,e[5]=(i*a-r*s)*l,e):null}function cG(e){var t=ar();return au(t,e),t}const iee=Object.freeze(Object.defineProperty({__proto__:null,clone:cG,copy:au,create:ar,identity:Ih,invert:Ra,mul:ja,rotate:Js,scale:_1,translate:Hi},Symbol.toStringTag,{value:"Module"}));var Oe=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,a){t.x=r.x+n.x*a,t.y=r.y+n.y*a},e.lerp=function(t,r,n,a){var i=1-a;t.x=i*r.x+a*n.x,t.y=i*r.y+a*n.y},e}(),kc=Math.min,Xd=Math.max,cM=Math.abs,nE=["x","y"],oee=["width","height"],zu=new Oe,Bu=new Oe,Fu=new Oe,Vu=new Oe,Ma=fG(),Dp=Ma.minTv,hM=Ma.maxTv,og=[0,0],je=function(){function e(t,r,n,a){gS(this,t,r,n,a)}return e.set=function(t,r,n,a,i){return a<0&&(r=r+a,a=-a),i<0&&(n=n+i,i=-i),t.x=r,t.y=n,t.width=a,t.height=i,t},e.prototype.union=function(t){var r=kc(t.x,this.x),n=kc(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Xd(t.x+t.width,this.x+this.width)-r:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=Xd(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 hG(ar(),this,t)},e.prototype.intersect=function(t,r,n){return e.intersect(this,t,r,n)},e.intersect=function(t,r,n,a){n&&Oe.set(n,0,0);var i=a&&a.outIntersectRect||null,o=a&&a.clamp;if(i&&(i.x=i.y=i.width=i.height=NaN),!t||!r)return!1;t instanceof e||(t=gS(lee,t.x,t.y,t.width,t.height)),r instanceof e||(r=gS(uee,r.x,r.y,r.width,r.height));var s=!!n;Ma.reset(a,s);var l=Ma.touchThreshold,u=t.x+l,c=t.x+t.width-l,h=t.y+l,f=t.y+t.height-l,v=r.x+l,g=r.x+r.width-l,m=r.y+l,y=r.y+r.height-l;if(u>c||h>f||v>g||m>y)return!1;var x=!(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){If(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&&If(t,r);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var a=n[0],i=n[3],o=n[4],s=n[5];t.x=r.x*a+o,t.y=r.y*i+s,t.width=r.width*a,t.height=r.height*i,t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height);return}zu.x=Fu.x=r.x,zu.y=Vu.y=r.y,Bu.x=Vu.x=r.x+r.width,Bu.y=Fu.y=r.y+r.height,zu.transform(n),Vu.transform(n),Bu.transform(n),Fu.transform(n),t.x=kc(zu.x,Bu.x,Fu.x,Vu.x),t.y=kc(zu.y,Bu.y,Fu.y,Vu.y);var l=Xd(zu.x,Bu.x,Fu.x,Vu.x),u=Xd(zu.y,Bu.y,Fu.y,Vu.y);t.width=l-t.x,t.height=u-t.y},e.calculateTransform=function(t,r,n){var a=n.width/r.width,i=n.height/r.height;return t=Ih(t||[]),Hi(t,t,Ns(mS,-r.x,-r.y)),_1(t,t,Ns(mS,a,i)),Hi(t,t,Ns(mS,n.x,n.y)),t},e}(),b1=je.create,gS=je.set,If=je.copy,hG=je.calculateTransform,dG=je.applyTransform,see=je.contain,lee=new je(0,0,0,0),uee=new je(0,0,0,0),mS=[];function aE(e,t,r,n,a,i,o,s){var l=cM(t-r),u=cM(n-e),c=kc(l,u),h=nE[a],f=nE[1-a],v=oee[a];t=u||!Ma.bidirectional)&&(Dp[h]=-u,Dp[f]=0,Ma.useDir&&Ma.calcDirMTV())))}function fG(){var e=0,t=new Oe,r=new Oe,n={minTv:new Oe,maxTv:new Oe,useDir:!1,dirMinTv:new Oe,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,o){n.touchThreshold=0,i&&i.touchThreshold!=null&&(n.touchThreshold=Xd(0,i.touchThreshold)),n.negativeSize=!1,o&&(n.minTv.set(1/0,1/0),n.maxTv.set(0,0),n.useDir=!1,i&&i.direction!=null&&(n.useDir=!0,n.dirMinTv.copy(n.minTv),r.copy(n.minTv),e=i.direction,n.bidirectional=i.bidirectional==null||!!i.bidirectional,n.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var i=n.minTv,o=n.dirMinTv,s=i.y*i.y+i.x*i.x,l=Math.sin(e),u=Math.cos(e),c=l*i.y+u*i.x;if(a(c)){a(i.x)&&a(i.y)&&o.set(0,0);return}if(r.x=s*u/c,r.y=s*l/c,a(r.x)&&a(r.y)){o.set(0,0);return}(n.bidirectional||t.dot(r)>0)&&r.len()=0;h--){var f=i[h];f!==a&&!f.ignore&&!f.ignoreCoarsePointer&&(!f.parent||!f.parent.ignoreCoarsePointer)&&(yS.copy(f.getBoundingRect()),f.transform&&yS.applyTransform(f.transform),yS.intersect(c)&&s.push(f))}if(s.length)for(var v=4,g=Math.PI/12,m=Math.PI*2,y=0;y4)return;this._downPoint=null}this.dispatchToElement(i,e,t)}});function vee(e,t,r){if(e[e.rectHover?"rectContain":"contain"](t,r)){for(var n=e,a=void 0,i=!1;n;){if(n.ignoreClip&&(i=!0),!i){var o=n.getClipPath();if(o&&!o.contain(t,r))return!1}n.silent&&(a=!0);var s=n.__hostTarget;n=s?n.ignoreHostSilent?null:s:n.parent}return a?vG:!0}return!1}function iE(e,t,r,n,a){for(var i=e.length-1;i>=0;i--){var o=e[i],s=void 0;if(o!==a&&!o.ignore&&(s=vee(o,r,n))&&(!t.topTarget&&(t.topTarget=o),s!==vG)){t.target=o;break}}}function gG(e,t,r){var n=e.painter;return t<0||t>n.getWidth()||r<0||r>n.getHeight()}var mG=32,Xv=7;function pee(e){for(var t=0;e>=mG;)t|=e&1,e>>=1;return e+t}function oE(e,t,r,n){var a=t+1;if(a===r)return 1;if(n(e[a++],e[t])<0){for(;a=0;)a++;return a-t}function gee(e,t,r){for(r--;t>>1,a(i,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]=i}}function xS(e,t,r,n,a,i){var o=0,s=0,l=1;if(i(e,t[r+a])>0){for(s=n-a;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}else{for(s=a+1;ls&&(l=s);var u=o;o=a-l,l=a-u}for(o++;o>>1);i(e,t[r+c])>0?o=c+1:l=c}return l}function _S(e,t,r,n,a,i){var o=0,s=0,l=1;if(i(e,t[r+a])<0){for(s=a+1;ls&&(l=s);var u=o;o=a-l,l=a-u}else{for(s=n-a;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}for(o++;o>>1);i(e,t[r+c])<0?l=c:o=c+1}return l}function mee(e,t){var r=Xv,n,a,i=0,o=[];n=[],a=[];function s(v,g){n[i]=v,a[i]=g,i+=1}function l(){for(;i>1;){var v=i-2;if(v>=1&&a[v-1]<=a[v]+a[v+1]||v>=2&&a[v-2]<=a[v]+a[v-1])a[v-1]a[v+1])break;c(v)}}function u(){for(;i>1;){var v=i-2;v>0&&a[v-1]=Xv||A>=Xv);if(I)break;C<0&&(C=0),C+=2}if(r=C,r<1&&(r=1),g===1){for(x=0;x=0;x--)e[M+x]=e[C+x];e[S]=o[w];return}for(var A=r;;){var I=0,k=0,P=!1;do if(t(o[w],e[_])<0){if(e[S--]=e[_--],I++,k=0,--g===0){P=!0;break}}else if(e[S--]=o[w--],k++,I=0,--y===1){P=!0;break}while((I|k)=0;x--)e[M+x]=e[C+x];if(g===0){P=!0;break}}if(e[S--]=o[w--],--y===1){P=!0;break}if(k=y-xS(e[_],o,0,y,y-1,t),k!==0){for(S-=k,w-=k,y-=k,M=S+1,C=w+1,x=0;x=Xv||k>=Xv);if(P)break;A<0&&(A=0),A+=2}if(r=A,r<1&&(r=1),y===1){for(S-=g,_-=g,M=S+1,C=_+1,x=g-1;x>=0;x--)e[M+x]=e[C+x];e[S]=o[w]}else{if(y===0)throw new Error;for(C=S-(y-1),x=0;xs&&(l=s),sE(e,r,r+l,r+i,t),i=l}o.pushRun(r,i),o.mergeRuns(),a-=i,r+=i}while(a!==0);o.forceMergeRuns()}}var da=1,jp=2,Dd=4,lE=!1;function bS(){lE||(lE=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function uE(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var yee=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=uE}return e.prototype.traverse=function(t,r){for(var n=0;n=0&&this._roots.splice(a,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}(),A_;A_=xt.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};var sg={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-sg.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?sg.bounceIn(e*2)*.5:sg.bounceOut(e*2-1)*.5+.5}},Uy=Math.pow,Zl=Math.sqrt,N_=1e-8,yG=1e-4,cE=Zl(3),Wy=1/3,yo=wu(),ni=wu(),hf=wu();function Il(e){return e>-N_&&eN_||e<-N_}function $r(e,t,r,n,a){var i=1-a;return i*i*(i*e+3*a*t)+a*a*(a*n+3*i*r)}function hE(e,t,r,n,a){var i=1-a;return 3*(((t-e)*i+2*(r-t)*a)*i+(n-r)*a*a)}function k_(e,t,r,n,a,i){var o=n+3*(t-r)-e,s=3*(r-t*2+e),l=3*(t-e),u=e-a,c=s*s-3*o*l,h=s*l-9*o*u,f=l*l-3*s*u,v=0;if(Il(c)&&Il(h))if(Il(s))i[0]=0;else{var g=-l/s;g>=0&&g<=1&&(i[v++]=g)}else{var m=h*h-4*c*f;if(Il(m)){var y=h/c,g=-s/o+y,x=-y/2;g>=0&&g<=1&&(i[v++]=g),x>=0&&x<=1&&(i[v++]=x)}else if(m>0){var _=Zl(m),w=c*s+1.5*o*(-h+_),S=c*s+1.5*o*(-h-_);w<0?w=-Uy(-w,Wy):w=Uy(w,Wy),S<0?S=-Uy(-S,Wy):S=Uy(S,Wy);var g=(-s-(w+S))/(3*o);g>=0&&g<=1&&(i[v++]=g)}else{var C=(2*c*s-3*o*h)/(2*Zl(c*c*c)),M=Math.acos(C)/3,A=Zl(c),I=Math.cos(M),g=(-s-2*A*I)/(3*o),x=(-s+A*(I+cE*Math.sin(M)))/(3*o),k=(-s+A*(I-cE*Math.sin(M)))/(3*o);g>=0&&g<=1&&(i[v++]=g),x>=0&&x<=1&&(i[v++]=x),k>=0&&k<=1&&(i[v++]=k)}}return v}function _G(e,t,r,n,a){var i=6*r-12*t+6*e,o=9*t+3*n-3*e-9*r,s=3*t-3*e,l=0;if(Il(o)){if(xG(i)){var u=-s/i;u>=0&&u<=1&&(a[l++]=u)}}else{var c=i*i-4*o*s;if(Il(c))a[0]=-i/(2*o);else if(c>0){var h=Zl(c),u=(-i+h)/(2*o),f=(-i-h)/(2*o);u>=0&&u<=1&&(a[l++]=u),f>=0&&f<=1&&(a[l++]=f)}}return l}function iu(e,t,r,n,a,i){var o=(t-e)*a+e,s=(r-t)*a+t,l=(n-r)*a+r,u=(s-o)*a+o,c=(l-s)*a+s,h=(c-u)*a+u;i[0]=e,i[1]=o,i[2]=u,i[3]=h,i[4]=h,i[5]=c,i[6]=l,i[7]=n}function bG(e,t,r,n,a,i,o,s,l,u,c){var h,f=.005,v=1/0,g,m,y,x;yo[0]=l,yo[1]=u;for(var _=0;_<1;_+=.05)ni[0]=$r(e,r,a,o,_),ni[1]=$r(t,n,i,s,_),y=$l(yo,ni),y=0&&y=0&&u<=1&&(a[l++]=u)}}else{var c=o*o-4*i*s;if(Il(c)){var u=-o/(2*i);u>=0&&u<=1&&(a[l++]=u)}else if(c>0){var h=Zl(c),u=(-o+h)/(2*i),f=(-o-h)/(2*i);u>=0&&u<=1&&(a[l++]=u),f>=0&&f<=1&&(a[l++]=f)}}return l}function wG(e,t,r){var n=e+r-2*t;return n===0?.5:(e-t)/n}function Gg(e,t,r,n,a){var i=(t-e)*n+e,o=(r-t)*n+t,s=(o-i)*n+i;a[0]=e,a[1]=i,a[2]=s,a[3]=s,a[4]=o,a[5]=r}function SG(e,t,r,n,a,i,o,s,l){var u,c=.005,h=1/0;yo[0]=o,yo[1]=s;for(var f=0;f<1;f+=.05){ni[0]=an(e,r,a,f),ni[1]=an(t,n,i,f);var v=$l(yo,ni);v=0&&v=1?1:k_(0,n,i,1,l,s)&&$r(0,a,o,1,s[0])}}}var See=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||hr,this.ondestroy=t.ondestroy||hr,this.onrestart=t.onrestart||hr,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,a=t-this._startTime-this._pausedTime,i=a/n;i<0&&(i=0),i=Math.min(i,1);var o=this.easingFunc,s=o?o(i):i;if(this.onframe(s),i===1)if(this.loop){var l=a%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=Le(t)?t:sg[t]||Pk(t)},e}(),CG=function(){function e(t){this.value=t}return e}(),Cee=function(){function e(){this._len=0}return e.prototype.insert=function(t){var r=new CG(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}(),Pf=function(){function e(t){this._list=new Cee,this._maxSize=10,this._map={},this._maxSize=t}return e.prototype.put=function(t,r){var n=this._list,a=this._map,i=null;if(a[t]==null){var o=n.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=n.head;n.remove(l),delete a[l.key],i=l.value,this._lastRemovedEntry=l}s?s.value=r:s=new CG(r),s.key=t,n.insertEntry(s),a[t]=s}return i},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}(),dE={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 zi(e){return e=Math.round(e),e<0?0:e>255?255:e}function Tee(e){return e=Math.round(e),e<0?0:e>360?360:e}function Hg(e){return e<0?0:e>1?1:e}function Ax(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?zi(parseFloat(t)/100*255):zi(parseInt(t,10))}function ks(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?Hg(parseFloat(t)/100):Hg(parseFloat(t))}function wS(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 Pl(e,t,r){return e+(t-e)*r}function Xa(e,t,r,n,a){return e[0]=t,e[1]=r,e[2]=n,e[3]=a,e}function fM(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var TG=new Pf(20),$y=null;function ld(e,t){$y&&fM($y,t),$y=TG.put(e,$y||t.slice())}function zn(e,t){if(e){t=t||[];var r=TG.get(e);if(r)return fM(t,r);e=e+"";var n=e.replace(/ /g,"").toLowerCase();if(n in dE)return fM(t,dE[n]),ld(e,t),t;var a=n.length;if(n.charAt(0)==="#"){if(a===4||a===5){var i=parseInt(n.slice(1,4),16);if(!(i>=0&&i<=4095)){Xa(t,0,0,0,1);return}return Xa(t,(i&3840)>>4|(i&3840)>>8,i&240|(i&240)>>4,i&15|(i&15)<<4,a===5?parseInt(n.slice(4),16)/15:1),ld(e,t),t}else if(a===7||a===9){var i=parseInt(n.slice(1,7),16);if(!(i>=0&&i<=16777215)){Xa(t,0,0,0,1);return}return Xa(t,(i&16711680)>>16,(i&65280)>>8,i&255,a===9?parseInt(n.slice(7),16)/255:1),ld(e,t),t}return}var o=n.indexOf("("),s=n.indexOf(")");if(o!==-1&&s+1===a){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?Xa(t,+u[0],+u[1],+u[2],1):Xa(t,0,0,0,1);c=ks(u.pop());case"rgb":if(u.length>=3)return Xa(t,Ax(u[0]),Ax(u[1]),Ax(u[2]),u.length===3?c:ks(u[3])),ld(e,t),t;Xa(t,0,0,0,1);return;case"hsla":if(u.length!==4){Xa(t,0,0,0,1);return}return u[3]=ks(u[3]),vM(u,t),ld(e,t),t;case"hsl":if(u.length!==3){Xa(t,0,0,0,1);return}return vM(u,t),ld(e,t),t;default:return}}Xa(t,0,0,0,1)}}function vM(e,t){var r=(parseFloat(e[0])%360+360)%360/360,n=ks(e[1]),a=ks(e[2]),i=a<=.5?a*(n+1):a+n-a*n,o=a*2-i;return t=t||[],Xa(t,zi(wS(o,i,r+1/3)*255),zi(wS(o,i,r)*255),zi(wS(o,i,r-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function Mee(e){if(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,a=Math.min(t,r,n),i=Math.max(t,r,n),o=i-a,s=(i+a)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(i+a):u=o/(2-i-a);var c=((i-t)/6+o/2)/o,h=((i-r)/6+o/2)/o,f=((i-n)/6+o/2)/o;t===i?l=f-h:r===i?l=1/3+c-f:n===i&&(l=2/3+h-c),l<0&&(l+=1),l>1&&(l-=1)}var v=[l*360,u,s];return e[3]!=null&&v.push(e[3]),v}}function L_(e,t){var r=zn(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 ui(r,r.length===4?"rgba":"rgb")}}function Aee(e){var t=zn(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)}function lg(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){r=r||[];var n=e*(t.length-1),a=Math.floor(n),i=Math.ceil(n),o=t[a],s=t[i],l=n-a;return r[0]=zi(Pl(o[0],s[0],l)),r[1]=zi(Pl(o[1],s[1],l)),r[2]=zi(Pl(o[2],s[2],l)),r[3]=Hg(Pl(o[3],s[3],l)),r}}var Nee=lg;function Dk(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){var n=e*(t.length-1),a=Math.floor(n),i=Math.ceil(n),o=zn(t[a]),s=zn(t[i]),l=n-a,u=ui([zi(Pl(o[0],s[0],l)),zi(Pl(o[1],s[1],l)),zi(Pl(o[2],s[2],l)),Hg(Pl(o[3],s[3],l))],"rgba");return r?{color:u,leftIndex:a,rightIndex:i,value:n}:u}}var kee=Dk;function Ls(e,t,r,n){var a=zn(e);if(e)return a=Mee(a),t!=null&&(a[0]=Tee(Le(t)?t(a[0]):t)),r!=null&&(a[1]=ks(Le(r)?r(a[1]):r)),n!=null&&(a[2]=ks(Le(n)?n(a[2]):n)),ui(vM(a),"rgba")}function Ug(e,t){var r=zn(e);if(r&&t!=null)return r[3]=Hg(t),ui(r,"rgba")}function ui(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 Wg(e,t){var r=zn(e);return r?(.299*r[0]+.587*r[1]+.114*r[2])*r[3]/255+(1-r[3])*t:0}function Lee(){return ui([Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255)],"rgb")}var fE=new Pf(100);function I_(e){if(ve(e)){var t=fE.get(e);return t||(t=L_(e,-.1),fE.put(e,t)),t}else if(Om(e)){var r=te({},e);return r.colorStops=oe(e.colorStops,function(n){return{offset:n.offset,color:L_(n.color,-.1)}}),r}return e}const Iee=Object.freeze(Object.defineProperty({__proto__:null,fastLerp:lg,fastMapToColor:Nee,lerp:Dk,lift:L_,liftColor:I_,lum:Wg,mapToColor:kee,modifyAlpha:Ug,modifyHSL:Ls,parse:zn,parseCssFloat:ks,parseCssInt:Ax,random:Lee,stringify:ui,toHex:Aee},Symbol.toStringTag,{value:"Module"}));var P_=Math.round;function $g(e){var t;if(!e||e==="transparent")e="none";else if(typeof e=="string"&&e.indexOf("rgba")>-1){var r=zn(e);r&&(e="rgb("+r[0]+","+r[1]+","+r[2]+")",t=r[3])}return{color:e,opacity:t??1}}var vE=1e-4;function Dl(e){return e-vE}function Zy(e){return P_(e*1e3)/1e3}function pM(e){return P_(e*1e4)/1e4}function Pee(e){return"matrix("+Zy(e[0])+","+Zy(e[1])+","+Zy(e[2])+","+Zy(e[3])+","+pM(e[4])+","+pM(e[5])+")"}var Dee={left:"start",right:"end",center:"middle",middle:"middle"};function jee(e,t,r){return r==="top"?e+=t/2:r==="bottom"&&(e-=t/2),e}function Eee(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function Ree(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 MG(e){return e&&!!e.image}function Oee(e){return e&&!!e.svgElement}function jk(e){return MG(e)||Oee(e)}function AG(e){return e.type==="linear"}function NG(e){return e.type==="radial"}function kG(e){return e&&(e.type==="linear"||e.type==="radial")}function w1(e){return"url(#"+e+")"}function LG(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 IG(e){var t=e.x||0,r=e.y||0,n=(e.rotation||0)*ng,a=Te(e.scaleX,1),i=Te(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+")"),(a!==1||i!==1)&&l.push("scale("+a+","+i+")"),(o||s)&&l.push("skew("+P_(o*ng)+"deg, "+P_(s*ng)+"deg)"),l.join(" ")}var zee=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}}(),gM=Array.prototype.slice;function ms(e,t,r){return(t-e)*r+e}function SS(e,t,r,n){for(var a=t.length,i=0;in?t:e,i=Math.min(r,n),o=a[i-1]||{color:[0,0,0,0],offset:0},s=i;so;if(s)n.length=o;else for(var l=i;l=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(t,r,n){this._needsSort=!0;var a=this.keyframes,i=a.length,o=!1,s=gE,l=r;if(_n(r)){var u=Gee(r);s=u,(u===1&&!Tt(r[0])||u===2&&!Tt(r[0][0]))&&(o=!0)}else if(Tt(r)&&!yn(r))s=Xy;else if(ve(r))if(!isNaN(+r))s=Xy;else{var c=zn(r);c&&(l=c,s=Ep)}else if(Om(r)){var h=te({},l);h.colorStops=oe(r.colorStops,function(v){return{offset:v.offset,color:zn(v.color)}}),AG(r)?s=mM:NG(r)&&(s=yM),l=h}i===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=Le(n)?n:sg[n]||Pk(n)),a.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 a=this.valType,i=n.length,o=n[i-1],s=this.discrete,l=qy(a),u=mE(a),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],v=o[c]}if(v&&g){this._lastFr=c,this._lastFrP=r;var y=g.percent-v.percent,x=y===0?1:f((r-v.percent)/y,1);g.easingFunc&&(x=g.easingFunc(x));var _=n?this._additiveValue:u?qv:t[l];if((qy(i)||u)&&!_&&(_=this._additiveValue=[]),this.discrete)t[l]=x<1?v.rawValue:g.rawValue;else if(qy(i))i===kx?SS(_,v[a],g[a],x):Bee(_,v[a],g[a],x);else if(mE(i)){var w=v[a],S=g[a],C=i===mM;t[l]={type:C?"linear":"radial",x:ms(w.x,S.x,x),y:ms(w.y,S.y,x),colorStops:oe(w.colorStops,function(A,I){var k=S.colorStops[I];return{offset:ms(A.offset,k.offset,x),color:Nx(SS([],A.color,k.color,x))}}),global:S.global},C?(t[l].x2=ms(w.x2,S.x2,x),t[l].y2=ms(w.y2,S.y2,x)):t[l].r=ms(w.r,S.r,x)}else if(u)SS(_,v[a],g[a],x),n||(t[l]=Nx(_));else{var M=ms(v[a],g[a],x);n?this._additiveValue=M:t[l]=M}n&&this._addToTarget(t)}}},e.prototype._addToTarget=function(t){var r=this.valType,n=this.propName,a=this._additiveValue;r===Xy?t[n]=t[n]+a:r===Ep?(zn(t[n],qv),Yy(qv,qv,a,1),t[n]=Nx(qv)):r===kx?Yy(t[n],t[n],a,1):r===PG&&pE(t[n],t[n],a,1)},e}(),Ek=function(){function e(t,r,n,a){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=t,this._loop=r,r&&a){m1("Can' use additive animation on looped animation.");return}this._additiveAnimators=a,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,gt(r),n)},e.prototype.whenWithKeys=function(t,r,n,a){for(var i=this._tracks,o=0;o0&&l.addKeyframe(0,ug(u),a),this._trackKeys.push(s)}l.addKeyframe(t,ug(r[s]),a)}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=[],a=this._maxTime||0,i=0;i1){var s=o.pop();i.addKeyframe(s.time,t[a]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}();function qd(){return new Date().getTime()}var Uee=function(e){X(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,a=r.next;n?n.next=a:this._head=a,a?a.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=qd()-this._pausedTime,a=n-this._time,i=this._head;i;){var o=i.next,s=i.step(n,a);s&&(i.ondestroy(),this.removeClip(i)),i=o}this._time=n,r||(this.trigger("frame",a),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var r=this;this._running=!0;function n(){r._running&&(A_(n),!r._paused&&r.update())}A_(n)},t.prototype.start=function(){this._running||(this._time=qd(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=qd(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=qd()-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 a=new Ek(r,n.loop);return this.addAnimator(a),a},t}(bi),Wee=300,CS=xt.domSupported,TS=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=oe(e,function(a){var i=a.replace("mouse","pointer");return r.hasOwnProperty(i)?i:a});return{mouse:e,touch:t,pointer:n}}(),yE={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},xE=!1;function xM(e){var t=e.pointerType;return t==="pen"||t==="touch"}function $ee(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 MS(e){e&&(e.zrByTouch=!0)}function Zee(e,t){return Ka(e.dom,new Yee(e,t),!0)}function DG(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 Yee=function(){function e(t,r){this.stopPropagation=hr,this.stopImmediatePropagation=hr,this.preventDefault=hr,this.type=r.type,this.target=this.currentTarget=t.dom,this.pointerType=r.pointerType,this.clientX=r.clientX,this.clientY=r.clientY}return e}(),Li={mousedown:function(e){e=Ka(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=Ka(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=Ka(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){e=Ka(this.dom,e);var t=e.toElement||e.relatedTarget;DG(this,t)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){xE=!0,e=Ka(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){xE||(e=Ka(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){e=Ka(this.dom,e),MS(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),Li.mousemove.call(this,e),Li.mousedown.call(this,e)},touchmove:function(e){e=Ka(this.dom,e),MS(e),this.handler.processGesture(e,"change"),Li.mousemove.call(this,e)},touchend:function(e){e=Ka(this.dom,e),MS(e),this.handler.processGesture(e,"end"),Li.mouseup.call(this,e),+new Date-+this.__lastTouchMomentwE||e<-wE}var Hu=[],ud=[],NS=ar(),kS=Math.abs,Xo=function(){function e(){}return e.prototype.getLocalTransform=function(t){return ou(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 Gu(this.rotation)||Gu(this.x)||Gu(this.y)||Gu(this.scaleX-1)||Gu(this.scaleY-1)||Gu(this.skewX)||Gu(this.skewY)},e.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,r=this.needLocalTransform(),n=this.transform;if(!(r||t)){n&&(bE(n),this.invTransform=null);return}n=n||ar(),r?this.getLocalTransform(n):bE(n),t&&(r?ja(n,t,n):au(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||ar(),Ra(this.invTransform,n)},e.prototype._resolveGlobalScaleRatio=function(t){var r=this.globalScaleRatio;if(r!=null&&r!==1){this.getGlobalScale(Hu);var n=Hu[0]<0?-1:1,a=Hu[1]<0?-1:1,i=((Hu[0]-n)*r+n)/Hu[0]||0,o=((Hu[1]-a)*r+a)/Hu[1]||0;t[0]*=i,t[1]*=i,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],a=Math.atan2(t[1],t[0]),i=Math.PI/2+a-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(i),r=Math.sqrt(r),this.skewX=i,this.skewY=0,this.rotation=-a,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||ar(),ja(ud,t.invTransform,r),r=ud);var n=this.originX,a=this.originY;(n||a)&&(NS[4]=n,NS[5]=a,ja(ud,r,NS),ud[4]-=n,ud[5]-=a,r=ud),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],a=this.invTransform;return a&&dr(n,n,a),n},e.prototype.transformCoordToGlobal=function(t,r){var n=[t,r],a=this.transform;return a&&dr(n,n,a),n},e.prototype.getLineScale=function(){var t=this.transform;return t&&kS(t[0]-1)>1e-10&&kS(t[3]-1)>1e-10?Math.sqrt(kS(t[0]*t[3]-t[2]*t[1])):1},e.prototype.copyTransform=function(t){zo(this,t)},e.getLocalTransform=function(t,r){r=r||[];var n=t.originX||0,a=t.originY||0,i=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,v=t.skewY?Math.tan(-t.skewY):0;if(n||a||s||l){var g=n+s,m=a+l;r[4]=-g*i-f*m*o,r[5]=-m*o-v*g*i}else r[4]=r[5]=0;return r[0]=i,r[3]=o,r[1]=v*i,r[2]=f*o,u&&Js(r,r,u),r[4]+=n+c,r[5]+=a+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}(),ou=Xo.getLocalTransform;function df(){return new Xo}var Gs=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function zo(e,t){return rG(e,t,Gs)}function ko(e){Ky||(Ky=new Pf(100)),e=e||Fs;var t=Ky.get(e);return t||(t={font:e,strWidthCache:new Pf(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:qr.measureText("国",e).width,asciiCharWidth:qr.measureText("a",e).width},Ky.put(e,t)),t}var Ky;function Qee(e){if(!(LS>=SE)){e=e||Fs;for(var t=[],r=+new Date,n=0;n<=127;n++)t[n]=qr.measureText(String.fromCharCode(n),e).width;var a=+new Date-r;return a>16?LS=SE:a>2&&LS++,t}}var LS=0,SE=5;function EG(e,t){return e.asciiWidthMapTried||(e.asciiWidthMap=Qee(e.font),e.asciiWidthMapTried=!0),0<=t&&t<=127?e.asciiWidthMap!=null?e.asciiWidthMap[t]:e.asciiCharWidth:e.stWideCharWidth}function Lo(e,t){var r=e.strWidthCache,n=r.get(t);return n==null&&(n=qr.measureText(t,e.font).width,r.put(t,n)),n}function CE(e,t,r,n){var a=Lo(ko(t),e),i=Fm(t),o=Df(0,a,r),s=zc(0,i,n),l=new je(o,s,a,i);return l}function S1(e,t,r,n){var a=((e||"")+"").split(` -`),i=a.length;if(i===1)return CE(a[0],t,r,n);for(var o=new je(0,0,0,0),s=0;s=0?parseFloat(e)/100*t:parseFloat(e):e}function j_(e,t,r){var n=t.position||"inside",a=t.distance!=null?t.distance:5,i=r.height,o=r.width,s=i/2,l=r.x,u=r.y,c="left",h="top";if(n instanceof Array)l+=Bo(n[0],r.width),u+=Bo(n[1],r.height),c=null,h=null;else switch(n){case"left":l-=a,u+=s,c="right",h="middle";break;case"right":l+=a+o,u+=s,h="middle";break;case"top":l+=o/2,u-=a,c="center",h="bottom";break;case"bottom":l+=o/2,u+=i+a,c="center";break;case"inside":l+=o/2,u+=s,c="center",h="middle";break;case"insideLeft":l+=a,u+=s,h="middle";break;case"insideRight":l+=o-a,u+=s,c="right",h="middle";break;case"insideTop":l+=o/2,u+=a,c="center";break;case"insideBottom":l+=o/2,u+=i-a,c="center",h="bottom";break;case"insideTopLeft":l+=a,u+=a;break;case"insideTopRight":l+=o-a,u+=a,c="right";break;case"insideBottomLeft":l+=a,u+=i-a,h="bottom";break;case"insideBottomRight":l+=o-a,u+=i-a,c="right",h="bottom";break}return e=e||{},e.x=l,e.y=u,e.align=c,e.verticalAlign=h,e}var IS="__zr_normal__",PS=Gs.concat(["ignore"]),ete=pi(Gs,function(e,t){return e[t]=!0,e},{ignore:!1}),cd={},tte=new je(0,0,0,0),Jy=[],Ix=0,C1=1,T1=function(){function e(t){this.id=Ak(),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 a=this.transform;a||(a=this.transform=[1,0,0,1,0,0]),a[4]+=t,a[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,a=n.local,i=r.innerTransformable,o=void 0,s=void 0,l=!1;i.parent=a?this:null;var u=!1;i.copyTransform(r);var c=n.position!=null,h=n.autoOverflowArea,f=void 0;if((h||c)&&(f=tte,n.layoutRect?f.copy(n.layoutRect):f.copy(this.getBoundingRect()),a||f.applyTransform(this.transform)),c){this.calculateTextPosition?this.calculateTextPosition(cd,n,f):j_(cd,n,f),i.x=cd.x,i.y=cd.y,o=cd.align,s=cd.verticalAlign;var v=n.origin;if(v&&n.rotation!=null){var g=void 0,m=void 0;v==="center"?(g=f.width*.5,m=f.height*.5):(g=Bo(v[0],f.width),m=Bo(v[1],f.height)),u=!0,i.originX=-i.x+g+(a?0:f.x),i.originY=-i.y+m+(a?0:f.y)}}n.rotation!=null&&(i.rotation=n.rotation);var y=n.offset;y&&(i.x+=y[0],i.y+=y[1],u||(i.originX=-y[0],i.originY=-y[1]));var x=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={});if(h){var _=x.overflowRect=x.overflowRect||new je(0,0,0,0);i.getLocalTransform(Jy),Ra(Jy,Jy),je.copy(_,f),_.applyTransform(Jy)}else x.overflowRect=null;var w=n.inside==null?typeof n.position=="string"&&n.position.indexOf("inside")>=0:n.inside,S=void 0,C=void 0,M=void 0;w&&this.canBeInsideText()?(S=n.insideFill,C=n.insideStroke,(S==null||S==="auto")&&(S=this.getInsideTextFill()),(C==null||C==="auto")&&(C=this.getInsideTextStroke(S),M=!0)):(S=n.outsideFill,C=n.outsideStroke,(S==null||S==="auto")&&(S=this.getOutsideFill()),(C==null||C==="auto")&&(C=this.getOutsideStroke(S),M=!0)),S=S||"#000",(S!==x.fill||C!==x.stroke||M!==x.autoStroke||o!==x.align||s!==x.verticalAlign)&&(l=!0,x.fill=S,x.stroke=C,x.autoStroke=M,x.align=o,x.verticalAlign=s,r.setDefaultTextStyle(x)),r.__dirty|=da,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()?SM:wM},e.prototype.getOutsideStroke=function(t){var r=this.__zr&&this.__zr.getBackgroundColor(),n=typeof r=="string"&&zn(r);n||(n=[255,255,255,1]);for(var a=n[3],i=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*a+(i?0:255)*(1-a);return n[3]=1,ui(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||{},te(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(Re(t))for(var n=t,a=gt(n),i=0;i0},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(IS,!1,t)},e.prototype.useState=function(t,r,n,a){var i=t===IS,o=this.hasState();if(!(!o&&i)){var s=this.currentStates,l=this.stateTransition;if(!(Ye(s,t)>=0&&(r||s.length===1))){var u;if(this.stateProxy&&!i&&(u=this.stateProxy(t)),u||(u=this.states&&this.states[t]),!u&&!i){m1("State "+t+" not exists.");return}i||this.saveCurrentToNormalState(u);var c=this._textContent,h=TE(this,c,u,a);h&&!this.__inHover&&(this.__inHover=h),this._applyStateObj(t,u,this._normalState,r,AE(this,n,l),l);var f=this._textGuide;return c&&c.useState(t,r,n,!!h),f&&f.useState(t,r,n,!!h),i?(this.currentStates=[],this._normalState={}):r?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!h&&this.__inHover&&(this.__inHover=Ix,this.__dirty&=~da),u}}},e.prototype.useStates=function(t,r,n){if(!t.length)this.clearStates();else{var a=[],i=this.currentStates,o=t.length,s=o===i.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 a=this.currentStates.slice(),i=Ye(a,t),o=Ye(a,r)>=0;i>=0?o?a.splice(i,1):a[i]=r:n&&!o&&a.push(r),this.useStates(a)},e.prototype.toggleState=function(t,r){r?this.useState(t,!0):this.removeState(t)},e.prototype._mergeStates=function(t){for(var r={},n,a=0;a=0&&i.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,a=n.length,i=[],o=0;o0&&r.during&&i[0].during(function(g,m){r.during(m)});for(var f=0;f0||a.force&&!o.length){var I=void 0,k=void 0,P=void 0;if(s){k={},f&&(I={});for(var S=0;S0}var De=function(e){X(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,a=0;a=0&&(a.splice(i,0,r),this._doAdd(r))}return this},t.prototype.replace=function(r,n){var a=Ye(this._children,r);return a>=0&&this.replaceAt(n,a),this},t.prototype.replaceAt=function(r,n){var a=this._children,i=a[n];if(r&&r!==this&&r.parent!==this&&r!==i){a[n]=r,i.parent=null;var o=this.__zr;o&&i.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,a=this._children,i=Ye(a,r);return i<0?this:(a.splice(i,1),r.parent=null,n&&r.removeSelfFromZr(n),n&&n.refresh(),this)},t.prototype.removeAll=function(){for(var r=this._children,n=this.__zr,a=0;a0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]"u"&&typeof self<"u"?xt.worker=!0:!xt.hasGlobalWindow||"Deno"in window||typeof navigator<"u"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Node.js")>-1?(xt.node=!0,xt.svgSupported=!0):SQ(navigator.userAgent,xt);function SQ(e,t){var r=t.browser,n=e.match(/Firefox\/([\d.]+)/),a=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),i=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);n&&(r.firefox=!0,r.version=n[1]),a&&(r.ie=!0,r.version=a[1]),i&&(r.edge=!0,r.version=i[1],r.newEdge=+i[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 Tk=12,QV="sans-serif",Fs=Tk+"px "+QV,CQ=20,TQ=100,MQ="007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N";function AQ(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=PQ&&(dS=0),dS++}function m1(){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",a[u]+":0",n[1-l]+":auto",a[1-u]+":auto",""].join("!important;"),e.appendChild(o),r.push(o)}return t.clearMarkers=function(){R(r,function(c){c.parentNode&&c.parentNode.removeChild(c)})},r}function KQ(e,t,r){for(var n=r?"invTrans":"trans",a=t[n],i=t.srcCoords,o=[],s=[],l=!0,u=0;u<4;u++){var c=e[u].getBoundingClientRect(),h=2*u,f=c.left,v=c.top;o.push(f,v),l=l&&i&&f===i[h]&&v===i[h+1],s.push(e[u].offsetLeft,e[u].offsetTop)}return l&&a?a:(t.srcCoords=o,t[n]=r?eE(s,o):eE(o,s))}function cG(e){return e.nodeName.toUpperCase()==="CANVAS"}var JQ=/([&<>"'])/g,QQ={"&":"&","<":"<",">":">",'"':""","'":"'"};function On(e){return e==null?"":(e+"").replace(JQ,function(t,r){return QQ[r]})}var eee=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,vS=[],tee=xt.browser.firefox&&+xt.browser.version.split(".")[0]<39;function lM(e,t,r,n){return r=r||{},n?tE(e,t,r):tee&&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):tE(e,t,r),r}function tE(e,t,r){if(xt.domSupported&&e.getBoundingClientRect){var n=t.clientX,a=t.clientY;if(cG(e)){var i=e.getBoundingClientRect();r.zrX=n-i.left,r.zrY=a-i.top;return}else if(sM(vS,e,n,a)){r.zrX=vS[0],r.zrY=vS[1];return}}r.zrX=r.zrY=0}function Pk(e){return e||window.event}function Ja(e,t,r){if(t=Pk(t),t.zrX!=null)return t;var n=t.type,a=n&&n.indexOf("touch")>=0;if(a){var o=n!=="touchend"?t.targetTouches[0]:t.changedTouches[0];o&&lM(e,o,t,r)}else{lM(e,t,t,r);var i=ree(t);t.zrDelta=i?i/120:-(t.detail||0)/3}var s=t.button;return t.which==null&&s!==void 0&&eee.test(t.type)&&(t.which=s&1?1:s&2?3:s&4?2:0),t}function ree(e){var t=e.wheelDelta;if(t)return t;var r=e.deltaX,n=e.deltaY;if(r==null||n==null)return t;var a=Math.abs(n!==0?n:r),i=n>0?-1:n<0?1:r>0?-1:1;return 3*a*i}function uM(e,t,r,n){e.addEventListener(t,r,n)}function nee(e,t,r,n){e.removeEventListener(t,r,n)}var Vs=function(e){e.preventDefault(),e.stopPropagation(),e.cancelBubble=!0};function rE(e){return e.which===2||e.which===3}var aee=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 a=t.touches;if(a){for(var i={points:[],touches:[],target:r,event:t},o=0,s=a.length;o1&&n&&n.length>1){var i=nE(n)/nE(a);!isFinite(i)&&(i=1),t.pinchScale=i;var o=iee(n);return t.pinchX=o[0],t.pinchY=o[1],{type:"pinch",target:e[0].target,event:t}}}}};function ar(){return[1,0,0,1,0,0]}function Ih(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e}function au(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 Ea(e,t,r){var n=t[0]*r[0]+t[2]*r[1],a=t[1]*r[0]+t[3]*r[1],i=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]=a,e[2]=i,e[3]=o,e[4]=s,e[5]=l,e}function Hi(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 Js(e,t,r,n){n===void 0&&(n=[0,0]);var a=t[0],i=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]=a*h+s*c,e[1]=-a*c+s*h,e[2]=i*h+l*c,e[3]=-i*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 _1(e,t,r){var n=r[0],a=r[1];return e[0]=t[0]*n,e[1]=t[1]*a,e[2]=t[2]*n,e[3]=t[3]*a,e[4]=t[4]*n,e[5]=t[5]*a,e}function Oa(e,t){var r=t[0],n=t[2],a=t[4],i=t[1],o=t[3],s=t[5],l=r*o-i*n;return l?(l=1/l,e[0]=o*l,e[1]=-i*l,e[2]=-n*l,e[3]=r*l,e[4]=(n*s-o*a)*l,e[5]=(i*a-r*s)*l,e):null}function hG(e){var t=ar();return au(t,e),t}const oee=Object.freeze(Object.defineProperty({__proto__:null,clone:hG,copy:au,create:ar,identity:Ih,invert:Oa,mul:Ea,rotate:Js,scale:_1,translate:Hi},Symbol.toStringTag,{value:"Module"}));var Oe=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,a){t.x=r.x+n.x*a,t.y=r.y+n.y*a},e.lerp=function(t,r,n,a){var i=1-a;t.x=i*r.x+a*n.x,t.y=i*r.y+a*n.y},e}(),kc=Math.min,Xd=Math.max,cM=Math.abs,aE=["x","y"],see=["width","height"],zu=new Oe,Bu=new Oe,Fu=new Oe,Vu=new Oe,Aa=vG(),Dp=Aa.minTv,hM=Aa.maxTv,og=[0,0],je=function(){function e(t,r,n,a){gS(this,t,r,n,a)}return e.set=function(t,r,n,a,i){return a<0&&(r=r+a,a=-a),i<0&&(n=n+i,i=-i),t.x=r,t.y=n,t.width=a,t.height=i,t},e.prototype.union=function(t){var r=kc(t.x,this.x),n=kc(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Xd(t.x+t.width,this.x+this.width)-r:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=Xd(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 dG(ar(),this,t)},e.prototype.intersect=function(t,r,n){return e.intersect(this,t,r,n)},e.intersect=function(t,r,n,a){n&&Oe.set(n,0,0);var i=a&&a.outIntersectRect||null,o=a&&a.clamp;if(i&&(i.x=i.y=i.width=i.height=NaN),!t||!r)return!1;t instanceof e||(t=gS(uee,t.x,t.y,t.width,t.height)),r instanceof e||(r=gS(cee,r.x,r.y,r.width,r.height));var s=!!n;Aa.reset(a,s);var l=Aa.touchThreshold,u=t.x+l,c=t.x+t.width-l,h=t.y+l,f=t.y+t.height-l,v=r.x+l,g=r.x+r.width-l,m=r.y+l,y=r.y+r.height-l;if(u>c||h>f||v>g||m>y)return!1;var x=!(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){If(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&&If(t,r);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var a=n[0],i=n[3],o=n[4],s=n[5];t.x=r.x*a+o,t.y=r.y*i+s,t.width=r.width*a,t.height=r.height*i,t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height);return}zu.x=Fu.x=r.x,zu.y=Vu.y=r.y,Bu.x=Vu.x=r.x+r.width,Bu.y=Fu.y=r.y+r.height,zu.transform(n),Vu.transform(n),Bu.transform(n),Fu.transform(n),t.x=kc(zu.x,Bu.x,Fu.x,Vu.x),t.y=kc(zu.y,Bu.y,Fu.y,Vu.y);var l=Xd(zu.x,Bu.x,Fu.x,Vu.x),u=Xd(zu.y,Bu.y,Fu.y,Vu.y);t.width=l-t.x,t.height=u-t.y},e.calculateTransform=function(t,r,n){var a=n.width/r.width,i=n.height/r.height;return t=Ih(t||[]),Hi(t,t,Ns(mS,-r.x,-r.y)),_1(t,t,Ns(mS,a,i)),Hi(t,t,Ns(mS,n.x,n.y)),t},e}(),b1=je.create,gS=je.set,If=je.copy,dG=je.calculateTransform,fG=je.applyTransform,lee=je.contain,uee=new je(0,0,0,0),cee=new je(0,0,0,0),mS=[];function iE(e,t,r,n,a,i,o,s){var l=cM(t-r),u=cM(n-e),c=kc(l,u),h=aE[a],f=aE[1-a],v=see[a];t=u||!Aa.bidirectional)&&(Dp[h]=-u,Dp[f]=0,Aa.useDir&&Aa.calcDirMTV())))}function vG(){var e=0,t=new Oe,r=new Oe,n={minTv:new Oe,maxTv:new Oe,useDir:!1,dirMinTv:new Oe,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,o){n.touchThreshold=0,i&&i.touchThreshold!=null&&(n.touchThreshold=Xd(0,i.touchThreshold)),n.negativeSize=!1,o&&(n.minTv.set(1/0,1/0),n.maxTv.set(0,0),n.useDir=!1,i&&i.direction!=null&&(n.useDir=!0,n.dirMinTv.copy(n.minTv),r.copy(n.minTv),e=i.direction,n.bidirectional=i.bidirectional==null||!!i.bidirectional,n.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var i=n.minTv,o=n.dirMinTv,s=i.y*i.y+i.x*i.x,l=Math.sin(e),u=Math.cos(e),c=l*i.y+u*i.x;if(a(c)){a(i.x)&&a(i.y)&&o.set(0,0);return}if(r.x=s*u/c,r.y=s*l/c,a(r.x)&&a(r.y)){o.set(0,0);return}(n.bidirectional||t.dot(r)>0)&&r.len()=0;h--){var f=i[h];f!==a&&!f.ignore&&!f.ignoreCoarsePointer&&(!f.parent||!f.parent.ignoreCoarsePointer)&&(yS.copy(f.getBoundingRect()),f.transform&&yS.applyTransform(f.transform),yS.intersect(c)&&s.push(f))}if(s.length)for(var v=4,g=Math.PI/12,m=Math.PI*2,y=0;y4)return;this._downPoint=null}this.dispatchToElement(i,e,t)}});function pee(e,t,r){if(e[e.rectHover?"rectContain":"contain"](t,r)){for(var n=e,a=void 0,i=!1;n;){if(n.ignoreClip&&(i=!0),!i){var o=n.getClipPath();if(o&&!o.contain(t,r))return!1}n.silent&&(a=!0);var s=n.__hostTarget;n=s?n.ignoreHostSilent?null:s:n.parent}return a?pG:!0}return!1}function oE(e,t,r,n,a){for(var i=e.length-1;i>=0;i--){var o=e[i],s=void 0;if(o!==a&&!o.ignore&&(s=pee(o,r,n))&&(!t.topTarget&&(t.topTarget=o),s!==pG)){t.target=o;break}}}function mG(e,t,r){var n=e.painter;return t<0||t>n.getWidth()||r<0||r>n.getHeight()}var yG=32,Xv=7;function gee(e){for(var t=0;e>=yG;)t|=e&1,e>>=1;return e+t}function sE(e,t,r,n){var a=t+1;if(a===r)return 1;if(n(e[a++],e[t])<0){for(;a=0;)a++;return a-t}function mee(e,t,r){for(r--;t>>1,a(i,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]=i}}function xS(e,t,r,n,a,i){var o=0,s=0,l=1;if(i(e,t[r+a])>0){for(s=n-a;l0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}else{for(s=a+1;ls&&(l=s);var u=o;o=a-l,l=a-u}for(o++;o>>1);i(e,t[r+c])>0?o=c+1:l=c}return l}function _S(e,t,r,n,a,i){var o=0,s=0,l=1;if(i(e,t[r+a])<0){for(s=a+1;ls&&(l=s);var u=o;o=a-l,l=a-u}else{for(s=n-a;l=0;)o=l,l=(l<<1)+1,l<=0&&(l=s);l>s&&(l=s),o+=a,l+=a}for(o++;o>>1);i(e,t[r+c])<0?l=c:o=c+1}return l}function yee(e,t){var r=Xv,n,a,i=0,o=[];n=[],a=[];function s(v,g){n[i]=v,a[i]=g,i+=1}function l(){for(;i>1;){var v=i-2;if(v>=1&&a[v-1]<=a[v]+a[v+1]||v>=2&&a[v-2]<=a[v]+a[v-1])a[v-1]a[v+1])break;c(v)}}function u(){for(;i>1;){var v=i-2;v>0&&a[v-1]=Xv||A>=Xv);if(k)break;C<0&&(C=0),C+=2}if(r=C,r<1&&(r=1),g===1){for(x=0;x=0;x--)e[M+x]=e[C+x];e[S]=o[w];return}for(var A=r;;){var k=0,I=0,P=!1;do if(t(o[w],e[_])<0){if(e[S--]=e[_--],k++,I=0,--g===0){P=!0;break}}else if(e[S--]=o[w--],I++,k=0,--y===1){P=!0;break}while((k|I)=0;x--)e[M+x]=e[C+x];if(g===0){P=!0;break}}if(e[S--]=o[w--],--y===1){P=!0;break}if(I=y-xS(e[_],o,0,y,y-1,t),I!==0){for(S-=I,w-=I,y-=I,M=S+1,C=w+1,x=0;x=Xv||I>=Xv);if(P)break;A<0&&(A=0),A+=2}if(r=A,r<1&&(r=1),y===1){for(S-=g,_-=g,M=S+1,C=_+1,x=g-1;x>=0;x--)e[M+x]=e[C+x];e[S]=o[w]}else{if(y===0)throw new Error;for(C=S-(y-1),x=0;xs&&(l=s),lE(e,r,r+l,r+i,t),i=l}o.pushRun(r,i),o.mergeRuns(),a-=i,r+=i}while(a!==0);o.forceMergeRuns()}}var da=1,jp=2,Dd=4,uE=!1;function bS(){uE||(uE=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function cE(e,t){return e.zlevel===t.zlevel?e.z===t.z?e.z2-t.z2:e.z-t.z:e.zlevel-t.zlevel}var xee=function(){function e(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=cE}return e.prototype.traverse=function(t,r){for(var n=0;n=0&&this._roots.splice(a,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}(),A_;A_=xt.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(e){return setTimeout(e,16)};var sg={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-sg.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?sg.bounceIn(e*2)*.5:sg.bounceOut(e*2-1)*.5+.5}},Uy=Math.pow,Zl=Math.sqrt,N_=1e-8,xG=1e-4,hE=Zl(3),Wy=1/3,yo=wu(),ai=wu(),hf=wu();function Il(e){return e>-N_&&eN_||e<-N_}function $r(e,t,r,n,a){var i=1-a;return i*i*(i*e+3*a*t)+a*a*(a*n+3*i*r)}function dE(e,t,r,n,a){var i=1-a;return 3*(((t-e)*i+2*(r-t)*a)*i+(n-r)*a*a)}function k_(e,t,r,n,a,i){var o=n+3*(t-r)-e,s=3*(r-t*2+e),l=3*(t-e),u=e-a,c=s*s-3*o*l,h=s*l-9*o*u,f=l*l-3*s*u,v=0;if(Il(c)&&Il(h))if(Il(s))i[0]=0;else{var g=-l/s;g>=0&&g<=1&&(i[v++]=g)}else{var m=h*h-4*c*f;if(Il(m)){var y=h/c,g=-s/o+y,x=-y/2;g>=0&&g<=1&&(i[v++]=g),x>=0&&x<=1&&(i[v++]=x)}else if(m>0){var _=Zl(m),w=c*s+1.5*o*(-h+_),S=c*s+1.5*o*(-h-_);w<0?w=-Uy(-w,Wy):w=Uy(w,Wy),S<0?S=-Uy(-S,Wy):S=Uy(S,Wy);var g=(-s-(w+S))/(3*o);g>=0&&g<=1&&(i[v++]=g)}else{var C=(2*c*s-3*o*h)/(2*Zl(c*c*c)),M=Math.acos(C)/3,A=Zl(c),k=Math.cos(M),g=(-s-2*A*k)/(3*o),x=(-s+A*(k+hE*Math.sin(M)))/(3*o),I=(-s+A*(k-hE*Math.sin(M)))/(3*o);g>=0&&g<=1&&(i[v++]=g),x>=0&&x<=1&&(i[v++]=x),I>=0&&I<=1&&(i[v++]=I)}}return v}function bG(e,t,r,n,a){var i=6*r-12*t+6*e,o=9*t+3*n-3*e-9*r,s=3*t-3*e,l=0;if(Il(o)){if(_G(i)){var u=-s/i;u>=0&&u<=1&&(a[l++]=u)}}else{var c=i*i-4*o*s;if(Il(c))a[0]=-i/(2*o);else if(c>0){var h=Zl(c),u=(-i+h)/(2*o),f=(-i-h)/(2*o);u>=0&&u<=1&&(a[l++]=u),f>=0&&f<=1&&(a[l++]=f)}}return l}function iu(e,t,r,n,a,i){var o=(t-e)*a+e,s=(r-t)*a+t,l=(n-r)*a+r,u=(s-o)*a+o,c=(l-s)*a+s,h=(c-u)*a+u;i[0]=e,i[1]=o,i[2]=u,i[3]=h,i[4]=h,i[5]=c,i[6]=l,i[7]=n}function wG(e,t,r,n,a,i,o,s,l,u,c){var h,f=.005,v=1/0,g,m,y,x;yo[0]=l,yo[1]=u;for(var _=0;_<1;_+=.05)ai[0]=$r(e,r,a,o,_),ai[1]=$r(t,n,i,s,_),y=$l(yo,ai),y=0&&y=0&&u<=1&&(a[l++]=u)}}else{var c=o*o-4*i*s;if(Il(c)){var u=-o/(2*i);u>=0&&u<=1&&(a[l++]=u)}else if(c>0){var h=Zl(c),u=(-o+h)/(2*i),f=(-o-h)/(2*i);u>=0&&u<=1&&(a[l++]=u),f>=0&&f<=1&&(a[l++]=f)}}return l}function SG(e,t,r){var n=e+r-2*t;return n===0?.5:(e-t)/n}function Gg(e,t,r,n,a){var i=(t-e)*n+e,o=(r-t)*n+t,s=(o-i)*n+i;a[0]=e,a[1]=i,a[2]=s,a[3]=s,a[4]=o,a[5]=r}function CG(e,t,r,n,a,i,o,s,l){var u,c=.005,h=1/0;yo[0]=o,yo[1]=s;for(var f=0;f<1;f+=.05){ai[0]=an(e,r,a,f),ai[1]=an(t,n,i,f);var v=$l(yo,ai);v=0&&v=1?1:k_(0,n,i,1,l,s)&&$r(0,a,o,1,s[0])}}}var Cee=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||hr,this.ondestroy=t.ondestroy||hr,this.onrestart=t.onrestart||hr,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,a=t-this._startTime-this._pausedTime,i=a/n;i<0&&(i=0),i=Math.min(i,1);var o=this.easingFunc,s=o?o(i):i;if(this.onframe(s),i===1)if(this.loop){var l=a%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=Le(t)?t:sg[t]||Dk(t)},e}(),TG=function(){function e(t){this.value=t}return e}(),Tee=function(){function e(){this._len=0}return e.prototype.insert=function(t){var r=new TG(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}(),Pf=function(){function e(t){this._list=new Tee,this._maxSize=10,this._map={},this._maxSize=t}return e.prototype.put=function(t,r){var n=this._list,a=this._map,i=null;if(a[t]==null){var o=n.len(),s=this._lastRemovedEntry;if(o>=this._maxSize&&o>0){var l=n.head;n.remove(l),delete a[l.key],i=l.value,this._lastRemovedEntry=l}s?s.value=r:s=new TG(r),s.key=t,n.insertEntry(s),a[t]=s}return i},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}(),fE={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 zi(e){return e=Math.round(e),e<0?0:e>255?255:e}function Mee(e){return e=Math.round(e),e<0?0:e>360?360:e}function Hg(e){return e<0?0:e>1?1:e}function Ax(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?zi(parseFloat(t)/100*255):zi(parseInt(t,10))}function ks(e){var t=e;return t.length&&t.charAt(t.length-1)==="%"?Hg(parseFloat(t)/100):Hg(parseFloat(t))}function wS(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 Pl(e,t,r){return e+(t-e)*r}function qa(e,t,r,n,a){return e[0]=t,e[1]=r,e[2]=n,e[3]=a,e}function fM(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var MG=new Pf(20),$y=null;function ld(e,t){$y&&fM($y,t),$y=MG.put(e,$y||t.slice())}function Bn(e,t){if(e){t=t||[];var r=MG.get(e);if(r)return fM(t,r);e=e+"";var n=e.replace(/ /g,"").toLowerCase();if(n in fE)return fM(t,fE[n]),ld(e,t),t;var a=n.length;if(n.charAt(0)==="#"){if(a===4||a===5){var i=parseInt(n.slice(1,4),16);if(!(i>=0&&i<=4095)){qa(t,0,0,0,1);return}return qa(t,(i&3840)>>4|(i&3840)>>8,i&240|(i&240)>>4,i&15|(i&15)<<4,a===5?parseInt(n.slice(4),16)/15:1),ld(e,t),t}else if(a===7||a===9){var i=parseInt(n.slice(1,7),16);if(!(i>=0&&i<=16777215)){qa(t,0,0,0,1);return}return qa(t,(i&16711680)>>16,(i&65280)>>8,i&255,a===9?parseInt(n.slice(7),16)/255:1),ld(e,t),t}return}var o=n.indexOf("("),s=n.indexOf(")");if(o!==-1&&s+1===a){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?qa(t,+u[0],+u[1],+u[2],1):qa(t,0,0,0,1);c=ks(u.pop());case"rgb":if(u.length>=3)return qa(t,Ax(u[0]),Ax(u[1]),Ax(u[2]),u.length===3?c:ks(u[3])),ld(e,t),t;qa(t,0,0,0,1);return;case"hsla":if(u.length!==4){qa(t,0,0,0,1);return}return u[3]=ks(u[3]),vM(u,t),ld(e,t),t;case"hsl":if(u.length!==3){qa(t,0,0,0,1);return}return vM(u,t),ld(e,t),t;default:return}}qa(t,0,0,0,1)}}function vM(e,t){var r=(parseFloat(e[0])%360+360)%360/360,n=ks(e[1]),a=ks(e[2]),i=a<=.5?a*(n+1):a+n-a*n,o=a*2-i;return t=t||[],qa(t,zi(wS(o,i,r+1/3)*255),zi(wS(o,i,r)*255),zi(wS(o,i,r-1/3)*255),1),e.length===4&&(t[3]=e[3]),t}function Aee(e){if(e){var t=e[0]/255,r=e[1]/255,n=e[2]/255,a=Math.min(t,r,n),i=Math.max(t,r,n),o=i-a,s=(i+a)/2,l,u;if(o===0)l=0,u=0;else{s<.5?u=o/(i+a):u=o/(2-i-a);var c=((i-t)/6+o/2)/o,h=((i-r)/6+o/2)/o,f=((i-n)/6+o/2)/o;t===i?l=f-h:r===i?l=1/3+c-f:n===i&&(l=2/3+h-c),l<0&&(l+=1),l>1&&(l-=1)}var v=[l*360,u,s];return e[3]!=null&&v.push(e[3]),v}}function L_(e,t){var r=Bn(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 ci(r,r.length===4?"rgba":"rgb")}}function Nee(e){var t=Bn(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)}function lg(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){r=r||[];var n=e*(t.length-1),a=Math.floor(n),i=Math.ceil(n),o=t[a],s=t[i],l=n-a;return r[0]=zi(Pl(o[0],s[0],l)),r[1]=zi(Pl(o[1],s[1],l)),r[2]=zi(Pl(o[2],s[2],l)),r[3]=Hg(Pl(o[3],s[3],l)),r}}var kee=lg;function jk(e,t,r){if(!(!(t&&t.length)||!(e>=0&&e<=1))){var n=e*(t.length-1),a=Math.floor(n),i=Math.ceil(n),o=Bn(t[a]),s=Bn(t[i]),l=n-a,u=ci([zi(Pl(o[0],s[0],l)),zi(Pl(o[1],s[1],l)),zi(Pl(o[2],s[2],l)),Hg(Pl(o[3],s[3],l))],"rgba");return r?{color:u,leftIndex:a,rightIndex:i,value:n}:u}}var Lee=jk;function Ls(e,t,r,n){var a=Bn(e);if(e)return a=Aee(a),t!=null&&(a[0]=Mee(Le(t)?t(a[0]):t)),r!=null&&(a[1]=ks(Le(r)?r(a[1]):r)),n!=null&&(a[2]=ks(Le(n)?n(a[2]):n)),ci(vM(a),"rgba")}function Ug(e,t){var r=Bn(e);if(r&&t!=null)return r[3]=Hg(t),ci(r,"rgba")}function ci(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 Wg(e,t){var r=Bn(e);return r?(.299*r[0]+.587*r[1]+.114*r[2])*r[3]/255+(1-r[3])*t:0}function Iee(){return ci([Math.round(Math.random()*255),Math.round(Math.random()*255),Math.round(Math.random()*255)],"rgb")}var vE=new Pf(100);function I_(e){if(ve(e)){var t=vE.get(e);return t||(t=L_(e,-.1),vE.put(e,t)),t}else if(Om(e)){var r=te({},e);return r.colorStops=oe(e.colorStops,function(n){return{offset:n.offset,color:L_(n.color,-.1)}}),r}return e}const Pee=Object.freeze(Object.defineProperty({__proto__:null,fastLerp:lg,fastMapToColor:kee,lerp:jk,lift:L_,liftColor:I_,lum:Wg,mapToColor:Lee,modifyAlpha:Ug,modifyHSL:Ls,parse:Bn,parseCssFloat:ks,parseCssInt:Ax,random:Iee,stringify:ci,toHex:Nee},Symbol.toStringTag,{value:"Module"}));var P_=Math.round;function $g(e){var t;if(!e||e==="transparent")e="none";else if(typeof e=="string"&&e.indexOf("rgba")>-1){var r=Bn(e);r&&(e="rgb("+r[0]+","+r[1]+","+r[2]+")",t=r[3])}return{color:e,opacity:t??1}}var pE=1e-4;function Dl(e){return e-pE}function Zy(e){return P_(e*1e3)/1e3}function pM(e){return P_(e*1e4)/1e4}function Dee(e){return"matrix("+Zy(e[0])+","+Zy(e[1])+","+Zy(e[2])+","+Zy(e[3])+","+pM(e[4])+","+pM(e[5])+")"}var jee={left:"start",right:"end",center:"middle",middle:"middle"};function Eee(e,t,r){return r==="top"?e+=t/2:r==="bottom"&&(e-=t/2),e}function Ree(e){return e&&(e.shadowBlur||e.shadowOffsetX||e.shadowOffsetY)}function Oee(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 AG(e){return e&&!!e.image}function zee(e){return e&&!!e.svgElement}function Ek(e){return AG(e)||zee(e)}function NG(e){return e.type==="linear"}function kG(e){return e.type==="radial"}function LG(e){return e&&(e.type==="linear"||e.type==="radial")}function w1(e){return"url(#"+e+")"}function IG(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 PG(e){var t=e.x||0,r=e.y||0,n=(e.rotation||0)*ng,a=Te(e.scaleX,1),i=Te(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+")"),(a!==1||i!==1)&&l.push("scale("+a+","+i+")"),(o||s)&&l.push("skew("+P_(o*ng)+"deg, "+P_(s*ng)+"deg)"),l.join(" ")}var Bee=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}}(),gM=Array.prototype.slice;function ms(e,t,r){return(t-e)*r+e}function SS(e,t,r,n){for(var a=t.length,i=0;in?t:e,i=Math.min(r,n),o=a[i-1]||{color:[0,0,0,0],offset:0},s=i;so;if(s)n.length=o;else for(var l=i;l=1},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(t,r,n){this._needsSort=!0;var a=this.keyframes,i=a.length,o=!1,s=mE,l=r;if(_n(r)){var u=Hee(r);s=u,(u===1&&!Tt(r[0])||u===2&&!Tt(r[0][0]))&&(o=!0)}else if(Tt(r)&&!yn(r))s=Xy;else if(ve(r))if(!isNaN(+r))s=Xy;else{var c=Bn(r);c&&(l=c,s=Ep)}else if(Om(r)){var h=te({},l);h.colorStops=oe(r.colorStops,function(v){return{offset:v.offset,color:Bn(v.color)}}),NG(r)?s=mM:kG(r)&&(s=yM),l=h}i===0?this.valType=s:(s!==this.valType||s===mE)&&(o=!0),this.discrete=this.discrete||o;var f={time:t,value:l,rawValue:r,percent:0};return n&&(f.easing=n,f.easingFunc=Le(n)?n:sg[n]||Dk(n)),a.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 a=this.valType,i=n.length,o=n[i-1],s=this.discrete,l=qy(a),u=yE(a),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],v=o[c]}if(v&&g){this._lastFr=c,this._lastFrP=r;var y=g.percent-v.percent,x=y===0?1:f((r-v.percent)/y,1);g.easingFunc&&(x=g.easingFunc(x));var _=n?this._additiveValue:u?qv:t[l];if((qy(i)||u)&&!_&&(_=this._additiveValue=[]),this.discrete)t[l]=x<1?v.rawValue:g.rawValue;else if(qy(i))i===kx?SS(_,v[a],g[a],x):Fee(_,v[a],g[a],x);else if(yE(i)){var w=v[a],S=g[a],C=i===mM;t[l]={type:C?"linear":"radial",x:ms(w.x,S.x,x),y:ms(w.y,S.y,x),colorStops:oe(w.colorStops,function(A,k){var I=S.colorStops[k];return{offset:ms(A.offset,I.offset,x),color:Nx(SS([],A.color,I.color,x))}}),global:S.global},C?(t[l].x2=ms(w.x2,S.x2,x),t[l].y2=ms(w.y2,S.y2,x)):t[l].r=ms(w.r,S.r,x)}else if(u)SS(_,v[a],g[a],x),n||(t[l]=Nx(_));else{var M=ms(v[a],g[a],x);n?this._additiveValue=M:t[l]=M}n&&this._addToTarget(t)}}},e.prototype._addToTarget=function(t){var r=this.valType,n=this.propName,a=this._additiveValue;r===Xy?t[n]=t[n]+a:r===Ep?(Bn(t[n],qv),Yy(qv,qv,a,1),t[n]=Nx(qv)):r===kx?Yy(t[n],t[n],a,1):r===DG&&gE(t[n],t[n],a,1)},e}(),Rk=function(){function e(t,r,n,a){if(this._tracks={},this._trackKeys=[],this._maxTime=0,this._started=0,this._clip=null,this._target=t,this._loop=r,r&&a){m1("Can' use additive animation on looped animation.");return}this._additiveAnimators=a,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,mt(r),n)},e.prototype.whenWithKeys=function(t,r,n,a){for(var i=this._tracks,o=0;o0&&l.addKeyframe(0,ug(u),a),this._trackKeys.push(s)}l.addKeyframe(t,ug(r[s]),a)}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=[],a=this._maxTime||0,i=0;i1){var s=o.pop();i.addKeyframe(s.time,t[a]),i.prepare(this._maxTime,i.getAdditiveTrack())}}}},e}();function qd(){return new Date().getTime()}var Wee=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,a=r.next;n?n.next=a:this._head=a,a?a.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=qd()-this._pausedTime,a=n-this._time,i=this._head;i;){var o=i.next,s=i.step(n,a);s&&(i.ondestroy(),this.removeClip(i)),i=o}this._time=n,r||(this.trigger("frame",a),this.stage.update&&this.stage.update())},t.prototype._startLoop=function(){var r=this;this._running=!0;function n(){r._running&&(A_(n),!r._paused&&r.update())}A_(n)},t.prototype.start=function(){this._running||(this._time=qd(),this._pausedTime=0,this._startLoop())},t.prototype.stop=function(){this._running=!1},t.prototype.pause=function(){this._paused||(this._pauseStart=qd(),this._paused=!0)},t.prototype.resume=function(){this._paused&&(this._pausedTime+=qd()-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 a=new Rk(r,n.loop);return this.addAnimator(a),a},t}(wi),$ee=300,CS=xt.domSupported,TS=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=oe(e,function(a){var i=a.replace("mouse","pointer");return r.hasOwnProperty(i)?i:a});return{mouse:e,touch:t,pointer:n}}(),xE={mouse:["mousemove","mouseup"],pointer:["pointermove","pointerup"]},_E=!1;function xM(e){var t=e.pointerType;return t==="pen"||t==="touch"}function Zee(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 MS(e){e&&(e.zrByTouch=!0)}function Yee(e,t){return Ja(e.dom,new Xee(e,t),!0)}function jG(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 Xee=function(){function e(t,r){this.stopPropagation=hr,this.stopImmediatePropagation=hr,this.preventDefault=hr,this.type=r.type,this.target=this.currentTarget=t.dom,this.pointerType=r.pointerType,this.clientX=r.clientX,this.clientY=r.clientY}return e}(),Li={mousedown:function(e){e=Ja(this.dom,e),this.__mayPointerCapture=[e.zrX,e.zrY],this.trigger("mousedown",e)},mousemove:function(e){e=Ja(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=Ja(this.dom,e),this.__togglePointerCapture(!1),this.trigger("mouseup",e)},mouseout:function(e){e=Ja(this.dom,e);var t=e.toElement||e.relatedTarget;jG(this,t)||(this.__pointerCapturing&&(e.zrEventControl="no_globalout"),this.trigger("mouseout",e))},wheel:function(e){_E=!0,e=Ja(this.dom,e),this.trigger("mousewheel",e)},mousewheel:function(e){_E||(e=Ja(this.dom,e),this.trigger("mousewheel",e))},touchstart:function(e){e=Ja(this.dom,e),MS(e),this.__lastTouchMoment=new Date,this.handler.processGesture(e,"start"),Li.mousemove.call(this,e),Li.mousedown.call(this,e)},touchmove:function(e){e=Ja(this.dom,e),MS(e),this.handler.processGesture(e,"change"),Li.mousemove.call(this,e)},touchend:function(e){e=Ja(this.dom,e),MS(e),this.handler.processGesture(e,"end"),Li.mouseup.call(this,e),+new Date-+this.__lastTouchMoment<$ee&&Li.click.call(this,e)},pointerdown:function(e){Li.mousedown.call(this,e)},pointermove:function(e){xM(e)||Li.mousemove.call(this,e)},pointerup:function(e){Li.mouseup.call(this,e)},pointerout:function(e){xM(e)||Li.mouseout.call(this,e)}};R(["click","dblclick","contextmenu"],function(e){Li[e]=function(t){t=Ja(this.dom,t),this.trigger(e,t)}});var _M={pointermove:function(e){xM(e)||_M.mousemove.call(this,e)},pointerup:function(e){_M.mouseup.call(this,e)},mousemove:function(e){this.trigger("mousemove",e)},mouseup:function(e){var t=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",e),t&&(e.zrEventControl="only_globalout",this.trigger("mouseout",e))}};function qee(e,t){var r=t.domHandlers;xt.pointerEventsSupported?R(TS.pointer,function(n){Lx(t,n,function(a){r[n].call(e,a)})}):(xt.touchEventsSupported&&R(TS.touch,function(n){Lx(t,n,function(a){r[n].call(e,a),Zee(t)})}),R(TS.mouse,function(n){Lx(t,n,function(a){a=Pk(a),t.touching||r[n].call(e,a)})}))}function Kee(e,t){xt.pointerEventsSupported?R(xE.pointer,r):xt.touchEventsSupported||R(xE.mouse,r);function r(n){function a(i){i=Pk(i),jG(e,i.target)||(i=Yee(e,i),t.domHandlers[n].call(e,i))}Lx(t,n,a,{capture:!0})}}function Lx(e,t,r,n){e.mounted[t]=r,e.listenerOpts[t]=n,uM(e.domTarget,t,r,n)}function AS(e){var t=e.mounted;for(var r in t)t.hasOwnProperty(r)&&nee(e.domTarget,r,t[r],e.listenerOpts[r]);e.mounted={}}var bE=function(){function e(t,r){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=t,this.domHandlers=r}return e}(),Jee=function(e){q(t,e);function t(r,n){var a=e.call(this)||this;return a.__pointerCapturing=!1,a.dom=r,a.painterRoot=n,a._localHandlerScope=new bE(r,Li),CS&&(a._globalHandlerScope=new bE(document,_M)),qee(a,a._localHandlerScope),a}return t.prototype.dispose=function(){AS(this._localHandlerScope),CS&&AS(this._globalHandlerScope)},t.prototype.setCursor=function(r){this.dom.style&&(this.dom.style.cursor=r||"default")},t.prototype.__togglePointerCapture=function(r){if(this.__mayPointerCapture=null,CS&&+this.__pointerCapturing^+r){this.__pointerCapturing=r;var n=this._globalHandlerScope;r?Kee(this,n):AS(n)}},t}(wi),EG=1;xt.hasGlobalWindow&&(EG=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var D_=EG,bM=.4,wM="#333",SM="#ccc",Qee="#eee",wE=Ih,SE=5e-5;function Gu(e){return e>SE||e<-SE}var Hu=[],ud=[],NS=ar(),kS=Math.abs,Xo=function(){function e(){}return e.prototype.getLocalTransform=function(t){return ou(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 Gu(this.rotation)||Gu(this.x)||Gu(this.y)||Gu(this.scaleX-1)||Gu(this.scaleY-1)||Gu(this.skewX)||Gu(this.skewY)},e.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,r=this.needLocalTransform(),n=this.transform;if(!(r||t)){n&&(wE(n),this.invTransform=null);return}n=n||ar(),r?this.getLocalTransform(n):wE(n),t&&(r?Ea(n,t,n):au(n,t)),this.transform=n,this._resolveGlobalScaleRatio(n),this.invTransform=this.invTransform||ar(),Oa(this.invTransform,n)},e.prototype._resolveGlobalScaleRatio=function(t){var r=this.globalScaleRatio;if(r!=null&&r!==1){this.getGlobalScale(Hu);var n=Hu[0]<0?-1:1,a=Hu[1]<0?-1:1,i=((Hu[0]-n)*r+n)/Hu[0]||0,o=((Hu[1]-a)*r+a)/Hu[1]||0;t[0]*=i,t[1]*=i,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],a=Math.atan2(t[1],t[0]),i=Math.PI/2+a-Math.atan2(t[3],t[2]);n=Math.sqrt(n)*Math.cos(i),r=Math.sqrt(r),this.skewX=i,this.skewY=0,this.rotation=-a,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||ar(),Ea(ud,t.invTransform,r),r=ud);var n=this.originX,a=this.originY;(n||a)&&(NS[4]=n,NS[5]=a,Ea(ud,r,NS),ud[4]-=n,ud[5]-=a,r=ud),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],a=this.invTransform;return a&&dr(n,n,a),n},e.prototype.transformCoordToGlobal=function(t,r){var n=[t,r],a=this.transform;return a&&dr(n,n,a),n},e.prototype.getLineScale=function(){var t=this.transform;return t&&kS(t[0]-1)>1e-10&&kS(t[3]-1)>1e-10?Math.sqrt(kS(t[0]*t[3]-t[2]*t[1])):1},e.prototype.copyTransform=function(t){zo(this,t)},e.getLocalTransform=function(t,r){r=r||[];var n=t.originX||0,a=t.originY||0,i=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,v=t.skewY?Math.tan(-t.skewY):0;if(n||a||s||l){var g=n+s,m=a+l;r[4]=-g*i-f*m*o,r[5]=-m*o-v*g*i}else r[4]=r[5]=0;return r[0]=i,r[3]=o,r[1]=v*i,r[2]=f*o,u&&Js(r,r,u),r[4]+=n+c,r[5]+=a+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}(),ou=Xo.getLocalTransform;function df(){return new Xo}var Gs=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function zo(e,t){return nG(e,t,Gs)}function ko(e){Ky||(Ky=new Pf(100)),e=e||Fs;var t=Ky.get(e);return t||(t={font:e,strWidthCache:new Pf(500),asciiWidthMap:null,asciiWidthMapTried:!1,stWideCharWidth:qr.measureText("国",e).width,asciiCharWidth:qr.measureText("a",e).width},Ky.put(e,t)),t}var Ky;function ete(e){if(!(LS>=CE)){e=e||Fs;for(var t=[],r=+new Date,n=0;n<=127;n++)t[n]=qr.measureText(String.fromCharCode(n),e).width;var a=+new Date-r;return a>16?LS=CE:a>2&&LS++,t}}var LS=0,CE=5;function RG(e,t){return e.asciiWidthMapTried||(e.asciiWidthMap=ete(e.font),e.asciiWidthMapTried=!0),0<=t&&t<=127?e.asciiWidthMap!=null?e.asciiWidthMap[t]:e.asciiCharWidth:e.stWideCharWidth}function Lo(e,t){var r=e.strWidthCache,n=r.get(t);return n==null&&(n=qr.measureText(t,e.font).width,r.put(t,n)),n}function TE(e,t,r,n){var a=Lo(ko(t),e),i=Fm(t),o=Df(0,a,r),s=zc(0,i,n),l=new je(o,s,a,i);return l}function S1(e,t,r,n){var a=((e||"")+"").split(` +`),i=a.length;if(i===1)return TE(a[0],t,r,n);for(var o=new je(0,0,0,0),s=0;s=0?parseFloat(e)/100*t:parseFloat(e):e}function j_(e,t,r){var n=t.position||"inside",a=t.distance!=null?t.distance:5,i=r.height,o=r.width,s=i/2,l=r.x,u=r.y,c="left",h="top";if(n instanceof Array)l+=Bo(n[0],r.width),u+=Bo(n[1],r.height),c=null,h=null;else switch(n){case"left":l-=a,u+=s,c="right",h="middle";break;case"right":l+=a+o,u+=s,h="middle";break;case"top":l+=o/2,u-=a,c="center",h="bottom";break;case"bottom":l+=o/2,u+=i+a,c="center";break;case"inside":l+=o/2,u+=s,c="center",h="middle";break;case"insideLeft":l+=a,u+=s,h="middle";break;case"insideRight":l+=o-a,u+=s,c="right",h="middle";break;case"insideTop":l+=o/2,u+=a,c="center";break;case"insideBottom":l+=o/2,u+=i-a,c="center",h="bottom";break;case"insideTopLeft":l+=a,u+=a;break;case"insideTopRight":l+=o-a,u+=a,c="right";break;case"insideBottomLeft":l+=a,u+=i-a,h="bottom";break;case"insideBottomRight":l+=o-a,u+=i-a,c="right",h="bottom";break}return e=e||{},e.x=l,e.y=u,e.align=c,e.verticalAlign=h,e}var IS="__zr_normal__",PS=Gs.concat(["ignore"]),tte=gi(Gs,function(e,t){return e[t]=!0,e},{ignore:!1}),cd={},rte=new je(0,0,0,0),Jy=[],Ix=0,C1=1,T1=function(){function e(t){this.id=Nk(),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 a=this.transform;a||(a=this.transform=[1,0,0,1,0,0]),a[4]+=t,a[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,a=n.local,i=r.innerTransformable,o=void 0,s=void 0,l=!1;i.parent=a?this:null;var u=!1;i.copyTransform(r);var c=n.position!=null,h=n.autoOverflowArea,f=void 0;if((h||c)&&(f=rte,n.layoutRect?f.copy(n.layoutRect):f.copy(this.getBoundingRect()),a||f.applyTransform(this.transform)),c){this.calculateTextPosition?this.calculateTextPosition(cd,n,f):j_(cd,n,f),i.x=cd.x,i.y=cd.y,o=cd.align,s=cd.verticalAlign;var v=n.origin;if(v&&n.rotation!=null){var g=void 0,m=void 0;v==="center"?(g=f.width*.5,m=f.height*.5):(g=Bo(v[0],f.width),m=Bo(v[1],f.height)),u=!0,i.originX=-i.x+g+(a?0:f.x),i.originY=-i.y+m+(a?0:f.y)}}n.rotation!=null&&(i.rotation=n.rotation);var y=n.offset;y&&(i.x+=y[0],i.y+=y[1],u||(i.originX=-y[0],i.originY=-y[1]));var x=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={});if(h){var _=x.overflowRect=x.overflowRect||new je(0,0,0,0);i.getLocalTransform(Jy),Oa(Jy,Jy),je.copy(_,f),_.applyTransform(Jy)}else x.overflowRect=null;var w=n.inside==null?typeof n.position=="string"&&n.position.indexOf("inside")>=0:n.inside,S=void 0,C=void 0,M=void 0;w&&this.canBeInsideText()?(S=n.insideFill,C=n.insideStroke,(S==null||S==="auto")&&(S=this.getInsideTextFill()),(C==null||C==="auto")&&(C=this.getInsideTextStroke(S),M=!0)):(S=n.outsideFill,C=n.outsideStroke,(S==null||S==="auto")&&(S=this.getOutsideFill()),(C==null||C==="auto")&&(C=this.getOutsideStroke(S),M=!0)),S=S||"#000",(S!==x.fill||C!==x.stroke||M!==x.autoStroke||o!==x.align||s!==x.verticalAlign)&&(l=!0,x.fill=S,x.stroke=C,x.autoStroke=M,x.align=o,x.verticalAlign=s,r.setDefaultTextStyle(x)),r.__dirty|=da,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()?SM:wM},e.prototype.getOutsideStroke=function(t){var r=this.__zr&&this.__zr.getBackgroundColor(),n=typeof r=="string"&&Bn(r);n||(n=[255,255,255,1]);for(var a=n[3],i=this.__zr.isDarkMode(),o=0;o<3;o++)n[o]=n[o]*a+(i?0:255)*(1-a);return n[3]=1,ci(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||{},te(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(Re(t))for(var n=t,a=mt(n),i=0;i0},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(IS,!1,t)},e.prototype.useState=function(t,r,n,a){var i=t===IS,o=this.hasState();if(!(!o&&i)){var s=this.currentStates,l=this.stateTransition;if(!(Ye(s,t)>=0&&(r||s.length===1))){var u;if(this.stateProxy&&!i&&(u=this.stateProxy(t)),u||(u=this.states&&this.states[t]),!u&&!i){m1("State "+t+" not exists.");return}i||this.saveCurrentToNormalState(u);var c=this._textContent,h=ME(this,c,u,a);h&&!this.__inHover&&(this.__inHover=h),this._applyStateObj(t,u,this._normalState,r,NE(this,n,l),l);var f=this._textGuide;return c&&c.useState(t,r,n,!!h),f&&f.useState(t,r,n,!!h),i?(this.currentStates=[],this._normalState={}):r?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!h&&this.__inHover&&(this.__inHover=Ix,this.__dirty&=~da),u}}},e.prototype.useStates=function(t,r,n){if(!t.length)this.clearStates();else{var a=[],i=this.currentStates,o=t.length,s=o===i.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 a=this.currentStates.slice(),i=Ye(a,t),o=Ye(a,r)>=0;i>=0?o?a.splice(i,1):a[i]=r:n&&!o&&a.push(r),this.useStates(a)},e.prototype.toggleState=function(t,r){r?this.useState(t,!0):this.removeState(t)},e.prototype._mergeStates=function(t){for(var r={},n,a=0;a=0&&i.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,a=n.length,i=[],o=0;o0&&r.during&&i[0].during(function(g,m){r.during(m)});for(var f=0;f0||a.force&&!o.length){var k=void 0,I=void 0,P=void 0;if(s){I={},f&&(k={});for(var S=0;S0}var De=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,a=0;a=0&&(a.splice(i,0,r),this._doAdd(r))}return this},t.prototype.replace=function(r,n){var a=Ye(this._children,r);return a>=0&&this.replaceAt(n,a),this},t.prototype.replaceAt=function(r,n){var a=this._children,i=a[n];if(r&&r!==this&&r.parent!==this&&r!==i){a[n]=r,i.parent=null;var o=this.__zr;o&&i.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,a=this._children,i=Ye(a,r);return i<0?this:(a.splice(i,1),r.parent=null,n&&r.removeSelfFromZr(n),n&&n.refresh(),this)},t.prototype.removeAll=function(){for(var r=this._children,n=this.__zr,a=0;a0&&(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<=a)return o;if(e>=i)return s}else{if(e>=a)return o;if(e<=i)return s}else{if(e===a)return o;if(e===i)return s}return(e-a)/l*u+o}var me=mte;function mte(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 O_(e,t,r)}function O_(e,t,r){return ve(e)?FG(e)?parseFloat(e)/100*t+(r||0):parseFloat(e):e==null?NaN:+e}function yte(e){return ve(e)&&FG(e)}function FG(e){return!!pte(e).match(/%$/)}function Mt(e,t,r){return isNaN(t)?r?""+e:+e:(t=Et(at(0,t),E_),e=(+e).toFixed(t),r?e:+e)}function xte(e,t,r){return t==null&&(t=10),Mt(e,t,r)}function on(e){return e.sort(function(t,r){return t-r}),e}function _o(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,r=0;r<15;r++,t*=10)if(Fo(e*t)/t===e)return r}return VG(e)}function VG(e){var t=e.toString().toLowerCase(),r=t.indexOf("e"),n=r>0?+t.slice(r+1):0,a=r>0?r:t.length,i=t.indexOf("."),o=i<0?0:a-1-i;return at(0,o-n)}function _te(e,t){var r=gi(eh(e[1]-e[0])/Zg),n=Fo(eh(cr(t[1]-t[0]))/Zg),a=Et(at(-r+n,0),E_);return isFinite(a)?a:E_}function Rk(e,t,r){var n=cr(e[1]-e[0]);if(!isFinite(n)||n===0)return NaN;var a=eh(2*cr(r||1)*cr(n))/Zg,i=eh(cr(t))/Zg,o=at(0,Ph(-a+i));return isFinite(o)||(o=NaN),o}function bte(e,t,r){if(!e[t])return 0;var n=GG(e,r);return n[t]||0}function GG(e,t){var r=pi(e,function(v,g){return v+(isNaN(g)?0:g)},0);if(r===0)return[];for(var n=Dh(10,t),a=oe(e,function(v){return(isNaN(v)?0:v)/r*n*100}),i=n*100,o=oe(a,function(v){return gi(v)}),s=pi(o,function(v,g){return v+g},0),l=oe(a,function(v,g){return v-o[g]});su&&(u=l[h],c=h);++o[c],l[c]=0,++s}return oe(o,function(v){return v/n})}function pc(e,t){var r=at(_o(e),_o(t)),n=e+t;return r>E_?n:Mt(n,r)}var Yg=Dh(2,53)-1;function Ok(e){var t=R_*2;return(e%t+t)%t}function th(e){return e>-NE&&e=10&&t++,t}var HG=2;function A1(e,t){var r=M1(e),n=Dh(10,r),a=e/n,i;return t===HG?i=1:t?a<1.5?i=1:a<2.5?i=2:a<4?i=3:a<7?i=5:i=10:a<1?i=1:a<2?i=2:a<3?i=3:a<5?i=5:i=10,e=i*n,Mt(e,-r)}function Dx(e,t){var r=(e.length-1)*t+1,n=gi(r),a=+e[n-1],i=r-n;return i?a+i*(e[n]-a):a}function MM(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 ES(e){e.option=e.parentModel=e.ecModel=null}function gn(){return[1/0,-1/0]}function NM(e,t){Hs(t)&&(te[1]&&(e[1]=t))}function JG(e,t){Hs(t)&&te[1]&&(e[1]=t)}function Vte(e,t){ah(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function Hs(e){return e!=null&&isFinite(e)}function ah(e,t){return Hs(e)&&Hs(t)&&e<=t}function Gte(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function jx(e){ah(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function lv(){var e="__ec_once_"+Hte++;return function(t,r){Se(t,e)||(t[e]=1,r())}}var Hte=Fk();function N1(e,t,r){var n=we(),a=0;R(e,function(i){var o=t(i),s=n.get(o)||0;r&&r(i,s),!s&&!r&&(e[a++]=i),n.set(o,s+1)}),r||(e.length=a)}function Ute(e){return e.value+""}function Wte(e){return e+""}function Io(e,t){return Te(t,!0)?e.seriesIndex+2:0}function e7(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 Hr(e,t){return{seriesType:e,overallReset:t}}function Vm(e){return{overallReset:e}}var $te=".",Uu="___EC__COMPONENT__CONTAINER___",t7="___EC__EXTENDED_CLASS___";function bo(e){var t={main:"",sub:""};if(e){var r=e.split($te);t.main=r[0]||"",t.sub=r[1]||""}return t}function Zte(e){bn(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),'componentType "'+e+'" illegal')}function Yte(e){return!!(e&&e[t7])}function Uk(e,t){e.$constructor=e,e.extend=function(r){var n=this,a;return Xte(n)?a=function(i){X(o,i);function o(){return i.apply(this,arguments)||this}return o}(n):(a=function(){(r.$constructor||n).apply(this,arguments)},Nk(a,this)),te(a.prototype,r),a[t7]=!0,a.extend=this.extend,a.superCall=Jte,a.superApply=Qte,a.superClass=n,a}}function Xte(e){return Le(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function r7(e,t){e.extend=t.extend}var qte=Math.round(Math.random()*10);function Kte(e){var t=["__\0is_clz",qte++].join("_");e.prototype[t]=!0,e.isInstance=function(r){return!!(r&&r[t])}}function Jte(e,t){for(var r=[],n=2;n=0||i&&Ye(i,l)<0)){var u=n.getShallow(l,t);u!=null&&(o[e[s][0]]=u)}}return o}}var ere=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],tre=ih(ere),rre=function(){function e(){}return e.prototype.getAreaStyle=function(t,r){return tre(this,t,r)},e}(),kM=new Pf(50);function nre(e){if(typeof e=="string"){var t=kM.get(e);return t&&t.image}else return e}function Wk(e,t,r,n,a){if(e)if(typeof e=="string"){if(t&&t.__zrImageSrc===e||!r)return t;var i=kM.get(e),o={hostEl:r,cb:n,cbPayload:a};return i?(t=i.image,!L1(t)&&i.pending.push(o)):(t=qr.loadImage(e,PE,PE),t.__zrImageSrc=e,kM.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}else return e;else return t}function PE(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t=s;u++)l-=s;var c=Lo(o,r);return c>l&&(r="",c=0),l=e-c,a.ellipsis=r,a.ellipsisWidth=c,a.contentWidth=l,a.containerWidth=e,a}function i7(e,t,r){var n=r.containerWidth,a=r.contentWidth,i=r.fontMeasureInfo;if(!n){e.textLine="",e.isTruncated=!1;return}var o=Lo(i,t);if(o<=n){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=a||s>=r.maxIterations){t+=r.ellipsis;break}var l=s===0?ire(t,a,i):o>0?Math.floor(t.length*a/o):0;t=t.substr(0,l),o=Lo(i,t)}t===""&&(t=r.placeholder),e.textLine=t,e.isTruncated=!0}function ire(e,t,r){for(var n=0,a=0,i=e.length;ay&&v){var w=Math.floor(y/f);g=g||x.length>w,x=x.slice(0,w),_=x.length*f}if(a&&c&&m!=null)for(var S=a7(m,u,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),C={},M=0;Mg&&OS(i,o.substring(g,y),t,v),OS(i,m[2],t,v,m[1]),g=RS.lastIndex}gh){var W=i.lines.length;z>0?(k.tokens=k.tokens.slice(0,z),A(k,D,P),i.lines=i.lines.slice(0,I+1)):i.lines=i.lines.slice(0,I),i.isTruncated=i.isTruncated||i.lines.length0&&g+n.accumWidth>n.width&&(c=t.split(` -`),u=!0),n.accumWidth=g}else{var m=o7(t,l,n.width,n.breakAll,n.accumWidth);n.accumWidth=m.accumWidth+v,h=m.linesWidths,c=m.lines}}c||(c=t.split(` -`));for(var y=ko(l),x=0;x=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}var hre=pi(",&?/;] ".split(""),function(e,t){return e[t]=!0,e},{});function dre(e){return cre(e)?!!hre[e]:!0}function o7(e,t,r,n,a){for(var i=[],o=[],s="",l="",u=0,c=0,h=ko(t),f=0;fr:a+c+g>r){c?(s||l)&&(m?(s||(s=l,l="",u=0,c=u),i.push(s),o.push(c-u),l+=v,u+=g,s="",c=u):(l&&(s+=l,l="",u=0),i.push(s),o.push(c),s=v,c=g)):m?(i.push(l),o.push(u),l=v,u=g):(i.push(v),o.push(g));continue}c+=g,m?(l+=v,u+=g):(l&&(s+=l,l="",u=0),s+=v)}return l&&(s+=l),s&&(i.push(s),o.push(c)),i.length===1&&(c+=a),{accumWidth:c,lines:i,linesWidths:o}}function jE(e,t,r,n,a,i){if(e.baseX=r,e.baseY=n,e.outerWidth=e.outerHeight=null,!!t){var o=t.width*2,s=t.height*2;je.set(EE,Df(r,o,a),zc(n,s,i),o,s),je.intersect(t,EE,null,RE);var l=RE.outIntersectRect;e.outerWidth=l.width,e.outerHeight=l.height,e.baseX=Df(l.x,l.width,a,!0),e.baseY=zc(l.y,l.height,i,!0)}}var EE=new je(0,0,0,0),RE={outIntersectRect:{},clamp:!0};function $k(e){return e!=null?e+="":e=""}function fre(e){var t=$k(e.text),r=e.font,n=Lo(ko(r),t),a=Fm(r);return LM(e,n,a,null)}function LM(e,t,r,n){var a=new je(Df(e.x||0,t,e.textAlign),zc(e.y||0,r,e.textBaseline),t,r),i=n??(s7(e)?e.lineWidth:0);return i>0&&(a.x-=i/2,a.y-=i/2,a.width+=i,a.height+=i),a}function s7(e){var t=e.stroke;return t!=null&&t!=="none"&&e.lineWidth>0}var IM="__zr_style_"+Math.round(Math.random()*10),Bc={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},I1={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Bc[IM]=!0;var OE=["z","z2","invisible"],vre=["invisible"],yi=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype._init=function(r){for(var n=gt(r),a=0;a1e-4){s[0]=e-r,s[1]=t-n,l[0]=e+r,l[1]=t+n;return}if(Qy[0]=VS(a)*r+e,Qy[1]=FS(a)*n+t,e0[0]=VS(i)*r+e,e0[1]=FS(i)*n+t,u(s,Qy,e0),c(l,Qy,e0),a=a%Wu,a<0&&(a=a+Wu),i=i%Wu,i<0&&(i=i+Wu),a>i&&!o?i+=Wu:aa&&(t0[0]=VS(v)*r+e,t0[1]=FS(v)*n+t,u(s,t0,s),c(l,t0,l))}var Xt={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},$u=[],Zu=[],io=[],cl=[],oo=[],so=[],GS=Math.min,HS=Math.max,Yu=Math.cos,Xu=Math.sin,hs=Math.abs,PM=Math.PI,xl=PM*2,US=typeof Float32Array<"u",Kv=[];function WS(e){var t=Math.round(e/PM*1e8)/1e8;return t%2*PM}function D1(e,t){var r=WS(e[0]);r<0&&(r+=xl);var n=r-e[0],a=e[1];a+=n,!t&&a-r>=xl?a=r+xl:t&&r-a>=xl?a=r-xl:!t&&r>a?a=r+(xl-WS(r-a)):t&&r0&&(this._ux=hs(n/D_/t)||0,this._uy=hs(n/D_/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(Xt.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=hs(t-this._xi),a=hs(r-this._yi),i=n>this._ux||a>this._uy;if(this.addData(Xt.L,t,r),this._ctx&&i&&this._ctx.lineTo(t,r),i)this._xi=t,this._yi=r,this._pendingPtDist=0;else{var o=n*n+a*a;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=r,this._pendingPtDist=o)}return this},e.prototype.bezierCurveTo=function(t,r,n,a,i,o){return this._drawPendingPt(),this.addData(Xt.C,t,r,n,a,i,o),this._ctx&&this._ctx.bezierCurveTo(t,r,n,a,i,o),this._xi=i,this._yi=o,this},e.prototype.quadraticCurveTo=function(t,r,n,a){return this._drawPendingPt(),this.addData(Xt.Q,t,r,n,a),this._ctx&&this._ctx.quadraticCurveTo(t,r,n,a),this._xi=n,this._yi=a,this},e.prototype.arc=function(t,r,n,a,i,o){this._drawPendingPt(),Kv[0]=a,Kv[1]=i,D1(Kv,o),a=Kv[0],i=Kv[1];var s=i-a;return this.addData(Xt.A,t,r,n,n,a,s,0,o?0:1),this._ctx&&this._ctx.arc(t,r,n,a,i,o),this._xi=Yu(i)*n+t,this._yi=Xu(i)*n+r,this},e.prototype.arcTo=function(t,r,n,a,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(t,r,n,a,i),this},e.prototype.rect=function(t,r,n,a){return this._drawPendingPt(),this._ctx&&this._ctx.rect(t,r,n,a),this.addData(Xt.R,t,r,n,a),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(Xt.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)&&US&&(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(){io[0]=io[1]=oo[0]=oo[1]=Number.MAX_VALUE,cl[0]=cl[1]=so[0]=so[1]=-Number.MAX_VALUE;var t=this.data,r=0,n=0,a=0,i=0,o;for(o=0;on||hs(w)>a||f===r-1)&&(m=Math.sqrt(_*_+w*w),i=y,o=x);break}case Xt.C:{var S=t[f++],C=t[f++],y=t[f++],x=t[f++],M=t[f++],A=t[f++];m=xee(i,o,S,C,y,x,M,A,10),i=M,o=A;break}case Xt.Q:{var S=t[f++],C=t[f++],y=t[f++],x=t[f++];m=bee(i,o,S,C,y,x,10),i=y,o=x;break}case Xt.A:var I=t[f++],k=t[f++],P=t[f++],D=t[f++],z=t[f++],j=t[f++],B=j+z;f+=1,g&&(s=Yu(z)*P+I,l=Xu(z)*D+k),m=HS(P,D)*GS(xl,Math.abs(j)),i=Yu(B)*P+I,o=Xu(B)*D+k;break;case Xt.R:{s=i=t[f++],l=o=t[f++];var H=t[f++],V=t[f++];m=H*2+V*2;break}case Xt.Z:{var _=s-i,w=l-o;m=Math.sqrt(_*_+w*w),i=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,a=this._ux,i=this._uy,o=this._len,s,l,u,c,h,f,v=r<1,g,m,y=0,x=0,_,w=0,S,C;if(!(v&&(this._pathSegLen||this._calculateLength(),g=this._pathSegLen,m=this._pathLen,_=r*m,!_)))e:for(var M=0;M0&&(t.lineTo(S,C),w=0),A){case Xt.M:s=u=n[M++],l=c=n[M++],t.moveTo(u,c);break;case Xt.L:{h=n[M++],f=n[M++];var k=hs(h-u),P=hs(f-c);if(k>a||P>i){if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;t.lineTo(u*(1-z)+h*z,c*(1-z)+f*z);break e}y+=D}t.lineTo(h,f),u=h,c=f,w=0}else{var j=k*k+P*P;j>w&&(S=h,C=f,w=j)}break}case Xt.C:{var B=n[M++],H=n[M++],V=n[M++],U=n[M++],F=n[M++],W=n[M++];if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;iu(u,B,V,F,z,$u),iu(c,H,U,W,z,Zu),t.bezierCurveTo($u[1],Zu[1],$u[2],Zu[2],$u[3],Zu[3]);break e}y+=D}t.bezierCurveTo(B,H,V,U,F,W),u=F,c=W;break}case Xt.Q:{var B=n[M++],H=n[M++],V=n[M++],U=n[M++];if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;Gg(u,B,V,z,$u),Gg(c,H,U,z,Zu),t.quadraticCurveTo($u[1],Zu[1],$u[2],Zu[2]);break e}y+=D}t.quadraticCurveTo(B,H,V,U),u=V,c=U;break}case Xt.A:var $=n[M++],Z=n[M++],J=n[M++],re=n[M++],Q=n[M++],le=n[M++],de=n[M++],He=!n[M++],ye=J>re?J:re,ne=hs(J-re)>.001,xe=Q+le,he=!1;if(v){var D=g[x++];y+D>_&&(xe=Q+le*(_-y)/D,he=!0),y+=D}if(ne&&t.ellipse?t.ellipse($,Z,J,re,de,Q,xe,He):t.arc($,Z,ye,Q,xe,He),he)break e;I&&(s=Yu(Q)*J+$,l=Xu(Q)*re+Z),u=Yu(xe)*J+$,c=Xu(xe)*re+Z;break;case Xt.R:s=u=n[M],l=c=n[M+1],h=n[M++],f=n[M++];var ge=n[M++],tt=n[M++];if(v){var D=g[x++];if(y+D>_){var Ue=_-y;t.moveTo(h,f),t.lineTo(h+GS(Ue,ge),f),Ue-=ge,Ue>0&&t.lineTo(h+ge,f+GS(Ue,tt)),Ue-=tt,Ue>0&&t.lineTo(h+HS(ge-Ue,0),f+tt),Ue-=ge,Ue>0&&t.lineTo(h,f+HS(tt-Ue,0));break e}y+=D}t.rect(h,f,ge,tt);break;case Xt.Z:if(v){var D=g[x++];if(y+D>_){var z=(_-y)/D;t.lineTo(u*(1-z)+s*z,c*(1-z)+l*z);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=Xt,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function Sl(e,t,r,n,a,i,o){if(a===0)return!1;var s=a,l=0,u=e;if(o>t+s&&o>n+s||oe+s&&i>r+s||it+h&&c>n+h&&c>i+h&&c>s+h||ce+h&&u>r+h&&u>a+h&&u>o+h||ut+u&&l>n+u&&l>i+u||le+u&&s>r+u&&s>a+u||sr||c+ua&&(a+=Jv);var f=Math.atan2(l,s);return f<0&&(f+=Jv),f>=n&&f<=a||f+Jv>=n&&f+Jv<=a}function ys(e,t,r,n,a,i){if(i>t&&i>n||ia?s:0}var hl=Go.CMD,qu=Math.PI*2,bre=1e-4;function wre(e,t){return Math.abs(e-t)t&&u>n&&u>i&&u>s||u1&&Sre(),v=$r(t,n,i,s,Qa[0]),f>1&&(g=$r(t,n,i,s,Qa[1]))),f===2?yt&&s>n&&s>i||s=0&&u<=1){for(var c=0,h=an(t,n,i,u),f=0;fr||s<-r)return 0;var l=Math.sqrt(r*r-s*s);Zn[0]=-l,Zn[1]=l;var u=Math.abs(n-a);if(u<1e-4)return 0;if(u>=qu-1e-4){n=0,a=qu;var c=i?1:-1;return o>=Zn[0]+e&&o<=Zn[1]+e?c:0}if(n>a){var h=n;n=a,a=h}n<0&&(n+=qu,a+=qu);for(var f=0,v=0;v<2;v++){var g=Zn[v];if(g+e>o){var m=Math.atan2(s,g),c=i?1:-1;m<0&&(m=qu+m),(m>=n&&m<=a||m+qu>=n&&m+qu<=a)&&(m>Math.PI/2&&m1&&(r||(s+=ys(l,u,c,h,n,a))),y&&(l=i[g],u=i[g+1],c=l,h=u),m){case hl.M:c=i[g++],h=i[g++],l=c,u=h;break;case hl.L:if(r){if(Sl(l,u,i[g],i[g+1],t,n,a))return!0}else s+=ys(l,u,i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case hl.C:if(r){if(xre(l,u,i[g++],i[g++],i[g++],i[g++],i[g],i[g+1],t,n,a))return!0}else s+=Cre(l,u,i[g++],i[g++],i[g++],i[g++],i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case hl.Q:if(r){if(l7(l,u,i[g++],i[g++],i[g],i[g+1],t,n,a))return!0}else s+=Tre(l,u,i[g++],i[g++],i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case hl.A:var x=i[g++],_=i[g++],w=i[g++],S=i[g++],C=i[g++],M=i[g++];g+=1;var A=!!(1-i[g++]);f=Math.cos(C)*w+x,v=Math.sin(C)*S+_,y?(c=f,h=v):s+=ys(l,u,f,v,n,a);var I=(n-x)*S/w+x;if(r){if(_re(x,_,S,C,C+M,A,t,I,a))return!0}else s+=Mre(x,_,S,C,C+M,A,I,a);l=Math.cos(C+M)*w+x,u=Math.sin(C+M)*S+_;break;case hl.R:c=l=i[g++],h=u=i[g++];var k=i[g++],P=i[g++];if(f=c+k,v=h+P,r){if(Sl(c,h,f,h,t,n,a)||Sl(f,h,f,v,t,n,a)||Sl(f,v,c,v,t,n,a)||Sl(c,v,c,h,t,n,a))return!0}else s+=ys(f,h,f,v,n,a),s+=ys(c,v,c,h,n,a);break;case hl.Z:if(r){if(Sl(l,u,c,h,t,n,a))return!0}else s+=ys(l,u,c,h,n,a);l=c,u=h;break}}return!r&&!wre(u,h)&&(s+=ys(l,u,c,h,n,a)||0),s!==0}function Are(e,t,r){return u7(e,0,!1,t,r)}function Nre(e,t,r,n){return u7(e,t,!0,r,n)}var z_=Ee({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Bc),kre={style:Ee({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},I1.style)},$S=Gs.concat(["invisible","culling","z","z2","zlevel","parent"]),pt=function(e){X(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 a=this._decalEl=this._decalEl||new t;a.buildPath===t.prototype.buildPath&&(a.buildPath=function(l){r.buildPath(l,r.shape)}),a.silent=!0;var i=a.style;for(var o in n)i[o]!==n[o]&&(i[o]=n[o]);i.fill=n.fill?n.decal:null,i.decal=null,i.shadowColor=null,n.strokeFirst&&(i.stroke=null);for(var s=0;s<$S.length;++s)a[$S[s]]=this[$S[s]];a.__dirty|=da}else this._decalEl&&(this._decalEl=null)},t.prototype.getDecalElement=function(){return this._decalEl},t.prototype._init=function(r){var n=gt(r);this.shape=this.getDefaultShape();var a=this.getDefaultStyle();a&&this.useStyle(a);for(var i=0;i.5?wM:n>.2?Jee:SM}else if(r)return SM}return wM},t.prototype.getInsideTextStroke=function(r){var n=this.style.fill;if(ve(n)){var a=this.__zr,i=!!(a&&a.isDarkMode()),o=Wg(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,a=!r;if(a){var i=!1;this.path||(i=!0,this.createPathProxy());var o=this.path;(i||this.__dirty&Dd)&&(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||a){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 a=this.transformCoordToLocal(r,n),i=this.getBoundingRect(),o=this.style;if(r=a[0],n=a[1],i.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)),Nre(s,l/u,r,n)))return!0}if(this.hasFill())return Are(s,r,n)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=Dd,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 a=this.shape;return a||(a=this.shape={}),typeof r=="string"?a[r]=n:te(a,r),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(this.__dirty&Dd)},t.prototype.createStyle=function(r){return Bm(z_,r)},t.prototype._innerSaveToNormal=function(r){e.prototype._innerSaveToNormal.call(this,r);var n=this._normalState;r.shape&&!n.shape&&(n.shape=te({},this.shape))},t.prototype._applyStateObj=function(r,n,a,i,o,s){if(e.prototype._applyStateObj.call(this,r,n,a,i,o,s),this.__inHover!==C1){var l=!(n&&i),u;if(n&&n.shape?o?i?u=n.shape:(u=te({},a.shape),te(u,n.shape)):(u=te({},i?this.shape:a.shape),te(u,n.shape)):l&&(u=a.shape),u)if(o){this.shape=te({},this.shape);for(var c={},h=gt(u),f=0;fa&&(h=s+l,s*=a/h,l*=a/h),u+c>a&&(h=u+c,u*=a/h,c*=a/h),l+u>i&&(h=l+u,l*=i/h,u*=i/h),s+c>i&&(h=s+c,s*=i/h,c*=i/h),e.moveTo(r+s,n),e.lineTo(r+a-l,n),l!==0&&e.arc(r+a-l,n+l,l,-Math.PI/2,0),e.lineTo(r+a,n+i-u),u!==0&&e.arc(r+a-u,n+i-u,u,0,Math.PI/2),e.lineTo(r+c,n+i),c!==0&&e.arc(r+c,n+i-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 Kd=Math.round;function j1(e,t,r){if(t){var n=t.x1,a=t.x2,i=t.y1,o=t.y2;e.x1=n,e.x2=a,e.y1=i,e.y2=o;var s=r&&r.lineWidth;return s&&(Kd(n*2)===Kd(a*2)&&(e.x1=e.x2=Ia(n,s,!0)),Kd(i*2)===Kd(o*2)&&(e.y1=e.y2=Ia(i,s,!0))),e}}function c7(e,t,r){if(t){var n=t.x,a=t.y,i=t.width,o=t.height;e.x=n,e.y=a,e.width=i,e.height=o;var s=r&&r.lineWidth;return s&&(e.x=Ia(n,s,!0),e.y=Ia(a,s,!0),e.width=Math.max(Ia(n+i,s,!1)-e.x,i===0?0:1),e.height=Math.max(Ia(a+o,s,!1)-e.y,o===0?0:1)),e}}function Ia(e,t,r){if(!t)return e;var n=Kd(e*2);return(n+Kd(t))%2===0?n/2:(n+(r?1:-1))/2}var Ere=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0}return e}(),Rre={},it=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new Ere},t.prototype.buildPath=function(r,n){var a,i,o,s;if(this.subPixelOptimize){var l=c7(Rre,n,this.style);a=l.x,i=l.y,o=l.width,s=l.height,l.r=n.r,n=l}else a=n.x,i=n.y,o=n.width,s=n.height;n.r?jre(r,n):r.rect(a,i,o,s)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(pt);it.prototype.type="rect";var GE={fill:"#000"},HE=2,lo={},Ore={style:Ee({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},I1.style)},wt=function(e){X(t,e);function t(r){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=GE,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,z=0;z=0&&(B=M[j],B.align==="right");)this._placeToken(B,r,I,x,z,"right",w),k-=B.width,z-=B.width,j--;for(D+=(c-(D-y)-(_-z)-k)/2;P<=j;)B=M[P],this._placeToken(B,r,I,x,D+B.width/2,"center",w),D+=B.width,P++;x+=I}},t.prototype._placeToken=function(r,n,a,i,o,s,l){var u=n.rich[r.styleName]||{};u.text=r.text;var c=r.verticalAlign,h=i+a/2;c==="top"?h=i+r.height/2:c==="bottom"&&(h=i+a-r.height/2);var f=!r.isLineHolder&&ZS(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 v=!!u.backgroundColor,g=r.textPadding;g&&(o=XE(o,s,g),h-=r.height/2-g[0]-r.innerHeight/2);var m=this._getOrCreateChild(jf),y=m.createStyle();m.useStyle(y);var x=this._defaultStyle,_=!1,w=0,S=!1,C=YE("fill"in u?u.fill:"fill"in n?n.fill:(_=!0,x.fill)),M=ZE("stroke"in u?u.stroke:"stroke"in n?n.stroke:!v&&!l&&(!x.autoStroke||_)?(w=HE,S=!0,x.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||Fs,y.opacity=ya(u.opacity,n.opacity,1),WE(y,u),M&&(y.lineWidth=ya(u.lineWidth,n.lineWidth,w),y.lineDash=Te(u.lineDash,n.lineDash),y.lineDashOffset=n.lineDashOffset||0,y.stroke=M),C&&(y.fill=C),m.setBoundingRect(LM(y,r.contentWidth,r.contentHeight,S?0:null))},t.prototype._renderBackground=function(r,n,a,i,o,s){var l=r.backgroundColor,u=r.borderWidth,c=r.borderColor,h=l&&l.image,f=l&&!h,v=r.borderRadius,g=this,m,y;if(f||r.lineHeight||u&&c){m=this._getOrCreateChild(it),m.useStyle(m.createStyle()),m.style.fill=null;var x=m.shape;x.x=a,x.y=i,x.width=o,x.height=s,x.r=v,m.dirtyShape()}if(f){var _=m.style;_.fill=l||null,_.fillOpacity=Te(r.fillOpacity,1)}else if(h){y=this._getOrCreateChild(Qr),y.onload=function(){g.dirtyStyle()};var w=y.style;w.image=l.image,w.x=a,w.y=i,w.width=o,w.height=s}if(u&&c){var _=m.style;_.lineWidth=u,_.stroke=c,_.strokeOpacity=Te(r.strokeOpacity,1),_.lineDash=r.borderDash,_.lineDashOffset=r.borderDashOffset||0,m.strokeContainThreshold=0,m.hasFill()&&m.hasStroke()&&(_.strokeFirst=!0,_.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=ya(r.opacity,n.opacity,1)},t.makeFont=function(r){var n="";return d7(r)&&(n=[r.fontStyle,r.fontWeight,h7(r.fontSize),r.fontFamily||"sans-serif"].join(" ")),n&&ka(n)||r.textFont||r.font},t}(yi),zre={left:!0,right:1,center:1},Bre={top:1,bottom:1,middle:1},UE=["fontStyle","fontWeight","fontSize","fontFamily"];function h7(e){return typeof e=="string"&&(e.indexOf("px")!==-1||e.indexOf("rem")!==-1||e.indexOf("em")!==-1)?e:isNaN(+e)?Ck+"px":e+"px"}function WE(e,t){for(var r=0;r=0,i=!1;if(e instanceof pt){var o=y7(e),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(hd(s)||hd(l)){n=n||{};var u=n.style||{};u.fill==="inherit"?(i=!0,n=te({},n),u=te({},u),u.fill=s):!hd(u.fill)&&hd(s)?(i=!0,n=te({},n),u=te({},u),u.fill=I_(s)):!hd(u.stroke)&&hd(l)&&(i||(n=te({},n),u=te({},u)),u.stroke=I_(l)),n.style=u}}if(n&&n.z2==null){i||(n=te({},n));var c=e.z2EmphasisLift;n.z2=e.z2+(c??cv)}return n}function Zre(e,t,r){if(r&&r.z2==null){r=te({},r);var n=e.z2SelectLift;r.z2=e.z2+(n??Gre)}return r}function Yre(e,t,r){var n=Ye(e.currentStates,t)>=0,a=e.style.opacity,i=n?null:Wre(e,["opacity"],t,{opacity:1});r=r||{};var o=r.style||{};return o.opacity==null&&(r=te({},r),o=te({opacity:n?a:i.opacity*.1},o),r.style=o),r}function YS(e,t){var r=this.states[e];if(this.style){if(e==="emphasis")return $re(this,e,t,r);if(e==="blur")return Yre(this,e,r);if(e==="select")return Zre(this,e,r)}return r}function oh(e){e.stateProxy=YS;var t=e.getTextContent(),r=e.getTextGuideLine();t&&(t.stateProxy=YS),r&&(r.stateProxy=YS)}function eR(e,t){!T7(e,t)&&!e.__highByOuter&&Qs(e,x7)}function tR(e,t){!T7(e,t)&&!e.__highByOuter&&Qs(e,_7)}function Us(e,t){e.__highByOuter|=1<<(t||0),Qs(e,x7)}function Ws(e,t){!(e.__highByOuter&=~(1<<(t||0)))&&Qs(e,_7)}function w7(e){Qs(e,qk)}function Kk(e){Qs(e,b7)}function S7(e){Qs(e,Hre)}function C7(e){Qs(e,Ure)}function T7(e,t){return e.__highDownSilentOnTouch&&t.zrByTouch}function M7(e){var t=e.getModel(),r=[],n=[];t.eachComponent(function(a,i){var o=Zk(i),s=m7(e,i),l=a==="series";!l&&n.push(s),o.isBlured&&(s.group.traverse(function(u){b7(u)}),l&&r.push(i)),o.isBlured=!1}),R(n,function(a){a&&a.toggleBlurSeries&&a.toggleBlurSeries(r,!1,t)})}function EM(e,t,r,n){var a=n.getModel();r=r||"coordinateSystem";function i(u,c){for(var h=0;h0){var s={dataIndex:o,seriesIndex:r.seriesIndex};i!=null&&(s.dataType=i),t.push(s)}})}),t}function ql(e,t,r){Ic(e,!0),Qs(e,oh),OM(e,t,r)}function ene(e){Ic(e,!1)}function ir(e,t,r,n){n?ene(e):ql(e,t,r)}function OM(e,t,r){var n=Be(e);t!=null?(n.focus=t,n.blurScope=r):n.focus&&(n.focus=null)}var nR=["emphasis","blur","select"],tne={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Vr(e,t,r,n){r=r||"itemStyle";for(var a=0;a1&&(o*=XS(g),s*=XS(g));var m=(a===i?-1:1)*XS((o*o*(s*s)-o*o*(v*v)-s*s*(f*f))/(o*o*(v*v)+s*s*(f*f)))||0,y=m*o*v/s,x=m*-s*f/o,_=(e+r)/2+n0(h)*y-r0(h)*x,w=(t+n)/2+r0(h)*y+n0(h)*x,S=sR([1,0],[(f-y)/o,(v-x)/s]),C=[(f-y)/o,(v-x)/s],M=[(-1*f-y)/o,(-1*v-x)/s],A=sR(C,M);if(BM(C,M)<=-1&&(A=Qv),BM(C,M)>=1&&(A=0),A<0){var I=Math.round(A/Qv*1e6)/1e6;A=Qv*2+I%2*Qv}c.addData(u,_,w,o,s,S,A,h,i)}var sne=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,lne=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function une(e){var t=new Go;if(!e)return t;var r=0,n=0,a=r,i=n,o,s=Go.CMD,l=e.match(sne);if(!l)return t;for(var u=0;uB*B+H*H&&(I=P,k=D),{cx:I,cy:k,x0:-c,y0:-h,x1:I*(a/C-1),y1:k*(a/C-1)}}function gne(e){var t;if(ae(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 mne(e,t){var r,n=Rp(t.r,0),a=Rp(t.r0||0,0),i=n>0,o=a>0;if(!(!i&&!o)){if(i||(n=a,a=0),a>n){var s=n;n=a,a=s}var l=t.startAngle,u=t.endAngle;if(!(isNaN(l)||isNaN(u))){var c=t.cx,h=t.cy,f=!!t.clockwise,v=uR(u-l),g=v>qS&&v%qS;if(g>ki&&(v=g),!(n>ki))e.moveTo(c,h);else if(v>qS-ki)e.moveTo(c+n*fd(l),h+n*Ku(l)),e.arc(c,h,n,l,u,!f),a>ki&&(e.moveTo(c+a*fd(u),h+a*Ku(u)),e.arc(c,h,a,u,l,f));else{var m=void 0,y=void 0,x=void 0,_=void 0,w=void 0,S=void 0,C=void 0,M=void 0,A=void 0,I=void 0,k=void 0,P=void 0,D=void 0,z=void 0,j=void 0,B=void 0,H=n*fd(l),V=n*Ku(l),U=a*fd(u),F=a*Ku(u),W=v>ki;if(W){var $=t.cornerRadius;$&&(r=gne($),m=r[0],y=r[1],x=r[2],_=r[3]);var Z=uR(n-a)/2;if(w=uo(Z,x),S=uo(Z,_),C=uo(Z,m),M=uo(Z,y),k=A=Rp(w,S),P=I=Rp(C,M),(A>ki||I>ki)&&(D=n*fd(u),z=n*Ku(u),j=a*fd(l),B=a*Ku(l),vki){var ne=uo(x,k),xe=uo(_,k),he=a0(j,B,H,V,n,ne,f),ge=a0(D,z,U,F,n,xe,f);e.moveTo(c+he.cx+he.x0,h+he.cy+he.y0),k0&&e.arc(c+he.cx,h+he.cy,ne,Ln(he.y0,he.x0),Ln(he.y1,he.x1),!f),e.arc(c,h,n,Ln(he.cy+he.y1,he.cx+he.x1),Ln(ge.cy+ge.y1,ge.cx+ge.x1),!f),xe>0&&e.arc(c+ge.cx,h+ge.cy,xe,Ln(ge.y1,ge.x1),Ln(ge.y0,ge.x0),!f))}else e.moveTo(c+H,h+V),e.arc(c,h,n,l,u,!f);if(!(a>ki)||!W)e.lineTo(c+U,h+F);else if(P>ki){var ne=uo(m,P),xe=uo(y,P),he=a0(U,F,D,z,a,-xe,f),ge=a0(H,V,j,B,a,-ne,f);e.lineTo(c+he.cx+he.x0,h+he.cy+he.y0),P0&&e.arc(c+he.cx,h+he.cy,xe,Ln(he.y0,he.x0),Ln(he.y1,he.x1),!f),e.arc(c,h,a,Ln(he.cy+he.y1,he.cx+he.x1),Ln(ge.cy+ge.y1,ge.cx+ge.x1),f),ne>0&&e.arc(c+ge.cx,h+ge.cy,ne,Ln(ge.y1,ge.x1),Ln(ge.y0,ge.x0),!f))}else e.lineTo(c+U,h+F),e.arc(c,h,a,u,l,f)}e.closePath()}}}var yne=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}(),wn=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new yne},t.prototype.buildPath=function(r,n){mne(r,n)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(pt);wn.prototype.type="sector";var xne=function(){function e(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return e}(),hv=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new xne},t.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.PI*2;r.moveTo(a+n.r,i),r.arc(a,i,n.r,0,o,!1),r.moveTo(a+n.r0,i),r.arc(a,i,n.r0,0,o,!0)},t}(pt);hv.prototype.type="ring";function _ne(e,t,r,n){var a=[],i=[],o=[],s=[],l,u,c,h;if(n){c=[1/0,1/0],h=[-1/0,-1/0];for(var f=0,v=e.length;f=2){if(n){var i=_ne(a,n,r,t.smoothConstraint);e.moveTo(a[0][0],a[0][1]);for(var o=a.length,s=0;s<(r?o:o-1);s++){var l=i[s*2],u=i[s*2+1],c=a[(s+1)%o];e.bezierCurveTo(l[0],l[1],u[0],u[1],c[0],c[1])}}else{e.moveTo(a[0][0],a[0][1]);for(var s=1,h=a.length;sQu[1]){if(i=!1,rn.negativeSize||n)return i;var l=i0(Qu[0]-Ju[1]),u=i0(Ju[0]-Qu[1]);KS(l,u)>s0.len()&&(l=u||!rn.bidirectional)&&(Oe.scale(o0,s,-u*a),rn.useDir&&rn.calcDirMTV()))}}return i},e.prototype._getProjMinMaxOnAxis=function(t,r,n){for(var a=this._axes[t],i=this._origin,o=r[0].dot(a)+i[t],s=o,l=o,u=1;u0){var h=c.duration,f=c.delay,v=c.easing,g={duration:h,delay:f||0,easing:v,done:i,force:!!i||!!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),i&&i()}function At(e,t,r,n,a,i){tL("update",e,t,r,n,a,i)}function Qt(e,t,r,n,a,i){tL("enter",e,t,r,n,a,i)}function vf(e){if(!e.__zr)return!0;for(var t=0;tcr(i[1])?i[0]>0?"right":"left":i[1]>0?"bottom":"top"}function dR(e){return!e.isGroup}function Ene(e){return e.shape!=null}function $m(e,t,r){if(!e||!t)return;function n(o){var s={};return o.traverse(function(l){dR(l)&&l.anid&&(s[l.anid]=l)}),s}function a(o){var s={x:o.x,y:o.y,rotation:o.rotation};return Ene(o)&&(s.shape=ke(o.shape)),s}var i=n(e);t.traverse(function(o){if(dR(o)&&o.anid){var s=i[o.anid];if(s){var l=a(o);o.attr(a(s)),At(o,l,r,Be(o).dataIndex)}}})}function aL(e,t){return oe(e,function(r){var n=r[0];n=at(n,t.x),n=Et(n,t.x+t.width);var a=r[1];return a=at(a,t.y),a=Et(a,t.y+t.height),[n,a]})}function U7(e,t){var r=at(e.x,t.x),n=Et(e.x+e.width,t.x+t.width),a=at(e.y,t.y),i=Et(e.y+e.height,t.y+t.height);if(n>=r&&i>=a)return{x:r,y:a,width:n-r,height:i-a}}function pv(e,t,r){var n=te({rectHover:!0},t),a=n.style={strokeNoScale:!0};if(r=r||{x:-1,y:-1,width:2,height:2},e)return e.indexOf("image://")===0?(a.image=e.slice(8),Ee(a,r),new Qr(n)):Ef(e.replace("path://",""),n,r,"center")}function Op(e,t,r,n,a){for(var i=0,o=a[a.length-1];i1)return!1;var y=JS(v,g,c,h)/f;return!(y<0||y>1)}function JS(e,t,r,n){return e*n-r*t}function Rne(e){return e<=1e-6&&e>=-1e-6}function sh(e,t,r,n,a){return t==null||(Tt(t)?or[0]=or[1]=or[2]=or[3]=t:(or[0]=t[0],or[1]=t[1],or[2]=t[2],or[3]=t[3]),n&&(or[0]=at(0,or[0]),or[1]=at(0,or[1]),or[2]=at(0,or[2]),or[3]=at(0,or[3])),r&&(or[0]=-or[0],or[1]=-or[1],or[2]=-or[2],or[3]=-or[3]),fR(e,or,"x","width",3,1,a&&a[0]||0),fR(e,or,"y","height",0,2,a&&a[1]||0)),e}var or=[0,0,0,0];function fR(e,t,r,n,a,i,o){var s=t[i]+t[a],l=e[n];e[n]+=s,o=at(0,Et(o,l)),e[n]=0?-t[a]:t[i]>=0?l+t[i]:cr(s)>1e-8?(l-o)*t[a]/s:0):e[r]-=t[a]}function el(e){var t=e.itemTooltipOption,r=e.componentModel,n=e.itemName,a=ve(t)?{formatter:t}:t,i=r.mainType,o=r.componentIndex,s={componentType:i,name:n,$vars:["name"]};s[i+"Index"]=o;var l=e.formatterParamsExtra;l&&R(gt(l),function(c){Se(s,c)||(s[c]=l[c],s.$vars.push(c))});var u=Be(e.el);u.componentMainType=i,u.componentIndex=o,u.tooltipConfig={name:n,option:Ee({content:n,encodeHTMLContent:!0,formatterParams:s},a)}}function VM(e,t){var r;e.isGroup&&(r=t(e)),r||e.traverse(t)}function Su(e,t){if(e)if(ae(e))for(var r=0;rt&&(t=o),ot&&(r=t=0),{min:r,max:t}}function z1(e,t,r){Z7(e,t,r,-1/0)}function Z7(e,t,r,n){if(e.ignoreModelZ)return n;var a=e.getTextContent(),i=e.getTextGuideLine(),o=e.isGroup;if(o)for(var s=e.childrenRef(),l=0;l=0&&s.push(l)}),s}}function Cu(e,t){return Je(Je({},e,!0),t,!0)}const Yne={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:". "}}}},Xne={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 H_="ZH",uL="EN",pf=uL,zx={},cL={},Q7=xt.domSupported?function(){var e=(document.documentElement.lang||navigator.language||navigator.browserLanguage||pf).toUpperCase();return e.indexOf(H_)>-1?H_:pf}():pf;function hL(e,t){e=e.toUpperCase(),cL[e]=new vt(t),zx[e]=t}function qne(e){if(ve(e)){var t=zx[e.toUpperCase()]||{};return e===H_||e===uL?ke(t):Je(ke(t),ke(zx[pf]),!1)}else return Je(ke(e),ke(zx[pf]),!1)}function UM(e){return cL[e]}function Kne(){return cL[pf]}hL(uL,Yne);hL(H_,Xne);var WM=null;function Jne(e){WM||(WM=e)}function Mr(){return WM}function eH(e,t){var r=Mr(),n=t.breakOption,a=t.breakParsed;return!a&&r&&(a=r.parseAxisBreakOption(n,e)),a}function U_(e){var t=e.brk;return t?t.breaks:[]}function W_(e){var t=e.brk;return t?t.hasBreaks():!1}var dL=1e3,fL=dL*60,dg=fL*60,ai=dg*24,yR=ai*365,Qne={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})/},Bx={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}"},eae="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}",u0="{yyyy}-{MM}-{dd}",xR={year:"{yyyy}",month:"{yyyy}-{MM}",day:u0,hour:u0+" "+Bx.hour,minute:u0+" "+Bx.minute,second:u0+" "+Bx.second,millisecond:eae},Ta=["year","month","day","hour","minute","second","millisecond"],tae=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function rae(e){return!ve(e)&&!Le(e)?nae(e):e}function nae(e){e=e||{};var t={},r=!0;return R(Ta,function(n){r&&(r=e[n]==null)}),R(Ta,function(n,a){var i=e[n];t[n]={};for(var o=null,s=a;s>=0;s--){var l=Ta[s],u=Re(i)&&!ae(i)?i[l]:i,c=void 0;ae(u)?(c=u.slice(),o=c[0]||""):ve(u)?(o=u,c=[o]):(o==null?o=Bx[n]:Qne[l].test(o)||(o=t[l][l][0]+" "+o),c=[o],r&&(c[1]="{primary|"+o+"}")),t[n][l]=c}}),t}function Yn(e,t){return e+="","0000".substr(0,t-e.length)+e}function fg(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 aae(e){return e===fg(e)}function iae(e){switch(e){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function Zm(e,t,r,n){var a=qo(e),i=a[tH(r)](),o=a[vL(r)]()+1,s=Math.floor((o-1)/3)+1,l=a[pL(r)](),u=a["get"+(r?"UTC":"")+"Day"](),c=a[gL(r)](),h=(c-1)%12+1,f=a[mL(r)](),v=a[yL(r)](),g=a[xL(r)](),m=c>=12?"pm":"am",y=m.toUpperCase(),x=n instanceof vt?n:UM(n||Q7)||Kne(),_=x.getModel("time"),w=_.get("month"),S=_.get("monthAbbr"),C=_.get("dayOfWeek"),M=_.get("dayOfWeekAbbr");return(t||"").replace(/{a}/g,m+"").replace(/{A}/g,y+"").replace(/{yyyy}/g,i+"").replace(/{yy}/g,Yn(i%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,w[o-1]).replace(/{MMM}/g,S[o-1]).replace(/{MM}/g,Yn(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,Yn(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,C[u]).replace(/{ee}/g,M[u]).replace(/{e}/g,u+"").replace(/{HH}/g,Yn(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,Yn(h+"",2)).replace(/{h}/g,h+"").replace(/{mm}/g,Yn(f,2)).replace(/{m}/g,f+"").replace(/{ss}/g,Yn(v,2)).replace(/{s}/g,v+"").replace(/{SSS}/g,Yn(g,3)).replace(/{S}/g,g+"")}function oae(e,t,r,n,a){var i=null;if(ve(r))i=r;else if(Le(r)){var o={time:e.time,level:e.time?e.time.level:0},s=Mr();s&&s.makeAxisLabelFormatterParamBreak(o,e.break),i=r(e.value,t,o)}else{var l=e.time;if(l){var u=r[l.lowerTimeUnit][l.upperTimeUnit];i=u[Math.min(l.level,u.length-1)]||""}else{var c=gf(e.value,a);i=r[c][c][0]}}return Zm(new Date(e.value),i,a,n)}function gf(e,t){var r=qo(e),n=r[vL(t)]()+1,a=r[pL(t)](),i=r[gL(t)](),o=r[mL(t)](),s=r[yL(t)](),l=r[xL(t)](),u=l===0,c=u&&s===0,h=c&&o===0,f=h&&i===0,v=f&&a===1,g=v&&n===1;return g?"year":v?"month":f?"day":h?"hour":c?"minute":u?"second":"millisecond"}function $_(e,t,r){switch(t){case"year":e[rH(r)](0);case"month":e[nH(r)](1);case"day":e[aH(r)](0);case"hour":e[iH(r)](0);case"minute":e[oH(r)](0);case"second":e[sH(r)](0)}return e}function tH(e){return e?"getUTCFullYear":"getFullYear"}function vL(e){return e?"getUTCMonth":"getMonth"}function pL(e){return e?"getUTCDate":"getDate"}function gL(e){return e?"getUTCHours":"getHours"}function mL(e){return e?"getUTCMinutes":"getMinutes"}function yL(e){return e?"getUTCSeconds":"getSeconds"}function xL(e){return e?"getUTCMilliseconds":"getMilliseconds"}function sae(e){return e?"setUTCFullYear":"setFullYear"}function rH(e){return e?"setUTCMonth":"setMonth"}function nH(e){return e?"setUTCDate":"setDate"}function aH(e){return e?"setUTCHours":"setHours"}function iH(e){return e?"setUTCMinutes":"setMinutes"}function oH(e){return e?"setUTCSeconds":"setSeconds"}function sH(e){return e?"setUTCMilliseconds":"setMilliseconds"}function lae(e,t,r,n,a,i,o,s){var l=new wt({style:{text:e,font:t,align:r,verticalAlign:n,padding:a,rich:i,overflow:o?"truncate":null,lineHeight:s}});return l.getBoundingRect()}function _L(e){if(!Bk(e))return ve(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function bL(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 mv=zm;function $M(e,t,r){var n="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function a(c){return c&&ka(c)?c:"-"}function i(c){return mi(c)}var o=t==="time",s=e instanceof Date;if(o||s){var l=o?qo(e):e;if(isNaN(+l)){if(s)return"-"}else return Zm(l,n,r)}if(t==="ordinal")return S_(e)?a(e):Tt(e)&&i(e)?e+"":"-";var u=Vo(e);return i(u)?_L(u):S_(e)?a(e):typeof e=="boolean"?e+"":"-"}var _R=["a","b","c","d","e","f","g"],tC=function(e,t){return"{"+e+(t??"")+"}"};function wL(e,t,r){ae(t)||(t=[t]);var n=t.length;if(!n)return"";for(var a=t[0].$vars||[],i=0;i':'';var o=r.markerId||"markerX";return{renderMode:i,content:"{"+o+"|} ",style:a==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:n}:{width:10,height:10,borderRadius:5,backgroundColor:n}}}function uae(e,t,r){(e==="week"||e==="month"||e==="quarter"||e==="half-year"||e==="year")&&(e=`MM-dd -yyyy`);var n=qo(t),a=r?"getUTC":"get",i=n[a+"FullYear"](),o=n[a+"Month"]()+1,s=n[a+"Date"](),l=n[a+"Hours"](),u=n[a+"Minutes"](),c=n[a+"Seconds"](),h=n[a+"Milliseconds"]();return e=e.replace("MM",Yn(o,2)).replace("M",o).replace("yyyy",i).replace("yy",Yn(i%100+"",2)).replace("dd",Yn(s,2)).replace("d",s).replace("hh",Yn(l,2)).replace("h",l).replace("mm",Yn(u,2)).replace("m",u).replace("ss",Yn(c,2)).replace("s",c).replace("SSS",Yn(h,3)),e}function cae(e){return e&&e.charAt(0).toUpperCase()+e.substr(1)}function uh(e,t){return t=t||"transparent",ve(e)?e:Re(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}function Z_(e,t){if(t==="_blank"||t==="blank"){var r=window.open();r.opener=null,r.location.href=e}else window.open(e,t)}var Fx={},rC={},yv=function(){function e(){this._normalMasterList=[],this._nonSeriesBoxMasterList=[]}return e.prototype.create=function(t,r){this._nonSeriesBoxMasterList=n(Fx),this._normalMasterList=n(rC);function n(a,i){var o=[];return R(a,function(s,l){var u=s.create(t,r);o=o.concat(u||[])}),o}},e.prototype.update=function(t,r){R(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"){Fx[t]=r;return}rC[t]=r},e.get=function(t){return rC[t]||Fx[t]},e}();function hae(e){return!!Fx[e]}var dae=1,cH=2;function fae(e){hH.set(e.fullType,{getCoord2:void 0}).getCoord2=e.getCoord2}var hH=we();function dH(e){var t=e.getShallow("coord",!0),r=dae;if(t==null){var n=hH.get(e.type);n&&n.getCoord2&&(r=cH,t=n.getCoord2(e))}return{coord:t,from:r}}var mf=0,Vx=1,fH=2;function vH(e,t){var r=e.getShallow("coordinateSystem"),n=e.getShallow("coordinateSystemUsage",!0),a=mf;if(r){var i=e.mainType==="series";n==null&&(n=i?"data":"box"),n==="data"?(a=Vx,i||(a=mf)):n==="box"&&(a=fH,!i&&!hae(r)&&(a=mf))}return{coordSysType:r,kind:a}}function Ym(e){var t=e.targetModel,r=e.coordSysType,n=e.coordSysProvider,a=e.isDefaultDataCoordSys;e.allowNotFound;var i=vH(t),o=i.kind,s=i.coordSysType;if(a&&o!==Vx&&(o=Vx,s=r),o===mf||s!==r)return mf;var l=n(r,t);return l?(o===Vx?t.coordinateSystem=l:t.boxCoordinateSystem=l,o):mf}var pH=function(e,t){var r=t.getReferringComponents(e,pr).models[0];return r&&r.coordinateSystem},Gx=R,gH=["left","right","top","bottom","width","height"],Pc=[["width","left","right"],["height","top","bottom"]];function SL(e,t,r,n,a){var i=0,o=0;n==null&&(n=1/0),a==null&&(a=1/0);var s=0;t.eachChild(function(l,u){var c=l.getBoundingRect(),h=t.childAt(u+1),f=h&&h.getBoundingRect(),v,g;if(e==="horizontal"){var m=c.width+(f?-f.x+c.x:0);v=i+m,v>n||l.newline?(i=0,v=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>a||l.newline?(i+=s+r,o=0,g=y,s=c.width):s=Math.max(s,c.width)}l.newline||(l.x=i,l.y=o,l.markRedraw(),e==="horizontal"?i=v+r:o=g+r)})}var Gc=SL;nt(SL,"vertical");nt(SL,"horizontal");function mH(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 vae(e,t){var r=Ur(e,t,{enableLayoutOnlyByCenter:!0}),n=e.getBoxLayoutParams(),a,i;if(r.type===Bp.point)i=r.refPoint,a=tr(n,{width:t.getWidth(),height:t.getHeight()});else{var o=e.get("center"),s=ae(o)?o:[o,o];a=tr(n,r.refContainer),i=r.boxCoordFrom===cH?r.refPoint:[me(s[0],a.width)+a.x,me(s[1],a.height)+a.y]}return{viewRect:a,center:i}}function yH(e,t){var r=vae(e,t),n=r.viewRect,a=r.center,i=e.get("radius");ae(i)||(i=[0,i]);var o=me(n.width,t.getWidth()),s=me(n.height,t.getHeight()),l=Math.min(o,s),u=me(i[0],l/2),c=me(i[1],l/2);return{cx:a[0],cy:a[1],r0:u,r:c,viewRect:n}}function tr(e,t,r){r=mv(r||0);var n=t.width,a=t.height,i=me(e.left,n),o=me(e.top,a),s=me(e.right,n),l=me(e.bottom,a),u=me(e.width,n),c=me(e.height,a),h=r[2]+r[0],f=r[1]+r[3],v=e.aspect;switch(isNaN(u)&&(u=n-s-f-i),isNaN(c)&&(c=a-l-h-o),v!=null&&(isNaN(u)&&isNaN(c)&&(v>n/a?u=n*.8:c=a*.8),isNaN(u)&&(u=v*c),isNaN(c)&&(c=u/v)),isNaN(i)&&(i=n-s-u-f),isNaN(o)&&(o=a-l-c-h),e.left||e.right){case"center":i=n/2-u/2-r[3];break;case"right":i=n-u-f;break}switch(e.top||e.bottom){case"middle":case"center":o=a/2-c/2-r[0];break;case"bottom":o=a-c-h;break}i=i||0,o=o||0,isNaN(u)&&(u=n-f-i-(s||0)),isNaN(c)&&(c=a-h-o-(l||0));var g=new je((t.x||0)+i+r[3],(t.y||0)+o+r[0],u,c);return g.margin=r,g}function xH(e,t,r){var n=e.getShallow("preserveAspect",!0);if(!n)return t;var a=t.width/t.height;if(Math.abs(Math.atan(r)-Math.atan(a))<1e-9)return t;var i=e.getShallow("preserveAspectAlign",!0),o=e.getShallow("preserveAspectVerticalAlign",!0),s={width:t.width,height:t.height},l=n==="cover";return a>r&&!l||a=m)return h;for(var y=0;y=0;l--)s=Je(s,a[l],!0);n.defaultOption=s}return n.defaultOption},t.prototype.getReferringComponents=function(r,n){var a=r+"Index",i=r+"Id";return sv(this.ecModel,r,{index:this.get(a,!0),id:this.get(i,!0)},n)},t.prototype.getBoxLayoutParams=function(){return mH(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}(vt);r7(ht,vt);k1(ht);$ne(ht);Zne(ht,mae);function mae(e){var t=[];return R(ht.getClassesByMainType(e),function(r){t=t.concat(r.dependencies||r.prototype.dependencies||[])}),t=oe(t,function(r){return bo(r).main}),e!=="dataset"&&Ye(t,"dataset")<=0&&t.unshift("dataset"),t}var K={color:{},darkColor:{},size:{}},wr=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)"};te(wr,{primary:wr.neutral80,secondary:wr.neutral70,tertiary:wr.neutral60,quaternary:wr.neutral50,disabled:wr.neutral20,border:wr.neutral30,borderTint:wr.neutral20,borderShade:wr.neutral40,background:wr.neutral05,backgroundTint:"rgba(234,237,245,0.5)",backgroundTransparent:"rgba(255,255,255,0)",backgroundShade:wr.neutral10,shadow:"rgba(0,0,0,0.2)",shadowTint:"rgba(129,130,136,0.2)",axisLine:wr.neutral70,axisLineTint:wr.neutral40,axisTick:wr.neutral70,axisTickMinor:wr.neutral60,axisLabel:wr.neutral70,axisSplitLine:wr.neutral15,axisMinorSplitLine:wr.neutral05});for(var ec in wr)if(wr.hasOwnProperty(ec)){var bR=wr[ec];ec==="theme"?K.darkColor.theme=wr.theme.slice():ec==="highlight"?K.darkColor.highlight="rgba(255,231,130,0.4)":ec.indexOf("accent")===0?K.darkColor[ec]=Ls(bR,null,function(e){return e*.5},function(e){return Math.min(1,1.3-e)}):K.darkColor[ec]=Ls(bR,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 bH="";typeof navigator<"u"&&(bH=navigator.platform||"");var vd="rgba(0, 0, 0, 0.2)",wH=K.color.theme[0],yae=Ls(wH,null,null,.9);const SH={darkMode:"auto",colorBy:"series",color:K.color.theme,gradientColor:[yae,wH],aria:{decal:{decals:[{color:vd,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:vd,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:vd,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:vd,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:vd,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:vd,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:bH.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 fn={Must:1,Might:2,Not:3},CH=Qe();function xae(e){CH(e).datasetMap=we()}function TH(e,t,r){var n={},a=TL(t);if(!a||!e)return n;var i=[],o=[],s=t.ecModel,l=CH(s).datasetMap,u=a.uid+"_"+r.seriesLayoutBy,c,h;e=e.slice(),R(e,function(m,y){var x=Re(m)?m:e[y]={name:m};x.type==="ordinal"&&c==null&&(c=y,h=g(x)),n[x.name]=[]});var f=l.get(u)||l.set(u,{categoryWayDim:h,valueWayDim:0});R(e,function(m,y){var x=m.name,_=g(m);if(c==null){var w=f.valueWayDim;v(n[x],w,_),v(o,w,_),f.valueWayDim+=_}else if(c===y)v(n[x],0,_),v(i,0,_);else{var w=f.categoryWayDim;v(n[x],w,_),v(o,w,_),f.categoryWayDim+=_}});function v(m,y,x){for(var _=0;_t)return e[n];return e[r-1]}function NH(e,t,r,n,a,i,o){i=i||e;var s=t(i),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(a))return u[a];var c=o==null||!n?r:Cae(n,o);if(c=c||r,!(!c||!c.length)){var h=c[l];return a&&(u[a]=h),s.paletteIdx=(l+1)%c.length,h}}function Tae(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}var c0,ep,SR,CR="\0_ec_inner",Mae=1,AL=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.init=function(r,n,a,i,o,s){i=i||{},this.option=null,this._theme=new vt(i),this._locale=new vt(o),this._optionManager=s},t.prototype.setOption=function(r,n,a){var i=AR(n);this._optionManager.setOption(r,a,i),this._resetOption(null,i)},t.prototype.resetOption=function(r,n){return this._resetOption(r,AR(n))},t.prototype._resetOption=function(r,n){var a=!1,i=this._optionManager;if(!r||r==="recreate"){var o=i.mountOption(r==="recreate");!this.option||r==="recreate"?SR(this,o):(this.restoreData(),this._mergeOption(o,n)),a=!0}if((r==="timeline"||r==="media")&&this.restoreData(),!r||r==="recreate"||r==="timeline"){var s=i.getTimelineOption(this);s&&(a=!0,this._mergeOption(s,n))}if(!r||r==="recreate"||r==="media"){var l=i.getMediaOption(this);l.length&&R(l,function(u){a=!0,this._mergeOption(u,n)},this)}return a},t.prototype.mergeOption=function(r){this._mergeOption(r,null)},t.prototype._mergeOption=function(r,n){var a=this.option,i=this._componentsMap,o=this._componentsCount,s=[],l=we(),u=n&&n.replaceMergeMainTypeMap;xae(this),R(r,function(h,f){h!=null&&(ht.hasClass(f)?f&&(s.push(f),l.set(f,!0)):a[f]=a[f]==null?ke(h):Je(a[f],h,!0))}),u&&u.each(function(h,f){ht.hasClass(f)&&!l.get(f)&&(s.push(f),l.set(f,!0))}),ht.topologicalTravel(s,ht.getAllClassMainTypes(),c,this);function c(h){var f=wae(this,h,Zt(r[h])),v=i.get(h),g=v?u&&u.get(h)?"replaceMerge":"normalMerge":"replaceAll",m=YG(v,f,g);jte(m,h,ht),a[h]=null,i.set(h,null),o.set(h,0);var y=[],x=[],_=0,w;R(m,function(S,C){var M=S.existing,A=S.newOption;if(!A)M&&(M.mergeOption({},this),M.optionUpdated({},!1));else{var I=h==="series",k=ht.getClass(h,S.keyInfo.subType,!I);if(!k)return;if(h==="tooltip"){if(w)return;w=!0}if(M&&M.constructor===k)M.name=S.keyInfo.name,M.mergeOption(A,this),M.optionUpdated(A,!1);else{var P=te({componentIndex:C},S.keyInfo);M=new k(A,this,this,P),te(M,P),S.brandNew&&(M.__requireNewView=!0),M.init(A,this,this),M.optionUpdated(null,!0)}}M?(y.push(M.option),x.push(M),_++):(y.push(void 0),x.push(void 0))},this),a[h]=y,i.set(h,x),o.set(h,_),h==="series"&&c0(this)}this._seriesIndices||c0(this)},t.prototype.getOption=function(){var r=ke(this.option);return R(r,function(n,a){if(ht.hasClass(a)){for(var i=Zt(n),o=i.length,s=!1,l=o-1;l>=0;l--)i[l]&&!Xg(i[l])?s=!0:(i[l]=null,!s&&o--);i.length=o,r[a]=i}}),delete r[CR],r},t.prototype.setTheme=function(r){this._theme=new vt(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 a=this._componentsMap.get(r);if(a){var i=a[n||0];if(i)return i;if(n==null){for(var o=0;o=t:r==="max"?e<=t:e===t}function jae(e,t){return e.join(",")===t.join(",")}var Ni=R,tm=Re,NR=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function nC(e){var t=e&&e.itemStyle;if(t)for(var r=0,n=NR.length;r0?r[o-1].seriesModel:null)}),Uae(r)}})}function Uae(e){R(e,function(t,r){var n=[],a=[NaN,NaN],i=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,l=t.seriesModel.get("stackStrategy")||"samesign";o.modify(i,function(u,c,h){var f=o.get(t.stackedDimension,h);if(isNaN(f))return a;var v,g;s?g=o.getRawIndex(h):v=o.get(t.stackedByDimension,h);for(var m=NaN,y=r-1;y>=0;y--){var x=e[y];if(s||(g=x.data.rawIndexOf(x.stackedByDimension,v)),g>=0){var _=x.data.getByRawIndex(x.stackResultDimension,g);if(l==="all"||l==="positive"&&_>0||l==="negative"&&_<0||l==="samesign"&&f>=0&&_>0||l==="samesign"&&f<=0&&_<0){f=pc(f,_),m=_;break}}}return n[0]=f,n[1]=m,n})})}var G1=function(){function e(t){this.data=t.data||(t.sourceFormat===Yi?{}:[]),this.sourceFormat=t.sourceFormat||v7,this.seriesLayoutBy=t.seriesLayoutBy||Bi,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)}v[0]=g,v[1]=m}},a=function(){return this._data?this._data.length/this._dimSize:0};ER=(t={},t[ln+"_"+Bi]={pure:!0,appendData:i},t[ln+"_"+jh]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},t[Fa]={pure:!0,appendData:i},t[Yi]={pure:!0,appendData:function(o){var s=this._data;R(o,function(l,u){for(var c=s[u]||(s[u]=[]),h=0;h<(l||[]).length;h++)c.push(l[h])})}},t[Ba]={appendData:i},t[Xl]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},t);function i(o){for(var s=0;s=0&&(m=o.interpolatedValue[y])}return m!=null?m+"":""})}},e.prototype.getRawValue=function(t,r){return Of(this.getData(r),t)},e.prototype.formatTooltip=function(t,r,n){},e}();function BR(e){var t,r;return Re(e)?e.type&&(r=e):t=e,{text:t,frag:r}}function vg(e){return new Jae(e)}var Jae=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 a=this.context;a.data=a.outputData=r.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=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)&&(i="reset");function c(_){return!(_>=1)&&(_=1),_}var h;(this._dirty||i==="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 v=this._dueIndex,g=Math.min(f!=null?this._dueIndex+f:1/0,this._dueEnd);if(!n&&(h||v1&&n>0?s:o}};return i;function o(){return t=e?null:lt},gte:function(e,t){return e>=t}},eie=function(){function e(t,r){if(!Tt(r)){var n="";Lt(n)}this._opFn=zH[t],this._rvalFloat=Vo(r)}return e.prototype.evaluate=function(t){return Tt(t)?this._opFn(t,this._rvalFloat):this._opFn(Vo(t),this._rvalFloat)},e}(),BH=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=Tt(t)?t:Vo(t),a=Tt(r)?r:Vo(r),i=isNaN(n),o=isNaN(a);if(i&&(n=this._incomparable),o&&(a=this._incomparable),i&&o){var s=ve(t),l=ve(r);s&&(n=l?t:0),l&&(a=s?r:0)}return na?-this._resultLT:0},e}(),tie=function(){function e(t,r){this._rval=r,this._isEQ=t,this._rvalTypeof=typeof r,this._rvalFloat=Vo(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=Vo(t)===this._rvalFloat)}return this._isEQ?r:!r},e}();function rie(e,t){return e==="eq"||e==="ne"?new tie(e==="eq",t):Se(zH,e)?new eie(e,t):null}function FH(e){var t="",r=-1/0,n=-1/0,a=1/0,i=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,a=e.l),e.le!=null&&(t+="LE"+e.le,i=e.le)),{key:t,g:r,ge:n,l:a,le:i}}function VH(e,t){return t>e.g&&t>=e.ge&&t65535?die:fie}function vie(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function GR(e,t,r,n,a){var i=UH[r||"float"];if(a){var o=e[t],s=o&&o.length;if(s!==n){for(var l=new i(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 a=this._provider,i=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,u=oe(o,function(_){return _.property}),c=0;cx[1]&&(x[1]=y)}}!a.persistent&&a.clean&&a.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)i=o-1;else return o}return-1},e.prototype.getIndices=function(){var t,r=this._indices;if(r){var n=r.constructor,a=this._count;if(n===Array){t=new n(a);for(var i=0;i=h&&_<=f||isNaN(_))&&(l[u++]=m),m++}g=!0}else if(i===2){for(var y=v[a[0]],w=v[a[1]],S=t[a[1]][0],C=t[a[1]][1],x=0;x=h&&_<=f||isNaN(_))&&(M>=S&&M<=C||isNaN(M))&&(l[u++]=m),m++}g=!0}}if(!g)if(i===1)for(var x=0;x=h&&_<=f||isNaN(_))&&(l[u++]=A)}else for(var x=0;xt[P][1])&&(I=!1)}I&&(l[u++]=r.getRawIndex(x))}return ux[1]&&(x[1]=y)}}}},e.prototype.lttbDownSample=function(t,r){var n=this.clone([t],!0),a=n._chunks,i=a[t],o=this.count(),s=0,l=Math.floor(1/r),u=this.getRawIndex(0),c,h,f,v=new(pd(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));v[s++]=u;for(var g=1;gc&&(c=h,f=S)}D>0&&Ds&&(m=s-c);for(var y=0;yg&&(g=_,v=c+y)}var w=this.getRawIndex(h),S=this.getRawIndex(v);hc-g&&(l=c-g,s.length=l);for(var m=0;mh[1]&&(h[1]=x),f[v++]=_}return i._count=v,i._indices=f,i._updateGetRawIdx(),i},e.prototype.each=function(t,r){if(this._count)for(var n=t.length,a=this._chunks,i=0,o=this.count();iv&&(v=y))}return l[c]=[f,v]},e.prototype.getRawDataItem=function(t){var r=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(r);for(var n=[],a=this._chunks,i=0;i=0?this._indices[t]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function t(r,n,a,i){return Kl(r[i],this._dimensions[i])}oC={arrayRows:t,objectRows:function(r,n,a,i){return Kl(r[n],this._dimensions[i])},keyedColumns:t,original:function(r,n,a,i){var o=r&&(r.value==null?r:r.value);return Kl(o instanceof Array?o[i]:o,this._dimensions[i])},typedArray:function(r,n,a,i){return r[i]}}}(),e}(),WH=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,a,i;if(d0(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,i=[c._getVersionSign()]}else s=o.get("data",!0),l=Qn(s)?Xl:Ba,i=[];var h=this._getSourceMetaRawOption()||{},f=u&&u.metaRawOption||{},v=Te(h.seriesLayoutBy,f.seriesLayoutBy)||null,g=Te(h.sourceHeader,f.sourceHeader),m=Te(h.dimensions,f.dimensions),y=v!==f.seriesLayoutBy||!!g!=!!f.sourceHeader||m;a=y?[XM(s,{seriesLayoutBy:v,sourceHeader:g,dimensions:m},l)]:[]}else{var x=t;if(n){var _=this._applyTransform(r);a=_.sourceList,i=_.upstreamSignList}else{var w=x.get("source",!0);a=[XM(w,this._getSourceMetaRawOption(),null)],i=[]}}this._setLocalSource(a,i)},e.prototype._applyTransform=function(t){var r=this._sourceHost,n=r.get("transform",!0),a=r.get("fromTransformResult",!0);if(a!=null){var i="";t.length!==1&&UR(i)}var o,s=[],l=[];return R(t,function(u){u.prepareSource();var c=u.getSource(a||0),h="";a!=null&&!c&&UR(h),s.push(c),l.push(u._getVersionSign())}),n?o=cie(n,s,{datasetIndex:r.componentIndex}):a!=null&&(o=[Wae(s[0])]),{sourceList:o,upstreamSignList:l}},e.prototype._isDirty=function(){if(this._dirty)return!0;for(var t=this._getUpstreamSourceManagers(),r=0;r0&&(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<=a)return o;if(e>=i)return s}else{if(e>=a)return o;if(e<=i)return s}else{if(e===a)return o;if(e===i)return s}return(e-a)/l*u+o}var me=yte;function yte(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 O_(e,t,r)}function O_(e,t,r){return ve(e)?VG(e)?parseFloat(e)/100*t+(r||0):parseFloat(e):e==null?NaN:+e}function xte(e){return ve(e)&&VG(e)}function VG(e){return!!gte(e).match(/%$/)}function Mt(e,t,r){return isNaN(t)?r?""+e:+e:(t=Et(at(0,t),E_),e=(+e).toFixed(t),r?e:+e)}function _te(e,t,r){return t==null&&(t=10),Mt(e,t,r)}function on(e){return e.sort(function(t,r){return t-r}),e}function _o(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,r=0;r<15;r++,t*=10)if(Fo(e*t)/t===e)return r}return GG(e)}function GG(e){var t=e.toString().toLowerCase(),r=t.indexOf("e"),n=r>0?+t.slice(r+1):0,a=r>0?r:t.length,i=t.indexOf("."),o=i<0?0:a-1-i;return at(0,o-n)}function bte(e,t){var r=mi(eh(e[1]-e[0])/Zg),n=Fo(eh(cr(t[1]-t[0]))/Zg),a=Et(at(-r+n,0),E_);return isFinite(a)?a:E_}function Ok(e,t,r){var n=cr(e[1]-e[0]);if(!isFinite(n)||n===0)return NaN;var a=eh(2*cr(r||1)*cr(n))/Zg,i=eh(cr(t))/Zg,o=at(0,Ph(-a+i));return isFinite(o)||(o=NaN),o}function wte(e,t,r){if(!e[t])return 0;var n=HG(e,r);return n[t]||0}function HG(e,t){var r=gi(e,function(v,g){return v+(isNaN(g)?0:g)},0);if(r===0)return[];for(var n=Dh(10,t),a=oe(e,function(v){return(isNaN(v)?0:v)/r*n*100}),i=n*100,o=oe(a,function(v){return mi(v)}),s=gi(o,function(v,g){return v+g},0),l=oe(a,function(v,g){return v-o[g]});su&&(u=l[h],c=h);++o[c],l[c]=0,++s}return oe(o,function(v){return v/n})}function pc(e,t){var r=at(_o(e),_o(t)),n=e+t;return r>E_?n:Mt(n,r)}var Yg=Dh(2,53)-1;function zk(e){var t=R_*2;return(e%t+t)%t}function th(e){return e>-kE&&e=10&&t++,t}var UG=2;function A1(e,t){var r=M1(e),n=Dh(10,r),a=e/n,i;return t===UG?i=1:t?a<1.5?i=1:a<2.5?i=2:a<4?i=3:a<7?i=5:i=10:a<1?i=1:a<2?i=2:a<3?i=3:a<5?i=5:i=10,e=i*n,Mt(e,-r)}function Dx(e,t){var r=(e.length-1)*t+1,n=mi(r),a=+e[n-1],i=r-n;return i?a+i*(e[n]-a):a}function MM(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 ES(e){e.option=e.parentModel=e.ecModel=null}function gn(){return[1/0,-1/0]}function NM(e,t){Hs(t)&&(te[1]&&(e[1]=t))}function QG(e,t){Hs(t)&&te[1]&&(e[1]=t)}function Gte(e,t){ah(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function Hs(e){return e!=null&&isFinite(e)}function ah(e,t){return Hs(e)&&Hs(t)&&e<=t}function Hte(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function jx(e){ah(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function lv(){var e="__ec_once_"+Ute++;return function(t,r){Se(t,e)||(t[e]=1,r())}}var Ute=Vk();function N1(e,t,r){var n=we(),a=0;R(e,function(i){var o=t(i),s=n.get(o)||0;r&&r(i,s),!s&&!r&&(e[a++]=i),n.set(o,s+1)}),r||(e.length=a)}function Wte(e){return e.value+""}function $te(e){return e+""}function Io(e,t){return Te(t,!0)?e.seriesIndex+2:0}function t7(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 Hr(e,t){return{seriesType:e,overallReset:t}}function Vm(e){return{overallReset:e}}var Zte=".",Uu="___EC__COMPONENT__CONTAINER___",r7="___EC__EXTENDED_CLASS___";function bo(e){var t={main:"",sub:""};if(e){var r=e.split(Zte);t.main=r[0]||"",t.sub=r[1]||""}return t}function Yte(e){bn(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),'componentType "'+e+'" illegal')}function Xte(e){return!!(e&&e[r7])}function Wk(e,t){e.$constructor=e,e.extend=function(r){var n=this,a;return qte(n)?a=function(i){q(o,i);function o(){return i.apply(this,arguments)||this}return o}(n):(a=function(){(r.$constructor||n).apply(this,arguments)},kk(a,this)),te(a.prototype,r),a[r7]=!0,a.extend=this.extend,a.superCall=Qte,a.superApply=ere,a.superClass=n,a}}function qte(e){return Le(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function n7(e,t){e.extend=t.extend}var Kte=Math.round(Math.random()*10);function Jte(e){var t=["__\0is_clz",Kte++].join("_");e.prototype[t]=!0,e.isInstance=function(r){return!!(r&&r[t])}}function Qte(e,t){for(var r=[],n=2;n=0||i&&Ye(i,l)<0)){var u=n.getShallow(l,t);u!=null&&(o[e[s][0]]=u)}}return o}}var tre=[["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]],rre=ih(tre),nre=function(){function e(){}return e.prototype.getAreaStyle=function(t,r){return rre(this,t,r)},e}(),kM=new Pf(50);function are(e){if(typeof e=="string"){var t=kM.get(e);return t&&t.image}else return e}function $k(e,t,r,n,a){if(e)if(typeof e=="string"){if(t&&t.__zrImageSrc===e||!r)return t;var i=kM.get(e),o={hostEl:r,cb:n,cbPayload:a};return i?(t=i.image,!L1(t)&&i.pending.push(o)):(t=qr.loadImage(e,DE,DE),t.__zrImageSrc=e,kM.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}else return e;else return t}function DE(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;t=s;u++)l-=s;var c=Lo(o,r);return c>l&&(r="",c=0),l=e-c,a.ellipsis=r,a.ellipsisWidth=c,a.contentWidth=l,a.containerWidth=e,a}function o7(e,t,r){var n=r.containerWidth,a=r.contentWidth,i=r.fontMeasureInfo;if(!n){e.textLine="",e.isTruncated=!1;return}var o=Lo(i,t);if(o<=n){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=a||s>=r.maxIterations){t+=r.ellipsis;break}var l=s===0?ore(t,a,i):o>0?Math.floor(t.length*a/o):0;t=t.substr(0,l),o=Lo(i,t)}t===""&&(t=r.placeholder),e.textLine=t,e.isTruncated=!0}function ore(e,t,r){for(var n=0,a=0,i=e.length;ay&&v){var w=Math.floor(y/f);g=g||x.length>w,x=x.slice(0,w),_=x.length*f}if(a&&c&&m!=null)for(var S=i7(m,u,t.ellipsis,{minChar:t.truncateMinChar,placeholder:t.placeholder}),C={},M=0;Mg&&OS(i,o.substring(g,y),t,v),OS(i,m[2],t,v,m[1]),g=RS.lastIndex}gh){var W=i.lines.length;z>0?(I.tokens=I.tokens.slice(0,z),A(I,j,P),i.lines=i.lines.slice(0,k+1)):i.lines=i.lines.slice(0,k),i.isTruncated=i.isTruncated||i.lines.length0&&g+n.accumWidth>n.width&&(c=t.split(` +`),u=!0),n.accumWidth=g}else{var m=s7(t,l,n.width,n.breakAll,n.accumWidth);n.accumWidth=m.accumWidth+v,h=m.linesWidths,c=m.lines}}c||(c=t.split(` +`));for(var y=ko(l),x=0;x=32&&t<=591||t>=880&&t<=4351||t>=4608&&t<=5119||t>=7680&&t<=8303}var dre=gi(",&?/;] ".split(""),function(e,t){return e[t]=!0,e},{});function fre(e){return hre(e)?!!dre[e]:!0}function s7(e,t,r,n,a){for(var i=[],o=[],s="",l="",u=0,c=0,h=ko(t),f=0;fr:a+c+g>r){c?(s||l)&&(m?(s||(s=l,l="",u=0,c=u),i.push(s),o.push(c-u),l+=v,u+=g,s="",c=u):(l&&(s+=l,l="",u=0),i.push(s),o.push(c),s=v,c=g)):m?(i.push(l),o.push(u),l=v,u=g):(i.push(v),o.push(g));continue}c+=g,m?(l+=v,u+=g):(l&&(s+=l,l="",u=0),s+=v)}return l&&(s+=l),s&&(i.push(s),o.push(c)),i.length===1&&(c+=a),{accumWidth:c,lines:i,linesWidths:o}}function EE(e,t,r,n,a,i){if(e.baseX=r,e.baseY=n,e.outerWidth=e.outerHeight=null,!!t){var o=t.width*2,s=t.height*2;je.set(RE,Df(r,o,a),zc(n,s,i),o,s),je.intersect(t,RE,null,OE);var l=OE.outIntersectRect;e.outerWidth=l.width,e.outerHeight=l.height,e.baseX=Df(l.x,l.width,a,!0),e.baseY=zc(l.y,l.height,i,!0)}}var RE=new je(0,0,0,0),OE={outIntersectRect:{},clamp:!0};function Zk(e){return e!=null?e+="":e=""}function vre(e){var t=Zk(e.text),r=e.font,n=Lo(ko(r),t),a=Fm(r);return LM(e,n,a,null)}function LM(e,t,r,n){var a=new je(Df(e.x||0,t,e.textAlign),zc(e.y||0,r,e.textBaseline),t,r),i=n??(l7(e)?e.lineWidth:0);return i>0&&(a.x-=i/2,a.y-=i/2,a.width+=i,a.height+=i),a}function l7(e){var t=e.stroke;return t!=null&&t!=="none"&&e.lineWidth>0}var IM="__zr_style_"+Math.round(Math.random()*10),Bc={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},I1={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};Bc[IM]=!0;var zE=["z","z2","invisible"],pre=["invisible"],xi=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype._init=function(r){for(var n=mt(r),a=0;a1e-4){s[0]=e-r,s[1]=t-n,l[0]=e+r,l[1]=t+n;return}if(Qy[0]=VS(a)*r+e,Qy[1]=FS(a)*n+t,e0[0]=VS(i)*r+e,e0[1]=FS(i)*n+t,u(s,Qy,e0),c(l,Qy,e0),a=a%Wu,a<0&&(a=a+Wu),i=i%Wu,i<0&&(i=i+Wu),a>i&&!o?i+=Wu:aa&&(t0[0]=VS(v)*r+e,t0[1]=FS(v)*n+t,u(s,t0,s),c(l,t0,l))}var Xt={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},$u=[],Zu=[],io=[],cl=[],oo=[],so=[],GS=Math.min,HS=Math.max,Yu=Math.cos,Xu=Math.sin,hs=Math.abs,PM=Math.PI,xl=PM*2,US=typeof Float32Array<"u",Kv=[];function WS(e){var t=Math.round(e/PM*1e8)/1e8;return t%2*PM}function D1(e,t){var r=WS(e[0]);r<0&&(r+=xl);var n=r-e[0],a=e[1];a+=n,!t&&a-r>=xl?a=r+xl:t&&r-a>=xl?a=r-xl:!t&&r>a?a=r+(xl-WS(r-a)):t&&r0&&(this._ux=hs(n/D_/t)||0,this._uy=hs(n/D_/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(Xt.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=hs(t-this._xi),a=hs(r-this._yi),i=n>this._ux||a>this._uy;if(this.addData(Xt.L,t,r),this._ctx&&i&&this._ctx.lineTo(t,r),i)this._xi=t,this._yi=r,this._pendingPtDist=0;else{var o=n*n+a*a;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=r,this._pendingPtDist=o)}return this},e.prototype.bezierCurveTo=function(t,r,n,a,i,o){return this._drawPendingPt(),this.addData(Xt.C,t,r,n,a,i,o),this._ctx&&this._ctx.bezierCurveTo(t,r,n,a,i,o),this._xi=i,this._yi=o,this},e.prototype.quadraticCurveTo=function(t,r,n,a){return this._drawPendingPt(),this.addData(Xt.Q,t,r,n,a),this._ctx&&this._ctx.quadraticCurveTo(t,r,n,a),this._xi=n,this._yi=a,this},e.prototype.arc=function(t,r,n,a,i,o){this._drawPendingPt(),Kv[0]=a,Kv[1]=i,D1(Kv,o),a=Kv[0],i=Kv[1];var s=i-a;return this.addData(Xt.A,t,r,n,n,a,s,0,o?0:1),this._ctx&&this._ctx.arc(t,r,n,a,i,o),this._xi=Yu(i)*n+t,this._yi=Xu(i)*n+r,this},e.prototype.arcTo=function(t,r,n,a,i){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(t,r,n,a,i),this},e.prototype.rect=function(t,r,n,a){return this._drawPendingPt(),this._ctx&&this._ctx.rect(t,r,n,a),this.addData(Xt.R,t,r,n,a),this},e.prototype.closePath=function(){this._drawPendingPt(),this.addData(Xt.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)&&US&&(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(){io[0]=io[1]=oo[0]=oo[1]=Number.MAX_VALUE,cl[0]=cl[1]=so[0]=so[1]=-Number.MAX_VALUE;var t=this.data,r=0,n=0,a=0,i=0,o;for(o=0;on||hs(w)>a||f===r-1)&&(m=Math.sqrt(_*_+w*w),i=y,o=x);break}case Xt.C:{var S=t[f++],C=t[f++],y=t[f++],x=t[f++],M=t[f++],A=t[f++];m=_ee(i,o,S,C,y,x,M,A,10),i=M,o=A;break}case Xt.Q:{var S=t[f++],C=t[f++],y=t[f++],x=t[f++];m=wee(i,o,S,C,y,x,10),i=y,o=x;break}case Xt.A:var k=t[f++],I=t[f++],P=t[f++],j=t[f++],z=t[f++],D=t[f++],B=D+z;f+=1,g&&(s=Yu(z)*P+k,l=Xu(z)*j+I),m=HS(P,j)*GS(xl,Math.abs(D)),i=Yu(B)*P+k,o=Xu(B)*j+I;break;case Xt.R:{s=i=t[f++],l=o=t[f++];var H=t[f++],V=t[f++];m=H*2+V*2;break}case Xt.Z:{var _=s-i,w=l-o;m=Math.sqrt(_*_+w*w),i=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,a=this._ux,i=this._uy,o=this._len,s,l,u,c,h,f,v=r<1,g,m,y=0,x=0,_,w=0,S,C;if(!(v&&(this._pathSegLen||this._calculateLength(),g=this._pathSegLen,m=this._pathLen,_=r*m,!_)))e:for(var M=0;M0&&(t.lineTo(S,C),w=0),A){case Xt.M:s=u=n[M++],l=c=n[M++],t.moveTo(u,c);break;case Xt.L:{h=n[M++],f=n[M++];var I=hs(h-u),P=hs(f-c);if(I>a||P>i){if(v){var j=g[x++];if(y+j>_){var z=(_-y)/j;t.lineTo(u*(1-z)+h*z,c*(1-z)+f*z);break e}y+=j}t.lineTo(h,f),u=h,c=f,w=0}else{var D=I*I+P*P;D>w&&(S=h,C=f,w=D)}break}case Xt.C:{var B=n[M++],H=n[M++],V=n[M++],U=n[M++],F=n[M++],W=n[M++];if(v){var j=g[x++];if(y+j>_){var z=(_-y)/j;iu(u,B,V,F,z,$u),iu(c,H,U,W,z,Zu),t.bezierCurveTo($u[1],Zu[1],$u[2],Zu[2],$u[3],Zu[3]);break e}y+=j}t.bezierCurveTo(B,H,V,U,F,W),u=F,c=W;break}case Xt.Q:{var B=n[M++],H=n[M++],V=n[M++],U=n[M++];if(v){var j=g[x++];if(y+j>_){var z=(_-y)/j;Gg(u,B,V,z,$u),Gg(c,H,U,z,Zu),t.quadraticCurveTo($u[1],Zu[1],$u[2],Zu[2]);break e}y+=j}t.quadraticCurveTo(B,H,V,U),u=V,c=U;break}case Xt.A:var $=n[M++],Z=n[M++],J=n[M++],re=n[M++],Q=n[M++],le=n[M++],de=n[M++],He=!n[M++],ye=J>re?J:re,ne=hs(J-re)>.001,xe=Q+le,he=!1;if(v){var j=g[x++];y+j>_&&(xe=Q+le*(_-y)/j,he=!0),y+=j}if(ne&&t.ellipse?t.ellipse($,Z,J,re,de,Q,xe,He):t.arc($,Z,ye,Q,xe,He),he)break e;k&&(s=Yu(Q)*J+$,l=Xu(Q)*re+Z),u=Yu(xe)*J+$,c=Xu(xe)*re+Z;break;case Xt.R:s=u=n[M],l=c=n[M+1],h=n[M++],f=n[M++];var ge=n[M++],tt=n[M++];if(v){var j=g[x++];if(y+j>_){var Ue=_-y;t.moveTo(h,f),t.lineTo(h+GS(Ue,ge),f),Ue-=ge,Ue>0&&t.lineTo(h+ge,f+GS(Ue,tt)),Ue-=tt,Ue>0&&t.lineTo(h+HS(ge-Ue,0),f+tt),Ue-=ge,Ue>0&&t.lineTo(h,f+HS(tt-Ue,0));break e}y+=j}t.rect(h,f,ge,tt);break;case Xt.Z:if(v){var j=g[x++];if(y+j>_){var z=(_-y)/j;t.lineTo(u*(1-z)+s*z,c*(1-z)+l*z);break e}y+=j}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=Xt,e.initDefaultProps=function(){var t=e.prototype;t._saveData=!0,t._ux=0,t._uy=0,t._pendingPtDist=0,t._version=0}(),e}();function Sl(e,t,r,n,a,i,o){if(a===0)return!1;var s=a,l=0,u=e;if(o>t+s&&o>n+s||oe+s&&i>r+s||it+h&&c>n+h&&c>i+h&&c>s+h||ce+h&&u>r+h&&u>a+h&&u>o+h||ut+u&&l>n+u&&l>i+u||le+u&&s>r+u&&s>a+u||sr||c+ua&&(a+=Jv);var f=Math.atan2(l,s);return f<0&&(f+=Jv),f>=n&&f<=a||f+Jv>=n&&f+Jv<=a}function ys(e,t,r,n,a,i){if(i>t&&i>n||ia?s:0}var hl=Go.CMD,qu=Math.PI*2,wre=1e-4;function Sre(e,t){return Math.abs(e-t)t&&u>n&&u>i&&u>s||u1&&Cre(),v=$r(t,n,i,s,ei[0]),f>1&&(g=$r(t,n,i,s,ei[1]))),f===2?yt&&s>n&&s>i||s=0&&u<=1){for(var c=0,h=an(t,n,i,u),f=0;fr||s<-r)return 0;var l=Math.sqrt(r*r-s*s);Xn[0]=-l,Xn[1]=l;var u=Math.abs(n-a);if(u<1e-4)return 0;if(u>=qu-1e-4){n=0,a=qu;var c=i?1:-1;return o>=Xn[0]+e&&o<=Xn[1]+e?c:0}if(n>a){var h=n;n=a,a=h}n<0&&(n+=qu,a+=qu);for(var f=0,v=0;v<2;v++){var g=Xn[v];if(g+e>o){var m=Math.atan2(s,g),c=i?1:-1;m<0&&(m=qu+m),(m>=n&&m<=a||m+qu>=n&&m+qu<=a)&&(m>Math.PI/2&&m1&&(r||(s+=ys(l,u,c,h,n,a))),y&&(l=i[g],u=i[g+1],c=l,h=u),m){case hl.M:c=i[g++],h=i[g++],l=c,u=h;break;case hl.L:if(r){if(Sl(l,u,i[g],i[g+1],t,n,a))return!0}else s+=ys(l,u,i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case hl.C:if(r){if(_re(l,u,i[g++],i[g++],i[g++],i[g++],i[g],i[g+1],t,n,a))return!0}else s+=Tre(l,u,i[g++],i[g++],i[g++],i[g++],i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case hl.Q:if(r){if(u7(l,u,i[g++],i[g++],i[g],i[g+1],t,n,a))return!0}else s+=Mre(l,u,i[g++],i[g++],i[g],i[g+1],n,a)||0;l=i[g++],u=i[g++];break;case hl.A:var x=i[g++],_=i[g++],w=i[g++],S=i[g++],C=i[g++],M=i[g++];g+=1;var A=!!(1-i[g++]);f=Math.cos(C)*w+x,v=Math.sin(C)*S+_,y?(c=f,h=v):s+=ys(l,u,f,v,n,a);var k=(n-x)*S/w+x;if(r){if(bre(x,_,S,C,C+M,A,t,k,a))return!0}else s+=Are(x,_,S,C,C+M,A,k,a);l=Math.cos(C+M)*w+x,u=Math.sin(C+M)*S+_;break;case hl.R:c=l=i[g++],h=u=i[g++];var I=i[g++],P=i[g++];if(f=c+I,v=h+P,r){if(Sl(c,h,f,h,t,n,a)||Sl(f,h,f,v,t,n,a)||Sl(f,v,c,v,t,n,a)||Sl(c,v,c,h,t,n,a))return!0}else s+=ys(f,h,f,v,n,a),s+=ys(c,v,c,h,n,a);break;case hl.Z:if(r){if(Sl(l,u,c,h,t,n,a))return!0}else s+=ys(l,u,c,h,n,a);l=c,u=h;break}}return!r&&!Sre(u,h)&&(s+=ys(l,u,c,h,n,a)||0),s!==0}function Nre(e,t,r){return c7(e,0,!1,t,r)}function kre(e,t,r,n){return c7(e,t,!0,r,n)}var z_=Ee({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},Bc),Lre={style:Ee({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},I1.style)},$S=Gs.concat(["invisible","culling","z","z2","zlevel","parent"]),pt=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 a=this._decalEl=this._decalEl||new t;a.buildPath===t.prototype.buildPath&&(a.buildPath=function(l){r.buildPath(l,r.shape)}),a.silent=!0;var i=a.style;for(var o in n)i[o]!==n[o]&&(i[o]=n[o]);i.fill=n.fill?n.decal:null,i.decal=null,i.shadowColor=null,n.strokeFirst&&(i.stroke=null);for(var s=0;s<$S.length;++s)a[$S[s]]=this[$S[s]];a.__dirty|=da}else this._decalEl&&(this._decalEl=null)},t.prototype.getDecalElement=function(){return this._decalEl},t.prototype._init=function(r){var n=mt(r);this.shape=this.getDefaultShape();var a=this.getDefaultStyle();a&&this.useStyle(a);for(var i=0;i.5?wM:n>.2?Qee:SM}else if(r)return SM}return wM},t.prototype.getInsideTextStroke=function(r){var n=this.style.fill;if(ve(n)){var a=this.__zr,i=!!(a&&a.isDarkMode()),o=Wg(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,a=!r;if(a){var i=!1;this.path||(i=!0,this.createPathProxy());var o=this.path;(i||this.__dirty&Dd)&&(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||a){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 a=this.transformCoordToLocal(r,n),i=this.getBoundingRect(),o=this.style;if(r=a[0],n=a[1],i.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)),kre(s,l/u,r,n)))return!0}if(this.hasFill())return Nre(s,r,n)}return!1},t.prototype.dirtyShape=function(){this.__dirty|=Dd,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 a=this.shape;return a||(a=this.shape={}),typeof r=="string"?a[r]=n:te(a,r),this.dirtyShape(),this},t.prototype.shapeChanged=function(){return!!(this.__dirty&Dd)},t.prototype.createStyle=function(r){return Bm(z_,r)},t.prototype._innerSaveToNormal=function(r){e.prototype._innerSaveToNormal.call(this,r);var n=this._normalState;r.shape&&!n.shape&&(n.shape=te({},this.shape))},t.prototype._applyStateObj=function(r,n,a,i,o,s){if(e.prototype._applyStateObj.call(this,r,n,a,i,o,s),this.__inHover!==C1){var l=!(n&&i),u;if(n&&n.shape?o?i?u=n.shape:(u=te({},a.shape),te(u,n.shape)):(u=te({},i?this.shape:a.shape),te(u,n.shape)):l&&(u=a.shape),u)if(o){this.shape=te({},this.shape);for(var c={},h=mt(u),f=0;fa&&(h=s+l,s*=a/h,l*=a/h),u+c>a&&(h=u+c,u*=a/h,c*=a/h),l+u>i&&(h=l+u,l*=i/h,u*=i/h),s+c>i&&(h=s+c,s*=i/h,c*=i/h),e.moveTo(r+s,n),e.lineTo(r+a-l,n),l!==0&&e.arc(r+a-l,n+l,l,-Math.PI/2,0),e.lineTo(r+a,n+i-u),u!==0&&e.arc(r+a-u,n+i-u,u,0,Math.PI/2),e.lineTo(r+c,n+i),c!==0&&e.arc(r+c,n+i-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 Kd=Math.round;function j1(e,t,r){if(t){var n=t.x1,a=t.x2,i=t.y1,o=t.y2;e.x1=n,e.x2=a,e.y1=i,e.y2=o;var s=r&&r.lineWidth;return s&&(Kd(n*2)===Kd(a*2)&&(e.x1=e.x2=Pa(n,s,!0)),Kd(i*2)===Kd(o*2)&&(e.y1=e.y2=Pa(i,s,!0))),e}}function h7(e,t,r){if(t){var n=t.x,a=t.y,i=t.width,o=t.height;e.x=n,e.y=a,e.width=i,e.height=o;var s=r&&r.lineWidth;return s&&(e.x=Pa(n,s,!0),e.y=Pa(a,s,!0),e.width=Math.max(Pa(n+i,s,!1)-e.x,i===0?0:1),e.height=Math.max(Pa(a+o,s,!1)-e.y,o===0?0:1)),e}}function Pa(e,t,r){if(!t)return e;var n=Kd(e*2);return(n+Kd(t))%2===0?n/2:(n+(r?1:-1))/2}var Rre=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0}return e}(),Ore={},it=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new Rre},t.prototype.buildPath=function(r,n){var a,i,o,s;if(this.subPixelOptimize){var l=h7(Ore,n,this.style);a=l.x,i=l.y,o=l.width,s=l.height,l.r=n.r,n=l}else a=n.x,i=n.y,o=n.width,s=n.height;n.r?Ere(r,n):r.rect(a,i,o,s)},t.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},t}(pt);it.prototype.type="rect";var HE={fill:"#000"},UE=2,lo={},zre={style:Ee({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},I1.style)},wt=function(e){q(t,e);function t(r){var n=e.call(this)||this;return n.type="text",n._children=[],n._defaultStyle=HE,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,z=0;z=0&&(B=M[D],B.align==="right");)this._placeToken(B,r,k,x,z,"right",w),I-=B.width,z-=B.width,D--;for(j+=(c-(j-y)-(_-z)-I)/2;P<=D;)B=M[P],this._placeToken(B,r,k,x,j+B.width/2,"center",w),j+=B.width,P++;x+=k}},t.prototype._placeToken=function(r,n,a,i,o,s,l){var u=n.rich[r.styleName]||{};u.text=r.text;var c=r.verticalAlign,h=i+a/2;c==="top"?h=i+r.height/2:c==="bottom"&&(h=i+a-r.height/2);var f=!r.isLineHolder&&ZS(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 v=!!u.backgroundColor,g=r.textPadding;g&&(o=qE(o,s,g),h-=r.height/2-g[0]-r.innerHeight/2);var m=this._getOrCreateChild(jf),y=m.createStyle();m.useStyle(y);var x=this._defaultStyle,_=!1,w=0,S=!1,C=XE("fill"in u?u.fill:"fill"in n?n.fill:(_=!0,x.fill)),M=YE("stroke"in u?u.stroke:"stroke"in n?n.stroke:!v&&!l&&(!x.autoStroke||_)?(w=UE,S=!0,x.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||Fs,y.opacity=ya(u.opacity,n.opacity,1),$E(y,u),M&&(y.lineWidth=ya(u.lineWidth,n.lineWidth,w),y.lineDash=Te(u.lineDash,n.lineDash),y.lineDashOffset=n.lineDashOffset||0,y.stroke=M),C&&(y.fill=C),m.setBoundingRect(LM(y,r.contentWidth,r.contentHeight,S?0:null))},t.prototype._renderBackground=function(r,n,a,i,o,s){var l=r.backgroundColor,u=r.borderWidth,c=r.borderColor,h=l&&l.image,f=l&&!h,v=r.borderRadius,g=this,m,y;if(f||r.lineHeight||u&&c){m=this._getOrCreateChild(it),m.useStyle(m.createStyle()),m.style.fill=null;var x=m.shape;x.x=a,x.y=i,x.width=o,x.height=s,x.r=v,m.dirtyShape()}if(f){var _=m.style;_.fill=l||null,_.fillOpacity=Te(r.fillOpacity,1)}else if(h){y=this._getOrCreateChild(Qr),y.onload=function(){g.dirtyStyle()};var w=y.style;w.image=l.image,w.x=a,w.y=i,w.width=o,w.height=s}if(u&&c){var _=m.style;_.lineWidth=u,_.stroke=c,_.strokeOpacity=Te(r.strokeOpacity,1),_.lineDash=r.borderDash,_.lineDashOffset=r.borderDashOffset||0,m.strokeContainThreshold=0,m.hasFill()&&m.hasStroke()&&(_.strokeFirst=!0,_.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=ya(r.opacity,n.opacity,1)},t.makeFont=function(r){var n="";return f7(r)&&(n=[r.fontStyle,r.fontWeight,d7(r.fontSize),r.fontFamily||"sans-serif"].join(" ")),n&&La(n)||r.textFont||r.font},t}(xi),Bre={left:!0,right:1,center:1},Fre={top:1,bottom:1,middle:1},WE=["fontStyle","fontWeight","fontSize","fontFamily"];function d7(e){return typeof e=="string"&&(e.indexOf("px")!==-1||e.indexOf("rem")!==-1||e.indexOf("em")!==-1)?e:isNaN(+e)?Tk+"px":e+"px"}function $E(e,t){for(var r=0;r=0,i=!1;if(e instanceof pt){var o=x7(e),s=a&&o.selectFill||o.normalFill,l=a&&o.selectStroke||o.normalStroke;if(hd(s)||hd(l)){n=n||{};var u=n.style||{};u.fill==="inherit"?(i=!0,n=te({},n),u=te({},u),u.fill=s):!hd(u.fill)&&hd(s)?(i=!0,n=te({},n),u=te({},u),u.fill=I_(s)):!hd(u.stroke)&&hd(l)&&(i||(n=te({},n),u=te({},u)),u.stroke=I_(l)),n.style=u}}if(n&&n.z2==null){i||(n=te({},n));var c=e.z2EmphasisLift;n.z2=e.z2+(c??cv)}return n}function Yre(e,t,r){if(r&&r.z2==null){r=te({},r);var n=e.z2SelectLift;r.z2=e.z2+(n??Hre)}return r}function Xre(e,t,r){var n=Ye(e.currentStates,t)>=0,a=e.style.opacity,i=n?null:$re(e,["opacity"],t,{opacity:1});r=r||{};var o=r.style||{};return o.opacity==null&&(r=te({},r),o=te({opacity:n?a:i.opacity*.1},o),r.style=o),r}function YS(e,t){var r=this.states[e];if(this.style){if(e==="emphasis")return Zre(this,e,t,r);if(e==="blur")return Xre(this,e,r);if(e==="select")return Yre(this,e,r)}return r}function oh(e){e.stateProxy=YS;var t=e.getTextContent(),r=e.getTextGuideLine();t&&(t.stateProxy=YS),r&&(r.stateProxy=YS)}function tR(e,t){!M7(e,t)&&!e.__highByOuter&&Qs(e,_7)}function rR(e,t){!M7(e,t)&&!e.__highByOuter&&Qs(e,b7)}function Us(e,t){e.__highByOuter|=1<<(t||0),Qs(e,_7)}function Ws(e,t){!(e.__highByOuter&=~(1<<(t||0)))&&Qs(e,b7)}function S7(e){Qs(e,Kk)}function Jk(e){Qs(e,w7)}function C7(e){Qs(e,Ure)}function T7(e){Qs(e,Wre)}function M7(e,t){return e.__highDownSilentOnTouch&&t.zrByTouch}function A7(e){var t=e.getModel(),r=[],n=[];t.eachComponent(function(a,i){var o=Yk(i),s=y7(e,i),l=a==="series";!l&&n.push(s),o.isBlured&&(s.group.traverse(function(u){w7(u)}),l&&r.push(i)),o.isBlured=!1}),R(n,function(a){a&&a.toggleBlurSeries&&a.toggleBlurSeries(r,!1,t)})}function EM(e,t,r,n){var a=n.getModel();r=r||"coordinateSystem";function i(u,c){for(var h=0;h0){var s={dataIndex:o,seriesIndex:r.seriesIndex};i!=null&&(s.dataType=i),t.push(s)}})}),t}function ql(e,t,r){Ic(e,!0),Qs(e,oh),OM(e,t,r)}function tne(e){Ic(e,!1)}function ir(e,t,r,n){n?tne(e):ql(e,t,r)}function OM(e,t,r){var n=Be(e);t!=null?(n.focus=t,n.blurScope=r):n.focus&&(n.focus=null)}var aR=["emphasis","blur","select"],rne={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function Vr(e,t,r,n){r=r||"itemStyle";for(var a=0;a1&&(o*=XS(g),s*=XS(g));var m=(a===i?-1:1)*XS((o*o*(s*s)-o*o*(v*v)-s*s*(f*f))/(o*o*(v*v)+s*s*(f*f)))||0,y=m*o*v/s,x=m*-s*f/o,_=(e+r)/2+n0(h)*y-r0(h)*x,w=(t+n)/2+r0(h)*y+n0(h)*x,S=lR([1,0],[(f-y)/o,(v-x)/s]),C=[(f-y)/o,(v-x)/s],M=[(-1*f-y)/o,(-1*v-x)/s],A=lR(C,M);if(BM(C,M)<=-1&&(A=Qv),BM(C,M)>=1&&(A=0),A<0){var k=Math.round(A/Qv*1e6)/1e6;A=Qv*2+k%2*Qv}c.addData(u,_,w,o,s,S,A,h,i)}var lne=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig,une=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;function cne(e){var t=new Go;if(!e)return t;var r=0,n=0,a=r,i=n,o,s=Go.CMD,l=e.match(lne);if(!l)return t;for(var u=0;uB*B+H*H&&(k=P,I=j),{cx:k,cy:I,x0:-c,y0:-h,x1:k*(a/C-1),y1:I*(a/C-1)}}function mne(e){var t;if(ae(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 yne(e,t){var r,n=Rp(t.r,0),a=Rp(t.r0||0,0),i=n>0,o=a>0;if(!(!i&&!o)){if(i||(n=a,a=0),a>n){var s=n;n=a,a=s}var l=t.startAngle,u=t.endAngle;if(!(isNaN(l)||isNaN(u))){var c=t.cx,h=t.cy,f=!!t.clockwise,v=cR(u-l),g=v>qS&&v%qS;if(g>ki&&(v=g),!(n>ki))e.moveTo(c,h);else if(v>qS-ki)e.moveTo(c+n*fd(l),h+n*Ku(l)),e.arc(c,h,n,l,u,!f),a>ki&&(e.moveTo(c+a*fd(u),h+a*Ku(u)),e.arc(c,h,a,u,l,f));else{var m=void 0,y=void 0,x=void 0,_=void 0,w=void 0,S=void 0,C=void 0,M=void 0,A=void 0,k=void 0,I=void 0,P=void 0,j=void 0,z=void 0,D=void 0,B=void 0,H=n*fd(l),V=n*Ku(l),U=a*fd(u),F=a*Ku(u),W=v>ki;if(W){var $=t.cornerRadius;$&&(r=mne($),m=r[0],y=r[1],x=r[2],_=r[3]);var Z=cR(n-a)/2;if(w=uo(Z,x),S=uo(Z,_),C=uo(Z,m),M=uo(Z,y),I=A=Rp(w,S),P=k=Rp(C,M),(A>ki||k>ki)&&(j=n*fd(u),z=n*Ku(u),D=a*fd(l),B=a*Ku(l),vki){var ne=uo(x,I),xe=uo(_,I),he=a0(D,B,H,V,n,ne,f),ge=a0(j,z,U,F,n,xe,f);e.moveTo(c+he.cx+he.x0,h+he.cy+he.y0),I0&&e.arc(c+he.cx,h+he.cy,ne,Ln(he.y0,he.x0),Ln(he.y1,he.x1),!f),e.arc(c,h,n,Ln(he.cy+he.y1,he.cx+he.x1),Ln(ge.cy+ge.y1,ge.cx+ge.x1),!f),xe>0&&e.arc(c+ge.cx,h+ge.cy,xe,Ln(ge.y1,ge.x1),Ln(ge.y0,ge.x0),!f))}else e.moveTo(c+H,h+V),e.arc(c,h,n,l,u,!f);if(!(a>ki)||!W)e.lineTo(c+U,h+F);else if(P>ki){var ne=uo(m,P),xe=uo(y,P),he=a0(U,F,j,z,a,-xe,f),ge=a0(H,V,D,B,a,-ne,f);e.lineTo(c+he.cx+he.x0,h+he.cy+he.y0),P0&&e.arc(c+he.cx,h+he.cy,xe,Ln(he.y0,he.x0),Ln(he.y1,he.x1),!f),e.arc(c,h,a,Ln(he.cy+he.y1,he.cx+he.x1),Ln(ge.cy+ge.y1,ge.cx+ge.x1),f),ne>0&&e.arc(c+ge.cx,h+ge.cy,ne,Ln(ge.y1,ge.x1),Ln(ge.y0,ge.x0),!f))}else e.lineTo(c+U,h+F),e.arc(c,h,a,u,l,f)}e.closePath()}}}var xne=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}(),wn=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new xne},t.prototype.buildPath=function(r,n){yne(r,n)},t.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},t}(pt);wn.prototype.type="sector";var _ne=function(){function e(){this.cx=0,this.cy=0,this.r=0,this.r0=0}return e}(),hv=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new _ne},t.prototype.buildPath=function(r,n){var a=n.cx,i=n.cy,o=Math.PI*2;r.moveTo(a+n.r,i),r.arc(a,i,n.r,0,o,!1),r.moveTo(a+n.r0,i),r.arc(a,i,n.r0,0,o,!0)},t}(pt);hv.prototype.type="ring";function bne(e,t,r,n){var a=[],i=[],o=[],s=[],l,u,c,h;if(n){c=[1/0,1/0],h=[-1/0,-1/0];for(var f=0,v=e.length;f=2){if(n){var i=bne(a,n,r,t.smoothConstraint);e.moveTo(a[0][0],a[0][1]);for(var o=a.length,s=0;s<(r?o:o-1);s++){var l=i[s*2],u=i[s*2+1],c=a[(s+1)%o];e.bezierCurveTo(l[0],l[1],u[0],u[1],c[0],c[1])}}else{e.moveTo(a[0][0],a[0][1]);for(var s=1,h=a.length;sQu[1]){if(i=!1,rn.negativeSize||n)return i;var l=i0(Qu[0]-Ju[1]),u=i0(Ju[0]-Qu[1]);KS(l,u)>s0.len()&&(l=u||!rn.bidirectional)&&(Oe.scale(o0,s,-u*a),rn.useDir&&rn.calcDirMTV()))}}return i},e.prototype._getProjMinMaxOnAxis=function(t,r,n){for(var a=this._axes[t],i=this._origin,o=r[0].dot(a)+i[t],s=o,l=o,u=1;u0){var h=c.duration,f=c.delay,v=c.easing,g={duration:h,delay:f||0,easing:v,done:i,force:!!i||!!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),i&&i()}function At(e,t,r,n,a,i){rL("update",e,t,r,n,a,i)}function Qt(e,t,r,n,a,i){rL("enter",e,t,r,n,a,i)}function vf(e){if(!e.__zr)return!0;for(var t=0;tcr(i[1])?i[0]>0?"right":"left":i[1]>0?"bottom":"top"}function fR(e){return!e.isGroup}function Rne(e){return e.shape!=null}function $m(e,t,r){if(!e||!t)return;function n(o){var s={};return o.traverse(function(l){fR(l)&&l.anid&&(s[l.anid]=l)}),s}function a(o){var s={x:o.x,y:o.y,rotation:o.rotation};return Rne(o)&&(s.shape=ke(o.shape)),s}var i=n(e);t.traverse(function(o){if(fR(o)&&o.anid){var s=i[o.anid];if(s){var l=a(o);o.attr(a(s)),At(o,l,r,Be(o).dataIndex)}}})}function iL(e,t){return oe(e,function(r){var n=r[0];n=at(n,t.x),n=Et(n,t.x+t.width);var a=r[1];return a=at(a,t.y),a=Et(a,t.y+t.height),[n,a]})}function W7(e,t){var r=at(e.x,t.x),n=Et(e.x+e.width,t.x+t.width),a=at(e.y,t.y),i=Et(e.y+e.height,t.y+t.height);if(n>=r&&i>=a)return{x:r,y:a,width:n-r,height:i-a}}function pv(e,t,r){var n=te({rectHover:!0},t),a=n.style={strokeNoScale:!0};if(r=r||{x:-1,y:-1,width:2,height:2},e)return e.indexOf("image://")===0?(a.image=e.slice(8),Ee(a,r),new Qr(n)):Ef(e.replace("path://",""),n,r,"center")}function Op(e,t,r,n,a){for(var i=0,o=a[a.length-1];i1)return!1;var y=JS(v,g,c,h)/f;return!(y<0||y>1)}function JS(e,t,r,n){return e*n-r*t}function One(e){return e<=1e-6&&e>=-1e-6}function sh(e,t,r,n,a){return t==null||(Tt(t)?or[0]=or[1]=or[2]=or[3]=t:(or[0]=t[0],or[1]=t[1],or[2]=t[2],or[3]=t[3]),n&&(or[0]=at(0,or[0]),or[1]=at(0,or[1]),or[2]=at(0,or[2]),or[3]=at(0,or[3])),r&&(or[0]=-or[0],or[1]=-or[1],or[2]=-or[2],or[3]=-or[3]),vR(e,or,"x","width",3,1,a&&a[0]||0),vR(e,or,"y","height",0,2,a&&a[1]||0)),e}var or=[0,0,0,0];function vR(e,t,r,n,a,i,o){var s=t[i]+t[a],l=e[n];e[n]+=s,o=at(0,Et(o,l)),e[n]=0?-t[a]:t[i]>=0?l+t[i]:cr(s)>1e-8?(l-o)*t[a]/s:0):e[r]-=t[a]}function el(e){var t=e.itemTooltipOption,r=e.componentModel,n=e.itemName,a=ve(t)?{formatter:t}:t,i=r.mainType,o=r.componentIndex,s={componentType:i,name:n,$vars:["name"]};s[i+"Index"]=o;var l=e.formatterParamsExtra;l&&R(mt(l),function(c){Se(s,c)||(s[c]=l[c],s.$vars.push(c))});var u=Be(e.el);u.componentMainType=i,u.componentIndex=o,u.tooltipConfig={name:n,option:Ee({content:n,encodeHTMLContent:!0,formatterParams:s},a)}}function VM(e,t){var r;e.isGroup&&(r=t(e)),r||e.traverse(t)}function Su(e,t){if(e)if(ae(e))for(var r=0;rt&&(t=o),ot&&(r=t=0),{min:r,max:t}}function z1(e,t,r){Y7(e,t,r,-1/0)}function Y7(e,t,r,n){if(e.ignoreModelZ)return n;var a=e.getTextContent(),i=e.getTextGuideLine(),o=e.isGroup;if(o)for(var s=e.childrenRef(),l=0;l=0&&s.push(l)}),s}}function Cu(e,t){return Je(Je({},e,!0),t,!0)}const Xne={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:". "}}}},qne={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 H_="ZH",cL="EN",pf=cL,zx={},hL={},eH=xt.domSupported?function(){var e=(document.documentElement.lang||navigator.language||navigator.browserLanguage||pf).toUpperCase();return e.indexOf(H_)>-1?H_:pf}():pf;function dL(e,t){e=e.toUpperCase(),hL[e]=new vt(t),zx[e]=t}function Kne(e){if(ve(e)){var t=zx[e.toUpperCase()]||{};return e===H_||e===cL?ke(t):Je(ke(t),ke(zx[pf]),!1)}else return Je(ke(e),ke(zx[pf]),!1)}function UM(e){return hL[e]}function Jne(){return hL[pf]}dL(cL,Xne);dL(H_,qne);var WM=null;function Qne(e){WM||(WM=e)}function Mr(){return WM}function tH(e,t){var r=Mr(),n=t.breakOption,a=t.breakParsed;return!a&&r&&(a=r.parseAxisBreakOption(n,e)),a}function U_(e){var t=e.brk;return t?t.breaks:[]}function W_(e){var t=e.brk;return t?t.hasBreaks():!1}var fL=1e3,vL=fL*60,dg=vL*60,ii=dg*24,xR=ii*365,eae={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})/},Bx={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}"},tae="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}",u0="{yyyy}-{MM}-{dd}",_R={year:"{yyyy}",month:"{yyyy}-{MM}",day:u0,hour:u0+" "+Bx.hour,minute:u0+" "+Bx.minute,second:u0+" "+Bx.second,millisecond:tae},Ma=["year","month","day","hour","minute","second","millisecond"],rae=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function nae(e){return!ve(e)&&!Le(e)?aae(e):e}function aae(e){e=e||{};var t={},r=!0;return R(Ma,function(n){r&&(r=e[n]==null)}),R(Ma,function(n,a){var i=e[n];t[n]={};for(var o=null,s=a;s>=0;s--){var l=Ma[s],u=Re(i)&&!ae(i)?i[l]:i,c=void 0;ae(u)?(c=u.slice(),o=c[0]||""):ve(u)?(o=u,c=[o]):(o==null?o=Bx[n]:eae[l].test(o)||(o=t[l][l][0]+" "+o),c=[o],r&&(c[1]="{primary|"+o+"}")),t[n][l]=c}}),t}function qn(e,t){return e+="","0000".substr(0,t-e.length)+e}function fg(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 iae(e){return e===fg(e)}function oae(e){switch(e){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function Zm(e,t,r,n){var a=qo(e),i=a[rH(r)](),o=a[pL(r)]()+1,s=Math.floor((o-1)/3)+1,l=a[gL(r)](),u=a["get"+(r?"UTC":"")+"Day"](),c=a[mL(r)](),h=(c-1)%12+1,f=a[yL(r)](),v=a[xL(r)](),g=a[_L(r)](),m=c>=12?"pm":"am",y=m.toUpperCase(),x=n instanceof vt?n:UM(n||eH)||Jne(),_=x.getModel("time"),w=_.get("month"),S=_.get("monthAbbr"),C=_.get("dayOfWeek"),M=_.get("dayOfWeekAbbr");return(t||"").replace(/{a}/g,m+"").replace(/{A}/g,y+"").replace(/{yyyy}/g,i+"").replace(/{yy}/g,qn(i%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,w[o-1]).replace(/{MMM}/g,S[o-1]).replace(/{MM}/g,qn(o,2)).replace(/{M}/g,o+"").replace(/{dd}/g,qn(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,C[u]).replace(/{ee}/g,M[u]).replace(/{e}/g,u+"").replace(/{HH}/g,qn(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,qn(h+"",2)).replace(/{h}/g,h+"").replace(/{mm}/g,qn(f,2)).replace(/{m}/g,f+"").replace(/{ss}/g,qn(v,2)).replace(/{s}/g,v+"").replace(/{SSS}/g,qn(g,3)).replace(/{S}/g,g+"")}function sae(e,t,r,n,a){var i=null;if(ve(r))i=r;else if(Le(r)){var o={time:e.time,level:e.time?e.time.level:0},s=Mr();s&&s.makeAxisLabelFormatterParamBreak(o,e.break),i=r(e.value,t,o)}else{var l=e.time;if(l){var u=r[l.lowerTimeUnit][l.upperTimeUnit];i=u[Math.min(l.level,u.length-1)]||""}else{var c=gf(e.value,a);i=r[c][c][0]}}return Zm(new Date(e.value),i,a,n)}function gf(e,t){var r=qo(e),n=r[pL(t)]()+1,a=r[gL(t)](),i=r[mL(t)](),o=r[yL(t)](),s=r[xL(t)](),l=r[_L(t)](),u=l===0,c=u&&s===0,h=c&&o===0,f=h&&i===0,v=f&&a===1,g=v&&n===1;return g?"year":v?"month":f?"day":h?"hour":c?"minute":u?"second":"millisecond"}function $_(e,t,r){switch(t){case"year":e[nH(r)](0);case"month":e[aH(r)](1);case"day":e[iH(r)](0);case"hour":e[oH(r)](0);case"minute":e[sH(r)](0);case"second":e[lH(r)](0)}return e}function rH(e){return e?"getUTCFullYear":"getFullYear"}function pL(e){return e?"getUTCMonth":"getMonth"}function gL(e){return e?"getUTCDate":"getDate"}function mL(e){return e?"getUTCHours":"getHours"}function yL(e){return e?"getUTCMinutes":"getMinutes"}function xL(e){return e?"getUTCSeconds":"getSeconds"}function _L(e){return e?"getUTCMilliseconds":"getMilliseconds"}function lae(e){return e?"setUTCFullYear":"setFullYear"}function nH(e){return e?"setUTCMonth":"setMonth"}function aH(e){return e?"setUTCDate":"setDate"}function iH(e){return e?"setUTCHours":"setHours"}function oH(e){return e?"setUTCMinutes":"setMinutes"}function sH(e){return e?"setUTCSeconds":"setSeconds"}function lH(e){return e?"setUTCMilliseconds":"setMilliseconds"}function uae(e,t,r,n,a,i,o,s){var l=new wt({style:{text:e,font:t,align:r,verticalAlign:n,padding:a,rich:i,overflow:o?"truncate":null,lineHeight:s}});return l.getBoundingRect()}function bL(e){if(!Fk(e))return ve(e)?e:"-";var t=(e+"").split(".");return t[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function wL(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 mv=zm;function $M(e,t,r){var n="{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}";function a(c){return c&&La(c)?c:"-"}function i(c){return yi(c)}var o=t==="time",s=e instanceof Date;if(o||s){var l=o?qo(e):e;if(isNaN(+l)){if(s)return"-"}else return Zm(l,n,r)}if(t==="ordinal")return S_(e)?a(e):Tt(e)&&i(e)?e+"":"-";var u=Vo(e);return i(u)?bL(u):S_(e)?a(e):typeof e=="boolean"?e+"":"-"}var bR=["a","b","c","d","e","f","g"],tC=function(e,t){return"{"+e+(t??"")+"}"};function SL(e,t,r){ae(t)||(t=[t]);var n=t.length;if(!n)return"";for(var a=t[0].$vars||[],i=0;i':'';var o=r.markerId||"markerX";return{renderMode:i,content:"{"+o+"|} ",style:a==="subItem"?{width:4,height:4,borderRadius:2,backgroundColor:n}:{width:10,height:10,borderRadius:5,backgroundColor:n}}}function cae(e,t,r){(e==="week"||e==="month"||e==="quarter"||e==="half-year"||e==="year")&&(e=`MM-dd +yyyy`);var n=qo(t),a=r?"getUTC":"get",i=n[a+"FullYear"](),o=n[a+"Month"]()+1,s=n[a+"Date"](),l=n[a+"Hours"](),u=n[a+"Minutes"](),c=n[a+"Seconds"](),h=n[a+"Milliseconds"]();return e=e.replace("MM",qn(o,2)).replace("M",o).replace("yyyy",i).replace("yy",qn(i%100+"",2)).replace("dd",qn(s,2)).replace("d",s).replace("hh",qn(l,2)).replace("h",l).replace("mm",qn(u,2)).replace("m",u).replace("ss",qn(c,2)).replace("s",c).replace("SSS",qn(h,3)),e}function hae(e){return e&&e.charAt(0).toUpperCase()+e.substr(1)}function uh(e,t){return t=t||"transparent",ve(e)?e:Re(e)&&e.colorStops&&(e.colorStops[0]||{}).color||t}function Z_(e,t){if(t==="_blank"||t==="blank"){var r=window.open();r.opener=null,r.location.href=e}else window.open(e,t)}var Fx={},rC={},yv=function(){function e(){this._normalMasterList=[],this._nonSeriesBoxMasterList=[]}return e.prototype.create=function(t,r){this._nonSeriesBoxMasterList=n(Fx),this._normalMasterList=n(rC);function n(a,i){var o=[];return R(a,function(s,l){var u=s.create(t,r);o=o.concat(u||[])}),o}},e.prototype.update=function(t,r){R(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"){Fx[t]=r;return}rC[t]=r},e.get=function(t){return rC[t]||Fx[t]},e}();function dae(e){return!!Fx[e]}var fae=1,hH=2;function vae(e){dH.set(e.fullType,{getCoord2:void 0}).getCoord2=e.getCoord2}var dH=we();function fH(e){var t=e.getShallow("coord",!0),r=fae;if(t==null){var n=dH.get(e.type);n&&n.getCoord2&&(r=hH,t=n.getCoord2(e))}return{coord:t,from:r}}var mf=0,Vx=1,vH=2;function pH(e,t){var r=e.getShallow("coordinateSystem"),n=e.getShallow("coordinateSystemUsage",!0),a=mf;if(r){var i=e.mainType==="series";n==null&&(n=i?"data":"box"),n==="data"?(a=Vx,i||(a=mf)):n==="box"&&(a=vH,!i&&!dae(r)&&(a=mf))}return{coordSysType:r,kind:a}}function Ym(e){var t=e.targetModel,r=e.coordSysType,n=e.coordSysProvider,a=e.isDefaultDataCoordSys;e.allowNotFound;var i=pH(t),o=i.kind,s=i.coordSysType;if(a&&o!==Vx&&(o=Vx,s=r),o===mf||s!==r)return mf;var l=n(r,t);return l?(o===Vx?t.coordinateSystem=l:t.boxCoordinateSystem=l,o):mf}var gH=function(e,t){var r=t.getReferringComponents(e,pr).models[0];return r&&r.coordinateSystem},Gx=R,mH=["left","right","top","bottom","width","height"],Pc=[["width","left","right"],["height","top","bottom"]];function CL(e,t,r,n,a){var i=0,o=0;n==null&&(n=1/0),a==null&&(a=1/0);var s=0;t.eachChild(function(l,u){var c=l.getBoundingRect(),h=t.childAt(u+1),f=h&&h.getBoundingRect(),v,g;if(e==="horizontal"){var m=c.width+(f?-f.x+c.x:0);v=i+m,v>n||l.newline?(i=0,v=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>a||l.newline?(i+=s+r,o=0,g=y,s=c.width):s=Math.max(s,c.width)}l.newline||(l.x=i,l.y=o,l.markRedraw(),e==="horizontal"?i=v+r:o=g+r)})}var Gc=CL;nt(CL,"vertical");nt(CL,"horizontal");function yH(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 pae(e,t){var r=Ur(e,t,{enableLayoutOnlyByCenter:!0}),n=e.getBoxLayoutParams(),a,i;if(r.type===Bp.point)i=r.refPoint,a=tr(n,{width:t.getWidth(),height:t.getHeight()});else{var o=e.get("center"),s=ae(o)?o:[o,o];a=tr(n,r.refContainer),i=r.boxCoordFrom===hH?r.refPoint:[me(s[0],a.width)+a.x,me(s[1],a.height)+a.y]}return{viewRect:a,center:i}}function xH(e,t){var r=pae(e,t),n=r.viewRect,a=r.center,i=e.get("radius");ae(i)||(i=[0,i]);var o=me(n.width,t.getWidth()),s=me(n.height,t.getHeight()),l=Math.min(o,s),u=me(i[0],l/2),c=me(i[1],l/2);return{cx:a[0],cy:a[1],r0:u,r:c,viewRect:n}}function tr(e,t,r){r=mv(r||0);var n=t.width,a=t.height,i=me(e.left,n),o=me(e.top,a),s=me(e.right,n),l=me(e.bottom,a),u=me(e.width,n),c=me(e.height,a),h=r[2]+r[0],f=r[1]+r[3],v=e.aspect;switch(isNaN(u)&&(u=n-s-f-i),isNaN(c)&&(c=a-l-h-o),v!=null&&(isNaN(u)&&isNaN(c)&&(v>n/a?u=n*.8:c=a*.8),isNaN(u)&&(u=v*c),isNaN(c)&&(c=u/v)),isNaN(i)&&(i=n-s-u-f),isNaN(o)&&(o=a-l-c-h),e.left||e.right){case"center":i=n/2-u/2-r[3];break;case"right":i=n-u-f;break}switch(e.top||e.bottom){case"middle":case"center":o=a/2-c/2-r[0];break;case"bottom":o=a-c-h;break}i=i||0,o=o||0,isNaN(u)&&(u=n-f-i-(s||0)),isNaN(c)&&(c=a-h-o-(l||0));var g=new je((t.x||0)+i+r[3],(t.y||0)+o+r[0],u,c);return g.margin=r,g}function _H(e,t,r){var n=e.getShallow("preserveAspect",!0);if(!n)return t;var a=t.width/t.height;if(Math.abs(Math.atan(r)-Math.atan(a))<1e-9)return t;var i=e.getShallow("preserveAspectAlign",!0),o=e.getShallow("preserveAspectVerticalAlign",!0),s={width:t.width,height:t.height},l=n==="cover";return a>r&&!l||a=m)return h;for(var y=0;y=0;l--)s=Je(s,a[l],!0);n.defaultOption=s}return n.defaultOption},t.prototype.getReferringComponents=function(r,n){var a=r+"Index",i=r+"Id";return sv(this.ecModel,r,{index:this.get(a,!0),id:this.get(i,!0)},n)},t.prototype.getBoxLayoutParams=function(){return yH(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}(vt);n7(ht,vt);k1(ht);Zne(ht);Yne(ht,yae);function yae(e){var t=[];return R(ht.getClassesByMainType(e),function(r){t=t.concat(r.dependencies||r.prototype.dependencies||[])}),t=oe(t,function(r){return bo(r).main}),e!=="dataset"&&Ye(t,"dataset")<=0&&t.unshift("dataset"),t}var K={color:{},darkColor:{},size:{}},wr=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)"};te(wr,{primary:wr.neutral80,secondary:wr.neutral70,tertiary:wr.neutral60,quaternary:wr.neutral50,disabled:wr.neutral20,border:wr.neutral30,borderTint:wr.neutral20,borderShade:wr.neutral40,background:wr.neutral05,backgroundTint:"rgba(234,237,245,0.5)",backgroundTransparent:"rgba(255,255,255,0)",backgroundShade:wr.neutral10,shadow:"rgba(0,0,0,0.2)",shadowTint:"rgba(129,130,136,0.2)",axisLine:wr.neutral70,axisLineTint:wr.neutral40,axisTick:wr.neutral70,axisTickMinor:wr.neutral60,axisLabel:wr.neutral70,axisSplitLine:wr.neutral15,axisMinorSplitLine:wr.neutral05});for(var ec in wr)if(wr.hasOwnProperty(ec)){var wR=wr[ec];ec==="theme"?K.darkColor.theme=wr.theme.slice():ec==="highlight"?K.darkColor.highlight="rgba(255,231,130,0.4)":ec.indexOf("accent")===0?K.darkColor[ec]=Ls(wR,null,function(e){return e*.5},function(e){return Math.min(1,1.3-e)}):K.darkColor[ec]=Ls(wR,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 wH="";typeof navigator<"u"&&(wH=navigator.platform||"");var vd="rgba(0, 0, 0, 0.2)",SH=K.color.theme[0],xae=Ls(SH,null,null,.9);const CH={darkMode:"auto",colorBy:"series",color:K.color.theme,gradientColor:[xae,SH],aria:{decal:{decals:[{color:vd,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:vd,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:vd,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:vd,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:vd,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:vd,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:wH.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 fn={Must:1,Might:2,Not:3},TH=Qe();function _ae(e){TH(e).datasetMap=we()}function MH(e,t,r){var n={},a=ML(t);if(!a||!e)return n;var i=[],o=[],s=t.ecModel,l=TH(s).datasetMap,u=a.uid+"_"+r.seriesLayoutBy,c,h;e=e.slice(),R(e,function(m,y){var x=Re(m)?m:e[y]={name:m};x.type==="ordinal"&&c==null&&(c=y,h=g(x)),n[x.name]=[]});var f=l.get(u)||l.set(u,{categoryWayDim:h,valueWayDim:0});R(e,function(m,y){var x=m.name,_=g(m);if(c==null){var w=f.valueWayDim;v(n[x],w,_),v(o,w,_),f.valueWayDim+=_}else if(c===y)v(n[x],0,_),v(i,0,_);else{var w=f.categoryWayDim;v(n[x],w,_),v(o,w,_),f.categoryWayDim+=_}});function v(m,y,x){for(var _=0;_t)return e[n];return e[r-1]}function kH(e,t,r,n,a,i,o){i=i||e;var s=t(i),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(a))return u[a];var c=o==null||!n?r:Tae(n,o);if(c=c||r,!(!c||!c.length)){var h=c[l];return a&&(u[a]=h),s.paletteIdx=(l+1)%c.length,h}}function Mae(e,t){t(e).paletteIdx=0,t(e).paletteNameMap={}}var c0,ep,CR,TR="\0_ec_inner",Aae=1,NL=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.init=function(r,n,a,i,o,s){i=i||{},this.option=null,this._theme=new vt(i),this._locale=new vt(o),this._optionManager=s},t.prototype.setOption=function(r,n,a){var i=NR(n);this._optionManager.setOption(r,a,i),this._resetOption(null,i)},t.prototype.resetOption=function(r,n){return this._resetOption(r,NR(n))},t.prototype._resetOption=function(r,n){var a=!1,i=this._optionManager;if(!r||r==="recreate"){var o=i.mountOption(r==="recreate");!this.option||r==="recreate"?CR(this,o):(this.restoreData(),this._mergeOption(o,n)),a=!0}if((r==="timeline"||r==="media")&&this.restoreData(),!r||r==="recreate"||r==="timeline"){var s=i.getTimelineOption(this);s&&(a=!0,this._mergeOption(s,n))}if(!r||r==="recreate"||r==="media"){var l=i.getMediaOption(this);l.length&&R(l,function(u){a=!0,this._mergeOption(u,n)},this)}return a},t.prototype.mergeOption=function(r){this._mergeOption(r,null)},t.prototype._mergeOption=function(r,n){var a=this.option,i=this._componentsMap,o=this._componentsCount,s=[],l=we(),u=n&&n.replaceMergeMainTypeMap;_ae(this),R(r,function(h,f){h!=null&&(ht.hasClass(f)?f&&(s.push(f),l.set(f,!0)):a[f]=a[f]==null?ke(h):Je(a[f],h,!0))}),u&&u.each(function(h,f){ht.hasClass(f)&&!l.get(f)&&(s.push(f),l.set(f,!0))}),ht.topologicalTravel(s,ht.getAllClassMainTypes(),c,this);function c(h){var f=Sae(this,h,Zt(r[h])),v=i.get(h),g=v?u&&u.get(h)?"replaceMerge":"normalMerge":"replaceAll",m=XG(v,f,g);Ete(m,h,ht),a[h]=null,i.set(h,null),o.set(h,0);var y=[],x=[],_=0,w;R(m,function(S,C){var M=S.existing,A=S.newOption;if(!A)M&&(M.mergeOption({},this),M.optionUpdated({},!1));else{var k=h==="series",I=ht.getClass(h,S.keyInfo.subType,!k);if(!I)return;if(h==="tooltip"){if(w)return;w=!0}if(M&&M.constructor===I)M.name=S.keyInfo.name,M.mergeOption(A,this),M.optionUpdated(A,!1);else{var P=te({componentIndex:C},S.keyInfo);M=new I(A,this,this,P),te(M,P),S.brandNew&&(M.__requireNewView=!0),M.init(A,this,this),M.optionUpdated(null,!0)}}M?(y.push(M.option),x.push(M),_++):(y.push(void 0),x.push(void 0))},this),a[h]=y,i.set(h,x),o.set(h,_),h==="series"&&c0(this)}this._seriesIndices||c0(this)},t.prototype.getOption=function(){var r=ke(this.option);return R(r,function(n,a){if(ht.hasClass(a)){for(var i=Zt(n),o=i.length,s=!1,l=o-1;l>=0;l--)i[l]&&!Xg(i[l])?s=!0:(i[l]=null,!s&&o--);i.length=o,r[a]=i}}),delete r[TR],r},t.prototype.setTheme=function(r){this._theme=new vt(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 a=this._componentsMap.get(r);if(a){var i=a[n||0];if(i)return i;if(n==null){for(var o=0;o=t:r==="max"?e<=t:e===t}function Eae(e,t){return e.join(",")===t.join(",")}var Ni=R,tm=Re,kR=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function nC(e){var t=e&&e.itemStyle;if(t)for(var r=0,n=kR.length;r0?r[o-1].seriesModel:null)}),Wae(r)}})}function Wae(e){R(e,function(t,r){var n=[],a=[NaN,NaN],i=[t.stackResultDimension,t.stackedOverDimension],o=t.data,s=t.isStackedByIndex,l=t.seriesModel.get("stackStrategy")||"samesign";o.modify(i,function(u,c,h){var f=o.get(t.stackedDimension,h);if(isNaN(f))return a;var v,g;s?g=o.getRawIndex(h):v=o.get(t.stackedByDimension,h);for(var m=NaN,y=r-1;y>=0;y--){var x=e[y];if(s||(g=x.data.rawIndexOf(x.stackedByDimension,v)),g>=0){var _=x.data.getByRawIndex(x.stackResultDimension,g);if(l==="all"||l==="positive"&&_>0||l==="negative"&&_<0||l==="samesign"&&f>=0&&_>0||l==="samesign"&&f<=0&&_<0){f=pc(f,_),m=_;break}}}return n[0]=f,n[1]=m,n})})}var G1=function(){function e(t){this.data=t.data||(t.sourceFormat===Yi?{}:[]),this.sourceFormat=t.sourceFormat||p7,this.seriesLayoutBy=t.seriesLayoutBy||Bi,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)}v[0]=g,v[1]=m}},a=function(){return this._data?this._data.length/this._dimSize:0};RR=(t={},t[ln+"_"+Bi]={pure:!0,appendData:i},t[ln+"_"+jh]={pure:!0,appendData:function(){throw new Error('Do not support appendData when set seriesLayoutBy: "row".')}},t[Va]={pure:!0,appendData:i},t[Yi]={pure:!0,appendData:function(o){var s=this._data;R(o,function(l,u){for(var c=s[u]||(s[u]=[]),h=0;h<(l||[]).length;h++)c.push(l[h])})}},t[Fa]={appendData:i},t[Xl]={persistent:!1,pure:!0,appendData:function(o){this._data=o},clean:function(){this._offset+=this.count(),this._data=null}},t);function i(o){for(var s=0;s=0&&(m=o.interpolatedValue[y])}return m!=null?m+"":""})}},e.prototype.getRawValue=function(t,r){return Of(this.getData(r),t)},e.prototype.formatTooltip=function(t,r,n){},e}();function FR(e){var t,r;return Re(e)?e.type&&(r=e):t=e,{text:t,frag:r}}function vg(e){return new Qae(e)}var Qae=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 a=this.context;a.data=a.outputData=r.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var i;this._plan&&!n&&(i=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)&&(i="reset");function c(_){return!(_>=1)&&(_=1),_}var h;(this._dirty||i==="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 v=this._dueIndex,g=Math.min(f!=null?this._dueIndex+f:1/0,this._dueEnd);if(!n&&(h||v1&&n>0?s:o}};return i;function o(){return t=e?null:lt},gte:function(e,t){return e>=t}},tie=function(){function e(t,r){if(!Tt(r)){var n="";Lt(n)}this._opFn=BH[t],this._rvalFloat=Vo(r)}return e.prototype.evaluate=function(t){return Tt(t)?this._opFn(t,this._rvalFloat):this._opFn(Vo(t),this._rvalFloat)},e}(),FH=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=Tt(t)?t:Vo(t),a=Tt(r)?r:Vo(r),i=isNaN(n),o=isNaN(a);if(i&&(n=this._incomparable),o&&(a=this._incomparable),i&&o){var s=ve(t),l=ve(r);s&&(n=l?t:0),l&&(a=s?r:0)}return na?-this._resultLT:0},e}(),rie=function(){function e(t,r){this._rval=r,this._isEQ=t,this._rvalTypeof=typeof r,this._rvalFloat=Vo(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=Vo(t)===this._rvalFloat)}return this._isEQ?r:!r},e}();function nie(e,t){return e==="eq"||e==="ne"?new rie(e==="eq",t):Se(BH,e)?new tie(e,t):null}function VH(e){var t="",r=-1/0,n=-1/0,a=1/0,i=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,a=e.l),e.le!=null&&(t+="LE"+e.le,i=e.le)),{key:t,g:r,ge:n,l:a,le:i}}function GH(e,t){return t>e.g&&t>=e.ge&&t65535?fie:vie}function pie(e){var t=e.constructor;return t===Array?e.slice():new t(e)}function HR(e,t,r,n,a){var i=WH[r||"float"];if(a){var o=e[t],s=o&&o.length;if(s!==n){for(var l=new i(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 a=this._provider,i=this._chunks,o=this._dimensions,s=o.length,l=this._rawExtent,u=oe(o,function(_){return _.property}),c=0;cx[1]&&(x[1]=y)}}!a.persistent&&a.clean&&a.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)i=o-1;else return o}return-1},e.prototype.getIndices=function(){var t,r=this._indices;if(r){var n=r.constructor,a=this._count;if(n===Array){t=new n(a);for(var i=0;i=h&&_<=f||isNaN(_))&&(l[u++]=m),m++}g=!0}else if(i===2){for(var y=v[a[0]],w=v[a[1]],S=t[a[1]][0],C=t[a[1]][1],x=0;x=h&&_<=f||isNaN(_))&&(M>=S&&M<=C||isNaN(M))&&(l[u++]=m),m++}g=!0}}if(!g)if(i===1)for(var x=0;x=h&&_<=f||isNaN(_))&&(l[u++]=A)}else for(var x=0;xt[P][1])&&(k=!1)}k&&(l[u++]=r.getRawIndex(x))}return ux[1]&&(x[1]=y)}}}},e.prototype.lttbDownSample=function(t,r){var n=this.clone([t],!0),a=n._chunks,i=a[t],o=this.count(),s=0,l=Math.floor(1/r),u=this.getRawIndex(0),c,h,f,v=new(pd(this._rawCount))(Math.min((Math.ceil(o/l)+2)*2,o));v[s++]=u;for(var g=1;gc&&(c=h,f=S)}j>0&&js&&(m=s-c);for(var y=0;yg&&(g=_,v=c+y)}var w=this.getRawIndex(h),S=this.getRawIndex(v);hc-g&&(l=c-g,s.length=l);for(var m=0;mh[1]&&(h[1]=x),f[v++]=_}return i._count=v,i._indices=f,i._updateGetRawIdx(),i},e.prototype.each=function(t,r){if(this._count)for(var n=t.length,a=this._chunks,i=0,o=this.count();iv&&(v=y))}return l[c]=[f,v]},e.prototype.getRawDataItem=function(t){var r=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(r);for(var n=[],a=this._chunks,i=0;i=0?this._indices[t]:-1},e.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},e.internalField=function(){function t(r,n,a,i){return Kl(r[i],this._dimensions[i])}oC={arrayRows:t,objectRows:function(r,n,a,i){return Kl(r[n],this._dimensions[i])},keyedColumns:t,original:function(r,n,a,i){var o=r&&(r.value==null?r:r.value);return Kl(o instanceof Array?o[i]:o,this._dimensions[i])},typedArray:function(r,n,a,i){return r[i]}}}(),e}(),$H=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,a,i;if(d0(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,i=[c._getVersionSign()]}else s=o.get("data",!0),l=ta(s)?Xl:Fa,i=[];var h=this._getSourceMetaRawOption()||{},f=u&&u.metaRawOption||{},v=Te(h.seriesLayoutBy,f.seriesLayoutBy)||null,g=Te(h.sourceHeader,f.sourceHeader),m=Te(h.dimensions,f.dimensions),y=v!==f.seriesLayoutBy||!!g!=!!f.sourceHeader||m;a=y?[XM(s,{seriesLayoutBy:v,sourceHeader:g,dimensions:m},l)]:[]}else{var x=t;if(n){var _=this._applyTransform(r);a=_.sourceList,i=_.upstreamSignList}else{var w=x.get("source",!0);a=[XM(w,this._getSourceMetaRawOption(),null)],i=[]}}this._setLocalSource(a,i)},e.prototype._applyTransform=function(t){var r=this._sourceHost,n=r.get("transform",!0),a=r.get("fromTransformResult",!0);if(a!=null){var i="";t.length!==1&&WR(i)}var o,s=[],l=[];return R(t,function(u){u.prepareSource();var c=u.getSource(a||0),h="";a!=null&&!c&&WR(h),s.push(c),l.push(u._getVersionSign())}),n?o=hie(n,s,{datasetIndex:r.componentIndex}):a!=null&&(o=[$ae(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 R(e.blocks,function(a){var i=XH(a);i>=t&&(t=i+ +(n&&(!i||KM(a)&&!a.noHeader)))}),t}return 0}function yie(e,t,r,n){var a=t.noHeader,i=_ie(XH(t)),o=[],s=t.blocks||[];bn(!s||ae(s)),s=s||[];var l=e.orderMode;if(t.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(Se(u,l)){var c=new BH(u[l],null);s.sort(function(m,y){return c.evaluate(m.sortParam,y.sortParam)})}else l==="seriesDesc"&&s.reverse()}R(s,function(m,y){var x=t.valueFormatter,_=YH(m)(x?te(te({},e),{valueFormatter:x}):e,m,y>0?i.html:0,n);_!=null&&o.push(_)});var h=e.renderMode==="richText"?o.join(i.richText):JM(n,o.join(""),a?r:i.html);if(a)return h;var f=$M(t.header,"ordinal",e.useUTC),v=ZH(n,e.renderMode).nameStyle,g=$H(n);return e.renderMode==="richText"?qH(e,f,v)+i.richText+h:JM(n,'
'+Rn(f)+"
"+h,r)}function xie(e,t,r,n){var a=e.renderMode,i=t.noName,o=t.noValue,s=!t.markerType,l=t.name,u=e.useUTC,c=t.valueFormatter||e.valueFormatter||function(S){return S=ae(S)?S:[S],oe(S,function(C,M){return $M(C,ae(v)?v[M]:v,u)})};if(!(i&&o)){var h=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||K.color.secondary,a),f=i?"":$M(l,"ordinal",u),v=t.valueType,g=o?[]:c(t.value,t.rawDataIndex),m=!s||!i,y=!s&&i,x=ZH(n,a),_=x.nameStyle,w=x.valueStyle;return a==="richText"?(s?"":h)+(i?"":qH(e,f,_))+(o?"":Sie(e,g,m,y,w)):JM(n,(s?"":h)+(i?"":bie(f,!s,_))+(o?"":wie(g,m,y,w)),r)}}function WR(e,t,r,n,a,i){if(e){var o=YH(e),s={useUTC:a,renderMode:r,orderMode:n,markupStyleCreator:t,valueFormatter:e.valueFormatter};return o(s,e,0,i)}}function _ie(e){return{html:gie[e],richText:mie[e]}}function JM(e,t,r){var n='
',a="margin: "+r+"px 0 0",i=$H(e);return'
'+t+n+"
"}function bie(e,t,r){var n=t?"margin-left:2px":"";return''+Rn(e)+""}function wie(e,t,r,n){var a=r?"10px":"20px",i=t?"float:right;margin-left:"+a:"";return e=ae(e)?e:[e],''+oe(e,function(o){return Rn(o)}).join("  ")+""}function qH(e,t,r){return e.markupStyleCreator.wrapRichTextStyle(t,r)}function Sie(e,t,r,n,a){var i=[a],o=n?10:20;return r&&i.push({padding:[0,0,0,o],align:"right"}),e.markupStyleCreator.wrapRichTextStyle(ae(t)?t.join(" "):t,i)}function KH(e,t){var r=e.getData().getItemVisual(t,"style"),n=r[e.visualDrawType];return uh(n)}function JH(e,t){var r=e.get("padding");return r??(t==="richText"?[8,10]:10)}var sC=function(){function e(){this.richTextStyles={},this._nextStyleNameId=Fk()}return e.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(t,r,n){var a=n==="richText"?this._generateStyleName():null,i=uH({color:r,type:t,renderMode:n,markerId:a});return ve(i)?i:(this.richTextStyles[a]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(t,r){var n={};ae(r)?R(r,function(i){return te(n,i)}):te(n,r);var a=this._generateStyleName();return this.richTextStyles[a]=n,"{"+a+"|"+t+"}"},e}();function QH(e){var t=e.series,r=e.dataIndex,n=e.multipleSeries,a=t.getData(),i=a.mapDimensionsAll("defaultedTooltip"),o=i.length,s=t.getRawValue(r),l=ae(s),u=KH(t,r),c,h,f,v;if(o>1||l&&!o){var g=Cie(s,t,r,i,u);c=g.inlineValues,h=g.inlineValueTypes,f=g.blocks,v=g.inlineValues[0]}else if(o){var m=a.getDimensionInfo(i[0]);v=c=Of(a,r,i[0]),h=m.type}else v=c=l?s[0]:s;var y=Vk(t),x=y&&t.name||"",_=a.getName(r),w=n?x:_;return Er("section",{header:x,noHeader:n||!y,sortParam:v,blocks:[Er("nameValue",{markerType:"item",markerColor:u,name:w,noName:!ka(w),value:c,valueType:h,rawDataIndex:a.getRawIndex(r)})].concat(f||[])})}function Cie(e,t,r,n,a){var i=t.getData(),o=pi(e,function(h,f,v){var g=i.getDimensionInfo(v);return h=h||g&&g.tooltip!==!1&&g.displayName!=null},!1),s=[],l=[],u=[];n.length?R(n,function(h){c(Of(i,r,h),h)}):R(e,c);function c(h,f){var v=i.getDimensionInfo(f);!v||v.otherDims.tooltip===!1||(o?u.push(Er("nameValue",{markerType:"subItem",markerColor:a,name:v.displayName,value:h,valueType:v.type})):(s.push(h),l.push(v.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var dl=Qe();function f0(e,t){return e.getName(t)||e.getId(t)}var Hx="__universalTransitionEnabled",Ut=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r._selectedDataIndicesMap={},r}return t.prototype.init=function(r,n,a){this.seriesIndex=this.componentIndex,this.dataTask=vg({count:Mie,reset:Aie}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(r,a);var i=dl(this).sourceManager=new WH(this);i.prepareSource();var o=this.getInitialData(r,a);ZR(o,this),this.dataTask.context.data=o,dl(this).dataBeforeProcessed=o,$R(this),this._initSelectedMapFromData(o)},t.prototype.mergeDefaultAndTheme=function(r,n){var a=em(this),i=a?zh(r):{},o=this.subType;ht.hasClass(o)&&(o+="Series"),Je(r,n.getTheme().get(this.subType)),Je(r,this.getDefaultOption()),rh(r,"label",["show"]),this.fillDataTextStyle(r.data),a&&Uo(r,i,a)},t.prototype.mergeOption=function(r,n){r=Je(this.option,r,!0),this.fillDataTextStyle(r.data);var a=em(this);a&&Uo(this.option,r,a);var i=dl(this).sourceManager;i.dirty(),i.prepareSource();var o=this.getInitialData(r,n);ZR(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,dl(this).dataBeforeProcessed=o,$R(this),this._initSelectedMapFromData(o)},t.prototype.fillDataTextStyle=function(r){if(r&&!Qn(r))for(var n=["show"],a=0;a=0&&f<0)&&(h=C,f=S,v=0),S===f&&(c[v++]=y))}return c.length=v,c},t.prototype.formatTooltip=function(r,n,a){return QH({series:this,dataIndex:r,multipleSeries:n})},t.prototype.isAnimationEnabled=function(){var r=this.ecModel;if(xt.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,a){var i=this.ecModel,o=ML.prototype.getColorFromPalette.call(this,r,n,a);return o||(o=i.getColorFromPalette(r,n,a)),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 a=this.option.selectedMap;if(a){var i=this.option.selectedMode,o=this.getData(n);if(i==="series"||a==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s=0&&a.push(o)}return a},t.prototype.isSelected=function(r,n){var a=this.option.selectedMap;if(!a)return!1;var i=this.getData(n);return(a==="all"||a[f0(i,r)])&&!i.getItemModel(r).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[Hx])return!0;var r=this.option.universalTransition;return r?r===!0?!0:r&&r.enabled:!1},t.prototype._innerSelect=function(r,n){var a,i,o=this.option,s=o.selectedMode,l=n.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){Re(o.selectedMap)||(o.selectedMap={});for(var u=o.selectedMap,c=0;c0&&this._innerSelect(r,n)}},t.registerClass=function(r){return ht.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}(ht);kr(Ut,H1);kr(Ut,ML);r7(Ut,ht);function $R(e){var t=e.name;Vk(e)||(e.name=Tie(e)||t)}function Tie(e){var t=e.getRawData(),r=t.mapDimensionsAll("seriesName"),n=[];return R(r,function(a){var i=t.getDimensionInfo(a);i.displayName&&n.push(i.displayName)}),n.join(" ")}function Mie(e){return e.model.getRawData().count()}function Aie(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),Nie}function Nie(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function ZR(e,t){R(Lf(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(r){e.wrapMethod(r,nt(kie,t))})}function kie(e,t){var r=QM(e);return r&&r.setOutputEnd((t||this).count()),t}function QM(e){var t=(e.ecModel||{}).scheduler,r=t&&t.getPipeline(e.uid);if(r){var n=r.currentTask;if(n){var a=n.agentStubMap;a&&(n=a.get(e.uid))}return n}}var Yt=function(){function e(){this.group=new De,this.uid=Oh("viewComponent")}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,a){},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,a){},e.prototype.updateLayout=function(t,r,n,a){},e.prototype.updateVisual=function(t,r,n,a){},e.prototype.toggleBlurSeries=function(t,r,n){},e.prototype.eachRendered=function(t){var r=this.group;r&&r.traverse(t)},e}();Uk(Yt);k1(Yt);function Bh(){var e=Qe();return function(t){var r=e(t),n=t.pipelineContext,a=!!r.large,i=!!r.progressiveRender,o=r.large=!!(n&&n.large),s=r.progressiveRender=!!(n&&n.progressiveRender);return(a!==o||i!==s)&&"reset"}}var eU=Qe(),Lie=Bh(),Rt=function(){function e(){this.group=new De,this.uid=Oh("viewChart"),this.renderTask=vg({plan:Iie,reset:Pie}),this.renderTask.context={view:this}}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,a){},e.prototype.highlight=function(t,r,n,a){var i=t.getData(a&&a.dataType);i&&XR(i,a,"emphasis")},e.prototype.downplay=function(t,r,n,a){var i=t.getData(a&&a.dataType);i&&XR(i,a,"normal")},e.prototype.remove=function(t,r){this.group.removeAll()},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,a){this.render(t,r,n,a)},e.prototype.updateVisual=function(t,r,n,a){this.render(t,r,n,a)},e.prototype.eachRendered=function(t){Su(this.group,t)},e.markUpdateMethod=function(t,r){eU(t).updateMethod=r},e.protoInitialize=function(){var t=e.prototype;t.type="chart"}(),e}();function YR(e,t,r){e&&Kg(e)&&(t==="emphasis"?Us:Ws)(e,r)}function XR(e,t,r){var n=nh(e,t),a=t&&t.highlightKey!=null?nne(t.highlightKey):null;n!=null?R(Zt(n),function(i){YR(e.getItemGraphicEl(i),r,a)}):e.eachItemGraphicEl(function(i){YR(i,r,a)})}Uk(Rt);k1(Rt);function Iie(e){return Lie(e.model)}function Pie(e){var t=e.model,r=e.ecModel,n=e.api,a=e.payload,i=t.pipelineContext.progressiveRender,o=e.view,s=a&&eU(a).updateMethod,l=i?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](t,r,n,a),Die[l]}var Die={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)}}},Y_="\0__throttleOriginMethod",qR="\0__throttleRate",KR="\0__throttleType";function U1(e,t,r){var n,a=0,i=0,o=null,s,l,u,c;t=t||0;function h(){i=new Date().getTime(),o=null,e.apply(l,u||[])}var f=function(){for(var v=[],g=0;g=0?h():o=setTimeout(h,-s),a=n};return f.clear=function(){o&&(clearTimeout(o),o=null)},f.debounceNextCall=function(v){c=v},f}function xv(e,t,r,n){var a=e[t];if(a){var i=a[Y_]||a,o=a[KR],s=a[qR];if(s!==r||o!==n){if(r==null||!n)return e[t]=i;a=e[t]=U1(i,r,n==="debounce"),a[Y_]=i,a[KR]=n,a[qR]=r}return a}}function rm(e,t){var r=e[t];r&&r[Y_]&&(r.clear&&r.clear(),e[t]=r[Y_])}var JR=Qe(),QR={itemStyle:ih(J7,!0),lineStyle:ih(K7,!0)},jie={lineStyle:"stroke",itemStyle:"fill"};function tU(e,t){var r=e.visualStyleMapper||QR[t];return r||(console.warn("Unknown style type '"+t+"'."),QR.itemStyle)}function rU(e,t){var r=e.visualDrawType||jie[t];return r||(console.warn("Unknown style type '"+t+"'."),"fill")}var Eie={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",a=e.getModel(n),i=tU(e,n),o=i(a),s=a.getShallow("decal");s&&(r.setVisual("decal",s),s.dirty=!0);var l=rU(e,n),u=o[l],c=Le(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"||Le(o.fill)?f:o.fill,o.stroke=o.stroke==="auto"||Le(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(v,g){var m=e.getDataParams(g),y=te({},o);y[l]=c(m),v.setItemVisual(g,"style",y)}}}},rp=new vt,Rie={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",a=tU(e,n),i=r.getVisual("drawType");return{dataEach:r.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[n]){rp.option=l[n];var u=a(rp),c=o.ensureUniqueItemVisual(s,"style");te(c,u),rp.option.decal&&(o.setItemVisual(s,"decal",rp.option.decal),rp.option.decal.dirty=!0),i in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},Oie={performRawSeries:!0,overallReset:function(e){var t=we();e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.type+"-"+r.getColorBy();JR(r).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.getRawData(),a={},i=r.getData(),o=JR(r).scope,s=r.visualStyleAccessPath||"itemStyle",l=rU(r,s);i.each(function(u){var c=i.getRawIndex(u);a[c]=u}),n.each(function(u){var c=a[u],h=i.getItemVisual(c,"colorFromPalette");if(h){var f=i.ensureUniqueItemVisual(c,"style"),v=n.getName(u)||u+"",g=n.count();f[l]=r.getColorFromPalette(v,o,g)}})}})}},v0=Math.PI;function zie(e,t){t=t||{},Ee(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 De,n=new it({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});r.add(n);var a=new wt({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),i=new it({style:{fill:"none"},textContent:a,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});r.add(i);var o;return t.showSpinner&&(o=new Um({shape:{startAngle:-v0/2,endAngle:-v0/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:v0*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:v0*3/2}).delay(300).start("circularInOut"),r.add(o)),r.resize=function(){var s=a.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}),i.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 nU=function(){function e(t,r,n,a){this._stageTaskMap=we(),this.ecInstance=t,this.api=r,n=this._dataProcessorHandlers=n.slice(),a=this._visualHandlers=a.slice(),this._allHandlers=n.concat(a)}return e.prototype.restoreData=function(t,r){t.restoreData(r),this._stageTaskMap.each(function(n){var a=n.overallTask;a&&a.dirty()})},e.prototype.getPerformArgs=function(t,r){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),a=n.context,i=!r&&n.progressiveEnabled&&(!a||a.progressiveRender)&&t.__idxInPipeline>n.blockIndex,o=i?n.step:null,s=a&&a.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),a=t.__preparePipelineContext?t.__preparePipelineContext(r,n):e7(t,r,n);t.pipelineContext=n.context=a},e.prototype.restorePipelines=function(t,r){var n=this,a=n._pipelineMap=we();r.eachSeries(function(i){var o=t.painter.type==="canvas"&&i.getProgressive(),s=i.uid;a.set(s,{id:s,head:null,tail:null,threshold:i.getProgressiveThreshold(),progressiveEnabled:o&&!(i.preventIncremental&&i.preventIncremental()),blockIndex:-1,step:Math.round(o||700),count:0}),n._pipe(i,i.dataTask)})},e.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,r=this.api.getModel(),n=this.api;R(this._allHandlers,function(a){var i=t.get(a.uid)||t.set(a.uid,{}),o="";bn(!(a.reset&&a.overallReset),o),a.reset&&this._createSeriesStageTask(a,i,r,n),a.overallReset&&this._createOverallStageTask(a,i,r,n)},this)},e.prototype.prepareView=function(t,r,n,a){var i=t.renderTask,o=i.context;o.model=r,o.ecModel=n,o.api=a,i.__block=!t.incrementalPrepareRender,this._pipe(r,i)},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,a){a=a||{};var i=!1,o=this;R(t,function(l,u){if(!(a.visualType&&a.visualType!==l.visualType)){var c=o._stageTaskMap.get(l.uid),h=c.seriesTaskMap,f=c.overallTask;if(f){var v,g=f.agentStubMap;g.each(function(y){s(a,y)&&(y.dirty(),v=!0)}),v&&f.dirty(),o.updatePayload(f,n);var m=o.getPerformArgs(f,a.block);g.each(function(y){y.perform(m)}),f.perform(m)&&(i=!0)}else h&&h.each(function(y,x){s(a,y)&&y.dirty();var _=o.getPerformArgs(y,a.block);_.skip=!l.performRawSeries&&r.isSeriesFiltered(y.context.model),o.updatePayload(y,n),y.perform(_)&&(i=!0)})}});function s(l,u){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(u.__pipeline.id))}this.unfinished=i||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,a){var i=this,o=r.seriesTaskMap,s=r.seriesTaskMap=we(),l=t.seriesType,u=t.getTargetSeries;t.createOnAllSeries?n.eachRawSeries(c):l?n.eachRawSeriesByType(l,c):u&&u(n,a).each(c);function c(h){var f=h.uid,v=s.set(f,o&&o.get(f)||vg({plan:Hie,reset:Uie,count:$ie}));v.context={model:h,ecModel:n,api:a,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:i},i._pipe(h,v)}},e.prototype._createOverallStageTask=function(t,r,n,a){var i=this,o=r.overallTask=r.overallTask||vg({reset:Bie});o.context={ecModel:n,api:a,overallReset:t.overallReset,scheduler:i};var s=o.agentStubMap,l=o.agentStubMap=we(),u=t.seriesType,c=t.getTargetSeries,h=t.dirtyOnOverallProgress,f=!1,v="";bn(!t.createOnAllSeries,v),u?n.eachRawSeriesByType(u,g):c?c(n,a).each(g):R(n.getSeries(),g);function g(m){var y=m.uid,x=l.set(y,s&&s.get(y)||(f=!0,vg({reset:Fie,onDirty:Gie})));x.context={model:m,dirtyOnOverallProgress:h},x.agent=o,x.__block=h,i._pipe(m,x)}f&&o.dirty()},e.prototype._pipe=function(t,r){var n=t.uid,a=this._pipelineMap.get(n);!a.head&&(a.head=r),a.tail&&a.tail.pipe(r),a.tail=r,r.__idxInPipeline=a.count++,r.__pipeline=a},e.wrapStageHandler=function(t,r){return Le(t)&&(t={overallReset:t,seriesType:Zie(t)}),t.uid=Oh("stageHandler"),r&&(t.visualType=r),t},e}();function Bie(e){e.overallReset(e.ecModel,e.api,e.payload)}function Fie(e){return e.dirtyOnOverallProgress&&Vie}function Vie(){this.agent.dirty(),this.getDownstream().dirty()}function Gie(){this.agent&&this.agent.dirty()}function Hie(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function Uie(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Zt(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?oe(t,function(r,n){return aU(n)}):Wie}var Wie=aU(0);function aU(e){return function(t,r){var n=r.data,a=r.resetDefines[e];if(a&&a.dataEach)for(var i=t.start;i0&&v===u.length-f.length){var g=u.slice(0,v);g!=="data"&&(r.mainType=g,r[f.toLowerCase()]=l,c=!0)}}s.hasOwnProperty(u)&&(n[u]=l,c=!0),c||(a[u]=l)})}return{cptQuery:r,dataQuery:n,otherQuery:a}},e.prototype.filter=function(t,r){var n=this.eventInfo;if(!n)return!0;var a=n.targetEl,i=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,i,"name")&&c(u,i,"dataIndex")&&c(u,i,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(t,r.otherQuery,a,i));function c(h,f,v,g){return h[v]==null||f[g||v]===h[v]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),eA=["symbol","symbolSize","symbolRotate","symbolOffset"],rO=eA.concat(["symbolKeepAspect"]),Xie={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={},a={},i=!1,o=0;o=0&&jc(l)?l:.5;var u=e.createRadialGradient(o,s,0,o,s,l);return u}function tA(e,t,r){for(var n=t.type==="radial"?voe(e,t,r):foe(e,t,r),a=t.colorStops,i=0;i0)?null:e==="dashed"?[4*t,2*t]:e==="dotted"?[t]:Tt(e)?[e]:ae(e)?e:null}function DL(e){var t=e.style,r=t.lineDash&&t.lineWidth>0&&goe(t.lineDash,t.lineWidth),n=t.lineDashOffset;if(r){var a=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;a&&a!==1&&(r=oe(r,function(i){return i/a}),n/=a)}return[r,n]}var moe=new Go(!0);function K_(e){var t=e.stroke;return!(t==null||t==="none"||!(e.lineWidth>0))}function nO(e){return typeof e=="string"&&e!=="none"}function J_(e){var t=e.fill;return t!=null&&t!=="none"}function aO(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 iO(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 rA(e,t,r){var n=Wk(t.image,t.__image,r);if(L1(n)){var a=e.createPattern(n,t.repeat||"repeat");if(typeof DOMMatrix=="function"&&a&&a.setTransform){var i=new DOMMatrix;i.translateSelf(t.x||0,t.y||0),i.rotateSelf(0,0,(t.rotation||0)*ng),i.scaleSelf(t.scaleX||1,t.scaleY||1),a.setTransform(i)}return a}}function yoe(e,t,r,n,a){var i,o=K_(r),s=J_(r),l=r.strokePercent,u=l<1,c=!t.path;(!t.silent||u)&&c&&t.createPathProxy();var h=t.path||moe,f=t.__dirty;if(!n){var v=r.fill,g=r.stroke,m=s&&!!v.colorStops,y=o&&!!g.colorStops,x=s&&!!v.image,_=o&&!!g.image,w=void 0,S=void 0,C=void 0,M=void 0,A=void 0;(m||y)&&(A=t.getBoundingRect()),m&&(w=f?tA(e,v,A):t.__canvasFillGradient,t.__canvasFillGradient=w),y&&(S=f?tA(e,g,A):t.__canvasStrokeGradient,t.__canvasStrokeGradient=S),x&&(C=f||!t.__canvasFillPattern?rA(e,v,t):t.__canvasFillPattern,t.__canvasFillPattern=C),_&&(M=f||!t.__canvasStrokePattern?rA(e,g,t):t.__canvasStrokePattern,t.__canvasStrokePattern=M),m?e.fillStyle=w:x&&(C?e.fillStyle=C:s=!1),y?e.strokeStyle=S:_&&(M?e.strokeStyle=M:o=!1)}var I=t.getGlobalScale();h.setScale(I[0],I[1],t.segmentIgnoreThreshold);var k,P;e.setLineDash&&r.lineDash&&(i=DL(t),k=i[0],P=i[1]);var D=!0;(c||f&Dd)&&(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),k&&(e.setLineDash(k),e.lineDashOffset=P),n?(a.batchFill=s,a.batchStroke=o):r.strokeFirst?(o&&iO(e,r),s&&aO(e,r)):(s&&aO(e,r),o&&iO(e,r)),k&&e.setLineDash([])}function xoe(e,t,r){var n=t.__image=Wk(r.image,t.__image,t,t.onload);if(!(!n||!L1(n))){var a=r.x||0,i=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,a,i,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,a,i,o,s)}else e.drawImage(n,a,i,o,s)}}function _oe(e,t,r){var n,a=r.text;if(a!=null&&(a+=""),a){e.font=r.font||Fs,e.textAlign=r.textAlign,e.textBaseline=r.textBaseline;var i=void 0,o=void 0;e.setLineDash&&r.lineDash&&(n=DL(t),i=n[0],o=n[1]),i&&(e.setLineDash(i),e.lineDashOffset=o),r.strokeFirst?(K_(r)&&e.strokeText(a,r.x,r.y),J_(r)&&e.fillText(a,r.x,r.y)):(J_(r)&&e.fillText(a,r.x,r.y),K_(r)&&e.strokeText(a,r.x,r.y)),i&&e.setLineDash([])}}var oO=["shadowBlur","shadowOffsetX","shadowOffsetY"],sO=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function pU(e,t,r,n,a){var i=!1;if(!n&&(r=r||{},t===r))return!1;if(n||t.opacity!==r.opacity){qn(e,a),i=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?Bc.opacity:o}(n||t.blend!==r.blend)&&(i||(qn(e,a),i=!0),e.globalCompositeOperation=t.blend||Bc.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,a){if(!this[zr]){if(this._disposed){this.id;return}var i,o,s;if(Re(n)&&(a=n.lazyUpdate,i=n.silent,o=n.replaceMerge,s=n.transition,n=n.notMerge),this[zr]=!0,xd(this),!this._model||n){var l=new Lae(this._api),u=this._theme,c=this._model=new AL;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,u,this._locale,l)}this._model.setOption(r,{replaceMerge:o},oA);var h={seriesTransition:s,optionChanged:!0};if(a)this[tn]={silent:i,updateParams:h},this[zr]=!1,this.getZr().wakeUp();else{try{ic(this),fs.update.call(this,null,h)}catch(f){throw this[tn]=null,this[zr]=!1,f}this._ssr||this._zr.flush(),this[tn]=null,this[zr]=!1,md.call(this,i),yd.call(this,i)}}},t.prototype.setTheme=function(r,n){if(!this[zr]){if(this._disposed){this.id;return}var a=this._model;if(a){var i=n&&n.silent,o=null;this[tn]&&(i==null&&(i=this[tn].silent),o=this[tn].updateParams,this[tn]=null),this[zr]=!0,xd(this);try{this._updateTheme(r),a.setTheme(this._theme),ic(this),fs.update.call(this,{type:"setTheme"},o)}catch(s){throw this[zr]=!1,s}this[zr]=!1,md.call(this,i),yd.call(this,i)}}},t.prototype._updateTheme=function(r){ve(r)&&(r=LU[r]),r&&(r=ke(r),r&&LH(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||xt.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 R(n,function(a){a.stopAnimation(null,!0)}),r.painter.toDataURL()},t.prototype.getDataURL=function(r){if(this._disposed){this.id;return}r=r||{};var n=r.excludeComponents,a=this._model,i=[],o=this;R(n,function(l){a.eachComponent({mainType:l},function(u){var c=o._componentsMap[u.__viewId];c.group.ignore||(i.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 R(i,function(l){l.group.ignore=!1}),s},t.prototype.getConnectedDataURL=function(r){if(this._disposed){this.id;return}var n=r.type==="svg",a=this.group,i=Math.min,o=Math.max,s=1/0;if(rb[a]){var l=s,u=s,c=-s,h=-s,f=[],v=r&&r.pixelRatio||this.getDevicePixelRatio();R(Hc,function(w,S){if(w.group===a){var C=n?w.getZr().painter.getSvgDom().innerHTML:w.renderToCanvas(ke(r)),M=w.getDom().getBoundingClientRect();l=i(M.left,l),u=i(M.top,u),c=o(M.right,c),h=o(M.bottom,h),f.push({dom:C,left:M.left,top:M.top})}}),l*=v,u*=v,c*=v,h*=v;var g=c-l,m=h-u,y=qr.createCanvas(),x=CM(y,{renderer:n?"svg":"canvas"});if(x.resize({width:g,height:m}),n){var _="";return R(f,function(w){var S=w.left-l,C=w.top-u;_+=''+w.dom+""}),x.painter.getSvgRoot().innerHTML=_,r.connectedBackgroundColor&&x.painter.setBackgroundColor(r.connectedBackgroundColor),x.refreshImmediately(),x.painter.toDataURL()}else return r.connectedBackgroundColor&&x.add(new it({shape:{x:0,y:0,width:g,height:m},style:{fill:r.connectedBackgroundColor}})),R(f,function(w){var S=new Qr({style:{x:w.left*v-l,y:w.top*v-u,image:w.dom}});x.add(S)}),x.refreshImmediately(),y.toDataURL("image/"+(r&&r.type||"png"))}else return this.getDataURL(r)},t.prototype.convertToPixel=function(r,n,a){return y0(this,"convertToPixel",r,n,a)},t.prototype.convertToLayout=function(r,n,a){return y0(this,"convertToLayout",r,n,a)},t.prototype.convertFromPixel=function(r,n,a){return y0(this,"convertFromPixel",r,n,a)},t.prototype.containPixel=function(r,n){if(this._disposed){this.id;return}var a=this._model,i,o=ff(a,r);return R(o,function(s,l){l.indexOf("Models")>=0&&R(s,function(u){var c=u.coordinateSystem;if(c&&c.containPoint)i=i||!!c.containPoint(n);else if(l==="seriesModels"){var h=this._chartsMap[u.__viewId];h&&h.containPoint&&(i=i||h.containPoint(n,u))}},this)},this),!!i},t.prototype.getVisual=function(r,n){var a=this._model,i=ff(a,r,{defaultMainType:"series"}),o=i.seriesModel,s=o.getData(),l=i.hasOwnProperty("dataIndexInside")?i.dataIndexInside:i.hasOwnProperty("dataIndex")?s.indexOfRawIndex(i.dataIndex):null;return l!=null?PL(s,l,n):Xm(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;R(Woe,function(a){var i=function(o){var s=r.getModel(),l=o.target,u,c=a==="globalout";if(c?u={}:l&&Dc(l,function(m){var y=Be(m);if(y&&y.dataIndex!=null){var x=y.dataModel||s.getSeriesByIndex(y.seriesIndex);return u=x&&x.getDataParams(y.dataIndex,y.dataType,l)||{},!0}else if(y.eventData)return u=te({},y.eventData),!0},!0),u){var h=u.componentType,f=u.componentIndex;(h==="markLine"||h==="markPoint"||h==="markArea")&&(h="series",f=u.seriesIndex);var v=h&&f!=null&&s.getComponent(h,f),g=v&&r[v.mainType==="series"?"_chartsMap":"_componentsMap"][v.__viewId];u.event=o,u.type=a,r._$eventProcessor.eventInfo={targetEl:l,packedEvent:u,model:v,view:g},r.trigger(a,u)}};i.zrEventfulCallAtLast=!0,r._zr.on(a,i,r)});var n=this._messageCenter;R(aA,function(a,i){n.on(i,function(o){r.trigger(i,o)})}),Kie(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&&qG(this.getDom(),OL,"");var n=this,a=n._api,i=n._model;R(n._componentsViews,function(o){o.dispose(i,a)}),R(n._chartsViews,function(o){o.dispose(i,a)}),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 Hc[n.id]},t.prototype.resize=function(r){if(!this[zr]){if(this._disposed){this.id;return}this._zr.resize(r);var n=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!n){var a=n.resetOption("media"),i=r&&r.silent;this[tn]&&(i==null&&(i=this[tn].silent),a=!0,this[tn]=null),this[zr]=!0,xd(this);try{a&&ic(this),fs.update.call(this,{type:"resize",animation:te({duration:0},r&&r.animation)})}catch(o){throw this[zr]=!1,o}this[zr]=!1,md.call(this,i),yd.call(this,i)}}},t.prototype.showLoading=function(r,n){if(this._disposed){this.id;return}if(Re(r)&&(n=r,r=""),r=r||"default",this.hideLoading(),!!sA[r]){var a=sA[r](this._api,n),i=this._zr;this._loadingFX=a,i.add(a)}},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=te({},r);return n.type=nA[r.type],n},t.prototype.dispatchAction=function(r,n){if(this._disposed){this.id;return}if(Re(n)||(n={silent:!!n}),!!eb[r.type]&&this._model){if(this[zr]){this._pendingActions.push(r);return}var a=n.silent;fC.call(this,r,a);var i=n.flush;i?this._zr.flush():i!==!1&&xt.browser.weChat&&this._throttledZrFlush(),md.call(this,a),yd.call(this,a)}},t.prototype.updateLabelLayout=function(){qa.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(r){if(this._disposed){this.id;return}var n=r.seriesIndex,a=this.getModel(),i=a.getSeriesByIndex(n);i.appendData(r),this._scheduler.unfinished=!0,this.getZr().wakeUp()},t.internalField=function(){ic=function(h){eoe(h._model);var f=h._scheduler;f.restorePipelines(h._zr,h._model),f.prepareStageTasks(),hC(h,!0),hC(h,!1),f.plan()},hC=function(h,f){for(var v=h._model,g=h._scheduler,m=f?h._componentsViews:h._chartsViews,y=f?h._componentsMap:h._chartsMap,x=h._zr,_=h._api,w=0;wTe(f.get("hoverLayerThreshold"),SH.hoverLayerThreshold)&&!xt.node&&!xt.worker;(h._usingTHL||y)&&(f.eachSeries(function(x){if(!x.preventUsingHoverLayer){var _=h._chartsMap[x.__viewId];_.__alive&&_.eachRendered(function(w){var S=w.states.emphasis;S&&S.hoverLayer!==vv&&(S.hoverLayer=y?F7:B7)})}}),h._usingTHL=y)}}function s(h,f){var v=h.get("blendMode")||null;f.eachRendered(function(g){g.isGroup||(g.style.blend=v)})}function l(h,f){if(!h.preventAutoZ){var v=lh(h);f.eachRendered(function(g){return z1(g,v.z,v.zlevel),!0})}}function u(h,f){f.eachRendered(function(v){if(!vf(v)){var g=v.getTextContent(),m=v.getTextGuideLine();v.stateTransition&&(v.stateTransition=null),g&&g.stateTransition&&(g.stateTransition=null),m&&m.stateTransition&&(m.stateTransition=null),v.hasState()?(v.prevStates=v.currentStates,v.clearStates()):v.prevStates&&(v.prevStates=null)}})}function c(h,f){var v=h.getModel("stateAnimation"),g=h.isAnimationEnabled(),m=v.get("duration"),y=m>0?{duration:m,delay:v.get("delay"),easing:v.get("easing")}:null;f.eachRendered(function(x){if(x.states&&x.states.emphasis){if(vf(x))return;if(x instanceof pt&&ane(x),x.__dirty){var _=x.prevStates;_&&x.useStates(_)}if(g){x.stateTransition=y;var w=x.getTextContent(),S=x.getTextGuideLine();w&&(w.stateTransition=y),S&&(S.stateTransition=y)}x.__dirty&&i(x)}})}bO=function(h){return new(function(f){X(v,f);function v(){return f!==null&&f.apply(this,arguments)||this}return v.prototype.getCoordinateSystems=function(){return h._coordSysMgr.getCoordinateSystems()},v.prototype.getComponentByElement=function(g){for(;g;){var m=g.__ecComponentInfo;if(m!=null)return h._model.getComponent(m.mainType,m.index);g=g.parent}},v.prototype.enterEmphasis=function(g,m){Us(g,m),Wa(h)},v.prototype.leaveEmphasis=function(g,m){Ws(g,m),Wa(h)},v.prototype.enterBlur=function(g){w7(g),Wa(h)},v.prototype.leaveBlur=function(g){Kk(g),Wa(h)},v.prototype.enterSelect=function(g){S7(g),Wa(h)},v.prototype.leaveSelect=function(g){C7(g),Wa(h)},v.prototype.getModel=function(){return h.getModel()},v.prototype.getViewOfComponentModel=function(g){return h.getViewOfComponentModel(g)},v.prototype.getViewOfSeriesModel=function(g){return h.getViewOfSeriesModel(g)},v.prototype.getECUpdateCycleVersion=function(){return h[g0]},v.prototype.usingTHL=function(){return h._usingTHL},v}(g7))(h)},kU=function(h){function f(v,g){for(var m=0;m=0)){SO.push(r);var o=nU.wrapStageHandler(r,a);o.__prio=t,o.__raw=r,e.push(o)}}function HL(e,t){sA[e]=t}function tse(e){QV({createCanvas:e})}function RU(e,t,r){var n=hU("registerMap");n&&n(e,t,r)}function rse(e){var t=hU("getMap");return t&&t(e)}var OU=uie;Tu(EL,Eie);Tu($1,Rie);Tu($1,Oie);Tu(EL,Xie);Tu($1,qie);Tu(wU,Noe);FL(LH);VL(joe,Gae);HL("default",zie);Xi({type:Fc,event:Fc,update:Fc},hr);Xi({type:Ex,event:Ex,update:Ex},hr);Xi({type:B_,event:Xk,update:B_,action:hr,refineEvent:UL,publishNonRefinedEvent:!0});Xi({type:jM,event:Xk,update:jM,action:hr,refineEvent:UL,publishNonRefinedEvent:!0});Xi({type:F_,event:Xk,update:F_,action:hr,refineEvent:UL,publishNonRefinedEvent:!0});function UL(e,t,r,n){return{eventContent:{selected:Qre(r),isFromClick:t.isFromClick||!1}}}BL("default",{});BL("dark",sU);var nse={},CO=[],ase={registerPreprocessor:FL,registerProcessor:VL,registerPostInit:PU,registerPostUpdate:DU,registerUpdateLifecycle:Z1,registerAction:Xi,registerCoordinateSystem:jU,registerLayout:EU,registerVisual:Tu,registerTransform:OU,registerLoading:HL,registerMap:RU,registerImpl:Jie,PRIORITY:SU,ComponentModel:ht,ComponentView:Yt,SeriesModel:Ut,ChartView:Rt,registerComponentModel:function(e){ht.registerClass(e)},registerComponentView:function(e){Yt.registerClass(e)},registerSeriesModel:function(e){Ut.registerClass(e)},registerChartView:function(e){Rt.registerClass(e)},registerCustomSeries:function(e,t){fU(e,t)},registerSubTypeDefaulter:function(e,t){ht.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){OG(e,t)}};function rt(e){if(ae(e)){R(e,function(t){rt(t)});return}Ye(CO,e)>=0||(CO.push(e),Le(e)&&(e={install:e}),e.install(ase))}function ap(e){return e==null?0:e.length||1}function TO(e){return e}var $s=function(){function e(t,r,n,a,i,o){this._old=t,this._new=r,this._oldKeyGetter=n||TO,this._newKeyGetter=a||TO,this.context=i,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={},a=new Array(t.length),i=new Array(r.length);this._initIndexMap(t,null,a,"_oldKeyGetter"),this._initIndexMap(r,n,i,"_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(i,n)},e.prototype._executeMultiple=function(){var t=this._old,r=this._new,n={},a={},i=[],o=[];this._initIndexMap(t,n,i,"_oldKeyGetter"),this._initIndexMap(r,a,o,"_newKeyGetter");for(var s=0;s1&&f===1)this._updateManyToOne&&this._updateManyToOne(c,u),a[l]=null;else if(h===1&&f>1)this._updateOneToMany&&this._updateOneToMany(c,u),a[l]=null;else if(h===1&&f===1)this._update&&this._update(c,u),a[l]=null;else if(h>1&&f>1)this._updateManyToMany&&this._updateManyToMany(c,u),a[l]=null;else if(h>1)for(var v=0;v1)for(var s=0;s30}var ip=Re,fl=oe,cse=typeof Int32Array>"u"?Array:Int32Array,hse="e\0\0",MO=-1,dse=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],fse=["_approximateExtent"],AO,_0,op,sp,gC,lp,mC,Bn=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,a=!1;BU(t)?(n=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(a=!0,n=t),n=n||["x","y"];for(var i={},o=[],s={},l=!1,u={},c=0;c=r)){var n=this._store,a=n.getProvider();this._updateOrdinalMeta();var i=this._nameList,o=this._idList,s=a.getSource().sourceFormat,l=s===Ba;if(l&&!a.pure)for(var u=[],c=t;c0},e.prototype.ensureUniqueItemVisual=function(t,r){var n=this._itemVisuals,a=n[t];a||(a=n[t]={});var i=a[r];return i==null&&(i=this.getVisual(r),ae(i)?i=i.slice():ip(i)&&(i=te({},i)),a[r]=i),i},e.prototype.setItemVisual=function(t,r,n){var a=this._itemVisuals[t]||{};this._itemVisuals[t]=a,ip(r)?te(a,r):a[r]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(t,r){ip(t)?te(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?te(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){R(this._graphicEls,function(n,a){n&&t&&t.call(r,n,a)})},e.prototype.cloneShallow=function(t){return t||(t=new e(this._schema?this._schema:fl(this.dimensions,this._getDimInfo,this),this.hostModel)),gC(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(t,r){var n=this[t];Le(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var a=n.apply(this,arguments);return r.apply(this,[a].concat(x1(arguments)))})},e.internalField=function(){AO=function(t){var r=t._invertedIndicesMap;R(r,function(n,a){var i=t._dimInfos[a],o=i.ordinalMeta,s=t._store;if(o){n=r[a]=new cse(o.categories.length);for(var l=0;l1&&(l+="__ec__"+c),a[r]=l}}}(),e}();function vse(e,t){return wv(e,t).dimensions}function wv(e,t){NL(e)||(e=kL(e)),t=t||{};var r=t.coordDimensions||[],n=t.dimensionsDefine||e.dimensionsDefine||[],a=we(),i=[],o=pse(e,r,n,t.dimensionsCount),s=t.canOmitUnusedDimensions&&VU(o),l=n===e.dimensionsDefine,u=l?FU(e):WL(n),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var h=we(c),f=new HH(o),v=0;v0&&(k.name=k.name+(P-1))}),new zU({source:e,dimensions:i,fullDimensionCount:o,dimensionOmitted:s})}function pse(e,t,r,n){var a=Math.max(e.dimensionsDetectedCount||1,t.length,r.length,n||0);return R(t,function(i){var o;Re(i)&&(o=i.dimsDef)&&(a=Math.max(a,o.length))}),a}function gse(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 mse=function(){function e(t){this.coordSysDims=[],this.axisMap=we(),this.categoryAxisMap=we(),this.coordSysName=t}return e}();function yse(e){var t=e.get("coordinateSystem"),r=new mse(t),n=xse[t];if(n)return n(e,r,r.axisMap,r.categoryAxisMap),r}var xse={cartesian2d:function(e,t,r,n){var a=e.getReferringComponents("xAxis",pr).models[0],i=e.getReferringComponents("yAxis",pr).models[0];t.coordSysDims=["x","y"],r.set("x",a),r.set("y",i),_d(a)&&(n.set("x",a),t.firstCategoryDimIndex=0),_d(i)&&(n.set("y",i),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,r,n){var a=e.getReferringComponents("singleAxis",pr).models[0];t.coordSysDims=["single"],r.set("single",a),_d(a)&&(n.set("single",a),t.firstCategoryDimIndex=0)},polar:function(e,t,r,n){var a=e.getReferringComponents("polar",pr).models[0],i=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],r.set("radius",i),r.set("angle",o),_d(i)&&(n.set("radius",i),t.firstCategoryDimIndex=0),_d(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 a=e.ecModel,i=a.getComponent("parallel",e.get("parallelIndex")),o=t.coordSysDims=i.dimensions.slice();R(i.parallelAxisIndex,function(s,l){var u=a.getComponent("parallelAxis",s),c=o[l];r.set(c,u),_d(u)&&(n.set(c,u),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=l))})},matrix:function(e,t,r,n){var a=e.getReferringComponents("matrix",pr).models[0];t.coordSysDims=["x","y"];var i=a.getDimensionModel("x"),o=a.getDimensionModel("y");r.set("x",i),r.set("y",o),n.set("x",i),n.set("y",o)}};function _d(e){return e.get("type")==="category"}function GU(e,t,r){r=r||{};var n=r.byIndex,a=r.stackedCoordDimension,i,o,s;_se(t)?i=t:(o=t.schema,i=o.dimensions,s=t.store);var l=!!(e&&e.get("stack")),u,c,h,f,v=!0;function g(S){return S.type!=="ordinal"&&S.type!=="time"}if(R(i,function(S,C){ve(S)&&(i[C]=S={name:S}),g(S)||(v=!1)}),R(i,function(S,C){l&&!S.isExtraCoord&&(!n&&!u&&S.ordinalMeta&&(u=S),!c&&g(S)&&(!v||S.coordDim!=="x"&&S.coordDim!=="angle")&&(!a||a===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,x=0;R(i,function(S){S.coordDim===m&&x++});var _={name:h,coordDim:m,coordDimIndex:x,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},w={name:f,coordDim:f,coordDimIndex:x+1,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};o?(s&&(_.storeDimIndex=s.ensureCalculationDimension(f,y),w.storeDimIndex=s.ensureCalculationDimension(h,y)),o.appendCalculationDimension(_),o.appendCalculationDimension(w)):(i.push(_),i.push(w))}return{stackedDimension:c&&c.name,stackedByDimension:u&&u.name,isStackedByIndex:n,stackedOverDimension:f,stackResultDimension:h}}function _se(e){return!BU(e.schema)}function Zs(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function $L(e,t){return Zs(e,t)?e.getCalculationInfo("stackResultDimension"):t}function bse(e,t){var r=e.get("coordinateSystem"),n=yv.get(r),a;return t&&t.coordSysDims&&(a=oe(t.coordSysDims,function(i){var o={name:i},s=t.axisMap.get(i);if(s){var l=s.get("type");o.type=nb(l)}return o})),a||(a=n&&(n.getDimensionsInfo?n.getDimensionsInfo():n.dimensions.slice())||["x","y"]),a}function wse(e,t,r){var n,a;return r&&R(e,function(i,o){var s=i.coordDim,l=r.categoryAxisMap.get(s);l&&(n==null&&(n=o),i.ordinalMeta=l.getOrdinalMeta(),t&&(i.createInvertedIndices=!0)),i.otherDims.itemName!=null&&(a=!0)}),!a&&n!=null&&(e[n].otherDims.itemName=0),n}function Jo(e,t,r){r=r||{};var n=t.getSourceManager(),a,i=!1;e?(i=!0,a=kL(e)):(a=n.getSource(),i=a.sourceFormat===Ba);var o=yse(t),s=bse(t,o),l=r.useEncodeDefaulter,u=Le(l)?l:l?nt(TH,s,t):null,c={coordDimensions:s,generateCoord:r.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!i},h=wv(a,c),f=wse(h.dimensions,r.createInvertedIndices,o),v=i?null:n.getSharedDataStore(h),g=GU(t,{schema:h,store:v}),m=new Bn(h,t);m.setCalculationInfo(g);var y=f!=null&&Sse(a)?function(x,_,w,S){return S===f?w:this.defaultDimValueGetter(x,_,w,S)}:null;return m.hasItemOption=!1,m.initData(i?a:v,null,y),m}function Sse(e){if(e.sourceFormat===Ba){var t=Cse(e.data||[]);return!ae(ov(t))}}function Cse(e){for(var t=0;t=t[0]&&e<=t[1]},getExtent:function(){return this._extents[fa].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){NO(this._extents,fa,e,t)},setExtent2:function(e,t,r){var n=this._extents;n[e]||(n[e]=n[fa].slice()),NO(n,e,t,r)},freeze:function(){}};function NO(e,t,r,n){ah(r,n)&&(e[t][0]=r,e[t][1]=n)}function WU(e){return ib(e)||Bf(e)}function ib(e){return e.type==="interval"}function qm(e){return e.type==="time"}function Bf(e){return e.type==="log"}function Vn(e){return e.type==="ordinal"}function Lse(e){var t=M1(e),r=Dh(10,t),n=Fo(e/r);return n?n===2?n=3:n===3?n=5:n*=2:n=1,Mt(n*r,-t)}function ch(e){return _o(e)+2}function b0(e,t){return eh(e)/eh(t)}function yC(e,t,r){var n=r&&r.lookup;if(n){for(var a=0;a1&&i/o>2&&(a=Math.round(Math.ceil(a/o)*o)),a!==n[0]&&l(n[0],!0,!0);for(var s=a;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 sm=function(e){X(t,e);function t(r){var n=e.call(this)||this;n.type="ordinal",n.parse=t.parse,YL(n,t.decoratedMethods);var a=r.ordinalMeta;a||(a=new am({})),ae(a)&&(a=new am({categories:oe(a,function(o){return Re(o)?o.value:o})})),n._ordinalMeta=a;var i=ZL(null,null,r.extent||[0,a.categories.length-1]);return n._mapper=i.mapper,XL(n),n}return t.parse=function(r){return r==null?r=NaN:ve(r)?(r=this._ordinalMeta.getOrdinal(r),r==null&&(r=NaN)):r=Fo(r),r},t.prototype.getTicks=function(){var r=[];return ZU(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,a=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Et(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=Et(m,o[1]),y===g&&(m=o[1])}if(h.push({value:m}),m=Mt(m+a,s),u){var x=u.calcNiceTickMultiple(m,v);x>=0&&(m=Mt(m+x*a,s))}if(h.length>0&&m===h[h.length-1].value)break;if(h.length>f)return[]}var _=h.length?h[h.length-1].value:o[1];return i[1]>_&&h.push({value:r.expandToNicedExtent?Mt(_+a,s):i[1]}),c&&l.pruneTicksByBreak(r.pruneByBreak,h,u.breaks,function(w){return w.value},n.interval,i),c&&r.breakTicks!=="none"&&l.addBreaksToTicks(h,u.breaks,i),h},t.prototype.getMinorTicks=function(r){return qL(this,r,U_(this),this._cfg.interval)},t.prototype.getLabel=function(r,n){if(r==null)return"";var a=n&&n.precision;a==null?a=_o(r.value)||0:a==="auto"&&(a=this._cfg.intervalPrecision);var i=Mt(r.value,a,!0);return _L(i)},t.type="interval",t}(qi);qi.registerClass(Jl);var Pse=function(e,t,r,n){for(;r>>1;e[a][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function jse(e){var t=30*ai;return e/=t,e>6?6:e>3?3:e>2?2:1}function Ese(e){return e/=dg,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function kO(e,t){return e/=t?fL:dL,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function Rse(e){return at(A1(e,!0),1)}function Ose(e,t,r){var n=Math.max(0,Ye(Ta,t)-1);return $_(new Date(e),Ta[n],r).getTime()}function zse(e,t){var r=new Date(0);r[e](1);var n=r.getTime();r[e](1+t);var a=r.getTime()-n;return function(i,o){return Math.max(0,Math.round((o-i)/a))}}function Bse(e,t,r,n,a,i){var o=3e3,s=tae,l=0;function u(V,U,F,W,$,Z,J){for(var re=zse($,V),Q=U,le=new Date(Q);Qo));)if(le[$](le[W]()+V),Q=le.getTime(),i){var de=i.calcNiceTickMultiple(Q,re);de>0&&(le[$](le[W]()+de*V),Q=le.getTime())}J.push({value:Q,notAdd:Q>n[1]})}function c(V,U,F){var W=[],$=!U.length;if(!XU(fg(V),n[0],n[1],r)){$&&(U=[{value:Ose(n[0],V,r)},{value:n[1]}]);for(var Z=0;Z=n[0]&&J<=n[1]&&u(Q,J,re,le,de,He,W),V==="year"&&F.length>1&&Z===0&&F.unshift({value:F[0].value-Q})}}for(var Z=0;Z=n[0]&&S<=n[1]&&v++)}var C=a/t;if(v>C*1.5&&g>C/1.5||(h.push(_),v>C||e===s[m]))break}f=[]}}}for(var M=It(oe(h,function(V){return It(V,function(U){return U.value>=n[0]&&U.value<=n[1]&&!U.notAdd})}),function(V){return V.length>0}),A=M.length-1,I=[],m=0;mn[0])&&I.unshift({value:n[0],time:{level:0,upperTimeUnit:B,lowerTimeUnit:B},notNice:!0}),(!j||j.values&&(i=s);var l=w0.length,u=Math.min(Pse(w0,i,0,l),l-1),c=w0[u][1],h=w0[Math.max(u-1,0)][0];e.setTimeInterval({approxInterval:i,interval:c,minLevelUnit:h})};qi.registerClass(YU);var S0=0,C0=1,Vse=2,qU=function(e){X(t,e);function t(r){var n=e.call(this)||this;n.type="log",n.parse=Jl.parse,n.base=r.logBase||10;var a=[],i=[],o=n._lookup={from:a,to:i};a[S0]=a[C0]=i[S0]=i[C0]=NaN,YL(n,t.mapperMethods);var s=Mr(),l=r.breakOption,u={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(l,n,{noNegative:!0},Vse,u),n.powStub=new Jl({breakParsed:u.original}),n.intervalStub=new Jl({breakParsed:u.transformed}),XL(n,n.intervalStub),n}return t.prototype.getTicks=function(r){var n=this.base,a=this.powStub,i=Mr(),o=this.intervalStub,s=o.getExtent(),l=a.getExtent(),u={lookup:{from:s,to:l}};return oe(o.getTicks(r||{}),function(c){var h=c.value,f=yC(h,n,u),v;if(i){var g=i.getTicksBreakOutwardTransform(this,c,U_(a),this._lookup);g&&(v=g.vBreak,f=g.tickVal)}return{value:f,break:v}},this)},t.prototype.getMinorTicks=function(r){return qL(this,r,U_(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(b0(r,this.base))},scale:function(r){return yC(this.intervalStub.scale(r),this.base,null)},transformIn:function(r,n){return r=b0(r,this.base),n&&n.depth===Ps?r:this.intervalStub.transformIn(r,n)},transformOut:function(r,n){var a=n?n.depth:null;return LO.depth=a,IO.lookup=this._lookup,yC(a===Ps?r:this.intervalStub.transformOut(r,LO),this.base,IO)},contain:function(r){return this.powStub.contain(r)},setExtent:function(r,n){this.setExtent2(fa,r,n)},setExtent2:function(r,n,a){if(!(!ah(n,a)||n<=0||a<=0)){var i=PO,o=PO;if(r===fa){var s=this._lookup;i=s.to,o=s.from}this.powStub.setExtent2(r,i[S0]=n,i[C0]=a);var l=this.base;this.intervalStub.setExtent2(r,o[S0]=b0(n,l),o[C0]=b0(a,l))}},getFilter:function(){return{g:0}},sanitize:function(r,n){return ah(n[0],n[1])&&mi(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}(qi);qi.registerClass(qU);var LO={},IO={},PO=[],KU={value:1,category:1,time:1,log:1},JU=Qe();function Km(e){var t=e.get("type");return(t==null||!Se(KU,t)&&!qi.getClass(t))&&(t="value"),t}function Sv(e,t,r){var n=Mr(),a;switch(n&&(a=QU(e,t,r)),t){case"category":return new sm({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:gn()});case"time":return new YU({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC"),breakOption:a});case"log":return new qU({logBase:e.get("logBase"),breakOption:a});case"value":return new Jl({breakOption:a});default:return new(qi.getClass(t)||Jl)({})}}function Gse(e,t,r){var n=e.getExtentUnsafe(fa,null),a=n[0],i=n[1];return ah(a,i)?a===t||i===t?Use:at?Hse:uA:uA}var Hse=1,Use=2,uA=3;function Wse(e){JU(e).noOnMyZero=!0}function $se(e){return JU(e).noOnMyZero}function Jm(e){var t=e.getLabelModel().get("formatter");if(e.type==="time"){var r=rae(t);return function(a,i){return e.scale.getFormattedLabel(a,i,r)}}else{if(ve(t))return function(a){var i=e.scale.getLabel(a),o=t.replace("{value}",i??"");return o};if(Le(t)){if(e.type==="category")return function(a,i){return t(ob(e,a),a.value-e.scale.getExtent()[0],null)};var n=Mr();return function(a,i){var o=null;return n&&(o=n.makeAxisLabelFormatterParamBreak(o,a.break)),t(ob(e,a),i,o)}}else return function(a){return e.scale.getLabel(a)}}}function ob(e,t){var r=e.scale;return Vn(r)?r.getLabel(t):t.value}function KL(e){var t=e.get("interval");return t??"auto"}function Zse(e){return e.type==="category"&&KL(e.getLabelModel())===0}function Yse(e,t){var r={};return R(e.mapDimensionsAll(t),function(n){r[$L(e,n)]=!0}),gt(r)}function Ff(e){return e==="middle"||e==="center"}function lm(e){return e.getShallow("show")}function QU(e,t,r){var n=e.get("breaks",!0);if(n!=null)return!Mr()||!r||!Xse(t)?void 0:n}function Xse(e){return e!=="category"}function eW(e,t,r,n,a,i){var o=Bf(e),s=o?e.intervalStub:e;if(s.setExtent(n[0],n[1]),o){var l=e.powStub,u={depth:Ps},c=e.transformOut(n[0],u),h=e.transformOut(n[1],u),f=Ise(r,n);t[0]&&!f[0]&&(c=a[0]),t[1]&&!f[1]&&(h=a[1]),l.setExtent(c,h)}s.setConfig(i)}function Cv(e,t){return Vn(e)?e.getRawOrdinalNumber(t.value):t.value}function Qm(e,t){return Vn(e)&&!!t.get("boundaryGap")}var Tv=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),qse=lv(),sb="|&",Mv=Qe(),tW=-2,Kse=-1,Jse=Qe();function JL(e,t){var r=e.model,n=Mv(_v(r.ecModel)).keyed,a=n&&n.get(t);return a&&a.get(r.uid)}function Qse(e,t){return nW(JL(e,t))}function ele(e,t){var r=[];return rW(e.model.ecModel,function(n){for(var a=0;a0&&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 C=up(t,r.get("startValue",!0)),M=C!=null;!mi(C)&&a&&(C=t.getDefaultStartValue?t.getDefaultStartValue():0),mi(C)&&(M||!_||w)&&(Ch[1]&&!f[1]&&(h[1]=C,f[1]=!0));var A=this._i={scale:t,dataMM:c,noZoomEffMM:h,zoomMM:[],fixMM:f,zoomFixMM:[!1,!1],startValue:C,isBlank:x,incl0:w,tggAxInv:S,ctnShp:i};DO(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,a=t.zoomFixMM,i=t.fixMM,o={fixMM:i,zoomFixMM:a,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],i[0]=a[0]=!0),r[1]!=null&&(s[1]=r[1],i[1]=a[1]=!0),DO(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 DO(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),jx(t))}function up(e,t){return t==null?null:yn(t)?NaN:e.parse(t)}function lle(e,t){var r;if(Vn(e))r=[0,0];else{var n=t.get("boundaryGap");typeof n=="boolean"&&(n=null),r=ae(n)?n:[n,n]}return[jO(r[0]),jO(r[1])]}function jO(e){return Bo(typeof e=="boolean"?0:e,1)||0}function sW(e){var t=ile(e.scale);return t.extent||(t.extent=gn()),t}function ule(e,t){sW(e).dimIdxInCoord=t.get(e.dim)}function fh(e,t){var r=e.scale,n=e.model,a=e.dim;r.rawExtentInfo||cle(r,e,a,n,t)}function cle(e,t,r,n,a){var i=sW(t),o=i.extent,s=!1;tle(t,function(c){if(c.boxCoordinateSystem){var h=dH(c).coord,f=i.dimIdxInCoord;if(f>=0){if(ae(h)){var v=h[f];v!=null&&!ae(v)&&NM(o,e.parse(v))}}}else if(c.coordinateSystem){var g=c.getData();if(g){var m=e.getFilter?e.getFilter():null;R(Yse(g,r),function(y){Vte(o,g.getApproximateExtent(y,m))})}c.__requireStartValue&&c.__requireStartValue(t)&&(s=!0)}});var l=dle(e,t,n),u=new oW(e,n,o,s,l);lW(e,u,a),i.extent=null}function hle(e,t){var r=e.scale;lW(r,new oW(r,e.model,t,!1,!1),sle)}function lW(e,t,r){e.rawExtentInfo=t,t.from=r}function K1(e,t){tI.set(e,t)}var tI=we();function uW(e,t,r,n,a){e.rawExtentInfo||hle({scale:e,model:t},a||gn());var i=e.rawExtentInfo.makeFinal(),o=i.effMM;return e.setExtent(o[0],o[1]),e.setBlank(i.isBlank),n&&i.tggAxInv&&r&&!r.get("legacyMinMaxDontInverseAxis")&&(n.inverse=!n.inverse),i}function dle(e,t,r){var n=Qm(e,r),a=r.get("containShape",!0);if(a==null&&!n&&(a=!0),!a)return!1;var i=!1;return aW(t,function(o){i=!!tI.get(o)||i}),i}function fle(e,t,r,n){if(r.ctnShp){var a;if(aW(e,function(s){var l=tI.get(s);if(l){var u=l(e,n);u&&(a=a||[0,0],JG(a,u[0]),QG(a,u[1]),Wse(e))}}),!!a){var i=t.getExtent();if(Vn(t))e.onBand||t.setExtent2(im,Et(i[0],i[0]+a[0]),at(i[1],i[1]+a[1]));else{var o=i.slice();r.zoomFixMM[0]||(o[0]=Et(o[0],t.transformOut(t.transformIn(o[0],null)+a[0],null))),r.zoomFixMM[1]||(o[1]=at(o[1],t.transformOut(t.transformIn(o[1],null)+a[1],null))),(o[0]i[1])&&t.setExtent2(im,o[0],o[1])}}}}function EO(e,t){var r=Bf(e),n=r?e.intervalStub:e,a=t.fixMinMax||[],i=r?e.getExtent():null,o=n.getExtent(),s=$U(o,a,t.rawExtentResult);n.setExtent(s[0],s[1]),s=n.getExtent();var l=r?ple(n,t):vle(n,t),u=l.intervalPrecision,c=l.interval,h=t.userInterval;h!=null&&(l.interval=h,l.intervalPrecision=ch(h)),a[0]||(s[0]=Mt(gi(s[0]/c)*c,u)),a[1]||(s[1]=Mt(Ph(s[1]/c)*c,u)),h!=null&&(l.niceExtent=s.slice()),eW(e,a,o,s,i,l)}function vle(e,t){var r=X1(t.splitNumber,5),n=Y1(e),a=t.minInterval,i=t.maxInterval,o=A1(n/r,!0);a!=null&&oi&&(o=i);var s=ch(o),l=e.getExtent(),u=[Mt(Ph(l[0]/o)*o,s),Mt(gi(l[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:u}}function ple(e,t){var r=X1(t.splitNumber,10),n=e.getExtent(),a=Y1(e),i=at(zk(a),1),o=r/a*i;o<=.5&&(i*=10);var s=ch(i),l=[Mt(Ph(n[0]/i)*i,s),Mt(gi(n[1]/i)*i,s)];return{intervalPrecision:s,interval:i,niceExtent:l}}function Gf(e){var t=e.scale,r=e.model,n=r.axis,a=r.ecModel;cW(t,r,n,a,null)}function cW(e,t,r,n,a){var i=uW(e,t,n,r,a),o=ib(e)||qm(e);hW(e,{splitNumber:t.get("splitNumber"),fixMinMax:i.fixMM,userInterval:t.get("interval"),minInterval:o?t.get("minInterval"):null,maxInterval:o?t.get("maxInterval"):null,rawExtentResult:i}),r&&n&&fle(r,e,i,n)}function hW(e,t){gle[e.type](e,t)}var gle={interval:EO,log:EO,time:Fse,ordinal:hr};function mle(e){return Jo(null,e)}var yle={isDimensionStacked:Zs,enableDataStack:GU,getStackedDimension:$L};function xle(e,t){var r=t;t instanceof vt||(r=new vt(t));var n=Km(r),a=Sv(r,n,!1);return e[1]a&&(n=o,a=l)}if(n)return Tle(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 a=[1/0,1/0],i=[-1/0,-1/0],o=this.geometries;return R(o,function(s){s.type==="polygon"?OO(s.exterior,a,i,r):R(s.points,function(l){OO(l,a,i,r)})}),isFinite(a[0])&&isFinite(a[1])&&isFinite(i[0])&&isFinite(i[1])||(a[0]=a[1]=i[0]=i[1]=0),n=new je(a[0],a[1],i[0]-a[0],i[1]-a[1]),r||(this._rect=n),n},t.prototype.contain=function(r){var n=this.getBoundingRect(),a=this.geometries;if(!n.contain(r[0],r[1]))return!1;e:for(var i=0,o=a.length;i>1^-(s&1),l=l>>1^-(l&1),s+=a,l+=i,a=s,i=l,n.push([s/r,l/r])}return n}function dA(e,t){return e=Ale(e),oe(It(e.features,function(r){return r.geometry&&r.properties&&r.geometry.coordinates.length>0}),function(r){var n=r.properties,a=r.geometry,i=[];switch(a.type){case"Polygon":var o=a.coordinates;i.push(new zO(o[0],o.slice(1)));break;case"MultiPolygon":R(a.coordinates,function(l){l[0]&&i.push(new zO(l[0],l.slice(1)))});break;case"LineString":i.push(new BO([a.coordinates]));break;case"MultiLineString":i.push(new BO(a.coordinates))}var s=new fW(n[t||"name"],i,n.cp);return s.properties=n,s})}const Nle=Object.freeze(Object.defineProperty({__proto__:null,MAX_SAFE_INTEGER:Yg,asc:on,getPercentWithPrecision:bte,getPixelPrecision:_te,getPrecision:_o,getPrecisionSafe:VG,isNumeric:Bk,isRadianAroundZero:th,linearMap:Nt,nice:A1,numericToNumber:Vo,parseDate:qo,parsePercent:me,quantile:Dx,quantity:zk,quantityExponent:M1,reformIntervals:MM,remRadian:Ok,round:xte},Symbol.toStringTag,{value:"Module"})),kle=Object.freeze(Object.defineProperty({__proto__:null,format:Zm,parse:qo,roundTime:$_},Symbol.toStringTag,{value:"Module"})),Lle=Object.freeze(Object.defineProperty({__proto__:null,Arc:Um,BezierCurve:dv,BoundingRect:je,Circle:Ko,CompoundPath:Wm,Ellipse:Hm,Group:De,Image:Qr,IncrementalDisplayable:O7,Line:Tr,LinearGradient:Eh,Polygon:Sn,Polyline:un,RadialGradient:eL,Rect:it,Ring:hv,Sector:wn,Text:wt,clipPointsByRect:aL,clipRectByRect:U7,createIcon:pv,extendPath:G7,extendShape:V7,getShapeClass:Jg,getTransform:Vc,initProps:Qt,makeImage:rL,makePath:Ef,mergePath:Aa,registerShape:wi,resizePath:nL,updateProps:At},Symbol.toStringTag,{value:"Module"})),Ile=Object.freeze(Object.defineProperty({__proto__:null,addCommas:_L,capitalFirst:cae,encodeHTML:Rn,formatTime:uae,formatTpl:wL,getTextRect:lae,getTooltipMarker:uH,normalizeCssArray:mv,toCamelCase:bL,truncateText:are},Symbol.toStringTag,{value:"Module"})),Ple=Object.freeze(Object.defineProperty({__proto__:null,bind:be,clone:ke,curry:nt,defaults:Ee,each:R,extend:te,filter:It,indexOf:Ye,inherits:Nk,isArray:ae,isFunction:Le,isObject:Re,isString:ve,map:oe,merge:Je,reduce:pi},Symbol.toStringTag,{value:"Module"}));var Dle=Qe(),pg=Qe(),Ui={estimate:1,determine:2};function lb(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function jle(e,t){var r=e.getLabelModel().get("customValues");if(r){var n=e.scale;return{labels:oe(pW(r,n),function(a,i){return{formattedLabel:Jm(e)(a,i),rawLabel:n.getLabel(a),tick:a}})}}return e.type==="category"?Rle(e,t):zle(e)}function Ele(e,t,r){var n=e.scale,a=e.getTickModel().get("customValues");return a?{ticks:pW(a,n)}:e.type==="category"?Ole(e,t):{ticks:n.getTicks(r)}}function pW(e,t){var r=t.getExtent(),n=[];return R(e,function(a){a=t.parse(a),a>=r[0]&&a<=r[1]&&n.push(a)}),N1(n,Wte,null),on(n),oe(n,function(a){return{value:a}})}function Rle(e,t){var r=e.getLabelModel(),n=gW(e,r,t);return!r.get("show")||e.scale.isBlank()?{labels:[]}:n}function gW(e,t,r){var n=Fle(e),a=KL(t),i=r.kind===Ui.estimate;if(!i){var o=yW(n,a);if(o)return o}var s,l;Le(a)?s=ub(e,a,!1):(l=a==="auto"?Vle(e,r):a,s=ub(e,l,!1));var u={labels:s,labelCategoryInterval:l};return i?r.out.noPxChangeTryDetermine.push(function(){return fA(n,a,u),!0}):fA(n,a,u),u}function Ole(e,t){var r=Ble(e),n=KL(t),a=yW(r,n);if(a)return a;var i,o;if((!t.get("show")||e.scale.isBlank())&&(i=[]),Le(n))i=ub(e,n,!0);else if(n==="auto"){var s=gW(e,e.getLabelModel(),lb(Ui.determine));o=s.labelCategoryInterval,i=oe(s.labels,function(l){return l.tick})}else o=n,i=ub(e,o,!0);return fA(r,n,{ticks:i,tickCategoryInterval:o})}function zle(e){var t=e.scale.getTicks(),r=Jm(e);return{labels:oe(t,function(n,a){return{formattedLabel:r(n,a),rawLabel:e.scale.getLabel(n),tick:n}})}}var Ble=mW("axisTick"),Fle=mW("axisLabel");function mW(e){return function(r){return pg(r)[e]||(pg(r)[e]={list:[]})}}function yW(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),v=Math.abs(f*Math.cos(i)),g=Math.abs(f*Math.sin(i)),m=0,y=0;h<=s[1];h+=u){var x=0,_=0,w=S1(a({value:h}),n.font,"center","top");x=w.width*1.3,_=w.height*1.3,m=Math.max(m,x,7),y=Math.max(y,_,7)}var S=m/v,C=y/g;isNaN(S)&&(S=1/0),isNaN(C)&&(C=1/0);var M=Math.max(0,Math.floor(Math.min(S,C)));if(r===Ui.estimate)return t.out.noPxChangeTryDetermine.push(be(Hle,null,e,M,l)),M;var A=xW(e,M,l);return A??M}function Hle(e,t,r){return xW(e,t,r)==null}function xW(e,t,r){var n=Dle(e.model),a=e.getExtent(),i=n.lastAutoInterval,o=n.lastTickCount;if(i!=null&&o!=null&&Math.abs(i-t)<=1&&Math.abs(o-r)<=1&&i>t&&n.axisExtent0===a[0]&&n.axisExtent1===a[1])return i;n.lastTickCount=r,n.lastAutoInterval=t,n.axisExtent0=a[0],n.axisExtent1=a[1]}function Ule(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 ub(e,t,r){var n=Jm(e),a=e.scale,i=[],o=Le(t);return ZU(a,o?0:t,function(s,l){var u=a.getLabel(s);if(o){var c=!!t(s.value,u);if(s.offInterval=!c,!c&&!l)return}i.push(r?s:{formattedLabel:n(s),rawLabel:u,tick:s})}),i}var Wle=.8;function Cn(e,t){t=t||{};var r={w:NaN,w2:NaN},n=e.scale,a=t.fromStat,i=t.min,o=Nse(n);mi(o)||(o=NaN);var s=e.getExtent(),l=cr(s[1]-s[0]);return Vn(n)?$le(r,e,o,l):a&&Zle(r,e,o,l,a),i!=null&&(r.w=mi(r.w)?at(i,r.w):i),r}function $le(e,t,r,n){var a=t.onBand,i=r+(a?1:0);i===0&&(i=1),e.w=n/i,!a&&r&&n&&(e.w2=e.w*r/n)}function Zle(e,t,r,n,a){var i=!1,o=-1/0;R(a.key?[Qse(t,a.key)]:ele(t,a.sers||[]),function(s){var l=s.liPosMinGap;l!=null&&(l>0?(l>o&&(o=l),i=!1):l===tW&&(i=!0))}),mi(r)&&r>0&&mi(o)?(e.w=n/r*o,e.w2=o):i&&(e.w=n*Wle,e.w2=e.w*r/n)}var FO=[0,1],Si=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]),a=Math.max(r[0],r[1]);return t>=n&&t<=a},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)),Nt(t,FO,VO(this),r)},e.prototype.coordToData=function(t,r){var n=Nt(t,VO(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=Ele(this,r,{breakTicks:t.breakTicks,pruneByBreak:t.pruneByBreak}),a=oe(n.ticks,function(s){return{coord:this.dataToCoord(Cv(this.scale,s)),tick:s}},this),i=r.get("alignWithLabel"),o=Yle(this,a,i);return oe(a,function(s){return{coord:s.coord,tickValue:s.tick.value,onBand:o}})},e.prototype.getMinorTicksCoords=function(){if(Vn(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),a=oe(n,function(i){return oe(i,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return a},e.prototype.getViewLabels=function(t){return t=t||lb(Ui.determine),jle(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 Cn(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(t){return t=t||lb(Ui.determine),Gle(this,t)},e}();function VO(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 Yle(e,t,r){var n=t.length;if(!e.onBand||r||!n)return!1;var a=Cn(e).w;if(!a)return!1;R(t,function(s){s.coord-=a/2});var i=e.scale.getExtent(),o=t[n-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+a,tick:{value:i[1]+1}}),!0}function Xle(e){var t=ht.extend(e);return ht.registerClass(t),t}function qle(e){var t=Yt.extend(e);return Yt.registerClass(t),t}function Kle(e){var t=Ut.extend(e);return Ut.registerClass(t),t}function Jle(e){var t=Rt.extend(e);return Rt.registerClass(t),t}var cp=Math.PI*2,oc=Go.CMD,Qle=["top","right","bottom","left"];function eue(e,t,r,n,a){var i=r.width,o=r.height;switch(e){case"top":n.set(r.x+i/2,r.y-t),a.set(0,-1);break;case"bottom":n.set(r.x+i/2,r.y+o+t),a.set(0,1);break;case"left":n.set(r.x-t,r.y+o/2),a.set(-1,0);break;case"right":n.set(r.x+i+t,r.y+o/2),a.set(1,0);break}}function tue(e,t,r,n,a,i,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-a)%cp<1e-4)return l[0]=c,l[1]=h,u-r;if(i){var f=n;n=La(a),a=La(f)}else n=La(n),a=La(a);n>a&&(a+=cp);var v=Math.atan2(s,o);if(v<0&&(v+=cp),v>=n&&v<=a||v+cp>=n&&v+cp<=a)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(a)+e,x=r*Math.sin(a)+t,_=(g-o)*(g-o)+(m-s)*(m-s),w=(y-o)*(y-o)+(x-s)*(x-s);return _0){t=t/180*Math.PI,Ei.fromArray(e[0]),Kt.fromArray(e[1]),Cr.fromArray(e[2]),Oe.sub(wo,Ei,Kt),Oe.sub(xo,Cr,Kt);var r=wo.len(),n=xo.len();if(!(r<.001||n<.001)){wo.scale(1/r),xo.scale(1/n);var a=wo.dot(xo),i=Math.cos(t);if(i1&&Oe.copy(Xn,Cr),Xn.toArray(e[1])}}}}function aue(e,t,r){if(r<=180&&r>0){r=r/180*Math.PI,Ei.fromArray(e[0]),Kt.fromArray(e[1]),Cr.fromArray(e[2]),Oe.sub(wo,Kt,Ei),Oe.sub(xo,Cr,Kt);var n=wo.len(),a=xo.len();if(!(n<.001||a<.001)){wo.scale(1/n),xo.scale(1/a);var i=wo.dot(t),o=Math.cos(r);if(i=l)Oe.copy(Xn,Cr);else{Xn.scaleAndAdd(xo,s/Math.tan(Math.PI/2-c));var h=Cr.x!==Kt.x?(Xn.x-Kt.x)/(Cr.x-Kt.x):(Xn.y-Kt.y)/(Cr.y-Kt.y);if(isNaN(h))return;h<0?Oe.copy(Xn,Kt):h>1&&Oe.copy(Xn,Cr)}Xn.toArray(e[1])}}}}function bC(e,t,r,n){var a=r==="normal",i=a?e:e.ensureState(r);i.ignore=t;var o=n.get("smooth");o=o===!0?.3:Math.max(+o,0)||0,i.shape=i.shape||{},i.shape.smooth=o;var s=n.getModel("lineStyle").getLineStyle();a?e.useStyle(s):i.style=s}function iue(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 a=Ss(n[0],n[1]),i=Ss(n[1],n[2]);if(!a||!i){e.lineTo(n[1][0],n[1][1]),e.lineTo(n[2][0],n[2][1]);return}var o=Math.min(a,i)*r,s=ig([],n[1],n[0],o/a),l=ig([],n[1],n[2],o/i),u=ig([],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(P*k,0,i);var D=P+A;D<0&&C(-D*k,1)}else C(-A*k,1)}}function S(A,I,k){A!==0&&(c=!0);for(var P=I;P0)for(var D=0;D0;D--){var H=k[D-1]*B;S(-H,D,i)}}}function M(A){var I=A<0?-1:1;A=Math.abs(A);for(var k=Math.ceil(A/(i-1)),P=0;P0?S(k,0,P+1):S(-k,i-P-1,i),A-=k,A<=0)return}return c}function lue(e){for(var t=0;t=0&&n.attr(i.oldLayoutSelect),Ye(f,"emphasis")>=0&&n.attr(i.oldLayoutEmphasis)),At(n,u,r,l)}else if(n.attr(u),!gv(n).valueAnimation){var h=Te(n.style.opacity,1);n.style.opacity=0,Qt(n,{style:{opacity:h}},r,l)}if(i.oldLayout=u,n.states.select){var v=i.oldLayoutSelect={};T0(v,u,M0),T0(v,n.states.select,M0)}if(n.states.emphasis){var g=i.oldLayoutEmphasis={};T0(g,u,M0),T0(g,n.states.emphasis,M0)}q7(n,l,c,r,r)}if(a&&!a.ignore&&!a.invisible){var i=hue(a),o=i.oldLayout,m={points:a.shape.points};o?(a.attr({shape:o}),At(a,{shape:m},r)):(a.setShape(m),a.style.strokePercent=0,Qt(a,{style:{strokePercent:1}},r)),i.oldLayout=m}},e}(),CC=Qe();function fue(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){var a=CC(r).labelManager;a||(a=CC(r).labelManager=new due),a.clearLabels()}),e.registerUpdateLifecycle("series:layoutlabels",function(t,r,n){var a=CC(r).labelManager;R(n.updatedSeries,function(i){a.addLabelsOfSeries(r.getViewOfSeriesModel(i))}),a.updateLayoutConfig(r),a.layout(r),a.processLabelsOverall()})}var TC=Math.sin,MC=Math.cos,MW=Math.PI,sc=Math.PI*2,vue=180/MW,AW=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,a,i,o){this._add("C",t,r,n,a,i,o)},e.prototype.quadraticCurveTo=function(t,r,n,a){this._add("Q",t,r,n,a)},e.prototype.arc=function(t,r,n,a,i,o){this.ellipse(t,r,n,n,0,a,i,o)},e.prototype.ellipse=function(t,r,n,a,i,o,s,l){var u=s-o,c=!l,h=Math.abs(u),f=Dl(h-sc)||(c?u>=sc:-u>=sc),v=u>0?u%sc:u%sc+sc,g=!1;f?g=!0:Dl(h)?g=!1:g=v>=MW==!!c;var m=t+n*MC(o),y=r+a*TC(o);this._start&&this._add("M",m,y);var x=Math.round(i*vue);if(f){var _=1/this._p,w=(c?1:-1)*(sc-_);this._add("A",n,a,x,1,+c,t+n*MC(o+w),r+a*TC(o+w)),_>.01&&this._add("A",n,a,x,0,+c,m,y)}else{var S=t+n*MC(s),C=r+a*TC(s);this._add("A",n,a,x,+g,+c,S,C)}},e.prototype.rect=function(t,r,n,a){this._add("M",t,r),this._add("l",n,0),this._add("l",0,a),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,a,i,o,s,l,u){for(var c=[],h=this._p,f=1;f"}function Sue(e){return""}function iI(e,t){t=t||{};var r=t.newline?` -`:"";function n(a){var i=a.children,o=a.tag,s=a.attrs,l=a.text;return wue(o,s)+(o!=="style"?Rn(l):l||"")+(i?""+r+oe(i,function(u){return n(u)}).join(r)+r:"")+Sue(o)}return n(e)}function Cue(e,t,r){r=r||{};var n=r.newline?` -`:"",a=" {"+n,i=n+"}",o=oe(gt(e),function(l){return l+a+oe(gt(e[l]),function(u){return u+":"+e[l][u]+";"}).join(n)+i}).join(n),s=oe(gt(t),function(l){return"@keyframes "+l+a+oe(gt(t[l]),function(u){return u+a+oe(gt(t[l][u]),function(c){var h=t[l][u][c];return c==="d"&&(h='path("'+h+'")'),c+":"+h+";"}).join(n)+i}).join(n)+i}).join(n);return!o&&!s?"":[""].join(n)}function yA(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function ZO(e,t,r,n){return Xr("svg","root",{width:e,height:t,xmlns:NW,"xmlns:xlink":kW,version:"1.1",baseProfile:"full",viewBox:n?"0 0 "+e+" "+t:!1},r)}var Tue=0;function IW(){return Tue++}var YO={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"},gc="transform-origin";function Mue(e,t,r){var n=te({},e.shape);te(n,t),e.buildPath(r,n);var a=new AW;return a.reset(LG(e)),r.rebuildPath(a,1),a.generateStr(),a.getStr()}function Aue(e,t){var r=t.originX,n=t.originY;(r||n)&&(e[gc]=r+"px "+n+"px")}var Nue={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function PW(e,t){var r=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[r]=e,r}function kue(e,t,r){var n=e.shape.paths,a={},i,o;if(R(n,function(l){var u=yA(r.zrId);u.animation=!0,Q1(l,{},u,!0);var c=u.cssAnims,h=u.cssNodes,f=gt(c),v=f.length;if(v){o=f[v-1];var g=c[o];for(var m in g){var y=g[m];a[m]=a[m]||{d:""},a[m].d+=y.d||""}for(var x in h){var _=h[x].animation;_.indexOf(o)>=0&&(i=_)}}}),!!i){t.d=!1;var s=PW(a,r);return i.replace(o,s)}}function XO(e){return ve(e)?YO[e]?"cubic-bezier("+YO[e]+")":Pk(e)?e:"":""}function Q1(e,t,r,n){var a=e.animators,i=a.length,o=[];if(e instanceof Wm){var s=kue(e,t,r);if(s)o.push(s);else if(!i)return}else if(!i)return;for(var l={},u=0;u0}).length){var He=PW(A,r);return He+" "+_[0]+" both"}}for(var y in l){var s=m(l[y]);s&&o.push(s)}if(o.length){var x=r.zrId+"-cls-"+IW();r.cssNodes["."+x]={animation:o.join(",")},t.class=x}}function Lue(e,t,r){if(!e.ignore)if(e.isSilent()){var n={"pointer-events":"none"};qO(n,t,r)}else{var a=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},i=a.fill;if(!i){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&&(i=I_(l))}var u=a.lineWidth;if(u){var c=!a.strokeNoScale&&e.transform?e.transform[0]:1;u=u/c}var n={cursor:"pointer"};i&&(n.fill=i),a.stroke&&(n.stroke=a.stroke),u&&(n["stroke-width"]=u),qO(n,t,r)}}function qO(e,t,r,n){var a=JSON.stringify(e),i=r.cssStyleCache[a];i||(i=r.zrId+"-cls-"+IW(),r.cssStyleCache[a]=i,r.cssNodes["."+i+":hover"]=e),t.class=t.class?t.class+" "+i:i}var um=Math.round;function DW(e){return e&&ve(e.src)}function jW(e){return e&&Le(e.toDataURL)}function oI(e,t,r,n){xue(function(a,i){var o=a==="fill"||a==="stroke";o&&kG(i)?RW(t,e,a,n):o&&jk(i)?OW(r,e,a,n):e[a]=i,o&&n.ssr&&i==="none"&&(e["pointer-events"]="visible")},t,r,!1),Oue(r,e,n)}function sI(e,t){var r=zG(t);r&&(r.each(function(n,a){n!=null&&(e[($O+a).toLowerCase()]=n+"")}),t.isSilent()&&(e[$O+"silent"]="true"))}function KO(e){return Dl(e[0]-1)&&Dl(e[1])&&Dl(e[2])&&Dl(e[3]-1)}function Iue(e){return Dl(e[4])&&Dl(e[5])}function lI(e,t,r){if(t&&!(Iue(t)&&KO(t))){var n=1e4;e.transform=KO(t)?"translate("+um(t[4]*n)/n+" "+um(t[5]*n)/n+")":Pee(t)}}function JO(e,t,r){for(var n=e.points,a=[],i=0;i"u"){var y="Image width/height must been given explictly in svg-ssr renderer.";bn(f,y),bn(v,y)}else if(f==null||v==null){var x=function(P,D){if(P){var z=P.elm,j=f||D.width,B=v||D.height;P.tag==="pattern"&&(u?(B=1,j/=i.width):c&&(j=1,B/=i.height)),P.attrs.width=j,P.attrs.height=B,z&&(z.setAttribute("width",j),z.setAttribute("height",B))}},_=Wk(g,null,e,function(P){l||x(M,P),x(h,P)});_&&_.width&&_.height&&(f=f||_.width,v=v||_.height)}h=Xr("image","img",{href:g,width:f,height:v}),o.width=f,o.height=v}else a.svgElement&&(h=ke(a.svgElement),o.width=a.svgWidth,o.height=a.svgHeight);if(h){var w,S;l?w=S=1:u?(S=1,w=o.width/i.width):c?(w=1,S=o.height/i.height):o.patternUnits="userSpaceOnUse",w!=null&&!isNaN(w)&&(o.width=w),S!=null&&!isNaN(S)&&(o.height=S);var C=IG(a);C&&(o.patternTransform=C);var M=Xr("pattern","",o,[h]),A=iI(M),I=n.patternCache,k=I[A];k||(k=n.zrId+"-p"+n.patternIdx++,I[A]=k,o.id=k,M=n.defs[k]=Xr("pattern",k,o,[h])),t[r]=w1(k)}}function zue(e,t,r){var n=r.clipPathCache,a=r.defs,i=n[e.id];if(!i){i=r.zrId+"-c"+r.clipPathIdx++;var o={id:i};n[e.id]=i,a[i]=Xr("clipPath",i,o,[EW(e,r)])}t["clip-path"]=w1(i)}function t5(e){return document.createTextNode(e)}function Sc(e,t,r){e.insertBefore(t,r)}function r5(e,t){e.removeChild(t)}function n5(e,t){e.appendChild(t)}function zW(e){return e.parentNode}function BW(e){return e.nextSibling}function AC(e,t){e.textContent=t}var a5=58,Bue=120,Fue=Xr("","");function xA(e){return e===void 0}function go(e){return e!==void 0}function Vue(e,t,r){for(var n={},a=t;a<=r;++a){var i=e[a].key;i!==void 0&&(n[i]=a)}return n}function Vp(e,t){var r=e.key===t.key,n=e.tag===t.tag;return n&&r}function cm(e){var t,r=e.children,n=e.tag;if(go(n)){var a=e.elm=LW(n);if(uI(Fue,e),ae(r))for(t=0;ti?(g=r[l+1]==null?null:r[l+1].elm,FW(e,g,r,a,l)):vb(e,t,n,i))}function jd(e,t){var r=t.elm=e.elm,n=e.children,a=t.children;e!==t&&(uI(e,t),xA(t.text)?go(n)&&go(a)?n!==a&&Gue(r,n,a):go(a)?(go(e.text)&&AC(r,""),FW(r,null,a,0,a.length-1)):go(n)?vb(r,n,0,n.length-1):go(e.text)&&AC(r,""):e.text!==t.text&&(go(n)&&vb(r,n,0,n.length-1),AC(r,t.text)))}function Hue(e,t){if(Vp(e,t))jd(e,t);else{var r=e.elm,n=zW(r);cm(t),n!==null&&(Sc(n,t.elm,BW(r)),vb(n,[e],0,0))}return t}var Uue=0,Wue=function(){function e(t,r,n){if(this.type="svg",this.configLayer=$ue(),this.storage=r,this._opts=n=te({},n),this.root=t,this._id="zr"+Uue++,this._oldVNode=ZO(n.width,n.height),t&&!n.ssr){var a=this._viewport=document.createElement("div");a.style.cssText="position:relative;overflow:hidden";var i=this._svgDom=this._oldVNode.elm=LW("svg");uI(null,this._oldVNode),a.appendChild(i),t.appendChild(a)}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",Hue(this._oldVNode,t),this._oldVNode=t}},e.prototype.renderOneToVNode=function(t){return e5(t,yA(this._id))},e.prototype.renderToVNode=function(t){t=t||{};var r=this.storage.getDisplayList(!0),n=this._width,a=this._height,i=yA(this._id);i.animation=t.animation,i.willUpdate=t.willUpdate,i.compress=t.compress,i.emphasis=t.emphasis,i.ssr=this._opts.ssr;var o=[],s=this._bgVNode=Zue(n,a,this._backgroundColor,i);s&&o.push(s);var l=t.compress?null:this._mainVNode=Xr("g","main",{},[]);this._paintList(r,i,l?l.children:o),l&&o.push(l);var u=oe(gt(i.defs),function(f){return i.defs[f]});if(u.length&&o.push(Xr("defs","defs",{},u)),t.animation){var c=Cue(i.cssNodes,i.cssAnims,{newline:!0});if(c){var h=Xr("style","stl",{},[],c);o.push(h)}}return ZO(n,a,o,t.useViewBox)},e.prototype.renderToString=function(t){return t=t||{},iI(this.renderToVNode({animation:Te(t.cssAnimation,!0),emphasis:Te(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Te(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 a=t.length,i=[],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=i[o-1];for(var x=m+1;x=s)}}for(var h=o5(this),f=h.startIdx;f=0)&&(o=!0)}),!(!o&&!i.__dirty)){var s=n._opts.useDirtyRect&&!NC(i)?i.createRepaintRects(t,r,n._width,n._height):null,l=n._i.layerStack[0],u=!0;if(i.__dirty){u=!1,i.__dirty=!1;var c=i.zlevel===l.zl&&i.zlevel2===l.zl2?n._backgroundColor:null;i.clear(!1,c,s)}A0(i,function(h){var f=n._paintPerCursor(i,h,t,s,u);a=a&&f})}},N0),xt.wxa&&In(this._i,function(i){i&&i.ctx&&i.ctx.draw&&i.ctx.draw()}),a},e.prototype._paintPerCursor=function(t,r,n,a,i){var o=t.ctx;if(a)if(!a.length)r.drawIdx=r.endIdx;else for(var s=this.dpr,l=0;l=r.endIdx},e.prototype._paintPerCursorInRect=function(t,r,n,a,i){for(var o={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},s=t.ctx,l=NC(t),u=l&&qr.getTime(),c=r.drawIdx,h=r.notClearIdx,f=h>=0?Math.min(h,c):c;f15){f++;break}}}}yf(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 a=this._singleCanvas;a&&!this._needsManuallyCompositing&&(t=lc,r=0);var i=IC(this._i,t)[r];return i||(i=l5("zr_"+t+"."+r,this,t,r),this._layerConfig[t]&&Je(i,this._layerConfig[t],!0),(n||a&&t!==lc)&&(i.virtual=!0),this._insertLayer(i,t,r,!1),i.initContext()),i},e.prototype.insertLayer=function(t,r){this._insertLayer(r,t,0,!1)},e.prototype._insertLayer=function(t,r,n,a){var i=this._i,o=i.layers,s=i.layerStack,l=this._domRoot,u=null;if(!(o[r]&&o[r][n])&&que(t)){for(var c=s.length,h=0;h0&&(u=IC(i,s[h-1].zl)[s[h-1].zl2]),s.splice(h,0,{zl:r,zl2:n}),IC(i,r)[n]=t,!a&&!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 In(this._i,function(n,a){t.call(r,n,a)})},e.prototype.eachBuiltinLayer=function(t,r){return In(this._i,function(n,a){t.call(r,n,a)},gg)},e.prototype.eachOtherLayer=function(t,r){return In(this._i,function(n,a){t.call(r,n,a)},_A)},e.prototype.getLayers=function(){var t={};return In(this._i,function(r,n,a){t[r.id]=r}),t},e.prototype._updateLayerStatus=function(t,r){var n=this;if(n._singleCanvas)for(var a=1;a=0;w--){var S=_.get(x[w]);if(!S.used)y.__dirty=!0,_.removeKey(x[w]),x.splice(w,1);else{var C=S.endIdxNew;(NC(y)?C=0;a--){var i=r[a];if(i.zl===t){var o=n[t][i.zl2];if(o.__builtin__)continue;if(r.splice(a,1),n[t][i.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 a=this._opts,i=this.root;t!=null&&(a.width=t),r!=null&&(a.height=r),t=Qd(i,0,a),r=Qd(i,1,a),n.style.display="",(this._width!==t||r!==this._height)&&(n.style.width=t+"px",n.style.height=r+"px",In(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(lc).resize(t,r)}return this},e.prototype.clearLayer=function(t){R(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[lc][0].dom;var r=new VW("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 a=r.dom.width,i=r.dom.height;In(this._i,function(h){h.__builtin__?n.drawImage(h.dom,0,0,a,i):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}(Ut);function Hf(e,t){var r=e.mapDimensionsAll("defaultedLabel"),n=r.length;if(n===1){var a=Of(e,t,r[0]);return a!=null?a+"":null}else if(n){for(var i=[],o=0;o=0&&n.push(t[i])}return n.join(" ")}var ey=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this)||this;return o.updateData(r,n,a,i),o}return t.prototype._createSymbol=function(r,n,a,i,o,s){this.removeAll();var l=Ar(r,-1,-1,2,2,null,s);l.attr({z2:Te(o,100),culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),l.drift=nce,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(){Us(this.childAt(0))},t.prototype.downplay=function(){Ws(this.childAt(0))},t.prototype.setZ=function(r,n){var a=this.childAt(0);a.zlevel=r,a.z=n},t.prototype.setDraggable=function(r,n){var a=this.childAt(0);a.draggable=r,a.cursor=!n&&r?"move":a.cursor},t.prototype.updateData=function(r,n,a,i){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=i&&i.disableAnimation;if(c){var f=r.getItemVisual(n,"symbolKeepAspect");this._createSymbol(o,r,n,l,u,f)}else{var v=this.childAt(0);v.silent=!1;var g={scaleX:l[0]/2,scaleY:l[1]/2};h?v.attr(g):At(v,g,s,n),xi(v)}if(this._updateCommon(r,n,l,a,i),c){var v=this.childAt(0);if(!h){var g={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:v.style.opacity}};v.scaleX=v.scaleY=0,v.style.opacity=0,Qt(v,g,s,n)}}h&&this.childAt(0).stopAnimation("leave")},t.prototype._updateCommon=function(r,n,a,i,o){var s=this.childAt(0),l=r.hostModel,u,c,h,f,v,g,m,y,x;if(i&&(u=i.emphasisItemStyle,c=i.blurItemStyle,h=i.selectItemStyle,f=i.focus,v=i.blurScope,m=i.labelStatesModels,y=i.hoverScale,x=i.cursorStyle,g=i.emphasisDisabled),!i||r.hasItemOption){var _=i&&i.itemModel?i.itemModel:r.getItemModel(n),w=_.getModel("emphasis");u=w.getModel("itemStyle").getItemStyle(),h=_.getModel(["select","itemStyle"]).getItemStyle(),c=_.getModel(["blur","itemStyle"]).getItemStyle(),f=w.get("focus"),v=w.get("blurScope"),g=w.get("disabled"),m=Gr(_),y=w.getShallow("scale"),x=_.getShallow("cursor")}var S=r.getItemVisual(n,"symbolRotate");s.attr("rotation",(S||0)*Math.PI/180||0);var C=Fh(r.getItemVisual(n,"symbolOffset"),a);C&&(s.x=C[0],s.y=C[1]),x&&s.attr("cursor",x);var M=r.getItemVisual(n,"style"),A=M.fill;if(s instanceof Qr){var I=s.style;s.useStyle(te({image:I.image,x:I.x,y:I.y,width:I.width,height:I.height},M))}else s.__isEmptyBrush?s.useStyle(te({},M)):s.useStyle(M),s.style.decal=null,s.setColor(A,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var k=r.getItemVisual(n,"liftZ"),P=this._z2;k!=null?P==null&&(this._z2=s.z2,s.z2+=k):P!=null&&(s.z2=P,this._z2=null);var D=o&&o.useNameLabel;Jr(s,m,{labelFetcher:l,labelDataIndex:n,defaultText:z,inheritColor:A,defaultOpacity:M.opacity});function z(H){return D?r.getName(H):Hf(r,H)}this._sizeX=a[0]/2,this._sizeY=a[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),ir(this,f,v,g)},t.prototype.setSymbolScale=function(r){this.scaleX=this.scaleY=r},t.prototype.fadeOut=function(r,n,a){var i=this.childAt(0),o=Be(this).dataIndex,s=a&&a.animation;if(this.silent=i.silent=!0,a&&a.fadeLabel){var l=i.getTextContent();l&&su(l,{style:{opacity:0}},n,{dataIndex:o,removeOpt:s,cb:function(){i.removeTextContent()}})}else i.removeTextContent();su(i,{style:{opacity:0},scaleX:0,scaleY:0},n,{dataIndex:o,cb:r,removeOpt:s})},t.getSymbolSize=function(r,n){return bv(r.getItemVisual(n,"symbolSize"))},t.getSymbolZ2=function(r,n){return r.getItemVisual(n,"z2")},t}(De);function nce(e,t){this.parent.drift(e,t)}function k0(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 u5(e){return e!=null&&!Re(e)&&(e={isIgnore:e}),e||{}}function c5(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:Gr(t),cursorStyle:t.get("cursor")}}function h5(e,t,r,n,a,i,o){var s=new e(t,r,n,a);return s.setPosition(i),t.setItemGraphicEl(r,s),o.add(s),s}var ty=function(){function e(t){this.group=new De,this._SymbolCtor=t||ey}return e.prototype.updateData=function(t,r){this._progressiveEls=null,r=u5(r);var n=this.group,a=t.hostModel,i=this._data,o=this._SymbolCtor,s=r.disableAnimation,l=this._seriesScope=c5(t),u={disableAnimation:s},c=r.getSymbolPoint||function(h){return t.getItemLayout(h)};i||n.removeAll(),t.diff(i).add(function(h){var f=c(h);k0(t,f,h,r)&&h5(o,t,h,l,u,f,n)}).update(function(h,f){var v=i.getItemGraphicEl(f),g=c(h);if(!k0(t,g,h,r)){n.remove(v);return}var m=t.getItemVisual(h,"symbol")||"circle",y=v&&v.getSymbolType&&v.getSymbolType();if(!v||y&&y!==m)n.remove(v),v=new o(t,h,l,u),v.setPosition(g);else{v.updateData(t,h,l,u);var x={x:g[0],y:g[1]};s?v.attr(x):At(v,x,a)}n.add(v),t.setItemGraphicEl(h,v)}).remove(function(h){var f=i.getItemGraphicEl(h);f&&f.fadeOut(function(){n.remove(f)},a)}).execute(),this._getSymbolPoint=c,this._data=t},e.prototype.updateLayout=function(t){var r=this._data;if(r)for(var n=this,a=r.getStore(),i=0,o=a.count();i0?r=n[0]:n[1]<0&&(r=n[1]),r}function $W(e,t,r,n){var a=NaN;e.stacked&&(a=r.get(r.getCalculationInfo("stackedOverDimension"),n)),isNaN(a)&&(a=e.valueStart);var i=e.baseDataOffset,o=[];return o[i]=r.get(e.baseDim,n),o[1-i]=a,t.dataToPoint(o)}function ci(e,t){return!isFinite(e)||!isFinite(t)}var ice=typeof Float32Array!==uv?Float32Array:void 0,oce=typeof Float64Array!==uv?Float64Array:void 0;function So(e){return cI({ctor:ice},e).arr}function cI(e,t){var r=e.arr,n=e.ctor;if(t>Yg&&(t=Yg),!r||e.typed&&r.length=a||m<0)break;if(ci(x,_)){if(l){m+=i;continue}break}if(m===r)e[i>0?"moveTo":"lineTo"](x,_),h=x,f=_;else{var w=x-u,S=_-c;if(w*w+S*S<.5){m+=i;continue}if(o>0){for(var C=m+i,M=t[C*2],A=t[C*2+1];M===x&&A===_&&y=n||ci(M,A))v=x,g=_;else{P=M-u,D=A-c;var B=x-u,H=M-x,V=_-c,U=A-_,F=void 0,W=void 0;if(s==="x"){F=Math.abs(B),W=Math.abs(H);var $=P>0?1:-1;v=x-$*F*o,g=_,z=x+$*W*o,j=_}else if(s==="y"){F=Math.abs(V),W=Math.abs(U);var Z=D>0?1:-1;v=x,g=_-Z*F*o,z=x,j=_+Z*W*o}else F=Math.sqrt(B*B+V*V),W=Math.sqrt(H*H+U*U),k=W/(W+F),v=x-P*o*(1-k),g=_-D*o*(1-k),z=x+P*o*k,j=_+D*o*k,z=vl(z,pl(M,x)),j=vl(j,pl(A,_)),z=pl(z,vl(M,x)),j=pl(j,vl(A,_)),P=z-x,D=j-_,v=x-P*F/W,g=_-D*F/W,v=vl(v,pl(u,x)),g=vl(g,pl(c,_)),v=pl(v,vl(u,x)),g=pl(g,vl(c,_)),P=x-v,D=_-g,z=x+P*W/F,j=_+D*W/F}e.bezierCurveTo(h,f,v,g,x,_),h=z,f=j}else e.lineTo(x,_)}u=x,c=_,m+=i}return y}var ZW=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),uce=function(e){X(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 ZW},t.prototype.buildPath=function(r,n){var a=n.points,i=0,o=a.length/2;if(n.connectNulls){for(;o>0&&ci(a[o*2-2],a[o*2-1]);o--);for(;i=0){var S=u?(g-l)*w+l:(v-s)*w+s;return u?[r,S]:[S,r]}s=v,l=g;break;case o.C:v=i[h++],g=i[h++],m=i[h++],y=i[h++],x=i[h++],_=i[h++];var C=u?k_(s,v,m,x,r,c):k_(l,g,y,_,r,c);if(C>0)for(var M=0;M=0){var S=u?$r(l,g,y,_,A):$r(s,v,m,x,A);return u?[r,S]:[S,r]}}s=x,l=_;break}}},t}(pt),cce=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(ZW),YW=function(e){X(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 cce},t.prototype.buildPath=function(r,n){var a=n.points,i=n.stackedOnPoints,o=0,s=a.length/2,l=n.smoothMonotone;if(n.connectNulls){for(;s>0&&ci(a[s*2-2],a[s*2-1]);s--);for(;o=0,i=e.fill||K.color.neutral99;p5(n,t);var o=n.textFill==null;return a?o&&(n.textFill=r.insideFill||K.color.neutral00,!n.textStroke&&r.insideStroke&&(n.textStroke=r.insideStroke),!n.textStroke&&(n.textStroke=i),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,R(t.rich,function(s){p5(s,s)}),n}function p5(e,t){t&&(Se(t,"fill")&&(e.textFill=t.fill),Se(t,"stroke")&&(e.textStroke=t.fill),Se(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),Se(t,"font")&&(e.font=t.font),Se(t,"fontStyle")&&(e.fontStyle=t.fontStyle),Se(t,"fontWeight")&&(e.fontWeight=t.fontWeight),Se(t,"fontSize")&&(e.fontSize=t.fontSize),Se(t,"fontFamily")&&(e.fontFamily=t.fontFamily),Se(t,"align")&&(e.textAlign=t.align),Se(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),Se(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),Se(t,"width")&&(e.textWidth=t.width),Se(t,"height")&&(e.textHeight=t.height),Se(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),Se(t,"padding")&&(e.textPadding=t.padding),Se(t,"borderColor")&&(e.textBorderColor=t.borderColor),Se(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),Se(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),Se(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),Se(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),Se(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),Se(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),Se(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),Se(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),Se(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),Se(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}function g5(e,t){if(e.length===t.length){for(var r=0;rt){i?r.push(o(i,l,t)):a&&r.push(o(a,l,0),o(a,l,t));break}else a&&(r.push(o(a,l,0)),a=null),r.push(l),i=l}return r}function fce(e,t,r){var n=e.getVisual("visualMeta");if(!(!n||!n.length||!e.count())&&t.type==="cartesian2d"){for(var a,i,o=n.length-1;o>=0;o--){var s=e.getDimensionInfo(n[o].dimension);if(a=s&&s.coordDim,a==="x"||a==="y"){i=n[o];break}}if(i){var l=t.getAxis(a),u=oe(i.stops,function(w){return{coord:l.toGlobalCoord(l.dataToCoord(w.value)),color:w.color}}),c=u.length,h=i.outerColors.slice();c&&u[0].coord>u[c-1].coord&&(u.reverse(),h.reverse());var f=dce(u,a==="x"?r.getWidth():r.getHeight()),v=f.length;if(!v&&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[v-1].coord+g,x=y-m;if(x<.001)return"transparent";R(f,function(w){w.offset=(w.coord-m)/x}),f.push({offset:v?f[v-1].offset:.5,color:h[1]||"transparent"}),f.unshift({offset:v?f[0].offset:.5,color:h[0]||"transparent"});var _=new Eh(0,0,0,0,f,!0);return _[a]=m,_[a+"2"]=y,_}}}function vce(e,t,r){var n=e.get("showAllSymbol"),a=n==="auto";if(!(n&&!a)){var i=r.getAxesByScale("ordinal")[0];if(i&&!(a&&pce(i,t))){var o=t.mapDimension(i.dim),s={};return R(i.getViewLabels(),function(l){l.tick.offInterval||(s[Cv(i.scale,l.tick)]=1)}),function(l){return!s.hasOwnProperty(t.get(o,l))}}}}function pce(e,t){var r=e.getExtent(),n=Math.abs(r[1]-r[0])/e.scale.count();isNaN(n)&&(n=0);for(var a=t.count(),i=Math.max(1,Math.round(a/5)),o=0;on)return!1;return!0}function gce(e){for(var t=e.length/2;t>0&&ci(e[t*2-2],e[t*2-1]);t--);return t-1}function _5(e,t){return[e[t*2],e[t*2+1]]}function mce(e,t,r){for(var n=e.length/2,a=r==="x"?0:1,i,o,s=0,l=-1,u=0;u=t||i>=t&&o<=t){l=u;break}s=u,i=o}return{range:[s,l],t:(t-i)/(o-i)}}function e8(e){if(e.get(["endLabel","show"]))return!0;for(var t=0;t0&&r.get(["emphasis","lineStyle","width"])==="bolder"){var W=g.getState("emphasis").style;W.lineWidth=+g.style.lineWidth+1}Be(g).seriesIndex=r.seriesIndex,ir(g,V,U,F);var $=x5(r.get("smooth")),Z=r.get("smoothMonotone");if(g.setShape({smooth:$,smoothMonotone:Z,connectNulls:A}),m){var J=s.getCalculationInfo("stackedOnSeries"),re=0;m.useStyle(Ee(u.getAreaStyle(),{fill:z,opacity:.7,lineJoin:"bevel",decal:s.getVisual("style").decal})),J&&(re=x5(J.get("smooth"))),m.setShape({smooth:$,stackedOnSmooth:re,smoothMonotone:Z,connectNulls:A}),Vr(m,r,"areaStyle"),Be(m).seriesIndex=r.seriesIndex,ir(m,V,U,F)}var Q=this._changePolyState;s.eachItemGraphicEl(function(ne){ne&&(ne.onHoverStateChange=Q)}),this._polyline.onHoverStateChange=Q,this._data=s,this._coordSys=i,this._stackedOnPoints=C,this._points=c,this._step=P,this._valueOrigin=w;var le=r.get("triggerEvent"),de=r.get("triggerLineEvent"),He=de===!0||le===!0||le==="line",ye=de===!0||le===!0||le==="area";this.packEventData(r,g,He),m&&this.packEventData(r,m,ye)},t.prototype.packEventData=function(r,n,a){Be(n).eventData=a?{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,a,i){var o=r.getData(),s=nh(o,i);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(ci(c,h)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,h))return;var f=r.get("zlevel")||0,v=r.get("z")||0;u=new ey(o,s),u.x=c,u.y=h,u.setZ(f,v);var g=u.getSymbolPath().getTextContent();g&&(g.zlevel=f,g.z=v,g.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else Rt.prototype.highlight.call(this,r,n,a,i)},t.prototype.downplay=function(r,n,a,i){var o=r.getData(),s=nh(o,i);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 Rt.prototype.downplay.call(this,r,n,a,i)},t.prototype._changePolyState=function(r){var n=this._polygon;V_(this._polyline,r),n&&V_(n,r)},t.prototype._newPolyline=function(r){var n=this._polyline;return n&&this._lineGroup.remove(n),n=new uce({shape:{points:r},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(n),this._polyline=n,n},t.prototype._newPolygon=function(r,n){var a=this._polygon;return a&&this._lineGroup.remove(a),a=new YW({shape:{points:r,stackedOnPoints:n},segmentIgnoreThreshold:2}),this._lineGroup.add(a),this._polygon=a,a},t.prototype._initSymbolLabelAnimation=function(r,n,a){var i,o,s=n.getBaseAxis(),l=s.inverse;n.type==="cartesian2d"?(i=s.isHorizontal(),o=!1):n.type==="polar"&&(i=s.dim==="angle",o=!0);var u=r.hostModel,c=u.get("animationDuration");Le(c)&&(c=c(null));var h=u.get("animationDelay")||0,f=Le(h)?h(null):h;r.eachItemGraphicEl(function(v,g){var m=v;if(m){var y=[v.x,v.y],x=void 0,_=void 0,w=void 0;if(a)if(o){var S=a,C=n.pointToCoord(y);i?(x=S.startAngle,_=S.endAngle,w=-C[1]/180*Math.PI):(x=S.r0,_=S.r,w=C[0])}else{var M=a;i?(x=M.x,_=M.x+M.width,w=v.x):(x=M.y+M.height,_=M.y,w=v.y)}var A=_===x?0:(w-x)/(_-x);l&&(A=1-A);var I=Le(h)?h(g):c*A+f,k=m.getSymbolPath(),P=k.getTextContent();m.attr({scaleX:0,scaleY:0}),m.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:I}),P&&P.animateFrom({style:{opacity:0}},{duration:300,delay:I}),k.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(r,n,a){var i=r.getModel("endLabel");if(e8(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 wt({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=gce(l);c>=0&&(Jr(s,Gr(r,"endLabel"),{inheritColor:a,labelFetcher:r,labelDataIndex:c,defaultText:function(h,f,v){return v!=null?UW(o,v):Hf(o,h)},enableTextSetter:!0},yce(i,n)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},t.prototype._endLabelOnDuring=function(r,n,a,i,o,s,l){var u=this._endLabel,c=this._polyline;if(u){r<1&&i.originalX==null&&(i.originalX=u.x,i.originalY=u.y);var h=a.getLayout("points"),f=a.hostModel,v=f.get("connectNulls"),g=s.get("precision"),m=s.get("distance")||0,y=l.getBaseAxis(),x=y.isHorizontal(),_=y.inverse,w=n.shape,S=_?x?w.x:w.y+w.height:x?w.x+w.width:w.y,C=(x?m:0)*(_?-1:1),M=(x?0:-m)*(_?-1:1),A=x?"x":"y",I=mce(h,S,A),k=I.range,P=k[1]-k[0],D=void 0;if(P>=1){if(P>1&&!v){var z=_5(h,k[0]);u.attr({x:z[0]+C,y:z[1]+M}),o&&(D=f.getRawValue(k[0]))}else{var z=c.getPointOn(S,A);z&&u.attr({x:z[0]+C,y:z[1]+M});var j=f.getRawValue(k[0]),B=f.getRawValue(k[1]);o&&(D=KG(a,g,j,B,I.t))}i.lastFrameIndex=k[0]}else{var H=r===1||i.lastFrameIndex>0?k[0]:0,z=_5(h,H);o&&(D=f.getRawValue(H)),u.attr({x:z[0]+C,y:z[1]+M})}if(o){var V=gv(u);typeof V.setLabelText=="function"&&V.setLabelText(D)}}},t.prototype._doUpdateAnimation=function(r,n,a,i,o,s,l){var u=this._polyline,c=this._polygon,h=r.hostModel,f=lce(this._data,r,this._stackedOnPoints,n,this._coordSys,a,this._valueOrigin),v=f.current,g=f.stackedOnCurrent,m=f.next,y=f.stackedOnNext;if(o&&(g=gl(f.stackedOnCurrent,f.current,a,o,l),v=gl(f.current,null,a,o,l),y=gl(f.stackedOnNext,f.next,a,o,l),m=gl(f.next,null,a,o,l)),y5(v,m)>3e3||c&&y5(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=v;var x={shape:{points:m}};f.current!==v&&(x.shape.__points=f.next),u.stopAnimation(),At(u,x,h),c&&(c.setShape({points:v,stackedOnPoints:g}),c.stopAnimation(),At(c,{shape:{stackedOnPoints:y}},h),u.shape.points!==c.shape.points&&(c.shape.points=u.shape.points));for(var _=[],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"&&i){var l=o.getBaseAxis(),u=o.getOtherAxis(l),c=l.getExtent(),h=n.getDevicePixelRatio(),f=Math.abs(c[1]-c[0])*(h||1),v=Math.round(s/f);if(isFinite(v)&&v>1){i==="lttb"?t.setData(a.lttbDownSample(a.mapDimension(u.dim),1/v)):i==="minmax"&&t.setData(a.minmaxDownSample(a.mapDimension(u.dim),1/v));var g=void 0;ve(i)?g=_ce[i]:Le(i)&&(g=i),g&&t.setData(a.downSample(a.mapDimension(u.dim),1/v,g,bce))}}}}}function wce(e){e.registerChartView(xce),e.registerSeriesModel(rce),e.registerLayout(ry("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,t8("line"))}var r8=function(e){X(t,e);function t(r,n,a,i,o){var s=e.call(this,r,n,a)||this;return s.index=0,s.type=i||"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}(Si),wA=null;function Sce(e){wA||(wA=e)}function ny(){return wA}var ew="expandAxisBreak",n8="collapseAxisBreak",a8="toggleAxisBreak",hI="axisbreakchanged",Cce={type:ew,event:hI,update:"update",refineEvent:dI},Tce={type:n8,event:hI,update:"update",refineEvent:dI},Mce={type:a8,event:hI,update:"update",refineEvent:dI};function dI(e,t,r,n){var a=[];return R(e,function(i){a=a.concat(i.eventBreaks)}),{eventContent:{breaks:a}}}function Ace(e){e.registerAction(Cce,t),e.registerAction(Tce,t),e.registerAction(Mce,t);function t(r,n){var a=[],i=ff(n,r);function o(s,l){R(i[s],function(u){var c=u.updateAxisBreaks(r);R(c.breaks,function(h){var f;a.push(Ee((f={},f[l]=u.componentIndex,f),h))})})}return o("xAxisModels","xAxisIndex"),o("yAxisModels","yAxisIndex"),o("singleAxisModels","singleAxisIndex"),{eventBreaks:a}}}var jl=Math.PI,Nce=[[1,2,1,2],[5,3,5,3],[8,3,8,3]],kce=[[0,1,0,1],[0,3,0,3],[0,3,0,3]],gh=Qe(),i8=Qe(),o8=function(){function e(t){this.recordMap={},this.resolveAxisNameOverlap=t}return e.prototype.ensureRecord=function(t){var r=t.axis.dim,n=t.componentIndex,a=this.recordMap,i=a[r]||(a[r]=[]);return i[n]||(i[n]={ready:{}})},e}();function Lce(e,t,r,n){var a=r.axis,i=t.ensureRecord(r),o=[],s,l=fI(e.axisName)&&Ff(e.nameLocation);R(n,function(g){var m=Wo(g);if(!(!m||m.label.ignore)){o.push(m);var y=i.transGroup;l&&(y.transform?Ra(hp,y.transform):Ih(hp),m.transform&&ja(hp,hp,m.transform),je.copy(L0,m.localRect),L0.applyTransform(hp),s?s.union(L0):je.copy(s=new je(0,0,0,0),L0))}});var u=Math.abs(i.dirVec.x)>.1?"x":"y",c=i.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=a.getExtent(),f=Math.min(h[0],h[1]),v=Math.max(h[0],h[1])-f;s.union(new je(f,0,v,1))}i.stOccupiedRect=s,i.labelInfoList=o}var hp=ar(),L0=new je(0,0,0,0),s8=function(e,t,r,n,a,i){if(Ff(e.nameLocation)){var o=i.stOccupiedRect;o&&l8(sue({},o,i.transGroup.transform),n,a)}else u8(i.labelInfoList,i.dirVec,n,a)};function l8(e,t,r){var n=new Oe;J1(e,t,n,{direction:Math.atan2(r.y,r.x),bidirectional:!1,touchThreshold:.05})&&vA(t,n)}function u8(e,t,r,n){for(var a=Oe.dot(n,t)>=0,i=0,o=e.length;i0?"top":"bottom",i="center"):th(a-jl)?(o=n>0?"bottom":"top",i="center"):(o="middle",a>0&&a0?"right":"left":i=n>0?"left":"right"),{rotation:a,textAlign:i,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}(),Ice=["axisLine","axisTickLabelEstimate","axisTickLabelDetermine","axisName"],Pce={axisLine:function(e,t,r,n,a,i,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=i.transform,c=[l[0],0],h=[l[1],0],f=c[0]>h[0];u&&(dr(c,c,u),dr(h,h,u));var v=te({lineCap:"round"},n.getModel(["axisLine","lineStyle"]).getLineStyle()),g={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:v};if(n.get(["axisLine","breakLine"])&&W_(n.axis.scale))ny().buildAxisBreakLine(n,a,i,g);else{var m=new Tr(te({shape:{x1:c[0],y1:c[1],x2:h[0],y2:h[1]}},g));Rf(m.shape,m.style.lineWidth),m.anid="line",a.add(m)}var y=n.get(["axisLine","symbol"]);if(y!=null){var x=n.get(["axisLine","symbolSize"]);ve(y)&&(y=[y,y]),(ve(x)||Tt(x))&&(x=[x,x]);var _=Fh(n.get(["axisLine","symbolOffset"])||0,x),w=x[0],S=x[1];R([{rotate:e.rotation+Math.PI/2,offset:_[0],r:0},{rotate:e.rotation-Math.PI/2,offset:_[1],r:Math.sqrt((c[0]-h[0])*(c[0]-h[0])+(c[1]-h[1])*(c[1]-h[1]))}],function(C,M){if(y[M]!=="none"&&y[M]!=null){var A=Ar(y[M],-w/2,-S/2,w,S,v.stroke,!0),I=C.r+C.offset,k=f?h:c;A.attr({rotation:C.rotate,x:k[0]+I*Math.cos(e.rotation),y:k[1]-I*Math.sin(e.rotation),silent:!0,z2:11}),a.add(A)}})}}},axisTickLabelEstimate:function(e,t,r,n,a,i,o,s){var l=w5(t,a,s);l&&b5(e,t,r,n,a,i,o,Ui.estimate)},axisTickLabelDetermine:function(e,t,r,n,a,i,o,s){var l=w5(t,a,s);l&&b5(e,t,r,n,a,i,o,Ui.determine);var u=Rce(e,a,i,n);Ece(e,t.labelLayoutList,u),Oce(e,a,i,n,e.tickDirection)},axisName:function(e,t,r,n,a,i,o,s){var l=r.ensureRecord(n);t.nameEl&&(a.remove(t.nameEl),t.nameEl=l.nameLayout=l.nameLocation=null);var u=e.axisName;if(fI(u)){var c=e.nameLocation,h=e.nameDirection,f=n.getModel("nameTextStyle"),v=n.get("nameGap")||0,g=n.axis.getExtent(),m=n.axis.inverse?-1:1,y=new Oe(0,0),x=new Oe(0,0);c==="start"?(y.x=g[0]-m*v,x.x=-m):c==="end"?(y.x=g[1]+m*v,x.x=m):(y.x=(g[0]+g[1])/2,y.y=e.labelOffset+h*v,x.y=h);var _=ar();x.transform(Js(_,_,e.rotation));var w=n.get("nameRotate");w!=null&&(w=w*jl/180);var S,C;Ff(c)?S=Jn.innerTextLayout(e.rotation,w??e.rotation,h):(S=Dce(e.rotation,c,w||0,g),C=e.raw.axisNameAvailableWidth,C!=null&&(C=Math.abs(C/Math.sin(S.rotation)),!isFinite(C)&&(C=null)));var M=f.getFont(),A=n.get("nameTruncate",!0)||{},I=A.ellipsis,k=On(e.raw.nameTruncateMaxWidth,A.maxWidth,C),P=s.nameMarginLevel||0,D=new wt({x:y.x,y:y.y,rotation:S.rotation,silent:Jn.isLabelSilent(n),style:$t(f,{text:u,font:M,overflow:"truncate",width:k,ellipsis:I,fill:f.getTextColor()||n.get(["axisLine","lineStyle","color"]),align:f.get("align")||S.textAlign,verticalAlign:f.get("verticalAlign")||S.textVerticalAlign}),z2:1});if(el({el:D,componentModel:n,itemName:u}),D.__fullText=u,D.anid="name",n.get("triggerEvent")){var z=Jn.makeAxisEventDataBase(n);z.targetType="axisName",z.name=u,Be(D).eventData=z}i.add(D),D.updateTransform(),t.nameEl=D;var j=l.nameLayout=Wo({label:D,priority:D.z2,defaultAttr:{ignore:D.ignore},marginDefault:Ff(c)?Nce[P]:kce[P]});if(l.nameLocation=c,a.add(D),D.decomposeTransform(),e.shouldNameMoveOverlap&&j){var B=r.ensureRecord(n);r.resolveAxisNameOverlap(e,r,n,j,x,B)}}}};function b5(e,t,r,n,a,i,o,s){h8(t)||zce(e,t,a,s,n,o);var l=t.labelLayoutList;Bce(e,n,l,i),Gce(n,e.rotation,l);var u=e.optionHideOverlap;jce(n,l,u),u&&TW(It(l,function(c){return c&&!c.label.ignore})),Lce(e,r,n,l)}function Dce(e,t,r,n){var a=Ok(r-e),i,o,s=n[0]>n[1],l=t==="start"&&!s||t!=="start"&&s;return th(a-jl/2)?(o=l?"bottom":"top",i="center"):th(a-jl*1.5)?(o=l?"top":"bottom",i="center"):(o="middle",ajl/2?i=l?"left":"right":i=l?"right":"left"),{rotation:a,textAlign:i,textVerticalAlign:o}}function jce(e,t,r){var n=e.axis,a=e.get(["axisLabel","customValues"]);if(Zse(n))return;function i(u,c,h){var f=Wo(t[c]),v=Wo(t[h]),g=n.scale;if(!(!f||!v)){if(u==null){if(!r&&a)return;var m=gh(f.label).labelInfo.tick;if(qm(g)&&m.notNice||Vn(g)&&m.offInterval){Ed(f.label);return}}if(u===!1||f.suggestIgnore){Ed(f.label);return}if(v.suggestIgnore){Ed(v.label);return}var y=.1;if(!r){var x=[0,0,0,0];f=pA({marginForce:x},f),v=pA({marginForce:x},v)}J1(f,v,null,{touchThreshold:y})&&Ed(u?v.label:f.label)}}var o=e.get(["axisLabel","showMinLabel"]),s=e.get(["axisLabel","showMaxLabel"]),l=t.length;i(o,0,1),i(s,l-1,l-2)}function Ece(e,t,r){e.showMinorTicks||R(t,function(n){if(n&&n.label.ignore)for(var a=0;a=0&&w(M,S,C.getStore())})}var v=0;if(f(function(w,S,C){n.set(S.uid,1),(!a||!a.hasKey(S.uid))&&(o=!0),v+=C.count()}),(!a||a.keys().length!==n.keys().length)&&(o=!0),!o&&i!=null){t.liPosMinGap=i;return}cI(uc,v);var g=0;f(function(w,S,C){for(var M=0,A=C.count();M0&&_0?tW:Kse,r.serUids=n}var uc=cI({ctor:oce},50);function tw(e){return function(t,r){var n=Cn(t,{fromStat:{key:e}});if(mi(n.w2))return[-n.w2/2,n.w2/2]}}function Uc(e){return e+sb}function Vh(e,t){return e+sb+t}function vI(e){return Yce(),{liPosMinGap:!Vn(e.scale)}}var Po="bar",vm="pictorialBar";function d8(e,t,r,n){eI(e,{key:t,seriesType:r,coordSysType:n,getMetrics:vI})}function f8(e){var t=e.scale.rawExtentInfo.makeRenderInfo().startValue;return t}var v8={left:0,right:0,top:0,bottom:0},gb=["25%","25%"],Vi="cartesian2d",qce=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(r,n){var a=zh(r.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),a&&r.outerBounds&&Uo(r.outerBounds,a)},t.prototype.mergeOption=function(r,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&r.outerBounds&&Uo(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:v8,outerBoundsContain:"all",outerBoundsClampWidth:gb[0],outerBoundsClampHeight:gb[1],backgroundColor:K.color.transparent,borderWidth:1,borderColor:K.color.neutral30},t}(ht),Kce=lv(),CA="__ec_stack_";function p8(e){return e.get("stack")||CA+e.seriesIndex}function Jce(e){if(Vn(e.axis.scale)){for(var t=Cn(e.axis),r=[],n=0;nw&&(w=_),w!==c&&(y.width=w,r-=w+u*w,n--)}}),c=(r-l)/(n+(n-1)*u),c=at(c,0);var h=0,f;R(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 v={},g=-h/2;return R(o,function(m){var y=s[m];v[m]=v[m]||{bandWidth:t,offset:g,width:y.width},g+=y.width*(1+u)}),v}function m8(e){return{seriesType:e,overallReset:function(t){var r=Vh(e,Vi);QL(t,r,function(n){var a=Qce(n,e);hh(n,r,function(i){var o=a.columnMap[p8(i)];i.getData().setLayout({bandWidth:o.bandWidth,offset:o.offset,size:o.width})})})}}}function y8(e){return{seriesType:e,plan:Bh(),reset:function(t){if(Hce(t)){var r=t.getData(),n=t.coordinateSystem,a=n.getBaseAxis(),i=n.getOtherAxis(a),o=r.getDimensionIndex(r.mapDimension(i.dim)),s=r.getDimensionIndex(r.mapDimension(a.dim)),l=t.get("showBackground",!0),u=r.mapDimension(i.dim),c=r.getCalculationInfo("stackResultDimension"),h=Zs(r,u)&&!!r.getCalculationInfo("stackedOnSeries"),f=i.isHorizontal(),v=i.toGlobalCoord(i.dataToCoord(f8(i))),g=x8(t),m=t.get("barMinHeight")||0,y=c&&r.getDimensionIndex(c),x=r.getLayout("size"),_=r.getLayout("offset");return{progress:function(w,S){for(var C=w.count,M=g&&So(C*3),A=g&&l&&So(C*3),I=g&&So(C),k=n.master.getRect(),P=f?k.width:k.height,D,z=S.getStore(),j=0;(D=w.next())!=null;){var B=z.get(h?y:o,D),H=z.get(s,D),V=v,U=void 0;h&&(U=+B-z.get(o,D));var F=void 0,W=void 0,$=void 0,Z=void 0;if(f){var J=n.dataToPoint([B,H]);h&&(V=n.dataToPoint([U,H])[0]),F=V,W=J[1]+_,$=J[0]-V,Z=x,cr($)y){w=(M+_)/2;break}C===1&&(S=A-g[0].tickValue)}w==null&&(_?_&&(w=g[g.length-1].coord):w=g[0].coord),s[v]=f.toGlobalCoord(w)}});else{var l=this.getData(),u=l.getLayout("offset"),c=l.getLayout("size"),h=i.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}(Ut);Ut.registerClass(pm);var rhe=function(e){X(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 Jo(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 a=e7(this,r,n);return a.progressiveRender&&(a.large=!0),a},t.prototype.brushSelector=function(r,n,a){return a.rect(n.getItemLayout(r))},t.type="series."+Po,t.dependencies=["grid","polar"],t.defaultOption=Cu(pm.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}(pm),nhe=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}(),mb=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="sausage",n}return t.prototype.getDefaultShape=function(){return new nhe},t.prototype.buildPath=function(r,n){var a=n.cx,i=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,v=Math.PI*2,g=f?h-cMath.PI/2&&cs)return!0;s=h}return!1},t.prototype._isOrderDifferentInView=function(r,n){for(var a=n.scale,i=a.getExtent(),o=Math.max(0,i[0]),s=Math.min(i[1],a.getOrdinalMeta().categories.length-1);o<=s;++o)if(r.ordinalNumbers[o]!==a.getRawOrdinalNumber(o))return!0},t.prototype._updateSortWithinSameData=function(r,n,a,i){if(this._isOrderChangedWithinSameData(r,n,a)){var o=this._dataSort(r,a,n);this._isOrderDifferentInView(o,a)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",axisId:a.index,sortInfo:o}))}},t.prototype._dispatchInitSort=function(r,n,a){var i=n.baseAxis,o=this._dataSort(r,i,function(s){return r.get(r.mapDimension(n.otherAxis.dim),s)});a.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.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,a=this._data;r&&r.isAnimationEnabled()&&a&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],a.eachItemGraphicEl(function(i){Is(i,r,Be(i).dataIndex)})):n.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=Po,t}(Rt),S5={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 a=e.x+e.width,i=e.y+e.height,o=DC(t.x,e.x),s=jC(t.x+t.width,a),l=DC(t.y,e.y),u=jC(t.y+t.height,i),c=sa?s:o,t.y=h&&l>i?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 a=jC(t.r,e.r),i=DC(t.r0,e.r0);t.r=a,t.r0=i;var o=a-i<0;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}return o}},C5={cartesian2d:function(e,t,r,n,a,i,o,s,l){var u=new it({shape:te({},n),z2:1});if(u.__dataIndex=r,u.name="item",i){var c=u.shape,h=a?"height":"width";c[h]=0}return u},polar:function(e,t,r,n,a,i,o,s,l){var u=!a&&l?mb:wn,c=new u({shape:n,z2:1});c.name="item";var h=b8(a);if(c.calculateTextPosition=ahe(h,{isRoundCap:u===mb}),i){var f=c.shape,v=a?"r":"endAngle",g={};f[v]=a?n.r0:n.startAngle,g[v]=n[v],(s?At:Qt)(c,{shape:g},i)}return c}};function she(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 T5(e,t,r,n,a,i,o,s){var l,u;i?(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?At:Qt)(r,{shape:l},t,a,null);var c=t?e.baseAxis.model:null;(o?At:Qt)(r,{shape:u},c,a)}function M5(e,t){for(var r=0;r0?1:-1,o=n.height>0?1:-1;return{x:n.x+i*a/2,y:n.y+o*a/2,width:n.width-i*a,height:n.height-o*a}},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 che(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function b8(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 N5(e,t,r,n,a,i,o,s){var l=t.getItemVisual(r,"style");if(s){if(!i.get("roundCap")){var c=e.shape,h=Co(n.getModel("itemStyle"),c,!0);te(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 v=s?o?a.r>=a.r0?"endArc":"startArc":a.endAngle>=a.startAngle?"endAngle":"startAngle":o?phe(a,i.coordinateSystem):ghe(a,i.coordinateSystem),g=Gr(n);Jr(e,g,{labelFetcher:i,labelDataIndex:r,defaultText:Hf(i.getData(),r),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:v});var m=e.getTextContent();if(s&&m){var y=n.get(["label","position"]);e.textConfig.inside=y==="middle"?!0:null,ihe(e,y==="outside"?v:y,b8(o),n.get(["label","rotate"]))}X7(m,g,i.getRawValue(r),function(_){return UW(t,_)});var x=n.getModel(["emphasis"]);ir(e,x.get("focus"),x.get("blurScope"),x.get("disabled")),Vr(e,n),che(a)&&(e.style.fill="none",e.style.stroke="none",R(e.states,function(_){_.style&&(_.style.fill=_.style.stroke="none")}))}function hhe(e,t){var r=e.get(["itemStyle","borderColor"]);if(!r||r==="none")return 0;var n=e.get(["itemStyle","borderWidth"])||0,a=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),i=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(n,a,i)}var dhe=function(){function e(){}return e}(),k5=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="largeBar",n}return t.prototype.getDefaultShape=function(){return new dhe},t.prototype.buildPath=function(r,n){for(var a=n.points,i=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],u=this.barWidth,c=0;c=0?r:null},30,!1);function fhe(e,t,r){for(var n=e.baseDimIdx,a=1-n,i=e.shape.points,o=e.largeDataIndices,s=[],l=[],u=e.barWidth,c=0,h=i.length/3;c=s[0]&&t<=s[0]+l[0]&&r>=s[1]&&r<=s[1]+l[1])return o[c]}return-1}function w8(e,t,r){if(ph(r,"cartesian2d")){var n=t,a=r.getArea();return{x:e?n.x:a.x,y:e?a.y:n.y,width:e?n.width:a.width,height:e?a.height:n.height}}else{var a=r.getArea(),i=t;return{cx:a.cx,cy:a.cy,r0:e?a.r0:i.r0,r:e?a.r:i.r,startAngle:e?i.startAngle:0,endAngle:e?i.endAngle:Math.PI*2}}}function vhe(e,t,r){var n=e.type==="polar"?wn:it;return new n({shape:w8(t,r,e),silent:!0,z2:0})}function phe(e,t){if(e.height===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"bottom":"top"}return e.height>0?"bottom":"top"}function ghe(e,t){if(e.width===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"left":"right"}return e.width>=0?"right":"left"}function mhe(e){e.registerChartView(ohe),e.registerSeriesModel(rhe),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,m8(Po)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,y8(Po)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,t8(Po)),e.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(t,r){var n=t.componentType||"series";r.eachComponent({mainType:n,query:t},function(a){t.sortInfo&&a.axis.setCategorySortInfo(t.sortInfo)})}),_8(e)}function ay(e){return{seriesType:e,reset:function(t,r){var n=r.findComponents({mainType:"legend"});if(!(!n||!n.length)){var a=t.getData();a.filterSelf(function(i){for(var o=a.getName(i),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}(),Ql="pie",yhe=Qe(),S8=function(e){X(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 Nv(be(this.getData,this),be(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return Av(this,{coordDimensions:["value"],encodeDefaulter:nt(CL,this)})},t.prototype.getDataParams=function(r){var n=this.getData(),a=yhe(n),i=a.seats;if(!i){var o=[];n.each(n.mapDimension("value"),function(l){o.push(l)}),i=a.seats=GG(o,n.hostModel.get("percentPrecision"))}var s=e.prototype.getDataParams.call(this,r);return s.percent=i[r]||0,s.$vars.push("percent"),s},t.prototype._defaultLabelLine=function(r){rh(r,"labelLine",["show"]);var n=r.labelLine,a=r.emphasis.labelLine;n.show=n.show&&r.label.show,a.show=a.show&&r.emphasis.label.show},t.type="series."+Ql,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}(Ut);fae({fullType:S8.type,getCoord2:function(e){return e.getShallow("center")}});var xhe=Math.PI/180;function P5(e,t,r,n,a,i,o,s,l,u){if(e.length<2)return;function c(m){for(var y=m.rB,x=y*y,_=0;_r?x:y,C=Math.abs(w.label.y-r);if(C>=S.maxY){var M=w.label.x-t-w.len2*a,A=n+w.len,I=Math.abs(M)e.unconstrainedWidth?null:f:null;n.setStyle("width",v)}T8(i,n)}}}function T8(e,t){D5.rect=e,CW(D5,t,bhe)}var bhe={minMarginForce:[null,0,null,0],marginDefault:[1,0,1,0]},D5={};function EC(e){return e.position==="center"}function whe(e){var t=e.getData(),r=[],n,a,i=!1,o=(e.get("minShowLabelAngle")||0)*xhe,s=t.getLayout("viewRect"),l=t.getLayout("r"),u=s.width,c=s.x,h=s.y,f=s.height;function v(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),I=A.shape,k=A.getTextContent(),P=A.getTextGuideLine(),D=t.getItemModel(M),z=D.getModel("label"),j=z.get("position")||D.get(["emphasis","label","position"]),B=z.get("distanceToLabelLine"),H=z.get("alignTo"),V=me(z.get("edgeDistance"),u),U=z.get("bleedMargin");U==null&&(U=Math.min(u,f)>200?10:2);var F=D.getModel("labelLine"),W=F.get("length");W=me(W,u);var $=F.get("length2");if($=me($,u),Math.abs(I.endAngle-I.startAngle)0?"right":"left":J>0?"left":"right"}var qe=Math.PI,Fe=0,_t=z.get("rotate");if(Tt(_t))Fe=_t*(qe/180);else if(j==="center")Fe=0;else if(_t==="radial"||_t===!0){var bt=J<0?-Z+qe:-Z;Fe=bt}else if(_t==="tangential"||_t==="tangential-noflip"&&j!=="outside"&&j!=="outer"){var et=Math.atan2(J,re);et<0&&(et=qe*2+et);var Ke=re>0;Ke&&_t!=="tangential-noflip"&&(et=qe+et),Fe=et-qe}if(i=!!Fe,k.x=Q,k.y=le,k.rotation=Fe,k.setStyle({verticalAlign:"middle"}),ye){k.setStyle({align:He});var ce=k.states.select;ce&&(ce.x+=k.x,ce.y+=k.y)}else{var St=new je(0,0,0,0);T8(St,k),r.push({label:k,labelLine:P,position:j,len:W,len2:$,minTurnAngle:F.get("minTurnAngle"),maxSurfaceAngle:F.get("maxSurfaceAngle"),surfaceNormal:new Oe(J,re),linePoints:de,textAlign:He,labelDistance:B,labelAlignTo:H,edgeDistance:V,bleedMargin:U,rect:St,unconstrainedWidth:St.width,labelStyleWidth:k.style.width})}A.setTextConfig({inside:ye})}}),!i&&e.get("avoidLabelOverlap")&&_he(r,n,a,l,u,f,c,h);for(var m=0;mF?($=B+A*F/2,Z=$):($=B+k,Z=W-k),n.setItemLayout(U,{angle:F,startAngle:$,endAngle:Z,clockwise:w,cx:o,cy:s,r0:u,r:S?Nt(V,M,[u,l]):l}),B=W}),z0){for(var c=o.getItemLayout(0),h=1;isNaN(c&&c.startAngle)&&h=i.r0}},t.type=Ql,t}(Rt);function Ahe(e){return{seriesType:e,reset:function(t,r){var n=t.getData();n.filterSelf(function(a){var i=n.mapDimension("value"),o=n.get(i,a);return!(Tt(o)&&!isNaN(o)&&o<0)})}}}function Nhe(e){e.registerChartView(Mhe),e.registerSeriesModel(S8),uU(Ql,e.registerAction),e.registerLayout(She),e.registerProcessor(ay(Ql)),e.registerProcessor(Ahe(Ql))}var khe=function(e){X(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 Jo(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,a){return a.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}(Ut),A8=4,Lhe=function(){function e(){}return e}(),Ihe=function(e){X(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 Lhe},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 a=n.points,i=n.size,o=this.symbolProxy,s=o.shape,l=r.getContext?r.getContext():r,u=l&&i[0]=0;u--){var c=u*2,h=i[c]-s/2,f=i[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 a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(r=a[0],n=a[1],i.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,a=n.points,i=n.size,o=i[0],s=i[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}(),Dhe=function(e){X(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,a){var i=r.getData(),o=this._updateSymbolDraw(i,r);o.updateData(i,RC(r)),this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,a){var i=r.getData(),o=this._updateSymbolDraw(i,r);o.incrementalPrepareUpdate(i),this._finished=!1},t.prototype.incrementalRender=function(r,n,a){this._symbolDraw.incrementalUpdate(r,n.getData(),Io(n),RC(n)),this._finished=r.end===n.getData().count()},t.prototype.updateTransform=function(r,n,a){var i=r.getData();if(this.group.dirty(),this._finished){var o=ry("").reset(r,n,a);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(RC(r))}else return{update:!0}},t.prototype.eachRendered=function(r){this._symbolDraw&&this._symbolDraw.eachRendered(r)},t.prototype._updateSymbolDraw=function(r,n){var a=this._symbolDraw,i=n.pipelineContext,o=i.large;return(!a||o!==this._isLargeDraw)&&(a&&a.remove(),a=this._symbolDraw=o?new Phe:new ty,this._isLargeDraw=o,this.group.removeAll()),this.group.add(a.group),a},t.prototype.remove=function(r,n){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type="scatter",t}(Rt);function RC(e){return{clipShape:KW(e)}}var TA=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",pr).models[0]},t.type="cartesian2dAxis",t}(ht);kr(TA,Tv);var N8={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"}},jhe=Je({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto",show:"auto"},axisLabel:{interval:"auto"}},N8),pI=Je({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}}},N8),Ehe=Je({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},pI),Rhe=Ee({logBase:10},pI);const k8={category:jhe,value:pI,time:Ehe,log:Rhe};function Uf(e,t,r,n){R(KU,function(a,i){var o=Je(Je({},k8[i],!0),n,!0),s=function(l){X(u,l);function u(){var c=l!==null&&l.apply(this,arguments)||this;return c.type=t+"Axis."+i,c}return u.prototype.mergeDefaultAndTheme=function(c,h){var f=em(this),v=f?zh(c):{},g=h.getTheme();Je(c,g.get(i+"Axis")),Je(c,this.getDefaultOption()),c.type=E5(c),f&&Uo(c,v,f)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=am.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=ny();return h?h.updateModelAxisBreak(this,c):{breaks:[]}},u.type=t+"Axis."+i,u.defaultOption=o,u}(r);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+"Axis",E5)}function E5(e){return e.type||(e.data?"category":"value")}var Ohe=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 oe(this._dimList,function(t){return this._axes[t]},this)},e.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),It(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}(),Wx=["x","y"];function R5(e){return(e.type==="interval"||e.type==="time")&&!W_(e)}var zhe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Vi,r.dimensions=Wx,r}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var r=this.getAxis("x").scale,n=this.getAxis("y").scale;if(!(!R5(r)||!R5(n))){var a=ab(r,null),i=ab(n,null),o=this.dataToPoint([a[0],i[0]]),s=this.dataToPoint([a[1],i[1]]),l=a[1]-a[0],u=i[1]-i[0];if(!(!l||!u)){var c=(s[0]-o[0])/l,h=(s[1]-o[1])/u,f=o[0]-a[0]*c,v=o[1]-i[0]*h,g=this._transform=[c,0,0,h,f,v];this._invTransform=Ra([],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"),a=this.getAxis("y");return n.contain(n.toLocalCoord(r[0]))&&a.contain(a.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 a=this.dataToPoint(r),i=this.dataToPoint(n),o=this.getArea(),s=new je(a[0],a[1],i[0]-a[0],i[1]-a[1]);return o.intersect(s)},t.prototype.dataToPoint=function(r,n,a){a=a||[];var i=r[0],o=r[1];if(this._transform&&i!=null&&isFinite(i)&&o!=null&&isFinite(o))return dr(a,r,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return a[0]=s.toGlobalCoord(s.dataToCoord(i,n)),a[1]=l.toGlobalCoord(l.dataToCoord(o,n)),a},t.prototype.clampData=function(r,n){var a=this.getAxis("x").scale,i=this.getAxis("y").scale,o=a.getExtent(),s=i.getExtent(),l=a.parse(r[0]),u=i.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,a){if(a=a||[],this._invTransform)return dr(a,r,this._invTransform);var i=this.getAxis("x"),o=this.getAxis("y");return a[0]=i.coordToData(i.toLocalCoord(r[0]),n),a[1]=o.coordToData(o.toLocalCoord(r[1]),n),a},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(),a=this.getAxis("y").getGlobalExtent(),i=Math.min(n[0],n[1])-r,o=Math.min(a[0],a[1])-r,s=Math.max(n[0],n[1])-i+r,l=Math.max(a[0],a[1])-o+r;return new je(i,o,s,l)},t}(Ohe);function L8(e,t){var r=e.scale,n=e.model,a=uW(r,n,n.ecModel,e,null),i=Bf(r),o=Bf(t)?t.intervalStub:t,s=i?r.intervalStub:r,l=r.base,u=o.getTicks(),c=o.getTicks({expandToNicedExtent:!0}),h=u.length-1,f,v,g;if(h===1)f=v=0,g=1;else if(h===2){var m=cr(u[0].value-u[1].value),y=cr(u[1].value-u[2].value);f=v=0,m===y?g=2:(g=1,m=A[1])return!0})):S[1]?(k=A[1],B(function(){if(F(),j=Mt(z-P*g,D),H(),I<=A[0])return!0})):B(function(){j=Mt(Ph(A[0]/P)*P,D),z=Mt(gi(A[1]/P)*P,D);var J=Fo((z-j)/P);if(J<=g){var re=g-J,Q=void 0,le=a.incl0||i;if(le&&A[0]===0)Q=[0,re];else if(le&&A[1]===0)Q=[re,0];else{var de=gi(re/2);Q=re%2===0?[de,de]:I+k=A[1])return!0}})}eW(r,S,M,[I,k],C,{interval:P,intervalCount:g,intervalPrecision:D,niceExtent:[j,z]})}var O5=[[3,1],[0,2]],Bhe=function(){function e(t,r,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=Wx,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;R(this._axesList,function(o){fh(o,Vf);var s=o.scale;Vn(s)&&s.setSortInfo(o.model.get("categorySortInfo"))});function a(o){for(var s=gt(o),l=[],u=s.length-1;u>=0;u--){var c=o[+s[u]];c.__alignTo?l.push(c):Gf(c)}R(l,function(h){Vhe(h,h.__alignTo)?Gf(h):L8(h,h.__alignTo.scale)})}a(n.x),a(n.y);var i={};R(n.x,function(o){z5(n,"y",o,i)}),R(n.y,function(o){z5(n,"x",o,i)}),this.resize(this.model,r)},e.prototype.resize=function(t,r,n){var a=Ur(t,r),i=this._rect=tr(t.getBoxLayoutParams(),a.refContainer),o=this._axesMap,s=this._coordsList,l=t.get("containLabel");if(MA(o,i),!n){var u=Uhe(i,s,o,l,r),c=void 0;if(l)AA?(AA(this._axesList,i),MA(o,i)):c=G5(i.clone(),"axisLabel",null,i,o,u,a);else{var h=Whe(t,i,a),f=h.outerBoundsRect,v=h.parsedOuterBoundsContain,g=h.outerBoundsClamp;f&&(c=G5(f,v,g,i,o,u,a))}I8(i,o,Ui.determine,null,c,a),R(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]}Re(t)&&(r=t.yAxisIndex,t=t.xAxisIndex);for(var a=0,i=this._coordsList;a=0;a--){var i=e[+t[a]];WU(i.scale)&&QU(i.model,i.type,!0)==null&&(i.model.get("alignTicks")&&i.model.get("interval")==null?n.push(i):r=i)}r||(r=n.pop()),r&&R(n,function(o){o.__alignTo=r})}function Vhe(e,t){return W_(e.scale)||W_(t.scale)||t.scale.getTicks().length<2}function Ghe(e,t){var r=e.getExtent(),n=r[0]+r[1];e.toGlobalCoord=e.dim==="x"?function(a){return a+t}:function(a){return n-a+t},e.toLocalCoord=e.dim==="x"?function(a){return a-t}:function(a){return n-a+t}}function MA(e,t){R(e.x,function(r){return V5(r,t.x,t.width)}),R(e.y,function(r){return V5(r,t.y,t.height)})}function V5(e,t,r){var n=[0,r],a=e.inverse?1:0;e.setExtent(n[a],n[1-a]),Ghe(e,t)}var AA;function Hhe(e){AA=e}function G5(e,t,r,n,a,i,o){I8(n,a,Ui.estimate,t,!1,o);var s=[0,0,0,0];u(0),u(1),c(n,0,NaN),c(n,1,NaN);var l=Ks(s,function(f){return f>0})==null;return sh(n,s,!0,!0,r),MA(a,n),l;function u(f){R(a[We[f]],function(v){if(lm(v.model)){var g=i.ensureRecord(v.model),m=g.labelInfoList;if(m)for(var y=0;y0&&!yn(v)&&v>1e-4&&(f/=v),f}}function Uhe(e,t,r,n,a){var i=new o8($he);return R(r,function(o){return R(o,function(s){if(lm(s.model)){var l=!n;s.axisBuilder=Wce(e,t,s.model,a,i,l)}})}),i}function I8(e,t,r,n,a,i){var o=r===Ui.determine;R(t,function(u){return R(u,function(c){lm(c.model)&&($ce(c.axisBuilder,e,c.model),c.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:a}))})});var s={x:0,y:0};l(0),l(1);function l(u){s[We[1-u]]=e[_r[u]]<=i.refContainer[_r[u]]*.5?0:1-u===1?2:1}R(t,function(u,c){return R(u,function(h){lm(h.model)&&((n==="all"||o)&&h.axisBuilder.build({axisName:!0},{nameMarginLevel:s[c]}),o&&h.axisBuilder.build({axisLine:!0}))})})}function Whe(e,t,r){var n,a=e.get("outerBoundsMode",!0);a==="same"?n=t.clone():(a==null||a==="auto")&&(n=tr(e.get("outerBounds",!0)||v8,r.refContainer));var i=e.get("outerBoundsContain",!0),o;i==null||i==="auto"||Ye(["all","axisLabel"],i)<0?o="all":o=i;var s=[O_(Te(e.get("outerBoundsClampWidth",!0),gb[0]),t.width),O_(Te(e.get("outerBoundsClampHeight",!0),gb[1]),t.height)];return{outerBoundsRect:n,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var $he=function(e,t,r,n,a,i){var o=r.axis.dim==="x"?"y":"x";s8(e,t,r,n,a,i),Ff(e.nameLocation)||R(t.recordMap[o],function(s){s&&s.labelInfoList&&s.dirVec&&u8(s.labelInfoList,s.dirVec,n,a)})};function Zhe(e,t){var r={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return Yhe(r,e,t),r.seriesInvolved&&qhe(r,e),r}function Yhe(e,t,r){var n=t.getComponent("tooltip"),a=t.getComponent("axisPointer"),i=a.get("link",!0)||[],o=[];R(r.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=gm(s.model),u=e.coordSysAxesInfo[l]={};e.coordSysMap[l]=s;var c=s.model,h=c.getModel("tooltip",n);if(R(s.getAxes(),nt(m,!1,null)),s.getTooltipAxes&&n&&h.get("show")){var f=h.get("trigger")==="axis",v=h.get(["axisPointer","type"])==="cross",g=s.getTooltipAxes(h.get(["axisPointer","axis"]));(f||v)&&R(g.baseAxes,nt(m,v?"cross":!0,f)),v&&R(g.otherAxes,nt(m,"cross",!1))}function m(y,x,_){var w=_.model.getModel("axisPointer",a),S=w.get("show");if(!(!S||S==="auto"&&!y&&!NA(w))){x==null&&(x=w.get("triggerTooltip")),w=y?Xhe(_,h,a,t,y,x):w;var C=w.get("snap"),M=w.get("triggerEmphasis"),A=gm(_.model),I=x||C||_.type==="category",k=e.axesInfo[A]={key:A,axis:_,coordSys:s,axisPointerModel:w,triggerTooltip:x,triggerEmphasis:M,involveSeries:I,snap:C,useHandle:NA(w),seriesModels:[],linkGroup:null};u[A]=k,e.seriesInvolved=e.seriesInvolved||I;var P=Khe(i,_);if(P!=null){var D=o[P]||(o[P]={axesInfo:{}});D.axesInfo[A]=k,D.mapper=i[P].mapper,k.linkGroup=D}}}})}function Xhe(e,t,r,n,a,i){var o=t.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};R(s,function(f){l[f]=ke(o.get(f))}),l.snap=e.type!=="category"&&!!i,o.get("type")==="cross"&&(l.type="line");var u=l.label||(l.label={});if(u.show==null&&(u.show=!1),a==="cross"){var c=o.get(["label","show"]);if(u.show=c??!0,!i){var h=l.lineStyle=o.get("crossStyle");h&&Ee(u,h.textStyle)}}return e.model.getModel("axisPointer",new vt(l,r,n))}function qhe(e,t){t.eachSeries(function(r){var n=r.coordinateSystem,a=r.get(["tooltip","trigger"],!0),i=r.get(["tooltip","show"],!0);!n||!n.model||a==="none"||a===!1||a==="item"||i===!1||r.get(["axisPointer","show"],!0)===!1||R(e.coordSysAxesInfo[gm(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 Khe(e,t){for(var r=t.model,n=t.dim,a=0;a=0||e===t}function Jhe(e){var t=gI(e);if(t){var r=t.axisPointerModel,n=t.axis.scale,a=r.option,i=r.get("status"),o=r.get("value");o!=null&&(o=n.parse(o));var s=NA(r);i==null&&(a.status=s?"show":"hide");var l=n.getExtent();(o==null||o>l[1])&&(o=l[1]),o0;return o&&s}var ode=Qe();function W5(e,t,r,n){if(e instanceof r8){var a=e.scale.type;if(a!=="ordinal")return r}var i=e.model,o=i.get("jitter");if(!(o>0))return r;var s=i.get("jitterOverlap"),l=i.get("jitterMargin")||0,u=Vn(e.scale)?Cn(e).w:null;return s?O8(r,o,u,n):sde(e,t,r,n,o,l)}function O8(e,t,r,n){if(r===null)return e+(Math.random()-.5)*t;var a=r-n*2,i=Math.min(Math.max(0,t),a);return e+(Math.random()-.5)*i}function sde(e,t,r,n,a,i){var o=ode(e);o.items||(o.items=[]);var s=o.items,l=$5(s,t,r,n,a,i,1),u=$5(s,t,r,n,a,i,-1),c=Math.abs(l-r)a/2||h&&f>h/2-n?O8(r,a,h,n):(s.push({fixedCoord:t,floatCoord:c,r:n}),c)}function $5(e,t,r,n,a,i,o){for(var s=r,l=0;la/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=Ee({color:m.color},u));var x=Je(ke(m),{boundaryGap:r,splitNumber:n,clockwise:a,scale:i,axisLine:o,axisTick:s,axisLabel:l,name:m.text,showName:c,nameLocation:"end",nameGap:f,nameTextStyle:y,triggerEvent:v},!1);if(ve(h)){var _=x.name;x.name=h.replace("{value}",_??"")}else Le(h)&&(x.name=h(x.name,x));var w=new vt(x,null,this.ecModel);return kr(w,Tv.prototype),w.mainType="radar",w.componentIndex=this.componentIndex,w.uid=Oh("ec_radar"),w},this);this._indicatorModels=g},t.prototype.getIndicatorModels=function(){return this._indicatorModels},t.type=z8,t.defaultOption={z:0,center:["50%","50%"],radius:"50%",startAngle:90,clockwise:!1,axisName:{show:!0,color:K.color.axisLabel},boundaryGap:[0,0],splitNumber:B8,axisNameGap:15,scale:!1,shape:"polygon",axisLine:Je({lineStyle:{color:K.color.neutral20}},dp.axisLine),axisLabel:E0(dp.axisLabel,!1),axisTick:E0(dp.axisTick,!1),splitLine:E0(dp.splitLine,!0),splitArea:E0(dp.splitArea,!0),indicator:[]},t}(ht),gde=function(e){X(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,a){var i=this.group;i.removeAll(),this._buildAxes(r,a),this._buildSplitLineAndArea(r)},t.prototype._buildAxes=function(r,n){var a=r.coordinateSystem,i=a.getIndicatorAxes(),o=oe(i,function(s){var l=s.model.get("showName")?s.name:"",u=new Jn(s.model,n,{axisName:l,position:[a.cx,a.cy],rotation:s.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return u});R(o,function(s){s.build(),this.group.add(s.group)},this)},t.prototype._buildSplitLineAndArea=function(r){var n=r.coordinateSystem,a=n.getIndicatorAxes();if(!a.length)return;var i=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"),v=u.get("color"),g=ae(f)?f:[f],m=ae(v)?v:[v],y=[],x=[];function _(H,V,U){var F=U%V.length;return H[F]=H[F]||[],F}if(i==="circle")for(var w=a[0].getTicksCoords(),S=n.cx,C=n.cy,M=0;M3?1.4:o>1?1.2:1.1,c=i>0?u:1/u;this._checkTriggerMoveZoom(this,"zoom","zoomOnMouseWheel",r,{scale:c,originX:s,originY:l,isAvailableBehavior:null})}if(a){var h=Math.abs(i),f=(i>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(!(X5(this._zr,"globalPan")||fp(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,a,i,o){r._checkPointer(i,o.originX,o.originY)&&(Vs(i.event),i.__ecRoamConsumed=!0,q5(r,n,a,i,o))},t}(bi);function fp(e){return e.__ecRoamConsumed}var Mde=Qe();function nw(e){var t=Mde(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function vp(e,t,r,n){for(var a=nw(e),i=a.roam,o=i[t]=i[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=H8(c,{x:0,y:0,width:s,height:l}),!r.ignoreViewBox)){var v=a;a=new De,a.add(v),v.scaleX=v.scaleY=h.scale,v.x=h.x,v.y=h.y}return!r.ignoreRootClip&&s!=null&&l!=null&&a.setClipPath(new it({shape:{x:0,y:0,width:s,height:l}})),{root:a,width:s,height:l,viewBoxRect:c,viewBoxTransform:h,named:i}},e.prototype._parseNode=function(t,r,n,a,i,o){var s=t.nodeName.toLowerCase(),l,u=a;if(s==="defs"&&(i=!0),s==="text"&&(o=!0),s==="defs"||s==="switch")l=r;else{if(!i){var c=zC[s];if(c&&Se(zC,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 a&&n.push({name:a.name,namedFrom:a,svgNodeTagLower:s,el:l});r.add(l)}}var v=Q5[s];if(v&&Se(Q5,s)){var g=v.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,i,o):y.nodeType===3&&o&&this._parseText(y,l),y=y.nextSibling},e.prototype._parseText=function(t,r){var n=new jf({style:{text:t.textContent},silent:!0,x:this._textX||0,y:this._textY||0});$a(r,n),Sa(t,n,this._defsUsePending,!1,!1),Lde(n,r);var a=n.style,i=a.fontSize;i&&i<9&&(a.fontSize=9,n.scaleX*=i/9,n.scaleY*=i/9);var o=(a.fontSize||a.fontFamily)&&[a.fontStyle,a.fontWeight,(a.fontSize||12)+"px",a.fontFamily||"sans-serif"].join(" ");a.font=o;var s=n.getBoundingRect();return this._textX+=s.width,r.add(n),n},e.internalField=function(){zC={g:function(t,r){var n=new De;return $a(r,n),Sa(t,n,this._defsUsePending,!1,!1),n},rect:function(t,r){var n=new it;return $a(r,n),Sa(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 Ko;return $a(r,n),Sa(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 Tr;return $a(r,n),Sa(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 Hm;return $a(r,n),Sa(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"),a;n&&(a=r3(n));var i=new Sn({shape:{points:a||[]},silent:!0});return $a(r,i),Sa(t,i,this._defsUsePending,!1,!1),i},polyline:function(t,r){var n=t.getAttribute("points"),a;n&&(a=r3(n));var i=new un({shape:{points:a||[]},silent:!0});return $a(r,i),Sa(t,i,this._defsUsePending,!1,!1),i},image:function(t,r){var n=new Qr;return $a(r,n),Sa(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",a=t.getAttribute("y")||"0",i=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0";this._textX=parseFloat(n)+parseFloat(i),this._textY=parseFloat(a)+parseFloat(o);var s=new De;return $a(r,s),Sa(t,s,this._defsUsePending,!1,!0),s},tspan:function(t,r){var n=t.getAttribute("x"),a=t.getAttribute("y");n!=null&&(this._textX=parseFloat(n)),a!=null&&(this._textY=parseFloat(a));var i=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0",s=new De;return $a(r,s),Sa(t,s,this._defsUsePending,!1,!0),this._textX+=parseFloat(i),this._textY+=parseFloat(o),s},path:function(t,r){var n=t.getAttribute("d")||"",a=I7(n);return $a(r,a),Sa(t,a,this._defsUsePending,!1,!1),a.silent=!0,a}}}(),e}(),Q5={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),a=parseInt(e.getAttribute("y2")||"0",10),i=new Eh(t,r,n,a);return e3(e,i),t3(e,i),i},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),a=new eL(t,r,n);return e3(e,a),t3(e,a),a}};function e3(e,t){var r=e.getAttribute("gradientUnits");r==="userSpaceOnUse"&&(t.global=!0)}function t3(e,t){for(var r=e.firstChild;r;){if(r.nodeType===1&&r.nodeName.toLocaleLowerCase()==="stop"){var n=r.getAttribute("offset"),a=void 0;n&&n.indexOf("%")>0?a=parseInt(n,10)/100:n?a=parseFloat(n):a=0;var i={};G8(r,i,i);var o=i.stopColor||r.getAttribute("stop-color")||"#000000",s=i.stopOpacity||r.getAttribute("stop-opacity");if(s){var l=zn(o),u=l&&l[3];u&&(l[3]*=ks(s),o=ui(l,"rgba"))}t.colorStops.push({offset:a,color:o})}r=r.nextSibling}}function $a(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),Ee(t.__inheritedStyle,e.__inheritedStyle))}function r3(e){for(var t=aw(e),r=[],n=0;n0;i-=2){var o=n[i],s=n[i-1],l=aw(o);switch(a=a||ar(),s){case"translate":Hi(a,a,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":_1(a,a,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Js(a,a,-parseFloat(l[0])*BC,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*BC);ja(a,[1,0,u,1,0,0],a);break;case"skewY":var c=Math.tan(parseFloat(l[0])*BC);ja(a,[1,c,0,1,0,0],a);break;case"matrix":a[0]=parseFloat(l[0]),a[1]=parseFloat(l[1]),a[2]=parseFloat(l[2]),a[3]=parseFloat(l[3]),a[4]=parseFloat(l[4]),a[5]=parseFloat(l[5]);break}}t.setLocalTransform(a)}}var a3=/([^\s:;]+)\s*:\s*([^:;]+)/g;function G8(e,t,r){var n=e.getAttribute("style");if(n){a3.lastIndex=0;for(var a;(a=a3.exec(n))!=null;){var i=a[1],o=Se(yb,i)?yb[i]:null;o&&(t[o]=a[2]);var s=Se(xb,i)?xb[i]:null;s&&(r[s]=a[2])}}}function Rde(e,t,r){for(var n=0;n1e-6;mp[0]=o?(a[0]-n.x)/i:a[0],mp[1]=o?(a[1]-n.y)/i:a[1],dr(mp,mp,e.mtRawInv);var s=sfe(e,mp);d3(t,s,i),R(r,function(l){l!==t&&d3(l,s.slice(),i)})}var mp=[];function d3(e,t,r){var n=e.option;n.center=t,n.zoom=r}function wI(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 J8(e,t){var r=t.getShallow("nodeScaleRatio",!0)||1,n=e;return((n.zoom-1)*r+1)/(n.trans[$o].scaleX||1)}function sw(e,t,r,n,a,i,o,s){var l=wb(e);if(!l){r.disable();return}r.enable(Te(e.get("roam"),o),{api:t,zInfo:{component:e},triggerInfo:{roamTrigger:e.get("roamTrigger"),isInSelf:n,isInClip:function(c,h,f){return!a||a.contain(h,f)}}});function u(c){var h=e.mainType,f=sL(Ee({type:e9(h,e.subType,p7)},c));s&&(f.componentType=h),f[h+"Id"]=e.id,t.dispatchAction(f)}r.off("pan").off("zoom").on("pan",function(c){i&&i("pan"),u({dx:c.dx,dy:c.dy})}).on("zoom",function(c){i&&i("zoom"),u({zoom:c.scale,originX:c.originX,originY:c.originY})})}function Q8(e){return function(t,r,n){return HC.copy(e.getBoundingRect()),HC.applyTransform(e.getComputedTransform()),HC.contain(r,n)}}var HC=new je(0,0,0,0);function SI(e,t,r){var n=e9(t,r,p7);e.registerAction({type:n,event:n,update:"none"},function(a,i,o){i.eachComponent(Hk(a,t,r),function(s){Y8(a,s),X8(a,s,i,o)})})}function e9(e,t,r){return(e!==Ho?e:t==="map"?"geo":t)+r}function t9(e){return e.zoom!=null}function CI(e,t,r,n,a,i,o){var s=new iw(null,K8(e.ecModel,t));return ow(s,r,n,a,i),o?bb(s,o.x,o.y,o.width,o.height):bb(s,r,n,a,i),_I(s,e),s}var TI=["rect","circle","line","ellipse","polygon","polyline","path"],ufe=we(TI),cfe=we(TI.concat(["g"])),hfe=we(TI.concat(["g"])),r9=Qe();function B0(e){var t=e.getItemStyle(),r=e.get("areaColor");return r!=null&&(t.fill=r),t}function f3(e){var t=e.style;t&&(t.stroke=t.stroke||t.fill,t.fill=null)}var n9=function(){function e(t){var r=this.group=new De,n=this._transformGroup=new De;r.add(n),this.uid=Oh("ec_map_draw"),this._controller=new Hh(t.getZr()),n.add(this._regionsGroup=new De),n.add(this._svgGroup=new De)}return e.prototype.draw=function(t,r,n,a,i){var o=this,s=t.getData&&t.getData();xf(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)||i,v;l.shouldClip()?(v=yI(null,u),this.group.setClipPath(new it({shape:v.clone()}))):this.group.removeClipPath(),lu(h,yh,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),sw(t,n,this._controller,function(m,y,x){return t.coordinateSystem.containPoint([y,x])},v,function(){o._mouseDownFlag=!1},!1,!0),this._updateMapSelectHandler(t,c,n,a)},e.prototype.__updateOnOwnRoam=function(t){lu(this._transformGroup,yh,t.coordinateSystem.view,null)},e.prototype._buildGeoJSON=function(t,r,n,a,i,o){var s=this._regionsGroupByName=we(),l=we(),u=this._regionsGroup,c=n.projection,h=c&&c.stream,f=ou(ym(null,t,mh));function v(y,x){return x&&(y=x(y)),y&&dr([],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;Jr(r,Gr(a),{labelFetcher:c,labelDataIndex:u,defaultText:n},h);var f=r.getTextContent();if(f&&(r9(f).ignore=f.ignore,r.textConfig&&o)){var v=r.getBoundingRect().clone();r.textConfig.layoutRect=v,r.textConfig.position=[(o[0]-v.x)/v.width*100+"%",(o[1]-v.y)/v.height*100+"%"]}r.disableLabelAnimation=!0}else r.removeTextContent(),r.removeTextConfig(),r.disableLabelAnimation=null}function g3(e,t,r,n,a,i){t?t.setItemGraphicEl(i,r):Be(r).eventData={componentType:"geo",componentIndex:e.componentIndex,geoIndex:e.componentIndex,name:n,region:a&&a.option||{}}}function m3(e,t,r,n,a){t||el({el:r,componentModel:e,itemName:n,itemTooltipOption:a.get("tooltip")})}function y3(e,t,r,n){t.highDownSilentOnTouch=!!e.get("selectedMode");var a=n.getModel("emphasis"),i=a.get("focus");return ir(t,i,a.get("blurScope"),a.get("disabled")),xf(e)&&rne(t,e,r),i}function x3(e,t,r){var n=[],a;function i(){a=[]}function o(){a.length&&(n.push(a),a=[])}var s=t({polygonStart:i,polygonEnd:o,lineStart:i,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&a.push([l,u])},sphere:function(){}});return!r&&s.polygonStart(),R(e,function(l){s.lineStart();for(var u=0;u-1&&(a.style.stroke=a.style.fill,a.style.fill=K.color.neutral00,a.style.lineWidth=2),a},t.prototype.__ownRoamView=function(){return Sb(this)?this.coordinateSystem.view:null},t.type="series."+xh,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}(Ut);function a9(e){return e.indexOf("i")===0}function Sb(e){return xm(e.seriesGroup)===e&&!e.getHostGeoModel()}function xm(e){return e.f[0]}function MI(e,t){var r={};return e.eachRawSeriesByType(xh,function(n){var a=n.getHostGeoModel(),i=a?"o"+a.id:"i"+n.getMapType(),o=r[i]=r[i]||{f:[],r:[]};!e.isSeriesFiltered(n)&&!t&&o.f.push(n),o.r.push(n)}),r}var ffe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=xh,r}return t.prototype.render=function(r,n,a,i){if(!(i&&i.type==="mapToggleSelect"&&i.from===this.uid)){var o=this.group;if(o.removeAll(),!r.getHostGeoModel()){var s=this._mapDraw;s&&i&&i.type==="geoRoam"&&s.resetForLabelLayout(),i&&i.type==="geoRoam"&&i.componentType==="series"&&i.seriesId===r.id?s&&o.add(s.group):Sb(r)?(s=s||(this._mapDraw=new n9(a)),o.add(s.group),s.draw(r,n,a,this,i)):this._clearMapDraw(),r.get("showLegendSymbol")&&n.getComponent("legend")&&this._renderSymbols(r)}}},t.prototype.__updateOnOwnRoam=function(r,n,a){var i=this._mapDraw;Sb(n)&&i&&i.__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,a=this.group;n.each(n.mapDimension("value"),function(i,o){if(!isNaN(i)){var s=n.getItemLayout(o);if(!(!s||!s.point)){var l=s.point,u=s.offset,c=new Ko({style:{fill:r.getData().getVisual("style").fill},shape:{cx:l[0]+u*9,cy:l[1],r:3},silent:!0,z2:8+(u?0:cv+1)});if(!u){var h=xm(r.seriesGroup).getData(),f=n.getName(o),v=h.indexOfName(f),g=n.getItemModel(o),m=g.getModel("label"),y=h.getItemGraphicEl(v);Jr(c,Gr(g),{labelFetcher:{getFormattedLabel:function(x,_){return r.getFormattedLabel(v,_)}},defaultText:f}),c.disableLabelAnimation=!0,m.get("position")||c.setTextConfig({position:"bottom"}),y.onHoverStateChange=function(x){V_(c,x)}}a.add(c)}}})},t.type=xh,t}(Rt),vfe={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},i9=["lng","lat"],_3=function(e){X(t,e);function t(r,n,a){var i=e.call(this)||this;i.dimensions=i9,i.type="geo",i._nameCoordMap=we(),i.name=r;var o=a.projection,s=Ys.load(n,a.nameMap,a.nameProperty),l=Ys.getGeoResource(n);i.resourceType=l?l.type:null;var u=i.regions=s.regions,c=vfe[l.type];i._clip=a.clip;var h=o?!1:c.invertLongitute;i.view=new iw(h,K8(a.ecModel,a.api),i),i.map=n,i._regionsMap=s.regionsMap,i.regions=s.regions,i.projection=o;var f;if(o)for(var v=0;v1?(S.width=w,S.height=w/y):(S.height=w,S.width=w*y),S.y=_[1]-S.height/2,S.x=_[0]-S.width/2;else{var C=e.getBoxLayoutParams();C.aspect=y,S=tr(C,m),S=xH(e,S,y)}bb(r,S.x,S.y,S.width,S.height),_I(r,e)}function pfe(e,t){R(t.get("geoCoord"),function(r,n){e.addGeoCoord(n,r)})}var gfe=function(){function e(){this.dimensions=i9}return e.prototype.create=function(t,r){var n=[];function a(i){return{nameProperty:i.get("nameProperty"),aspectScale:i.get("aspectScale"),projection:i.get("projection"),clip:i.getShallow("clip",!0)}}return t.eachComponent("geo",function(i,o){var s=i.get("map"),l=new _3(s+o,s,te({nameMap:i.get("nameMap"),api:r,ecModel:t},a(i)));n.push(l),i.coordinateSystem=l,l.model=i,l.resize=w3,l.resize(i,r)}),t.eachSeries(function(i){Ym({targetModel:i,coordSysType:"geo",coordSysProvider:function(){var o=i.subType===xh?i.getHostGeoModel():i.getReferringComponents("geo",pr).models[0];return o&&o.coordinateSystem},allowNotFound:!0})}),R(MI(t,!0),function(i,o){if(a9(o)){var s=i.r[0],l=[];R(i.r,function(f){l.push(f.get("nameMap")),f.seriesGroup=null});var u=o.slice(1),c=new _3(u,u,te({nameMap:y1(l),api:r,ecModel:t},a(s))),h;R(i.r,function(f){h=Te(h,f.get("scaleLimit"))}),n.push(c),c.resize=w3,c.resize(s,r),R(i.r,function(f){f.coordinateSystem=c,pfe(c,f)})}}),n},e.prototype.getFilledRegions=function(t,r,n,a){for(var i=(t||[]).slice(),o=we(),s=0;s=0;o--){var s=a[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},r.push(s)}}function Afe(e,t){var r=e.isExpand?e.children:[],n=e.parentNode.children,a=e.hierNode.i?n[e.hierNode.i-1]:null;if(r.length){kfe(e);var i=(r[0].hierNode.prelim+r[r.length-1].hierNode.prelim)/2;a?(e.hierNode.prelim=a.hierNode.prelim+t(e,a),e.hierNode.modifier=e.hierNode.prelim-i):e.hierNode.prelim=i}else a&&(e.hierNode.prelim=a.hierNode.prelim+t(e,a));e.parentNode.hierNode.defaultAncestor=Lfe(e,a,e.parentNode.hierNode.defaultAncestor||n[0],t)}function Nfe(e){var t=e.hierNode.prelim+e.parentNode.hierNode.modifier;e.setLayout({x:t},!0),e.hierNode.modifier+=e.parentNode.hierNode.modifier}function S3(e){return arguments.length?e:Dfe}function Gp(e,t){return e-=Math.PI/2,{x:t*Math.cos(e),y:t*Math.sin(e)}}function kfe(e){for(var t=e.children,r=t.length,n=0,a=0;--r>=0;){var i=t[r];i.hierNode.prelim+=n,i.hierNode.modifier+=n,a+=i.hierNode.change,n+=i.hierNode.shift+a}}function Lfe(e,t,r,n){if(t){for(var a=e,i=e,o=i.parentNode.children[0],s=t,l=a.hierNode.modifier,u=i.hierNode.modifier,c=o.hierNode.modifier,h=s.hierNode.modifier;s=UC(s),i=WC(i),s&&i;){a=UC(a),o=WC(o),a.hierNode.ancestor=e;var f=s.hierNode.prelim+h-i.hierNode.prelim-u+n(s,i);f>0&&(Pfe(Ife(s,e,r),e,f),u+=f,l+=f),h+=s.hierNode.modifier,u+=i.hierNode.modifier,l+=a.hierNode.modifier,c+=o.hierNode.modifier}s&&!UC(a)&&(a.hierNode.thread=s,a.hierNode.modifier+=h-l),i&&!WC(o)&&(o.hierNode.thread=i,o.hierNode.modifier+=u-c,r=e)}return r}function UC(e){var t=e.children;return t.length&&e.isExpand?t[t.length-1]:e.hierNode.thread}function WC(e){var t=e.children;return t.length&&e.isExpand?t[0]:e.hierNode.thread}function Ife(e,t,r){return e.hierNode.ancestor.parentNode===t.parentNode?e.hierNode.ancestor:r}function Pfe(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 Dfe(e,t){return e.parentNode===t.parentNode?1:2}var hi=Qe();function l9(e){var t=e.mainData,r=e.datas;r||(r={main:t},e.datasAttr={main:"data"}),e.datas=e.mainData=null,u9(t,r,e),R(r,function(n){R(t.TRANSFERABLE_METHODS,function(a){n.wrapMethod(a,nt(jfe,e))})}),t.wrapMethod("cloneShallow",nt(Rfe,e)),R(t.CHANGABLE_METHODS,function(n){t.wrapMethod(n,nt(Efe,e))}),bn(r[t.dataType]===t)}function jfe(e,t){if(Bfe(this)){var r=te({},hi(this).datas);r[this.dataType]=t,u9(t,r,e)}else AI(t,this.dataType,hi(this).mainData,e);return t}function Efe(e,t){return e.struct&&e.struct.update(),t}function Rfe(e,t){return R(hi(t).datas,function(r,n){r!==t&&AI(r.cloneShallow(),n,t,e)}),t}function Ofe(e){var t=hi(this).mainData;return e==null||t==null?t:hi(t).datas[e]}function zfe(){var e=hi(this).mainData;return e==null?[{data:e}]:oe(gt(hi(e).datas),function(t){return{type:t,data:hi(e).datas[t]}})}function Bfe(e){return hi(e).mainData===e}function u9(e,t,r){hi(e).datas={},R(t,function(n,a){AI(n,a,e,r)})}function AI(e,t,r,n){hi(r).datas[t]=e,hi(e).mainData=r,e.dataType=t,n.struct&&(e[n.structAttr]=n.struct,n.struct[n.datasAttr[t]]=e),e.getLinkedData=Ofe,e.getLinkedDataAll=zfe}var Ffe=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){Le(t)&&(n=r,r=t,t=null),t=t||{},ve(t)&&(t={order:t});var a=t.order||"preorder",i=this[t.attr||"children"],o;a==="preorder"&&(o=r.call(n,this));for(var s=0;!o&&sr&&(r=a.height)}this.height=r+1},e.prototype.getNodeById=function(t){if(this.getId()===t)return this;for(var r=0,n=this.children,a=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,a=e.targetNode;if(ve(a)&&(a=n.getNodeById(a)),a&&n.contains(a))return{node:a};var i=e.targetNodeId;if(i!=null&&(a=n.getNodeById(i)))return{node:a}}}function c9(e){for(var t=[];e;)e=e.parentNode,e&&t.push(e);return t.reverse()}function kI(e,t){var r=c9(e);return Ye(r,t)>=0}function lw(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 _h="tree",Gfe=function(e){X(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},a=r.leaves||{},i=new vt(a,this,this.ecModel),o=NI.createTree(n,this,s);function s(h){h.wrapMethod("getItemModel",function(f,v){var g=o.getNodeByDataIndex(v);return g&&g.children.length&&g.isExpand||(f.parentModel=i),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,a){for(var i=this.getData().tree,o=i.root.children[0],s=i.getNodeByDataIndex(r),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return Er("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),a=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=lw(a,this),n.collapsed=!a.isExpand,n},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+_h,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}(Ut),Hfe=function(){function e(){this.parentPoint=[],this.childPoints=[]}return e}(),Ufe=function(e){X(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 Hfe},t.prototype.buildPath=function(r,n){var a=n.childPoints,i=a.length,o=n.parentPoint,s=a[0],l=a[i-1];if(i===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=me(n.forkPosition,1),v=[];v[c]=o[c],v[h]=o[h]+(l[h]-o[h])*f,r.moveTo(o[0],o[1]),r.lineTo(v[0],v[1]),r.moveTo(s[0],s[1]),v[c]=s[c],r.lineTo(v[0],v[1]),v[c]=l[c],r.lineTo(v[0],v[1]),r.lineTo(l[0],l[1]);for(var g=1;g_.x,C||(S=S-Math.PI));var A=C?"left":"right",I=s.getModel("label"),k=I.get("rotate"),P=k*(Math.PI/180),D=y.getTextContent();D&&(y.setTextConfig({position:I.get("position")||A,rotation:k==null?-S:P,origin:"center"}),D.setStyle("verticalAlign","middle"))}var z=s.get(["emphasis","focus"]),j=z==="relative"?Lf(o.getAncestorsIndices(),o.getDescendantIndices()):z==="ancestor"?o.getAncestorsIndices():z==="descendant"?o.getDescendantIndices():null;j&&(Be(r).focus=j),$fe(a,o,c,r,g,v,m,n),r.__edge&&(r.onHoverStateChange=function(B){if(B!=="blur"){var H=o.parentNode&&e.getItemGraphicEl(o.parentNode.dataIndex);H&&H.hoverState===Gm||V_(r.__edge,B)}})}function $fe(e,t,r,n,a,i,o,s){var l=t.getModel(),u=e.get("edgeShape"),c=e.get("layout"),h=e.getOrient(),f=e.get(["lineStyle","curveness"]),v=e.get("edgeForkPosition"),g=l.getModel("lineStyle").getLineStyle(),m=n.__edge;if(u==="curve")t.parentNode&&t.parentNode!==r&&(m||(m=n.__edge=new dv({shape:PA(c,h,f,a,a)})),At(m,{shape:PA(c,h,f,i,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;_=0;i--)r.push(a[i])}}function Yfe(e,t){e.eachSeriesByType("tree",function(r){Xfe(r,t)})}function Xfe(e,t){var r=Ur(e,t).refContainer,n=tr(e.getBoxLayoutParams(),r);e.layoutInfo=n;var a=e.get("layout"),i=0,o=0,s=null;a==="radial"?(i=2*Math.PI,o=Math.min(n.height,n.width)/2,s=S3(function(S,C){return(S.parentNode===C.parentNode?1:2)/S.depth})):(i=n.width,o=n.height,s=S3());var l=e.getData().tree.root,u=l.children[0];if(u){Mfe(l),Zfe(u,Afe,s),l.hierNode.modifier=-u.hierNode.prelim,yp(u,Nfe);var c=u,h=u,f=u;yp(u,function(S){var C=S.getLayout().x;Ch.getLayout().x&&(h=S),S.depth>f.depth&&(f=S)});var v=c===h?1:s(c,h)/2,g=v-c.getLayout().x,m=0,y=0,x=0,_=0;if(a==="radial")m=i/(h.getLayout().x+v+g),y=o/(f.depth-1||1),yp(u,function(S){x=(S.getLayout().x+g)*m,_=(S.depth-1)*y;var C=Gp(x,_);S.setLayout({x:C.x,y:C.y,rawX:x,rawY:_},!0)});else{var w=e.getOrient();w==="RL"||w==="LR"?(y=o/(h.getLayout().x+v+g),m=i/(f.depth-1||1),yp(u,function(S){_=(S.getLayout().x+g)*y,x=w==="LR"?(S.depth-1)*m:i-(S.depth-1)*m,S.setLayout({x,y:_},!0)})):(w==="TB"||w==="BT")&&(m=i/(h.getLayout().x+v+g),y=o/(f.depth-1||1),yp(u,function(S){x=(S.getLayout().x+g)*m,_=w==="TB"?(S.depth-1)*y:o-(S.depth-1)*y,S.setLayout({x,y:_},!0)}))}}}function qfe(e){e.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,r){r.eachComponent({mainType:Ho,subType:_h,query:t},function(n){var a=t.dataIndex,i=n.getData().tree,o=i.getNodeByDataIndex(a);o.isExpand=!o.isExpand})}),SI(e,Ho,_h)}var Kfe=Hr(_h,Jfe);function Jfe(e){e.eachSeriesByType(_h,function(t){var r=t.getData(),n=r.tree;n.eachNode(function(a){var i=a.getModel(),o=i.getModel("itemStyle").getItemStyle(),s=r.ensureUniqueItemVisual(a.dataIndex,"style");te(s,o)})})}function Qfe(e){e.registerChartView(Wfe),e.registerSeriesModel(Gfe),e.registerLayout(Yfe),e.registerVisual(Kfe),qfe(e)}var N3=["treemapZoomToNode","treemapRender","treemapMove"];function eve(e){for(var t=0;t1;)i=i.parentNode;var o=YM(e.ecModel,i.name||i.dataIndex+"",n);a.setVisual("decal",o)})}var tve=function(e){X(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 a={name:r.name,children:r.data};f9(a);var i=r.levels||[],o=this.designatedVisualItemStyle={},s=new vt({itemStyle:o},this,n);i=r.levels=rve(i,n);var l=oe(i||[],function(h){return new vt(h,s,n)},this),u=NI.createTree(a,this,c);function c(h){h.wrapMethod("getItemModel",function(f,v){var g=u.getNodeByDataIndex(v),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,a){var i=this.getData(),o=this.getRawValue(r),s=i.getName(r);return Er("nameValue",{name:s,value:o})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),a=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=lw(a,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(r){this.layoutInfo=this.layoutInfo||{},te(this.layoutInfo,r)},t.prototype.mapIdToIndex=function(r){var n=this._idIndexMap;n||(n=this._idIndexMap=we(),this._idIndexMapCount=0);var a=n.get(r);return a==null&&n.set(r,a=this._idIndexMapCount++),a},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(){d9(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}(Ut);function f9(e){var t=0;R(e.children,function(n){f9(n);var a=n.value;ae(a)&&(a=a[0]),t+=a});var r=e.value;ae(r)&&(r=r[0]),(r==null||isNaN(r))&&(r=t),r<0&&(r=0),ae(e.value)?e.value[0]=r:e.value=r}function rve(e,t){var r=Zt(t.get("color")),n=Zt(t.get(["aria","decal","decals"]));if(r){e=e||[];var a,i;R(e,function(s){var l=new vt(s),u=l.get("color"),c=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(a=!0),(l.get(["itemStyle","decal"])||c&&c!=="none")&&(i=!0)});var o=e[0]||(e[0]={});return a||(o.color=r.slice()),!i&&n&&(o.decal=n.slice()),e}}var nve=8,k3=8,$C=5,ave=function(){function e(t){this.group=new De,t.add(this.group)}return e.prototype.render=function(t,r,n,a){var i=t.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!i.get("show")||!n)){var s=i.getModel("itemStyle"),l=i.getModel("emphasis"),u=s.getModel("textStyle"),c=l.getModel(["itemStyle","textStyle"]),h=Ur(t,r).refContainer,f={left:i.get("left"),right:i.get("right"),top:i.get("top"),bottom:i.get("bottom")},v={emptyItemWidth:i.get("emptyItemWidth"),totalWidth:0,renderList:[]},g=tr(f,h);this._prepare(n,v,u),this._renderContent(t,v,g,s,l,u,c,a),V1(o,f,h)}},e.prototype._prepare=function(t,r,n){for(var a=t;a;a=a.parentNode){var i=Fr(a.getModel().get("name"),""),o=n.getTextRect(i),s=Math.max(o.width+nve*2,r.emptyItemWidth);r.totalWidth+=s+k3,r.renderList.push({node:a,text:i,width:s})}},e.prototype._renderContent=function(t,r,n,a,i,o,s,l){for(var u=0,c=r.emptyItemWidth,h=t.get(["breadcrumb","height"]),f=r.totalWidth,v=r.renderList,g=i.getModel("itemStyle").getItemStyle(),m=v.length-1;m>=0;m--){var y=v[m],x=y.node,_=y.width,w=y.text;f>n.width&&(f-=_-c,_=c,w=null);var S=new Sn({shape:{points:ive(u,0,_,h,m===v.length-1,m===0)},style:Ee(a.getItemStyle(),{lineJoin:"bevel"}),textContent:new wt({style:$t(o,{text:w})}),textConfig:{position:"inside"},z2:cv*1e4,onclick:nt(l,x)});S.disableLabelAnimation=!0,S.getTextContent().ensureState("emphasis").style=$t(s,{text:w}),S.ensureState("emphasis").style=g,ir(S,i.get("focus"),i.get("blurScope"),i.get("disabled")),this.group.add(S),ove(S,t,x),u+=_+k3}},e.prototype.remove=function(){this.group.removeAll()},e}();function ive(e,t,r,n,a,i){var o=[[a?e:e-$C,t],[e+r,t],[e+r,t+n],[a?e:e-$C,t+n]];return!i&&o.splice(2,0,[e+r+$C,t+n/2]),!a&&o.push([e,t+n/2]),o}function ove(e,t,r){Be(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&&lw(r,t)}}var sve=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(t,r,n,a,i){return this._elExistsMap[t.id]?!1:(this._elExistsMap[t.id]=!0,this._storage.push({el:t,target:r,duration:n,delay:a,easing:i}),!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())},a=0,i=this._storage.length;a=0;l--){var u=a[n==="asc"?o-l-1:l].getValue();u/r*ts[1]&&(s[1]=u)})),{sum:n,dataExtent:s}}function mve(e,t,r){for(var n=0,a=1/0,i=0,o=void 0,s=e.length;in&&(n=o));var l=e.area*e.area,u=t*t*r;return l?bm(u*n/l,l/(u*a)):1/0}function L3(e,t,r,n,a){var i=t===r.width?0:1,o=1-i,s=["x","y"],l=["width","height"],u=r[s[i]],c=t?e.area/t:0;(a||c>r[l[o]])&&(c=r[l[o]]);for(var h=0,f=e.length;hYg&&(c=Yg),a=l}cP3||Math.abs(r.dy)>P3)){var n=this.seriesModel.getData().tree.root;if(!n)return;var a=n.getLayout();if(!a)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:a.x+r.dx,y:a.y+r.dy,width:a.width,height:a.height}})}},t.prototype._onZoom=function(r){var n=r.originX,a=r.originY,i=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 je(l.x,l.y,l.width,l.height),c=o.layoutInfo,h=y9(c,l),f=h*i;f=x9(f,o);var v=f/h;n-=c.x,a-=c.y;var g=ar();Hi(g,g,[-n,-a]),_1(g,g,[v,v]),Hi(g,g,[n,a]),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(a){if(n._state==="ready"){var i=n.seriesModel.get("nodeClick",!0);if(i){var o=n.findTarget(a.offsetX,a.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)n._rootToNode(o);else if(i==="zoomToNode")n._zoomToNode(o);else if(i==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),c=l.get("target",!0)||"blank";u&&Z_(u,c)}}}}},this)},t.prototype._renderBreadcrumb=function(r,n,a){var i=this;a||(a=r.get("leafDepth",!0)!=null?{node:r.getViewRoot()}:this.findTarget(n.getWidth()/2,n.getHeight()/2),a||(a={node:r.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new ave(this.group))).render(r,n,a.node,function(o){i._state!=="animating"&&(kI(r.getViewRoot(),o)?i._rootToNode({node:o}):i._zoomToNode({node:o}))})},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=xp(),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 a,i=this.seriesModel.getViewRoot();return i.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)a={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),a},t.type="treemap",t}(Rt);function xp(){return{nodeGroup:[],background:[],content:[]}}function Cve(e,t,r,n,a,i,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 v=c.width,g=c.height,m=c.borderWidth,y=c.invisible,x=o.getRawIndex(),_=s&&s.getRawIndex(),w=o.viewChildren,S=c.upperHeight,C=w&&w.length,M=f.getModel("itemStyle"),A=f.getModel(["emphasis","itemStyle"]),I=f.getModel(["blur","itemStyle"]),k=f.getModel(["select","itemStyle"]),P=M.get("borderRadius")||0,D=le("nodeGroup",DA);if(!D)return;if(l.add(D),D.x=c.x||0,D.y=c.y||0,D.markRedraw(),Tb(D).nodeWidth=v,Tb(D).nodeHeight=g,c.isAboveViewRoot)return D;var z=le("background",I3,u,bve);z&&$(D,z,C&&c.upperLabelHeight);var j=f.getModel("emphasis"),B=j.get("focus"),H=j.get("blurScope"),V=j.get("disabled"),U=B==="ancestor"?o.getAncestorsIndices():B==="descendant"?o.getDescendantIndices():B;if(C)Kg(D)&&Ic(D,!1),z&&(Ic(z,!V),h.setItemGraphicEl(o.dataIndex,z),OM(z,U,H));else{var F=le("content",I3,u,wve);F&&Z(D,F),z.disableMorphing=!0,z&&Kg(z)&&Ic(z,!1),Ic(D,!V),h.setItemGraphicEl(o.dataIndex,D);var W=f.getShallow("cursor");W&&F.attr("cursor",W),OM(D,U,H)}return D;function $(ye,ne,xe){var he=Be(ne);if(he.dataIndex=o.dataIndex,he.seriesIndex=e.seriesIndex,ne.setShape({x:0,y:0,width:v,height:g,r:P}),y)J(ne);else{ne.invisible=!1;var ge=o.getVisual("style"),tt=ge.stroke,Ue=E3(M);Ue.fill=tt;var qe=yc(A);qe.fill=A.get("borderColor");var Fe=yc(I);Fe.fill=I.get("borderColor");var _t=yc(k);if(_t.fill=k.get("borderColor"),xe){var bt=v-2*m;re(ne,tt,ge.opacity,{x:m,y:0,width:bt,height:S})}else ne.removeTextContent();ne.setStyle(Ue),ne.ensureState("emphasis").style=qe,ne.ensureState("blur").style=Fe,ne.ensureState("select").style=_t,oh(ne)}ye.add(ne)}function Z(ye,ne){var xe=Be(ne);xe.dataIndex=o.dataIndex,xe.seriesIndex=e.seriesIndex;var he=Math.max(v-2*m,0),ge=Math.max(g-2*m,0);if(ne.culling=!0,ne.setShape({x:m,y:m,width:he,height:ge,r:P}),y)J(ne);else{ne.invisible=!1;var tt=o.getVisual("style"),Ue=tt.fill,qe=E3(M);qe.fill=Ue,qe.decal=tt.decal;var Fe=yc(A),_t=yc(I),bt=yc(k);re(ne,Ue,tt.opacity,null),ne.setStyle(qe),ne.ensureState("emphasis").style=Fe,ne.ensureState("blur").style=_t,ne.ensureState("select").style=bt,oh(ne)}ye.add(ne)}function J(ye){!ye.invisible&&i.push(ye)}function re(ye,ne,xe,he){var ge=f.getModel(he?j3:D3),tt=Fr(f.get("name"),null),Ue=ge.getShallow("show");Jr(ye,Gr(f,he?j3:D3),{defaultText:Ue?tt:null,inheritColor:ne,defaultOpacity:xe,labelFetcher:e,labelDataIndex:o.dataIndex});var qe=ye.getTextContent();if(qe){var Fe=qe.style,_t=zm(Fe.padding||0);he&&(ye.setTextConfig({layoutRect:he}),qe.disableLabelLayout=!0),qe.beforeUpdate=function(){var et=Math.max((he?he.width:ye.shape.width)-_t[1]-_t[3],0),Ke=Math.max((he?he.height:ye.shape.height)-_t[0]-_t[2],0);(Fe.width!==et||Fe.height!==Ke)&&qe.setStyle({width:et,height:Ke})},Fe.truncateMinChar=2,Fe.lineOverflow="truncate",Q(Fe,he,c);var bt=qe.getState("emphasis");Q(bt?bt.style:null,he,c)}}function Q(ye,ne,xe){var he=ye?ye.text:null;if(!ne&&xe.isLeafRoot&&he!=null){var ge=e.get("drillDownIcon",!0);ye.text=ge?ge+" "+he:he}}function le(ye,ne,xe,he){var ge=_!=null&&r[ye][_],tt=a[ye];return ge?(r[ye][_]=null,de(tt,ge)):y||(ge=new ne,ge instanceof yi&&(ge.z2=Tve(xe,he)),He(tt,ge)),t[ye][x]=ge}function de(ye,ne){var xe=ye[x]={};ne instanceof DA?(xe.oldX=ne.x,xe.oldY=ne.y):xe.oldShape=te({},ne.shape)}function He(ye,ne){var xe=ye[x]={},he=o.parentNode,ge=ne instanceof De;if(he&&(!n||n.direction==="drillDown")){var tt=0,Ue=0,qe=a.background[he.getRawIndex()];!n&&qe&&qe.oldShape&&(tt=qe.oldShape.width,Ue=qe.oldShape.height),ge?(xe.oldX=0,xe.oldY=Ue):xe.oldShape={x:tt,y:Ue,width:0,height:0}}xe.fadein=!ge}}function Tve(e,t){return e*_ve+t}var wm=R,Mve=Re,Mb=-1,Kr=function(){function e(t){var r=t.mappingMethod,n=t.type,a=this.option=ke(t);this.type=n,this.mappingMethod=r,this._normalizeData=kve[r];var i=e.visualHandlers[n];this.applyVisual=i.applyVisual,this.getColorMapper=i.getColorMapper,this._normalizedToVisual=i._normalizedToVisual[r],r==="piecewise"?(ZC(a),Ave(a)):r==="category"?a.categories?Nve(a):ZC(a,!0):(bn(r!=="linear"||a.dataExtent),ZC(a))}return e.prototype.mapValueToVisual=function(t){var r=this._normalizeData(t);return this._normalizedToVisual(r,t)},e.prototype.getNormalizer=function(){return be(this._normalizeData,this)},e.listVisualTypes=function(){return gt(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(t,r,n){Re(t)?R(t,r,n):r.call(n,t)},e.mapVisual=function(t,r,n){var a,i=ae(t)?[]:Re(t)?{}:(a=!0,null);return e.eachVisual(t,function(o,s){var l=r.call(n,o,s);a?i=l:i[s]=l}),i},e.retrieveVisuals=function(t){var r={},n;return t&&wm(e.visualHandlers,function(a,i){t.hasOwnProperty(i)&&(r[i]=t[i],n=!0)}),n?r:null},e.prepareVisualTypes=function(t){if(ae(t))t=t.slice();else if(Mve(t)){var r=[];wm(t,function(n,a){r.push(a)}),t=r}else return[];return t.sort(function(n,a){return a==="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 a,i=1/0,o=0,s=r.length;o=0;i--)n[i]==null&&(delete r[t[i]],t.pop())}function ZC(e,t){var r=e.visual,n=[];Re(r)?wm(r,function(i){n.push(i)}):r!=null&&n.push(r);var a={color:1,symbol:1};!t&&n.length===1&&!a.hasOwnProperty(e.type)&&(n[1]=n[0]),_9(e,n)}function F0(e){return{applyVisual:function(t,r,n){var a=this.mapValueToVisual(t);n("color",e(r("color"),a))},_normalizedToVisual:jA([0,1])}}function R3(e){var t=this.option.visual;return t[Math.round(Nt(e,[0,1],[0,t.length-1],!0))]||{}}function _p(e){return function(t,r,n){n(e,this.mapValueToVisual(t))}}function Hp(e){var t=this.option.visual;return t[this.option.loop&&e!==Mb?e%t.length:e]}function xc(){return this.option.visual[0]}function jA(e){return{linear:function(t){return Nt(t,e,this.option.visual,!0)},category:Hp,piecewise:function(t,r){var n=EA.call(this,r);return n==null&&(n=Nt(t,e,this.option.visual,!0)),n},fixed:xc}}function EA(e){var t=this.option,r=t.pieceList;if(t.hasSpecialVisual){var n=Kr.findPieceIndex(e,r),a=r[n];if(a&&a.visual)return a.visual[this.type]}}function _9(e,t){return e.visual=t,e.type==="color"&&(e.parsedVisual=oe(t,function(r){var n=zn(r);return n||[0,0,0,1]})),t}var kve={linear:function(e){return Nt(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,r=Kr.findPieceIndex(e,t,!0);if(r!=null)return Nt(r,[0,t.length-1],[0,1],!0)},category:function(e){var t=this.option.categories?this.option.categoryMap[e]:e;return t??Mb},fixed:hr};function V0(e,t,r){return e?t<=r:t=r.length||m===r[m.depth]){var x=Eve(a,l,m,y,g,n);w9(m,x,r,n)}})}}}function Pve(e,t,r){var n=te({},t),a=r.designatedVisualItemStyle;return R(["color","colorAlpha","colorSaturation"],function(i){a[i]=t[i];var o=e.get(i);a[i]=null,o!=null&&(n[i]=o)}),n}function O3(e){var t=YC(e,"color");if(t){var r=YC(e,"colorAlpha"),n=YC(e,"colorSaturation");return n&&(t=Ls(t,null,null,n)),r&&(t=Ug(t,r)),t}}function Dve(e,t){return t!=null?Ls(t,null,null,e):null}function YC(e,t){var r=e[t];if(r!=null&&r!=="none")return r}function jve(e,t,r,n,a,i){if(!(!i||!i.length)){var o=XC(t,"color")||a.color!=null&&a.color!=="none"&&(XC(t,"colorAlpha")||XC(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 Kr(h);return b9(f).drColorMappingBy=c,f}}}function XC(e,t){var r=e.get(t);return ae(r)&&r.length?{name:t,range:r}:null}function Eve(e,t,r,n,a,i){var o=te({},t);if(a){var s=a.type,l=s==="color"&&b9(a).drColorMappingBy,u=l==="index"?n:l==="id"?i.mapIdToIndex(r.getId()):r.getValue(e.get("visualDimension"));o[s]=a.mapValueToVisual(u)}return o}function Rve(e){e.registerSeriesModel(tve),e.registerChartView(Sve),e.registerVisual(Ive),e.registerLayout(dve),eve(e)}function wd(e){return"_EC_"+e}var Ove=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[wd(t)]){var a=new _c(t,r);return a.hostGraph=this,this.nodes.push(a),n[wd(t)]=a,a}},e.prototype.getNodeByIndex=function(t){var r=this.data.getRawIndex(t);return this.nodes[r]},e.prototype.getNodeById=function(t){return this._nodesMap[wd(t)]},e.prototype.addEdge=function(t,r,n){var a=this._nodesMap,i=this._edgesMap;if(Tt(t)&&(t=this.nodes[t]),Tt(r)&&(r=this.nodes[r]),t instanceof _c||(t=a[wd(t)]),r instanceof _c||(r=a[wd(r)]),!(!t||!r)){var o=t.id+"-"+r.id,s=new S9(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),i[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 _c&&(t=t.id),r instanceof _c&&(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,a=n.length,i=0;i=0&&t.call(r,n[i],i)},e.prototype.eachEdge=function(t,r){for(var n=this.edges,a=n.length,i=0;i=0&&n[i].node1.dataIndex>=0&&n[i].node2.dataIndex>=0&&t.call(r,n[i],i)},e.prototype.breadthFirstTraverse=function(t,r,n,a){if(r instanceof _c||(r=this._nodesMap[wd(r)]),!!r){for(var i=n==="out"?"outEdges":n==="in"?"inEdges":"edges",o=0;o=0&&l.node2.dataIndex>=0});for(var i=0,o=a.length;i=0&&!t.hasKey(g)&&(t.set(g,!0),o.push(v.node1))}for(l=0;l=0&&!t.hasKey(w)&&(t.set(w,!0),s.push(_.node2))}}}return{edge:t.keys(),node:r.keys()}},e}(),S9=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=we(),r=we();t.set(this.dataIndex,!0);for(var n=[this.node1],a=[this.node2],i=0;i=0&&!t.hasKey(h)&&(t.set(h,!0),n.push(c.node1))}for(i=0;i=0&&!t.hasKey(m)&&(t.set(m,!0),a.push(g.node2))}return{edge:t.keys(),node:r.keys()}},e}();function C9(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)}}}kr(_c,C9("hostGraph","data"));kr(S9,C9("hostGraph","edgeData"));function II(e,t,r,n,a){for(var i=new Ove(n),o=0;o "+f)),u++)}var v=r.get("coordinateSystem"),g;if(v==="cartesian2d"||v==="polar"||v==="matrix")g=Jo(e,r);else{var m=yv.get(v),y=m?m.dimensions||[]:[];Ye(y,"value")<0&&y.concat(["value"]);var x=wv(e,{coordDimensions:y,encodeDefine:r.getEncode()}).dimensions;g=new Bn(x,r),g.initData(e)}var _=new Bn(["value"],r);return _.initData(l,s),a&&a(g,_),l9({mainData:g,struct:i,structAttr:"graph",datas:{node:g,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),i.update(),i}var RA="-->",uw=function(e){return e.get("autoCurveness")||null},T9=function(e,t){var r=uw(e),n=20,a=[];if(Tt(r))n=r;else if(ae(r)){e.__curvenessList=r;return}t>n&&(n=t);var i=n%2?n+2:n+3;a=[];for(var o=0;o "),value:o.value,noValue:o.value==null})}var h=QH({series:this,dataIndex:r,multipleSeries:n});return h},t.prototype._updateCategoriesData=function(){var r=oe(this.option.categories||[],function(a){return a.value!=null?a:te({value:0},a)}),n=new Bn(["value"],this);n.initData(r),this._categoriesData=n,this._categoriesModels=n.mapArray(function(a){return n.getItemModel(a)})},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 Z8(r)&&r},t.type="series."+ta,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}(Ut);function G0(e){return e instanceof Array||(e=[e,e]),e}var Hve=Hr(ta,Uve);function Uve(e){e.eachSeriesByType(ta,function(t){var r=t.getGraph(),n=t.getEdgeData(),a=G0(t.get("edgeSymbol")),i=G0(t.get("edgeSymbolSize"));n.setVisual("fromSymbol",a&&a[0]),n.setVisual("toSymbol",a&&a[1]),n.setVisual("fromSymbolSize",i&&i[0]),n.setVisual("toSymbolSize",i&&i[1]),n.setVisual("style",t.getModel("lineStyle").getLineStyle()),n.each(function(o){var s=n.getItemModel(o),l=r.getEdgeByIndex(o),u=G0(s.getShallow("symbol",!0)),c=G0(s.getShallow("symbolSize",!0)),h=s.getModel("lineStyle").getLineStyle(),f=n.ensureUniqueItemVisual(o,"style");switch(te(f,h),f.stroke){case"source":{var v=l.node1.getVisual("style");f.stroke=v&&v.fill;break}case"target":{var v=l.node2.getVisual("style");f.stroke=v&&v.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 A9(e){var t=e.coordinateSystem;if(!(t&&t.type!=="view")){var r=e.getGraph();r.eachNode(function(n){var a=n.getModel();n.setLayout([+a.get("x"),+a.get("y")])}),DI(r,e)}}function DI(e,t){e.eachEdge(function(r,n){var a=ya(r.getModel().get(["lineStyle","curveness"]),-PI(r,t,n,!0),0),i=No(r.node1.getLayout()),o=No(r.node2.getLayout()),s=[i,o];+a&&s.push([(i[0]+o[0])/2-(i[1]-o[1])*a,(i[1]+o[1])/2-(o[0]-i[0])*a]),r.setLayout(s)})}var Wve=Hr(ta,$ve);function $ve(e,t){e.eachSeriesByType(ta,function(r){var n=r.get("layout"),a=r.coordinateSystem;if(a&&a.type!=="view"){var i=r.getData(),o=[];R(a.dimensions,function(f){o=o.concat(i.mapDimensionsAll(f))});for(var s=0;s0&&(C[0]=-C[0],C[1]=-C[1]);var A=S[0]<0?-1:1;if(i.__position!=="start"&&i.__position!=="end"){var I=-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":i.x=-f[0]*x+c[0],i.y=-f[1]*_+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":i.x=x*A+c[0],i.y=c[1]+k,g=S[0]<0?"right":"left",i.originX=-x*A,i.originY=-k;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=M[0],i.y=M[1]+k,g="center",i.originY=-k;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-x*A+h[0],i.y=h[1]+k,g=S[0]>=0?"right":"left",i.originX=x*A,i.originY=-k;break}i.scaleX=i.scaleY=o,i.setStyle({verticalAlign:i.__verticalAlign||m,align:i.__align||g})}},t}(De),RI=function(){function e(t){this.group=new De,this._LineCtor=t||EI}return e.prototype.updateData=function(t){var r=this;this._progressiveEls=null;var n=this,a=n.group,i=n._lineData;n._lineData=t,i||a.removeAll();var o=H3(t);t.diff(i).add(function(s){r._doAdd(t,s,o)}).update(function(s,l){r._doUpdate(i,t,l,s,o)}).remove(function(s){a.remove(i.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=H3(t),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(t,r,n){this._progressiveEls=[];function a(l){!l.isGroup&&!rpe(l)&&(l.incremental=n,l.ensureState("emphasis").hoverLayer=vv)}for(var i=t.start;i0}function H3(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:Gr(t)}}function U3(e){return isNaN(e[0])||isNaN(e[1])}function e2(e){return e&&!U3(e[0])&&!U3(e[1])}var t2=[],r2=[],n2=[],Cd=an,a2=$l,W3=Math.abs;function $3(e,t,r){for(var n=e[0],a=e[1],i=e[2],o=1/0,s,l=r*r,u=.1,c=.1;c<=.9;c+=.1){t2[0]=Cd(n[0],a[0],i[0],c),t2[1]=Cd(n[1],a[1],i[1],c);var h=W3(a2(t2,t)-l);h=0?s=s+u:s=s-u:g>=0?s=s-u:s=s+u}return s}function i2(e,t){var r=[],n=Gg,a=[[],[],[]],i=[[],[]],o=[];t/=2,e.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),h=s.getVisual("toSymbol");u.__original||(u.__original=[No(u[0]),No(u[1])],u[2]&&u.__original.push(No(u[2])));var f=u.__original;if(u[2]!=null){if(vn(a[0],f[0]),vn(a[1],f[2]),vn(a[2],f[1]),c&&c!=="none"){var v=Wp(s.node1),g=$3(a,f[0],v*t);n(a[0][0],a[1][0],a[2][0],g,r),a[0][0]=r[3],a[1][0]=r[4],n(a[0][1],a[1][1],a[2][1],g,r),a[0][1]=r[3],a[1][1]=r[4]}if(h&&h!=="none"){var v=Wp(s.node2),g=$3(a,f[1],v*t);n(a[0][0],a[1][0],a[2][0],g,r),a[1][0]=r[1],a[2][0]=r[2],n(a[0][1],a[1][1],a[2][1],g,r),a[1][1]=r[1],a[2][1]=r[2]}vn(u[0],a[0]),vn(u[1],a[2]),vn(u[2],a[1])}else{if(vn(i[0],f[0]),vn(i[1],f[1]),Ll(o,i[1],i[0]),Lh(o,o),c&&c!=="none"){var v=Wp(s.node1);C_(i[0],i[0],o,v*t)}if(h&&h!=="none"){var v=Wp(s.node2);C_(i[1],i[1],o,-v*t)}vn(u[0],i[0]),vn(u[1],i[1])}})}var I9=Qe();function npe(e){if(e)return I9(e).bridge}function Z3(e,t){e&&(I9(e).bridge=t)}var ape=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=ta,r}return t.prototype.init=function(r,n){var a=new ty,i=new RI,o=this.group,s=new De;this._controller=new Hh(n.getZr()),s.add(a.group),s.add(i.group),o.add(s),this._symbolDraw=a,this._lineDraw=i,this._mainGroup=s,this._firstRender=!0},t.prototype.render=function(r,n,a){var i=this,o=wb(r),s=!1;this._model=r,this._api=a,this._active=!0;var l=this._mainGroup,u=this._getThumbnailInfo();u&&u.bridge.reset(a);var c=this._symbolDraw,h=this._lineDraw;o&&lu(l,$o,o,this._firstRender?null:r),i2(r.getGraph(),Up(r));var f=r.getData();c.updateData(f);var v=r.getEdgeData();h.updateData(v),this._updateNodeAndLinkScale(),o&&sw(r,a,this._controller,function(S,C,M){return r.coordinateSystem.containPoint([C,M])},null),clearTimeout(this._layoutTimeout);var g=r.forceLayout,m=r.get(["force","layoutAnimation"]);g&&(s=!0,this._startForceLayoutIteration(g,a,m));var y=r.get("layout");f.graph.eachNode(function(S){var C=S.dataIndex,M=S.getGraphicEl(),A=S.getModel();if(M){M.off("drag").off("dragend");var I=A.get("draggable");I&&M.on("drag",function(P){switch(y){case"force":g.warmUp(),!i._layouting&&i._startForceLayoutIteration(g,a,m),g.setFixed(C),f.setItemLayout(C,[M.x,M.y]);break;case"circular":f.setItemLayout(C,[M.x,M.y]),S.setLayout({fixed:!0},!0),jI(r,"symbolSize",S,[P.offsetX,P.offsetY]),i.updateLayout(r);break;case"none":default:f.setItemLayout(C,[M.x,M.y]),DI(r.getGraph(),r),i.updateLayout(r);break}}).on("dragend",function(){g&&g.setUnfixed(C)}),M.setDraggable(I,!!A.get("cursor"));var k=A.get(["emphasis","focus"]);k==="adjacency"&&(Be(M).focus=S.getAdjacentDataIndices())}}),f.graph.eachEdge(function(S){var C=S.getGraphicEl(),M=S.getModel().get(["emphasis","focus"]);C&&M==="adjacency"&&(Be(C).focus={edge:[S.dataIndex],node:[S.node1.dataIndex,S.node2.dataIndex]})});var x=r.get("layout")==="circular"&&r.get(["circular","rotateLabel"]),_=f.getLayout("cx"),w=f.getLayout("cy");f.graph.eachNode(function(S){N9(S,x,_,w)}),this._firstRender=!1,s||this._renderThumbnail(r,a,this._symbolDraw,this._lineDraw)},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose()},t.prototype._startForceLayoutIteration=function(r,n,a){var i=this,o=!1;(function s(){r.step(function(l){i.updateLayout(i._model),(l||!o)&&(o=!0,i._renderThumbnail(i._model,n,i._symbolDraw,i._lineDraw)),(i._layouting=!l)&&(a?i._layoutTimeout=setTimeout(s,16):s())})})()},t.prototype.__updateOnOwnRoam=function(r,n,a){var i=wb(n);!this._active||!i||(lu(this._mainGroup,$o,i,null),t9(r)&&(this._updateNodeAndLinkScale(),i2(n.getGraph(),Up(n)),this._lineDraw.updateLayout(),a.updateLabelLayout()),this._updateThumbnailWindow())},t.prototype._updateNodeAndLinkScale=function(){var r=this._model,n=r.getData(),a=Up(r);n.eachItemGraphicEl(function(i,o){i&&i.setSymbolScale(a)})},t.prototype.updateLayout=function(r){this._active&&(i2(r.getGraph(),Up(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 a=npe(r);if(a)return{bridge:a,coordSys:n}}},t.prototype._updateThumbnailWindow=function(){var r=this._getThumbnailInfo();r&&r.bridge.updateWindow(_b(null,r.coordSys),this._api)},t.prototype._renderThumbnail=function(r,n,a,i){var o=this._getThumbnailInfo();if(o){var s=new De,l=a.group.children(),u=i.group.children(),c=new De,h=new De;s.add(h),s.add(c);for(var f=0;f "),value:i.value,noValue:i.value==null})}return Er("nameValue",{name:i.name,value:i.value,noValue:i.value==null})},t.prototype.getDataParams=function(r,n){var a=e.prototype.getDataParams.call(this,r,n);if(n==="node"){var i=this.getData(),o=this.getGraph().getNodeByIndex(r);if(a.name==null&&(a.name=i.getName(r)),a.value==null){var s=o.getLayout().value;a.value=s}}return a},t.type="series."+Cm,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}(Ut),Y3=function(e){X(t,e);function t(r,n,a){var i=e.call(this)||this;Be(i).dataType="node",i.z2=2;var o=new wt;return i.setTextContent(o),i.updateData(r,n,a,!0),i}return t.prototype.updateData=function(r,n,a,i){var o=this,s=r.graph.getNodeByIndex(n),l=r.hostModel,u=s.getModel(),c=u.getModel("emphasis"),h=r.getItemLayout(n),f=te(Co(u.getModel("itemStyle"),h,!0),h),v=this;if(isNaN(f.startAngle)){v.setShape(f);return}i?v.setShape(f):At(v,{shape:f},l,n);var g=te(Co(u.getModel("itemStyle"),h,!0),h);o.setShape(g),o.useStyle(r.getItemVisual(n,"style")),Vr(o,u),this._updateLabel(l,u,s),r.setItemGraphicEl(n,v),Vr(v,u,"itemStyle");var m=c.get("focus");ir(this,m==="adjacency"?s.getAdjacentDataIndices():m,c.get("blurScope"),c.get("disabled"))},t.prototype._updateLabel=function(r,n,a){var i=this.getTextContent(),o=a.getLayout(),s=(o.startAngle+o.endAngle)/2,l=Math.cos(s),u=Math.sin(s),c=n.getModel("label");i.ignore=!c.get("show");var h=Gr(n),f=a.getVisual("style");Jr(i,h,{labelFetcher:{getFormattedLabel:function(_,w,S,C,M,A){return r.getFormattedLabel(_,w,"node",C,ya(M,h.normal&&h.normal.get("formatter"),n.get("name")),A)}},labelDataIndex:a.dataIndex,defaultText:a.dataIndex+"",inheritColor:f.fill,defaultOpacity:f.opacity,defaultOutsidePosition:"startArc"});var v=c.get("position")||"outside",g=c.get("distance")||0,m;v==="outside"?m=o.r+g:m=(o.r+o.r0)/2,this.textConfig={inside:v!=="outside"};var y=v!=="outside"?c.get("align")||"center":l>0?"left":"right",x=v!=="outside"?c.get("verticalAlign")||"middle":u>0?"top":"bottom";i.attr({x:l*m+o.cx,y:u*m+o.cy,rotation:0,style:{align:y,verticalAlign:x}})},t}(wn),hpe=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this)||this;return Be(o).dataType="edge",o.updateData(r,n,a,i,!0),o}return t.prototype.buildPath=function(r,n){r.moveTo(n.s1[0],n.s1[1]);var a=.7,i=n.clockwise;r.arc(n.cx,n.cy,n.r,n.sStartAngle,n.sEndAngle,!i),r.bezierCurveTo((n.cx-n.s2[0])*a+n.s2[0],(n.cy-n.s2[1])*a+n.s2[1],(n.cx-n.t1[0])*a+n.t1[0],(n.cy-n.t1[1])*a+n.t1[1],n.t1[0],n.t1[1]),r.arc(n.cx,n.cy,n.r,n.tStartAngle,n.tEndAngle,!i),r.bezierCurveTo((n.cx-n.t2[0])*a+n.t2[0],(n.cy-n.t2[1])*a+n.t2[1],(n.cx-n.s1[0])*a+n.s1[0],(n.cy-n.s1[1])*a+n.s1[1],n.s1[0],n.s1[1]),r.closePath()},t.prototype.updateData=function(r,n,a,i,o){var s=r.hostModel,l=n.graph.getEdgeByIndex(a),u=l.getLayout(),c=l.node1.getModel(),h=n.getItemModel(l.dataIndex),f=h.getModel("lineStyle"),v=h.getModel("emphasis"),g=v.get("focus"),m=te(Co(c.getModel("itemStyle"),u,!0),u),y=this;if(isNaN(m.sStartAngle)||isNaN(m.tStartAngle)){y.setShape(m);return}o?(y.setShape(m),X3(y,l,r,f)):(xi(y),X3(y,l,r,f),At(y,{shape:m},s,a)),ir(this,g==="adjacency"?l.getAdjacentDataIndices():g,v.get("blurScope"),v.get("disabled")),Vr(y,h,"lineStyle"),n.setItemGraphicEl(l.dataIndex,y)},t}(pt);function X3(e,t,r,n){var a=t.node1,i=t.node2,o=e.style;e.setStyle(n.getLineStyle());var s=n.get("color");switch(s){case"source":o.fill=r.getItemVisual(a.dataIndex,"style").fill,o.decal=a.getVisual("style").decal;break;case"target":o.fill=r.getItemVisual(i.dataIndex,"style").fill,o.decal=i.getVisual("style").decal;break;case"gradient":var l=r.getItemVisual(a.dataIndex,"style").fill,u=r.getItemVisual(i.dataIndex,"style").fill;if(ve(l)&&ve(u)){var c=e.shape,h=(c.s1[0]+c.s2[0])/2,f=(c.s1[1]+c.s2[1])/2,v=(c.t1[0]+c.t2[0])/2,g=(c.t1[1]+c.t2[1])/2;o.fill=new Eh(h,f,v,g,[{offset:0,color:l},{offset:1,color:u}],!0)}break}}var dpe=Math.PI/180,fpe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Cm,r}return t.prototype.init=function(r,n){},t.prototype.render=function(r,n,a){var i=r.getData(),o=this._data,s=this.group,l=-r.get("startAngle")*dpe;if(i.diff(o).add(function(c){var h=i.getItemLayout(c);if(h){var f=new Y3(i,c,l);Be(f).dataIndex=c,s.add(f)}}).update(function(c,h){var f=o.getItemGraphicEl(h),v=i.getItemLayout(c);if(!v){f&&Is(f,r,h);return}f?f.updateData(i,c,l):f=new Y3(i,c,l),s.add(f)}).remove(function(c){var h=o.getItemGraphicEl(c);h&&Is(h,r,c)}).execute(),!o){var u=r.get("center");this.group.scaleX=.01,this.group.scaleY=.01,this.group.originX=me(u[0],a.getWidth()),this.group.originY=me(u[1],a.getHeight()),Qt(this.group,{scaleX:1,scaleY:1},r)}this._data=i,this.renderEdges(r,l)},t.prototype.renderEdges=function(r,n){var a=r.getData(),i=r.getEdgeData(),o=this._edgeData,s=this.group;i.diff(o).add(function(l){var u=new hpe(a,i,l,n);Be(u).dataIndex=l,s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(a,i,l,n),s.add(c)}).remove(function(l){var u=o.getItemGraphicEl(l);u&&Is(u,r,l)}).execute(),this._edgeData=i},t.prototype.dispose=function(){},t.type=Cm,t}(Rt),o2=Math.PI/180,vpe=Hr(Cm,ppe);function ppe(e,t){e.eachSeriesByType(Cm,function(r){gpe(r,t)})}function gpe(e,t){var r=e.getData(),n=r.graph,a=e.getEdgeData(),i=a.count();if(i){var o=yH(e,t),s=o.cx,l=o.cy,u=o.r,c=o.r0,h=Math.max((e.get("padAngle")||0)*o2,0),f=Math.max((e.get("minAngle")||0)*o2,0),v=-e.get("startAngle")*o2,g=v+Math.PI*2,m=e.get("clockwise"),y=m?1:-1,x=[v,g];D1(x,!m);var _=x[0],w=x[1],S=w-_,C=r.getSum("value")===0&&a.getSum("value")===0,M=[],A=0;n.eachEdge(function(F){var W=C?1:F.getValue("value");C&&(W>0||f)&&(A+=2);var $=F.node1.dataIndex,Z=F.node2.dataIndex;M[$]=(M[$]||0)+W,M[Z]=(M[Z]||0)+W});var I=0;if(n.eachNode(function(F){var W=F.getValue("value");isNaN(W)||(M[F.dataIndex]=Math.max(W,M[F.dataIndex]||0)),!C&&(M[F.dataIndex]>0||f)&&A++,I+=M[F.dataIndex]||0}),!(A===0||I===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 k=(S-h*A*y)/I,P=0,D=0,z=0;n.eachNode(function(F){var W=M[F.dataIndex]||0,$=k*(I?W:1)*y;Math.abs($)D){var B=P/D;n.eachNode(function(F){var W=F.getLayout().angle;Math.abs(W)>=f?F.setLayout({angle:W*B,ratio:B},!0):F.setLayout({angle:f,ratio:f===0?1:W/f},!0)})}else n.eachNode(function(F){if(!j){var W=F.getLayout().angle,$=Math.min(W/z,1),Z=$*P;W-Zf&&f>0){var $=j?1:Math.min(W/z,1),Z=W-f,J=Math.min(Z,Math.min(H,P*$));H-=J,F.setLayout({angle:W-J,ratio:(W-J)/W},!0)}else f>0&&F.setLayout({angle:f,ratio:W===0?1:f/W},!0)}});var V=_,U=[];n.eachNode(function(F){var W=Math.max(F.getLayout().angle,f);F.setLayout({cx:s,cy:l,r0:c,r:u,startAngle:V,endAngle:V+W*y,clockwise:m},!0),U[F.dataIndex]=V,V+=(W+h)*y}),n.eachEdge(function(F){var W=C?1:F.getValue("value"),$=k*(I?W:1)*y,Z=F.node1.dataIndex,J=U[Z]||0,re=Math.abs((F.node1.getLayout().ratio||1)*$),Q=J+re*y,le=[s+c*Math.cos(J),l+c*Math.sin(J)],de=[s+c*Math.cos(Q),l+c*Math.sin(Q)],He=F.node2.dataIndex,ye=U[He]||0,ne=Math.abs((F.node2.getLayout().ratio||1)*$),xe=ye+ne*y,he=[s+c*Math.cos(ye),l+c*Math.sin(ye)],ge=[s+c*Math.cos(xe),l+c*Math.sin(xe)];F.setLayout({s1:le,s2:de,sStartAngle:J,sEndAngle:Q,t1:he,t2:ge,tStartAngle:ye,tEndAngle:xe,cx:s,cy:l,r:c,value:W,clockwise:m}),U[Z]=Q,U[He]=xe})}}}function mpe(e){e.registerChartView(fpe),e.registerSeriesModel(cpe),e.registerLayout(e.PRIORITY.VISUAL.POST_CHART_LAYOUT,vpe),e.registerProcessor(ay("chord"))}var ype=function(){function e(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return e}(),xpe=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="pointer",n}return t.prototype.getDefaultShape=function(){return new ype},t.prototype.buildPath=function(r,n){var a=Math.cos,i=Math.sin,o=n.r,s=n.width,l=n.angle,u=n.x-a(l)*s*(s>=o/3?1:2),c=n.y-i(l)*s*(s>=o/3?1:2);l=n.angle-Math.PI/2,r.moveTo(u,c),r.lineTo(n.x+a(l)*s,n.y+i(l)*s),r.lineTo(n.x+a(n.angle)*o,n.y+i(n.angle)*o),r.lineTo(n.x-a(l)*s,n.y-i(l)*s),r.lineTo(u,c)},t}(pt);function _pe(e,t){var r=e.get("center"),n=t.getWidth(),a=t.getHeight(),i=Math.min(n,a),o=me(r[0],t.getWidth()),s=me(r[1],t.getHeight()),l=me(e.get("radius"),i/2);return{cx:o,cy:s,r:l}}function H0(e,t){var r=e==null?"":e+"";return t&&(ve(t)?r=t.replace("{value}",r):Le(t)&&(r=t(e))),r}var bpe=function(e){X(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,a){this.group.removeAll();var i=r.get(["axisLine","lineStyle","color"]),o=_pe(r,a);this._renderMain(r,n,a,i,o),this._data=r.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(r,n,a,i,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"),v=f?mb:wn,g=h.get("show"),m=h.getModel("lineStyle"),y=m.get("width"),x=[u,c];D1(x,!l),u=x[0],c=x[1];for(var _=c-u,w=u,S=[],C=0;g&&C=k&&(P===0?0:i[P-1][0])Math.PI/2&&(Q+=Math.PI)):re==="tangential"?Q=-I-Math.PI/2:Tt(re)&&(Q=re*Math.PI/180),Q===0?h.add(new wt({style:$t(w,{text:W,x:Z,y:J,verticalAlign:H<-.8?"top":H>.8?"bottom":"middle",align:B<-.4?"left":B>.4?"right":"center"},{inheritColor:$}),silent:!0})):h.add(new wt({style:$t(w,{text:W,x:Z,y:J,verticalAlign:"middle",align:"center"},{inheritColor:$}),silent:!0,originX:Z,originY:J,rotation:Q}))}if(_.get("show")&&V!==S){var U=_.get("distance");U=U?U+c:c;for(var le=0;le<=C;le++){B=Math.cos(I),H=Math.sin(I);var de=new Tr({shape:{x1:B*(g-U)+f,y1:H*(g-U)+v,x2:B*(g-A-U)+f,y2:H*(g-A-U)+v},silent:!0,style:z});z.stroke==="auto"&&de.setStyle({stroke:i((V+le/C)/S)}),h.add(de),I+=P}I-=P}else I+=k}},t.prototype._renderPointer=function(r,n,a,i,o,s,l,u,c){var h=this.group,f=this._data,v=this._progressEls,g=[],m=r.get(["pointer","show"]),y=r.getModel("progress"),x=y.get("show"),_=r.getData(),w=_.mapDimension("value"),S=+r.get("min"),C=+r.get("max"),M=[S,C],A=[s,l];function I(P,D){var z=_.getItemModel(P),j=z.getModel("pointer"),B=me(j.get("width"),o.r),H=me(j.get("length"),o.r),V=r.get(["pointer","icon"]),U=j.get("offsetCenter"),F=me(U[0],o.r),W=me(U[1],o.r),$=j.get("keepAspect"),Z;return V?Z=Ar(V,F-B/2,W-H,B,H,null,$):Z=new xpe({shape:{angle:-Math.PI/2,width:B,r:H,x:F,y:W}}),Z.rotation=-(D+Math.PI/2),Z.x=o.cx,Z.y=o.cy,Z}function k(P,D){var z=y.get("roundCap"),j=z?mb:wn,B=y.get("overlap"),H=B?y.get("width"):c/_.count(),V=B?o.r-H:o.r-(P+1)*H,U=B?o.r:o.r-P*H,F=new j({shape:{startAngle:s,endAngle:D,cx:o.cx,cy:o.cy,clockwise:u,r0:V,r:U}});return B&&(F.z2=Nt(_.get(w,P),[S,C],[100,0],!0)),F}(x||m)&&(_.diff(f).add(function(P){var D=_.get(w,P);if(m){var z=I(P,s);Qt(z,{rotation:-((isNaN(+D)?A[0]:Nt(D,M,A,!0))+Math.PI/2)},r),h.add(z),_.setItemGraphicEl(P,z)}if(x){var j=k(P,s),B=y.get("clip");Qt(j,{shape:{endAngle:Nt(D,M,A,B)}},r),h.add(j),DM(r.seriesIndex,_.dataType,P,j),g[P]=j}}).update(function(P,D){var z=_.get(w,P);if(m){var j=f.getItemGraphicEl(D),B=j?j.rotation:s,H=I(P,B);H.rotation=B,At(H,{rotation:-((isNaN(+z)?A[0]:Nt(z,M,A,!0))+Math.PI/2)},r),h.add(H),_.setItemGraphicEl(P,H)}if(x){var V=v[D],U=V?V.shape.endAngle:s,F=k(P,U),W=y.get("clip");At(F,{shape:{endAngle:Nt(z,M,A,W)}},r),h.add(F),DM(r.seriesIndex,_.dataType,P,F),g[P]=F}}).execute(),_.each(function(P){var D=_.getItemModel(P),z=D.getModel("emphasis"),j=z.get("focus"),B=z.get("blurScope"),H=z.get("disabled"),V=i(Nt(_.get(w,P),M,[0,1],!0));if(m){var U=_.getItemGraphicEl(P),F=_.getItemVisual(P,"style"),W=F.fill;if(U instanceof Qr){var $=U.style;U.useStyle(te({image:$.image,x:$.x,y:$.y,width:$.width,height:$.height},F))}else U.useStyle(F),U.type!=="pointer"&&U.setColor(W);U.setStyle(D.getModel(["pointer","itemStyle"]).getItemStyle()),U.style.fill==="auto"&&U.setStyle("fill",V),U.z2EmphasisLift=0,Vr(U,D),ir(U,j,B,H)}if(x){var Z=g[P];Z.useStyle(_.getItemVisual(P,"style")),Z.setStyle(D.getModel(["progress","itemStyle"]).getItemStyle()),Z.style.fill==="auto"&&Z.setStyle("fill",V),Z.z2EmphasisLift=0,Vr(Z,D),ir(Z,j,B,H)}}),this._progressEls=g)},t.prototype._renderAnchor=function(r,n){var a=r.getModel("anchor"),i=a.get("show");if(i){var o=a.get("size"),s=a.get("icon"),l=a.get("offsetCenter"),u=a.get("keepAspect"),c=Ar(s,n.cx-o/2+me(l[0],n.r),n.cy-o/2+me(l[1],n.r),o,o,null,u);c.z2=a.get("showAbove")?1:0,c.setStyle(a.getModel("itemStyle").getItemStyle()),this.group.add(c)}},t.prototype._renderTitleAndDetail=function(r,n,a,i,o){var s=this,l=r.getData(),u=l.mapDimension("value"),c=+r.get("min"),h=+r.get("max"),f=new De,v=[],g=[],m=r.isAnimationEnabled(),y=r.get(["pointer","showAbove"]);l.diff(this._data).add(function(x){v[x]=new wt({silent:!0}),g[x]=new wt({silent:!0})}).update(function(x,_){v[x]=s._titleEls[_],g[x]=s._detailEls[_]}).execute(),l.each(function(x){var _=l.getItemModel(x),w=l.get(u,x),S=new De,C=i(Nt(w,[c,h],[0,1],!0)),M=_.getModel("title");if(M.get("show")){var A=M.get("offsetCenter"),I=o.cx+me(A[0],o.r),k=o.cy+me(A[1],o.r),P=v[x];P.attr({z2:y?0:2,style:$t(M,{x:I,y:k,text:l.getName(x),align:"center",verticalAlign:"middle"},{inheritColor:C})}),S.add(P)}var D=_.getModel("detail");if(D.get("show")){var z=D.get("offsetCenter"),j=o.cx+me(z[0],o.r),B=o.cy+me(z[1],o.r),H=me(D.get("width"),o.r),V=me(D.get("height"),o.r),U=r.get(["progress","show"])?l.getItemVisual(x,"style").fill:C,P=g[x],F=D.get("formatter");P.attr({z2:y?0:2,style:$t(D,{x:j,y:B,text:H0(w,F),width:isNaN(H)?null:H,height:isNaN(V)?null:V,align:"center",verticalAlign:"middle"},{inheritColor:U})}),X7(P,{normal:D},w,function($){return H0($,F)}),m&&q7(P,x,l,r,{getFormattedLabel:function($,Z,J,re,Q,le){return H0(le?le.interpolatedValue:w,F)}}),S.add(P)}f.add(S)}),this.group.add(f),this._titleEls=v,this._detailEls=g},t.type="gauge",t}(Rt),wpe=function(e){X(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 Av(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}(Ut);function Spe(e){e.registerChartView(bpe),e.registerSeriesModel(wpe)}var Wf="funnel",Cpe=function(e){X(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 Nv(be(this.getData,this),be(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.getInitialData=function(r,n){return Av(this,{coordDimensions:["value"],encodeDefaulter:nt(CL,this)})},t.prototype._defaultLabelLine=function(r){rh(r,"labelLine",["show"]);var n=r.labelLine,a=r.emphasis.labelLine;n.show=n.show&&r.label.show,a.show=a.show&&r.emphasis.label.show},t.prototype.getDataParams=function(r){var n=this.getData(),a=e.prototype.getDataParams.call(this,r),i=n.mapDimension("value"),o=n.getSum(i);return a.percent=o?+(n.get(i,r)/o*100).toFixed(2):0,a.$vars.push("percent"),a},t.type="series."+Wf,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}(Ut),Tpe=["itemStyle","opacity"],Mpe=function(e){X(t,e);function t(r,n){var a=e.call(this)||this,i=a,o=new un,s=new wt;return i.setTextContent(s),a.setTextGuideLine(o),a.updateData(r,n,!0),a}return t.prototype.updateData=function(r,n,a){var i=this,o=r.hostModel,s=r.getItemModel(n),l=r.getItemLayout(n),u=s.getModel("emphasis"),c=s.get(Tpe);c=c??1,a||xi(i),i.useStyle(r.getItemVisual(n,"style")),i.style.lineJoin="round",a?(i.setShape({points:l.points}),i.style.opacity=0,Qt(i,{style:{opacity:c}},o,n)):At(i,{style:{opacity:c},shape:{points:l.points}},o,n),Vr(i,s),this._updateLabel(r,n),ir(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r,n){var a=this,i=this.getTextGuideLine(),o=a.getTextContent(),s=r.hostModel,l=r.getItemModel(n),u=r.getItemLayout(n),c=u.label,h=r.getItemVisual(n,"style"),f=h.fill;Jr(o,Gr(l),{labelFetcher:r.hostModel,labelDataIndex:n,defaultOpacity:h.opacity,defaultText:r.getName(n)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}});var v=l.getModel("label"),g=v.get("color"),m=g==="inherit"?f:null;a.setTextConfig({local:!0,inside:!!c.inside,insideStroke:m,outsideFill:m});var y=c.linePoints;i.setShape({points:y}),a.textGuideLineConfig={anchor:y?new Oe(y[0][0],y[0][1]):null},At(o,{style:{x:c.x,y:c.y}},s,n),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),rI(a,nI(l),{stroke:f})},t}(Sn),Ape=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Wf,r.ignoreLabelLineUpdate=!0,r}return t.prototype.render=function(r,n,a){var i=r.getData(),o=this._data,s=this.group;i.diff(o).add(function(l){var u=new Mpe(i,l);i.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(i,l),s.add(c),i.setItemGraphicEl(l,c)}).remove(function(l){var u=o.getItemGraphicEl(l);Is(u,r,l)}).execute(),this._data=i},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type=Wf,t}(Rt);function Npe(e,t){for(var r=e.mapDimension("value"),n=e.mapArray(r,function(l){return l}),a=[],i=t==="ascending",o=0,s=e.count();o-1&&(o="left"),r&&Ye(["left","right"],o)>-1&&(o="bottom")),o==="left"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,x=m-w,f=x-5,h="right"):o==="right"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,x=m+w,f=x+5,h="left"):o==="top"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,_=y-w,v=_-5,h="center"):o==="bottom"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,_=y+w,v=_+5,h="center"):o==="rightTop"?(m=r?u[3][0]:u[1][0],y=r?u[3][1]:u[1][1],r?(_=y-w,v=_-5,h="center"):(x=m+w,f=x+5,h="top")):o==="rightBottom"?(m=u[2][0],y=u[2][1],r?(_=y+w,v=_+5,h="center"):(x=m+w,f=x+5,h="bottom")):o==="leftTop"?(m=u[0][0],y=r?u[0][1]:u[1][1],r?(_=y-w,v=_-5,h="center"):(x=m-w,f=x-5,h="right")):o==="leftBottom"?(m=r?u[1][0]:u[3][0],y=r?u[1][1]:u[2][1],r?(_=y+w,v=_+5,h="center"):(x=m-w,f=x-5,h="right")):(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,r?(_=y+w,v=_+5,h="center"):(x=m+w,f=x+5,h="left")),r?(x=m,f=x):(_=y,v=_),g=[[m,y],[x,_]]}l.label={linePoints:g,x:f,y:v,verticalAlign:"middle",textAlign:h,inside:c}})}var Lpe=Hr(Wf,Ipe);function Ipe(e,t){e.eachSeriesByType(Wf,function(r){var n=r.getData(),a=n.mapDimension("value"),i=r.get("sort"),o=Ur(r,t),s=tr(r.getBoxLayoutParams(),o.refContainer),l=P9(r),u=s.width,c=s.height,h=Npe(n,i),f=s.x,v=s.y,g=l?[me(r.get("minSize"),c),me(r.get("maxSize"),c)]:[me(r.get("minSize"),u),me(r.get("maxSize"),u)],m=n.getDataExtent(a),y=r.get("min"),x=r.get("max");y==null&&(y=Math.min(m[0],0)),x==null&&(x=m[1]);var _=r.get("funnelAlign"),w=r.get("gap"),S=l?u:c,C=(S-w*(n.count()-1))/n.count(),M=function(H,V){if(l){var U=n.get(a,H)||0,F=Nt(U,[y,x],g,!0),W=void 0;switch(_){case"top":W=v;break;case"center":W=v+(c-F)/2;break;case"bottom":W=v+(c-F);break}return[[V,W],[V,W+F]]}var $=n.get(a,H)||0,Z=Nt($,[y,x],g,!0),J;switch(_){case"left":J=f;break;case"center":J=f+(u-Z)/2;break;case"right":J=f+u-Z;break}return[[J,V],[J+Z,V]]};i==="ascending"&&(C=-C,w=-w,l?f+=u:v+=c,h=h.reverse());for(var A=0;AWpe)return;var a=this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]);a.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:a.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(e){if(!(this._mouseDownPoint||!l2(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 l2(e,t){var r=e._model;return r.get("axisExpandable")&&r.get("axisExpandTriggerOn")===t}var Ab="parallel",BA=Ab,Ype=function(e){X(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&&Je(n,r,!0),this._initDimensions()},t.prototype.contains=function(r,n){var a=r.get("parallelIndex");return a!=null&&n.getComponent("parallel",a)===this},t.prototype.setAxisExpand=function(r){R(["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=[],a=It(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(i){return(i.get("parallelIndex")||0)===this.componentIndex},this);R(a,function(i){r.push("dim"+i.get("dim")),n.push(i.componentIndex)})},t.type=BA,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}(ht),Xpe=function(e){X(t,e);function t(r,n,a,i,o){var s=e.call(this,r,n,a)||this;return s.type=i||"value",s.axisIndex=o,s}return t.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},t}(Si);function uu(e,t,r,n,a,i){e=e||0;var o=pc(r[1],-r[0]);if(a!=null&&(a=Td(a,[0,o])),i!=null&&(i=Math.max(i,a??0)),n==="all"){var s=Math.abs(pc(t[1],-t[0]));s=Td(s,[0,o]),a=i=Td(s,[a,i]),n=0}t[0]=Td(t[0],r),t[1]=Td(t[1],r);var l=u2(t,n);t[n]+=e;var u=a||0,c=r.slice();l.sign<0?c[0]=pc(c[0],u):c[1]=pc(c[1],-u),t[n]=Td(t[n],c);var h;return h=u2(t,n),a!=null&&(h.sign!==l.sign||h.spani&&(t[1-n]=pc(t[n],h.sign*i)),t}function u2(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 Td(e,t){return Math.min(t[1]!=null?t[1]:1/0,Math.max(t[0]!=null?t[0]:-1/0,e))}var qpe=function(){function e(t,r,n){this.type=Ab,this._axesMap=we(),this._axesLayout={},this.dimensions=t.dimensions,this._model=t,this._init(t,r,n)}return e.prototype._init=function(t,r,n){var a=t.dimensions,i=t.parallelAxisIndex;R(a,function(o,s){var l=i[s],u=r.getComponent("parallelAxis",l),c=Km(u),h=this._axesMap.set(o,new Xpe(o,Sv(u,c,!1),[0,0],c,l));h.onBand=Qm(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){R(this.dimensions,function(n){var a=this._axesMap.get(n);fh(a,Vf),Gf(a)},this)},e.prototype.containPoint=function(t){var r=this._makeLayoutInfo(),n=r.axisBase,a=r.layoutBase,i=r.pixelDimIndex,o=t[1-i],s=t[i];return o>=n&&o<=n+r.axisLength&&s>=a&&s<=a+r.layoutLength},e.prototype.getModel=function(){return this._model},e.prototype.resize=function(t,r){var n=Ur(t,r).refContainer;this._rect=tr(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"],a=["width","height"],i=t.get("layout"),o=i==="horizontal"?0:1,s=r[a[o]],l=[0,s],u=this.dimensions.length,c=U0(t.get("axisExpandWidth"),l),h=U0(t.get("axisExpandCount")||0,[0,u]),f=t.get("axisExpandable")&&u>3&&u>h&&h>1&&c>0&&s>0,v=t.get("axisExpandWindow"),g;if(v)g=U0(v[1]-v[0],l),v[1]=v[0]+g;else{g=U0(c*(h-1),l);var m=t.get("axisExpandCenter")||gi(u/2);v=[c*m-g/2],v[1]=v[0]+g}var y=(s-g)/(u-h);y<3&&(y=0);var x=[gi(Mt(v[0]/c,1))+1,Ph(Mt(v[1]/c,1))-1],_=y/c*v[0];return{layout:i,pixelDimIndex:o,layoutBase:r[n[o]],layoutLength:s,axisBase:r[n[1-o]],axisLength:r[a[1-o]],axisExpandable:f,axisExpandWidth:c,axisCollapseWidth:y,axisExpandWindow:v,axisCount:u,winInnerIndices:x,axisExpandWindow0Pos:_}},e.prototype._layoutAxes=function(){var t=this._rect,r=this._axesMap,n=this.dimensions,a=this._makeLayoutInfo(),i=a.layout;r.each(function(o){var s=[0,a.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),R(n,function(o,s){var l=(a.axisExpandable?Jpe:Kpe)(s,a),u={horizontal:{x:l.position,y:a.axisLength},vertical:{x:0,y:l.position}},c={horizontal:R_/2,vertical:0},h=[u[i].x+t.x,u[i].y+t.y],f=c[i],v=ar();Js(v,v,f),Hi(v,v,h),this._axesLayout[o]={position:h,rotation:f,transform:v,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,a){n==null&&(n=0),a==null&&(a=t.count());var i=this._axesMap,o=this.dimensions,s=[],l=[];R(o,function(y){s.push(t.mapDimension(y)),l.push(i.get(y).model)});for(var u=this.hasAxisBrushed(),c=n;ci*(1-h[0])?(u="jump",l=s-i*(1-h[2])):(l=s-i*h[1])>=0&&(l=s-i*(1-h[1]))<=0&&(l=0),l*=r.axisExpandWidth/c,l?uu(l,a,o,"all"):u="none";else{var v=a[1]-a[0],g=o[1]*s/v;a=[at(0,g-v/2)],a[1]=Et(o[1],a[0]+v),a[0]=a[1]-v}return{axisExpandWindow:a,behavior:u}},e}();function U0(e,t){return Et(at(e,t[0]),t[1])}function Kpe(e,t){var r=t.layoutLength/(t.axisCount-1);return{position:r*e,axisNameAvailableWidth:r,axisLabelShow:!0}}function Jpe(e,t){var r=t.layoutLength,n=t.axisExpandWidth,a=t.axisCount,i=t.axisCollapseWidth,o=t.winInnerIndices,s,l=i,u=!1,c;return e=0;a--)on(n[a])},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 a=n[0];if(a[0]<=r&&r<=a[1])return"active"}else for(var i=0,o=n.length;inge}function B9(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function F9(e,t,r,n){var a=new De;return a.add(new it({name:"main",style:VI(r),silent:!0,draggable:!0,cursor:"move",drift:nt(e4,e,t,a,["n","s","w","e"]),ondragend:nt(wh,t,{isEnd:!0})})),R(n,function(i){a.add(new it({name:i.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:nt(e4,e,t,a,i),ondragend:nt(wh,t,{isEnd:!0})}))}),a}function V9(e,t,r,n){var a=n.brushStyle.lineWidth||0,i=$f(a,age),o=r[0][0],s=r[1][0],l=o-a/2,u=s-a/2,c=r[0][1],h=r[1][1],f=c-i+a/2,v=h-i+a/2,g=c-o,m=h-s,y=g+a,x=m+a;ps(e,t,"main",o,s,g,m),n.transformable&&(ps(e,t,"w",l,u,i,x),ps(e,t,"e",f,u,i,x),ps(e,t,"n",l,u,y,i),ps(e,t,"s",l,v,y,i),ps(e,t,"nw",l,u,i,i),ps(e,t,"ne",f,u,i,i),ps(e,t,"sw",l,v,i,i),ps(e,t,"se",f,v,i,i))}function GA(e,t){var r=t.__brushOption,n=r.transformable,a=t.childAt(0);a.useStyle(VI(r)),a.attr({silent:!n,cursor:n?"move":"default"}),R([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(i){var o=t.childOfName(i.join("")),s=i.length===1?HA(e,i[0]):cge(e,i);o&&o.attr({silent:!n,invisible:!n,cursor:n?oge[s]+"-resize":null})})}function ps(e,t,r,n,a,i,o){var s=t.childOfName(r);s&&s.setShape(dge(GI(e,t,[[n,a],[n+i,a+o]])))}function VI(e){return Ee({strokeNoScale:!0},e.brushStyle)}function G9(e,t,r,n){var a=[Tm(e,r),Tm(t,n)],i=[$f(e,r),$f(t,n)];return[[a[0],i[0]],[a[1],i[1]]]}function uge(e){return Vc(e.group)}function HA(e,t){var r={w:"left",e:"right",n:"top",s:"bottom"},n={left:"w",right:"e",top:"n",bottom:"s"},a=O1(r[t],uge(e));return n[a]}function cge(e,t){var r=[HA(e,t[0]),HA(e,t[1])];return(r[0]==="e"||r[0]==="w")&&r.reverse(),r.join("")}function e4(e,t,r,n,a,i){var o=r.__brushOption,s=e.toRectRange(o.range),l=H9(t,a,i);R(n,function(u){var c=ige[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=e.fromRectRange(G9(s[0][0],s[1][0],s[0][1],s[1][1])),zI(t,r),wh(t,{isEnd:!1})}function hge(e,t,r,n){var a=t.__brushOption.range,i=H9(e,r,n);R(a,function(o){o[0]+=i[0],o[1]+=i[1]}),zI(e,t),wh(e,{isEnd:!1})}function H9(e,t,r){var n=e.group,a=n.transformCoordToLocal(t,r),i=n.transformCoordToLocal(0,0);return[a[0]-i[0],a[1]-i[1]]}function GI(e,t,r){var n=z9(e,t);return n&&n!==bh?n.clipPath(r,e._transform):ke(r)}function dge(e){var t=Tm(e[0][0],e[1][0]),r=Tm(e[0][1],e[1][1]),n=$f(e[0][0],e[1][0]),a=$f(e[0][1],e[1][1]);return{x:t,y:r,width:n-t,height:a-r}}function fge(e,t,r){if(!(!e._brushType||pge(e,t.offsetX,t.offsetY))){var n=e._zr,a=e._covers,i=FI(e,t,r);if(!e._dragging)for(var o=0;on.getWidth()||r<0||r>n.getHeight()}var cw={lineX:n4(0),lineY:n4(1),rect:{createCover:function(e,t){function r(n){return n}return F9({toRectRange:r,fromRectRange:r},e,t,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(e){var t=B9(e);return G9(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,r,n){V9(e,t,r,n)},updateCommon:GA,contain:WA},polygon:{createCover:function(e,t){var r=new De;return r.add(new un({name:"main",style:VI(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:nt(hge,e,t),ondragend:nt(wh,e,{isEnd:!0})}))},updateCoverShape:function(e,t,r,n){t.childAt(0).setShape({points:GI(e,t,r)})},updateCommon:GA,contain:WA}};function n4(e){return{createCover:function(t,r){return F9({toRectRange:function(n){var a=[n,[0,100]];return e&&a.reverse(),a},fromRectRange:function(n){return n[e]}},t,r,[[["w"],["e"]],[["n"],["s"]]][e])},getCreatingRange:function(t){var r=B9(t),n=Tm(r[0][e],r[1][e]),a=$f(r[0][e],r[1][e]);return[n,a]},updateCoverShape:function(t,r,n,a){var i,o=z9(t,r);if(o!==bh&&o.getLinearBrushOtherExtent)i=o.getLinearBrushOtherExtent(e);else{var s=t._zr;i=[0,[s.getWidth(),s.getHeight()][1-e]]}var l=[n,i];e&&l.reverse(),V9(t,r,l,a)},updateCommon:GA,contain:WA}}function W9(e){return e=HI(e),function(t){return aL(t,e)}}function $9(e,t){return e=HI(e),function(r){var n=t??r,a=n?e.width:e.height,i=n?e.x:e.y;return[i,i+(a||0)]}}function Z9(e,t,r){var n=HI(e);return function(a,i){return n.contain(i[0],i[1])&&!F8(a,t,r)}}function HI(e){return je.create(e)}var gge=function(e){X(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 OI(n.getZr())).on("brush",be(this._onBrush,this))},t.prototype.render=function(r,n,a,i){if(!mge(r,n,i)){this.axisModel=r,this.api=a,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new De,this.group.add(this._axisGroup),!!r.get("show")){var s=xge(r,n),l=s.coordinateSystem,u=r.getAreaSelectStyle(),c=u.width,h=r.axis.dim,f=l.getAxisLayout(h),v=te({strokeContainThreshold:c},f),g=new Jn(r,a,v);g.build(),this._axisGroup.add(g.group),this._refreshBrushController(v,u,r,s,c,a),$m(o,this._axisGroup,r)}}},t.prototype._refreshBrushController=function(r,n,a,i,o,s){var l=a.axis.getExtent(),u=l[1]-l[0],c=Math.min(30,Math.abs(u)*.1),h=je.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:W9(h),isTargetByCursor:Z9(h,s,i),getLinearBrushOtherExtent:$9(h,0)}]).enableBrush({brushType:"lineX",brushStyle:n,removeOnClick:!0}).updateCovers(yge(a))},t.prototype._onBrush=function(r){var n=r.areas,a=this.axisModel,i=a.axis,o=oe(n,function(s){return[i.coordToData(s.range[0],!0),i.coordToData(s.range[1],!0)]});(!a.option.realtime===r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:a.id,intervals:o})},t.prototype.dispose=function(){this._brushController.dispose()},t.type="parallelAxis",t}(Yt);function mge(e,t,r){return r&&r.type==="axisAreaSelect"&&t.findComponents({mainType:"parallelAxis",query:r})[0]===e}function yge(e){var t=e.axis;return oe(e.activeIntervals,function(r){return{brushType:"lineX",panelId:"pl",range:[t.dataToCoord(r[0],!0),t.dataToCoord(r[1],!0)]}})}function xge(e,t){return t.getComponent("parallel",e.get("parallelIndex"))}var _ge={type:"axisAreaSelect",event:"axisAreaSelected"};function bge(e){e.registerAction(_ge,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 wge={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function Y9(e){e.registerComponentView($pe),e.registerComponentModel(Ype),e.registerCoordinateSystem("parallel",ege),e.registerPreprocessor(Gpe),e.registerComponentModel(FA),e.registerComponentView(gge),Uf(e,"parallel",FA,wge),bge(e)}function Sge(e){rt(Y9),e.registerChartView(jpe),e.registerSeriesModel(Ope),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,Vpe)}var Xs="sankey",Cge=function(e){X(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 a=r.edges||r.links||[],i=r.data||r.nodes||[],o=r.levels||[];this.levelModels=[];for(var s=this.levelModels,l=0;l=0&&(s[o[l].depth]=new vt(o[l],this,n));var u=II(i,a,this,!0,c);return u.data;function c(h,f){h.wrapMethod("getItemModel",function(v,g){var m=v.parentModel,y=m.getData().getItemLayout(g);if(y){var x=y.depth,_=m.levelModels[x];_&&(v.parentModel=_)}return v}),f.wrapMethod("getItemModel",function(v,g){var m=v.parentModel,y=m.getGraph().getEdgeByIndex(g),x=y.node1.getLayout();if(x){var _=x.depth,w=m.levelModels[_];w&&(v.parentModel=w)}return v})}},t.prototype.setNodePosition=function(r,n){var a=this.option.data||this.option.nodes,i=a[r];i.localX=n[0],i.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,a){function i(v){return isNaN(v)||v==null}if(a==="edge"){var o=this.getDataParams(r,a),s=o.data,l=o.value,u=s.source+" -- "+s.target;return Er("nameValue",{name:u,value:l,noValue:i(l)})}else{var c=this.getGraph().getNodeByIndex(r),h=c.getLayout().value,f=this.getDataParams(r,a).data.name;return Er("nameValue",{name:f!=null?f+"":null,value:h,noValue:i(h)})}},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(r,n){var a=e.prototype.getDataParams.call(this,r,n);if(a.value==null&&n==="node"){var i=this.getGraph().getNodeByIndex(r),o=i.getLayout().value;a.value=o}return a},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+Xs,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}(Ut),Tge=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}(),Mge=function(e){X(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new Tge},t.prototype.buildPath=function(r,n){var a=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+a,n.y2),r.bezierCurveTo(n.cpx2+a,n.cpy2,n.cpx1+a,n.cpy1,n.x1+a,n.y1)):(r.lineTo(n.x2,n.y2+a),r.bezierCurveTo(n.cpx2,n.cpy2+a,n.cpx1,n.cpy1+a,n.x1,n.y1+a)),r.closePath()},t.prototype.highlight=function(){Us(this)},t.prototype.downplay=function(){Ws(this)},t}(pt),Age=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Xs,r._mainGroup=new De,r}return t.prototype.init=function(r,n){this._controller=new Hh(n.getZr()),this.group.add(this._mainGroup),this._firstRender=!0},t.prototype.render=function(r,n,a){var i=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,a),sw(r,a,this._controller,Q8(o),null),i.eachEdge(function(v){var g=new Mge,m=Be(g);m.dataIndex=v.dataIndex,m.seriesIndex=r.seriesIndex,m.dataType="edge";var y=v.getModel(),x=y.getModel("lineStyle"),_=x.get("curveness"),w=v.node1.getLayout(),S=v.node1.getModel(),C=S.get("localX"),M=S.get("localY"),A=v.node2.getLayout(),I=v.node2.getModel(),k=I.get("localX"),P=I.get("localY"),D=v.getLayout(),z,j,B,H,V,U,F,W;g.shape.extent=Math.max(1,D.dy),g.shape.orient=f,f==="vertical"?(z=(C!=null?C*l:w.x)+D.sy,j=(M!=null?M*u:w.y)+w.dy,B=(k!=null?k*l:A.x)+D.ty,H=P!=null?P*u:A.y,V=z,U=j*(1-_)+H*_,F=B,W=j*_+H*(1-_)):(z=(C!=null?C*l:w.x)+w.dx,j=(M!=null?M*u:w.y)+D.sy,B=k!=null?k*l:A.x,H=(P!=null?P*u:A.y)+D.ty,V=z*(1-_)+B*_,U=j,F=z*_+B*(1-_),W=H),g.setShape({x1:z,y1:j,x2:B,y2:H,cpx1:V,cpy1:U,cpx2:F,cpy2:W}),g.useStyle(x.getItemStyle()),a4(g.style,f,v);var $=""+y.get("value"),Z=Gr(y,"edgeLabel");Jr(g,Z,{labelFetcher:{getFormattedLabel:function(Q,le,de,He,ye,ne){return r.getFormattedLabel(Q,le,"edge",He,ya(ye,Z.normal&&Z.normal.get("formatter"),$),ne)}},labelDataIndex:v.dataIndex,defaultText:$}),g.setTextConfig({position:"inside"});var J=y.getModel("emphasis");Vr(g,y,"lineStyle",function(Q){var le=Q.getItemStyle();return a4(le,f,v),le}),o.add(g),h.setItemGraphicEl(v.dataIndex,g);var re=J.get("focus");ir(g,re==="adjacency"?v.getAdjacentDataIndices():re==="trajectory"?v.getTrajectoryDataIndices():re,J.get("blurScope"),J.get("disabled"))}),i.eachNode(function(v){var g=v.getLayout(),m=v.getModel(),y=m.get("localX"),x=m.get("localY"),_=m.getModel("emphasis"),w=m.get(["itemStyle","borderRadius"])||0,S=new it({shape:{x:y!=null?y*l:g.x,y:x!=null?x*u:g.y,width:g.dx,height:g.dy,r:w},style:m.getModel("itemStyle").getItemStyle(),z2:10});Jr(S,Gr(m),{labelFetcher:{getFormattedLabel:function(M,A){return r.getFormattedLabel(M,A,"node")}},labelDataIndex:v.dataIndex,defaultText:v.id}),S.disableLabelAnimation=!0,S.setStyle("fill",v.getVisual("color")),S.setStyle("decal",v.getVisual("style").decal),Vr(S,m),o.add(S),c.setItemGraphicEl(v.dataIndex,S),Be(S).dataType="node";var C=_.get("focus");ir(S,C==="adjacency"?v.getAdjacentDataIndices():C==="trajectory"?v.getTrajectoryDataIndices():C,_.get("blurScope"),_.get("disabled"))}),c.eachItemGraphicEl(function(v,g){var m=c.getItemModel(g);m.get("draggable")&&(v.drift=function(y,x){this.shape.x+=y,this.shape.y+=x,this.dirty(),a.dispatchAction({type:"dragNode",seriesId:r.id,dataIndex:c.getRawIndex(g),localX:this.shape.x/l,localY:this.shape.y/u})},v.draggable=!0,v.cursor="move")}),!this._data&&r.isAnimationEnabled()&&o.setClipPath(Nge(o.getBoundingRect(),r,function(){o.removeClipPath()})),this._data=r.getData(),this._firstRender=!1},t.prototype.__updateOnOwnRoam=function(r,n,a){lu(this.group,$o,n.coordinateSystem,null)},t.prototype.dispose=function(){this._controller&&this._controller.dispose()},t.prototype._updateViewCoordSys=function(r,n){var a=r.layoutInfo,i=r.coordinateSystem=CI(r,n,a.x,a.y,a.width,a.height);lu(this.group,$o,i,this._firstRender?null:r)},t.type=Xs,t}(Rt);function a4(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"),a=r.node2.getVisual("color");ve(n)&&ve(a)&&(e.fill=new Eh(0,0,+(t==="horizontal"),+(t==="vertical"),[{color:n,offset:0},{color:a,offset:1}]))}}function Nge(e,t,r){var n=new it({shape:{x:e.x-10,y:e.y-10,width:0,height:e.height+20}});return Qt(n,{shape:{width:e.width+20}},t,r),n}var kge=Hr(Xs,Lge);function Lge(e,t){e.eachSeriesByType(Xs,function(r){var n=r.get("nodeWidth"),a=r.get("nodeGap"),i=Ur(r,t).refContainer,o=tr(r.getBoxLayoutParams(),i);r.layoutInfo=o;var s=o.width,l=o.height,u=r.getGraph(),c=u.nodes,h=u.edges;Pge(c);var f=It(c,function(y){return y.getLayout().value===0}),v=f.length!==0?0:r.get("layoutIterations"),g=r.get("orient"),m=r.get("nodeAlign");Ige(c,h,n,a,s,l,v,g,m)})}function Ige(e,t,r,n,a,i,o,s,l){Dge(e,t,r,a,i,s,l),Oge(e,t,i,a,n,o,s),$ge(e,s)}function Pge(e){R(e,function(t){var r=eu(t.outEdges,Nb),n=eu(t.inEdges,Nb),a=t.getValue()||0,i=Math.max(r,n,a);t.setLayout({value:i},!0)})}function Dge(e,t,r,n,a,i,o){for(var s=[],l=[],u=[],c=[],h=0,f=0;f=0;x&&y.depth>v&&(v=y.depth),m.setLayout({depth:x?y.depth:h},!0),i==="vertical"?m.setLayout({dy:r},!0):m.setLayout({dx:r},!0);for(var _=0;_h-1?v:h-1;o&&o!=="left"&&jge(e,o,i,A);var I=i==="vertical"?(a-r)/A:(n-r)/A;Rge(e,I,i)}function X9(e){var t=e.hostGraph.data.getRawDataItem(e.dataIndex);return t.depth!=null&&t.depth>=0}function jge(e,t,r,n){if(t==="right"){for(var a=[],i=e,o=0;i.length;){for(var s=0;s0;i--)l*=.99,Fge(s,l,o),c2(s,a,r,n,o),Wge(s,l,o),c2(s,a,r,n,o)}function zge(e,t){var r=[],n=t==="vertical"?"y":"x",a=AM(e,function(i){return i.getLayout()[n]});return on(a.keys),R(a.keys,function(i){r.push(a.buckets.get(i))}),r}function Bge(e,t,r,n,a,i){var o=1/0;R(e,function(s){var l=s.length,u=0;R(s,function(h){u+=h.getLayout().value});var c=i==="vertical"?(n-(l-1)*a)/u:(r-(l-1)*a)/u;c0&&(s=l.getLayout()[i]+u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[i]+l.getLayout()[f]+t;var g=a==="vertical"?n:r;if(u=c-t-g,u>0){s=l.getLayout()[i]-u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),c=s;for(var v=h-2;v>=0;--v)l=o[v],u=l.getLayout()[i]+l.getLayout()[f]+t-c,u>0&&(s=l.getLayout()[i]-u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[i]}})}function Fge(e,t,r){R(e.slice().reverse(),function(n){R(n,function(a){if(a.outEdges.length){var i=eu(a.outEdges,Vge,r)/eu(a.outEdges,Nb);if(isNaN(i)){var o=a.outEdges.length;i=o?eu(a.outEdges,Gge,r)/o:0}if(r==="vertical"){var s=a.getLayout().x+(i-cu(a,r))*t;a.setLayout({x:s},!0)}else{var l=a.getLayout().y+(i-cu(a,r))*t;a.setLayout({y:l},!0)}}})})}function Vge(e,t){return cu(e.node2,t)*e.getValue()}function Gge(e,t){return cu(e.node2,t)}function Hge(e,t){return cu(e.node1,t)*e.getValue()}function Uge(e,t){return cu(e.node1,t)}function cu(e,t){return t==="vertical"?e.getLayout().x+e.getLayout().dx/2:e.getLayout().y+e.getLayout().dy/2}function Nb(e){return e.getValue()}function eu(e,t,r){for(var n=0,a=e.length,i=-1;++io&&(o=l)}),R(n,function(s){var l=new Kr({type:"color",mappingMethod:"linear",dataExtent:[i,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}))})}a.length&&R(a,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function Xge(e){e.registerChartView(Age),e.registerSeriesModel(Cge),e.registerLayout(kge),e.registerVisual(Zge),e.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(t,r){r.eachComponent({mainType:Ho,subType:Xs,query:t},function(n){n.setNodePosition(t.dataIndex,[t.localX,t.localY])})}),SI(e,Ho,Xs)}var q9=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,a=r.getComponent("xAxis",this.get("xAxisIndex")),i=r.getComponent("yAxis",this.get("yAxisIndex")),o=a.get("type"),s=i.get("type"),l,u=t.layout;o==="category"?(u="horizontal",n=a.getOrdinalMeta(),l=!this._hasEncodeRule("x")):s==="category"&&(u="vertical",n=i.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],v=c[1-h],g=[a,i],m=g[h].get("type"),y=g[1-h].get("type"),x=t.data;if(x&&l){var _=[];R(x,function(C,M){var A;ae(C)?(A=C.slice(),C.unshift(M)):ae(C.value)?(A=te({},C),A.value=A.value.slice(),C.value.unshift(M)):A=C,_.push(A)}),t.data=_}var w=this.defaultValueDimensions,S=[{name:f,type:nb(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:v,type:nb(y),dimsDef:w.slice()}];return Av(this,{coordDimensions:S,dimensionsCount:w.length+1,encodeDefaulter:nt(TH,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 kb(e,t){for(var r=t.ends.length,n=0,a=0;am){var S=[x,w];n.push(S)}}}return{boxData:r,outliers:n}}var sme={type:"echarts:boxplot",transform:function(t){var r=t.upstream;if(r.sourceFormat!==ln){var n="";Lt(n)}var a=ome(r.getRawData(),t.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:a.boxData},{data:a.outliers}]}};function lme(e){e.registerSeriesModel(K9),e.registerChartView(qge),e.registerLayout(tme),e.registerTransform(sme),ime(e)}var hu="candlestick",Q9=function(e){X(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,a){var i=n.getItemLayout(r);return i&&a.rect(i.brushRect)},t.type="series."+hu,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}(Ut);kr(Q9,q9,!0);var ume=["itemStyle","borderColor"],cme=["itemStyle","borderColor0"],hme=["itemStyle","borderColorDoji"],dme=["itemStyle","color"],fme=["itemStyle","color0"];function UI(e,t){return t.get(e>0?dme:fme)}function WI(e,t){return t.get(e===0?hme:e>0?ume:cme)}var vme={seriesType:hu,plan:Bh(),performRawSeries:!0,reset:function(e,t){if(!t.isSeriesFiltered(e)){var r=e.pipelineContext.large;return!r&&{progress:function(n,a){for(var i;(i=n.next())!=null;){var o=a.getItemModel(i),s=a.getItemLayout(i).sign,l=o.getItemStyle();l.fill=UI(s,o),l.stroke=WI(s,o)||l.fill;var u=a.ensureUniqueItemVisual(i,"style");te(u,l)}}}}}},pme=["color","borderColor"],gme=function(e){X(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,a){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(r),this._isLargeDraw?this._renderLarge(r):this._renderNormal(r)},t.prototype.incrementalPrepareRender=function(r,n,a){this._clear(),this._updateDrawMode(r)},t.prototype.incrementalRender=function(r,n,a,i){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(r,n):this._incrementalRenderNormal(r,n)},t.prototype.eachRendered=function(r){Su(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(),a=this._data,i=this.group,o=n.getLayout("isSimpleBox"),s=r.get("clip",!0),l=r.coordinateSystem,u=l.getArea&&l.getArea(),c=s&&vh(l,!1,r);this._data||i.removeAll();var h=o4(r);n.diff(a).add(function(f){if(n.hasValue(f)){var v=n.getItemLayout(f),g=s?kb(u,v):hm;if(g===fm)return;var m=h2(v,f,h,!0);Qt(m,{shape:{points:v.ends}},r,f),ef(g===dm,m,c),d2(m,n,f,o),i.add(m),n.setItemGraphicEl(f,m)}}).update(function(f,v){var g=a.getItemGraphicEl(v);if(!n.hasValue(f)){i.remove(g);return}var m=n.getItemLayout(f),y=s?kb(u,m):hm;if(y===fm){i.remove(g);return}g?(At(g,{shape:{points:m.ends}},r,f),xi(g)):g=h2(m,f,h),d2(g,n,f,o),ef(y===dm,g,c),i.add(g),n.setItemGraphicEl(f,g)}).remove(function(f){var v=a.getItemGraphicEl(f);v&&i.remove(v)}).execute(),this._data=n},t.prototype._renderLarge=function(r){this._clear(),s4(r,this.group);var n=r.get("clip",!0)?vh(r.coordinateSystem,!1,r):null;ef(!!n,this.group,n)},t.prototype._incrementalRenderNormal=function(r,n){for(var a=n.getData(),i=a.getLayout("isSimpleBox"),o=o4(n),s;(s=r.next())!=null;){var l=a.getItemLayout(s),u=h2(l,s,o);d2(u,a,s,i),u.incremental=Io(n),this.group.add(u),this._progressiveEls.push(u)}},t.prototype._incrementalRenderLarge=function(r,n){s4(n,this.group,this._progressiveEls,!0)},t.prototype.remove=function(r){this._clear()},t.prototype._clear=function(){this.group.removeAll(),ef(!1,this.group,null),this._data=null},t.type=hu,t}(Rt),mme=function(){function e(){}return e}(),yme=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="normalCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new mme},t.prototype.buildPath=function(r,n){var a=n.points;this.__simpleBox?(r.moveTo(a[4][0],a[4][1]),r.lineTo(a[6][0],a[6][1])):(r.moveTo(a[0][0],a[0][1]),r.lineTo(a[1][0],a[1][1]),r.lineTo(a[2][0],a[2][1]),r.lineTo(a[3][0],a[3][1]),r.closePath(),r.moveTo(a[4][0],a[4][1]),r.lineTo(a[5][0],a[5][1]),r.moveTo(a[6][0],a[6][1]),r.lineTo(a[7][0],a[7][1]))},t}(pt);function h2(e,t,r,n){var a=e.ends;return new yme({shape:{points:n?xme(a,r,e):a},z2:100})}function d2(e,t,r,n){var a=t.getItemModel(r);e.useStyle(t.getItemVisual(r,"style")),e.style.strokeNoScale=!0;var i=a.getShallow("cursor");i&&e.attr("cursor",i),e.__simpleBox=n,Vr(e,a);var o=t.getItemLayout(r).sign;R(e.states,function(l,u){var c=a.getModel(u),h=UI(o,c),f=WI(o,c)||h,v=l.style||(l.style={});h&&(v.fill=h),f&&(v.stroke=f)});var s=a.getModel("emphasis");ir(e,s.get("focus"),s.get("blurScope"),s.get("disabled"))}function xme(e,t,r){return oe(e,function(n){return n=n.slice(),n[t]=r.initBaseline,n})}function o4(e){return e.getWhiskerBoxesLayout()==="horizontal"?1:0}var _me=function(){function e(){}return e}(),f2=function(e){X(t,e);function t(r){var n=e.call(this,r)||this;return n.type="largeCandlestickBox",n}return t.prototype.getDefaultShape=function(){return new _me},t.prototype.buildPath=function(r,n){for(var a=n.points,i=0;iC?D[i]:P[i],ends:B,brushRect:W(M,A,w)})}function U(Z,J){var re=[];return re[a]=J,re[i]=Z,isNaN(J)||isNaN(Z)?[NaN,NaN]:t.dataToPoint(re)}function F(Z,J,re){var Q=J.slice(),le=J.slice();Q[a]=Ox(Q[a]+n/2,1,!1),le[a]=Ox(le[a]-n/2,1,!0),re?Z.push(Q,le):Z.push(le,Q)}function W(Z,J,re){var Q=U(Z,re),le=U(J,re);return Q[a]-=n/2,le[a]-=n/2,{x:Q[0],y:Q[1],width:i?n:le[0]-Q[0],height:i?le[1]-Q[1]:n}}function $(Z){return Z[a]=Ox(Z[a],1),Z}}function g(m,y){for(var x=So(m.count*4),_=0,w,S=[],C=[],M,A=y.getStore(),I=!!e.get(["itemStyle","borderColorDoji"]);(M=m.next())!=null;){var k=A.get(s,M),P=A.get(u,M),D=A.get(c,M),z=A.get(h,M),j=A.get(f,M);if(isNaN(k)||isNaN(z)||isNaN(j)){x[_++]=NaN,_+=3;continue}x[_++]=l4(A,M,P,D,c,I),S[a]=k,S[i]=z,w=t.dataToPoint(S,null,C),x[_++]=w?w[0]:NaN,x[_++]=w?w[1]:NaN,S[i]=j,w=t.dataToPoint(S,null,C),x[_++]=w?w[1]:NaN}y.setLayout("largePoints",x)}}};function l4(e,t,r,n,a,i){var o;return r>n?o=-1:r0?e.get(a,t-1)<=n?1:-1:1,o}function Cme(e,t){var r=e.getBaseAxis(),n=Cn(r,{fromStat:{key:Uc(hu)},min:1}).w,a=me(Te(e.get("barMaxWidth"),n),n),i=me(Te(e.get("barMinWidth"),1),n),o=e.get("barWidth");return o!=null?me(o,n):at(Et(n/2,a),i)}function Tme(e){wme(e,function(){var t=Uc(hu);eI(e,{key:t,seriesType:hu,getMetrics:vI}),K1(t,tw(t))})}function Mme(e){e.registerChartView(gme),e.registerSeriesModel(Q9),e.registerPreprocessor(bme),e.registerVisual(vme),e.registerLayout(Sme),Tme(e)}function u4(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 Ame=function(e){X(t,e);function t(r,n){var a=e.call(this)||this,i=new ey(r,n),o=new De;return a.add(i),a.add(o),a.updateData(r,n),a}return t.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},t.prototype.startEffectAnimation=function(r){for(var n=r.symbolType,a=r.color,i=r.rippleNumber,o=this.childAt(1),s=0;s0&&(s=this._getLineLength(i)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){i.stopAnimation();var f=void 0;Le(h)?f=h(a):f=h,i.__t>0&&(f=-s*i.__t),this._animateSymbol(i,s,f,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},t.prototype._animateSymbol=function(r,n,a,i,o){if(n>0){r.__t=0;var s=this,l=r.animate("",i).when(o?n*2:n,{__t:o?2:1}).delay(a).during(function(){s._updateSymbolPosition(r)});i||l.done(function(){s.remove(r)}),l.start()}},t.prototype._getLineLength=function(r){return Ss(r.__p1,r.__cp1)+Ss(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,a){this.childAt(0).updateData(r,n,a),this._updateEffectSymbol(r,n)},t.prototype._updateSymbolPosition=function(r){var n=r.__p1,a=r.__p2,i=r.__cp1,o=r.__t<=1?r.__t:2-r.__t,s=[r.x,r.y],l=s.slice(),u=an,c=dM;s[0]=u(n[0],i[0],a[0],o),s[1]=u(n[1],i[1],a[1],o);var h=r.__t<=1?c(n[0],i[0],a[0],o):c(a[0],i[0],n[0],1-o),f=r.__t<=1?c(n[1],i[1],a[1],o):c(a[1],i[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&&!(i[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-i[l])/(i[l+1]-i[l]),h=a[l],f=a[l+1];r.x=h[0]*(1-c)+c*f[0],r.y=h[1]*(1-c)+c*f[1];var v=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,v)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=n,r.ignore=!1}},t}(e$),Pme=function(){function e(){this.polyline=!1,this.curveness=0,this.segs=[]}return e}(),Dme=function(e){X(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 Pme},t.prototype.buildPath=function(r,n){var a=n.segs,i=n.curveness,o;if(n.polyline)for(o=this._off;o0){r.moveTo(a[o++],a[o++]);for(var l=1;l0){var v=(u+h)/2-(c-f)*i,g=(c+f)/2-(h-u)*i;r.quadraticCurveTo(v,g,h,f)}else r.lineTo(h,f)}this.incremental&&(this._off=o,this.notClear=!0)},t.prototype.findDataIndex=function(r,n){var a=this.shape,i=a.segs,o=a.curveness,s=this.style.lineWidth;if(a.polyline)for(var l=0,u=0;u0)for(var h=i[u++],f=i[u++],v=1;v0){var y=(h+g)/2-(f-m)*o,x=(f+m)/2-(g-h)*o;if(l7(h,f,y,x,g,m,s,r,n))return l}else if(Sl(h,f,g,m,s,r,n))return l;l++}return-1},t.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(r=a[0],n=a[1],i.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,a=n.segs,i=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}(),r$={seriesType:"lines",plan:Bh(),reset:function(e){var t=e.coordinateSystem;if(t){var r=e.get("polyline"),n=e.pipelineContext.large;return{progress:function(a,i){var o=[];if(n){var s=void 0,l=a.end-a.start;if(r){for(var u=0,c=a.start;c0&&c&&u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)}),o.updateData(i);var h=r.get("clip",!0)&&vh(r.coordinateSystem,!1,r);h?this.group.setClipPath(h):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,a){var i=r.getData(),o=this._updateLineDraw(i,r);o.incrementalPrepareUpdate(i),this._clearLayer(a),this._finished=!1},t.prototype.incrementalRender=function(r,n,a){this._lineDraw.incrementalUpdate(r,n.getData(),Io(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,a){var i=r.getData(),o=this._lineDraw;if(!this._finished||!o||!o.updateLayout)return{update:!0};var s=r$.reset(r,n,a);s.progress&&s.progress({start:0,end:i.count(),count:i.count()},i),o.updateLayout(),this._clearLayer(a)},t.prototype._updateLineDraw=function(r,n){var a=this._lineDraw,i=this._showEffect(n),o=!!n.get("polyline"),s=n.pipelineContext,l=s.large;return(!a||i!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(a&&a.remove(),a=this._lineDraw=l?new jme:new RI(o?i?Ime:t$:i?e$:EI),this._hasEffet=i,this._isPolyline=o,this._isLargeDraw=l),this.group.add(a.group),a},t.prototype._showEffect=function(r){return!!r.get(["effect","show"])},t.prototype._clearLayer=function(r){var n=GM(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}(Rt),Rme=typeof Uint32Array>"u"?Array:Uint32Array,Ome=typeof Float64Array>"u"?Array:Float64Array;function h4(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=oe(t,function(r){var n=[r[0].coord,r[1].coord],a={coords:n};return r[0].name&&(a.fromName=r[0].name),r[1].name&&(a.toName=r[1].name),y1([a,r[0],r[1]])}))}var zme=function(e){X(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||[],h4(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(h4(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=Lf(this._flatCoords,n.flatCoords),this._flatCoordsOffset=Lf(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),a=n.option instanceof Array?n.option:n.getShallow("coords");return a},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 a=this._flatCoordsOffset[r*2],i=this._flatCoordsOffset[r*2+1],o=0;o ")}return Er("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}(Ut);function W0(e){return e instanceof Array||(e=[e,e]),e}var Bme={seriesType:"lines",reset:function(e){var t=W0(e.get("symbol")),r=W0(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 a(i,o){var s=i.getItemModel(o),l=W0(s.getShallow("symbol",!0)),u=W0(s.getShallow("symbolSize",!0));l[0]&&i.setItemVisual(o,"fromSymbol",l[0]),l[1]&&i.setItemVisual(o,"toSymbol",l[1]),u[0]&&i.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&i.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:n.hasItemOption?a:null}}};function Fme(e){e.registerChartView(Eme),e.registerSeriesModel(zme),e.registerLayout(r$),e.registerVisual(Bme)}var Vme=256,Gme=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var t=qr.createCanvas();this.canvas=t}return e.prototype.update=function(t,r,n,a,i,o){var s=this._getBrush(),l=this._getGradient(i,"inRange"),u=this._getGradient(i,"outOfRange"),c=this.pointSize+this.blurSize,h=this.canvas,f=h.getContext("2d"),v=t.length;h.width=r,h.height=n;for(var g=0;g0){var z=o(w)?l:u;w>0&&(w=w*P+I),C[M++]=z[D],C[M++]=z[D+1],C[M++]=z[D+2],C[M++]=z[D+3]*w*256}else M+=4}return f.putImageData(S,0,0),h},e.prototype._getBrush=function(){var t=this._brushCanvas||(this._brushCanvas=qr.createCanvas()),r=this.pointSize+this.blurSize,n=r*2;t.width=n,t.height=n;var a=t.getContext("2d");return a.clearRect(0,0,n,n),a.shadowOffsetX=n,a.shadowBlur=this.blurSize,a.shadowColor=K.color.neutral99,a.beginPath(),a.arc(-r,r,this.pointSize,0,Math.PI*2,!0),a.closePath(),a.fill(),t},e.prototype._getGradient=function(t,r){for(var n=this._gradientPixels,a=n[r]||(n[r]=new Uint8ClampedArray(256*4)),i=[0,0,0,0],o=0,s=0;s<256;s++)t[r](s/255,!0,i),a[o++]=i[0],a[o++]=i[1],a[o++]=i[2],a[o++]=i[3];return a},e}();function Hme(e,t,r){var n=e[1]-e[0];t=oe(t,function(o){return{interval:[(o.interval[0]-e[0])/n,(o.interval[1]-e[0])/n]}});var a=t.length,i=0;return function(o){var s;for(s=i;s=0;s--){var l=t[s].interval;if(l[0]<=o&&o<=l[1]){i=s;break}}return s>=0&&s=t[0]&&n<=t[1]}}var Wme=function(e){X(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,a){var i;n.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===r&&(i=s)})}),this._progressiveEls=null,this.group.removeAll();var o=r.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"||o.type==="matrix"?this._renderOnGridLike(r,a,0,r.getData().count()):d5(o)&&this._renderOnGeo(o,r,i,a)},t.prototype.incrementalPrepareRender=function(r,n,a){this.group.removeAll()},t.prototype.incrementalRender=function(r,n,a,i){var o=n.coordinateSystem;o&&(d5(o)?this.render(n,a,i):(this._progressiveEls=[],this._renderOnGridLike(n,i,r.start,r.end,!0)))},t.prototype.eachRendered=function(r){Su(this._progressiveEls||this.group,r)},t.prototype._renderOnGridLike=function(r,n,a,i,o){var s=r.coordinateSystem,l=ph(s,"cartesian2d"),u=ph(s,"matrix"),c,h,f,v;if(l){var g=s.getAxis("x"),m=s.getAxis("y");c=Cn(g).w+.5,h=Cn(m).w+.5,f=g.scale.getExtent(),v=m.scale.getExtent()}for(var y=this.group,x=r.getData(),_=r.getModel(["emphasis","itemStyle"]).getItemStyle(),w=r.getModel(["blur","itemStyle"]).getItemStyle(),S=r.getModel(["select","itemStyle"]).getItemStyle(),C=r.get(["itemStyle","borderRadius"]),M=Gr(r),A=r.getModel("emphasis"),I=A.get("focus"),k=A.get("blurScope"),P=A.get("disabled"),D=l||u?[x.mapDimension("x"),x.mapDimension("y"),x.mapDimension("value")]:[x.mapDimension("time"),x.mapDimension("value")],z=a;zf[1]||Vv[1])continue;var U=s.dataToPoint([H,V]);j=new it({shape:{x:U[0]-c/2,y:U[1]-h/2,width:c,height:h},style:B})}else if(u){var F=s.dataToLayout([x.get(D[0],z),x.get(D[1],z)]).rect;if(yn(F.x))continue;j=new it({z2:1,shape:F,style:B})}else{if(isNaN(x.get(D[1],z)))continue;var W=s.dataToLayout([x.get(D[0],z)]),F=W.contentRect||W.rect;if(yn(F.x)||yn(F.y))continue;j=new it({z2:1,shape:F,style:B})}if(x.hasItemOption){var $=x.getItemModel(z),Z=$.getModel("emphasis");_=Z.getModel("itemStyle").getItemStyle(),w=$.getModel(["blur","itemStyle"]).getItemStyle(),S=$.getModel(["select","itemStyle"]).getItemStyle(),C=$.get(["itemStyle","borderRadius"]),I=Z.get("focus"),k=Z.get("blurScope"),P=Z.get("disabled"),M=Gr($)}j.shape.r=C;var J=r.getRawValue(z),re="-";J&&J[2]!=null&&(re=J[2]+""),Jr(j,M,{labelFetcher:r,labelDataIndex:z,defaultOpacity:B.opacity,defaultText:re}),j.ensureState("emphasis").style=_,j.ensureState("blur").style=w,j.ensureState("select").style=S,ir(j,I,k,P),j.incremental=Io(r,o),o&&(j.states.emphasis.hoverLayer=vv),y.add(j),x.setItemGraphicEl(z,j),this._progressiveEls&&this._progressiveEls.push(j)}},t.prototype._renderOnGeo=function(r,n,a,i){var o=a.targetVisuals.inRange,s=a.targetVisuals.outOfRange,l=n.getData(),u=this._hmLayer||this._hmLayer||new Gme;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),v=Math.max(c.y,0),g=Math.min(c.width+c.x,i.getWidth()),m=Math.min(c.height+c.y,i.getHeight()),y=g-f,x=m-v,_=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],w=l.mapArray(_,function(A,I,k){var P=r.dataToPoint([A,I]);return P[0]-=f,P[1]-=v,P.push(k),P}),S=a.getExtent(),C=a.type==="visualMap.continuous"?Ume(S,a.option.range):Hme(S,a.getPieceList(),a.option.selected);u.update(w,y,x,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},C);var M=new Qr({style:{width:y,height:x,x:f,y:v,image:u.canvas},silent:!0});this.group.add(M)},t.type="heatmap",t}(Rt),$me=function(e){X(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 Jo(null,this,{generateCoord:"value"})},t.prototype.preventIncremental=function(){var r=yv.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}(Ut);function Zme(e){e.registerChartView(Wme),e.registerSeriesModel($me)}var Yme=["itemStyle","borderWidth"],d4=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],p2=new Ko,Xme=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=vm,r}return t.prototype.render=function(r,n,a){var i=this.group,o=r.getData(),s=this._data,l=r.coordinateSystem,u=l.getBaseAxis(),c=u.isHorizontal(),h=l.master.getRect(),f={ecSize:{width:a.getWidth(),height:a.getHeight()},seriesModel:r,coordSys:l,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:c,valueDim:d4[+c],categoryDim:d4[1-+c]};o.diff(s).add(function(g){if(o.hasValue(g)){var m=v4(o,g),y=f4(o,g,m,f),x=p4(o,f,y);o.setItemGraphicEl(g,x),i.add(x),m4(x,f,y)}}).update(function(g,m){var y=s.getItemGraphicEl(m);if(!o.hasValue(g)){i.remove(y);return}var x=v4(o,g),_=f4(o,g,x,f),w=l$(o,_);y&&w!==y.__pictorialShapeStr&&(i.remove(y),o.setItemGraphicEl(g,null),y=null),y?rye(y,f,_):y=p4(o,f,_,!0),o.setItemGraphicEl(g,y),y.__pictorialSymbolMeta=_,i.add(y),m4(y,f,_)}).remove(function(g){var m=s.getItemGraphicEl(g);m&&g4(s,g,m.__pictorialSymbolMeta.animationModel,m)}).execute();var v=r.get("clip",!0)?vh(r.coordinateSystem,!1,r):null;return v?i.setClipPath(v):i.removeClipPath(),this._data=o,this.group},t.prototype.remove=function(r,n){var a=this.group,i=this._data;r.get("animation")?i&&i.eachItemGraphicEl(function(o){g4(i,Be(o).dataIndex,r,o)}):a.removeAll()},t.type=vm,t}(Rt);function f4(e,t,r,n){var a=e.getItemLayout(t),i=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:a,itemModel:r,symbolType:e.getItemVisual(t,"symbol")||"circle",style:e.getItemVisual(t,"style"),symbolClip:o,symbolRepeat:i,symbolRepeatDirection:r.get("symbolRepeatDirection"),symbolPatternSize:c,rotation:u,animationModel:h?r:null,hoverScale:h&&r.get(["emphasis","scale"]),z2:r.getShallow("z",!0)||0};qme(r,i,a,n,f),Kme(e,t,a,i,o,f.boundingLength,f.pxSign,c,n,f),Jme(r,f.symbolScale,u,n,f);var v=f.symbolSize,g=Fh(r.get("symbolOffset"),v);return Qme(r,v,a,i,o,g,s,f.valueLineWidth,f.boundingLength,f.repeatCutLength,n,f),f}function qme(e,t,r,n,a){var i=n.valueDim,o=e.get("symbolBoundingData"),s=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(r[i.wh]<=0),c;if(ae(o)){var h=[g2(s,o[0])-l,g2(s,o[1])-l];h[1]=0?1:-1:c>0?1:-1}function g2(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function Kme(e,t,r,n,a,i,o,s,l,u){var c=l.valueDim,h=l.categoryDim,f=Math.abs(r[h.wh]),v=e.getItemVisual(t,"symbolSize"),g;ae(v)?g=v.slice():v==null?g=["100%","100%"]:g=[v,v],g[h.index]=me(g[h.index],f),g[c.index]=me(g[c.index],n?f:Math.abs(i)),u.symbolSize=g;var m=u.symbolScale=[g[0]/s,g[1]/s];m[c.index]*=(l.isHorizontal?-1:1)*o}function Jme(e,t,r,n,a){var i=e.get(Yme)||0;i&&(p2.attr({scaleX:t[0],scaleY:t[1],rotation:r}),p2.updateTransform(),i/=p2.getLineScale(),i*=t[n.valueDim.index]),a.valueLineWidth=i||0}function Qme(e,t,r,n,a,i,o,s,l,u,c,h){var f=c.categoryDim,v=c.valueDim,g=h.pxSign,m=Math.max(t[v.index]+s,0),y=m;if(n){var x=Math.abs(l),_=On(e.get("symbolMargin"),"15%")+"",w=!1;_.lastIndexOf("!")===_.length-1&&(w=!0,_=_.slice(0,_.length-1));var S=me(_,t[v.index]),C=Math.max(m+S*2,0),M=w?0:S*2,A=Bk(n),I=A?n:y4((x+M)/C),k=x-I*m;S=k/2/(w?I:Math.max(I-1,1)),C=m+S*2,M=w?0:S*2,!A&&n!=="fixed"&&(I=u?y4((Math.abs(u)+M)/C):0),y=I*C-M,h.repeatTimes=I,h.symbolMargin=S}var P=g*(y/2),D=h.pathPosition=[];D[f.index]=r[f.wh]/2,D[v.index]=o==="start"?P:o==="end"?l-P:l/2,i&&(D[0]+=i[0],D[1]+=i[1]);var z=h.bundlePosition=[];z[f.index]=r[f.xy],z[v.index]=r[v.xy];var j=h.barRectShape=te({},r);j[v.wh]=g*Math.max(Math.abs(r[v.wh]),Math.abs(D[v.index]+P)),j[f.wh]=r[f.wh];var B=h.clipShape={};B[f.xy]=-r[f.xy],B[f.wh]=c.ecSize[f.wh],B[v.xy]=0,B[v.wh]=r[v.wh]}function n$(e){var t=e.symbolPatternSize,r=Ar(e.symbolType,-t/2,-t/2,t,t);return r.attr({culling:!0}),r.type!=="image"&&r.setStyle({strokeNoScale:!0}),r}function a$(e,t,r,n){var a=e.__pictorialBundle,i=r.symbolSize,o=r.valueLineWidth,s=r.pathPosition,l=t.valueDim,u=r.repeatTimes||0,c=0,h=i[t.valueDim.index]+o+r.symbolMargin*2;for($I(e,function(m){m.__pictorialAnimationIndex=c,m.__pictorialRepeatTimes=u,c0:x<0)&&(_=u-1-m),y[l.index]=h*(_-u/2+.5)+s[l.index],{x:y[0],y:y[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation}}}function i$(e,t,r,n){var a=e.__pictorialBundle,i=e.__pictorialMainPath;i?_f(i,null,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation},r,n):(i=e.__pictorialMainPath=n$(r),a.add(i),_f(i,{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 o$(e,t,r){var n=te({},t.barRectShape),a=e.__pictorialBarRect;a?_f(a,null,{shape:n},t,r):(a=e.__pictorialBarRect=new it({z2:2,shape:n,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),a.disableMorphing=!0,e.add(a))}function s$(e,t,r,n){if(r.symbolClip){var a=e.__pictorialClipPath,i=te({},r.clipShape),o=t.valueDim,s=r.animationModel,l=r.dataIndex;if(a)At(a,{shape:i},s,l);else{i[o.wh]=0,a=new it({shape:i}),e.__pictorialBundle.setClipPath(a),e.__pictorialClipPath=a;var u={};u[o.wh]=r.clipShape[o.wh],Rh[n?"updateProps":"initProps"](a,{shape:u},s,l)}}}function v4(e,t){var r=e.getItemModel(t);return r.getAnimationDelayParams=eye,r.isAnimationEnabled=tye,r}function eye(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function tye(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function p4(e,t,r,n){var a=new De,i=new De;return a.add(i),a.__pictorialBundle=i,i.x=r.bundlePosition[0],i.y=r.bundlePosition[1],r.symbolRepeat?a$(a,t,r):i$(a,t,r),o$(a,r,n),s$(a,t,r,n),a.__pictorialShapeStr=l$(e,r),a.__pictorialSymbolMeta=r,a}function rye(e,t,r){var n=r.animationModel,a=r.dataIndex,i=e.__pictorialBundle;At(i,{x:r.bundlePosition[0],y:r.bundlePosition[1]},n,a),r.symbolRepeat?a$(e,t,r,!0):i$(e,t,r,!0),o$(e,r,!0),s$(e,t,r,!0)}function g4(e,t,r,n){var a=n.__pictorialBarRect;a&&a.removeTextContent();var i=[];$I(n,function(o){i.push(o)}),n.__pictorialMainPath&&i.push(n.__pictorialMainPath),n.__pictorialClipPath&&(r=null),R(i,function(o){su(o,{scaleX:0,scaleY:0},r,t,function(){n.parent&&n.parent.remove(n)})}),e.setItemGraphicEl(t,null)}function l$(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function $I(e,t,r){R(e.__pictorialBundle.children(),function(n){n!==e.__pictorialBarRect&&t.call(r,n)})}function _f(e,t,r,n,a,i){t&&e.attr(t),n.symbolClip&&!a?r&&e.attr(r):r&&Rh[a?"updateProps":"initProps"](e,r,n.animationModel,n.dataIndex,i)}function m4(e,t,r){var n=r.dataIndex,a=r.itemModel,i=a.getModel("emphasis"),o=i.getModel("itemStyle").getItemStyle(),s=a.getModel(["blur","itemStyle"]).getItemStyle(),l=a.getModel(["select","itemStyle"]).getItemStyle(),u=a.getShallow("cursor"),c=i.get("focus"),h=i.get("blurScope"),f=i.get("scale");$I(e,function(m){if(m instanceof Qr){var y=m.style;m.useStyle(te({image:y.image,x:y.x,y:y.y,width:y.width,height:y.height},r.style))}else m.useStyle(r.style);var x=m.ensureState("emphasis");x.style=o,f&&(x.scaleX=m.scaleX*1.1,x.scaleY=m.scaleY*1.1),m.ensureState("blur").style=s,m.ensureState("select").style=l,u&&(m.cursor=u),m.z2=r.z2});var v=t.valueDim.posDesc[+(r.boundingLength>0)],g=e.__pictorialBarRect;g.ignoreClip=!0,Jr(g,Gr(a),{labelFetcher:t.seriesModel,labelDataIndex:n,defaultText:Hf(t.seriesModel.getData(),n),inheritColor:r.style.fill,defaultOpacity:r.style.opacity,defaultOutsidePosition:v}),ir(e,c,h,i.get("disabled"))}function y4(e){var t=Math.round(e);return Math.abs(e-t)<1e-4?t:Math.ceil(e)}var nye=function(e){X(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."+vm,t.dependencies=["grid"],t.defaultOption=Cu(pm.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}(pm);function aye(e){e.registerChartView(Xme),e.registerSeriesModel(nye),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,m8(vm)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,y8(vm)),_8(e)}var m2=2,Zf="themeRiver",iye=function(e){X(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 Nv(be(this.getData,this),be(this.getRawData,this))},t.prototype.fixData=function(r){var n=r.length,a={},i=AM(r,function(f){return a.hasOwnProperty(f[0]+"")||(a[f[0]+""]=-1),f[2]}),o=[];i.buckets.each(function(f,v){o.push({name:v,dataList:f})});for(var s=o.length,l=0;li&&(i=s),n.push(s)}for(var u=0;ui&&(i=h)}return{y0:a,max:i}}function hye(e){e.registerChartView(oye),e.registerSeriesModel(iye),e.registerLayout(lye),e.registerProcessor(ay(Zf))}var dye=2,fye=4,_4=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this)||this;o.z2=dye,o.textConfig={inside:!0},Be(o).seriesIndex=n.seriesIndex;var s=new wt({z2:fye,silent:r.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,r,n,a,i),o}return t.prototype.updateData=function(r,n,a,i,o){this.node=n,n.piece=this,a=a||this._seriesModel,i=i||this._ecModel;var s=this;Be(s).dataIndex=n.dataIndex;var l=n.getModel(),u=l.getModel("emphasis"),c=n.getLayout(),h=te({},c);h.label=null;var f=n.getVisual("style");f.lineJoin="bevel";var v=n.getVisual("decal");v&&(f.decal=zf(v,o));var g=Co(l.getModel("itemStyle"),h,!0);te(h,g),R(ea,function(_){var w=s.ensureState(_),S=l.getModel([_,"itemStyle"]);w.style=S.getItemStyle();var C=Co(S,h);C&&(w.shape=C)}),r?(s.setShape(h),s.shape.r=c.r0,Qt(s,{shape:{r:c.r}},a,n.dataIndex)):(At(s,{shape:h},a),xi(s)),s.useStyle(f),this._updateLabel(a);var m=l.getShallow("cursor");m&&s.attr("cursor",m),this._seriesModel=a||this._seriesModel,this._ecModel=i||this._ecModel;var y=u.get("focus"),x=y==="relative"?Lf(n.getAncestorsIndices(),n.getDescendantIndices()):y==="ancestor"?n.getAncestorsIndices():y==="descendant"?n.getDescendantIndices():y;ir(this,x,u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r){var n=this,a=this.node.getModel(),i=a.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(),v=this.node.dataIndex,g=i.get("minAngle")/180*Math.PI,m=i.get("show")&&!(g!=null&&Math.abs(s)B&&!th(V-B)&&V0?(o.virtualPiece?o.virtualPiece.updateData(!1,_,r,n,a):(o.virtualPiece=new _4(_,r,n,a),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 a=!1,i=r.seriesModel.getViewRoot();i.eachNode(function(o){if(!a&&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";Z_(u,c)}}a=!0}})})},t.prototype._rootToNode=function(r){r!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:$A,from:this.uid,seriesId:this.seriesModel.id,targetNode:r})},t.prototype.containPoint=function(r,n){var a=n.getData(),i=a.getItemLayout(0);if(i){var o=r[0]-i.cx,s=r[1]-i.cy,l=Math.sqrt(o*o+s*s);return l<=i.r&&l>=i.r0}},t.type=Sh,t}(Rt),yye=Hr(Sh,xye);function xye(e){var t={};function r(n,a,i){if(n.depth===0)return K.color.neutral50;for(var o=n;o&&o.depth>1;)o=o.parentNode;var s=a.getColorFromPalette(o.name||o.dataIndex+"",t);return n.depth>1&&ve(s)&&(s=L_(s,(n.depth-1)/(i-1)*.5)),s}e.eachSeriesByType(Sh,function(n){var a=n.getData(),i=a.tree;i.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=r(o,n,i.root.height));var u=a.ensureUniqueItemVisual(o.dataIndex,"style");te(u,l)})})}var w4=Math.PI/180,_ye=Hr(Sh,bye);function bye(e,t){e.eachSeriesByType(Sh,function(r){var n=r.get("center"),a=r.get("radius");ae(a)||(a=[0,a]),ae(n)||(n=[n,n]);var i=t.getWidth(),o=t.getHeight(),s=Math.min(i,o),l=me(n[0],i),u=me(n[1],o),c=me(a[0],s/2),h=me(a[1],s/2),f=-r.get("startAngle")*w4,v=r.get("minAngle")*w4,g=r.getData().tree.root,m=r.getViewRoot(),y=m.depth,x=r.get("sort");x!=null&&c$(m,x);var _=0;R(m.children,function(H){!isNaN(H.getValue())&&_++});var w=m.getValue(),S=Math.PI/(w||_)*2,C=m.depth>0,M=m.height-(C?-1:1),A=(h-c)/(M||1),I=r.get("clockwise"),k=r.get("stillShowZeroSum"),P=I?1:-1,D=function(H,V){if(H){var U=V;if(H!==g){var F=H.getValue(),W=w===0&&k?S:F*S;Wn[1]&&n.reverse(),{coordSys:{type:"polar",cx:e.cx,cy:e.cy,r:n[1],r0:n[0]},api:{coord:function(a){var i=t.dataToRadius(a[0]),o=r.dataToAngle(a[1]),s=e.coordToPoint([i,o]);return s.push(i,o*Math.PI/180),s},size:be(Pye,e)}}}function jye(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,a){return e.dataToPoint(n,a)},layout:function(n,a){return e.dataToLayout(n,a)}}}}function Eye(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 h$={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},C4=gt(h$);pi(Gs,function(e,t){return e[t]=1,e},{});Gs.join(", ");var Lb=["","style","shape","extra"],Yf=Qe();function ZI(e,t,r,n,a){var i=e+"Animation",o=fv(e,n,a)||{},s=Yf(t).userDuring;return o.duration>0&&(o.during=s?be(Fye,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),te(o,r[i]),o}function Yx(e,t,r,n){n=n||{};var a=n.dataIndex,i=n.isInit,o=n.clearStyle,s=r.isAnimationEnabled(),l=Yf(e),u=t.style;l.userDuring=t.during;var c={},h={};if(Gye(e,t,h),e.type==="compound")for(var f=e.shape.paths,v=t.shape.paths,g=0;g0&&e.animateFrom(y,x)}else Oye(e,t,a||0,r,c);d$(e,t),u?e.dirty():e.markRedraw()}function d$(e,t){for(var r=Yf(e).leaveToProps,n=0;n0&&e.animateFrom(a,i)}}function zye(e,t){Se(t,"silent")&&(e.silent=t.silent),Se(t,"ignore")&&(e.ignore=t.ignore),e instanceof yi&&Se(t,"invisible")&&(e.invisible=t.invisible),e instanceof pt&&Se(t,"autoBatch")&&(e.autoBatch=t.autoBatch)}var fo={},Bye={setTransform:function(e,t){return fo.el[e]=t,this},getTransform:function(e){return fo.el[e]},setShape:function(e,t){var r=fo.el,n=r.shape||(r.shape={});return n[e]=t,r.dirtyShape&&r.dirtyShape(),this},getShape:function(e){var t=fo.el.shape;if(t)return t[e]},setStyle:function(e,t){var r=fo.el,n=r.style;return n&&(n[e]=t,r.dirtyStyle&&r.dirtyStyle()),this},getStyle:function(e){var t=fo.el.style;if(t)return t[e]},setExtra:function(e,t){var r=fo.el.extra||(fo.el.extra={});return r[e]=t,this},getExtra:function(e){var t=fo.el.extra;if(t)return t[e]}};function Fye(){var e=this,t=e.el;if(t){var r=Yf(t).userDuring,n=e.userDuring;if(r!==n){e.el=e.userDuring=null;return}fo.el=t,n(Bye)}}function T4(e,t,r,n){var a=r[e];if(a){var i=t[e],o;if(i){var s=r.transition,l=a.transition;if(l)if(!o&&(o=n[e]={}),Wc(l))te(o,i);else for(var u=Zt(l),c=0;c=0){!o&&(o=n[e]={});for(var v=gt(i),c=0;c=0)){var f=e.getAnimationStyleProps(),v=f?f.style:null;if(v){!i&&(i=n.style={});for(var g=gt(r),u=0;u=0?t.getStore().get(F,V):void 0}var W=t.get(U.name,V),$=U&&U.ordinalMeta;return $?$.categories[W]:W}function A(H,V){V==null&&(V=c);var U=t.getItemVisual(V,"style"),F=U&&U.fill,W=U&&U.opacity,$=w(V,El).getItemStyle();F!=null&&($.fill=F),W!=null&&($.opacity=W);var Z={inheritColor:ve(F)?F:K.color.neutral99},J=S(V,El),re=$t(J,null,Z,!1,!0);re.text=J.getShallow("show")?Te(e.getFormattedLabel(V,El),Hf(t,V)):null;var Q=G_(J,Z,!1);return P(H,$),$=v5($,re,Q),H&&k($,H),$.legacy=!0,$}function I(H,V){V==null&&(V=c);var U=w(V,js).getItemStyle(),F=S(V,js),W=$t(F,null,null,!0,!0);W.text=F.getShallow("show")?ya(e.getFormattedLabel(V,js),e.getFormattedLabel(V,El),Hf(t,V)):null;var $=G_(F,null,!0);return P(H,U),U=v5(U,W,$),H&&k(U,H),U.legacy=!0,U}function k(H,V){for(var U in V)Se(V,U)&&(H[U]=V[U])}function P(H,V){H&&(H.textFill&&(V.textFill=H.textFill),H.textPosition&&(V.textPosition=H.textPosition))}function D(H,V){if(V==null&&(V=c),Se(S4,H)){var U=t.getItemVisual(V,"style");return U?U[S4[H]]:null}if(Se(Cye,H))return t.getItemVisual(V,H)}function z(H){if(o.type==="cartesian2d"){var V=o.getBaseAxis();return Jce(Ee({axis:V},H))}}function j(){return r.getCurrentSeriesIndices()}function B(H){return lL(H,r)}}function Qye(e){var t={};return R(e.dimensions,function(r){var n=e.getDimensionInfo(r);if(!n.isExtraCoord){var a=n.coordDim,i=t[a]=t[a]||[];i[n.coordDimIndex]=e.getDimensionIndex(r)}}),t}function b2(e,t,r,n,a,i,o){if(!n){i.remove(t);return}var s=JI(e,t,r,n,a,i);return s&&o.setItemGraphicEl(r,s),s&&ir(s,n.focus,n.blurScope,n.emphasisDisabled),s}function JI(e,t,r,n,a,i){var o=-1,s=t;t&&g$(t,n,a)&&(o=Ye(i.childrenRef(),t),t=null);var l=!t,u=t;u?u.clearStates():(u=qI(n),s&&Xye(s,u)),n.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),n.tooltipDisabled&&(u.tooltipDisabled=!0),Za.normal.cfg=Za.normal.conOpt=Za.emphasis.cfg=Za.emphasis.conOpt=Za.blur.cfg=Za.blur.conOpt=Za.select.cfg=Za.select.conOpt=null,Za.isLegacy=!1,t0e(u,r,n,a,l,Za),e0e(u,r,n,a,l),KI(e,u,r,n,Za,a,l),Se(n,"info")&&(Ds(u).info=n.info);for(var c=0;c=0?i.replaceAt(u,o):i.add(u),u}function g$(e,t,r){var n=Ds(e),a=t.type,i=t.shape,o=t.style;return r.isUniversalTransitionEnabled()||a!=null&&a!==n.customGraphicType||a==="path"&&o0e(i)&&m$(i)!==n.customPathData||a==="image"&&Se(o,"image")&&o.image!==n.customImagePath}function e0e(e,t,r,n,a){var i=r.clipPath;if(i===!1)e&&e.getClipPath()&&e.removeClipPath();else if(i){var o=e.getClipPath();o&&g$(o,i,n)&&(o=null),o||(o=qI(i),e.setClipPath(o)),KI(null,o,t,i,null,n,a)}}function t0e(e,t,r,n,a,i){if(!(e.isGroup||e.type==="compoundPath")){A4(r,null,i),A4(r,js,i);var o=i.normal.conOpt,s=i.emphasis.conOpt,l=i.blur.conOpt,u=i.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var c=e.getTextContent();if(o===!1)c&&e.removeTextContent();else{o=i.normal.conOpt=o||{type:"text"},c?c.clearStates():(c=qI(o),e.setTextContent(c)),KI(null,c,t,o,null,n,a);for(var h=o&&o.style,f=0;f=c;v--){var g=t.childAt(v);n0e(t,g,a)}}}function n0e(e,t,r){t&&hw(t,Ds(e).option,r)}function a0e(e){new $s(e.oldChildren,e.newChildren,N4,N4,e).add(k4).update(k4).remove(i0e).execute()}function N4(e,t){var r=e&&e.name;return r??Zye+t}function k4(e,t){var r=this.context,n=e!=null?r.newChildren[e]:null,a=t!=null?r.oldChildren[t]:null;JI(r.api,a,r.dataIndex,n,r.seriesModel,r.group)}function i0e(e){var t=this.context,r=t.oldChildren[e];r&&hw(r,Ds(r).option,t.seriesModel)}function m$(e){return e&&(e.pathData||e.d)}function o0e(e){return e&&(Se(e,"pathData")||Se(e,"d"))}function s0e(e){e.registerChartView(qye),e.registerSeriesModel(Tye)}var Cc=Qe(),L4=ke,w2=be,eP=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(t,r,n,a){var i=r.get("value"),o=r.get("status");if(this._axisModel=t,this._axisPointerModel=r,this._api=n,!(!a&&this._lastValue===i&&this._lastStatus===o)){this._lastValue=i,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,i,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 De,this.createPointerEl(s,u,t,r),this.createLabelEl(s,u,t,r),n.getZr().add(s);else{var f=nt(I4,r,h);this.updatePointerEl(s,u,f),this.updateLabelEl(s,u,f,r)}D4(s,r,!0),this._renderHandle(i)}},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"),a=t.axis,i=a.type==="category",o=r.get("snap");if(!o&&!i)return!1;if(n==="auto"||n==null){var s=this.animationThreshold;if(i&&Cn(a).w>s)return!0;if(o){var l=gI(t).seriesDataCount,u=a.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return n===!0},e.prototype.makeElOption=function(t,r,n,a,i){},e.prototype.createPointerEl=function(t,r,n,a){var i=r.pointer;if(i){var o=Cc(t).pointerEl=new Rh[i.type](L4(r.pointer));t.add(o)}},e.prototype.createLabelEl=function(t,r,n,a){if(r.label){var i=Cc(t).labelEl=new wt(L4(r.label));t.add(i),P4(i,a)}},e.prototype.updatePointerEl=function(t,r,n){var a=Cc(t).pointerEl;a&&r.pointer&&(a.setStyle(r.pointer.style),n(a,{shape:r.pointer.shape}))},e.prototype.updateLabelEl=function(t,r,n,a){var i=Cc(t).labelEl;i&&(i.setStyle(r.label.style),n(i,{x:r.label.x,y:r.label.y}),P4(i,a))},e.prototype._renderHandle=function(t){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,n=this._api.getZr(),a=this._handle,i=r.getModel("handle"),o=r.get("status");if(!i.get("show")||!o||o==="hide"){a&&n.remove(a),this._handle=null;return}var s;this._handle||(s=!0,a=this._handle=pv(i.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){Vs(u.event)},onmousedown:w2(this._onHandleDragMove,this,0,0),drift:w2(this._onHandleDragMove,this),ondragend:w2(this._onHandleDragEnd,this)}),n.add(a)),D4(a,r,!1),a.setStyle(i.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=i.get("size");ae(l)||(l=[l,l]),a.scaleX=l[0]/2,a.scaleY=l[1]/2,xv(this,"_doDispatchAxisPointer",i.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,s)}},e.prototype._moveHandleToValue=function(t,r){I4(this._axisPointerModel,!r&&this._moveAnimation,this._handle,S2(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(t,r){var n=this._handle;if(n){this._dragging=!0;var a=this.updateHandleTransform(S2(n),[t,r],this._axisModel,this._axisPointerModel);this._payloadInfo=a,n.stopAnimation(),n.attr(S2(a)),Cc(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,a=this._handle;r&&n&&(this._lastGraphicKey=null,n&&r.remove(n),a&&r.remove(a),this._group=null,this._handle=null,this._payloadInfo=null),rm(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 I4(e,t,r,n){y$(Cc(r).lastProp,n)||(Cc(r).lastProp=n,t?At(r,n,e):(r.stopAnimation(),r.attr(n)))}function y$(e,t){if(Re(e)&&Re(t)){var r=!0;return R(t,function(n,a){r=r&&y$(e[a],n)}),!!r}else return e===t}function P4(e,t){e[t.get(["label","show"])?"show":"hide"]()}function S2(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function D4(e,t,r){var n=t.get("z"),a=t.get("zlevel");e&&e.traverse(function(i){i.type!=="group"&&(n!=null&&(i.z=n),a!=null&&(i.zlevel=a),i.silent=r)})}function tP(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 x$(e,t,r,n,a){var i=r.get("value"),o=_$(i,t.axis,t.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=mv(s.get("padding")||0),u=s.getFont(),c=S1(o,u),h=a.position,f=c.width+l[1]+l[3],v=c.height+l[0]+l[2],g=a.align;g==="right"&&(h[0]-=f),g==="center"&&(h[0]-=f/2);var m=a.verticalAlign;m==="bottom"&&(h[1]-=v),m==="middle"&&(h[1]-=v/2),l0e(h,f,v,n);var y=s.get("backgroundColor");(!y||y==="auto")&&(y=t.get(["axisLine","lineStyle","color"])),e.label={x:h[0],y:h[1],style:$t(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:y}),z2:10}}function l0e(e,t,r,n){var a=n.getWidth(),i=n.getHeight();e[0]=Math.min(e[0]+t,a)-t,e[1]=Math.min(e[1]+r,i)-r,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function _$(e,t,r,n,a){e=t.scale.parse(e);var i=t.scale.getLabel({value:e},{precision:a.precision}),o=a.formatter;if(o){var s={value:ob(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};R(n,function(l){var u=r.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,h=u&&u.getDataParams(c);h&&s.seriesData.push(h)}),ve(o)?i=o.replace("{value}",i):Le(o)&&(i=o(s))}return i}function rP(e,t,r){var n=ar();return Js(n,n,r.rotation),Hi(n,n,r.position),Fi([e.dataToCoord(t),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],n)}function b$(e,t,r,n,a,i){var o=Jn.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=a.get(["label","margin"]),x$(t,n,a,i,{position:rP(n.axis,e,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function nP(e,t,r){return r=r||0,{x1:e[r],y1:e[1-r],x2:t[r],y2:t[1-r]}}function w$(e,t,r){return r=r||0,{x:e[r],y:e[1-r],width:t[r],height:t[1-r]}}function j4(e,t,r,n,a,i){return{cx:e,cy:t,r0:r,r:n,startAngle:a,endAngle:i,clockwise:!0}}function aP(e,t,r){return Cn(e,{fromStat:{sers:oe(t,function(n){return r.getSeriesByIndex(n.seriesIndex)})},min:1}).w}function iP(e,t,r){return[at(Et(t[0],t[1]),e-r/2),Et(e+r/2,at(t[0],t[1]))]}var u0e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.grid,u=i.get("type"),c=s.getGlobalExtent(),h=E4(l,s).getOtherAxis(s).getGlobalExtent(),f=s.toGlobalCoord(s.dataToCoord(n,!0));if(u&&u!=="none"){var v=tP(i),g=c0e[u](s,f,c,h,i.get("seriesDataIndices"),i.ecModel);g.style=v,r.graphicKey=g.type,r.pointer=g}var m=pb(l.getRect(),a);b$(n,r,m,a,i,o)},t.prototype.getHandleTransform=function(r,n,a){var i=pb(n.axis.grid.getRect(),n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=rP(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.grid,l=o.getGlobalExtent(!0),u=E4(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,h=[r.x,r.y];h[c]+=n[c],h[c]=Et(l[1],h[c]),h[c]=at(l[0],h[c]);var f=(u[1]+u[0])/2,v=[f,f];v[c]=h[c];var g=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:r.rotation,cursorPoint:v,tooltipOption:g[c]}},t}(eP);function E4(e,t){var r={};return r[t.dim+"AxisIndex"]=t.index,e.getCartesian(r)}var c0e={line:function(e,t,r,n){var a=nP([t,n[0]],[t,n[1]],R4(e));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(e,t,r,n,a,i){var o=aP(e,a,i),s=n[1]-n[0],l=iP(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:w$([u,n[0]],[c-u,s],R4(e))}}};function R4(e){return e.dim==="x"?0:1}var h0e=function(e){X(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}(ht),Ms=Qe(),d0e=R;function S$(e,t,r){if(!xt.node){var n=t.getZr();Ms(n).records||(Ms(n).records={}),f0e(n,t);var a=Ms(n).records[e]||(Ms(n).records[e]={});a.handler=r}}function f0e(e,t){if(Ms(e).initialized)return;Ms(e).initialized=!0,r("click",nt(C2,"click")),r("mousemove",nt(C2,"mousemove")),r("mousewheel",nt(C2,"mousewheel")),r("globalout",p0e);function r(n,a){e.on(n,function(i){var o=g0e(t);d0e(Ms(e).records,function(s){s&&a(s,i,o.dispatchAction)}),v0e(o.pendings,t)})}}function v0e(e,t){var r=e.showTip.length,n=e.hideTip.length,a;r?a=e.showTip[r-1]:n&&(a=e.hideTip[n-1]),a&&(a.dispatchAction=null,t.dispatchAction(a))}function p0e(e,t,r){e.handler("leave",null,r)}function C2(e,t,r,n){t.handler(e,r,n)}function g0e(e){var t={showTip:[],hideTip:[]},r=function(n){var a=t[n.type];a?a.push(n):(n.dispatchAction=r,e.dispatchAction(n))};return{dispatchAction:r,pendings:t}}function XA(e,t){if(!xt.node){var r=t.getZr(),n=(Ms(r).records||{})[e];n&&(Ms(r).records[e]=null)}}var m0e=function(e){X(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,a){var i=n.getComponent("tooltip"),o=r.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click|mousewheel";S$("axisPointer",a,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){XA("axisPointer",n)},t.prototype.dispose=function(r,n){XA("axisPointer",n)},t.type="axisPointer",t}(Yt);function C$(e,t){var r=[],n=e.seriesIndex,a;if(n==null||!(a=t.getSeriesByIndex(n)))return{point:[]};var i=a.getData(),o=nh(i,e);if(o==null||o<0||ae(o))return{point:[]};var s=i.getItemGraphicEl(o),l=a.coordinateSystem;if(a.getTooltipPosition)r=a.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(e.isStacked){var u=l.getBaseAxis(),c=l.getOtherAxis(u),h=c.dim,f=u.dim,v=h==="x"||h==="radius"?1:0,g=i.mapDimension(f),m=[];m[v]=i.get(g,o),m[1-v]=i.get(i.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(m)||[]}else r=l.dataToPoint(i.getValues(oe(l.dimensions,function(x){return i.mapDimension(x)}),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 O4=Qe();function y0e(e,t,r){var n=e.currTrigger,a=[e.x,e.y],i=e,o=e.dispatchAction||be(r.dispatchAction,r),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){Xx(a)&&(a=C$({seriesIndex:i.seriesIndex,dataIndex:i.dataIndex},t).point);var l=Xx(a),u=i.axesInfo,c=s.axesInfo,h=n==="leave"||Xx(a),f={},v={},g={list:[],map:{}},m={showPointer:nt(_0e,v),showTooltip:nt(b0e,g)};R(s.coordSysMap,function(x,_){var w=l||x.containPoint(a);R(s.coordSysAxesInfo[_],function(S,C){var M=S.axis,A=T0e(u,S);if(!h&&w&&(!u||A)){var I=A&&A.value;I==null&&!l&&(I=M.pointToData(a)),I!=null&&z4(S,I,m,!1,f)}})});var y={};return R(c,function(x,_){var w=x.linkGroup;w&&!v[_]&&R(w.axesInfo,function(S,C){var M=v[C];if(S!==x&&M){var A=M.value;w.mapper&&(A=x.axis.scale.parse(w.mapper(A,B4(S),B4(x)))),y[x.key]=A}})}),R(y,function(x,_){z4(c[_],x,m,!0,f)}),w0e(v,c,f),S0e(g,a,e,o),C0e(c,o,r),f}}function z4(e,t,r,n,a){var i=e.axis;if(!(i.scale.isBlank()||!i.containData(t))){if(!e.involveSeries){r.showPointer(e,t);return}var o=x0e(t,e),s=o.payloadBatch,l=o.snapToValue;s[0]&&a.seriesIndex==null&&te(a,s[0]),!n&&e.snap&&i.containData(l)&&l!=null&&(t=l),r.showPointer(e,t,s),r.showTooltip(e,o,l)}}function x0e(e,t){var r=t.axis,n=r.dim,a=e,i=[],o=Number.MAX_VALUE,s=-1;return R(t.seriesModels,function(l,u){var c=l.getData().mapDimensionsAll(n),h,f;if(l.getAxisTooltipData){var v=l.getAxisTooltipData(c,e,r);f=v.dataIndices,h=v.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(mi(h)){var g=e-h,m=Math.abs(g);m<=o&&((m=0&&s<0)&&(o=m,s=g,a=h,i.length=0),R(f,function(y){i.push({seriesIndex:l.seriesIndex,dataIndexInside:y,dataIndex:l.getData().getRawIndex(y)})}))}}),{payloadBatch:i,snapToValue:a}}function _0e(e,t,r,n){e[t.key]={value:r,payloadBatch:n}}function b0e(e,t,r,n){var a=r.payloadBatch,i=t.axis,o=i.model,s=t.axisPointerModel;if(!(!t.triggerTooltip||!a.length)){var l=t.coordSys.model,u=gm(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:i.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:a.slice()})}}function w0e(e,t,r){var n=r.axesInfo=[];R(t,function(a,i){var o=a.axisPointerModel.option,s=e[i];s?(!a.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!a.useHandle&&(o.status="hide"),o.status==="show"&&n.push({axisDim:a.axis.dim,axisIndex:a.axis.model.componentIndex,value:o.value})})}function S0e(e,t,r,n){if(Xx(t)||!e.list.length){n({type:"hideTip"});return}var a=((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:a.dataIndexInside,dataIndex:a.dataIndex,seriesIndex:a.seriesIndex,dataByCoordSys:e.list})}function C0e(e,t,r){var n=r.getZr(),a="axisPointerLastHighlights",i=O4(n)[a]||{},o=O4(n)[a]={};R(e,function(c,h){var f=c.axisPointerModel.option;f.status==="show"&&c.triggerEmphasis&&R(f.seriesDataIndices,function(v){o[v.seriesIndex+"|"+v.dataIndex]=v})});var s=[],l=[];function u(c){return{seriesIndex:c.seriesIndex,dataIndex:c.dataIndex}}R(i,function(c,h){!o[h]&&l.push(u(c))}),R(o,function(c,h){!i[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 T0e(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 B4(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 Xx(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function iy(e){Gh.registerAxisPointerClass("CartesianAxisPointer",u0e),e.registerComponentModel(h0e),e.registerComponentView(m0e),e.registerPreprocessor(function(t){if(t){(!t.axisPointer||t.axisPointer.length===0)&&(t.axisPointer={});var r=t.axisPointer.link;r&&!ae(r)&&(t.axisPointer.link=[r])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(t,r){t.getComponent("axisPointer").coordSysAxesInfo=Zhe(t,r)}}),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},y0e)}function M0e(e){rt(R8),rt(iy)}var A0e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.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=i.get("type");if(f&&f!=="none"){var v=tP(i),g=k0e[f](s,l,h,u,c,i.get("seriesDataIndices"),i.ecModel);g.style=v,r.graphicKey=g.type,r.pointer=g}var m=i.get(["label","margin"]),y=N0e(n,a,i,l,m);x$(r,a,i,o,y)},t}(eP);function N0e(e,t,r,n,a){var i=t.axis,o=i.dataToCoord(e),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=n.getRadiusAxis().getExtent(),u,c,h;if(i.dim==="radius"){var f=ar();Js(f,f,s),Hi(f,f,[n.cx,n.cy]),u=Fi([o,-a],f);var v=t.getModel("axisLabel").get("rotate")||0,g=Jn.innerTextLayout(s,v*Math.PI/180,-1);c=g.textAlign,h=g.textVerticalAlign}else{var m=l[1];u=n.coordToPoint([m+a,o]);var y=n.cx,x=n.cy;c=Math.abs(u[0]-y)/m<.3?"center":u[0]>y?"left":"right",h=Math.abs(u[1]-x)/m<.3?"middle":u[1]>x?"top":"bottom"}return{position:u,align:c,verticalAlign:h}}var k0e={line:function(e,t,r,n,a){return e.dim==="angle"?{type:"Line",shape:nP(t.coordToPoint([a[0],r]),t.coordToPoint([a[1],r]))}:{type:"Circle",shape:{cx:t.cx,cy:t.cy,r}}},shadow:function(e,t,r,n,a,i,o){var s=Math.PI/180,l=aP(e,i,o),u;if(e.dim==="angle")u=j4(t.cx,t.cy,a[0],a[1],(-r-l/2)*s,(-r+l/2)*s);else{var c=iP(r,n,l),h=c[0],f=c[1];u=j4(t.cx,t.cy,h,f,0,Math.PI*2)}return{type:"Sector",shape:u}}},jo="polar",F4=jo,L0e=function(e){X(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,a=this.ecModel;return a.eachComponent(r,function(i){i.getCoordSysModel()===this&&(n=i)},this),n},t.type=jo,t.dependencies=["radiusAxis","angleAxis"],t.defaultOption={z:0,center:["50%","50%"],radius:"80%"},t}(ht),oP=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",pr).models[0]},t.type="polarAxis",t}(ht);kr(oP,Tv);var I0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="angleAxis",t}(oP),P0e=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="radiusAxis",t}(oP),sP=function(e){X(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}(Si);sP.prototype.dataToRadius=Si.prototype.dataToCoord;sP.prototype.radiusToData=Si.prototype.coordToData;var D0e=Qe(),lP=function(e){X(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(),a=r.scale,i=a.getExtent(),o=a.count();if(i[1]-i[0]<1)return 0;var s=i[0],l=r.dataToCoord(s+1)-r.dataToCoord(s),u=Math.abs(l),c=S1(s==null?"":s+"",n.getFont(),"center","top"),h=Math.max(c.height,7),f=h/u;isNaN(f)&&(f=1/0);var v=Math.max(0,Math.floor(f)),g=D0e(r.model),m=g.lastAutoInterval,y=g.lastTickCount;return m!=null&&y!=null&&Math.abs(m-v)<=1&&Math.abs(y-o)<=1&&m>v?v=m:(g.lastTickCount=o,g.lastAutoInterval=v),v},t}(Si);lP.prototype.dataToAngle=Si.prototype.dataToCoord;lP.prototype.angleToData=Si.prototype.coordToData;var T$=["radius","angle"],j0e=function(){function e(t){this.dimensions=T$,this.type=jo,this.cx=0,this.cy=0,this._radiusAxis=new sP,this._angleAxis=new lP,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,a=this._radiusAxis;return n.scale.type===t&&r.push(n),a.scale.type===t&&r.push(a),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 a=this.pointToCoord(t);return n[0]=this._radiusAxis.radiusToData(a[0],r),n[1]=this._angleAxis.angleToData(a[1],r),n},e.prototype.pointToCoord=function(t){var r=t[0]-this.cx,n=t[1]-this.cy,a=this.getAngleAxis(),i=a.getExtent(),o=Math.min(i[0],i[1]),s=Math.max(i[0],i[1]);a.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],a=t[1]/180*Math.PI;return r[0]=Math.cos(a)*n+this.cx,r[1]=-Math.sin(a)*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 a=t.getExtent(),i=Math.PI/180,o=1e-4;return{cx:this.cx,cy:this.cy,r0:n[0],r:n[1],startAngle:-a[0]*i,endAngle:-a[1]*i,clockwise:t.inverse,contain:function(s,l){var u=s-this.cx,c=l-this.cy,h=u*u+c*c,f=this.r,v=this.r0;return f!==v&&h-o<=f*f&&h+o>=v*v},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 a=V4(r);return a===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var a=V4(r);return a===this?this.pointToData(n):null},e}();function V4(e){var t=e.seriesModel,r=e.polarModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function E0e(e,t,r){var n=t.get("center"),a=Ur(t,r).refContainer;e.cx=me(n[0],a.width)+a.x,e.cy=me(n[1],a.height)+a.y;var i=e.getRadiusAxis(),o=Math.min(a.width,a.height)/2,s=t.get("radius");s==null?s=[0,"100%"]:ae(s)||(s=[0,s]);var l=[me(s[0],o),me(s[1],o)];i.inverse?i.setExtent(l[1],l[0]):i.setExtent(l[0],l[1])}function R0e(e,t){var r=this,n=r.getAngleAxis(),a=r.getRadiusAxis();if(fh(n,Vf),fh(a,Vf),Gf(n),Gf(a),n.type==="category"&&!n.onBand){var i=n.getExtent(),o=360/n.scale.count();n.inverse?i[1]+=o:i[1]-=o,n.setExtent(i[0],i[1])}}function O0e(e){return e.mainType==="angleAxis"}function G4(e,t){var r;if(e.type=Km(t),e.scale=Sv(t,e.type,!1),e.onBand=Qm(e.scale,t),e.inverse=t.get("inverse"),O0e(t)){e.inverse=e.inverse!==t.get("clockwise");var n=t.get("startAngle"),a=(r=t.get("endAngle"))!==null&&r!==void 0?r:n+(e.inverse?-360:360);e.setExtent(n,a)}t.axis=e,e.model=t}var z0e={dimensions:T$,create:function(e,t){var r=[];return e.eachComponent(F4,function(n,a){var i=new j0e(a+"");i.update=R0e;var o=i.getRadiusAxis(),s=i.getAngleAxis(),l=n.findAxisModel("radiusAxis"),u=n.findAxisModel("angleAxis");G4(o,l),G4(s,u),E0e(i,n,t),r.push(i),n.coordinateSystem=i,i.model=n}),e.eachSeries(function(n){if(n.get("coordinateSystem")===jo){var a=n.getReferringComponents(F4,pr).models[0],i=n.coordinateSystem=a.coordinateSystem;i&&(dh(i.getRadiusAxis(),n,jo),dh(i.getAngleAxis(),n,jo))}}),r}},B0e=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function $0(e,t,r){t[1]>t[0]&&(t=t.slice().reverse());var n=e.coordToPoint([t[0],r]),a=e.coordToPoint([t[1],r]);return{x1:n[0],y1:n[1],x2:a[0],y2:a[1]}}function Z0(e){var t=e.getRadiusAxis();return t.inverse?0:1}function H4(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 F0e=function(e){X(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 a=r.axis,i=a.polar,o=i.getRadiusAxis().getExtent(),s=a.getTicksCoords({breakTicks:"none"}),l=a.getMinorTicksCoords(),u=[];R(a.getViewLabels(),function(c){if(!c.tick.offInterval){c=ke(c);var h=a.scale;c.coord=a.dataToCoord(Cv(h,c.tick)),u.push(c)}}),H4(u),H4(s),R(B0e,function(c){r.get([c,"show"])&&(!a.scale.isBlank()||c==="axisLine")&&V0e[c](this.group,r,i,s,l,o,u)},this)}},t.type="angleAxis",t}(Gh),V0e={axisLine:function(e,t,r,n,a,i){var o=t.getModel(["axisLine","lineStyle"]),s=r.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),c=Z0(r),h=c?0:1,f,v=Math.abs(u[1]-u[0])===360?"Circle":"Arc";i[h]===0?f=new Rh[v]({shape:{cx:r.cx,cy:r.cy,r:i[c],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):f=new hv({shape:{cx:r.cx,cy:r.cy,r:i[c],r0:i[h]},style:o.getLineStyle(),z2:1,silent:!0}),f.style.fill=null,e.add(f)},axisTick:function(e,t,r,n,a,i){var o=t.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=i[Z0(r)],u=oe(n,function(c){return new Tr({shape:$0(r,[l,l+s],c.coord)})});e.add(Aa(u,{style:Ee(o.getModel("lineStyle").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})}))},minorTick:function(e,t,r,n,a,i){if(a.length){for(var o=t.getModel("axisTick"),s=t.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=i[Z0(r)],c=[],h=0;hx?"left":"right",S=Math.abs(y[1]-_)/m<.3?"middle":y[1]>_?"top":"bottom";if(s&&s[g]){var C=s[g];Re(C)&&C.textStyle&&(v=new vt(C.textStyle,l,l.ecModel))}var M=new wt({silent:Jn.isLabelSilent(t),style:$t(v,{x:y[0],y:y[1],fill:v.getTextColor()||t.get(["axisLine","lineStyle","color"]),text:h.formattedLabel,align:w,verticalAlign:S})});if(e.add(M),el({el:M,componentModel:t,itemName:h.formattedLabel,formatterParamsExtra:{isTruncated:function(){return M.isTruncated},value:h.rawLabel,tickIndex:f}}),c){var A=Jn.makeAxisEventDataBase(t);A.targetType="axisLabel",A.value=h.rawLabel,Be(M).eventData=A}},this)},splitLine:function(e,t,r,n,a,i){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",k=w;x&&(n[i][A]||(n[i][A]={p:w,n:w}),k=n[i][A][I]);var P=void 0,D=void 0,z=void 0,j=void 0;if(c.dim==="radius"){var B=c.dataToCoord(M)-w,H=e.dataToCoord(A);cr(B)=j})}}function q0e(e,t){var r=Vh(t,jo),n=Cn(e,{fromStat:{key:r},min:1}).w,a=n,i=0,o="20%",s="30%",l={};hh(e,r,function(y){var x=M$(y);l[x]||i++,l[x]=l[x]||{width:0,maxWidth:0};var _=me(y.get("barWidth"),n),w=me(y.get("barMaxWidth"),n),S=y.get("barGap"),C=y.get("barCategoryGap");_&&!l[x].width&&(_=Et(a,_),l[x].width=_,a-=_),w&&(l[x].maxWidth=w),S!=null&&(s=S),C!=null&&(o=C)});var u={},c=me(o,n),h=me(s,1),f=(a-c)/(i+(i-1)*h);f=at(f,0),R(l,function(y,x){var _=y.maxWidth;_&&_=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 a=this.getAxis();return n[0]=a.coordToData(a.toLocalCoord(t[a.orient==="horizontal"?0:1])),n},e.prototype.dataToPoint=function(t,r,n){var a=this.getAxis(),i=this.getRect();n=n||[];var o=a.orient==="horizontal"?0:1;return t instanceof Array&&(t=t[0]),n[o]=a.toGlobalCoord(a.dataToCoord(+t)),n[1-o]=o===0?i.y+i.height/2:i.x+i.width/2,n},e.prototype.convertToPixel=function(t,r,n){var a=U4(r);return a===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var a=U4(r);return a===this?this.pointToData(n):null},e}();function U4(e){var t=e.seriesModel,r=e.singleAxisModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function sxe(e,t){var r=[];return e.eachComponent(LA,function(n,a){var i=new oxe(n,e,t);i.name="single_"+a,i.resize(n,t),n.coordinateSystem=i,r.push(i)}),e.eachSeries(function(n){if(n.get("coordinateSystem")===ade){var a=n.getReferringComponents(LA,pr).models[0],i=n.coordinateSystem=a&&a.coordinateSystem;i&&dh(i.getAxis(),n,rw)}}),r}var lxe={create:sxe,dimensions:A$},W4=["x","y"],uxe=["width","height"],cxe=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.coordinateSystem,u=Db(s),c=Y0(l,u),h=Y0(l,1-u),f=l.dataToPoint(n)[0],v=i.get("type");if(v&&v!=="none"){var g=tP(i),m=hxe[v](s,f,c,h,i.get("seriesDataIndices"),i.ecModel);m.style=g,r.graphicKey=m.type,r.pointer=m}var y=qA(a);b$(n,r,y,a,i,o)},t.prototype.getHandleTransform=function(r,n,a){var i=qA(n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=rP(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.coordinateSystem,l=Db(o),u=Y0(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=Y0(s,1-l),f=(h[1]+h[0])/2,v=[f,f];return v[l]=c[l],{x:c[0],y:c[1],rotation:r.rotation,cursorPoint:v,tooltipOption:{verticalAlign:"middle"}}},t}(eP),hxe={line:function(e,t,r,n){var a=nP([t,n[0]],[t,n[1]],Db(e));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(e,t,r,n,a,i){var o=aP(e,a,i),s=n[1]-n[0],l=iP(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:w$([u,n[0]],[c-u,s],Db(e))}}};function Db(e){return e.isHorizontal()?0:1}function Y0(e,t){var r=e.getRect();return[r[W4[t]],r[W4[t]]+r[uxe[t]]]}var dxe=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="single",t}(Yt);function fxe(e){rt(iy),Gh.registerAxisPointerClass("SingleAxisPointer",cxe),e.registerComponentView(dxe),e.registerComponentView(nxe),e.registerComponentModel($x),Uf(e,"single",$x,$x.defaultOption),e.registerCoordinateSystem("single",lxe)}var vxe=function(e){X(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,a){var i=zh(r);e.prototype.init.apply(this,arguments),$4(r,i)},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),$4(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}(ht);function $4(e,t){var r=e.cellSize,n;ae(r)?n=r:n=e.cellSize=[r,r],n.length===1&&(n[1]=n[0]);var a=oe([0,1],function(i){return pae(t,i)&&(n[i]="auto"),n[i]!=null&&n[i]!=="auto"});Uo(e,t,{type:"box",ignoreSize:a})}var pxe=function(e){X(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,a){var i=this.group;i.removeAll();var o=r.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=n.getLocaleModel();this._renderDayRect(r,s,i),this._renderLines(r,s,l,i),this._renderYearText(r,s,l,i),this._renderMonthText(r,u,l,i),this._renderWeekText(r,u,s,l,i)},t.prototype._renderDayRect=function(r,n,a){for(var i=r.coordinateSystem,o=r.getModel("itemStyle").getItemStyle(),s=i.getCellWidth(),l=i.getCellHeight(),u=n.start.time;u<=n.end.time;u=i.getNextNDay(u,1).time){var c=i.dataToCalendarLayout([u],!1).tl,h=new it({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});a.add(h)}},t.prototype._renderLines=function(r,n,a,i){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 v=h.date;v.setMonth(v.getMonth()+1),h=s.getDateInfo(v)}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,a);o._tlpoints.push(y[0]),o._blpoints.push(y[y.length-1]),u&&o._drawSplitline(y,l,i)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,c,a),l,i),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,c,a),l,i)},t.prototype._getEdgesPoints=function(r,n,a){var i=[r[0].slice(),r[r.length-1].slice()],o=a==="horizontal"?0:1;return i[0][o]=i[0][o]-n/2,i[1][o]=i[1][o]+n/2,i},t.prototype._drawSplitline=function(r,n,a){var i=new un({z2:20,shape:{points:r},style:n});a.add(i)},t.prototype._getLinePointsOfOneWeek=function(r,n,a){for(var i=r.coordinateSystem,o=i.getDateInfo(n),s=[],l=0;l<7;l++){var u=i.getNextNDay(o.time,l),c=i.dataToCalendarLayout([u.time],!1);s[2*u.day]=c.tl,s[2*u.day+1]=c[a==="horizontal"?"bl":"tr"]}return s},t.prototype._formatterLabel=function(r,n){return ve(r)&&r?lH(r,n):Le(r)?r(n):n.nameMap},t.prototype._yearTextPositionControl=function(r,n,a,i,o){var s=n[0],l=n[1],u=["center","bottom"];i==="bottom"?(l+=o,u=["center","top"]):i==="left"?s-=o:i==="right"?(s+=o,u=["center","top"]):l-=o;var c=0;return(i==="left"||i==="right")&&(c=Math.PI/2),{rotation:c,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},t.prototype._renderYearText=function(r,n,a,i){var o=r.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=a!=="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=a==="horizontal"?0:1,v={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},x=this._formatterLabel(m,y),_=new wt({z2:30,style:$t(o,{text:x}),silent:o.get("silent")});_.attr(this._yearTextPositionControl(_,v[l],a,l,s)),i.add(_)}},t.prototype._monthTextPositionControl=function(r,n,a,i,o){var s="left",l="top",u=r[0],c=r[1];return a==="horizontal"?(c=c+o,n&&(s="center"),i==="start"&&(l="bottom")):(u=u+o,n&&(l="middle"),i==="start"&&(s="right")),{x:u,y:c,align:s,verticalAlign:l}},t.prototype._renderMonthText=function(r,n,a,i){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||ve(s))&&(s&&(n=UM(s)||n),s=n.get(["time","monthAbbr"])||[]);var f=u==="start"?0:1,v=a==="horizontal"?0:1;l=u==="start"?-l:l;for(var g=c==="center",m=o.get("silent"),y=0;y=i.start.time&&a.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 a=Math.floor(r[1].time/T2)-Math.floor(r[0].time/T2)+1,i=new Date(r[0].time),o=i.getDate(),s=r[1].date.getDate();i.setDate(o+a-1);var l=i.getDate();if(l!==s)for(var u=i.getTime()-r[1].time>0?1:-1;(l=i.getDate())!==s&&(i.getTime()-r[1].time)*u>0;)a-=u,i.setDate(l-u);var c=Math.floor((a+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:a,weeks:c,nthWeek:h,fweek:r[0].day,lweek:r[1].day}},e.prototype._getDateByWeeksAndDay=function(t,r,n){var a=this._getRangeInfo(n);if(t>a.weeks||t===0&&ra.lweek)return null;var i=(t-1)*7-a.fweek+r,o=new Date(a.start.time);return o.setDate(+a.start.d+i),this.getDateInfo(o)},e.create=function(t,r){var n=[];return t.eachComponent("calendar",function(a){var i=new e(a,t,r);n.push(i),a.coordinateSystem=i}),t.eachComponent(function(a,i){Ym({targetModel:i,coordSysType:"calendar",coordSysProvider:pH})}),n},e.dimensions=["time","value"],e}();function M2(e){var t=e.calendarModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}function mxe(e){e.registerComponentModel(vxe),e.registerComponentView(pxe),e.registerCoordinateSystem("calendar",gxe)}var _s={level:1,leaf:2,nonLeaf:3},Es={none:0,all:1,body:2,corner:3};function KA(e,t,r){var n=t[We[r]].getCell(e);return!n&&Tt(e)&&e<0&&(n=t[We[1-r]].getUnitLayoutInfo(r,Math.round(e))),n}function N$(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 k$(e,t,r,n,a){Z4(e[0],t,a,r,n,0),Z4(e[1],t,a,r,n,1)}function Z4(e,t,r,n,a,i){e[0]=1/0,e[1]=-1/0;var o=n[i],s=ae(o)?o:[o],l=s.length,u=!!r;if(l>=1?(Y4(e,t,s,u,a,i,0),l>1&&Y4(e,t,s,u,a,i,l-1)):e[0]=e[1]=NaN,u){var c=-a[We[1-i]].getLocatorCount(i),h=a[We[i]].getLocatorCount(i)-1;r===Es.body?c=at(0,c):r===Es.corner&&(h=Et(-1,h)),h=t[0]&&e[0]<=t[1]}function K4(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 _xe(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 J4(e,t,r,n){var a=KA(t[n][0],r,n),i=KA(t[n][1],r,n);e[We[n]]=e[_r[n]]=NaN,a&&i&&(e[We[n]]=a.xy,e[_r[n]]=i.xy+i.wh-a.xy)}function bp(e,t,r,n){return e[We[t]]=r,e[We[1-t]]=n,e}function bxe(e){return e&&(e.type===_s.leaf||e.type===_s.nonLeaf)?e:null}function jb(){return{x:NaN,y:NaN,width:NaN,height:NaN}}var Q4=function(){function e(t,r){this._cells=[],this._levels=[],this.dim=t,this.dimIdx=t==="x"?0:1,this._model=r,this._uniqueValueGen=wxe(t);var n=r.get("data",!0),a=r.get("length",!0);if(n!=null&&!ae(n)&&(n=[]),n)this._initByDimModelData(n);else if(a!=null){n=Array(a);for(var i=0;i=1,w=r[We[n]],S=i.getLocatorCount(n)-1,C=new Yl;for(o.resetLayoutIterator(C,n);C.next();)M(C.item);for(i.resetLayoutIterator(C,n);C.next();)M(C.item);function M(A){yn(A.wh)&&(A.wh=x),A.xy=w,A.id[We[n]]===S&&!_&&(A.wh=r[We[n]]+r[_r[n]]-A.xy),w+=A.wh}}function oz(e,t){for(var r=t[We[e]].resetCellIterator();r.next();){var n=r.item;Eb(n.rect,e,n.id,n.span,t),Eb(n.rect,1-e,n.id,n.span,t),n.type===_s.nonLeaf&&(n.xy=n.rect[We[e]],n.wh=n.rect[_r[e]])}}function sz(e,t){e.travelExistingCells(function(r){var n=r.span;if(n){var a=r.spanRect,i=r.id;Eb(a,0,i,n,t),Eb(a,1,i,n,t)}})}function Eb(e,t,r,n,a){e[_r[t]]=0;var i=r[We[t]],o=i<0?a[We[1-t]]:a[We[t]],s=o.getUnitLayoutInfo(t,r[We[t]]);if(e[We[t]]=s.xy,e[_r[t]]=s.wh,n[We[t]]>1){var l=o.getUnitLayoutInfo(t,r[We[t]]+n[We[t]]-1);e[_r[t]]=l.xy+l.wh-s.xy}}function Exe(e,t,r){var n=O_(e,r[_r[t]]);return QA(n,r[_r[t]])}function QA(e,t){return Math.max(Math.min(e,Te(t,1/0)),0)}function k2(e){var t=e.matrixModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}var pn={inBody:1,inCorner:2,outside:3},co={x:null,y:null,point:[]};function lz(e,t,r,n,a){var i=r[We[t]],o=r[We[1-t]],s=i.getUnitLayoutInfo(t,i.getLocatorCount(t)-1),l=i.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[We[t]]=pn.outside;return}if(a===Es.body){l?(e[We[t]]=pn.inBody,h=Et(s.xy+s.wh,at(l.xy,h)),e.point[t]=h):e[We[t]]=pn.outside;return}else if(a===Es.corner){c?(e[We[t]]=pn.inCorner,h=Et(c.xy+c.wh,at(u.xy,h)),e.point[t]=h):e[We[t]]=pn.outside;return}var f=l?l.xy:c?c.xy+c.wh:NaN,v=u?u.xy:f,g=s?s.xy+s.wh:f;if(hg){if(!a){e[We[t]]=pn.outside;return}h=g}e.point[t]=h,e[We[t]]=f<=h&&h<=g?pn.inBody:v<=h&&h<=f?pn.inCorner:pn.outside}function uz(e,t,r,n){var a=1-r;if(e[We[r]]!==pn.outside)for(n[We[r]].resetCellIterator(N2);N2.next();){var i=N2.item;if(hz(e.point[r],i.rect,r)&&hz(e.point[a],i.rect,a)){t[r]=i.ordinal,t[a]=i.id[We[a]];return}}}function cz(e,t,r,n){if(e[We[r]]!==pn.outside){var a=e[We[r]]===pn.inCorner?n[We[1-r]]:n[We[r]];for(a.resetLayoutIterator(Q0,r);Q0.next();)if(Rxe(e.point[r],Q0.item)){t[r]=Q0.item.id[We[r]];return}}}function Rxe(e,t){return t.xy<=e&&e<=t.xy+t.wh}function hz(e,t,r){return t[We[r]]<=e&&e<=t[We[r]]+t[_r[r]]}function Oxe(e){e.registerComponentModel(Mxe),e.registerComponentView(Ixe),e.registerCoordinateSystem("matrix",jxe)}function zxe(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 dz(e,t){var r;return R(t,function(n){e[n]!=null&&e[n]!=="auto"&&(r=!0)}),r}function Bxe(e,t,r){var n=te({},r),a=e[t],i=r.$action||"merge";i==="merge"?a?(Je(a,n,!0),Uo(a,n,{ignoreSize:!0}),_H(r,a),ex(r,a),ex(r,a,"shape"),ex(r,a,"style"),ex(r,a,"extra"),r.clipPath=a.clipPath):e[t]=n:i==="replace"?e[t]=n:i==="remove"&&a&&(e[t]=null)}var I$=["transition","enterFrom","leaveTo"],Fxe=I$.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function ex(e,t,r){if(r&&(!e[r]&&t[r]&&(e[r]={}),e=e[r],t=t[r]),!(!e||!t))for(var n=r?I$:Fxe,a=0;a=0;c--){var h=a[c],f=Fr(h.id,null),v=f!=null?o.get(f):null;if(v){var g=v.parent,x=ei(g),_=g===i?{width:s,height:l}:{width:x.width,height:x.height},w={},S=V1(v,h,_,null,{hv:h.hv,boundingMode:h.bounding},w);if(!ei(v).isNew&&S){for(var C=h.transition,M={},A=0;A=0)?M[I]=k:v[I]=k}At(v,M,r,0)}else v.attr(w)}}},t.prototype._clear=function(){var r=this,n=this._elMap;n.each(function(a){qx(a,ei(a).option,n,r._lastGraphicModel)}),this._elMap=we()},t.prototype.dispose=function(){this._clear()},t.type="graphic",t}(Yt);function eN(e){var t=Se(fz,e)?fz[e]:Jg(e),r=new t({});return ei(r).type=e,r}function vz(e,t,r,n){var a=eN(r);return t.add(a),n.set(e,a),ei(a).id=e,ei(a).isNew=!0,a}function qx(e,t,r,n){var a=e&&e.parent;a&&(e.type==="group"&&e.traverse(function(i){qx(i,t,r,n)}),hw(e,t,n),r.removeKey(ei(e).id))}function pz(e,t,r,n){e.isGroup||R([["cursor",yi.prototype.cursor],["zlevel",n||0],["z",r||0],["z2",0]],function(a){var i=a[0];Se(t,i)?e[i]=Te(t[i],a[1]):e[i]==null&&(e[i]=a[1])}),R(gt(t),function(a){if(a.indexOf("on")===0){var i=t[a];e[a]=Le(i)?i:null}}),Se(t,"draggable")&&(e.draggable=t.draggable),t.name!=null&&(e.name=t.name),t.id!=null&&(e.id=t.id)}function Uxe(e){return e=te({},e),R(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(gH),function(t){delete e[t]}),e}function Wxe(e,t,r){var n=Be(e).eventData;!e.silent&&!e.ignore&&!n&&(n=Be(e).eventData={componentType:"graphic",componentIndex:t.componentIndex,name:e.name}),n&&(n.info=r.info)}function $xe(e){e.registerComponentModel(Gxe),e.registerComponentView(Hxe),e.registerPreprocessor(function(t){var r=t.graphic;ae(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"],Zxe=Qe(),Yxe=["cartesian2d","polar","singleAxis"];function Xxe(e){var t=e.get("coordinateSystem");return Ye(Yxe,t)>=0}function Rl(e){return e+"Axis"}function qxe(e,t){var r=we(),n=[],a=we();e.eachComponent({mainType:"dataZoom",query:t},function(c){a.get(c.uid)||s(c)});var i;do i=!1,e.eachComponent("dataZoom",o);while(i);function o(c){!a.get(c.uid)&&l(c)&&(s(c),i=!0)}function s(c){a.set(c.uid,!0),n.push(c),u(c)}function l(c){var h=!1;return c.eachTargetAxis(function(f,v){var g=r.get(f);g&&g[v]&&(h=!0)}),h}function u(c){c.eachTargetAxis(function(h,f){(r.get(h)||r.set(h,[]))[f]=!0})}return n}function P$(e){var t=e.ecModel,r={infoList:[],infoMap:we()};return e.eachTargetAxis(function(n,a){var i=t.getComponent(Rl(n),a);if(i){var o=i.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(i)}}}),r}function D$(e){var t=Zxe(vU(e));return t.axisProxyMap||(t.axisProxyMap=we())}function Rb(e){if(e)return D$(e.ecModel).get(e.uid)}function Kxe(e,t){D$(e.ecModel).set(e.uid,t)}function j$(e,t){var r=t.getAxisModel().axis.__alignTo;return r&&e.getAxisProxy(r.dim,r.model.componentIndex)?Rb(r.model):null}var L2=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}(),Mm=function(e){X(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,a){var i=mz(r);this.settledOption=i,this.mergeDefaultAndTheme(r,a),this._doInit(i)},t.prototype.mergeOption=function(r){var n=mz(r);Je(this.option,r,!0),Je(this.settledOption,n,!0),this._doInit(n)},t.prototype._doInit=function(r){var n=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var a=this.settledOption;R([["start","startValue"],["end","endValue"]],function(i,o){this._rangePropMode[o]==="value"&&(n[i[0]]=a[i[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var r=this.get("orient",!0),n=this._targetAxisInfoMap=we(),a=this._fillSpecifiedTargetAxis(n);a?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(n,this._orient)),this._noTarget=!0,n.each(function(i){i.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(r){var n=!1;return R(gz,function(a){var i=this.getReferringComponents(Rl(a),zte);if(i.specified){n=!0;var o=new L2;R(i.models,function(s){o.add(s.componentIndex)}),r.set(a,o)}},this),n},t.prototype._fillAutoTargetAxisByOrient=function(r,n){var a=this.ecModel,i=!0;if(i){var o=n==="vertical"?"y":"x",s=a.findComponents({mainType:o+"Axis"});l(s,o)}if(i){var s=a.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 L2;if(f.add(h.componentIndex),r.set(c,f),i=!1,c==="x"||c==="y"){var v=h.getReferringComponents("grid",pr).models[0];v&&R(u,function(g){h.componentIndex!==g.componentIndex&&v===g.getReferringComponents("grid",pr).models[0]&&f.add(g.componentIndex)})}}}i&&R(gz,function(u){if(i){var c=a.findComponents({mainType:Rl(u),filter:function(f){return f.get("type",!0)==="category"}});if(c[0]){var h=new L2;h.add(c[0].componentIndex),r.set(u,h),i=!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,a=this.get("rangeMode");R([["start","startValue"],["end","endValue"]],function(i,o){var s=r[i[0]]!=null,l=r[i[1]]!=null;s&&!l?n[o]="percent":!s&&l?n[o]="value":a?n[o]=a[o]:s&&(n[o]="percent")})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(n,a){r==null&&(r=this.ecModel.getComponent(Rl(n),a))},this),r},t.prototype.eachTargetAxis=function(r,n){this._targetAxisInfoMap.each(function(a,i){R(a.indexList,function(o){r.call(n,i,o)})})},t.prototype.getAxisProxy=function(r,n){return Rb(this.getAxisModel(r,n))},t.prototype.getAxisModel=function(r,n){var a=this._targetAxisInfoMap.get(r);if(a&&a.indexMap[n])return this.ecModel.getComponent(Rl(r),n)},t.prototype.setRawRange=function(r){var n=this.option,a=this.settledOption;R([["start","startValue"],["end","endValue"]],function(i){(r[i[0]]!=null||r[i[1]]!=null)&&(n[i[0]]=a[i[0]]=r[i[0]],n[i[1]]=a[i[1]]=r[i[1]])},this),this._updateRangeUse(r)},t.prototype.setCalculatedRange=function(r){var n=this.option;R(["start","startValue","end","endValue"],function(a){n[a]=r[a]})},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 a=this.findRepresentativeAxisProxy();if(a)return a.getWindow().value}else return this.getAxisProxy(r,n).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(r){if(r)return Rb(r);for(var n,a=this._targetAxisInfoMap.keys(),i=0;io[1];if(w&&!S&&!C)return!0;w&&(y=!0),S&&(g=!0),C&&(m=!0)}return y&&g&&m})}else R(c,function(v){if(i==="empty")l.setData(u=u.map(v,function(m){return s(m)?m:NaN}));else{var g={};g[v]=o,u.selectRange(g)}});R(c,function(v){u.setApproximateExtent(o,v)})}});function s(l){return l>=o[0]&&l<=o[1]}},e.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},r=this._dataZoomModel,n=this._extent;R(["min","max"],function(a){var i=r.get(a+"Span"),o=r.get(a+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?i=Nt(n[0]+o,n,[0,100],!0):i!=null&&(o=Nt(i,[0,100],n,!0)-n[0]),t[a+"Span"]=i,t[a+"ValueSpan"]=o},this)},e}(),t_e={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(a){e.eachComponent("dataZoom",function(i){i.eachTargetAxis(function(o,s){var l=e.getComponent(Rl(o),s);a(o,s,l,i)})})}var r=[];t(function(a,i,o,s){if(!Rb(o)){var l=new e_e(a,i,s,e);r.push(l),Kxe(o,l)}});var n=we();return R(r,function(a){R(a.getTargetSeriesModels(),function(i){n.set(i.uid,i)})}),n},overallReset:function(e,t){e.eachComponent("dataZoom",function(r){var n=[];r.eachTargetAxis(function(a,i){var o=r.getAxisProxy(a,i),s=j$(r,o);s?n.push([o,s]):o.reset(r,null)}),R(n,function(a){a[0].reset(r,a[1].getWindow().percentInverted)}),r.eachTargetAxis(function(a,i){r.getAxisProxy(a,i).filterData(r,t)})}),e.eachComponent("dataZoom",function(r){var n=r.findRepresentativeAxisProxy();if(n){var a=n.getWindow(),i=a.percent,o=a.value;r.setCalculatedRange({start:i[0],end:i[1],startValue:o[0],endValue:o[1]})}})}};function r_e(e){e.registerAction("dataZoom",function(t,r){var n=qxe(r,t);R(n,function(a){a.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})}var n_e=lv();function dP(e){n_e(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,t_e),r_e(e),e.registerSubTypeDefaulter("dataZoom",function(){return"slider"})})}function a_e(e){e.registerComponentModel(Jxe),e.registerComponentView(Qxe),dP(e)}var Eo=function(){function e(){}return e}(),E$={};function Rd(e,t){E$[e]=t}function R$(e){return E$[e]}var i_e=function(e){X(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,a){var i=a.getTheme().get("toolbox"),o=i?i.feature:null;o&&(this._themeFeatureOption=te({},o),i.feature={}),e.prototype.init.call(this,r,n,a),o&&(i.feature=o)},t.prototype.optionUpdated=function(){R(this.option.feature,function(r,n){var a=this._themeFeatureOption,i=R$(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(this.ecModel)),a&&a[n]&&(Je(r,a[n]),a[n]=null),Je(r,i.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}(ht);function O$(e,t){var r=mv(t.get("padding")),n=t.getItemStyle(["color","opacity"]);n.fill=t.get("backgroundColor");var a=new it({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 a}var o_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a,i){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=we()),h=[];R(u,function(_,w){h.push(w)}),new $s(this._featureNames||[],h).add(f).update(f).remove(nt(f,null)).execute(),this._featureNames=It(h,function(_){return c.hasKey(_)});function f(_,w){var S=_!=null&&w==null,C=_!=null&&w!=null,M=_==null,A=S||C?h[_]:h[w],I=u[A],k=S||C?new vt(I,r,n):null,P=k&&k.get("show"),D;if(S){if(!P)return;if(s_e(A))D={onclick:k.option.onclick,featureName:A};else{var z=R$(A);if(!z)return;D=new z}c.set(A,D)}else D=c.get(A);if(M||!P){yz(D)&&D.dispose&&D.dispose(n,a),c.removeKey(A);return}i&&i.newTitle!=null&&i.featureName===A&&(I.title=i.newTitle),S&&(D.uid=Oh("toolbox-feature")),D.model=k,D.ecModel=n,D.api=a,v(k,D,A),k.setIconStatus=function(j,B){var H=this.option,V=this.iconPaths;H.iconStatus=H.iconStatus||{},H.iconStatus[j]=B,V[j]&&(B==="emphasis"?Us:Ws)(V[j])},yz(D)&&D.render&&D.render(k,n,a,i)}function v(_,w,S){var C=_.getModel("iconStyle"),M=_.getModel(["emphasis","iconStyle"]),A=w instanceof Eo&&w.getIcons?w.getIcons():_.get("icon"),I=_.get("title")||{},k,P;ve(A)?(k={},k[S]=A):k=A,ve(I)?(P={},P[S]=I):P=I;var D=_.iconPaths={};R(k,function(z,j){var B=pv(z,{},{x:-s/2,y:-s/2,width:s,height:s});B.setStyle(C.getItemStyle());var H=B.ensureState("emphasis");H.style=M.getItemStyle();var V=new wt({style:{text:P[j],align:M.get("textAlign"),borderRadius:M.get("textBorderRadius"),padding:M.get("textPadding"),fill:null,font:lL({fontStyle:M.get("textFontStyle"),fontFamily:M.get("textFontFamily"),fontSize:M.get("textFontSize"),fontWeight:M.get("textFontWeight")},n)},ignore:!0});B.setTextContent(V),el({el:B,componentModel:r,itemName:j,formatterParamsExtra:{title:P[j]}}),B.__title=P[j],B.on("mouseover",function(){var U=M.getItemStyle(),F=l?r.get("right")==null&&r.get("left")!=="right"?"right":"left":r.get("bottom")==null&&r.get("top")!=="bottom"?"bottom":"top";V.setStyle({fill:M.get("textFill")||U.fill||U.stroke||K.color.neutral99,backgroundColor:M.get("textBackgroundColor")}),B.setTextConfig({position:M.get("textPosition")||F}),V.ignore=!r.get("showTitle"),a.enterEmphasis(this)}).on("mouseout",function(){_.get(["iconStatus",j])!=="emphasis"&&a.leaveEmphasis(this),V.hide()}),(_.get(["iconStatus",j])==="emphasis"?Us:Ws)(B),o.add(B),B.on("click",be(w.onclick,w,n,a,j)),D[j]=B})}var g=Ur(r,a).refContainer,m=r.getBoxLayoutParams(),y=r.get("padding"),x=tr(m,g,y);Gc(r.get("orient"),o,r.get("itemGap"),x.width,x.height),V1(o,m,g,y),o.add(O$(o.getBoundingRect(),r)),l||o.eachChild(function(_){var w=_.__title,S=_.ensureState("emphasis"),C=S.textConfig||(S.textConfig={}),M=_.getTextContent(),A=M&&M.ensureState("emphasis");if(A&&!Le(A)&&w){var I=A.style||(A.style={}),k=S1(w,wt.makeFont(I)),P=_.x+o.x,D=_.y+o.y+s,z=!1;D+k.height>a.getHeight()&&(C.position="top",z=!0);var j=z?-5-k.height:s+10;P+k.width/2>a.getWidth()?(C.position=["100%",j],I.align="right"):P-k.width/2<0&&(C.position=[0,j],I.align="left")}})},t.prototype.updateView=function(r,n,a,i){R(this._features,function(o){o&&o instanceof Eo&&o.updateView&&o.updateView(o.model,n,a,i)})},t.prototype.dispose=function(r,n){R(this._features,function(a){a&&a instanceof Eo&&a.dispose&&a.dispose(r,n)})},t.type="toolbox",t}(Yt);function s_e(e){return e.indexOf("my")===0}function yz(e){return e instanceof Eo}var l_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){var a=this.model,i=a.get("name")||r.get("title.0.text")||"echarts",o=n.getZr().painter.getType()==="svg",s=o?"svg":a.get("type",!0)||"png",l=n.getConnectedDataURL({type:s,backgroundColor:a.get("backgroundColor",!0)||r.get("backgroundColor")||K.color.neutral00,connectedBackgroundColor:a.get("connectedBackgroundColor"),excludeComponents:a.get("excludeComponents"),pixelRatio:a.get("pixelRatio")}),u=xt.browser;if(typeof MouseEvent=="function"&&(u.newEdge||!u.ie&&!u.edge)){var c=document.createElement("a");c.download=i+"."+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(","),v=f[0].indexOf("base64")>-1,g=o?decodeURIComponent(f[1]):f[1];v&&(g=window.atob(g));var m=i+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var y=g.length,x=new Uint8Array(y);y--;)x[y]=g.charCodeAt(y);var _=new Blob([x]);window.navigator.msSaveOrOpenBlob(_,m)}else{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow,C=S.document;C.open("image/svg+xml","replace"),C.write(g),C.close(),S.focus(),C.execCommand("SaveAs",!0,m),document.body.removeChild(w)}}else{var M=a.get("lang"),A='',I=window.open();I.document.write(A),I.document.title=i}},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}(Eo),xz="__ec_magicType_stack__",u_e=[["line","bar"],["stack"]],c_e=function(e){X(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"),a={};return R(r.get("type"),function(i){n[i]&&(a[i]=n[i])}),a},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,a){var i=this.model,o=i.get(["seriesIndex",a]);if(_z[a]){var s={series:[]},l=function(h){var f=h.subType,v=h.id,g=_z[a](f,v,h,i);g&&(Ee(g,h.option),s.series.push(g));var m=h.coordinateSystem;if(m&&m.type==="cartesian2d"&&(a==="line"||a==="bar")){var y=m.getAxesByScale("ordinal")[0];if(y){var x=y.dim,_=x+"Axis",w=h.getReferringComponents(_,pr).models[0],S=w.componentIndex;s[_]=s[_]||[];for(var C=0;C<=S;C++)s[_][S]=s[_][S]||{};s[_][S].boundaryGap=a==="bar"}}};R(u_e,function(h){Ye(h,a)>=0&&R(h,function(f){i.setIconStatus(f,"normal")})}),i.setIconStatus(a,"emphasis"),r.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=a;a==="stack"&&(u=Je({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),i.get(["iconStatus",a])!=="emphasis"&&(c="tiled")),n.dispatchAction({type:"changeMagicType",currentType:c,newOption:s,newTitle:u,featureName:"magicType"})}},t}(Eo),_z={line:function(e,t,r,n){if(e==="bar")return Je({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 Je({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 a=r.get("stack")===xz;if(e==="line"||e==="bar")return n.setIconStatus("stack",a?"normal":"emphasis"),Je({id:t,stack:a?"":xz},n.get(["option","stack"])||{},!0)}};Xi({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(e,t){t.mergeOption(e.newOption)});var dw=new Array(60).join("-"),Xf=" ";function h_e(e){var t={},r=[],n=[];return e.eachRawSeries(function(a){var i=a.coordinateSystem;if(i&&(i.type==="cartesian2d"||i.type==="polar")){var o=i.getBaseAxis();if(o.type==="category"){var s=Zce(o);t[s]||(t[s]={categoryAxis:o,valueAxis:i.getOtherAxis(o),series:[]},n.push({axisDim:o.dim,axisIndex:o.index})),t[s].series.push(a)}else r.push(a)}else r.push(a)}),{seriesGroupByCategoryAxis:t,other:r,meta:n}}function d_e(e){var t=[];return R(e,function(r,n){var a=r.categoryAxis,i=r.valueAxis,o=i.dim,s=[" "].concat(oe(r.series,function(v){return v.name})),l=[a.model.getCategories()];R(r.series,function(v){var g=v.getRawData();l.push(v.getRawData().mapArray(g.mapDimension(o),function(m){return m}))});for(var u=[s.join(Xf)],c=0;c1||r>0&&!e.noHeader;return R(e.blocks,function(a){var i=qH(a);i>=t&&(t=i+ +(n&&(!i||KM(a)&&!a.noHeader)))}),t}return 0}function xie(e,t,r,n){var a=t.noHeader,i=bie(qH(t)),o=[],s=t.blocks||[];bn(!s||ae(s)),s=s||[];var l=e.orderMode;if(t.sortBlocks&&l){s=s.slice();var u={valueAsc:"asc",valueDesc:"desc"};if(Se(u,l)){var c=new FH(u[l],null);s.sort(function(m,y){return c.evaluate(m.sortParam,y.sortParam)})}else l==="seriesDesc"&&s.reverse()}R(s,function(m,y){var x=t.valueFormatter,_=XH(m)(x?te(te({},e),{valueFormatter:x}):e,m,y>0?i.html:0,n);_!=null&&o.push(_)});var h=e.renderMode==="richText"?o.join(i.richText):JM(n,o.join(""),a?r:i.html);if(a)return h;var f=$M(t.header,"ordinal",e.useUTC),v=YH(n,e.renderMode).nameStyle,g=ZH(n);return e.renderMode==="richText"?KH(e,f,v)+i.richText+h:JM(n,'
'+On(f)+"
"+h,r)}function _ie(e,t,r,n){var a=e.renderMode,i=t.noName,o=t.noValue,s=!t.markerType,l=t.name,u=e.useUTC,c=t.valueFormatter||e.valueFormatter||function(S){return S=ae(S)?S:[S],oe(S,function(C,M){return $M(C,ae(v)?v[M]:v,u)})};if(!(i&&o)){var h=s?"":e.markupStyleCreator.makeTooltipMarker(t.markerType,t.markerColor||K.color.secondary,a),f=i?"":$M(l,"ordinal",u),v=t.valueType,g=o?[]:c(t.value,t.rawDataIndex),m=!s||!i,y=!s&&i,x=YH(n,a),_=x.nameStyle,w=x.valueStyle;return a==="richText"?(s?"":h)+(i?"":KH(e,f,_))+(o?"":Cie(e,g,m,y,w)):JM(n,(s?"":h)+(i?"":wie(f,!s,_))+(o?"":Sie(g,m,y,w)),r)}}function $R(e,t,r,n,a,i){if(e){var o=XH(e),s={useUTC:a,renderMode:r,orderMode:n,markupStyleCreator:t,valueFormatter:e.valueFormatter};return o(s,e,0,i)}}function bie(e){return{html:mie[e],richText:yie[e]}}function JM(e,t,r){var n='
',a="margin: "+r+"px 0 0",i=ZH(e);return'
'+t+n+"
"}function wie(e,t,r){var n=t?"margin-left:2px":"";return''+On(e)+""}function Sie(e,t,r,n){var a=r?"10px":"20px",i=t?"float:right;margin-left:"+a:"";return e=ae(e)?e:[e],''+oe(e,function(o){return On(o)}).join("  ")+""}function KH(e,t,r){return e.markupStyleCreator.wrapRichTextStyle(t,r)}function Cie(e,t,r,n,a){var i=[a],o=n?10:20;return r&&i.push({padding:[0,0,0,o],align:"right"}),e.markupStyleCreator.wrapRichTextStyle(ae(t)?t.join(" "):t,i)}function JH(e,t){var r=e.getData().getItemVisual(t,"style"),n=r[e.visualDrawType];return uh(n)}function QH(e,t){var r=e.get("padding");return r??(t==="richText"?[8,10]:10)}var sC=function(){function e(){this.richTextStyles={},this._nextStyleNameId=Vk()}return e.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(t,r,n){var a=n==="richText"?this._generateStyleName():null,i=cH({color:r,type:t,renderMode:n,markerId:a});return ve(i)?i:(this.richTextStyles[a]=i.style,i.content)},e.prototype.wrapRichTextStyle=function(t,r){var n={};ae(r)?R(r,function(i){return te(n,i)}):te(n,r);var a=this._generateStyleName();return this.richTextStyles[a]=n,"{"+a+"|"+t+"}"},e}();function eU(e){var t=e.series,r=e.dataIndex,n=e.multipleSeries,a=t.getData(),i=a.mapDimensionsAll("defaultedTooltip"),o=i.length,s=t.getRawValue(r),l=ae(s),u=JH(t,r),c,h,f,v;if(o>1||l&&!o){var g=Tie(s,t,r,i,u);c=g.inlineValues,h=g.inlineValueTypes,f=g.blocks,v=g.inlineValues[0]}else if(o){var m=a.getDimensionInfo(i[0]);v=c=Of(a,r,i[0]),h=m.type}else v=c=l?s[0]:s;var y=Gk(t),x=y&&t.name||"",_=a.getName(r),w=n?x:_;return Er("section",{header:x,noHeader:n||!y,sortParam:v,blocks:[Er("nameValue",{markerType:"item",markerColor:u,name:w,noName:!La(w),value:c,valueType:h,rawDataIndex:a.getRawIndex(r)})].concat(f||[])})}function Tie(e,t,r,n,a){var i=t.getData(),o=gi(e,function(h,f,v){var g=i.getDimensionInfo(v);return h=h||g&&g.tooltip!==!1&&g.displayName!=null},!1),s=[],l=[],u=[];n.length?R(n,function(h){c(Of(i,r,h),h)}):R(e,c);function c(h,f){var v=i.getDimensionInfo(f);!v||v.otherDims.tooltip===!1||(o?u.push(Er("nameValue",{markerType:"subItem",markerColor:a,name:v.displayName,value:h,valueType:v.type})):(s.push(h),l.push(v.type)))}return{inlineValues:s,inlineValueTypes:l,blocks:u}}var dl=Qe();function f0(e,t){return e.getName(t)||e.getId(t)}var Hx="__universalTransitionEnabled",Ut=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,a){this.seriesIndex=this.componentIndex,this.dataTask=vg({count:Aie,reset:Nie}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(r,a);var i=dl(this).sourceManager=new $H(this);i.prepareSource();var o=this.getInitialData(r,a);YR(o,this),this.dataTask.context.data=o,dl(this).dataBeforeProcessed=o,ZR(this),this._initSelectedMapFromData(o)},t.prototype.mergeDefaultAndTheme=function(r,n){var a=em(this),i=a?zh(r):{},o=this.subType;ht.hasClass(o)&&(o+="Series"),Je(r,n.getTheme().get(this.subType)),Je(r,this.getDefaultOption()),rh(r,"label",["show"]),this.fillDataTextStyle(r.data),a&&Uo(r,i,a)},t.prototype.mergeOption=function(r,n){r=Je(this.option,r,!0),this.fillDataTextStyle(r.data);var a=em(this);a&&Uo(this.option,r,a);var i=dl(this).sourceManager;i.dirty(),i.prepareSource();var o=this.getInitialData(r,n);YR(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,dl(this).dataBeforeProcessed=o,ZR(this),this._initSelectedMapFromData(o)},t.prototype.fillDataTextStyle=function(r){if(r&&!ta(r))for(var n=["show"],a=0;a=0&&f<0)&&(h=C,f=S,v=0),S===f&&(c[v++]=y))}return c.length=v,c},t.prototype.formatTooltip=function(r,n,a){return eU({series:this,dataIndex:r,multipleSeries:n})},t.prototype.isAnimationEnabled=function(){var r=this.ecModel;if(xt.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,a){var i=this.ecModel,o=AL.prototype.getColorFromPalette.call(this,r,n,a);return o||(o=i.getColorFromPalette(r,n,a)),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 a=this.option.selectedMap;if(a){var i=this.option.selectedMode,o=this.getData(n);if(i==="series"||a==="all"){this.option.selectedMap={},this._selectedDataIndicesMap={};return}for(var s=0;s=0&&a.push(o)}return a},t.prototype.isSelected=function(r,n){var a=this.option.selectedMap;if(!a)return!1;var i=this.getData(n);return(a==="all"||a[f0(i,r)])&&!i.getItemModel(r).get(["select","disabled"])},t.prototype.isUniversalTransitionEnabled=function(){if(this[Hx])return!0;var r=this.option.universalTransition;return r?r===!0?!0:r&&r.enabled:!1},t.prototype._innerSelect=function(r,n){var a,i,o=this.option,s=o.selectedMode,l=n.length;if(!(!s||!l)){if(s==="series")o.selectedMap="all";else if(s==="multiple"){Re(o.selectedMap)||(o.selectedMap={});for(var u=o.selectedMap,c=0;c0&&this._innerSelect(r,n)}},t.registerClass=function(r){return ht.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}(ht);kr(Ut,H1);kr(Ut,AL);n7(Ut,ht);function ZR(e){var t=e.name;Gk(e)||(e.name=Mie(e)||t)}function Mie(e){var t=e.getRawData(),r=t.mapDimensionsAll("seriesName"),n=[];return R(r,function(a){var i=t.getDimensionInfo(a);i.displayName&&n.push(i.displayName)}),n.join(" ")}function Aie(e){return e.model.getRawData().count()}function Nie(e){var t=e.model;return t.setData(t.getRawData().cloneShallow()),kie}function kie(e,t){t.outputData&&e.end>t.outputData.count()&&t.model.getRawData().cloneShallow(t.outputData)}function YR(e,t){R(Lf(e.CHANGABLE_METHODS,e.DOWNSAMPLE_METHODS),function(r){e.wrapMethod(r,nt(Lie,t))})}function Lie(e,t){var r=QM(e);return r&&r.setOutputEnd((t||this).count()),t}function QM(e){var t=(e.ecModel||{}).scheduler,r=t&&t.getPipeline(e.uid);if(r){var n=r.currentTask;if(n){var a=n.agentStubMap;a&&(n=a.get(e.uid))}return n}}var Yt=function(){function e(){this.group=new De,this.uid=Oh("viewComponent")}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,a){},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,a){},e.prototype.updateLayout=function(t,r,n,a){},e.prototype.updateVisual=function(t,r,n,a){},e.prototype.toggleBlurSeries=function(t,r,n){},e.prototype.eachRendered=function(t){var r=this.group;r&&r.traverse(t)},e}();Wk(Yt);k1(Yt);function Bh(){var e=Qe();return function(t){var r=e(t),n=t.pipelineContext,a=!!r.large,i=!!r.progressiveRender,o=r.large=!!(n&&n.large),s=r.progressiveRender=!!(n&&n.progressiveRender);return(a!==o||i!==s)&&"reset"}}var tU=Qe(),Iie=Bh(),Rt=function(){function e(){this.group=new De,this.uid=Oh("viewChart"),this.renderTask=vg({plan:Pie,reset:Die}),this.renderTask.context={view:this}}return e.prototype.init=function(t,r){},e.prototype.render=function(t,r,n,a){},e.prototype.highlight=function(t,r,n,a){var i=t.getData(a&&a.dataType);i&&qR(i,a,"emphasis")},e.prototype.downplay=function(t,r,n,a){var i=t.getData(a&&a.dataType);i&&qR(i,a,"normal")},e.prototype.remove=function(t,r){this.group.removeAll()},e.prototype.dispose=function(t,r){},e.prototype.updateView=function(t,r,n,a){this.render(t,r,n,a)},e.prototype.updateVisual=function(t,r,n,a){this.render(t,r,n,a)},e.prototype.eachRendered=function(t){Su(this.group,t)},e.markUpdateMethod=function(t,r){tU(t).updateMethod=r},e.protoInitialize=function(){var t=e.prototype;t.type="chart"}(),e}();function XR(e,t,r){e&&Kg(e)&&(t==="emphasis"?Us:Ws)(e,r)}function qR(e,t,r){var n=nh(e,t),a=t&&t.highlightKey!=null?ane(t.highlightKey):null;n!=null?R(Zt(n),function(i){XR(e.getItemGraphicEl(i),r,a)}):e.eachItemGraphicEl(function(i){XR(i,r,a)})}Wk(Rt);k1(Rt);function Pie(e){return Iie(e.model)}function Die(e){var t=e.model,r=e.ecModel,n=e.api,a=e.payload,i=t.pipelineContext.progressiveRender,o=e.view,s=a&&tU(a).updateMethod,l=i?"incrementalPrepareRender":s&&o[s]?s:"render";return l!=="render"&&o[l](t,r,n,a),jie[l]}var jie={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)}}},Y_="\0__throttleOriginMethod",KR="\0__throttleRate",JR="\0__throttleType";function U1(e,t,r){var n,a=0,i=0,o=null,s,l,u,c;t=t||0;function h(){i=new Date().getTime(),o=null,e.apply(l,u||[])}var f=function(){for(var v=[],g=0;g=0?h():o=setTimeout(h,-s),a=n};return f.clear=function(){o&&(clearTimeout(o),o=null)},f.debounceNextCall=function(v){c=v},f}function xv(e,t,r,n){var a=e[t];if(a){var i=a[Y_]||a,o=a[JR],s=a[KR];if(s!==r||o!==n){if(r==null||!n)return e[t]=i;a=e[t]=U1(i,r,n==="debounce"),a[Y_]=i,a[JR]=n,a[KR]=r}return a}}function rm(e,t){var r=e[t];r&&r[Y_]&&(r.clear&&r.clear(),e[t]=r[Y_])}var QR=Qe(),eO={itemStyle:ih(Q7,!0),lineStyle:ih(J7,!0)},Eie={lineStyle:"stroke",itemStyle:"fill"};function rU(e,t){var r=e.visualStyleMapper||eO[t];return r||(console.warn("Unknown style type '"+t+"'."),eO.itemStyle)}function nU(e,t){var r=e.visualDrawType||Eie[t];return r||(console.warn("Unknown style type '"+t+"'."),"fill")}var Rie={createOnAllSeries:!0,performRawSeries:!0,reset:function(e,t){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",a=e.getModel(n),i=rU(e,n),o=i(a),s=a.getShallow("decal");s&&(r.setVisual("decal",s),s.dirty=!0);var l=nU(e,n),u=o[l],c=Le(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"||Le(o.fill)?f:o.fill,o.stroke=o.stroke==="auto"||Le(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(v,g){var m=e.getDataParams(g),y=te({},o);y[l]=c(m),v.setItemVisual(g,"style",y)}}}},rp=new vt,Oie={createOnAllSeries:!0,reset:function(e,t){if(!e.ignoreStyleOnData){var r=e.getData(),n=e.visualStyleAccessPath||"itemStyle",a=rU(e,n),i=r.getVisual("drawType");return{dataEach:r.hasItemOption?function(o,s){var l=o.getRawDataItem(s);if(l&&l[n]){rp.option=l[n];var u=a(rp),c=o.ensureUniqueItemVisual(s,"style");te(c,u),rp.option.decal&&(o.setItemVisual(s,"decal",rp.option.decal),rp.option.decal.dirty=!0),i in u&&o.setItemVisual(s,"colorFromPalette",!1)}}:null}}}},zie={performRawSeries:!0,overallReset:function(e){var t=we();e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.type+"-"+r.getColorBy();QR(r).scope=t.get(n)||t.set(n,{})}}),e.eachSeries(function(r){if(!r.isColorBySeries()){var n=r.getRawData(),a={},i=r.getData(),o=QR(r).scope,s=r.visualStyleAccessPath||"itemStyle",l=nU(r,s);i.each(function(u){var c=i.getRawIndex(u);a[c]=u}),n.each(function(u){var c=a[u],h=i.getItemVisual(c,"colorFromPalette");if(h){var f=i.ensureUniqueItemVisual(c,"style"),v=n.getName(u)||u+"",g=n.count();f[l]=r.getColorFromPalette(v,o,g)}})}})}},v0=Math.PI;function Bie(e,t){t=t||{},Ee(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 De,n=new it({style:{fill:t.maskColor},zlevel:t.zlevel,z:1e4});r.add(n);var a=new wt({style:{text:t.text,fill:t.textColor,fontSize:t.fontSize,fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:t.fontFamily},zlevel:t.zlevel,z:10001}),i=new it({style:{fill:"none"},textContent:a,textConfig:{position:"right",distance:10},zlevel:t.zlevel,z:10001});r.add(i);var o;return t.showSpinner&&(o=new Um({shape:{startAngle:-v0/2,endAngle:-v0/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:v0*3/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:v0*3/2}).delay(300).start("circularInOut"),r.add(o)),r.resize=function(){var s=a.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}),i.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 aU=function(){function e(t,r,n,a){this._stageTaskMap=we(),this.ecInstance=t,this.api=r,n=this._dataProcessorHandlers=n.slice(),a=this._visualHandlers=a.slice(),this._allHandlers=n.concat(a)}return e.prototype.restoreData=function(t,r){t.restoreData(r),this._stageTaskMap.each(function(n){var a=n.overallTask;a&&a.dirty()})},e.prototype.getPerformArgs=function(t,r){if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),a=n.context,i=!r&&n.progressiveEnabled&&(!a||a.progressiveRender)&&t.__idxInPipeline>n.blockIndex,o=i?n.step:null,s=a&&a.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),a=t.__preparePipelineContext?t.__preparePipelineContext(r,n):t7(t,r,n);t.pipelineContext=n.context=a},e.prototype.restorePipelines=function(t,r){var n=this,a=n._pipelineMap=we();r.eachSeries(function(i){var o=t.painter.type==="canvas"&&i.getProgressive(),s=i.uid;a.set(s,{id:s,head:null,tail:null,threshold:i.getProgressiveThreshold(),progressiveEnabled:o&&!(i.preventIncremental&&i.preventIncremental()),blockIndex:-1,step:Math.round(o||700),count:0}),n._pipe(i,i.dataTask)})},e.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,r=this.api.getModel(),n=this.api;R(this._allHandlers,function(a){var i=t.get(a.uid)||t.set(a.uid,{}),o="";bn(!(a.reset&&a.overallReset),o),a.reset&&this._createSeriesStageTask(a,i,r,n),a.overallReset&&this._createOverallStageTask(a,i,r,n)},this)},e.prototype.prepareView=function(t,r,n,a){var i=t.renderTask,o=i.context;o.model=r,o.ecModel=n,o.api=a,i.__block=!t.incrementalPrepareRender,this._pipe(r,i)},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,a){a=a||{};var i=!1,o=this;R(t,function(l,u){if(!(a.visualType&&a.visualType!==l.visualType)){var c=o._stageTaskMap.get(l.uid),h=c.seriesTaskMap,f=c.overallTask;if(f){var v,g=f.agentStubMap;g.each(function(y){s(a,y)&&(y.dirty(),v=!0)}),v&&f.dirty(),o.updatePayload(f,n);var m=o.getPerformArgs(f,a.block);g.each(function(y){y.perform(m)}),f.perform(m)&&(i=!0)}else h&&h.each(function(y,x){s(a,y)&&y.dirty();var _=o.getPerformArgs(y,a.block);_.skip=!l.performRawSeries&&r.isSeriesFiltered(y.context.model),o.updatePayload(y,n),y.perform(_)&&(i=!0)})}});function s(l,u){return l.setDirty&&(!l.dirtyMap||l.dirtyMap.get(u.__pipeline.id))}this.unfinished=i||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,a){var i=this,o=r.seriesTaskMap,s=r.seriesTaskMap=we(),l=t.seriesType,u=t.getTargetSeries;t.createOnAllSeries?n.eachRawSeries(c):l?n.eachRawSeriesByType(l,c):u&&u(n,a).each(c);function c(h){var f=h.uid,v=s.set(f,o&&o.get(f)||vg({plan:Uie,reset:Wie,count:Zie}));v.context={model:h,ecModel:n,api:a,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:i},i._pipe(h,v)}},e.prototype._createOverallStageTask=function(t,r,n,a){var i=this,o=r.overallTask=r.overallTask||vg({reset:Fie});o.context={ecModel:n,api:a,overallReset:t.overallReset,scheduler:i};var s=o.agentStubMap,l=o.agentStubMap=we(),u=t.seriesType,c=t.getTargetSeries,h=t.dirtyOnOverallProgress,f=!1,v="";bn(!t.createOnAllSeries,v),u?n.eachRawSeriesByType(u,g):c?c(n,a).each(g):R(n.getSeries(),g);function g(m){var y=m.uid,x=l.set(y,s&&s.get(y)||(f=!0,vg({reset:Vie,onDirty:Hie})));x.context={model:m,dirtyOnOverallProgress:h},x.agent=o,x.__block=h,i._pipe(m,x)}f&&o.dirty()},e.prototype._pipe=function(t,r){var n=t.uid,a=this._pipelineMap.get(n);!a.head&&(a.head=r),a.tail&&a.tail.pipe(r),a.tail=r,r.__idxInPipeline=a.count++,r.__pipeline=a},e.wrapStageHandler=function(t,r){return Le(t)&&(t={overallReset:t,seriesType:Yie(t)}),t.uid=Oh("stageHandler"),r&&(t.visualType=r),t},e}();function Fie(e){e.overallReset(e.ecModel,e.api,e.payload)}function Vie(e){return e.dirtyOnOverallProgress&&Gie}function Gie(){this.agent.dirty(),this.getDownstream().dirty()}function Hie(){this.agent&&this.agent.dirty()}function Uie(e){return e.plan?e.plan(e.model,e.ecModel,e.api,e.payload):null}function Wie(e){e.useClearVisual&&e.data.clearAllVisual();var t=e.resetDefines=Zt(e.reset(e.model,e.ecModel,e.api,e.payload));return t.length>1?oe(t,function(r,n){return iU(n)}):$ie}var $ie=iU(0);function iU(e){return function(t,r){var n=r.data,a=r.resetDefines[e];if(a&&a.dataEach)for(var i=t.start;i0&&v===u.length-f.length){var g=u.slice(0,v);g!=="data"&&(r.mainType=g,r[f.toLowerCase()]=l,c=!0)}}s.hasOwnProperty(u)&&(n[u]=l,c=!0),c||(a[u]=l)})}return{cptQuery:r,dataQuery:n,otherQuery:a}},e.prototype.filter=function(t,r){var n=this.eventInfo;if(!n)return!0;var a=n.targetEl,i=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,i,"name")&&c(u,i,"dataIndex")&&c(u,i,"dataType")&&(!s.filterForExposedEvent||s.filterForExposedEvent(t,r.otherQuery,a,i));function c(h,f,v,g){return h[v]==null||f[g||v]===h[v]}},e.prototype.afterTrigger=function(){this.eventInfo=null},e}(),eA=["symbol","symbolSize","symbolRotate","symbolOffset"],nO=eA.concat(["symbolKeepAspect"]),qie={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={},a={},i=!1,o=0;o=0&&jc(l)?l:.5;var u=e.createRadialGradient(o,s,0,o,s,l);return u}function tA(e,t,r){for(var n=t.type==="radial"?poe(e,t,r):voe(e,t,r),a=t.colorStops,i=0;i0)?null:e==="dashed"?[4*t,2*t]:e==="dotted"?[t]:Tt(e)?[e]:ae(e)?e:null}function jL(e){var t=e.style,r=t.lineDash&&t.lineWidth>0&&moe(t.lineDash,t.lineWidth),n=t.lineDashOffset;if(r){var a=t.strokeNoScale&&e.getLineScale?e.getLineScale():1;a&&a!==1&&(r=oe(r,function(i){return i/a}),n/=a)}return[r,n]}var yoe=new Go(!0);function K_(e){var t=e.stroke;return!(t==null||t==="none"||!(e.lineWidth>0))}function aO(e){return typeof e=="string"&&e!=="none"}function J_(e){var t=e.fill;return t!=null&&t!=="none"}function iO(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 oO(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 rA(e,t,r){var n=$k(t.image,t.__image,r);if(L1(n)){var a=e.createPattern(n,t.repeat||"repeat");if(typeof DOMMatrix=="function"&&a&&a.setTransform){var i=new DOMMatrix;i.translateSelf(t.x||0,t.y||0),i.rotateSelf(0,0,(t.rotation||0)*ng),i.scaleSelf(t.scaleX||1,t.scaleY||1),a.setTransform(i)}return a}}function xoe(e,t,r,n,a){var i,o=K_(r),s=J_(r),l=r.strokePercent,u=l<1,c=!t.path;(!t.silent||u)&&c&&t.createPathProxy();var h=t.path||yoe,f=t.__dirty;if(!n){var v=r.fill,g=r.stroke,m=s&&!!v.colorStops,y=o&&!!g.colorStops,x=s&&!!v.image,_=o&&!!g.image,w=void 0,S=void 0,C=void 0,M=void 0,A=void 0;(m||y)&&(A=t.getBoundingRect()),m&&(w=f?tA(e,v,A):t.__canvasFillGradient,t.__canvasFillGradient=w),y&&(S=f?tA(e,g,A):t.__canvasStrokeGradient,t.__canvasStrokeGradient=S),x&&(C=f||!t.__canvasFillPattern?rA(e,v,t):t.__canvasFillPattern,t.__canvasFillPattern=C),_&&(M=f||!t.__canvasStrokePattern?rA(e,g,t):t.__canvasStrokePattern,t.__canvasStrokePattern=M),m?e.fillStyle=w:x&&(C?e.fillStyle=C:s=!1),y?e.strokeStyle=S:_&&(M?e.strokeStyle=M:o=!1)}var k=t.getGlobalScale();h.setScale(k[0],k[1],t.segmentIgnoreThreshold);var I,P;e.setLineDash&&r.lineDash&&(i=jL(t),I=i[0],P=i[1]);var j=!0;(c||f&Dd)&&(h.setDPR(e.dpr),u?h.setContext(null):(h.setContext(e),j=!1),h.reset(),t.buildPath(h,t.shape,n),h.toStatic(),t.pathUpdated()),j&&h.rebuildPath(e,u?l:1),I&&(e.setLineDash(I),e.lineDashOffset=P),n?(a.batchFill=s,a.batchStroke=o):r.strokeFirst?(o&&oO(e,r),s&&iO(e,r)):(s&&iO(e,r),o&&oO(e,r)),I&&e.setLineDash([])}function _oe(e,t,r){var n=t.__image=$k(r.image,t.__image,t,t.onload);if(!(!n||!L1(n))){var a=r.x||0,i=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,a,i,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,a,i,o,s)}else e.drawImage(n,a,i,o,s)}}function boe(e,t,r){var n,a=r.text;if(a!=null&&(a+=""),a){e.font=r.font||Fs,e.textAlign=r.textAlign,e.textBaseline=r.textBaseline;var i=void 0,o=void 0;e.setLineDash&&r.lineDash&&(n=jL(t),i=n[0],o=n[1]),i&&(e.setLineDash(i),e.lineDashOffset=o),r.strokeFirst?(K_(r)&&e.strokeText(a,r.x,r.y),J_(r)&&e.fillText(a,r.x,r.y)):(J_(r)&&e.fillText(a,r.x,r.y),K_(r)&&e.strokeText(a,r.x,r.y)),i&&e.setLineDash([])}}var sO=["shadowBlur","shadowOffsetX","shadowOffsetY"],lO=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function gU(e,t,r,n,a){var i=!1;if(!n&&(r=r||{},t===r))return!1;if(n||t.opacity!==r.opacity){Jn(e,a),i=!0;var o=Math.max(Math.min(t.opacity,1),0);e.globalAlpha=isNaN(o)?Bc.opacity:o}(n||t.blend!==r.blend)&&(i||(Jn(e,a),i=!0),e.globalCompositeOperation=t.blend||Bc.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,a){if(!this[zr]){if(this._disposed){this.id;return}var i,o,s;if(Re(n)&&(a=n.lazyUpdate,i=n.silent,o=n.replaceMerge,s=n.transition,n=n.notMerge),this[zr]=!0,xd(this),!this._model||n){var l=new Iae(this._api),u=this._theme,c=this._model=new NL;c.scheduler=this._scheduler,c.ssr=this._ssr,c.init(null,null,null,u,this._locale,l)}this._model.setOption(r,{replaceMerge:o},oA);var h={seriesTransition:s,optionChanged:!0};if(a)this[tn]={silent:i,updateParams:h},this[zr]=!1,this.getZr().wakeUp();else{try{ic(this),fs.update.call(this,null,h)}catch(f){throw this[tn]=null,this[zr]=!1,f}this._ssr||this._zr.flush(),this[tn]=null,this[zr]=!1,md.call(this,i),yd.call(this,i)}}},t.prototype.setTheme=function(r,n){if(!this[zr]){if(this._disposed){this.id;return}var a=this._model;if(a){var i=n&&n.silent,o=null;this[tn]&&(i==null&&(i=this[tn].silent),o=this[tn].updateParams,this[tn]=null),this[zr]=!0,xd(this);try{this._updateTheme(r),a.setTheme(this._theme),ic(this),fs.update.call(this,{type:"setTheme"},o)}catch(s){throw this[zr]=!1,s}this[zr]=!1,md.call(this,i),yd.call(this,i)}}},t.prototype._updateTheme=function(r){ve(r)&&(r=IU[r]),r&&(r=ke(r),r&&IH(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||xt.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 R(n,function(a){a.stopAnimation(null,!0)}),r.painter.toDataURL()},t.prototype.getDataURL=function(r){if(this._disposed){this.id;return}r=r||{};var n=r.excludeComponents,a=this._model,i=[],o=this;R(n,function(l){a.eachComponent({mainType:l},function(u){var c=o._componentsMap[u.__viewId];c.group.ignore||(i.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 R(i,function(l){l.group.ignore=!1}),s},t.prototype.getConnectedDataURL=function(r){if(this._disposed){this.id;return}var n=r.type==="svg",a=this.group,i=Math.min,o=Math.max,s=1/0;if(rb[a]){var l=s,u=s,c=-s,h=-s,f=[],v=r&&r.pixelRatio||this.getDevicePixelRatio();R(Hc,function(w,S){if(w.group===a){var C=n?w.getZr().painter.getSvgDom().innerHTML:w.renderToCanvas(ke(r)),M=w.getDom().getBoundingClientRect();l=i(M.left,l),u=i(M.top,u),c=o(M.right,c),h=o(M.bottom,h),f.push({dom:C,left:M.left,top:M.top})}}),l*=v,u*=v,c*=v,h*=v;var g=c-l,m=h-u,y=qr.createCanvas(),x=CM(y,{renderer:n?"svg":"canvas"});if(x.resize({width:g,height:m}),n){var _="";return R(f,function(w){var S=w.left-l,C=w.top-u;_+=''+w.dom+""}),x.painter.getSvgRoot().innerHTML=_,r.connectedBackgroundColor&&x.painter.setBackgroundColor(r.connectedBackgroundColor),x.refreshImmediately(),x.painter.toDataURL()}else return r.connectedBackgroundColor&&x.add(new it({shape:{x:0,y:0,width:g,height:m},style:{fill:r.connectedBackgroundColor}})),R(f,function(w){var S=new Qr({style:{x:w.left*v-l,y:w.top*v-u,image:w.dom}});x.add(S)}),x.refreshImmediately(),y.toDataURL("image/"+(r&&r.type||"png"))}else return this.getDataURL(r)},t.prototype.convertToPixel=function(r,n,a){return y0(this,"convertToPixel",r,n,a)},t.prototype.convertToLayout=function(r,n,a){return y0(this,"convertToLayout",r,n,a)},t.prototype.convertFromPixel=function(r,n,a){return y0(this,"convertFromPixel",r,n,a)},t.prototype.containPixel=function(r,n){if(this._disposed){this.id;return}var a=this._model,i,o=ff(a,r);return R(o,function(s,l){l.indexOf("Models")>=0&&R(s,function(u){var c=u.coordinateSystem;if(c&&c.containPoint)i=i||!!c.containPoint(n);else if(l==="seriesModels"){var h=this._chartsMap[u.__viewId];h&&h.containPoint&&(i=i||h.containPoint(n,u))}},this)},this),!!i},t.prototype.getVisual=function(r,n){var a=this._model,i=ff(a,r,{defaultMainType:"series"}),o=i.seriesModel,s=o.getData(),l=i.hasOwnProperty("dataIndexInside")?i.dataIndexInside:i.hasOwnProperty("dataIndex")?s.indexOfRawIndex(i.dataIndex):null;return l!=null?DL(s,l,n):Xm(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;R($oe,function(a){var i=function(o){var s=r.getModel(),l=o.target,u,c=a==="globalout";if(c?u={}:l&&Dc(l,function(m){var y=Be(m);if(y&&y.dataIndex!=null){var x=y.dataModel||s.getSeriesByIndex(y.seriesIndex);return u=x&&x.getDataParams(y.dataIndex,y.dataType,l)||{},!0}else if(y.eventData)return u=te({},y.eventData),!0},!0),u){var h=u.componentType,f=u.componentIndex;(h==="markLine"||h==="markPoint"||h==="markArea")&&(h="series",f=u.seriesIndex);var v=h&&f!=null&&s.getComponent(h,f),g=v&&r[v.mainType==="series"?"_chartsMap":"_componentsMap"][v.__viewId];u.event=o,u.type=a,r._$eventProcessor.eventInfo={targetEl:l,packedEvent:u,model:v,view:g},r.trigger(a,u)}};i.zrEventfulCallAtLast=!0,r._zr.on(a,i,r)});var n=this._messageCenter;R(aA,function(a,i){n.on(i,function(o){r.trigger(i,o)})}),Jie(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&&KG(this.getDom(),zL,"");var n=this,a=n._api,i=n._model;R(n._componentsViews,function(o){o.dispose(i,a)}),R(n._chartsViews,function(o){o.dispose(i,a)}),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 Hc[n.id]},t.prototype.resize=function(r){if(!this[zr]){if(this._disposed){this.id;return}this._zr.resize(r);var n=this._model;if(this._loadingFX&&this._loadingFX.resize(),!!n){var a=n.resetOption("media"),i=r&&r.silent;this[tn]&&(i==null&&(i=this[tn].silent),a=!0,this[tn]=null),this[zr]=!0,xd(this);try{a&&ic(this),fs.update.call(this,{type:"resize",animation:te({duration:0},r&&r.animation)})}catch(o){throw this[zr]=!1,o}this[zr]=!1,md.call(this,i),yd.call(this,i)}}},t.prototype.showLoading=function(r,n){if(this._disposed){this.id;return}if(Re(r)&&(n=r,r=""),r=r||"default",this.hideLoading(),!!sA[r]){var a=sA[r](this._api,n),i=this._zr;this._loadingFX=a,i.add(a)}},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=te({},r);return n.type=nA[r.type],n},t.prototype.dispatchAction=function(r,n){if(this._disposed){this.id;return}if(Re(n)||(n={silent:!!n}),!!eb[r.type]&&this._model){if(this[zr]){this._pendingActions.push(r);return}var a=n.silent;fC.call(this,r,a);var i=n.flush;i?this._zr.flush():i!==!1&&xt.browser.weChat&&this._throttledZrFlush(),md.call(this,a),yd.call(this,a)}},t.prototype.updateLabelLayout=function(){Ka.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},t.prototype.appendData=function(r){if(this._disposed){this.id;return}var n=r.seriesIndex,a=this.getModel(),i=a.getSeriesByIndex(n);i.appendData(r),this._scheduler.unfinished=!0,this.getZr().wakeUp()},t.internalField=function(){ic=function(h){toe(h._model);var f=h._scheduler;f.restorePipelines(h._zr,h._model),f.prepareStageTasks(),hC(h,!0),hC(h,!1),f.plan()},hC=function(h,f){for(var v=h._model,g=h._scheduler,m=f?h._componentsViews:h._chartsViews,y=f?h._componentsMap:h._chartsMap,x=h._zr,_=h._api,w=0;wTe(f.get("hoverLayerThreshold"),CH.hoverLayerThreshold)&&!xt.node&&!xt.worker;(h._usingTHL||y)&&(f.eachSeries(function(x){if(!x.preventUsingHoverLayer){var _=h._chartsMap[x.__viewId];_.__alive&&_.eachRendered(function(w){var S=w.states.emphasis;S&&S.hoverLayer!==vv&&(S.hoverLayer=y?V7:F7)})}}),h._usingTHL=y)}}function s(h,f){var v=h.get("blendMode")||null;f.eachRendered(function(g){g.isGroup||(g.style.blend=v)})}function l(h,f){if(!h.preventAutoZ){var v=lh(h);f.eachRendered(function(g){return z1(g,v.z,v.zlevel),!0})}}function u(h,f){f.eachRendered(function(v){if(!vf(v)){var g=v.getTextContent(),m=v.getTextGuideLine();v.stateTransition&&(v.stateTransition=null),g&&g.stateTransition&&(g.stateTransition=null),m&&m.stateTransition&&(m.stateTransition=null),v.hasState()?(v.prevStates=v.currentStates,v.clearStates()):v.prevStates&&(v.prevStates=null)}})}function c(h,f){var v=h.getModel("stateAnimation"),g=h.isAnimationEnabled(),m=v.get("duration"),y=m>0?{duration:m,delay:v.get("delay"),easing:v.get("easing")}:null;f.eachRendered(function(x){if(x.states&&x.states.emphasis){if(vf(x))return;if(x instanceof pt&&ine(x),x.__dirty){var _=x.prevStates;_&&x.useStates(_)}if(g){x.stateTransition=y;var w=x.getTextContent(),S=x.getTextGuideLine();w&&(w.stateTransition=y),S&&(S.stateTransition=y)}x.__dirty&&i(x)}})}wO=function(h){return new(function(f){q(v,f);function v(){return f!==null&&f.apply(this,arguments)||this}return v.prototype.getCoordinateSystems=function(){return h._coordSysMgr.getCoordinateSystems()},v.prototype.getComponentByElement=function(g){for(;g;){var m=g.__ecComponentInfo;if(m!=null)return h._model.getComponent(m.mainType,m.index);g=g.parent}},v.prototype.enterEmphasis=function(g,m){Us(g,m),$a(h)},v.prototype.leaveEmphasis=function(g,m){Ws(g,m),$a(h)},v.prototype.enterBlur=function(g){S7(g),$a(h)},v.prototype.leaveBlur=function(g){Jk(g),$a(h)},v.prototype.enterSelect=function(g){C7(g),$a(h)},v.prototype.leaveSelect=function(g){T7(g),$a(h)},v.prototype.getModel=function(){return h.getModel()},v.prototype.getViewOfComponentModel=function(g){return h.getViewOfComponentModel(g)},v.prototype.getViewOfSeriesModel=function(g){return h.getViewOfSeriesModel(g)},v.prototype.getECUpdateCycleVersion=function(){return h[g0]},v.prototype.usingTHL=function(){return h._usingTHL},v}(m7))(h)},LU=function(h){function f(v,g){for(var m=0;m=0)){CO.push(r);var o=aU.wrapStageHandler(r,a);o.__prio=t,o.__raw=r,e.push(o)}}function UL(e,t){sA[e]=t}function rse(e){eG({createCanvas:e})}function OU(e,t,r){var n=dU("registerMap");n&&n(e,t,r)}function nse(e){var t=dU("getMap");return t&&t(e)}var zU=cie;Tu(RL,Rie);Tu($1,Oie);Tu($1,zie);Tu(RL,qie);Tu($1,Kie);Tu(SU,koe);VL(IH);GL(Eoe,Hae);UL("default",Bie);Xi({type:Fc,event:Fc,update:Fc},hr);Xi({type:Ex,event:Ex,update:Ex},hr);Xi({type:B_,event:qk,update:B_,action:hr,refineEvent:WL,publishNonRefinedEvent:!0});Xi({type:jM,event:qk,update:jM,action:hr,refineEvent:WL,publishNonRefinedEvent:!0});Xi({type:F_,event:qk,update:F_,action:hr,refineEvent:WL,publishNonRefinedEvent:!0});function WL(e,t,r,n){return{eventContent:{selected:ene(r),isFromClick:t.isFromClick||!1}}}FL("default",{});FL("dark",lU);var ase={},TO=[],ise={registerPreprocessor:VL,registerProcessor:GL,registerPostInit:DU,registerPostUpdate:jU,registerUpdateLifecycle:Z1,registerAction:Xi,registerCoordinateSystem:EU,registerLayout:RU,registerVisual:Tu,registerTransform:zU,registerLoading:UL,registerMap:OU,registerImpl:Qie,PRIORITY:CU,ComponentModel:ht,ComponentView:Yt,SeriesModel:Ut,ChartView:Rt,registerComponentModel:function(e){ht.registerClass(e)},registerComponentView:function(e){Yt.registerClass(e)},registerSeriesModel:function(e){Ut.registerClass(e)},registerChartView:function(e){Rt.registerClass(e)},registerCustomSeries:function(e,t){vU(e,t)},registerSubTypeDefaulter:function(e,t){ht.registerSubTypeDefaulter(e,t)},registerPainter:function(e,t){zG(e,t)}};function rt(e){if(ae(e)){R(e,function(t){rt(t)});return}Ye(TO,e)>=0||(TO.push(e),Le(e)&&(e={install:e}),e.install(ise))}function ap(e){return e==null?0:e.length||1}function MO(e){return e}var $s=function(){function e(t,r,n,a,i,o){this._old=t,this._new=r,this._oldKeyGetter=n||MO,this._newKeyGetter=a||MO,this.context=i,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={},a=new Array(t.length),i=new Array(r.length);this._initIndexMap(t,null,a,"_oldKeyGetter"),this._initIndexMap(r,n,i,"_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(i,n)},e.prototype._executeMultiple=function(){var t=this._old,r=this._new,n={},a={},i=[],o=[];this._initIndexMap(t,n,i,"_oldKeyGetter"),this._initIndexMap(r,a,o,"_newKeyGetter");for(var s=0;s1&&f===1)this._updateManyToOne&&this._updateManyToOne(c,u),a[l]=null;else if(h===1&&f>1)this._updateOneToMany&&this._updateOneToMany(c,u),a[l]=null;else if(h===1&&f===1)this._update&&this._update(c,u),a[l]=null;else if(h>1&&f>1)this._updateManyToMany&&this._updateManyToMany(c,u),a[l]=null;else if(h>1)for(var v=0;v1)for(var s=0;s30}var ip=Re,fl=oe,hse=typeof Int32Array>"u"?Array:Int32Array,dse="e\0\0",AO=-1,fse=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],vse=["_approximateExtent"],NO,_0,op,sp,gC,lp,mC,Fn=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,a=!1;FU(t)?(n=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(a=!0,n=t),n=n||["x","y"];for(var i={},o=[],s={},l=!1,u={},c=0;c=r)){var n=this._store,a=n.getProvider();this._updateOrdinalMeta();var i=this._nameList,o=this._idList,s=a.getSource().sourceFormat,l=s===Fa;if(l&&!a.pure)for(var u=[],c=t;c0},e.prototype.ensureUniqueItemVisual=function(t,r){var n=this._itemVisuals,a=n[t];a||(a=n[t]={});var i=a[r];return i==null&&(i=this.getVisual(r),ae(i)?i=i.slice():ip(i)&&(i=te({},i)),a[r]=i),i},e.prototype.setItemVisual=function(t,r,n){var a=this._itemVisuals[t]||{};this._itemVisuals[t]=a,ip(r)?te(a,r):a[r]=n},e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(t,r){ip(t)?te(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?te(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){R(this._graphicEls,function(n,a){n&&t&&t.call(r,n,a)})},e.prototype.cloneShallow=function(t){return t||(t=new e(this._schema?this._schema:fl(this.dimensions,this._getDimInfo,this),this.hostModel)),gC(t,this),t._store=this._store,t},e.prototype.wrapMethod=function(t,r){var n=this[t];Le(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var a=n.apply(this,arguments);return r.apply(this,[a].concat(x1(arguments)))})},e.internalField=function(){NO=function(t){var r=t._invertedIndicesMap;R(r,function(n,a){var i=t._dimInfos[a],o=i.ordinalMeta,s=t._store;if(o){n=r[a]=new hse(o.categories.length);for(var l=0;l1&&(l+="__ec__"+c),a[r]=l}}}(),e}();function pse(e,t){return wv(e,t).dimensions}function wv(e,t){kL(e)||(e=LL(e)),t=t||{};var r=t.coordDimensions||[],n=t.dimensionsDefine||e.dimensionsDefine||[],a=we(),i=[],o=gse(e,r,n,t.dimensionsCount),s=t.canOmitUnusedDimensions&&GU(o),l=n===e.dimensionsDefine,u=l?VU(e):$L(n),c=t.encodeDefine;!c&&t.encodeDefaulter&&(c=t.encodeDefaulter(e,o));for(var h=we(c),f=new UH(o),v=0;v0&&(I.name=I.name+(P-1))}),new BU({source:e,dimensions:i,fullDimensionCount:o,dimensionOmitted:s})}function gse(e,t,r,n){var a=Math.max(e.dimensionsDetectedCount||1,t.length,r.length,n||0);return R(t,function(i){var o;Re(i)&&(o=i.dimsDef)&&(a=Math.max(a,o.length))}),a}function mse(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 yse=function(){function e(t){this.coordSysDims=[],this.axisMap=we(),this.categoryAxisMap=we(),this.coordSysName=t}return e}();function xse(e){var t=e.get("coordinateSystem"),r=new yse(t),n=_se[t];if(n)return n(e,r,r.axisMap,r.categoryAxisMap),r}var _se={cartesian2d:function(e,t,r,n){var a=e.getReferringComponents("xAxis",pr).models[0],i=e.getReferringComponents("yAxis",pr).models[0];t.coordSysDims=["x","y"],r.set("x",a),r.set("y",i),_d(a)&&(n.set("x",a),t.firstCategoryDimIndex=0),_d(i)&&(n.set("y",i),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=1))},singleAxis:function(e,t,r,n){var a=e.getReferringComponents("singleAxis",pr).models[0];t.coordSysDims=["single"],r.set("single",a),_d(a)&&(n.set("single",a),t.firstCategoryDimIndex=0)},polar:function(e,t,r,n){var a=e.getReferringComponents("polar",pr).models[0],i=a.findAxisModel("radiusAxis"),o=a.findAxisModel("angleAxis");t.coordSysDims=["radius","angle"],r.set("radius",i),r.set("angle",o),_d(i)&&(n.set("radius",i),t.firstCategoryDimIndex=0),_d(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 a=e.ecModel,i=a.getComponent("parallel",e.get("parallelIndex")),o=t.coordSysDims=i.dimensions.slice();R(i.parallelAxisIndex,function(s,l){var u=a.getComponent("parallelAxis",s),c=o[l];r.set(c,u),_d(u)&&(n.set(c,u),t.firstCategoryDimIndex==null&&(t.firstCategoryDimIndex=l))})},matrix:function(e,t,r,n){var a=e.getReferringComponents("matrix",pr).models[0];t.coordSysDims=["x","y"];var i=a.getDimensionModel("x"),o=a.getDimensionModel("y");r.set("x",i),r.set("y",o),n.set("x",i),n.set("y",o)}};function _d(e){return e.get("type")==="category"}function HU(e,t,r){r=r||{};var n=r.byIndex,a=r.stackedCoordDimension,i,o,s;bse(t)?i=t:(o=t.schema,i=o.dimensions,s=t.store);var l=!!(e&&e.get("stack")),u,c,h,f,v=!0;function g(S){return S.type!=="ordinal"&&S.type!=="time"}if(R(i,function(S,C){ve(S)&&(i[C]=S={name:S}),g(S)||(v=!1)}),R(i,function(S,C){l&&!S.isExtraCoord&&(!n&&!u&&S.ordinalMeta&&(u=S),!c&&g(S)&&(!v||S.coordDim!=="x"&&S.coordDim!=="angle")&&(!a||a===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,x=0;R(i,function(S){S.coordDim===m&&x++});var _={name:h,coordDim:m,coordDimIndex:x,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length},w={name:f,coordDim:f,coordDimIndex:x+1,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:i.length+1};o?(s&&(_.storeDimIndex=s.ensureCalculationDimension(f,y),w.storeDimIndex=s.ensureCalculationDimension(h,y)),o.appendCalculationDimension(_),o.appendCalculationDimension(w)):(i.push(_),i.push(w))}return{stackedDimension:c&&c.name,stackedByDimension:u&&u.name,isStackedByIndex:n,stackedOverDimension:f,stackResultDimension:h}}function bse(e){return!FU(e.schema)}function Zs(e,t){return!!t&&t===e.getCalculationInfo("stackedDimension")}function ZL(e,t){return Zs(e,t)?e.getCalculationInfo("stackResultDimension"):t}function wse(e,t){var r=e.get("coordinateSystem"),n=yv.get(r),a;return t&&t.coordSysDims&&(a=oe(t.coordSysDims,function(i){var o={name:i},s=t.axisMap.get(i);if(s){var l=s.get("type");o.type=nb(l)}return o})),a||(a=n&&(n.getDimensionsInfo?n.getDimensionsInfo():n.dimensions.slice())||["x","y"]),a}function Sse(e,t,r){var n,a;return r&&R(e,function(i,o){var s=i.coordDim,l=r.categoryAxisMap.get(s);l&&(n==null&&(n=o),i.ordinalMeta=l.getOrdinalMeta(),t&&(i.createInvertedIndices=!0)),i.otherDims.itemName!=null&&(a=!0)}),!a&&n!=null&&(e[n].otherDims.itemName=0),n}function Jo(e,t,r){r=r||{};var n=t.getSourceManager(),a,i=!1;e?(i=!0,a=LL(e)):(a=n.getSource(),i=a.sourceFormat===Fa);var o=xse(t),s=wse(t,o),l=r.useEncodeDefaulter,u=Le(l)?l:l?nt(MH,s,t):null,c={coordDimensions:s,generateCoord:r.generateCoord,encodeDefine:t.getEncode(),encodeDefaulter:u,canOmitUnusedDimensions:!i},h=wv(a,c),f=Sse(h.dimensions,r.createInvertedIndices,o),v=i?null:n.getSharedDataStore(h),g=HU(t,{schema:h,store:v}),m=new Fn(h,t);m.setCalculationInfo(g);var y=f!=null&&Cse(a)?function(x,_,w,S){return S===f?w:this.defaultDimValueGetter(x,_,w,S)}:null;return m.hasItemOption=!1,m.initData(i?a:v,null,y),m}function Cse(e){if(e.sourceFormat===Fa){var t=Tse(e.data||[]);return!ae(ov(t))}}function Tse(e){for(var t=0;t=t[0]&&e<=t[1]},getExtent:function(){return this._extents[fa].slice()},getExtentUnsafe:function(e){return this._extents[e]},setExtent:function(e,t){kO(this._extents,fa,e,t)},setExtent2:function(e,t,r){var n=this._extents;n[e]||(n[e]=n[fa].slice()),kO(n,e,t,r)},freeze:function(){}};function kO(e,t,r,n){ah(r,n)&&(e[t][0]=r,e[t][1]=n)}function $U(e){return ib(e)||Bf(e)}function ib(e){return e.type==="interval"}function qm(e){return e.type==="time"}function Bf(e){return e.type==="log"}function Gn(e){return e.type==="ordinal"}function Ise(e){var t=M1(e),r=Dh(10,t),n=Fo(e/r);return n?n===2?n=3:n===3?n=5:n*=2:n=1,Mt(n*r,-t)}function ch(e){return _o(e)+2}function b0(e,t){return eh(e)/eh(t)}function yC(e,t,r){var n=r&&r.lookup;if(n){for(var a=0;a1&&i/o>2&&(a=Math.round(Math.ceil(a/o)*o)),a!==n[0]&&l(n[0],!0,!0);for(var s=a;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 sm=function(e){q(t,e);function t(r){var n=e.call(this)||this;n.type="ordinal",n.parse=t.parse,XL(n,t.decoratedMethods);var a=r.ordinalMeta;a||(a=new am({})),ae(a)&&(a=new am({categories:oe(a,function(o){return Re(o)?o.value:o})})),n._ordinalMeta=a;var i=YL(null,null,r.extent||[0,a.categories.length-1]);return n._mapper=i.mapper,qL(n),n}return t.parse=function(r){return r==null?r=NaN:ve(r)?(r=this._ordinalMeta.getOrdinal(r),r==null&&(r=NaN)):r=Fo(r),r},t.prototype.getTicks=function(){var r=[];return YU(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,a=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],o=0,s=this._ordinalMeta.categories.length,l=Et(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=Et(m,o[1]),y===g&&(m=o[1])}if(h.push({value:m}),m=Mt(m+a,s),u){var x=u.calcNiceTickMultiple(m,v);x>=0&&(m=Mt(m+x*a,s))}if(h.length>0&&m===h[h.length-1].value)break;if(h.length>f)return[]}var _=h.length?h[h.length-1].value:o[1];return i[1]>_&&h.push({value:r.expandToNicedExtent?Mt(_+a,s):i[1]}),c&&l.pruneTicksByBreak(r.pruneByBreak,h,u.breaks,function(w){return w.value},n.interval,i),c&&r.breakTicks!=="none"&&l.addBreaksToTicks(h,u.breaks,i),h},t.prototype.getMinorTicks=function(r){return KL(this,r,U_(this),this._cfg.interval)},t.prototype.getLabel=function(r,n){if(r==null)return"";var a=n&&n.precision;a==null?a=_o(r.value)||0:a==="auto"&&(a=this._cfg.intervalPrecision);var i=Mt(r.value,a,!0);return bL(i)},t.type="interval",t}(qi);qi.registerClass(Jl);var Dse=function(e,t,r,n){for(;r>>1;e[a][1]16?16:e>7.5?7:e>3.5?4:e>1.5?2:1}function Ese(e){var t=30*ii;return e/=t,e>6?6:e>3?3:e>2?2:1}function Rse(e){return e/=dg,e>12?12:e>6?6:e>3.5?4:e>2?2:1}function LO(e,t){return e/=t?vL:fL,e>30?30:e>20?20:e>15?15:e>10?10:e>5?5:e>2?2:1}function Ose(e){return at(A1(e,!0),1)}function zse(e,t,r){var n=Math.max(0,Ye(Ma,t)-1);return $_(new Date(e),Ma[n],r).getTime()}function Bse(e,t){var r=new Date(0);r[e](1);var n=r.getTime();r[e](1+t);var a=r.getTime()-n;return function(i,o){return Math.max(0,Math.round((o-i)/a))}}function Fse(e,t,r,n,a,i){var o=3e3,s=rae,l=0;function u(V,U,F,W,$,Z,J){for(var re=Bse($,V),Q=U,le=new Date(Q);Qo));)if(le[$](le[W]()+V),Q=le.getTime(),i){var de=i.calcNiceTickMultiple(Q,re);de>0&&(le[$](le[W]()+de*V),Q=le.getTime())}J.push({value:Q,notAdd:Q>n[1]})}function c(V,U,F){var W=[],$=!U.length;if(!qU(fg(V),n[0],n[1],r)){$&&(U=[{value:zse(n[0],V,r)},{value:n[1]}]);for(var Z=0;Z=n[0]&&J<=n[1]&&u(Q,J,re,le,de,He,W),V==="year"&&F.length>1&&Z===0&&F.unshift({value:F[0].value-Q})}}for(var Z=0;Z=n[0]&&S<=n[1]&&v++)}var C=a/t;if(v>C*1.5&&g>C/1.5||(h.push(_),v>C||e===s[m]))break}f=[]}}}for(var M=It(oe(h,function(V){return It(V,function(U){return U.value>=n[0]&&U.value<=n[1]&&!U.notAdd})}),function(V){return V.length>0}),A=M.length-1,k=[],m=0;mn[0])&&k.unshift({value:n[0],time:{level:0,upperTimeUnit:B,lowerTimeUnit:B},notNice:!0}),(!D||D.values&&(i=s);var l=w0.length,u=Math.min(Dse(w0,i,0,l),l-1),c=w0[u][1],h=w0[Math.max(u-1,0)][0];e.setTimeInterval({approxInterval:i,interval:c,minLevelUnit:h})};qi.registerClass(XU);var S0=0,C0=1,Gse=2,KU=function(e){q(t,e);function t(r){var n=e.call(this)||this;n.type="log",n.parse=Jl.parse,n.base=r.logBase||10;var a=[],i=[],o=n._lookup={from:a,to:i};a[S0]=a[C0]=i[S0]=i[C0]=NaN,XL(n,t.mapperMethods);var s=Mr(),l=r.breakOption,u={lookup:o};return s&&s.parseAxisBreakOptionInwardTransform(l,n,{noNegative:!0},Gse,u),n.powStub=new Jl({breakParsed:u.original}),n.intervalStub=new Jl({breakParsed:u.transformed}),qL(n,n.intervalStub),n}return t.prototype.getTicks=function(r){var n=this.base,a=this.powStub,i=Mr(),o=this.intervalStub,s=o.getExtent(),l=a.getExtent(),u={lookup:{from:s,to:l}};return oe(o.getTicks(r||{}),function(c){var h=c.value,f=yC(h,n,u),v;if(i){var g=i.getTicksBreakOutwardTransform(this,c,U_(a),this._lookup);g&&(v=g.vBreak,f=g.tickVal)}return{value:f,break:v}},this)},t.prototype.getMinorTicks=function(r){return KL(this,r,U_(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(b0(r,this.base))},scale:function(r){return yC(this.intervalStub.scale(r),this.base,null)},transformIn:function(r,n){return r=b0(r,this.base),n&&n.depth===Ps?r:this.intervalStub.transformIn(r,n)},transformOut:function(r,n){var a=n?n.depth:null;return IO.depth=a,PO.lookup=this._lookup,yC(a===Ps?r:this.intervalStub.transformOut(r,IO),this.base,PO)},contain:function(r){return this.powStub.contain(r)},setExtent:function(r,n){this.setExtent2(fa,r,n)},setExtent2:function(r,n,a){if(!(!ah(n,a)||n<=0||a<=0)){var i=DO,o=DO;if(r===fa){var s=this._lookup;i=s.to,o=s.from}this.powStub.setExtent2(r,i[S0]=n,i[C0]=a);var l=this.base;this.intervalStub.setExtent2(r,o[S0]=b0(n,l),o[C0]=b0(a,l))}},getFilter:function(){return{g:0}},sanitize:function(r,n){return ah(n[0],n[1])&&yi(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}(qi);qi.registerClass(KU);var IO={},PO={},DO=[],JU={value:1,category:1,time:1,log:1},QU=Qe();function Km(e){var t=e.get("type");return(t==null||!Se(JU,t)&&!qi.getClass(t))&&(t="value"),t}function Sv(e,t,r){var n=Mr(),a;switch(n&&(a=eW(e,t,r)),t){case"category":return new sm({ordinalMeta:e.getOrdinalMeta?e.getOrdinalMeta():e.getCategories(),extent:gn()});case"time":return new XU({locale:e.ecModel.getLocaleModel(),useUTC:e.ecModel.get("useUTC"),breakOption:a});case"log":return new KU({logBase:e.get("logBase"),breakOption:a});case"value":return new Jl({breakOption:a});default:return new(qi.getClass(t)||Jl)({})}}function Hse(e,t,r){var n=e.getExtentUnsafe(fa,null),a=n[0],i=n[1];return ah(a,i)?a===t||i===t?Wse:at?Use:uA:uA}var Use=1,Wse=2,uA=3;function $se(e){QU(e).noOnMyZero=!0}function Zse(e){return QU(e).noOnMyZero}function Jm(e){var t=e.getLabelModel().get("formatter");if(e.type==="time"){var r=nae(t);return function(a,i){return e.scale.getFormattedLabel(a,i,r)}}else{if(ve(t))return function(a){var i=e.scale.getLabel(a),o=t.replace("{value}",i??"");return o};if(Le(t)){if(e.type==="category")return function(a,i){return t(ob(e,a),a.value-e.scale.getExtent()[0],null)};var n=Mr();return function(a,i){var o=null;return n&&(o=n.makeAxisLabelFormatterParamBreak(o,a.break)),t(ob(e,a),i,o)}}else return function(a){return e.scale.getLabel(a)}}}function ob(e,t){var r=e.scale;return Gn(r)?r.getLabel(t):t.value}function JL(e){var t=e.get("interval");return t??"auto"}function Yse(e){return e.type==="category"&&JL(e.getLabelModel())===0}function Xse(e,t){var r={};return R(e.mapDimensionsAll(t),function(n){r[ZL(e,n)]=!0}),mt(r)}function Ff(e){return e==="middle"||e==="center"}function lm(e){return e.getShallow("show")}function eW(e,t,r){var n=e.get("breaks",!0);if(n!=null)return!Mr()||!r||!qse(t)?void 0:n}function qse(e){return e!=="category"}function tW(e,t,r,n,a,i){var o=Bf(e),s=o?e.intervalStub:e;if(s.setExtent(n[0],n[1]),o){var l=e.powStub,u={depth:Ps},c=e.transformOut(n[0],u),h=e.transformOut(n[1],u),f=Pse(r,n);t[0]&&!f[0]&&(c=a[0]),t[1]&&!f[1]&&(h=a[1]),l.setExtent(c,h)}s.setConfig(i)}function Cv(e,t){return Gn(e)?e.getRawOrdinalNumber(t.value):t.value}function Qm(e,t){return Gn(e)&&!!t.get("boundaryGap")}var Tv=function(){function e(){}return e.prototype.needIncludeZero=function(){return!this.option.scale},e.prototype.getCoordSysModel=function(){},e}(),Kse=lv(),sb="|&",Mv=Qe(),rW=-2,Jse=-1,Qse=Qe();function QL(e,t){var r=e.model,n=Mv(_v(r.ecModel)).keyed,a=n&&n.get(t);return a&&a.get(r.uid)}function ele(e,t){return aW(QL(e,t))}function tle(e,t){var r=[];return nW(e.model.ecModel,function(n){for(var a=0;a0&&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 C=up(t,r.get("startValue",!0)),M=C!=null;!yi(C)&&a&&(C=t.getDefaultStartValue?t.getDefaultStartValue():0),yi(C)&&(M||!_||w)&&(Ch[1]&&!f[1]&&(h[1]=C,f[1]=!0));var A=this._i={scale:t,dataMM:c,noZoomEffMM:h,zoomMM:[],fixMM:f,zoomFixMM:[!1,!1],startValue:C,isBlank:x,incl0:w,tggAxInv:S,ctnShp:i};jO(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,a=t.zoomFixMM,i=t.fixMM,o={fixMM:i,zoomFixMM:a,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],i[0]=a[0]=!0),r[1]!=null&&(s[1]=r[1],i[1]=a[1]=!0),jO(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 jO(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),jx(t))}function up(e,t){return t==null?null:yn(t)?NaN:e.parse(t)}function ule(e,t){var r;if(Gn(e))r=[0,0];else{var n=t.get("boundaryGap");typeof n=="boolean"&&(n=null),r=ae(n)?n:[n,n]}return[EO(r[0]),EO(r[1])]}function EO(e){return Bo(typeof e=="boolean"?0:e,1)||0}function lW(e){var t=ole(e.scale);return t.extent||(t.extent=gn()),t}function cle(e,t){lW(e).dimIdxInCoord=t.get(e.dim)}function fh(e,t){var r=e.scale,n=e.model,a=e.dim;r.rawExtentInfo||hle(r,e,a,n,t)}function hle(e,t,r,n,a){var i=lW(t),o=i.extent,s=!1;rle(t,function(c){if(c.boxCoordinateSystem){var h=fH(c).coord,f=i.dimIdxInCoord;if(f>=0){if(ae(h)){var v=h[f];v!=null&&!ae(v)&&NM(o,e.parse(v))}}}else if(c.coordinateSystem){var g=c.getData();if(g){var m=e.getFilter?e.getFilter():null;R(Xse(g,r),function(y){Gte(o,g.getApproximateExtent(y,m))})}c.__requireStartValue&&c.__requireStartValue(t)&&(s=!0)}});var l=fle(e,t,n),u=new sW(e,n,o,s,l);uW(e,u,a),i.extent=null}function dle(e,t){var r=e.scale;uW(r,new sW(r,e.model,t,!1,!1),lle)}function uW(e,t,r){e.rawExtentInfo=t,t.from=r}function K1(e,t){rI.set(e,t)}var rI=we();function cW(e,t,r,n,a){e.rawExtentInfo||dle({scale:e,model:t},a||gn());var i=e.rawExtentInfo.makeFinal(),o=i.effMM;return e.setExtent(o[0],o[1]),e.setBlank(i.isBlank),n&&i.tggAxInv&&r&&!r.get("legacyMinMaxDontInverseAxis")&&(n.inverse=!n.inverse),i}function fle(e,t,r){var n=Qm(e,r),a=r.get("containShape",!0);if(a==null&&!n&&(a=!0),!a)return!1;var i=!1;return iW(t,function(o){i=!!rI.get(o)||i}),i}function vle(e,t,r,n){if(r.ctnShp){var a;if(iW(e,function(s){var l=rI.get(s);if(l){var u=l(e,n);u&&(a=a||[0,0],QG(a,u[0]),e7(a,u[1]),$se(e))}}),!!a){var i=t.getExtent();if(Gn(t))e.onBand||t.setExtent2(im,Et(i[0],i[0]+a[0]),at(i[1],i[1]+a[1]));else{var o=i.slice();r.zoomFixMM[0]||(o[0]=Et(o[0],t.transformOut(t.transformIn(o[0],null)+a[0],null))),r.zoomFixMM[1]||(o[1]=at(o[1],t.transformOut(t.transformIn(o[1],null)+a[1],null))),(o[0]i[1])&&t.setExtent2(im,o[0],o[1])}}}}function RO(e,t){var r=Bf(e),n=r?e.intervalStub:e,a=t.fixMinMax||[],i=r?e.getExtent():null,o=n.getExtent(),s=ZU(o,a,t.rawExtentResult);n.setExtent(s[0],s[1]),s=n.getExtent();var l=r?gle(n,t):ple(n,t),u=l.intervalPrecision,c=l.interval,h=t.userInterval;h!=null&&(l.interval=h,l.intervalPrecision=ch(h)),a[0]||(s[0]=Mt(mi(s[0]/c)*c,u)),a[1]||(s[1]=Mt(Ph(s[1]/c)*c,u)),h!=null&&(l.niceExtent=s.slice()),tW(e,a,o,s,i,l)}function ple(e,t){var r=X1(t.splitNumber,5),n=Y1(e),a=t.minInterval,i=t.maxInterval,o=A1(n/r,!0);a!=null&&oi&&(o=i);var s=ch(o),l=e.getExtent(),u=[Mt(Ph(l[0]/o)*o,s),Mt(mi(l[1]/o)*o,s)];return{interval:o,intervalPrecision:s,niceExtent:u}}function gle(e,t){var r=X1(t.splitNumber,10),n=e.getExtent(),a=Y1(e),i=at(Bk(a),1),o=r/a*i;o<=.5&&(i*=10);var s=ch(i),l=[Mt(Ph(n[0]/i)*i,s),Mt(mi(n[1]/i)*i,s)];return{intervalPrecision:s,interval:i,niceExtent:l}}function Gf(e){var t=e.scale,r=e.model,n=r.axis,a=r.ecModel;hW(t,r,n,a,null)}function hW(e,t,r,n,a){var i=cW(e,t,n,r,a),o=ib(e)||qm(e);dW(e,{splitNumber:t.get("splitNumber"),fixMinMax:i.fixMM,userInterval:t.get("interval"),minInterval:o?t.get("minInterval"):null,maxInterval:o?t.get("maxInterval"):null,rawExtentResult:i}),r&&n&&vle(r,e,i,n)}function dW(e,t){mle[e.type](e,t)}var mle={interval:RO,log:RO,time:Vse,ordinal:hr};function yle(e){return Jo(null,e)}var xle={isDimensionStacked:Zs,enableDataStack:HU,getStackedDimension:ZL};function _le(e,t){var r=t;t instanceof vt||(r=new vt(t));var n=Km(r),a=Sv(r,n,!1);return e[1]a&&(n=o,a=l)}if(n)return Mle(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 a=[1/0,1/0],i=[-1/0,-1/0],o=this.geometries;return R(o,function(s){s.type==="polygon"?zO(s.exterior,a,i,r):R(s.points,function(l){zO(l,a,i,r)})}),isFinite(a[0])&&isFinite(a[1])&&isFinite(i[0])&&isFinite(i[1])||(a[0]=a[1]=i[0]=i[1]=0),n=new je(a[0],a[1],i[0]-a[0],i[1]-a[1]),r||(this._rect=n),n},t.prototype.contain=function(r){var n=this.getBoundingRect(),a=this.geometries;if(!n.contain(r[0],r[1]))return!1;e:for(var i=0,o=a.length;i>1^-(s&1),l=l>>1^-(l&1),s+=a,l+=i,a=s,i=l,n.push([s/r,l/r])}return n}function dA(e,t){return e=Nle(e),oe(It(e.features,function(r){return r.geometry&&r.properties&&r.geometry.coordinates.length>0}),function(r){var n=r.properties,a=r.geometry,i=[];switch(a.type){case"Polygon":var o=a.coordinates;i.push(new BO(o[0],o.slice(1)));break;case"MultiPolygon":R(a.coordinates,function(l){l[0]&&i.push(new BO(l[0],l.slice(1)))});break;case"LineString":i.push(new FO([a.coordinates]));break;case"MultiLineString":i.push(new FO(a.coordinates))}var s=new vW(n[t||"name"],i,n.cp);return s.properties=n,s})}const kle=Object.freeze(Object.defineProperty({__proto__:null,MAX_SAFE_INTEGER:Yg,asc:on,getPercentWithPrecision:wte,getPixelPrecision:bte,getPrecision:_o,getPrecisionSafe:GG,isNumeric:Fk,isRadianAroundZero:th,linearMap:Nt,nice:A1,numericToNumber:Vo,parseDate:qo,parsePercent:me,quantile:Dx,quantity:Bk,quantityExponent:M1,reformIntervals:MM,remRadian:zk,round:_te},Symbol.toStringTag,{value:"Module"})),Lle=Object.freeze(Object.defineProperty({__proto__:null,format:Zm,parse:qo,roundTime:$_},Symbol.toStringTag,{value:"Module"})),Ile=Object.freeze(Object.defineProperty({__proto__:null,Arc:Um,BezierCurve:dv,BoundingRect:je,Circle:Ko,CompoundPath:Wm,Ellipse:Hm,Group:De,Image:Qr,IncrementalDisplayable:z7,Line:Tr,LinearGradient:Eh,Polygon:Sn,Polyline:un,RadialGradient:tL,Rect:it,Ring:hv,Sector:wn,Text:wt,clipPointsByRect:iL,clipRectByRect:W7,createIcon:pv,extendPath:H7,extendShape:G7,getShapeClass:Jg,getTransform:Vc,initProps:Qt,makeImage:nL,makePath:Ef,mergePath:Na,registerShape:Si,resizePath:aL,updateProps:At},Symbol.toStringTag,{value:"Module"})),Ple=Object.freeze(Object.defineProperty({__proto__:null,addCommas:bL,capitalFirst:hae,encodeHTML:On,formatTime:cae,formatTpl:SL,getTextRect:uae,getTooltipMarker:cH,normalizeCssArray:mv,toCamelCase:wL,truncateText:ire},Symbol.toStringTag,{value:"Module"})),Dle=Object.freeze(Object.defineProperty({__proto__:null,bind:be,clone:ke,curry:nt,defaults:Ee,each:R,extend:te,filter:It,indexOf:Ye,inherits:kk,isArray:ae,isFunction:Le,isObject:Re,isString:ve,map:oe,merge:Je,reduce:gi},Symbol.toStringTag,{value:"Module"}));var jle=Qe(),pg=Qe(),Ui={estimate:1,determine:2};function lb(e){return{out:{noPxChangeTryDetermine:[]},kind:e}}function Ele(e,t){var r=e.getLabelModel().get("customValues");if(r){var n=e.scale;return{labels:oe(gW(r,n),function(a,i){return{formattedLabel:Jm(e)(a,i),rawLabel:n.getLabel(a),tick:a}})}}return e.type==="category"?Ole(e,t):Ble(e)}function Rle(e,t,r){var n=e.scale,a=e.getTickModel().get("customValues");return a?{ticks:gW(a,n)}:e.type==="category"?zle(e,t):{ticks:n.getTicks(r)}}function gW(e,t){var r=t.getExtent(),n=[];return R(e,function(a){a=t.parse(a),a>=r[0]&&a<=r[1]&&n.push(a)}),N1(n,$te,null),on(n),oe(n,function(a){return{value:a}})}function Ole(e,t){var r=e.getLabelModel(),n=mW(e,r,t);return!r.get("show")||e.scale.isBlank()?{labels:[]}:n}function mW(e,t,r){var n=Vle(e),a=JL(t),i=r.kind===Ui.estimate;if(!i){var o=xW(n,a);if(o)return o}var s,l;Le(a)?s=ub(e,a,!1):(l=a==="auto"?Gle(e,r):a,s=ub(e,l,!1));var u={labels:s,labelCategoryInterval:l};return i?r.out.noPxChangeTryDetermine.push(function(){return fA(n,a,u),!0}):fA(n,a,u),u}function zle(e,t){var r=Fle(e),n=JL(t),a=xW(r,n);if(a)return a;var i,o;if((!t.get("show")||e.scale.isBlank())&&(i=[]),Le(n))i=ub(e,n,!0);else if(n==="auto"){var s=mW(e,e.getLabelModel(),lb(Ui.determine));o=s.labelCategoryInterval,i=oe(s.labels,function(l){return l.tick})}else o=n,i=ub(e,o,!0);return fA(r,n,{ticks:i,tickCategoryInterval:o})}function Ble(e){var t=e.scale.getTicks(),r=Jm(e);return{labels:oe(t,function(n,a){return{formattedLabel:r(n,a),rawLabel:e.scale.getLabel(n),tick:n}})}}var Fle=yW("axisTick"),Vle=yW("axisLabel");function yW(e){return function(r){return pg(r)[e]||(pg(r)[e]={list:[]})}}function xW(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),v=Math.abs(f*Math.cos(i)),g=Math.abs(f*Math.sin(i)),m=0,y=0;h<=s[1];h+=u){var x=0,_=0,w=S1(a({value:h}),n.font,"center","top");x=w.width*1.3,_=w.height*1.3,m=Math.max(m,x,7),y=Math.max(y,_,7)}var S=m/v,C=y/g;isNaN(S)&&(S=1/0),isNaN(C)&&(C=1/0);var M=Math.max(0,Math.floor(Math.min(S,C)));if(r===Ui.estimate)return t.out.noPxChangeTryDetermine.push(be(Ule,null,e,M,l)),M;var A=_W(e,M,l);return A??M}function Ule(e,t,r){return _W(e,t,r)==null}function _W(e,t,r){var n=jle(e.model),a=e.getExtent(),i=n.lastAutoInterval,o=n.lastTickCount;if(i!=null&&o!=null&&Math.abs(i-t)<=1&&Math.abs(o-r)<=1&&i>t&&n.axisExtent0===a[0]&&n.axisExtent1===a[1])return i;n.lastTickCount=r,n.lastAutoInterval=t,n.axisExtent0=a[0],n.axisExtent1=a[1]}function Wle(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 ub(e,t,r){var n=Jm(e),a=e.scale,i=[],o=Le(t);return YU(a,o?0:t,function(s,l){var u=a.getLabel(s);if(o){var c=!!t(s.value,u);if(s.offInterval=!c,!c&&!l)return}i.push(r?s:{formattedLabel:n(s),rawLabel:u,tick:s})}),i}var $le=.8;function Cn(e,t){t=t||{};var r={w:NaN,w2:NaN},n=e.scale,a=t.fromStat,i=t.min,o=kse(n);yi(o)||(o=NaN);var s=e.getExtent(),l=cr(s[1]-s[0]);return Gn(n)?Zle(r,e,o,l):a&&Yle(r,e,o,l,a),i!=null&&(r.w=yi(r.w)?at(i,r.w):i),r}function Zle(e,t,r,n){var a=t.onBand,i=r+(a?1:0);i===0&&(i=1),e.w=n/i,!a&&r&&n&&(e.w2=e.w*r/n)}function Yle(e,t,r,n,a){var i=!1,o=-1/0;R(a.key?[ele(t,a.key)]:tle(t,a.sers||[]),function(s){var l=s.liPosMinGap;l!=null&&(l>0?(l>o&&(o=l),i=!1):l===rW&&(i=!0))}),yi(r)&&r>0&&yi(o)?(e.w=n/r*o,e.w2=o):i&&(e.w=n*$le,e.w2=e.w*r/n)}var VO=[0,1],Ci=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]),a=Math.max(r[0],r[1]);return t>=n&&t<=a},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)),Nt(t,VO,GO(this),r)},e.prototype.coordToData=function(t,r){var n=Nt(t,GO(this),VO,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=Rle(this,r,{breakTicks:t.breakTicks,pruneByBreak:t.pruneByBreak}),a=oe(n.ticks,function(s){return{coord:this.dataToCoord(Cv(this.scale,s)),tick:s}},this),i=r.get("alignWithLabel"),o=Xle(this,a,i);return oe(a,function(s){return{coord:s.coord,tickValue:s.tick.value,onBand:o}})},e.prototype.getMinorTicksCoords=function(){if(Gn(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),a=oe(n,function(i){return oe(i,function(o){return{coord:this.dataToCoord(o),tickValue:o}},this)},this);return a},e.prototype.getViewLabels=function(t){return t=t||lb(Ui.determine),Ele(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 Cn(this,{min:1}).w},e.prototype.calculateCategoryInterval=function(t){return t=t||lb(Ui.determine),Hle(this,t)},e}();function GO(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 Xle(e,t,r){var n=t.length;if(!e.onBand||r||!n)return!1;var a=Cn(e).w;if(!a)return!1;R(t,function(s){s.coord-=a/2});var i=e.scale.getExtent(),o=t[n-1];return o.tick.offInterval&&t.pop(),t.push({coord:o.coord+a,tick:{value:i[1]+1}}),!0}function qle(e){var t=ht.extend(e);return ht.registerClass(t),t}function Kle(e){var t=Yt.extend(e);return Yt.registerClass(t),t}function Jle(e){var t=Ut.extend(e);return Ut.registerClass(t),t}function Qle(e){var t=Rt.extend(e);return Rt.registerClass(t),t}var cp=Math.PI*2,oc=Go.CMD,eue=["top","right","bottom","left"];function tue(e,t,r,n,a){var i=r.width,o=r.height;switch(e){case"top":n.set(r.x+i/2,r.y-t),a.set(0,-1);break;case"bottom":n.set(r.x+i/2,r.y+o+t),a.set(0,1);break;case"left":n.set(r.x-t,r.y+o/2),a.set(-1,0);break;case"right":n.set(r.x+i+t,r.y+o/2),a.set(1,0);break}}function rue(e,t,r,n,a,i,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-a)%cp<1e-4)return l[0]=c,l[1]=h,u-r;if(i){var f=n;n=Ia(a),a=Ia(f)}else n=Ia(n),a=Ia(a);n>a&&(a+=cp);var v=Math.atan2(s,o);if(v<0&&(v+=cp),v>=n&&v<=a||v+cp>=n&&v+cp<=a)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(a)+e,x=r*Math.sin(a)+t,_=(g-o)*(g-o)+(m-s)*(m-s),w=(y-o)*(y-o)+(x-s)*(x-s);return _0){t=t/180*Math.PI,Ei.fromArray(e[0]),Kt.fromArray(e[1]),Cr.fromArray(e[2]),Oe.sub(wo,Ei,Kt),Oe.sub(xo,Cr,Kt);var r=wo.len(),n=xo.len();if(!(r<.001||n<.001)){wo.scale(1/r),xo.scale(1/n);var a=wo.dot(xo),i=Math.cos(t);if(i1&&Oe.copy(Kn,Cr),Kn.toArray(e[1])}}}}function iue(e,t,r){if(r<=180&&r>0){r=r/180*Math.PI,Ei.fromArray(e[0]),Kt.fromArray(e[1]),Cr.fromArray(e[2]),Oe.sub(wo,Kt,Ei),Oe.sub(xo,Cr,Kt);var n=wo.len(),a=xo.len();if(!(n<.001||a<.001)){wo.scale(1/n),xo.scale(1/a);var i=wo.dot(t),o=Math.cos(r);if(i=l)Oe.copy(Kn,Cr);else{Kn.scaleAndAdd(xo,s/Math.tan(Math.PI/2-c));var h=Cr.x!==Kt.x?(Kn.x-Kt.x)/(Cr.x-Kt.x):(Kn.y-Kt.y)/(Cr.y-Kt.y);if(isNaN(h))return;h<0?Oe.copy(Kn,Kt):h>1&&Oe.copy(Kn,Cr)}Kn.toArray(e[1])}}}}function bC(e,t,r,n){var a=r==="normal",i=a?e:e.ensureState(r);i.ignore=t;var o=n.get("smooth");o=o===!0?.3:Math.max(+o,0)||0,i.shape=i.shape||{},i.shape.smooth=o;var s=n.getModel("lineStyle").getLineStyle();a?e.useStyle(s):i.style=s}function oue(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 a=Ss(n[0],n[1]),i=Ss(n[1],n[2]);if(!a||!i){e.lineTo(n[1][0],n[1][1]),e.lineTo(n[2][0],n[2][1]);return}var o=Math.min(a,i)*r,s=ig([],n[1],n[0],o/a),l=ig([],n[1],n[2],o/i),u=ig([],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(P*I,0,i);var j=P+A;j<0&&C(-j*I,1)}else C(-A*I,1)}}function S(A,k,I){A!==0&&(c=!0);for(var P=k;P0)for(var j=0;j0;j--){var H=I[j-1]*B;S(-H,j,i)}}}function M(A){var k=A<0?-1:1;A=Math.abs(A);for(var I=Math.ceil(A/(i-1)),P=0;P0?S(I,0,P+1):S(-I,i-P-1,i),A-=I,A<=0)return}return c}function uue(e){for(var t=0;t=0&&n.attr(i.oldLayoutSelect),Ye(f,"emphasis")>=0&&n.attr(i.oldLayoutEmphasis)),At(n,u,r,l)}else if(n.attr(u),!gv(n).valueAnimation){var h=Te(n.style.opacity,1);n.style.opacity=0,Qt(n,{style:{opacity:h}},r,l)}if(i.oldLayout=u,n.states.select){var v=i.oldLayoutSelect={};T0(v,u,M0),T0(v,n.states.select,M0)}if(n.states.emphasis){var g=i.oldLayoutEmphasis={};T0(g,u,M0),T0(g,n.states.emphasis,M0)}K7(n,l,c,r,r)}if(a&&!a.ignore&&!a.invisible){var i=due(a),o=i.oldLayout,m={points:a.shape.points};o?(a.attr({shape:o}),At(a,{shape:m},r)):(a.setShape(m),a.style.strokePercent=0,Qt(a,{style:{strokePercent:1}},r)),i.oldLayout=m}},e}(),CC=Qe();function vue(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){var a=CC(r).labelManager;a||(a=CC(r).labelManager=new fue),a.clearLabels()}),e.registerUpdateLifecycle("series:layoutlabels",function(t,r,n){var a=CC(r).labelManager;R(n.updatedSeries,function(i){a.addLabelsOfSeries(r.getViewOfSeriesModel(i))}),a.updateLayoutConfig(r),a.layout(r),a.processLabelsOverall()})}var TC=Math.sin,MC=Math.cos,AW=Math.PI,sc=Math.PI*2,pue=180/AW,NW=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,a,i,o){this._add("C",t,r,n,a,i,o)},e.prototype.quadraticCurveTo=function(t,r,n,a){this._add("Q",t,r,n,a)},e.prototype.arc=function(t,r,n,a,i,o){this.ellipse(t,r,n,n,0,a,i,o)},e.prototype.ellipse=function(t,r,n,a,i,o,s,l){var u=s-o,c=!l,h=Math.abs(u),f=Dl(h-sc)||(c?u>=sc:-u>=sc),v=u>0?u%sc:u%sc+sc,g=!1;f?g=!0:Dl(h)?g=!1:g=v>=AW==!!c;var m=t+n*MC(o),y=r+a*TC(o);this._start&&this._add("M",m,y);var x=Math.round(i*pue);if(f){var _=1/this._p,w=(c?1:-1)*(sc-_);this._add("A",n,a,x,1,+c,t+n*MC(o+w),r+a*TC(o+w)),_>.01&&this._add("A",n,a,x,0,+c,m,y)}else{var S=t+n*MC(s),C=r+a*TC(s);this._add("A",n,a,x,+g,+c,S,C)}},e.prototype.rect=function(t,r,n,a){this._add("M",t,r),this._add("l",n,0),this._add("l",0,a),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,a,i,o,s,l,u){for(var c=[],h=this._p,f=1;f"}function Cue(e){return""}function oI(e,t){t=t||{};var r=t.newline?` +`:"";function n(a){var i=a.children,o=a.tag,s=a.attrs,l=a.text;return Sue(o,s)+(o!=="style"?On(l):l||"")+(i?""+r+oe(i,function(u){return n(u)}).join(r)+r:"")+Cue(o)}return n(e)}function Tue(e,t,r){r=r||{};var n=r.newline?` +`:"",a=" {"+n,i=n+"}",o=oe(mt(e),function(l){return l+a+oe(mt(e[l]),function(u){return u+":"+e[l][u]+";"}).join(n)+i}).join(n),s=oe(mt(t),function(l){return"@keyframes "+l+a+oe(mt(t[l]),function(u){return u+a+oe(mt(t[l][u]),function(c){var h=t[l][u][c];return c==="d"&&(h='path("'+h+'")'),c+":"+h+";"}).join(n)+i}).join(n)+i}).join(n);return!o&&!s?"":[""].join(n)}function yA(e){return{zrId:e,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function YO(e,t,r,n){return Xr("svg","root",{width:e,height:t,xmlns:kW,"xmlns:xlink":LW,version:"1.1",baseProfile:"full",viewBox:n?"0 0 "+e+" "+t:!1},r)}var Mue=0;function PW(){return Mue++}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"},gc="transform-origin";function Aue(e,t,r){var n=te({},e.shape);te(n,t),e.buildPath(r,n);var a=new NW;return a.reset(IG(e)),r.rebuildPath(a,1),a.generateStr(),a.getStr()}function Nue(e,t){var r=t.originX,n=t.originY;(r||n)&&(e[gc]=r+"px "+n+"px")}var kue={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function DW(e,t){var r=t.zrId+"-ani-"+t.cssAnimIdx++;return t.cssAnims[r]=e,r}function Lue(e,t,r){var n=e.shape.paths,a={},i,o;if(R(n,function(l){var u=yA(r.zrId);u.animation=!0,Q1(l,{},u,!0);var c=u.cssAnims,h=u.cssNodes,f=mt(c),v=f.length;if(v){o=f[v-1];var g=c[o];for(var m in g){var y=g[m];a[m]=a[m]||{d:""},a[m].d+=y.d||""}for(var x in h){var _=h[x].animation;_.indexOf(o)>=0&&(i=_)}}}),!!i){t.d=!1;var s=DW(a,r);return i.replace(o,s)}}function qO(e){return ve(e)?XO[e]?"cubic-bezier("+XO[e]+")":Dk(e)?e:"":""}function Q1(e,t,r,n){var a=e.animators,i=a.length,o=[];if(e instanceof Wm){var s=Lue(e,t,r);if(s)o.push(s);else if(!i)return}else if(!i)return;for(var l={},u=0;u0}).length){var He=DW(A,r);return He+" "+_[0]+" both"}}for(var y in l){var s=m(l[y]);s&&o.push(s)}if(o.length){var x=r.zrId+"-cls-"+PW();r.cssNodes["."+x]={animation:o.join(",")},t.class=x}}function Iue(e,t,r){if(!e.ignore)if(e.isSilent()){var n={"pointer-events":"none"};KO(n,t,r)}else{var a=e.states.emphasis&&e.states.emphasis.style?e.states.emphasis.style:{},i=a.fill;if(!i){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&&(i=I_(l))}var u=a.lineWidth;if(u){var c=!a.strokeNoScale&&e.transform?e.transform[0]:1;u=u/c}var n={cursor:"pointer"};i&&(n.fill=i),a.stroke&&(n.stroke=a.stroke),u&&(n["stroke-width"]=u),KO(n,t,r)}}function KO(e,t,r,n){var a=JSON.stringify(e),i=r.cssStyleCache[a];i||(i=r.zrId+"-cls-"+PW(),r.cssStyleCache[a]=i,r.cssNodes["."+i+":hover"]=e),t.class=t.class?t.class+" "+i:i}var um=Math.round;function jW(e){return e&&ve(e.src)}function EW(e){return e&&Le(e.toDataURL)}function sI(e,t,r,n){_ue(function(a,i){var o=a==="fill"||a==="stroke";o&&LG(i)?OW(t,e,a,n):o&&Ek(i)?zW(r,e,a,n):e[a]=i,o&&n.ssr&&i==="none"&&(e["pointer-events"]="visible")},t,r,!1),zue(r,e,n)}function lI(e,t){var r=BG(t);r&&(r.each(function(n,a){n!=null&&(e[(ZO+a).toLowerCase()]=n+"")}),t.isSilent()&&(e[ZO+"silent"]="true"))}function JO(e){return Dl(e[0]-1)&&Dl(e[1])&&Dl(e[2])&&Dl(e[3]-1)}function Pue(e){return Dl(e[4])&&Dl(e[5])}function uI(e,t,r){if(t&&!(Pue(t)&&JO(t))){var n=1e4;e.transform=JO(t)?"translate("+um(t[4]*n)/n+" "+um(t[5]*n)/n+")":Dee(t)}}function QO(e,t,r){for(var n=e.points,a=[],i=0;i"u"){var y="Image width/height must been given explictly in svg-ssr renderer.";bn(f,y),bn(v,y)}else if(f==null||v==null){var x=function(P,j){if(P){var z=P.elm,D=f||j.width,B=v||j.height;P.tag==="pattern"&&(u?(B=1,D/=i.width):c&&(D=1,B/=i.height)),P.attrs.width=D,P.attrs.height=B,z&&(z.setAttribute("width",D),z.setAttribute("height",B))}},_=$k(g,null,e,function(P){l||x(M,P),x(h,P)});_&&_.width&&_.height&&(f=f||_.width,v=v||_.height)}h=Xr("image","img",{href:g,width:f,height:v}),o.width=f,o.height=v}else a.svgElement&&(h=ke(a.svgElement),o.width=a.svgWidth,o.height=a.svgHeight);if(h){var w,S;l?w=S=1:u?(S=1,w=o.width/i.width):c?(w=1,S=o.height/i.height):o.patternUnits="userSpaceOnUse",w!=null&&!isNaN(w)&&(o.width=w),S!=null&&!isNaN(S)&&(o.height=S);var C=PG(a);C&&(o.patternTransform=C);var M=Xr("pattern","",o,[h]),A=oI(M),k=n.patternCache,I=k[A];I||(I=n.zrId+"-p"+n.patternIdx++,k[A]=I,o.id=I,M=n.defs[I]=Xr("pattern",I,o,[h])),t[r]=w1(I)}}function Bue(e,t,r){var n=r.clipPathCache,a=r.defs,i=n[e.id];if(!i){i=r.zrId+"-c"+r.clipPathIdx++;var o={id:i};n[e.id]=i,a[i]=Xr("clipPath",i,o,[RW(e,r)])}t["clip-path"]=w1(i)}function r5(e){return document.createTextNode(e)}function Sc(e,t,r){e.insertBefore(t,r)}function n5(e,t){e.removeChild(t)}function a5(e,t){e.appendChild(t)}function BW(e){return e.parentNode}function FW(e){return e.nextSibling}function AC(e,t){e.textContent=t}var i5=58,Fue=120,Vue=Xr("","");function xA(e){return e===void 0}function go(e){return e!==void 0}function Gue(e,t,r){for(var n={},a=t;a<=r;++a){var i=e[a].key;i!==void 0&&(n[i]=a)}return n}function Vp(e,t){var r=e.key===t.key,n=e.tag===t.tag;return n&&r}function cm(e){var t,r=e.children,n=e.tag;if(go(n)){var a=e.elm=IW(n);if(cI(Vue,e),ae(r))for(t=0;ti?(g=r[l+1]==null?null:r[l+1].elm,VW(e,g,r,a,l)):vb(e,t,n,i))}function jd(e,t){var r=t.elm=e.elm,n=e.children,a=t.children;e!==t&&(cI(e,t),xA(t.text)?go(n)&&go(a)?n!==a&&Hue(r,n,a):go(a)?(go(e.text)&&AC(r,""),VW(r,null,a,0,a.length-1)):go(n)?vb(r,n,0,n.length-1):go(e.text)&&AC(r,""):e.text!==t.text&&(go(n)&&vb(r,n,0,n.length-1),AC(r,t.text)))}function Uue(e,t){if(Vp(e,t))jd(e,t);else{var r=e.elm,n=BW(r);cm(t),n!==null&&(Sc(n,t.elm,FW(r)),vb(n,[e],0,0))}return t}var Wue=0,$ue=function(){function e(t,r,n){if(this.type="svg",this.configLayer=Zue(),this.storage=r,this._opts=n=te({},n),this.root=t,this._id="zr"+Wue++,this._oldVNode=YO(n.width,n.height),t&&!n.ssr){var a=this._viewport=document.createElement("div");a.style.cssText="position:relative;overflow:hidden";var i=this._svgDom=this._oldVNode.elm=IW("svg");cI(null,this._oldVNode),a.appendChild(i),t.appendChild(a)}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",Uue(this._oldVNode,t),this._oldVNode=t}},e.prototype.renderOneToVNode=function(t){return t5(t,yA(this._id))},e.prototype.renderToVNode=function(t){t=t||{};var r=this.storage.getDisplayList(!0),n=this._width,a=this._height,i=yA(this._id);i.animation=t.animation,i.willUpdate=t.willUpdate,i.compress=t.compress,i.emphasis=t.emphasis,i.ssr=this._opts.ssr;var o=[],s=this._bgVNode=Yue(n,a,this._backgroundColor,i);s&&o.push(s);var l=t.compress?null:this._mainVNode=Xr("g","main",{},[]);this._paintList(r,i,l?l.children:o),l&&o.push(l);var u=oe(mt(i.defs),function(f){return i.defs[f]});if(u.length&&o.push(Xr("defs","defs",{},u)),t.animation){var c=Tue(i.cssNodes,i.cssAnims,{newline:!0});if(c){var h=Xr("style","stl",{},[],c);o.push(h)}}return YO(n,a,o,t.useViewBox)},e.prototype.renderToString=function(t){return t=t||{},oI(this.renderToVNode({animation:Te(t.cssAnimation,!0),emphasis:Te(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Te(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 a=t.length,i=[],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=i[o-1];for(var x=m+1;x=s)}}for(var h=s5(this),f=h.startIdx;f=0)&&(o=!0)}),!(!o&&!i.__dirty)){var s=n._opts.useDirtyRect&&!NC(i)?i.createRepaintRects(t,r,n._width,n._height):null,l=n._i.layerStack[0],u=!0;if(i.__dirty){u=!1,i.__dirty=!1;var c=i.zlevel===l.zl&&i.zlevel2===l.zl2?n._backgroundColor:null;i.clear(!1,c,s)}A0(i,function(h){var f=n._paintPerCursor(i,h,t,s,u);a=a&&f})}},N0),xt.wxa&&In(this._i,function(i){i&&i.ctx&&i.ctx.draw&&i.ctx.draw()}),a},e.prototype._paintPerCursor=function(t,r,n,a,i){var o=t.ctx;if(a)if(!a.length)r.drawIdx=r.endIdx;else for(var s=this.dpr,l=0;l=r.endIdx},e.prototype._paintPerCursorInRect=function(t,r,n,a,i){for(var o={inHover:!1,allClipped:!1,prevEl:null,viewWidth:this._width,viewHeight:this._height,beforeBrushParam:{contentRetained:i}},s=t.ctx,l=NC(t),u=l&&qr.getTime(),c=r.drawIdx,h=r.notClearIdx,f=h>=0?Math.min(h,c):c;f15){f++;break}}}}yf(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 a=this._singleCanvas;a&&!this._needsManuallyCompositing&&(t=lc,r=0);var i=IC(this._i,t)[r];return i||(i=u5("zr_"+t+"."+r,this,t,r),this._layerConfig[t]&&Je(i,this._layerConfig[t],!0),(n||a&&t!==lc)&&(i.virtual=!0),this._insertLayer(i,t,r,!1),i.initContext()),i},e.prototype.insertLayer=function(t,r){this._insertLayer(r,t,0,!1)},e.prototype._insertLayer=function(t,r,n,a){var i=this._i,o=i.layers,s=i.layerStack,l=this._domRoot,u=null;if(!(o[r]&&o[r][n])&&Kue(t)){for(var c=s.length,h=0;h0&&(u=IC(i,s[h-1].zl)[s[h-1].zl2]),s.splice(h,0,{zl:r,zl2:n}),IC(i,r)[n]=t,!a&&!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 In(this._i,function(n,a){t.call(r,n,a)})},e.prototype.eachBuiltinLayer=function(t,r){return In(this._i,function(n,a){t.call(r,n,a)},gg)},e.prototype.eachOtherLayer=function(t,r){return In(this._i,function(n,a){t.call(r,n,a)},_A)},e.prototype.getLayers=function(){var t={};return In(this._i,function(r,n,a){t[r.id]=r}),t},e.prototype._updateLayerStatus=function(t,r){var n=this;if(n._singleCanvas)for(var a=1;a=0;w--){var S=_.get(x[w]);if(!S.used)y.__dirty=!0,_.removeKey(x[w]),x.splice(w,1);else{var C=S.endIdxNew;(NC(y)?C=0;a--){var i=r[a];if(i.zl===t){var o=n[t][i.zl2];if(o.__builtin__)continue;if(r.splice(a,1),n[t][i.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 a=this._opts,i=this.root;t!=null&&(a.width=t),r!=null&&(a.height=r),t=Qd(i,0,a),r=Qd(i,1,a),n.style.display="",(this._width!==t||r!==this._height)&&(n.style.width=t+"px",n.style.height=r+"px",In(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(lc).resize(t,r)}return this},e.prototype.clearLayer=function(t){R(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[lc][0].dom;var r=new GW("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 a=r.dom.width,i=r.dom.height;In(this._i,function(h){h.__builtin__?n.drawImage(h.dom,0,0,a,i):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}(Ut);function Hf(e,t){var r=e.mapDimensionsAll("defaultedLabel"),n=r.length;if(n===1){var a=Of(e,t,r[0]);return a!=null?a+"":null}else if(n){for(var i=[],o=0;o=0&&n.push(t[i])}return n.join(" ")}var ey=function(e){q(t,e);function t(r,n,a,i){var o=e.call(this)||this;return o.updateData(r,n,a,i),o}return t.prototype._createSymbol=function(r,n,a,i,o,s){this.removeAll();var l=Ar(r,-1,-1,2,2,null,s);l.attr({z2:Te(o,100),culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),l.drift=ace,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(){Us(this.childAt(0))},t.prototype.downplay=function(){Ws(this.childAt(0))},t.prototype.setZ=function(r,n){var a=this.childAt(0);a.zlevel=r,a.z=n},t.prototype.setDraggable=function(r,n){var a=this.childAt(0);a.draggable=r,a.cursor=!n&&r?"move":a.cursor},t.prototype.updateData=function(r,n,a,i){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=i&&i.disableAnimation;if(c){var f=r.getItemVisual(n,"symbolKeepAspect");this._createSymbol(o,r,n,l,u,f)}else{var v=this.childAt(0);v.silent=!1;var g={scaleX:l[0]/2,scaleY:l[1]/2};h?v.attr(g):At(v,g,s,n),_i(v)}if(this._updateCommon(r,n,l,a,i),c){var v=this.childAt(0);if(!h){var g={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:v.style.opacity}};v.scaleX=v.scaleY=0,v.style.opacity=0,Qt(v,g,s,n)}}h&&this.childAt(0).stopAnimation("leave")},t.prototype._updateCommon=function(r,n,a,i,o){var s=this.childAt(0),l=r.hostModel,u,c,h,f,v,g,m,y,x;if(i&&(u=i.emphasisItemStyle,c=i.blurItemStyle,h=i.selectItemStyle,f=i.focus,v=i.blurScope,m=i.labelStatesModels,y=i.hoverScale,x=i.cursorStyle,g=i.emphasisDisabled),!i||r.hasItemOption){var _=i&&i.itemModel?i.itemModel:r.getItemModel(n),w=_.getModel("emphasis");u=w.getModel("itemStyle").getItemStyle(),h=_.getModel(["select","itemStyle"]).getItemStyle(),c=_.getModel(["blur","itemStyle"]).getItemStyle(),f=w.get("focus"),v=w.get("blurScope"),g=w.get("disabled"),m=Gr(_),y=w.getShallow("scale"),x=_.getShallow("cursor")}var S=r.getItemVisual(n,"symbolRotate");s.attr("rotation",(S||0)*Math.PI/180||0);var C=Fh(r.getItemVisual(n,"symbolOffset"),a);C&&(s.x=C[0],s.y=C[1]),x&&s.attr("cursor",x);var M=r.getItemVisual(n,"style"),A=M.fill;if(s instanceof Qr){var k=s.style;s.useStyle(te({image:k.image,x:k.x,y:k.y,width:k.width,height:k.height},M))}else s.__isEmptyBrush?s.useStyle(te({},M)):s.useStyle(M),s.style.decal=null,s.setColor(A,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var I=r.getItemVisual(n,"liftZ"),P=this._z2;I!=null?P==null&&(this._z2=s.z2,s.z2+=I):P!=null&&(s.z2=P,this._z2=null);var j=o&&o.useNameLabel;Jr(s,m,{labelFetcher:l,labelDataIndex:n,defaultText:z,inheritColor:A,defaultOpacity:M.opacity});function z(H){return j?r.getName(H):Hf(r,H)}this._sizeX=a[0]/2,this._sizeY=a[1]/2;var D=s.ensureState("emphasis");D.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;D.scaleX=this._sizeX*B,D.scaleY=this._sizeY*B,this.setSymbolScale(1),ir(this,f,v,g)},t.prototype.setSymbolScale=function(r){this.scaleX=this.scaleY=r},t.prototype.fadeOut=function(r,n,a){var i=this.childAt(0),o=Be(this).dataIndex,s=a&&a.animation;if(this.silent=i.silent=!0,a&&a.fadeLabel){var l=i.getTextContent();l&&su(l,{style:{opacity:0}},n,{dataIndex:o,removeOpt:s,cb:function(){i.removeTextContent()}})}else i.removeTextContent();su(i,{style:{opacity:0},scaleX:0,scaleY:0},n,{dataIndex:o,cb:r,removeOpt:s})},t.getSymbolSize=function(r,n){return bv(r.getItemVisual(n,"symbolSize"))},t.getSymbolZ2=function(r,n){return r.getItemVisual(n,"z2")},t}(De);function ace(e,t){this.parent.drift(e,t)}function k0(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 c5(e){return e!=null&&!Re(e)&&(e={isIgnore:e}),e||{}}function h5(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:Gr(t),cursorStyle:t.get("cursor")}}function d5(e,t,r,n,a,i,o){var s=new e(t,r,n,a);return s.setPosition(i),t.setItemGraphicEl(r,s),o.add(s),s}var ty=function(){function e(t){this.group=new De,this._SymbolCtor=t||ey}return e.prototype.updateData=function(t,r){this._progressiveEls=null,r=c5(r);var n=this.group,a=t.hostModel,i=this._data,o=this._SymbolCtor,s=r.disableAnimation,l=this._seriesScope=h5(t),u={disableAnimation:s},c=r.getSymbolPoint||function(h){return t.getItemLayout(h)};i||n.removeAll(),t.diff(i).add(function(h){var f=c(h);k0(t,f,h,r)&&d5(o,t,h,l,u,f,n)}).update(function(h,f){var v=i.getItemGraphicEl(f),g=c(h);if(!k0(t,g,h,r)){n.remove(v);return}var m=t.getItemVisual(h,"symbol")||"circle",y=v&&v.getSymbolType&&v.getSymbolType();if(!v||y&&y!==m)n.remove(v),v=new o(t,h,l,u),v.setPosition(g);else{v.updateData(t,h,l,u);var x={x:g[0],y:g[1]};s?v.attr(x):At(v,x,a)}n.add(v),t.setItemGraphicEl(h,v)}).remove(function(h){var f=i.getItemGraphicEl(h);f&&f.fadeOut(function(){n.remove(f)},a)}).execute(),this._getSymbolPoint=c,this._data=t},e.prototype.updateLayout=function(t){var r=this._data;if(r)for(var n=this,a=r.getStore(),i=0,o=a.count();i0?r=n[0]:n[1]<0&&(r=n[1]),r}function ZW(e,t,r,n){var a=NaN;e.stacked&&(a=r.get(r.getCalculationInfo("stackedOverDimension"),n)),isNaN(a)&&(a=e.valueStart);var i=e.baseDataOffset,o=[];return o[i]=r.get(e.baseDim,n),o[1-i]=a,t.dataToPoint(o)}function hi(e,t){return!isFinite(e)||!isFinite(t)}var oce=typeof Float32Array!==uv?Float32Array:void 0,sce=typeof Float64Array!==uv?Float64Array:void 0;function So(e){return hI({ctor:oce},e).arr}function hI(e,t){var r=e.arr,n=e.ctor;if(t>Yg&&(t=Yg),!r||e.typed&&r.length=a||m<0)break;if(hi(x,_)){if(l){m+=i;continue}break}if(m===r)e[i>0?"moveTo":"lineTo"](x,_),h=x,f=_;else{var w=x-u,S=_-c;if(w*w+S*S<.5){m+=i;continue}if(o>0){for(var C=m+i,M=t[C*2],A=t[C*2+1];M===x&&A===_&&y=n||hi(M,A))v=x,g=_;else{P=M-u,j=A-c;var B=x-u,H=M-x,V=_-c,U=A-_,F=void 0,W=void 0;if(s==="x"){F=Math.abs(B),W=Math.abs(H);var $=P>0?1:-1;v=x-$*F*o,g=_,z=x+$*W*o,D=_}else if(s==="y"){F=Math.abs(V),W=Math.abs(U);var Z=j>0?1:-1;v=x,g=_-Z*F*o,z=x,D=_+Z*W*o}else F=Math.sqrt(B*B+V*V),W=Math.sqrt(H*H+U*U),I=W/(W+F),v=x-P*o*(1-I),g=_-j*o*(1-I),z=x+P*o*I,D=_+j*o*I,z=vl(z,pl(M,x)),D=vl(D,pl(A,_)),z=pl(z,vl(M,x)),D=pl(D,vl(A,_)),P=z-x,j=D-_,v=x-P*F/W,g=_-j*F/W,v=vl(v,pl(u,x)),g=vl(g,pl(c,_)),v=pl(v,vl(u,x)),g=pl(g,vl(c,_)),P=x-v,j=_-g,z=x+P*W/F,D=_+j*W/F}e.bezierCurveTo(h,f,v,g,x,_),h=z,f=D}else e.lineTo(x,_)}u=x,c=_,m+=i}return y}var YW=function(){function e(){this.smooth=0,this.smoothConstraint=!0}return e}(),cce=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 YW},t.prototype.buildPath=function(r,n){var a=n.points,i=0,o=a.length/2;if(n.connectNulls){for(;o>0&&hi(a[o*2-2],a[o*2-1]);o--);for(;i=0){var S=u?(g-l)*w+l:(v-s)*w+s;return u?[r,S]:[S,r]}s=v,l=g;break;case o.C:v=i[h++],g=i[h++],m=i[h++],y=i[h++],x=i[h++],_=i[h++];var C=u?k_(s,v,m,x,r,c):k_(l,g,y,_,r,c);if(C>0)for(var M=0;M=0){var S=u?$r(l,g,y,_,A):$r(s,v,m,x,A);return u?[r,S]:[S,r]}}s=x,l=_;break}}},t}(pt),hce=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(YW),XW=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 hce},t.prototype.buildPath=function(r,n){var a=n.points,i=n.stackedOnPoints,o=0,s=a.length/2,l=n.smoothMonotone;if(n.connectNulls){for(;s>0&&hi(a[s*2-2],a[s*2-1]);s--);for(;o=0,i=e.fill||K.color.neutral99;g5(n,t);var o=n.textFill==null;return a?o&&(n.textFill=r.insideFill||K.color.neutral00,!n.textStroke&&r.insideStroke&&(n.textStroke=r.insideStroke),!n.textStroke&&(n.textStroke=i),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,R(t.rich,function(s){g5(s,s)}),n}function g5(e,t){t&&(Se(t,"fill")&&(e.textFill=t.fill),Se(t,"stroke")&&(e.textStroke=t.fill),Se(t,"lineWidth")&&(e.textStrokeWidth=t.lineWidth),Se(t,"font")&&(e.font=t.font),Se(t,"fontStyle")&&(e.fontStyle=t.fontStyle),Se(t,"fontWeight")&&(e.fontWeight=t.fontWeight),Se(t,"fontSize")&&(e.fontSize=t.fontSize),Se(t,"fontFamily")&&(e.fontFamily=t.fontFamily),Se(t,"align")&&(e.textAlign=t.align),Se(t,"verticalAlign")&&(e.textVerticalAlign=t.verticalAlign),Se(t,"lineHeight")&&(e.textLineHeight=t.lineHeight),Se(t,"width")&&(e.textWidth=t.width),Se(t,"height")&&(e.textHeight=t.height),Se(t,"backgroundColor")&&(e.textBackgroundColor=t.backgroundColor),Se(t,"padding")&&(e.textPadding=t.padding),Se(t,"borderColor")&&(e.textBorderColor=t.borderColor),Se(t,"borderWidth")&&(e.textBorderWidth=t.borderWidth),Se(t,"borderRadius")&&(e.textBorderRadius=t.borderRadius),Se(t,"shadowColor")&&(e.textBoxShadowColor=t.shadowColor),Se(t,"shadowBlur")&&(e.textBoxShadowBlur=t.shadowBlur),Se(t,"shadowOffsetX")&&(e.textBoxShadowOffsetX=t.shadowOffsetX),Se(t,"shadowOffsetY")&&(e.textBoxShadowOffsetY=t.shadowOffsetY),Se(t,"textShadowColor")&&(e.textShadowColor=t.textShadowColor),Se(t,"textShadowBlur")&&(e.textShadowBlur=t.textShadowBlur),Se(t,"textShadowOffsetX")&&(e.textShadowOffsetX=t.textShadowOffsetX),Se(t,"textShadowOffsetY")&&(e.textShadowOffsetY=t.textShadowOffsetY))}function m5(e,t){if(e.length===t.length){for(var r=0;rt){i?r.push(o(i,l,t)):a&&r.push(o(a,l,0),o(a,l,t));break}else a&&(r.push(o(a,l,0)),a=null),r.push(l),i=l}return r}function vce(e,t,r){var n=e.getVisual("visualMeta");if(!(!n||!n.length||!e.count())&&t.type==="cartesian2d"){for(var a,i,o=n.length-1;o>=0;o--){var s=e.getDimensionInfo(n[o].dimension);if(a=s&&s.coordDim,a==="x"||a==="y"){i=n[o];break}}if(i){var l=t.getAxis(a),u=oe(i.stops,function(w){return{coord:l.toGlobalCoord(l.dataToCoord(w.value)),color:w.color}}),c=u.length,h=i.outerColors.slice();c&&u[0].coord>u[c-1].coord&&(u.reverse(),h.reverse());var f=fce(u,a==="x"?r.getWidth():r.getHeight()),v=f.length;if(!v&&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[v-1].coord+g,x=y-m;if(x<.001)return"transparent";R(f,function(w){w.offset=(w.coord-m)/x}),f.push({offset:v?f[v-1].offset:.5,color:h[1]||"transparent"}),f.unshift({offset:v?f[0].offset:.5,color:h[0]||"transparent"});var _=new Eh(0,0,0,0,f,!0);return _[a]=m,_[a+"2"]=y,_}}}function pce(e,t,r){var n=e.get("showAllSymbol"),a=n==="auto";if(!(n&&!a)){var i=r.getAxesByScale("ordinal")[0];if(i&&!(a&&gce(i,t))){var o=t.mapDimension(i.dim),s={};return R(i.getViewLabels(),function(l){l.tick.offInterval||(s[Cv(i.scale,l.tick)]=1)}),function(l){return!s.hasOwnProperty(t.get(o,l))}}}}function gce(e,t){var r=e.getExtent(),n=Math.abs(r[1]-r[0])/e.scale.count();isNaN(n)&&(n=0);for(var a=t.count(),i=Math.max(1,Math.round(a/5)),o=0;on)return!1;return!0}function mce(e){for(var t=e.length/2;t>0&&hi(e[t*2-2],e[t*2-1]);t--);return t-1}function b5(e,t){return[e[t*2],e[t*2+1]]}function yce(e,t,r){for(var n=e.length/2,a=r==="x"?0:1,i,o,s=0,l=-1,u=0;u=t||i>=t&&o<=t){l=u;break}s=u,i=o}return{range:[s,l],t:(t-i)/(o-i)}}function t8(e){if(e.get(["endLabel","show"]))return!0;for(var t=0;t0&&r.get(["emphasis","lineStyle","width"])==="bolder"){var W=g.getState("emphasis").style;W.lineWidth=+g.style.lineWidth+1}Be(g).seriesIndex=r.seriesIndex,ir(g,V,U,F);var $=_5(r.get("smooth")),Z=r.get("smoothMonotone");if(g.setShape({smooth:$,smoothMonotone:Z,connectNulls:A}),m){var J=s.getCalculationInfo("stackedOnSeries"),re=0;m.useStyle(Ee(u.getAreaStyle(),{fill:z,opacity:.7,lineJoin:"bevel",decal:s.getVisual("style").decal})),J&&(re=_5(J.get("smooth"))),m.setShape({smooth:$,stackedOnSmooth:re,smoothMonotone:Z,connectNulls:A}),Vr(m,r,"areaStyle"),Be(m).seriesIndex=r.seriesIndex,ir(m,V,U,F)}var Q=this._changePolyState;s.eachItemGraphicEl(function(ne){ne&&(ne.onHoverStateChange=Q)}),this._polyline.onHoverStateChange=Q,this._data=s,this._coordSys=i,this._stackedOnPoints=C,this._points=c,this._step=P,this._valueOrigin=w;var le=r.get("triggerEvent"),de=r.get("triggerLineEvent"),He=de===!0||le===!0||le==="line",ye=de===!0||le===!0||le==="area";this.packEventData(r,g,He),m&&this.packEventData(r,m,ye)},t.prototype.packEventData=function(r,n,a){Be(n).eventData=a?{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,a,i){var o=r.getData(),s=nh(o,i);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(hi(c,h)||this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(c,h))return;var f=r.get("zlevel")||0,v=r.get("z")||0;u=new ey(o,s),u.x=c,u.y=h,u.setZ(f,v);var g=u.getSymbolPath().getTextContent();g&&(g.zlevel=f,g.z=v,g.z2=this._polyline.z2+1),u.__temp=!0,o.setItemGraphicEl(s,u),u.stopSymbolAnimation(!0),this.group.add(u)}u.highlight()}else Rt.prototype.highlight.call(this,r,n,a,i)},t.prototype.downplay=function(r,n,a,i){var o=r.getData(),s=nh(o,i);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 Rt.prototype.downplay.call(this,r,n,a,i)},t.prototype._changePolyState=function(r){var n=this._polygon;V_(this._polyline,r),n&&V_(n,r)},t.prototype._newPolyline=function(r){var n=this._polyline;return n&&this._lineGroup.remove(n),n=new cce({shape:{points:r},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(n),this._polyline=n,n},t.prototype._newPolygon=function(r,n){var a=this._polygon;return a&&this._lineGroup.remove(a),a=new XW({shape:{points:r,stackedOnPoints:n},segmentIgnoreThreshold:2}),this._lineGroup.add(a),this._polygon=a,a},t.prototype._initSymbolLabelAnimation=function(r,n,a){var i,o,s=n.getBaseAxis(),l=s.inverse;n.type==="cartesian2d"?(i=s.isHorizontal(),o=!1):n.type==="polar"&&(i=s.dim==="angle",o=!0);var u=r.hostModel,c=u.get("animationDuration");Le(c)&&(c=c(null));var h=u.get("animationDelay")||0,f=Le(h)?h(null):h;r.eachItemGraphicEl(function(v,g){var m=v;if(m){var y=[v.x,v.y],x=void 0,_=void 0,w=void 0;if(a)if(o){var S=a,C=n.pointToCoord(y);i?(x=S.startAngle,_=S.endAngle,w=-C[1]/180*Math.PI):(x=S.r0,_=S.r,w=C[0])}else{var M=a;i?(x=M.x,_=M.x+M.width,w=v.x):(x=M.y+M.height,_=M.y,w=v.y)}var A=_===x?0:(w-x)/(_-x);l&&(A=1-A);var k=Le(h)?h(g):c*A+f,I=m.getSymbolPath(),P=I.getTextContent();m.attr({scaleX:0,scaleY:0}),m.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:k}),P&&P.animateFrom({style:{opacity:0}},{duration:300,delay:k}),I.disableLabelAnimation=!0}})},t.prototype._initOrUpdateEndLabel=function(r,n,a){var i=r.getModel("endLabel");if(t8(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 wt({z2:200}),u.ignoreClip=!0,s.setTextContent(this._endLabel),s.disableLabelAnimation=!0);var c=mce(l);c>=0&&(Jr(s,Gr(r,"endLabel"),{inheritColor:a,labelFetcher:r,labelDataIndex:c,defaultText:function(h,f,v){return v!=null?WW(o,v):Hf(o,h)},enableTextSetter:!0},xce(i,n)),s.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},t.prototype._endLabelOnDuring=function(r,n,a,i,o,s,l){var u=this._endLabel,c=this._polyline;if(u){r<1&&i.originalX==null&&(i.originalX=u.x,i.originalY=u.y);var h=a.getLayout("points"),f=a.hostModel,v=f.get("connectNulls"),g=s.get("precision"),m=s.get("distance")||0,y=l.getBaseAxis(),x=y.isHorizontal(),_=y.inverse,w=n.shape,S=_?x?w.x:w.y+w.height:x?w.x+w.width:w.y,C=(x?m:0)*(_?-1:1),M=(x?0:-m)*(_?-1:1),A=x?"x":"y",k=yce(h,S,A),I=k.range,P=I[1]-I[0],j=void 0;if(P>=1){if(P>1&&!v){var z=b5(h,I[0]);u.attr({x:z[0]+C,y:z[1]+M}),o&&(j=f.getRawValue(I[0]))}else{var z=c.getPointOn(S,A);z&&u.attr({x:z[0]+C,y:z[1]+M});var D=f.getRawValue(I[0]),B=f.getRawValue(I[1]);o&&(j=JG(a,g,D,B,k.t))}i.lastFrameIndex=I[0]}else{var H=r===1||i.lastFrameIndex>0?I[0]:0,z=b5(h,H);o&&(j=f.getRawValue(H)),u.attr({x:z[0]+C,y:z[1]+M})}if(o){var V=gv(u);typeof V.setLabelText=="function"&&V.setLabelText(j)}}},t.prototype._doUpdateAnimation=function(r,n,a,i,o,s,l){var u=this._polyline,c=this._polygon,h=r.hostModel,f=uce(this._data,r,this._stackedOnPoints,n,this._coordSys,a,this._valueOrigin),v=f.current,g=f.stackedOnCurrent,m=f.next,y=f.stackedOnNext;if(o&&(g=gl(f.stackedOnCurrent,f.current,a,o,l),v=gl(f.current,null,a,o,l),y=gl(f.stackedOnNext,f.next,a,o,l),m=gl(f.next,null,a,o,l)),x5(v,m)>3e3||c&&x5(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=v;var x={shape:{points:m}};f.current!==v&&(x.shape.__points=f.next),u.stopAnimation(),At(u,x,h),c&&(c.setShape({points:v,stackedOnPoints:g}),c.stopAnimation(),At(c,{shape:{stackedOnPoints:y}},h),u.shape.points!==c.shape.points&&(c.shape.points=u.shape.points));for(var _=[],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"&&i){var l=o.getBaseAxis(),u=o.getOtherAxis(l),c=l.getExtent(),h=n.getDevicePixelRatio(),f=Math.abs(c[1]-c[0])*(h||1),v=Math.round(s/f);if(isFinite(v)&&v>1){i==="lttb"?t.setData(a.lttbDownSample(a.mapDimension(u.dim),1/v)):i==="minmax"&&t.setData(a.minmaxDownSample(a.mapDimension(u.dim),1/v));var g=void 0;ve(i)?g=bce[i]:Le(i)&&(g=i),g&&t.setData(a.downSample(a.mapDimension(u.dim),1/v,g,wce))}}}}}function Sce(e){e.registerChartView(_ce),e.registerSeriesModel(nce),e.registerLayout(ry("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,r8("line"))}var n8=function(e){q(t,e);function t(r,n,a,i,o){var s=e.call(this,r,n,a)||this;return s.index=0,s.type=i||"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}(Ci),wA=null;function Cce(e){wA||(wA=e)}function ny(){return wA}var ew="expandAxisBreak",a8="collapseAxisBreak",i8="toggleAxisBreak",dI="axisbreakchanged",Tce={type:ew,event:dI,update:"update",refineEvent:fI},Mce={type:a8,event:dI,update:"update",refineEvent:fI},Ace={type:i8,event:dI,update:"update",refineEvent:fI};function fI(e,t,r,n){var a=[];return R(e,function(i){a=a.concat(i.eventBreaks)}),{eventContent:{breaks:a}}}function Nce(e){e.registerAction(Tce,t),e.registerAction(Mce,t),e.registerAction(Ace,t);function t(r,n){var a=[],i=ff(n,r);function o(s,l){R(i[s],function(u){var c=u.updateAxisBreaks(r);R(c.breaks,function(h){var f;a.push(Ee((f={},f[l]=u.componentIndex,f),h))})})}return o("xAxisModels","xAxisIndex"),o("yAxisModels","yAxisIndex"),o("singleAxisModels","singleAxisIndex"),{eventBreaks:a}}}var jl=Math.PI,kce=[[1,2,1,2],[5,3,5,3],[8,3,8,3]],Lce=[[0,1,0,1],[0,3,0,3],[0,3,0,3]],gh=Qe(),o8=Qe(),s8=function(){function e(t){this.recordMap={},this.resolveAxisNameOverlap=t}return e.prototype.ensureRecord=function(t){var r=t.axis.dim,n=t.componentIndex,a=this.recordMap,i=a[r]||(a[r]=[]);return i[n]||(i[n]={ready:{}})},e}();function Ice(e,t,r,n){var a=r.axis,i=t.ensureRecord(r),o=[],s,l=vI(e.axisName)&&Ff(e.nameLocation);R(n,function(g){var m=Wo(g);if(!(!m||m.label.ignore)){o.push(m);var y=i.transGroup;l&&(y.transform?Oa(hp,y.transform):Ih(hp),m.transform&&Ea(hp,hp,m.transform),je.copy(L0,m.localRect),L0.applyTransform(hp),s?s.union(L0):je.copy(s=new je(0,0,0,0),L0))}});var u=Math.abs(i.dirVec.x)>.1?"x":"y",c=i.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=a.getExtent(),f=Math.min(h[0],h[1]),v=Math.max(h[0],h[1])-f;s.union(new je(f,0,v,1))}i.stOccupiedRect=s,i.labelInfoList=o}var hp=ar(),L0=new je(0,0,0,0),l8=function(e,t,r,n,a,i){if(Ff(e.nameLocation)){var o=i.stOccupiedRect;o&&u8(lue({},o,i.transGroup.transform),n,a)}else c8(i.labelInfoList,i.dirVec,n,a)};function u8(e,t,r){var n=new Oe;J1(e,t,n,{direction:Math.atan2(r.y,r.x),bidirectional:!1,touchThreshold:.05})&&vA(t,n)}function c8(e,t,r,n){for(var a=Oe.dot(n,t)>=0,i=0,o=e.length;i0?"top":"bottom",i="center"):th(a-jl)?(o=n>0?"bottom":"top",i="center"):(o="middle",a>0&&a0?"right":"left":i=n>0?"left":"right"),{rotation:a,textAlign:i,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}(),Pce=["axisLine","axisTickLabelEstimate","axisTickLabelDetermine","axisName"],Dce={axisLine:function(e,t,r,n,a,i,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=i.transform,c=[l[0],0],h=[l[1],0],f=c[0]>h[0];u&&(dr(c,c,u),dr(h,h,u));var v=te({lineCap:"round"},n.getModel(["axisLine","lineStyle"]).getLineStyle()),g={strokeContainThreshold:e.raw.strokeContainThreshold||5,silent:!0,z2:1,style:v};if(n.get(["axisLine","breakLine"])&&W_(n.axis.scale))ny().buildAxisBreakLine(n,a,i,g);else{var m=new Tr(te({shape:{x1:c[0],y1:c[1],x2:h[0],y2:h[1]}},g));Rf(m.shape,m.style.lineWidth),m.anid="line",a.add(m)}var y=n.get(["axisLine","symbol"]);if(y!=null){var x=n.get(["axisLine","symbolSize"]);ve(y)&&(y=[y,y]),(ve(x)||Tt(x))&&(x=[x,x]);var _=Fh(n.get(["axisLine","symbolOffset"])||0,x),w=x[0],S=x[1];R([{rotate:e.rotation+Math.PI/2,offset:_[0],r:0},{rotate:e.rotation-Math.PI/2,offset:_[1],r:Math.sqrt((c[0]-h[0])*(c[0]-h[0])+(c[1]-h[1])*(c[1]-h[1]))}],function(C,M){if(y[M]!=="none"&&y[M]!=null){var A=Ar(y[M],-w/2,-S/2,w,S,v.stroke,!0),k=C.r+C.offset,I=f?h:c;A.attr({rotation:C.rotate,x:I[0]+k*Math.cos(e.rotation),y:I[1]-k*Math.sin(e.rotation),silent:!0,z2:11}),a.add(A)}})}}},axisTickLabelEstimate:function(e,t,r,n,a,i,o,s){var l=S5(t,a,s);l&&w5(e,t,r,n,a,i,o,Ui.estimate)},axisTickLabelDetermine:function(e,t,r,n,a,i,o,s){var l=S5(t,a,s);l&&w5(e,t,r,n,a,i,o,Ui.determine);var u=Oce(e,a,i,n);Rce(e,t.labelLayoutList,u),zce(e,a,i,n,e.tickDirection)},axisName:function(e,t,r,n,a,i,o,s){var l=r.ensureRecord(n);t.nameEl&&(a.remove(t.nameEl),t.nameEl=l.nameLayout=l.nameLocation=null);var u=e.axisName;if(vI(u)){var c=e.nameLocation,h=e.nameDirection,f=n.getModel("nameTextStyle"),v=n.get("nameGap")||0,g=n.axis.getExtent(),m=n.axis.inverse?-1:1,y=new Oe(0,0),x=new Oe(0,0);c==="start"?(y.x=g[0]-m*v,x.x=-m):c==="end"?(y.x=g[1]+m*v,x.x=m):(y.x=(g[0]+g[1])/2,y.y=e.labelOffset+h*v,x.y=h);var _=ar();x.transform(Js(_,_,e.rotation));var w=n.get("nameRotate");w!=null&&(w=w*jl/180);var S,C;Ff(c)?S=ea.innerTextLayout(e.rotation,w??e.rotation,h):(S=jce(e.rotation,c,w||0,g),C=e.raw.axisNameAvailableWidth,C!=null&&(C=Math.abs(C/Math.sin(S.rotation)),!isFinite(C)&&(C=null)));var M=f.getFont(),A=n.get("nameTruncate",!0)||{},k=A.ellipsis,I=zn(e.raw.nameTruncateMaxWidth,A.maxWidth,C),P=s.nameMarginLevel||0,j=new wt({x:y.x,y:y.y,rotation:S.rotation,silent:ea.isLabelSilent(n),style:$t(f,{text:u,font:M,overflow:"truncate",width:I,ellipsis:k,fill:f.getTextColor()||n.get(["axisLine","lineStyle","color"]),align:f.get("align")||S.textAlign,verticalAlign:f.get("verticalAlign")||S.textVerticalAlign}),z2:1});if(el({el:j,componentModel:n,itemName:u}),j.__fullText=u,j.anid="name",n.get("triggerEvent")){var z=ea.makeAxisEventDataBase(n);z.targetType="axisName",z.name=u,Be(j).eventData=z}i.add(j),j.updateTransform(),t.nameEl=j;var D=l.nameLayout=Wo({label:j,priority:j.z2,defaultAttr:{ignore:j.ignore},marginDefault:Ff(c)?kce[P]:Lce[P]});if(l.nameLocation=c,a.add(j),j.decomposeTransform(),e.shouldNameMoveOverlap&&D){var B=r.ensureRecord(n);r.resolveAxisNameOverlap(e,r,n,D,x,B)}}}};function w5(e,t,r,n,a,i,o,s){d8(t)||Bce(e,t,a,s,n,o);var l=t.labelLayoutList;Fce(e,n,l,i),Hce(n,e.rotation,l);var u=e.optionHideOverlap;Ece(n,l,u),u&&MW(It(l,function(c){return c&&!c.label.ignore})),Ice(e,r,n,l)}function jce(e,t,r,n){var a=zk(r-e),i,o,s=n[0]>n[1],l=t==="start"&&!s||t!=="start"&&s;return th(a-jl/2)?(o=l?"bottom":"top",i="center"):th(a-jl*1.5)?(o=l?"top":"bottom",i="center"):(o="middle",ajl/2?i=l?"left":"right":i=l?"right":"left"),{rotation:a,textAlign:i,textVerticalAlign:o}}function Ece(e,t,r){var n=e.axis,a=e.get(["axisLabel","customValues"]);if(Yse(n))return;function i(u,c,h){var f=Wo(t[c]),v=Wo(t[h]),g=n.scale;if(!(!f||!v)){if(u==null){if(!r&&a)return;var m=gh(f.label).labelInfo.tick;if(qm(g)&&m.notNice||Gn(g)&&m.offInterval){Ed(f.label);return}}if(u===!1||f.suggestIgnore){Ed(f.label);return}if(v.suggestIgnore){Ed(v.label);return}var y=.1;if(!r){var x=[0,0,0,0];f=pA({marginForce:x},f),v=pA({marginForce:x},v)}J1(f,v,null,{touchThreshold:y})&&Ed(u?v.label:f.label)}}var o=e.get(["axisLabel","showMinLabel"]),s=e.get(["axisLabel","showMaxLabel"]),l=t.length;i(o,0,1),i(s,l-1,l-2)}function Rce(e,t,r){e.showMinorTicks||R(t,function(n){if(n&&n.label.ignore)for(var a=0;a=0&&w(M,S,C.getStore())})}var v=0;if(f(function(w,S,C){n.set(S.uid,1),(!a||!a.hasKey(S.uid))&&(o=!0),v+=C.count()}),(!a||a.keys().length!==n.keys().length)&&(o=!0),!o&&i!=null){t.liPosMinGap=i;return}hI(uc,v);var g=0;f(function(w,S,C){for(var M=0,A=C.count();M0&&_0?rW:Jse,r.serUids=n}var uc=hI({ctor:sce},50);function tw(e){return function(t,r){var n=Cn(t,{fromStat:{key:e}});if(yi(n.w2))return[-n.w2/2,n.w2/2]}}function Uc(e){return e+sb}function Vh(e,t){return e+sb+t}function pI(e){return Xce(),{liPosMinGap:!Gn(e.scale)}}var Po="bar",vm="pictorialBar";function f8(e,t,r,n){tI(e,{key:t,seriesType:r,coordSysType:n,getMetrics:pI})}function v8(e){var t=e.scale.rawExtentInfo.makeRenderInfo().startValue;return t}var p8={left:0,right:0,top:0,bottom:0},gb=["25%","25%"],Vi="cartesian2d",Kce=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.mergeDefaultAndTheme=function(r,n){var a=zh(r.outerBounds);e.prototype.mergeDefaultAndTheme.apply(this,arguments),a&&r.outerBounds&&Uo(r.outerBounds,a)},t.prototype.mergeOption=function(r,n){e.prototype.mergeOption.apply(this,arguments),this.option.outerBounds&&r.outerBounds&&Uo(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:p8,outerBoundsContain:"all",outerBoundsClampWidth:gb[0],outerBoundsClampHeight:gb[1],backgroundColor:K.color.transparent,borderWidth:1,borderColor:K.color.neutral30},t}(ht),Jce=lv(),CA="__ec_stack_";function g8(e){return e.get("stack")||CA+e.seriesIndex}function Qce(e){if(Gn(e.axis.scale)){for(var t=Cn(e.axis),r=[],n=0;nw&&(w=_),w!==c&&(y.width=w,r-=w+u*w,n--)}}),c=(r-l)/(n+(n-1)*u),c=at(c,0);var h=0,f;R(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 v={},g=-h/2;return R(o,function(m){var y=s[m];v[m]=v[m]||{bandWidth:t,offset:g,width:y.width},g+=y.width*(1+u)}),v}function y8(e){return{seriesType:e,overallReset:function(t){var r=Vh(e,Vi);eI(t,r,function(n){var a=ehe(n,e);hh(n,r,function(i){var o=a.columnMap[g8(i)];i.getData().setLayout({bandWidth:o.bandWidth,offset:o.offset,size:o.width})})})}}}function x8(e){return{seriesType:e,plan:Bh(),reset:function(t){if(Uce(t)){var r=t.getData(),n=t.coordinateSystem,a=n.getBaseAxis(),i=n.getOtherAxis(a),o=r.getDimensionIndex(r.mapDimension(i.dim)),s=r.getDimensionIndex(r.mapDimension(a.dim)),l=t.get("showBackground",!0),u=r.mapDimension(i.dim),c=r.getCalculationInfo("stackResultDimension"),h=Zs(r,u)&&!!r.getCalculationInfo("stackedOnSeries"),f=i.isHorizontal(),v=i.toGlobalCoord(i.dataToCoord(v8(i))),g=_8(t),m=t.get("barMinHeight")||0,y=c&&r.getDimensionIndex(c),x=r.getLayout("size"),_=r.getLayout("offset");return{progress:function(w,S){for(var C=w.count,M=g&&So(C*3),A=g&&l&&So(C*3),k=g&&So(C),I=n.master.getRect(),P=f?I.width:I.height,j,z=S.getStore(),D=0;(j=w.next())!=null;){var B=z.get(h?y:o,j),H=z.get(s,j),V=v,U=void 0;h&&(U=+B-z.get(o,j));var F=void 0,W=void 0,$=void 0,Z=void 0;if(f){var J=n.dataToPoint([B,H]);h&&(V=n.dataToPoint([U,H])[0]),F=V,W=J[1]+_,$=J[0]-V,Z=x,cr($)y){w=(M+_)/2;break}C===1&&(S=A-g[0].tickValue)}w==null&&(_?_&&(w=g[g.length-1].coord):w=g[0].coord),s[v]=f.toGlobalCoord(w)}});else{var l=this.getData(),u=l.getLayout("offset"),c=l.getLayout("size"),h=i.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}(Ut);Ut.registerClass(pm);var nhe=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 Jo(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 a=t7(this,r,n);return a.progressiveRender&&(a.large=!0),a},t.prototype.brushSelector=function(r,n,a){return a.rect(n.getItemLayout(r))},t.type="series."+Po,t.dependencies=["grid","polar"],t.defaultOption=Cu(pm.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}(pm),ahe=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}(),mb=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 ahe},t.prototype.buildPath=function(r,n){var a=n.cx,i=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,v=Math.PI*2,g=f?h-cMath.PI/2&&cs)return!0;s=h}return!1},t.prototype._isOrderDifferentInView=function(r,n){for(var a=n.scale,i=a.getExtent(),o=Math.max(0,i[0]),s=Math.min(i[1],a.getOrdinalMeta().categories.length-1);o<=s;++o)if(r.ordinalNumbers[o]!==a.getRawOrdinalNumber(o))return!0},t.prototype._updateSortWithinSameData=function(r,n,a,i){if(this._isOrderChangedWithinSameData(r,n,a)){var o=this._dataSort(r,a,n);this._isOrderDifferentInView(o,a)&&(this._removeOnRenderedListener(i),i.dispatchAction({type:"changeAxisOrder",componentType:a.dim+"Axis",axisId:a.index,sortInfo:o}))}},t.prototype._dispatchInitSort=function(r,n,a){var i=n.baseAxis,o=this._dataSort(r,i,function(s){return r.get(r.mapDimension(n.otherAxis.dim),s)});a.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",isInitSort:!0,axisId:i.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,a=this._data;r&&r.isAnimationEnabled()&&a&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],a.eachItemGraphicEl(function(i){Is(i,r,Be(i).dataIndex)})):n.removeAll(),this._data=null,this._isFirstFrame=!0},t.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},t.type=Po,t}(Rt),C5={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 a=e.x+e.width,i=e.y+e.height,o=DC(t.x,e.x),s=jC(t.x+t.width,a),l=DC(t.y,e.y),u=jC(t.y+t.height,i),c=sa?s:o,t.y=h&&l>i?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 a=jC(t.r,e.r),i=DC(t.r0,e.r0);t.r=a,t.r0=i;var o=a-i<0;if(r<0){var n=t.r;t.r=t.r0,t.r0=n}return o}},T5={cartesian2d:function(e,t,r,n,a,i,o,s,l){var u=new it({shape:te({},n),z2:1});if(u.__dataIndex=r,u.name="item",i){var c=u.shape,h=a?"height":"width";c[h]=0}return u},polar:function(e,t,r,n,a,i,o,s,l){var u=!a&&l?mb:wn,c=new u({shape:n,z2:1});c.name="item";var h=w8(a);if(c.calculateTextPosition=ihe(h,{isRoundCap:u===mb}),i){var f=c.shape,v=a?"r":"endAngle",g={};f[v]=a?n.r0:n.startAngle,g[v]=n[v],(s?At:Qt)(c,{shape:g},i)}return c}};function lhe(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 M5(e,t,r,n,a,i,o,s){var l,u;i?(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?At:Qt)(r,{shape:l},t,a,null);var c=t?e.baseAxis.model:null;(o?At:Qt)(r,{shape:u},c,a)}function A5(e,t){for(var r=0;r0?1:-1,o=n.height>0?1:-1;return{x:n.x+i*a/2,y:n.y+o*a/2,width:n.width-i*a,height:n.height-o*a}},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 hhe(e){return e.startAngle!=null&&e.endAngle!=null&&e.startAngle===e.endAngle}function w8(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 k5(e,t,r,n,a,i,o,s){var l=t.getItemVisual(r,"style");if(s){if(!i.get("roundCap")){var c=e.shape,h=Co(n.getModel("itemStyle"),c,!0);te(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 v=s?o?a.r>=a.r0?"endArc":"startArc":a.endAngle>=a.startAngle?"endAngle":"startAngle":o?ghe(a,i.coordinateSystem):mhe(a,i.coordinateSystem),g=Gr(n);Jr(e,g,{labelFetcher:i,labelDataIndex:r,defaultText:Hf(i.getData(),r),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:v});var m=e.getTextContent();if(s&&m){var y=n.get(["label","position"]);e.textConfig.inside=y==="middle"?!0:null,ohe(e,y==="outside"?v:y,w8(o),n.get(["label","rotate"]))}q7(m,g,i.getRawValue(r),function(_){return WW(t,_)});var x=n.getModel(["emphasis"]);ir(e,x.get("focus"),x.get("blurScope"),x.get("disabled")),Vr(e,n),hhe(a)&&(e.style.fill="none",e.style.stroke="none",R(e.states,function(_){_.style&&(_.style.fill=_.style.stroke="none")}))}function dhe(e,t){var r=e.get(["itemStyle","borderColor"]);if(!r||r==="none")return 0;var n=e.get(["itemStyle","borderWidth"])||0,a=isNaN(t.width)?Number.MAX_VALUE:Math.abs(t.width),i=isNaN(t.height)?Number.MAX_VALUE:Math.abs(t.height);return Math.min(n,a,i)}var fhe=function(){function e(){}return e}(),L5=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 fhe},t.prototype.buildPath=function(r,n){for(var a=n.points,i=this.baseDimIdx,o=1-this.baseDimIdx,s=[],l=[],u=this.barWidth,c=0;c=0?r:null},30,!1);function vhe(e,t,r){for(var n=e.baseDimIdx,a=1-n,i=e.shape.points,o=e.largeDataIndices,s=[],l=[],u=e.barWidth,c=0,h=i.length/3;c=s[0]&&t<=s[0]+l[0]&&r>=s[1]&&r<=s[1]+l[1])return o[c]}return-1}function S8(e,t,r){if(ph(r,"cartesian2d")){var n=t,a=r.getArea();return{x:e?n.x:a.x,y:e?a.y:n.y,width:e?n.width:a.width,height:e?a.height:n.height}}else{var a=r.getArea(),i=t;return{cx:a.cx,cy:a.cy,r0:e?a.r0:i.r0,r:e?a.r:i.r,startAngle:e?i.startAngle:0,endAngle:e?i.endAngle:Math.PI*2}}}function phe(e,t,r){var n=e.type==="polar"?wn:it;return new n({shape:S8(t,r,e),silent:!0,z2:0})}function ghe(e,t){if(e.height===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"bottom":"top"}return e.height>0?"bottom":"top"}function mhe(e,t){if(e.width===0){var r=t.getOtherAxis(t.getBaseAxis());return r.inverse?"left":"right"}return e.width>=0?"right":"left"}function yhe(e){e.registerChartView(she),e.registerSeriesModel(nhe),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,y8(Po)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,x8(Po)),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,r8(Po)),e.registerAction({type:"changeAxisOrder",event:"changeAxisOrder",update:"update"},function(t,r){var n=t.componentType||"series";r.eachComponent({mainType:n,query:t},function(a){t.sortInfo&&a.axis.setCategorySortInfo(t.sortInfo)})}),b8(e)}function ay(e){return{seriesType:e,reset:function(t,r){var n=r.findComponents({mainType:"legend"});if(!(!n||!n.length)){var a=t.getData();a.filterSelf(function(i){for(var o=a.getName(i),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}(),Ql="pie",xhe=Qe(),C8=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 Nv(be(this.getData,this),be(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.mergeOption=function(){e.prototype.mergeOption.apply(this,arguments)},t.prototype.getInitialData=function(){return Av(this,{coordDimensions:["value"],encodeDefaulter:nt(TL,this)})},t.prototype.getDataParams=function(r){var n=this.getData(),a=xhe(n),i=a.seats;if(!i){var o=[];n.each(n.mapDimension("value"),function(l){o.push(l)}),i=a.seats=HG(o,n.hostModel.get("percentPrecision"))}var s=e.prototype.getDataParams.call(this,r);return s.percent=i[r]||0,s.$vars.push("percent"),s},t.prototype._defaultLabelLine=function(r){rh(r,"labelLine",["show"]);var n=r.labelLine,a=r.emphasis.labelLine;n.show=n.show&&r.label.show,a.show=a.show&&r.emphasis.label.show},t.type="series."+Ql,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}(Ut);vae({fullType:C8.type,getCoord2:function(e){return e.getShallow("center")}});var _he=Math.PI/180;function D5(e,t,r,n,a,i,o,s,l,u){if(e.length<2)return;function c(m){for(var y=m.rB,x=y*y,_=0;_r?x:y,C=Math.abs(w.label.y-r);if(C>=S.maxY){var M=w.label.x-t-w.len2*a,A=n+w.len,k=Math.abs(M)e.unconstrainedWidth?null:f:null;n.setStyle("width",v)}M8(i,n)}}}function M8(e,t){j5.rect=e,TW(j5,t,whe)}var whe={minMarginForce:[null,0,null,0],marginDefault:[1,0,1,0]},j5={};function EC(e){return e.position==="center"}function She(e){var t=e.getData(),r=[],n,a,i=!1,o=(e.get("minShowLabelAngle")||0)*_he,s=t.getLayout("viewRect"),l=t.getLayout("r"),u=s.width,c=s.x,h=s.y,f=s.height;function v(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),k=A.shape,I=A.getTextContent(),P=A.getTextGuideLine(),j=t.getItemModel(M),z=j.getModel("label"),D=z.get("position")||j.get(["emphasis","label","position"]),B=z.get("distanceToLabelLine"),H=z.get("alignTo"),V=me(z.get("edgeDistance"),u),U=z.get("bleedMargin");U==null&&(U=Math.min(u,f)>200?10:2);var F=j.getModel("labelLine"),W=F.get("length");W=me(W,u);var $=F.get("length2");if($=me($,u),Math.abs(k.endAngle-k.startAngle)0?"right":"left":J>0?"left":"right"}var qe=Math.PI,Fe=0,_t=z.get("rotate");if(Tt(_t))Fe=_t*(qe/180);else if(D==="center")Fe=0;else if(_t==="radial"||_t===!0){var bt=J<0?-Z+qe:-Z;Fe=bt}else if(_t==="tangential"||_t==="tangential-noflip"&&D!=="outside"&&D!=="outer"){var et=Math.atan2(J,re);et<0&&(et=qe*2+et);var Ke=re>0;Ke&&_t!=="tangential-noflip"&&(et=qe+et),Fe=et-qe}if(i=!!Fe,I.x=Q,I.y=le,I.rotation=Fe,I.setStyle({verticalAlign:"middle"}),ye){I.setStyle({align:He});var ce=I.states.select;ce&&(ce.x+=I.x,ce.y+=I.y)}else{var St=new je(0,0,0,0);M8(St,I),r.push({label:I,labelLine:P,position:D,len:W,len2:$,minTurnAngle:F.get("minTurnAngle"),maxSurfaceAngle:F.get("maxSurfaceAngle"),surfaceNormal:new Oe(J,re),linePoints:de,textAlign:He,labelDistance:B,labelAlignTo:H,edgeDistance:V,bleedMargin:U,rect:St,unconstrainedWidth:St.width,labelStyleWidth:I.style.width})}A.setTextConfig({inside:ye})}}),!i&&e.get("avoidLabelOverlap")&&bhe(r,n,a,l,u,f,c,h);for(var m=0;mF?($=B+A*F/2,Z=$):($=B+I,Z=W-I),n.setItemLayout(U,{angle:F,startAngle:$,endAngle:Z,clockwise:w,cx:o,cy:s,r0:u,r:S?Nt(V,M,[u,l]):l}),B=W}),z0){for(var c=o.getItemLayout(0),h=1;isNaN(c&&c.startAngle)&&h=i.r0}},t.type=Ql,t}(Rt);function Nhe(e){return{seriesType:e,reset:function(t,r){var n=t.getData();n.filterSelf(function(a){var i=n.mapDimension("value"),o=n.get(i,a);return!(Tt(o)&&!isNaN(o)&&o<0)})}}}function khe(e){e.registerChartView(Ahe),e.registerSeriesModel(C8),cU(Ql,e.registerAction),e.registerLayout(Che),e.registerProcessor(ay(Ql)),e.registerProcessor(Nhe(Ql))}var Lhe=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 Jo(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,a){return a.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}(Ut),N8=4,Ihe=function(){function e(){}return e}(),Phe=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 Ihe},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 a=n.points,i=n.size,o=this.symbolProxy,s=o.shape,l=r.getContext?r.getContext():r,u=l&&i[0]=0;u--){var c=u*2,h=i[c]-s/2,f=i[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 a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(r=a[0],n=a[1],i.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,a=n.points,i=n.size,o=i[0],s=i[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}(),jhe=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,a){var i=r.getData(),o=this._updateSymbolDraw(i,r);o.updateData(i,RC(r)),this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,a){var i=r.getData(),o=this._updateSymbolDraw(i,r);o.incrementalPrepareUpdate(i),this._finished=!1},t.prototype.incrementalRender=function(r,n,a){this._symbolDraw.incrementalUpdate(r,n.getData(),Io(n),RC(n)),this._finished=r.end===n.getData().count()},t.prototype.updateTransform=function(r,n,a){var i=r.getData();if(this.group.dirty(),this._finished){var o=ry("").reset(r,n,a);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(RC(r))}else return{update:!0}},t.prototype.eachRendered=function(r){this._symbolDraw&&this._symbolDraw.eachRendered(r)},t.prototype._updateSymbolDraw=function(r,n){var a=this._symbolDraw,i=n.pipelineContext,o=i.large;return(!a||o!==this._isLargeDraw)&&(a&&a.remove(),a=this._symbolDraw=o?new Dhe:new ty,this._isLargeDraw=o,this.group.removeAll()),this.group.add(a.group),a},t.prototype.remove=function(r,n){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type="scatter",t}(Rt);function RC(e){return{clipShape:JW(e)}}var TA=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",pr).models[0]},t.type="cartesian2dAxis",t}(ht);kr(TA,Tv);var k8={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"}},Ehe=Je({boundaryGap:!0,deduplication:null,jitter:0,jitterOverlap:!0,jitterMargin:2,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto",show:"auto"},axisLabel:{interval:"auto"}},k8),gI=Je({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}}},k8),Rhe=Je({splitNumber:6,axisLabel:{rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},gI),Ohe=Ee({logBase:10},gI);const L8={category:Ehe,value:gI,time:Rhe,log:Ohe};function Uf(e,t,r,n){R(JU,function(a,i){var o=Je(Je({},L8[i],!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."+i,c}return u.prototype.mergeDefaultAndTheme=function(c,h){var f=em(this),v=f?zh(c):{},g=h.getTheme();Je(c,g.get(i+"Axis")),Je(c,this.getDefaultOption()),c.type=R5(c),f&&Uo(c,v,f)},u.prototype.optionUpdated=function(){var c=this.option;c.type==="category"&&(this.__ordinalMeta=am.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=ny();return h?h.updateModelAxisBreak(this,c):{breaks:[]}},u.type=t+"Axis."+i,u.defaultOption=o,u}(r);e.registerComponentModel(s)}),e.registerSubTypeDefaulter(t+"Axis",R5)}function R5(e){return e.type||(e.data?"category":"value")}var zhe=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 oe(this._dimList,function(t){return this._axes[t]},this)},e.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),It(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}(),Wx=["x","y"];function O5(e){return(e.type==="interval"||e.type==="time")&&!W_(e)}var Bhe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Vi,r.dimensions=Wx,r}return t.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var r=this.getAxis("x").scale,n=this.getAxis("y").scale;if(!(!O5(r)||!O5(n))){var a=ab(r,null),i=ab(n,null),o=this.dataToPoint([a[0],i[0]]),s=this.dataToPoint([a[1],i[1]]),l=a[1]-a[0],u=i[1]-i[0];if(!(!l||!u)){var c=(s[0]-o[0])/l,h=(s[1]-o[1])/u,f=o[0]-a[0]*c,v=o[1]-i[0]*h,g=this._transform=[c,0,0,h,f,v];this._invTransform=Oa([],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"),a=this.getAxis("y");return n.contain(n.toLocalCoord(r[0]))&&a.contain(a.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 a=this.dataToPoint(r),i=this.dataToPoint(n),o=this.getArea(),s=new je(a[0],a[1],i[0]-a[0],i[1]-a[1]);return o.intersect(s)},t.prototype.dataToPoint=function(r,n,a){a=a||[];var i=r[0],o=r[1];if(this._transform&&i!=null&&isFinite(i)&&o!=null&&isFinite(o))return dr(a,r,this._transform);var s=this.getAxis("x"),l=this.getAxis("y");return a[0]=s.toGlobalCoord(s.dataToCoord(i,n)),a[1]=l.toGlobalCoord(l.dataToCoord(o,n)),a},t.prototype.clampData=function(r,n){var a=this.getAxis("x").scale,i=this.getAxis("y").scale,o=a.getExtent(),s=i.getExtent(),l=a.parse(r[0]),u=i.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,a){if(a=a||[],this._invTransform)return dr(a,r,this._invTransform);var i=this.getAxis("x"),o=this.getAxis("y");return a[0]=i.coordToData(i.toLocalCoord(r[0]),n),a[1]=o.coordToData(o.toLocalCoord(r[1]),n),a},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(),a=this.getAxis("y").getGlobalExtent(),i=Math.min(n[0],n[1])-r,o=Math.min(a[0],a[1])-r,s=Math.max(n[0],n[1])-i+r,l=Math.max(a[0],a[1])-o+r;return new je(i,o,s,l)},t}(zhe);function I8(e,t){var r=e.scale,n=e.model,a=cW(r,n,n.ecModel,e,null),i=Bf(r),o=Bf(t)?t.intervalStub:t,s=i?r.intervalStub:r,l=r.base,u=o.getTicks(),c=o.getTicks({expandToNicedExtent:!0}),h=u.length-1,f,v,g;if(h===1)f=v=0,g=1;else if(h===2){var m=cr(u[0].value-u[1].value),y=cr(u[1].value-u[2].value);f=v=0,m===y?g=2:(g=1,m=A[1])return!0})):S[1]?(I=A[1],B(function(){if(F(),D=Mt(z-P*g,j),H(),k<=A[0])return!0})):B(function(){D=Mt(Ph(A[0]/P)*P,j),z=Mt(mi(A[1]/P)*P,j);var J=Fo((z-D)/P);if(J<=g){var re=g-J,Q=void 0,le=a.incl0||i;if(le&&A[0]===0)Q=[0,re];else if(le&&A[1]===0)Q=[re,0];else{var de=mi(re/2);Q=re%2===0?[de,de]:k+I=A[1])return!0}})}tW(r,S,M,[k,I],C,{interval:P,intervalCount:g,intervalPrecision:j,niceExtent:[D,z]})}var z5=[[3,1],[0,2]],Fhe=function(){function e(t,r,n){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=Wx,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;R(this._axesList,function(o){fh(o,Vf);var s=o.scale;Gn(s)&&s.setSortInfo(o.model.get("categorySortInfo"))});function a(o){for(var s=mt(o),l=[],u=s.length-1;u>=0;u--){var c=o[+s[u]];c.__alignTo?l.push(c):Gf(c)}R(l,function(h){Ghe(h,h.__alignTo)?Gf(h):I8(h,h.__alignTo.scale)})}a(n.x),a(n.y);var i={};R(n.x,function(o){B5(n,"y",o,i)}),R(n.y,function(o){B5(n,"x",o,i)}),this.resize(this.model,r)},e.prototype.resize=function(t,r,n){var a=Ur(t,r),i=this._rect=tr(t.getBoxLayoutParams(),a.refContainer),o=this._axesMap,s=this._coordsList,l=t.get("containLabel");if(MA(o,i),!n){var u=Whe(i,s,o,l,r),c=void 0;if(l)AA?(AA(this._axesList,i),MA(o,i)):c=H5(i.clone(),"axisLabel",null,i,o,u,a);else{var h=$he(t,i,a),f=h.outerBoundsRect,v=h.parsedOuterBoundsContain,g=h.outerBoundsClamp;f&&(c=H5(f,v,g,i,o,u,a))}P8(i,o,Ui.determine,null,c,a),R(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]}Re(t)&&(r=t.yAxisIndex,t=t.xAxisIndex);for(var a=0,i=this._coordsList;a=0;a--){var i=e[+t[a]];$U(i.scale)&&eW(i.model,i.type,!0)==null&&(i.model.get("alignTicks")&&i.model.get("interval")==null?n.push(i):r=i)}r||(r=n.pop()),r&&R(n,function(o){o.__alignTo=r})}function Ghe(e,t){return W_(e.scale)||W_(t.scale)||t.scale.getTicks().length<2}function Hhe(e,t){var r=e.getExtent(),n=r[0]+r[1];e.toGlobalCoord=e.dim==="x"?function(a){return a+t}:function(a){return n-a+t},e.toLocalCoord=e.dim==="x"?function(a){return a-t}:function(a){return n-a+t}}function MA(e,t){R(e.x,function(r){return G5(r,t.x,t.width)}),R(e.y,function(r){return G5(r,t.y,t.height)})}function G5(e,t,r){var n=[0,r],a=e.inverse?1:0;e.setExtent(n[a],n[1-a]),Hhe(e,t)}var AA;function Uhe(e){AA=e}function H5(e,t,r,n,a,i,o){P8(n,a,Ui.estimate,t,!1,o);var s=[0,0,0,0];u(0),u(1),c(n,0,NaN),c(n,1,NaN);var l=Ks(s,function(f){return f>0})==null;return sh(n,s,!0,!0,r),MA(a,n),l;function u(f){R(a[We[f]],function(v){if(lm(v.model)){var g=i.ensureRecord(v.model),m=g.labelInfoList;if(m)for(var y=0;y0&&!yn(v)&&v>1e-4&&(f/=v),f}}function Whe(e,t,r,n,a){var i=new s8(Zhe);return R(r,function(o){return R(o,function(s){if(lm(s.model)){var l=!n;s.axisBuilder=$ce(e,t,s.model,a,i,l)}})}),i}function P8(e,t,r,n,a,i){var o=r===Ui.determine;R(t,function(u){return R(u,function(c){lm(c.model)&&(Zce(c.axisBuilder,e,c.model),c.axisBuilder.build(o?{axisTickLabelDetermine:!0}:{axisTickLabelEstimate:!0},{noPxChange:a}))})});var s={x:0,y:0};l(0),l(1);function l(u){s[We[1-u]]=e[_r[u]]<=i.refContainer[_r[u]]*.5?0:1-u===1?2:1}R(t,function(u,c){return R(u,function(h){lm(h.model)&&((n==="all"||o)&&h.axisBuilder.build({axisName:!0},{nameMarginLevel:s[c]}),o&&h.axisBuilder.build({axisLine:!0}))})})}function $he(e,t,r){var n,a=e.get("outerBoundsMode",!0);a==="same"?n=t.clone():(a==null||a==="auto")&&(n=tr(e.get("outerBounds",!0)||p8,r.refContainer));var i=e.get("outerBoundsContain",!0),o;i==null||i==="auto"||Ye(["all","axisLabel"],i)<0?o="all":o=i;var s=[O_(Te(e.get("outerBoundsClampWidth",!0),gb[0]),t.width),O_(Te(e.get("outerBoundsClampHeight",!0),gb[1]),t.height)];return{outerBoundsRect:n,parsedOuterBoundsContain:o,outerBoundsClamp:s}}var Zhe=function(e,t,r,n,a,i){var o=r.axis.dim==="x"?"y":"x";l8(e,t,r,n,a,i),Ff(e.nameLocation)||R(t.recordMap[o],function(s){s&&s.labelInfoList&&s.dirVec&&c8(s.labelInfoList,s.dirVec,n,a)})};function Yhe(e,t){var r={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return Xhe(r,e,t),r.seriesInvolved&&Khe(r,e),r}function Xhe(e,t,r){var n=t.getComponent("tooltip"),a=t.getComponent("axisPointer"),i=a.get("link",!0)||[],o=[];R(r.getCoordinateSystems(),function(s){if(!s.axisPointerEnabled)return;var l=gm(s.model),u=e.coordSysAxesInfo[l]={};e.coordSysMap[l]=s;var c=s.model,h=c.getModel("tooltip",n);if(R(s.getAxes(),nt(m,!1,null)),s.getTooltipAxes&&n&&h.get("show")){var f=h.get("trigger")==="axis",v=h.get(["axisPointer","type"])==="cross",g=s.getTooltipAxes(h.get(["axisPointer","axis"]));(f||v)&&R(g.baseAxes,nt(m,v?"cross":!0,f)),v&&R(g.otherAxes,nt(m,"cross",!1))}function m(y,x,_){var w=_.model.getModel("axisPointer",a),S=w.get("show");if(!(!S||S==="auto"&&!y&&!NA(w))){x==null&&(x=w.get("triggerTooltip")),w=y?qhe(_,h,a,t,y,x):w;var C=w.get("snap"),M=w.get("triggerEmphasis"),A=gm(_.model),k=x||C||_.type==="category",I=e.axesInfo[A]={key:A,axis:_,coordSys:s,axisPointerModel:w,triggerTooltip:x,triggerEmphasis:M,involveSeries:k,snap:C,useHandle:NA(w),seriesModels:[],linkGroup:null};u[A]=I,e.seriesInvolved=e.seriesInvolved||k;var P=Jhe(i,_);if(P!=null){var j=o[P]||(o[P]={axesInfo:{}});j.axesInfo[A]=I,j.mapper=i[P].mapper,I.linkGroup=j}}}})}function qhe(e,t,r,n,a,i){var o=t.getModel("axisPointer"),s=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],l={};R(s,function(f){l[f]=ke(o.get(f))}),l.snap=e.type!=="category"&&!!i,o.get("type")==="cross"&&(l.type="line");var u=l.label||(l.label={});if(u.show==null&&(u.show=!1),a==="cross"){var c=o.get(["label","show"]);if(u.show=c??!0,!i){var h=l.lineStyle=o.get("crossStyle");h&&Ee(u,h.textStyle)}}return e.model.getModel("axisPointer",new vt(l,r,n))}function Khe(e,t){t.eachSeries(function(r){var n=r.coordinateSystem,a=r.get(["tooltip","trigger"],!0),i=r.get(["tooltip","show"],!0);!n||!n.model||a==="none"||a===!1||a==="item"||i===!1||r.get(["axisPointer","show"],!0)===!1||R(e.coordSysAxesInfo[gm(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 Jhe(e,t){for(var r=t.model,n=t.dim,a=0;a=0||e===t}function Qhe(e){var t=mI(e);if(t){var r=t.axisPointerModel,n=t.axis.scale,a=r.option,i=r.get("status"),o=r.get("value");o!=null&&(o=n.parse(o));var s=NA(r);i==null&&(a.status=s?"show":"hide");var l=n.getExtent();(o==null||o>l[1])&&(o=l[1]),o0;return o&&s}var sde=Qe();function $5(e,t,r,n){if(e instanceof n8){var a=e.scale.type;if(a!=="ordinal")return r}var i=e.model,o=i.get("jitter");if(!(o>0))return r;var s=i.get("jitterOverlap"),l=i.get("jitterMargin")||0,u=Gn(e.scale)?Cn(e).w:null;return s?z8(r,o,u,n):lde(e,t,r,n,o,l)}function z8(e,t,r,n){if(r===null)return e+(Math.random()-.5)*t;var a=r-n*2,i=Math.min(Math.max(0,t),a);return e+(Math.random()-.5)*i}function lde(e,t,r,n,a,i){var o=sde(e);o.items||(o.items=[]);var s=o.items,l=Z5(s,t,r,n,a,i,1),u=Z5(s,t,r,n,a,i,-1),c=Math.abs(l-r)a/2||h&&f>h/2-n?z8(r,a,h,n):(s.push({fixedCoord:t,floatCoord:c,r:n}),c)}function Z5(e,t,r,n,a,i,o){for(var s=r,l=0;la/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=Ee({color:m.color},u));var x=Je(ke(m),{boundaryGap:r,splitNumber:n,clockwise:a,scale:i,axisLine:o,axisTick:s,axisLabel:l,name:m.text,showName:c,nameLocation:"end",nameGap:f,nameTextStyle:y,triggerEvent:v},!1);if(ve(h)){var _=x.name;x.name=h.replace("{value}",_??"")}else Le(h)&&(x.name=h(x.name,x));var w=new vt(x,null,this.ecModel);return kr(w,Tv.prototype),w.mainType="radar",w.componentIndex=this.componentIndex,w.uid=Oh("ec_radar"),w},this);this._indicatorModels=g},t.prototype.getIndicatorModels=function(){return this._indicatorModels},t.type=B8,t.defaultOption={z:0,center:["50%","50%"],radius:"50%",startAngle:90,clockwise:!1,axisName:{show:!0,color:K.color.axisLabel},boundaryGap:[0,0],splitNumber:F8,axisNameGap:15,scale:!1,shape:"polygon",axisLine:Je({lineStyle:{color:K.color.neutral20}},dp.axisLine),axisLabel:E0(dp.axisLabel,!1),axisTick:E0(dp.axisTick,!1),splitLine:E0(dp.splitLine,!0),splitArea:E0(dp.splitArea,!0),indicator:[]},t}(ht),mde=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,a){var i=this.group;i.removeAll(),this._buildAxes(r,a),this._buildSplitLineAndArea(r)},t.prototype._buildAxes=function(r,n){var a=r.coordinateSystem,i=a.getIndicatorAxes(),o=oe(i,function(s){var l=s.model.get("showName")?s.name:"",u=new ea(s.model,n,{axisName:l,position:[a.cx,a.cy],rotation:s.angle,labelDirection:-1,tickDirection:-1,nameDirection:1});return u});R(o,function(s){s.build(),this.group.add(s.group)},this)},t.prototype._buildSplitLineAndArea=function(r){var n=r.coordinateSystem,a=n.getIndicatorAxes();if(!a.length)return;var i=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"),v=u.get("color"),g=ae(f)?f:[f],m=ae(v)?v:[v],y=[],x=[];function _(H,V,U){var F=U%V.length;return H[F]=H[F]||[],F}if(i==="circle")for(var w=a[0].getTicksCoords(),S=n.cx,C=n.cy,M=0;M3?1.4:o>1?1.2:1.1,c=i>0?u:1/u;this._checkTriggerMoveZoom(this,"zoom","zoomOnMouseWheel",r,{scale:c,originX:s,originY:l,isAvailableBehavior:null})}if(a){var h=Math.abs(i),f=(i>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(!(q5(this._zr,"globalPan")||fp(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,a,i,o){r._checkPointer(i,o.originX,o.originY)&&(Vs(i.event),i.__ecRoamConsumed=!0,K5(r,n,a,i,o))},t}(wi);function fp(e){return e.__ecRoamConsumed}var Ade=Qe();function nw(e){var t=Ade(e);return t.roam=t.roam||{},t.uniform=t.uniform||{},t}function vp(e,t,r,n){for(var a=nw(e),i=a.roam,o=i[t]=i[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=U8(c,{x:0,y:0,width:s,height:l}),!r.ignoreViewBox)){var v=a;a=new De,a.add(v),v.scaleX=v.scaleY=h.scale,v.x=h.x,v.y=h.y}return!r.ignoreRootClip&&s!=null&&l!=null&&a.setClipPath(new it({shape:{x:0,y:0,width:s,height:l}})),{root:a,width:s,height:l,viewBoxRect:c,viewBoxTransform:h,named:i}},e.prototype._parseNode=function(t,r,n,a,i,o){var s=t.nodeName.toLowerCase(),l,u=a;if(s==="defs"&&(i=!0),s==="text"&&(o=!0),s==="defs"||s==="switch")l=r;else{if(!i){var c=zC[s];if(c&&Se(zC,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 a&&n.push({name:a.name,namedFrom:a,svgNodeTagLower:s,el:l});r.add(l)}}var v=e3[s];if(v&&Se(e3,s)){var g=v.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,i,o):y.nodeType===3&&o&&this._parseText(y,l),y=y.nextSibling},e.prototype._parseText=function(t,r){var n=new jf({style:{text:t.textContent},silent:!0,x:this._textX||0,y:this._textY||0});Za(r,n),Ca(t,n,this._defsUsePending,!1,!1),Ide(n,r);var a=n.style,i=a.fontSize;i&&i<9&&(a.fontSize=9,n.scaleX*=i/9,n.scaleY*=i/9);var o=(a.fontSize||a.fontFamily)&&[a.fontStyle,a.fontWeight,(a.fontSize||12)+"px",a.fontFamily||"sans-serif"].join(" ");a.font=o;var s=n.getBoundingRect();return this._textX+=s.width,r.add(n),n},e.internalField=function(){zC={g:function(t,r){var n=new De;return Za(r,n),Ca(t,n,this._defsUsePending,!1,!1),n},rect:function(t,r){var n=new it;return Za(r,n),Ca(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 Ko;return Za(r,n),Ca(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 Tr;return Za(r,n),Ca(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 Hm;return Za(r,n),Ca(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"),a;n&&(a=n3(n));var i=new Sn({shape:{points:a||[]},silent:!0});return Za(r,i),Ca(t,i,this._defsUsePending,!1,!1),i},polyline:function(t,r){var n=t.getAttribute("points"),a;n&&(a=n3(n));var i=new un({shape:{points:a||[]},silent:!0});return Za(r,i),Ca(t,i,this._defsUsePending,!1,!1),i},image:function(t,r){var n=new Qr;return Za(r,n),Ca(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",a=t.getAttribute("y")||"0",i=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0";this._textX=parseFloat(n)+parseFloat(i),this._textY=parseFloat(a)+parseFloat(o);var s=new De;return Za(r,s),Ca(t,s,this._defsUsePending,!1,!0),s},tspan:function(t,r){var n=t.getAttribute("x"),a=t.getAttribute("y");n!=null&&(this._textX=parseFloat(n)),a!=null&&(this._textY=parseFloat(a));var i=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0",s=new De;return Za(r,s),Ca(t,s,this._defsUsePending,!1,!0),this._textX+=parseFloat(i),this._textY+=parseFloat(o),s},path:function(t,r){var n=t.getAttribute("d")||"",a=P7(n);return Za(r,a),Ca(t,a,this._defsUsePending,!1,!1),a.silent=!0,a}}}(),e}(),e3={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),a=parseInt(e.getAttribute("y2")||"0",10),i=new Eh(t,r,n,a);return t3(e,i),r3(e,i),i},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),a=new tL(t,r,n);return t3(e,a),r3(e,a),a}};function t3(e,t){var r=e.getAttribute("gradientUnits");r==="userSpaceOnUse"&&(t.global=!0)}function r3(e,t){for(var r=e.firstChild;r;){if(r.nodeType===1&&r.nodeName.toLocaleLowerCase()==="stop"){var n=r.getAttribute("offset"),a=void 0;n&&n.indexOf("%")>0?a=parseInt(n,10)/100:n?a=parseFloat(n):a=0;var i={};H8(r,i,i);var o=i.stopColor||r.getAttribute("stop-color")||"#000000",s=i.stopOpacity||r.getAttribute("stop-opacity");if(s){var l=Bn(o),u=l&&l[3];u&&(l[3]*=ks(s),o=ci(l,"rgba"))}t.colorStops.push({offset:a,color:o})}r=r.nextSibling}}function Za(e,t){e&&e.__inheritedStyle&&(t.__inheritedStyle||(t.__inheritedStyle={}),Ee(t.__inheritedStyle,e.__inheritedStyle))}function n3(e){for(var t=aw(e),r=[],n=0;n0;i-=2){var o=n[i],s=n[i-1],l=aw(o);switch(a=a||ar(),s){case"translate":Hi(a,a,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":_1(a,a,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Js(a,a,-parseFloat(l[0])*BC,[parseFloat(l[1]||"0"),parseFloat(l[2]||"0")]);break;case"skewX":var u=Math.tan(parseFloat(l[0])*BC);Ea(a,[1,0,u,1,0,0],a);break;case"skewY":var c=Math.tan(parseFloat(l[0])*BC);Ea(a,[1,c,0,1,0,0],a);break;case"matrix":a[0]=parseFloat(l[0]),a[1]=parseFloat(l[1]),a[2]=parseFloat(l[2]),a[3]=parseFloat(l[3]),a[4]=parseFloat(l[4]),a[5]=parseFloat(l[5]);break}}t.setLocalTransform(a)}}var i3=/([^\s:;]+)\s*:\s*([^:;]+)/g;function H8(e,t,r){var n=e.getAttribute("style");if(n){i3.lastIndex=0;for(var a;(a=i3.exec(n))!=null;){var i=a[1],o=Se(yb,i)?yb[i]:null;o&&(t[o]=a[2]);var s=Se(xb,i)?xb[i]:null;s&&(r[s]=a[2])}}}function Ode(e,t,r){for(var n=0;n1e-6;mp[0]=o?(a[0]-n.x)/i:a[0],mp[1]=o?(a[1]-n.y)/i:a[1],dr(mp,mp,e.mtRawInv);var s=lfe(e,mp);f3(t,s,i),R(r,function(l){l!==t&&f3(l,s.slice(),i)})}var mp=[];function f3(e,t,r){var n=e.option;n.center=t,n.zoom=r}function SI(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 Q8(e,t){var r=t.getShallow("nodeScaleRatio",!0)||1,n=e;return((n.zoom-1)*r+1)/(n.trans[$o].scaleX||1)}function sw(e,t,r,n,a,i,o,s){var l=wb(e);if(!l){r.disable();return}r.enable(Te(e.get("roam"),o),{api:t,zInfo:{component:e},triggerInfo:{roamTrigger:e.get("roamTrigger"),isInSelf:n,isInClip:function(c,h,f){return!a||a.contain(h,f)}}});function u(c){var h=e.mainType,f=lL(Ee({type:t9(h,e.subType,g7)},c));s&&(f.componentType=h),f[h+"Id"]=e.id,t.dispatchAction(f)}r.off("pan").off("zoom").on("pan",function(c){i&&i("pan"),u({dx:c.dx,dy:c.dy})}).on("zoom",function(c){i&&i("zoom"),u({zoom:c.scale,originX:c.originX,originY:c.originY})})}function e9(e){return function(t,r,n){return HC.copy(e.getBoundingRect()),HC.applyTransform(e.getComputedTransform()),HC.contain(r,n)}}var HC=new je(0,0,0,0);function CI(e,t,r){var n=t9(t,r,g7);e.registerAction({type:n,event:n,update:"none"},function(a,i,o){i.eachComponent(Uk(a,t,r),function(s){X8(a,s),q8(a,s,i,o)})})}function t9(e,t,r){return(e!==Ho?e:t==="map"?"geo":t)+r}function r9(e){return e.zoom!=null}function TI(e,t,r,n,a,i,o){var s=new iw(null,J8(e.ecModel,t));return ow(s,r,n,a,i),o?bb(s,o.x,o.y,o.width,o.height):bb(s,r,n,a,i),bI(s,e),s}var MI=["rect","circle","line","ellipse","polygon","polyline","path"],cfe=we(MI),hfe=we(MI.concat(["g"])),dfe=we(MI.concat(["g"])),n9=Qe();function B0(e){var t=e.getItemStyle(),r=e.get("areaColor");return r!=null&&(t.fill=r),t}function v3(e){var t=e.style;t&&(t.stroke=t.stroke||t.fill,t.fill=null)}var a9=function(){function e(t){var r=this.group=new De,n=this._transformGroup=new De;r.add(n),this.uid=Oh("ec_map_draw"),this._controller=new Hh(t.getZr()),n.add(this._regionsGroup=new De),n.add(this._svgGroup=new De)}return e.prototype.draw=function(t,r,n,a,i){var o=this,s=t.getData&&t.getData();xf(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)||i,v;l.shouldClip()?(v=xI(null,u),this.group.setClipPath(new it({shape:v.clone()}))):this.group.removeClipPath(),lu(h,yh,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),sw(t,n,this._controller,function(m,y,x){return t.coordinateSystem.containPoint([y,x])},v,function(){o._mouseDownFlag=!1},!1,!0),this._updateMapSelectHandler(t,c,n,a)},e.prototype.__updateOnOwnRoam=function(t){lu(this._transformGroup,yh,t.coordinateSystem.view,null)},e.prototype._buildGeoJSON=function(t,r,n,a,i,o){var s=this._regionsGroupByName=we(),l=we(),u=this._regionsGroup,c=n.projection,h=c&&c.stream,f=ou(ym(null,t,mh));function v(y,x){return x&&(y=x(y)),y&&dr([],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;Jr(r,Gr(a),{labelFetcher:c,labelDataIndex:u,defaultText:n},h);var f=r.getTextContent();if(f&&(n9(f).ignore=f.ignore,r.textConfig&&o)){var v=r.getBoundingRect().clone();r.textConfig.layoutRect=v,r.textConfig.position=[(o[0]-v.x)/v.width*100+"%",(o[1]-v.y)/v.height*100+"%"]}r.disableLabelAnimation=!0}else r.removeTextContent(),r.removeTextConfig(),r.disableLabelAnimation=null}function m3(e,t,r,n,a,i){t?t.setItemGraphicEl(i,r):Be(r).eventData={componentType:"geo",componentIndex:e.componentIndex,geoIndex:e.componentIndex,name:n,region:a&&a.option||{}}}function y3(e,t,r,n,a){t||el({el:r,componentModel:e,itemName:n,itemTooltipOption:a.get("tooltip")})}function x3(e,t,r,n){t.highDownSilentOnTouch=!!e.get("selectedMode");var a=n.getModel("emphasis"),i=a.get("focus");return ir(t,i,a.get("blurScope"),a.get("disabled")),xf(e)&&nne(t,e,r),i}function _3(e,t,r){var n=[],a;function i(){a=[]}function o(){a.length&&(n.push(a),a=[])}var s=t({polygonStart:i,polygonEnd:o,lineStart:i,lineEnd:o,point:function(l,u){isFinite(l)&&isFinite(u)&&a.push([l,u])},sphere:function(){}});return!r&&s.polygonStart(),R(e,function(l){s.lineStart();for(var u=0;u-1&&(a.style.stroke=a.style.fill,a.style.fill=K.color.neutral00,a.style.lineWidth=2),a},t.prototype.__ownRoamView=function(){return Sb(this)?this.coordinateSystem.view:null},t.type="series."+xh,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}(Ut);function i9(e){return e.indexOf("i")===0}function Sb(e){return xm(e.seriesGroup)===e&&!e.getHostGeoModel()}function xm(e){return e.f[0]}function AI(e,t){var r={};return e.eachRawSeriesByType(xh,function(n){var a=n.getHostGeoModel(),i=a?"o"+a.id:"i"+n.getMapType(),o=r[i]=r[i]||{f:[],r:[]};!e.isSeriesFiltered(n)&&!t&&o.f.push(n),o.r.push(n)}),r}var vfe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=xh,r}return t.prototype.render=function(r,n,a,i){if(!(i&&i.type==="mapToggleSelect"&&i.from===this.uid)){var o=this.group;if(o.removeAll(),!r.getHostGeoModel()){var s=this._mapDraw;s&&i&&i.type==="geoRoam"&&s.resetForLabelLayout(),i&&i.type==="geoRoam"&&i.componentType==="series"&&i.seriesId===r.id?s&&o.add(s.group):Sb(r)?(s=s||(this._mapDraw=new a9(a)),o.add(s.group),s.draw(r,n,a,this,i)):this._clearMapDraw(),r.get("showLegendSymbol")&&n.getComponent("legend")&&this._renderSymbols(r)}}},t.prototype.__updateOnOwnRoam=function(r,n,a){var i=this._mapDraw;Sb(n)&&i&&i.__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,a=this.group;n.each(n.mapDimension("value"),function(i,o){if(!isNaN(i)){var s=n.getItemLayout(o);if(!(!s||!s.point)){var l=s.point,u=s.offset,c=new Ko({style:{fill:r.getData().getVisual("style").fill},shape:{cx:l[0]+u*9,cy:l[1],r:3},silent:!0,z2:8+(u?0:cv+1)});if(!u){var h=xm(r.seriesGroup).getData(),f=n.getName(o),v=h.indexOfName(f),g=n.getItemModel(o),m=g.getModel("label"),y=h.getItemGraphicEl(v);Jr(c,Gr(g),{labelFetcher:{getFormattedLabel:function(x,_){return r.getFormattedLabel(v,_)}},defaultText:f}),c.disableLabelAnimation=!0,m.get("position")||c.setTextConfig({position:"bottom"}),y.onHoverStateChange=function(x){V_(c,x)}}a.add(c)}}})},t.type=xh,t}(Rt),pfe={geoJSON:{aspectScale:.75,invertLongitute:!0},geoSVG:{aspectScale:1,invertLongitute:!1}},o9=["lng","lat"],b3=function(e){q(t,e);function t(r,n,a){var i=e.call(this)||this;i.dimensions=o9,i.type="geo",i._nameCoordMap=we(),i.name=r;var o=a.projection,s=Ys.load(n,a.nameMap,a.nameProperty),l=Ys.getGeoResource(n);i.resourceType=l?l.type:null;var u=i.regions=s.regions,c=pfe[l.type];i._clip=a.clip;var h=o?!1:c.invertLongitute;i.view=new iw(h,J8(a.ecModel,a.api),i),i.map=n,i._regionsMap=s.regionsMap,i.regions=s.regions,i.projection=o;var f;if(o)for(var v=0;v1?(S.width=w,S.height=w/y):(S.height=w,S.width=w*y),S.y=_[1]-S.height/2,S.x=_[0]-S.width/2;else{var C=e.getBoxLayoutParams();C.aspect=y,S=tr(C,m),S=_H(e,S,y)}bb(r,S.x,S.y,S.width,S.height),bI(r,e)}function gfe(e,t){R(t.get("geoCoord"),function(r,n){e.addGeoCoord(n,r)})}var mfe=function(){function e(){this.dimensions=o9}return e.prototype.create=function(t,r){var n=[];function a(i){return{nameProperty:i.get("nameProperty"),aspectScale:i.get("aspectScale"),projection:i.get("projection"),clip:i.getShallow("clip",!0)}}return t.eachComponent("geo",function(i,o){var s=i.get("map"),l=new b3(s+o,s,te({nameMap:i.get("nameMap"),api:r,ecModel:t},a(i)));n.push(l),i.coordinateSystem=l,l.model=i,l.resize=S3,l.resize(i,r)}),t.eachSeries(function(i){Ym({targetModel:i,coordSysType:"geo",coordSysProvider:function(){var o=i.subType===xh?i.getHostGeoModel():i.getReferringComponents("geo",pr).models[0];return o&&o.coordinateSystem},allowNotFound:!0})}),R(AI(t,!0),function(i,o){if(i9(o)){var s=i.r[0],l=[];R(i.r,function(f){l.push(f.get("nameMap")),f.seriesGroup=null});var u=o.slice(1),c=new b3(u,u,te({nameMap:y1(l),api:r,ecModel:t},a(s))),h;R(i.r,function(f){h=Te(h,f.get("scaleLimit"))}),n.push(c),c.resize=S3,c.resize(s,r),R(i.r,function(f){f.coordinateSystem=c,gfe(c,f)})}}),n},e.prototype.getFilledRegions=function(t,r,n,a){for(var i=(t||[]).slice(),o=we(),s=0;s=0;o--){var s=a[o];s.hierNode={defaultAncestor:null,ancestor:s,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},r.push(s)}}function Nfe(e,t){var r=e.isExpand?e.children:[],n=e.parentNode.children,a=e.hierNode.i?n[e.hierNode.i-1]:null;if(r.length){Lfe(e);var i=(r[0].hierNode.prelim+r[r.length-1].hierNode.prelim)/2;a?(e.hierNode.prelim=a.hierNode.prelim+t(e,a),e.hierNode.modifier=e.hierNode.prelim-i):e.hierNode.prelim=i}else a&&(e.hierNode.prelim=a.hierNode.prelim+t(e,a));e.parentNode.hierNode.defaultAncestor=Ife(e,a,e.parentNode.hierNode.defaultAncestor||n[0],t)}function kfe(e){var t=e.hierNode.prelim+e.parentNode.hierNode.modifier;e.setLayout({x:t},!0),e.hierNode.modifier+=e.parentNode.hierNode.modifier}function C3(e){return arguments.length?e:jfe}function Gp(e,t){return e-=Math.PI/2,{x:t*Math.cos(e),y:t*Math.sin(e)}}function Lfe(e){for(var t=e.children,r=t.length,n=0,a=0;--r>=0;){var i=t[r];i.hierNode.prelim+=n,i.hierNode.modifier+=n,a+=i.hierNode.change,n+=i.hierNode.shift+a}}function Ife(e,t,r,n){if(t){for(var a=e,i=e,o=i.parentNode.children[0],s=t,l=a.hierNode.modifier,u=i.hierNode.modifier,c=o.hierNode.modifier,h=s.hierNode.modifier;s=UC(s),i=WC(i),s&&i;){a=UC(a),o=WC(o),a.hierNode.ancestor=e;var f=s.hierNode.prelim+h-i.hierNode.prelim-u+n(s,i);f>0&&(Dfe(Pfe(s,e,r),e,f),u+=f,l+=f),h+=s.hierNode.modifier,u+=i.hierNode.modifier,l+=a.hierNode.modifier,c+=o.hierNode.modifier}s&&!UC(a)&&(a.hierNode.thread=s,a.hierNode.modifier+=h-l),i&&!WC(o)&&(o.hierNode.thread=i,o.hierNode.modifier+=u-c,r=e)}return r}function UC(e){var t=e.children;return t.length&&e.isExpand?t[t.length-1]:e.hierNode.thread}function WC(e){var t=e.children;return t.length&&e.isExpand?t[0]:e.hierNode.thread}function Pfe(e,t,r){return e.hierNode.ancestor.parentNode===t.parentNode?e.hierNode.ancestor:r}function Dfe(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 jfe(e,t){return e.parentNode===t.parentNode?1:2}var di=Qe();function u9(e){var t=e.mainData,r=e.datas;r||(r={main:t},e.datasAttr={main:"data"}),e.datas=e.mainData=null,c9(t,r,e),R(r,function(n){R(t.TRANSFERABLE_METHODS,function(a){n.wrapMethod(a,nt(Efe,e))})}),t.wrapMethod("cloneShallow",nt(Ofe,e)),R(t.CHANGABLE_METHODS,function(n){t.wrapMethod(n,nt(Rfe,e))}),bn(r[t.dataType]===t)}function Efe(e,t){if(Ffe(this)){var r=te({},di(this).datas);r[this.dataType]=t,c9(t,r,e)}else NI(t,this.dataType,di(this).mainData,e);return t}function Rfe(e,t){return e.struct&&e.struct.update(),t}function Ofe(e,t){return R(di(t).datas,function(r,n){r!==t&&NI(r.cloneShallow(),n,t,e)}),t}function zfe(e){var t=di(this).mainData;return e==null||t==null?t:di(t).datas[e]}function Bfe(){var e=di(this).mainData;return e==null?[{data:e}]:oe(mt(di(e).datas),function(t){return{type:t,data:di(e).datas[t]}})}function Ffe(e){return di(e).mainData===e}function c9(e,t,r){di(e).datas={},R(t,function(n,a){NI(n,a,e,r)})}function NI(e,t,r,n){di(r).datas[t]=e,di(e).mainData=r,e.dataType=t,n.struct&&(e[n.structAttr]=n.struct,n.struct[n.datasAttr[t]]=e),e.getLinkedData=zfe,e.getLinkedDataAll=Bfe}var Vfe=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){Le(t)&&(n=r,r=t,t=null),t=t||{},ve(t)&&(t={order:t});var a=t.order||"preorder",i=this[t.attr||"children"],o;a==="preorder"&&(o=r.call(n,this));for(var s=0;!o&&sr&&(r=a.height)}this.height=r+1},e.prototype.getNodeById=function(t){if(this.getId()===t)return this;for(var r=0,n=this.children,a=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,a=e.targetNode;if(ve(a)&&(a=n.getNodeById(a)),a&&n.contains(a))return{node:a};var i=e.targetNodeId;if(i!=null&&(a=n.getNodeById(i)))return{node:a}}}function h9(e){for(var t=[];e;)e=e.parentNode,e&&t.push(e);return t.reverse()}function LI(e,t){var r=h9(e);return Ye(r,t)>=0}function lw(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 _h="tree",Hfe=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},a=r.leaves||{},i=new vt(a,this,this.ecModel),o=kI.createTree(n,this,s);function s(h){h.wrapMethod("getItemModel",function(f,v){var g=o.getNodeByDataIndex(v);return g&&g.children.length&&g.isExpand||(f.parentModel=i),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,a){for(var i=this.getData().tree,o=i.root.children[0],s=i.getNodeByDataIndex(r),l=s.getValue(),u=s.name;s&&s!==o;)u=s.parentNode.name+"."+u,s=s.parentNode;return Er("nameValue",{name:u,value:l,noValue:isNaN(l)||l==null})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),a=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=lw(a,this),n.collapsed=!a.isExpand,n},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+_h,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}(Ut),Ufe=function(){function e(){this.parentPoint=[],this.childPoints=[]}return e}(),Wfe=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 Ufe},t.prototype.buildPath=function(r,n){var a=n.childPoints,i=a.length,o=n.parentPoint,s=a[0],l=a[i-1];if(i===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=me(n.forkPosition,1),v=[];v[c]=o[c],v[h]=o[h]+(l[h]-o[h])*f,r.moveTo(o[0],o[1]),r.lineTo(v[0],v[1]),r.moveTo(s[0],s[1]),v[c]=s[c],r.lineTo(v[0],v[1]),v[c]=l[c],r.lineTo(v[0],v[1]),r.lineTo(l[0],l[1]);for(var g=1;g_.x,C||(S=S-Math.PI));var A=C?"left":"right",k=s.getModel("label"),I=k.get("rotate"),P=I*(Math.PI/180),j=y.getTextContent();j&&(y.setTextConfig({position:k.get("position")||A,rotation:I==null?-S:P,origin:"center"}),j.setStyle("verticalAlign","middle"))}var z=s.get(["emphasis","focus"]),D=z==="relative"?Lf(o.getAncestorsIndices(),o.getDescendantIndices()):z==="ancestor"?o.getAncestorsIndices():z==="descendant"?o.getDescendantIndices():null;D&&(Be(r).focus=D),Zfe(a,o,c,r,g,v,m,n),r.__edge&&(r.onHoverStateChange=function(B){if(B!=="blur"){var H=o.parentNode&&e.getItemGraphicEl(o.parentNode.dataIndex);H&&H.hoverState===Gm||V_(r.__edge,B)}})}function Zfe(e,t,r,n,a,i,o,s){var l=t.getModel(),u=e.get("edgeShape"),c=e.get("layout"),h=e.getOrient(),f=e.get(["lineStyle","curveness"]),v=e.get("edgeForkPosition"),g=l.getModel("lineStyle").getLineStyle(),m=n.__edge;if(u==="curve")t.parentNode&&t.parentNode!==r&&(m||(m=n.__edge=new dv({shape:PA(c,h,f,a,a)})),At(m,{shape:PA(c,h,f,i,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;_=0;i--)r.push(a[i])}}function Xfe(e,t){e.eachSeriesByType("tree",function(r){qfe(r,t)})}function qfe(e,t){var r=Ur(e,t).refContainer,n=tr(e.getBoxLayoutParams(),r);e.layoutInfo=n;var a=e.get("layout"),i=0,o=0,s=null;a==="radial"?(i=2*Math.PI,o=Math.min(n.height,n.width)/2,s=C3(function(S,C){return(S.parentNode===C.parentNode?1:2)/S.depth})):(i=n.width,o=n.height,s=C3());var l=e.getData().tree.root,u=l.children[0];if(u){Afe(l),Yfe(u,Nfe,s),l.hierNode.modifier=-u.hierNode.prelim,yp(u,kfe);var c=u,h=u,f=u;yp(u,function(S){var C=S.getLayout().x;Ch.getLayout().x&&(h=S),S.depth>f.depth&&(f=S)});var v=c===h?1:s(c,h)/2,g=v-c.getLayout().x,m=0,y=0,x=0,_=0;if(a==="radial")m=i/(h.getLayout().x+v+g),y=o/(f.depth-1||1),yp(u,function(S){x=(S.getLayout().x+g)*m,_=(S.depth-1)*y;var C=Gp(x,_);S.setLayout({x:C.x,y:C.y,rawX:x,rawY:_},!0)});else{var w=e.getOrient();w==="RL"||w==="LR"?(y=o/(h.getLayout().x+v+g),m=i/(f.depth-1||1),yp(u,function(S){_=(S.getLayout().x+g)*y,x=w==="LR"?(S.depth-1)*m:i-(S.depth-1)*m,S.setLayout({x,y:_},!0)})):(w==="TB"||w==="BT")&&(m=i/(h.getLayout().x+v+g),y=o/(f.depth-1||1),yp(u,function(S){x=(S.getLayout().x+g)*m,_=w==="TB"?(S.depth-1)*y:o-(S.depth-1)*y,S.setLayout({x,y:_},!0)}))}}}function Kfe(e){e.registerAction({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,r){r.eachComponent({mainType:Ho,subType:_h,query:t},function(n){var a=t.dataIndex,i=n.getData().tree,o=i.getNodeByDataIndex(a);o.isExpand=!o.isExpand})}),CI(e,Ho,_h)}var Jfe=Hr(_h,Qfe);function Qfe(e){e.eachSeriesByType(_h,function(t){var r=t.getData(),n=r.tree;n.eachNode(function(a){var i=a.getModel(),o=i.getModel("itemStyle").getItemStyle(),s=r.ensureUniqueItemVisual(a.dataIndex,"style");te(s,o)})})}function eve(e){e.registerChartView($fe),e.registerSeriesModel(Hfe),e.registerLayout(Xfe),e.registerVisual(Jfe),Kfe(e)}var k3=["treemapZoomToNode","treemapRender","treemapMove"];function tve(e){for(var t=0;t1;)i=i.parentNode;var o=YM(e.ecModel,i.name||i.dataIndex+"",n);a.setVisual("decal",o)})}var rve=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 a={name:r.name,children:r.data};v9(a);var i=r.levels||[],o=this.designatedVisualItemStyle={},s=new vt({itemStyle:o},this,n);i=r.levels=nve(i,n);var l=oe(i||[],function(h){return new vt(h,s,n)},this),u=kI.createTree(a,this,c);function c(h){h.wrapMethod("getItemModel",function(f,v){var g=u.getNodeByDataIndex(v),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,a){var i=this.getData(),o=this.getRawValue(r),s=i.getName(r);return Er("nameValue",{name:s,value:o})},t.prototype.getDataParams=function(r){var n=e.prototype.getDataParams.apply(this,arguments),a=this.getData().tree.getNodeByDataIndex(r);return n.treeAncestors=lw(a,this),n.treePathInfo=n.treeAncestors,n},t.prototype.setLayoutInfo=function(r){this.layoutInfo=this.layoutInfo||{},te(this.layoutInfo,r)},t.prototype.mapIdToIndex=function(r){var n=this._idIndexMap;n||(n=this._idIndexMap=we(),this._idIndexMapCount=0);var a=n.get(r);return a==null&&n.set(r,a=this._idIndexMapCount++),a},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(){f9(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}(Ut);function v9(e){var t=0;R(e.children,function(n){v9(n);var a=n.value;ae(a)&&(a=a[0]),t+=a});var r=e.value;ae(r)&&(r=r[0]),(r==null||isNaN(r))&&(r=t),r<0&&(r=0),ae(e.value)?e.value[0]=r:e.value=r}function nve(e,t){var r=Zt(t.get("color")),n=Zt(t.get(["aria","decal","decals"]));if(r){e=e||[];var a,i;R(e,function(s){var l=new vt(s),u=l.get("color"),c=l.get("decal");(l.get(["itemStyle","color"])||u&&u!=="none")&&(a=!0),(l.get(["itemStyle","decal"])||c&&c!=="none")&&(i=!0)});var o=e[0]||(e[0]={});return a||(o.color=r.slice()),!i&&n&&(o.decal=n.slice()),e}}var ave=8,L3=8,$C=5,ive=function(){function e(t){this.group=new De,t.add(this.group)}return e.prototype.render=function(t,r,n,a){var i=t.getModel("breadcrumb"),o=this.group;if(o.removeAll(),!(!i.get("show")||!n)){var s=i.getModel("itemStyle"),l=i.getModel("emphasis"),u=s.getModel("textStyle"),c=l.getModel(["itemStyle","textStyle"]),h=Ur(t,r).refContainer,f={left:i.get("left"),right:i.get("right"),top:i.get("top"),bottom:i.get("bottom")},v={emptyItemWidth:i.get("emptyItemWidth"),totalWidth:0,renderList:[]},g=tr(f,h);this._prepare(n,v,u),this._renderContent(t,v,g,s,l,u,c,a),V1(o,f,h)}},e.prototype._prepare=function(t,r,n){for(var a=t;a;a=a.parentNode){var i=Fr(a.getModel().get("name"),""),o=n.getTextRect(i),s=Math.max(o.width+ave*2,r.emptyItemWidth);r.totalWidth+=s+L3,r.renderList.push({node:a,text:i,width:s})}},e.prototype._renderContent=function(t,r,n,a,i,o,s,l){for(var u=0,c=r.emptyItemWidth,h=t.get(["breadcrumb","height"]),f=r.totalWidth,v=r.renderList,g=i.getModel("itemStyle").getItemStyle(),m=v.length-1;m>=0;m--){var y=v[m],x=y.node,_=y.width,w=y.text;f>n.width&&(f-=_-c,_=c,w=null);var S=new Sn({shape:{points:ove(u,0,_,h,m===v.length-1,m===0)},style:Ee(a.getItemStyle(),{lineJoin:"bevel"}),textContent:new wt({style:$t(o,{text:w})}),textConfig:{position:"inside"},z2:cv*1e4,onclick:nt(l,x)});S.disableLabelAnimation=!0,S.getTextContent().ensureState("emphasis").style=$t(s,{text:w}),S.ensureState("emphasis").style=g,ir(S,i.get("focus"),i.get("blurScope"),i.get("disabled")),this.group.add(S),sve(S,t,x),u+=_+L3}},e.prototype.remove=function(){this.group.removeAll()},e}();function ove(e,t,r,n,a,i){var o=[[a?e:e-$C,t],[e+r,t],[e+r,t+n],[a?e:e-$C,t+n]];return!i&&o.splice(2,0,[e+r+$C,t+n/2]),!a&&o.push([e,t+n/2]),o}function sve(e,t,r){Be(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&&lw(r,t)}}var lve=function(){function e(){this._storage=[],this._elExistsMap={}}return e.prototype.add=function(t,r,n,a,i){return this._elExistsMap[t.id]?!1:(this._elExistsMap[t.id]=!0,this._storage.push({el:t,target:r,duration:n,delay:a,easing:i}),!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())},a=0,i=this._storage.length;a=0;l--){var u=a[n==="asc"?o-l-1:l].getValue();u/r*ts[1]&&(s[1]=u)})),{sum:n,dataExtent:s}}function yve(e,t,r){for(var n=0,a=1/0,i=0,o=void 0,s=e.length;in&&(n=o));var l=e.area*e.area,u=t*t*r;return l?bm(u*n/l,l/(u*a)):1/0}function I3(e,t,r,n,a){var i=t===r.width?0:1,o=1-i,s=["x","y"],l=["width","height"],u=r[s[i]],c=t?e.area/t:0;(a||c>r[l[o]])&&(c=r[l[o]]);for(var h=0,f=e.length;hYg&&(c=Yg),a=l}cD3||Math.abs(r.dy)>D3)){var n=this.seriesModel.getData().tree.root;if(!n)return;var a=n.getLayout();if(!a)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:a.x+r.dx,y:a.y+r.dy,width:a.width,height:a.height}})}},t.prototype._onZoom=function(r){var n=r.originX,a=r.originY,i=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 je(l.x,l.y,l.width,l.height),c=o.layoutInfo,h=x9(c,l),f=h*i;f=_9(f,o);var v=f/h;n-=c.x,a-=c.y;var g=ar();Hi(g,g,[-n,-a]),_1(g,g,[v,v]),Hi(g,g,[n,a]),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(a){if(n._state==="ready"){var i=n.seriesModel.get("nodeClick",!0);if(i){var o=n.findTarget(a.offsetX,a.offsetY);if(o){var s=o.node;if(s.getLayout().isLeafRoot)n._rootToNode(o);else if(i==="zoomToNode")n._zoomToNode(o);else if(i==="link"){var l=s.hostTree.data.getItemModel(s.dataIndex),u=l.get("link",!0),c=l.get("target",!0)||"blank";u&&Z_(u,c)}}}}},this)},t.prototype._renderBreadcrumb=function(r,n,a){var i=this;a||(a=r.get("leafDepth",!0)!=null?{node:r.getViewRoot()}:this.findTarget(n.getWidth()/2,n.getHeight()/2),a||(a={node:r.getData().tree.root})),(this._breadcrumb||(this._breadcrumb=new ive(this.group))).render(r,n,a.node,function(o){i._state!=="animating"&&(LI(r.getViewRoot(),o)?i._rootToNode({node:o}):i._zoomToNode({node:o}))})},t.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage=xp(),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 a,i=this.seriesModel.getViewRoot();return i.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)a={node:o,offsetX:l[0],offsetY:l[1]};else return!1}},this),a},t.type="treemap",t}(Rt);function xp(){return{nodeGroup:[],background:[],content:[]}}function Tve(e,t,r,n,a,i,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 v=c.width,g=c.height,m=c.borderWidth,y=c.invisible,x=o.getRawIndex(),_=s&&s.getRawIndex(),w=o.viewChildren,S=c.upperHeight,C=w&&w.length,M=f.getModel("itemStyle"),A=f.getModel(["emphasis","itemStyle"]),k=f.getModel(["blur","itemStyle"]),I=f.getModel(["select","itemStyle"]),P=M.get("borderRadius")||0,j=le("nodeGroup",DA);if(!j)return;if(l.add(j),j.x=c.x||0,j.y=c.y||0,j.markRedraw(),Tb(j).nodeWidth=v,Tb(j).nodeHeight=g,c.isAboveViewRoot)return j;var z=le("background",P3,u,wve);z&&$(j,z,C&&c.upperLabelHeight);var D=f.getModel("emphasis"),B=D.get("focus"),H=D.get("blurScope"),V=D.get("disabled"),U=B==="ancestor"?o.getAncestorsIndices():B==="descendant"?o.getDescendantIndices():B;if(C)Kg(j)&&Ic(j,!1),z&&(Ic(z,!V),h.setItemGraphicEl(o.dataIndex,z),OM(z,U,H));else{var F=le("content",P3,u,Sve);F&&Z(j,F),z.disableMorphing=!0,z&&Kg(z)&&Ic(z,!1),Ic(j,!V),h.setItemGraphicEl(o.dataIndex,j);var W=f.getShallow("cursor");W&&F.attr("cursor",W),OM(j,U,H)}return j;function $(ye,ne,xe){var he=Be(ne);if(he.dataIndex=o.dataIndex,he.seriesIndex=e.seriesIndex,ne.setShape({x:0,y:0,width:v,height:g,r:P}),y)J(ne);else{ne.invisible=!1;var ge=o.getVisual("style"),tt=ge.stroke,Ue=R3(M);Ue.fill=tt;var qe=yc(A);qe.fill=A.get("borderColor");var Fe=yc(k);Fe.fill=k.get("borderColor");var _t=yc(I);if(_t.fill=I.get("borderColor"),xe){var bt=v-2*m;re(ne,tt,ge.opacity,{x:m,y:0,width:bt,height:S})}else ne.removeTextContent();ne.setStyle(Ue),ne.ensureState("emphasis").style=qe,ne.ensureState("blur").style=Fe,ne.ensureState("select").style=_t,oh(ne)}ye.add(ne)}function Z(ye,ne){var xe=Be(ne);xe.dataIndex=o.dataIndex,xe.seriesIndex=e.seriesIndex;var he=Math.max(v-2*m,0),ge=Math.max(g-2*m,0);if(ne.culling=!0,ne.setShape({x:m,y:m,width:he,height:ge,r:P}),y)J(ne);else{ne.invisible=!1;var tt=o.getVisual("style"),Ue=tt.fill,qe=R3(M);qe.fill=Ue,qe.decal=tt.decal;var Fe=yc(A),_t=yc(k),bt=yc(I);re(ne,Ue,tt.opacity,null),ne.setStyle(qe),ne.ensureState("emphasis").style=Fe,ne.ensureState("blur").style=_t,ne.ensureState("select").style=bt,oh(ne)}ye.add(ne)}function J(ye){!ye.invisible&&i.push(ye)}function re(ye,ne,xe,he){var ge=f.getModel(he?E3:j3),tt=Fr(f.get("name"),null),Ue=ge.getShallow("show");Jr(ye,Gr(f,he?E3:j3),{defaultText:Ue?tt:null,inheritColor:ne,defaultOpacity:xe,labelFetcher:e,labelDataIndex:o.dataIndex});var qe=ye.getTextContent();if(qe){var Fe=qe.style,_t=zm(Fe.padding||0);he&&(ye.setTextConfig({layoutRect:he}),qe.disableLabelLayout=!0),qe.beforeUpdate=function(){var et=Math.max((he?he.width:ye.shape.width)-_t[1]-_t[3],0),Ke=Math.max((he?he.height:ye.shape.height)-_t[0]-_t[2],0);(Fe.width!==et||Fe.height!==Ke)&&qe.setStyle({width:et,height:Ke})},Fe.truncateMinChar=2,Fe.lineOverflow="truncate",Q(Fe,he,c);var bt=qe.getState("emphasis");Q(bt?bt.style:null,he,c)}}function Q(ye,ne,xe){var he=ye?ye.text:null;if(!ne&&xe.isLeafRoot&&he!=null){var ge=e.get("drillDownIcon",!0);ye.text=ge?ge+" "+he:he}}function le(ye,ne,xe,he){var ge=_!=null&&r[ye][_],tt=a[ye];return ge?(r[ye][_]=null,de(tt,ge)):y||(ge=new ne,ge instanceof xi&&(ge.z2=Mve(xe,he)),He(tt,ge)),t[ye][x]=ge}function de(ye,ne){var xe=ye[x]={};ne instanceof DA?(xe.oldX=ne.x,xe.oldY=ne.y):xe.oldShape=te({},ne.shape)}function He(ye,ne){var xe=ye[x]={},he=o.parentNode,ge=ne instanceof De;if(he&&(!n||n.direction==="drillDown")){var tt=0,Ue=0,qe=a.background[he.getRawIndex()];!n&&qe&&qe.oldShape&&(tt=qe.oldShape.width,Ue=qe.oldShape.height),ge?(xe.oldX=0,xe.oldY=Ue):xe.oldShape={x:tt,y:Ue,width:0,height:0}}xe.fadein=!ge}}function Mve(e,t){return e*bve+t}var wm=R,Ave=Re,Mb=-1,Kr=function(){function e(t){var r=t.mappingMethod,n=t.type,a=this.option=ke(t);this.type=n,this.mappingMethod=r,this._normalizeData=Lve[r];var i=e.visualHandlers[n];this.applyVisual=i.applyVisual,this.getColorMapper=i.getColorMapper,this._normalizedToVisual=i._normalizedToVisual[r],r==="piecewise"?(ZC(a),Nve(a)):r==="category"?a.categories?kve(a):ZC(a,!0):(bn(r!=="linear"||a.dataExtent),ZC(a))}return e.prototype.mapValueToVisual=function(t){var r=this._normalizeData(t);return this._normalizedToVisual(r,t)},e.prototype.getNormalizer=function(){return be(this._normalizeData,this)},e.listVisualTypes=function(){return mt(e.visualHandlers)},e.isValidType=function(t){return e.visualHandlers.hasOwnProperty(t)},e.eachVisual=function(t,r,n){Re(t)?R(t,r,n):r.call(n,t)},e.mapVisual=function(t,r,n){var a,i=ae(t)?[]:Re(t)?{}:(a=!0,null);return e.eachVisual(t,function(o,s){var l=r.call(n,o,s);a?i=l:i[s]=l}),i},e.retrieveVisuals=function(t){var r={},n;return t&&wm(e.visualHandlers,function(a,i){t.hasOwnProperty(i)&&(r[i]=t[i],n=!0)}),n?r:null},e.prepareVisualTypes=function(t){if(ae(t))t=t.slice();else if(Ave(t)){var r=[];wm(t,function(n,a){r.push(a)}),t=r}else return[];return t.sort(function(n,a){return a==="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 a,i=1/0,o=0,s=r.length;o=0;i--)n[i]==null&&(delete r[t[i]],t.pop())}function ZC(e,t){var r=e.visual,n=[];Re(r)?wm(r,function(i){n.push(i)}):r!=null&&n.push(r);var a={color:1,symbol:1};!t&&n.length===1&&!a.hasOwnProperty(e.type)&&(n[1]=n[0]),b9(e,n)}function F0(e){return{applyVisual:function(t,r,n){var a=this.mapValueToVisual(t);n("color",e(r("color"),a))},_normalizedToVisual:jA([0,1])}}function O3(e){var t=this.option.visual;return t[Math.round(Nt(e,[0,1],[0,t.length-1],!0))]||{}}function _p(e){return function(t,r,n){n(e,this.mapValueToVisual(t))}}function Hp(e){var t=this.option.visual;return t[this.option.loop&&e!==Mb?e%t.length:e]}function xc(){return this.option.visual[0]}function jA(e){return{linear:function(t){return Nt(t,e,this.option.visual,!0)},category:Hp,piecewise:function(t,r){var n=EA.call(this,r);return n==null&&(n=Nt(t,e,this.option.visual,!0)),n},fixed:xc}}function EA(e){var t=this.option,r=t.pieceList;if(t.hasSpecialVisual){var n=Kr.findPieceIndex(e,r),a=r[n];if(a&&a.visual)return a.visual[this.type]}}function b9(e,t){return e.visual=t,e.type==="color"&&(e.parsedVisual=oe(t,function(r){var n=Bn(r);return n||[0,0,0,1]})),t}var Lve={linear:function(e){return Nt(e,this.option.dataExtent,[0,1],!0)},piecewise:function(e){var t=this.option.pieceList,r=Kr.findPieceIndex(e,t,!0);if(r!=null)return Nt(r,[0,t.length-1],[0,1],!0)},category:function(e){var t=this.option.categories?this.option.categoryMap[e]:e;return t??Mb},fixed:hr};function V0(e,t,r){return e?t<=r:t=r.length||m===r[m.depth]){var x=Rve(a,l,m,y,g,n);S9(m,x,r,n)}})}}}function Dve(e,t,r){var n=te({},t),a=r.designatedVisualItemStyle;return R(["color","colorAlpha","colorSaturation"],function(i){a[i]=t[i];var o=e.get(i);a[i]=null,o!=null&&(n[i]=o)}),n}function z3(e){var t=YC(e,"color");if(t){var r=YC(e,"colorAlpha"),n=YC(e,"colorSaturation");return n&&(t=Ls(t,null,null,n)),r&&(t=Ug(t,r)),t}}function jve(e,t){return t!=null?Ls(t,null,null,e):null}function YC(e,t){var r=e[t];if(r!=null&&r!=="none")return r}function Eve(e,t,r,n,a,i){if(!(!i||!i.length)){var o=XC(t,"color")||a.color!=null&&a.color!=="none"&&(XC(t,"colorAlpha")||XC(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 Kr(h);return w9(f).drColorMappingBy=c,f}}}function XC(e,t){var r=e.get(t);return ae(r)&&r.length?{name:t,range:r}:null}function Rve(e,t,r,n,a,i){var o=te({},t);if(a){var s=a.type,l=s==="color"&&w9(a).drColorMappingBy,u=l==="index"?n:l==="id"?i.mapIdToIndex(r.getId()):r.getValue(e.get("visualDimension"));o[s]=a.mapValueToVisual(u)}return o}function Ove(e){e.registerSeriesModel(rve),e.registerChartView(Cve),e.registerVisual(Pve),e.registerLayout(fve),tve(e)}function wd(e){return"_EC_"+e}var zve=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[wd(t)]){var a=new _c(t,r);return a.hostGraph=this,this.nodes.push(a),n[wd(t)]=a,a}},e.prototype.getNodeByIndex=function(t){var r=this.data.getRawIndex(t);return this.nodes[r]},e.prototype.getNodeById=function(t){return this._nodesMap[wd(t)]},e.prototype.addEdge=function(t,r,n){var a=this._nodesMap,i=this._edgesMap;if(Tt(t)&&(t=this.nodes[t]),Tt(r)&&(r=this.nodes[r]),t instanceof _c||(t=a[wd(t)]),r instanceof _c||(r=a[wd(r)]),!(!t||!r)){var o=t.id+"-"+r.id,s=new C9(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),i[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 _c&&(t=t.id),r instanceof _c&&(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,a=n.length,i=0;i=0&&t.call(r,n[i],i)},e.prototype.eachEdge=function(t,r){for(var n=this.edges,a=n.length,i=0;i=0&&n[i].node1.dataIndex>=0&&n[i].node2.dataIndex>=0&&t.call(r,n[i],i)},e.prototype.breadthFirstTraverse=function(t,r,n,a){if(r instanceof _c||(r=this._nodesMap[wd(r)]),!!r){for(var i=n==="out"?"outEdges":n==="in"?"inEdges":"edges",o=0;o=0&&l.node2.dataIndex>=0});for(var i=0,o=a.length;i=0&&!t.hasKey(g)&&(t.set(g,!0),o.push(v.node1))}for(l=0;l=0&&!t.hasKey(w)&&(t.set(w,!0),s.push(_.node2))}}}return{edge:t.keys(),node:r.keys()}},e}(),C9=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=we(),r=we();t.set(this.dataIndex,!0);for(var n=[this.node1],a=[this.node2],i=0;i=0&&!t.hasKey(h)&&(t.set(h,!0),n.push(c.node1))}for(i=0;i=0&&!t.hasKey(m)&&(t.set(m,!0),a.push(g.node2))}return{edge:t.keys(),node:r.keys()}},e}();function T9(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)}}}kr(_c,T9("hostGraph","data"));kr(C9,T9("hostGraph","edgeData"));function PI(e,t,r,n,a){for(var i=new zve(n),o=0;o "+f)),u++)}var v=r.get("coordinateSystem"),g;if(v==="cartesian2d"||v==="polar"||v==="matrix")g=Jo(e,r);else{var m=yv.get(v),y=m?m.dimensions||[]:[];Ye(y,"value")<0&&y.concat(["value"]);var x=wv(e,{coordDimensions:y,encodeDefine:r.getEncode()}).dimensions;g=new Fn(x,r),g.initData(e)}var _=new Fn(["value"],r);return _.initData(l,s),a&&a(g,_),u9({mainData:g,struct:i,structAttr:"graph",datas:{node:g,edge:_},datasAttr:{node:"data",edge:"edgeData"}}),i.update(),i}var RA="-->",uw=function(e){return e.get("autoCurveness")||null},M9=function(e,t){var r=uw(e),n=20,a=[];if(Tt(r))n=r;else if(ae(r)){e.__curvenessList=r;return}t>n&&(n=t);var i=n%2?n+2:n+3;a=[];for(var o=0;o "),value:o.value,noValue:o.value==null})}var h=eU({series:this,dataIndex:r,multipleSeries:n});return h},t.prototype._updateCategoriesData=function(){var r=oe(this.option.categories||[],function(a){return a.value!=null?a:te({value:0},a)}),n=new Fn(["value"],this);n.initData(r),this._categoriesData=n,this._categoriesModels=n.mapArray(function(a){return n.getItemModel(a)})},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 Y8(r)&&r},t.type="series."+na,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}(Ut);function G0(e){return e instanceof Array||(e=[e,e]),e}var Uve=Hr(na,Wve);function Wve(e){e.eachSeriesByType(na,function(t){var r=t.getGraph(),n=t.getEdgeData(),a=G0(t.get("edgeSymbol")),i=G0(t.get("edgeSymbolSize"));n.setVisual("fromSymbol",a&&a[0]),n.setVisual("toSymbol",a&&a[1]),n.setVisual("fromSymbolSize",i&&i[0]),n.setVisual("toSymbolSize",i&&i[1]),n.setVisual("style",t.getModel("lineStyle").getLineStyle()),n.each(function(o){var s=n.getItemModel(o),l=r.getEdgeByIndex(o),u=G0(s.getShallow("symbol",!0)),c=G0(s.getShallow("symbolSize",!0)),h=s.getModel("lineStyle").getLineStyle(),f=n.ensureUniqueItemVisual(o,"style");switch(te(f,h),f.stroke){case"source":{var v=l.node1.getVisual("style");f.stroke=v&&v.fill;break}case"target":{var v=l.node2.getVisual("style");f.stroke=v&&v.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 N9(e){var t=e.coordinateSystem;if(!(t&&t.type!=="view")){var r=e.getGraph();r.eachNode(function(n){var a=n.getModel();n.setLayout([+a.get("x"),+a.get("y")])}),jI(r,e)}}function jI(e,t){e.eachEdge(function(r,n){var a=ya(r.getModel().get(["lineStyle","curveness"]),-DI(r,t,n,!0),0),i=No(r.node1.getLayout()),o=No(r.node2.getLayout()),s=[i,o];+a&&s.push([(i[0]+o[0])/2-(i[1]-o[1])*a,(i[1]+o[1])/2-(o[0]-i[0])*a]),r.setLayout(s)})}var $ve=Hr(na,Zve);function Zve(e,t){e.eachSeriesByType(na,function(r){var n=r.get("layout"),a=r.coordinateSystem;if(a&&a.type!=="view"){var i=r.getData(),o=[];R(a.dimensions,function(f){o=o.concat(i.mapDimensionsAll(f))});for(var s=0;s0&&(C[0]=-C[0],C[1]=-C[1]);var A=S[0]<0?-1:1;if(i.__position!=="start"&&i.__position!=="end"){var k=-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":i.x=-f[0]*x+c[0],i.y=-f[1]*_+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":i.x=x*A+c[0],i.y=c[1]+I,g=S[0]<0?"right":"left",i.originX=-x*A,i.originY=-I;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":i.x=M[0],i.y=M[1]+I,g="center",i.originY=-I;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":i.x=-x*A+h[0],i.y=h[1]+I,g=S[0]>=0?"right":"left",i.originX=x*A,i.originY=-I;break}i.scaleX=i.scaleY=o,i.setStyle({verticalAlign:i.__verticalAlign||m,align:i.__align||g})}},t}(De),OI=function(){function e(t){this.group=new De,this._LineCtor=t||RI}return e.prototype.updateData=function(t){var r=this;this._progressiveEls=null;var n=this,a=n.group,i=n._lineData;n._lineData=t,i||a.removeAll();var o=U3(t);t.diff(i).add(function(s){r._doAdd(t,s,o)}).update(function(s,l){r._doUpdate(i,t,l,s,o)}).remove(function(s){a.remove(i.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=U3(t),this._lineData=null,this.group.removeAll()},e.prototype.incrementalUpdate=function(t,r,n){this._progressiveEls=[];function a(l){!l.isGroup&&!npe(l)&&(l.incremental=n,l.ensureState("emphasis").hoverLayer=vv)}for(var i=t.start;i0}function U3(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:Gr(t)}}function W3(e){return isNaN(e[0])||isNaN(e[1])}function e2(e){return e&&!W3(e[0])&&!W3(e[1])}var t2=[],r2=[],n2=[],Cd=an,a2=$l,$3=Math.abs;function Z3(e,t,r){for(var n=e[0],a=e[1],i=e[2],o=1/0,s,l=r*r,u=.1,c=.1;c<=.9;c+=.1){t2[0]=Cd(n[0],a[0],i[0],c),t2[1]=Cd(n[1],a[1],i[1],c);var h=$3(a2(t2,t)-l);h=0?s=s+u:s=s-u:g>=0?s=s-u:s=s+u}return s}function i2(e,t){var r=[],n=Gg,a=[[],[],[]],i=[[],[]],o=[];t/=2,e.eachEdge(function(s,l){var u=s.getLayout(),c=s.getVisual("fromSymbol"),h=s.getVisual("toSymbol");u.__original||(u.__original=[No(u[0]),No(u[1])],u[2]&&u.__original.push(No(u[2])));var f=u.__original;if(u[2]!=null){if(vn(a[0],f[0]),vn(a[1],f[2]),vn(a[2],f[1]),c&&c!=="none"){var v=Wp(s.node1),g=Z3(a,f[0],v*t);n(a[0][0],a[1][0],a[2][0],g,r),a[0][0]=r[3],a[1][0]=r[4],n(a[0][1],a[1][1],a[2][1],g,r),a[0][1]=r[3],a[1][1]=r[4]}if(h&&h!=="none"){var v=Wp(s.node2),g=Z3(a,f[1],v*t);n(a[0][0],a[1][0],a[2][0],g,r),a[1][0]=r[1],a[2][0]=r[2],n(a[0][1],a[1][1],a[2][1],g,r),a[1][1]=r[1],a[2][1]=r[2]}vn(u[0],a[0]),vn(u[1],a[2]),vn(u[2],a[1])}else{if(vn(i[0],f[0]),vn(i[1],f[1]),Ll(o,i[1],i[0]),Lh(o,o),c&&c!=="none"){var v=Wp(s.node1);C_(i[0],i[0],o,v*t)}if(h&&h!=="none"){var v=Wp(s.node2);C_(i[1],i[1],o,-v*t)}vn(u[0],i[0]),vn(u[1],i[1])}})}var P9=Qe();function ape(e){if(e)return P9(e).bridge}function Y3(e,t){e&&(P9(e).bridge=t)}var ipe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=na,r}return t.prototype.init=function(r,n){var a=new ty,i=new OI,o=this.group,s=new De;this._controller=new Hh(n.getZr()),s.add(a.group),s.add(i.group),o.add(s),this._symbolDraw=a,this._lineDraw=i,this._mainGroup=s,this._firstRender=!0},t.prototype.render=function(r,n,a){var i=this,o=wb(r),s=!1;this._model=r,this._api=a,this._active=!0;var l=this._mainGroup,u=this._getThumbnailInfo();u&&u.bridge.reset(a);var c=this._symbolDraw,h=this._lineDraw;o&&lu(l,$o,o,this._firstRender?null:r),i2(r.getGraph(),Up(r));var f=r.getData();c.updateData(f);var v=r.getEdgeData();h.updateData(v),this._updateNodeAndLinkScale(),o&&sw(r,a,this._controller,function(S,C,M){return r.coordinateSystem.containPoint([C,M])},null),clearTimeout(this._layoutTimeout);var g=r.forceLayout,m=r.get(["force","layoutAnimation"]);g&&(s=!0,this._startForceLayoutIteration(g,a,m));var y=r.get("layout");f.graph.eachNode(function(S){var C=S.dataIndex,M=S.getGraphicEl(),A=S.getModel();if(M){M.off("drag").off("dragend");var k=A.get("draggable");k&&M.on("drag",function(P){switch(y){case"force":g.warmUp(),!i._layouting&&i._startForceLayoutIteration(g,a,m),g.setFixed(C),f.setItemLayout(C,[M.x,M.y]);break;case"circular":f.setItemLayout(C,[M.x,M.y]),S.setLayout({fixed:!0},!0),EI(r,"symbolSize",S,[P.offsetX,P.offsetY]),i.updateLayout(r);break;case"none":default:f.setItemLayout(C,[M.x,M.y]),jI(r.getGraph(),r),i.updateLayout(r);break}}).on("dragend",function(){g&&g.setUnfixed(C)}),M.setDraggable(k,!!A.get("cursor"));var I=A.get(["emphasis","focus"]);I==="adjacency"&&(Be(M).focus=S.getAdjacentDataIndices())}}),f.graph.eachEdge(function(S){var C=S.getGraphicEl(),M=S.getModel().get(["emphasis","focus"]);C&&M==="adjacency"&&(Be(C).focus={edge:[S.dataIndex],node:[S.node1.dataIndex,S.node2.dataIndex]})});var x=r.get("layout")==="circular"&&r.get(["circular","rotateLabel"]),_=f.getLayout("cx"),w=f.getLayout("cy");f.graph.eachNode(function(S){k9(S,x,_,w)}),this._firstRender=!1,s||this._renderThumbnail(r,a,this._symbolDraw,this._lineDraw)},t.prototype.dispose=function(){this.remove(),this._controller&&this._controller.dispose()},t.prototype._startForceLayoutIteration=function(r,n,a){var i=this,o=!1;(function s(){r.step(function(l){i.updateLayout(i._model),(l||!o)&&(o=!0,i._renderThumbnail(i._model,n,i._symbolDraw,i._lineDraw)),(i._layouting=!l)&&(a?i._layoutTimeout=setTimeout(s,16):s())})})()},t.prototype.__updateOnOwnRoam=function(r,n,a){var i=wb(n);!this._active||!i||(lu(this._mainGroup,$o,i,null),r9(r)&&(this._updateNodeAndLinkScale(),i2(n.getGraph(),Up(n)),this._lineDraw.updateLayout(),a.updateLabelLayout()),this._updateThumbnailWindow())},t.prototype._updateNodeAndLinkScale=function(){var r=this._model,n=r.getData(),a=Up(r);n.eachItemGraphicEl(function(i,o){i&&i.setSymbolScale(a)})},t.prototype.updateLayout=function(r){this._active&&(i2(r.getGraph(),Up(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 a=ape(r);if(a)return{bridge:a,coordSys:n}}},t.prototype._updateThumbnailWindow=function(){var r=this._getThumbnailInfo();r&&r.bridge.updateWindow(_b(null,r.coordSys),this._api)},t.prototype._renderThumbnail=function(r,n,a,i){var o=this._getThumbnailInfo();if(o){var s=new De,l=a.group.children(),u=i.group.children(),c=new De,h=new De;s.add(h),s.add(c);for(var f=0;f "),value:i.value,noValue:i.value==null})}return Er("nameValue",{name:i.name,value:i.value,noValue:i.value==null})},t.prototype.getDataParams=function(r,n){var a=e.prototype.getDataParams.call(this,r,n);if(n==="node"){var i=this.getData(),o=this.getGraph().getNodeByIndex(r);if(a.name==null&&(a.name=i.getName(r)),a.value==null){var s=o.getLayout().value;a.value=s}}return a},t.type="series."+Cm,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}(Ut),X3=function(e){q(t,e);function t(r,n,a){var i=e.call(this)||this;Be(i).dataType="node",i.z2=2;var o=new wt;return i.setTextContent(o),i.updateData(r,n,a,!0),i}return t.prototype.updateData=function(r,n,a,i){var o=this,s=r.graph.getNodeByIndex(n),l=r.hostModel,u=s.getModel(),c=u.getModel("emphasis"),h=r.getItemLayout(n),f=te(Co(u.getModel("itemStyle"),h,!0),h),v=this;if(isNaN(f.startAngle)){v.setShape(f);return}i?v.setShape(f):At(v,{shape:f},l,n);var g=te(Co(u.getModel("itemStyle"),h,!0),h);o.setShape(g),o.useStyle(r.getItemVisual(n,"style")),Vr(o,u),this._updateLabel(l,u,s),r.setItemGraphicEl(n,v),Vr(v,u,"itemStyle");var m=c.get("focus");ir(this,m==="adjacency"?s.getAdjacentDataIndices():m,c.get("blurScope"),c.get("disabled"))},t.prototype._updateLabel=function(r,n,a){var i=this.getTextContent(),o=a.getLayout(),s=(o.startAngle+o.endAngle)/2,l=Math.cos(s),u=Math.sin(s),c=n.getModel("label");i.ignore=!c.get("show");var h=Gr(n),f=a.getVisual("style");Jr(i,h,{labelFetcher:{getFormattedLabel:function(_,w,S,C,M,A){return r.getFormattedLabel(_,w,"node",C,ya(M,h.normal&&h.normal.get("formatter"),n.get("name")),A)}},labelDataIndex:a.dataIndex,defaultText:a.dataIndex+"",inheritColor:f.fill,defaultOpacity:f.opacity,defaultOutsidePosition:"startArc"});var v=c.get("position")||"outside",g=c.get("distance")||0,m;v==="outside"?m=o.r+g:m=(o.r+o.r0)/2,this.textConfig={inside:v!=="outside"};var y=v!=="outside"?c.get("align")||"center":l>0?"left":"right",x=v!=="outside"?c.get("verticalAlign")||"middle":u>0?"top":"bottom";i.attr({x:l*m+o.cx,y:u*m+o.cy,rotation:0,style:{align:y,verticalAlign:x}})},t}(wn),dpe=function(e){q(t,e);function t(r,n,a,i){var o=e.call(this)||this;return Be(o).dataType="edge",o.updateData(r,n,a,i,!0),o}return t.prototype.buildPath=function(r,n){r.moveTo(n.s1[0],n.s1[1]);var a=.7,i=n.clockwise;r.arc(n.cx,n.cy,n.r,n.sStartAngle,n.sEndAngle,!i),r.bezierCurveTo((n.cx-n.s2[0])*a+n.s2[0],(n.cy-n.s2[1])*a+n.s2[1],(n.cx-n.t1[0])*a+n.t1[0],(n.cy-n.t1[1])*a+n.t1[1],n.t1[0],n.t1[1]),r.arc(n.cx,n.cy,n.r,n.tStartAngle,n.tEndAngle,!i),r.bezierCurveTo((n.cx-n.t2[0])*a+n.t2[0],(n.cy-n.t2[1])*a+n.t2[1],(n.cx-n.s1[0])*a+n.s1[0],(n.cy-n.s1[1])*a+n.s1[1],n.s1[0],n.s1[1]),r.closePath()},t.prototype.updateData=function(r,n,a,i,o){var s=r.hostModel,l=n.graph.getEdgeByIndex(a),u=l.getLayout(),c=l.node1.getModel(),h=n.getItemModel(l.dataIndex),f=h.getModel("lineStyle"),v=h.getModel("emphasis"),g=v.get("focus"),m=te(Co(c.getModel("itemStyle"),u,!0),u),y=this;if(isNaN(m.sStartAngle)||isNaN(m.tStartAngle)){y.setShape(m);return}o?(y.setShape(m),q3(y,l,r,f)):(_i(y),q3(y,l,r,f),At(y,{shape:m},s,a)),ir(this,g==="adjacency"?l.getAdjacentDataIndices():g,v.get("blurScope"),v.get("disabled")),Vr(y,h,"lineStyle"),n.setItemGraphicEl(l.dataIndex,y)},t}(pt);function q3(e,t,r,n){var a=t.node1,i=t.node2,o=e.style;e.setStyle(n.getLineStyle());var s=n.get("color");switch(s){case"source":o.fill=r.getItemVisual(a.dataIndex,"style").fill,o.decal=a.getVisual("style").decal;break;case"target":o.fill=r.getItemVisual(i.dataIndex,"style").fill,o.decal=i.getVisual("style").decal;break;case"gradient":var l=r.getItemVisual(a.dataIndex,"style").fill,u=r.getItemVisual(i.dataIndex,"style").fill;if(ve(l)&&ve(u)){var c=e.shape,h=(c.s1[0]+c.s2[0])/2,f=(c.s1[1]+c.s2[1])/2,v=(c.t1[0]+c.t2[0])/2,g=(c.t1[1]+c.t2[1])/2;o.fill=new Eh(h,f,v,g,[{offset:0,color:l},{offset:1,color:u}],!0)}break}}var fpe=Math.PI/180,vpe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Cm,r}return t.prototype.init=function(r,n){},t.prototype.render=function(r,n,a){var i=r.getData(),o=this._data,s=this.group,l=-r.get("startAngle")*fpe;if(i.diff(o).add(function(c){var h=i.getItemLayout(c);if(h){var f=new X3(i,c,l);Be(f).dataIndex=c,s.add(f)}}).update(function(c,h){var f=o.getItemGraphicEl(h),v=i.getItemLayout(c);if(!v){f&&Is(f,r,h);return}f?f.updateData(i,c,l):f=new X3(i,c,l),s.add(f)}).remove(function(c){var h=o.getItemGraphicEl(c);h&&Is(h,r,c)}).execute(),!o){var u=r.get("center");this.group.scaleX=.01,this.group.scaleY=.01,this.group.originX=me(u[0],a.getWidth()),this.group.originY=me(u[1],a.getHeight()),Qt(this.group,{scaleX:1,scaleY:1},r)}this._data=i,this.renderEdges(r,l)},t.prototype.renderEdges=function(r,n){var a=r.getData(),i=r.getEdgeData(),o=this._edgeData,s=this.group;i.diff(o).add(function(l){var u=new dpe(a,i,l,n);Be(u).dataIndex=l,s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(a,i,l,n),s.add(c)}).remove(function(l){var u=o.getItemGraphicEl(l);u&&Is(u,r,l)}).execute(),this._edgeData=i},t.prototype.dispose=function(){},t.type=Cm,t}(Rt),o2=Math.PI/180,ppe=Hr(Cm,gpe);function gpe(e,t){e.eachSeriesByType(Cm,function(r){mpe(r,t)})}function mpe(e,t){var r=e.getData(),n=r.graph,a=e.getEdgeData(),i=a.count();if(i){var o=xH(e,t),s=o.cx,l=o.cy,u=o.r,c=o.r0,h=Math.max((e.get("padAngle")||0)*o2,0),f=Math.max((e.get("minAngle")||0)*o2,0),v=-e.get("startAngle")*o2,g=v+Math.PI*2,m=e.get("clockwise"),y=m?1:-1,x=[v,g];D1(x,!m);var _=x[0],w=x[1],S=w-_,C=r.getSum("value")===0&&a.getSum("value")===0,M=[],A=0;n.eachEdge(function(F){var W=C?1:F.getValue("value");C&&(W>0||f)&&(A+=2);var $=F.node1.dataIndex,Z=F.node2.dataIndex;M[$]=(M[$]||0)+W,M[Z]=(M[Z]||0)+W});var k=0;if(n.eachNode(function(F){var W=F.getValue("value");isNaN(W)||(M[F.dataIndex]=Math.max(W,M[F.dataIndex]||0)),!C&&(M[F.dataIndex]>0||f)&&A++,k+=M[F.dataIndex]||0}),!(A===0||k===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 I=(S-h*A*y)/k,P=0,j=0,z=0;n.eachNode(function(F){var W=M[F.dataIndex]||0,$=I*(k?W:1)*y;Math.abs($)j){var B=P/j;n.eachNode(function(F){var W=F.getLayout().angle;Math.abs(W)>=f?F.setLayout({angle:W*B,ratio:B},!0):F.setLayout({angle:f,ratio:f===0?1:W/f},!0)})}else n.eachNode(function(F){if(!D){var W=F.getLayout().angle,$=Math.min(W/z,1),Z=$*P;W-Zf&&f>0){var $=D?1:Math.min(W/z,1),Z=W-f,J=Math.min(Z,Math.min(H,P*$));H-=J,F.setLayout({angle:W-J,ratio:(W-J)/W},!0)}else f>0&&F.setLayout({angle:f,ratio:W===0?1:f/W},!0)}});var V=_,U=[];n.eachNode(function(F){var W=Math.max(F.getLayout().angle,f);F.setLayout({cx:s,cy:l,r0:c,r:u,startAngle:V,endAngle:V+W*y,clockwise:m},!0),U[F.dataIndex]=V,V+=(W+h)*y}),n.eachEdge(function(F){var W=C?1:F.getValue("value"),$=I*(k?W:1)*y,Z=F.node1.dataIndex,J=U[Z]||0,re=Math.abs((F.node1.getLayout().ratio||1)*$),Q=J+re*y,le=[s+c*Math.cos(J),l+c*Math.sin(J)],de=[s+c*Math.cos(Q),l+c*Math.sin(Q)],He=F.node2.dataIndex,ye=U[He]||0,ne=Math.abs((F.node2.getLayout().ratio||1)*$),xe=ye+ne*y,he=[s+c*Math.cos(ye),l+c*Math.sin(ye)],ge=[s+c*Math.cos(xe),l+c*Math.sin(xe)];F.setLayout({s1:le,s2:de,sStartAngle:J,sEndAngle:Q,t1:he,t2:ge,tStartAngle:ye,tEndAngle:xe,cx:s,cy:l,r:c,value:W,clockwise:m}),U[Z]=Q,U[He]=xe})}}}function ype(e){e.registerChartView(vpe),e.registerSeriesModel(hpe),e.registerLayout(e.PRIORITY.VISUAL.POST_CHART_LAYOUT,ppe),e.registerProcessor(ay("chord"))}var xpe=function(){function e(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return e}(),_pe=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 xpe},t.prototype.buildPath=function(r,n){var a=Math.cos,i=Math.sin,o=n.r,s=n.width,l=n.angle,u=n.x-a(l)*s*(s>=o/3?1:2),c=n.y-i(l)*s*(s>=o/3?1:2);l=n.angle-Math.PI/2,r.moveTo(u,c),r.lineTo(n.x+a(l)*s,n.y+i(l)*s),r.lineTo(n.x+a(n.angle)*o,n.y+i(n.angle)*o),r.lineTo(n.x-a(l)*s,n.y-i(l)*s),r.lineTo(u,c)},t}(pt);function bpe(e,t){var r=e.get("center"),n=t.getWidth(),a=t.getHeight(),i=Math.min(n,a),o=me(r[0],t.getWidth()),s=me(r[1],t.getHeight()),l=me(e.get("radius"),i/2);return{cx:o,cy:s,r:l}}function H0(e,t){var r=e==null?"":e+"";return t&&(ve(t)?r=t.replace("{value}",r):Le(t)&&(r=t(e))),r}var wpe=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,a){this.group.removeAll();var i=r.get(["axisLine","lineStyle","color"]),o=bpe(r,a);this._renderMain(r,n,a,i,o),this._data=r.getData()},t.prototype.dispose=function(){},t.prototype._renderMain=function(r,n,a,i,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"),v=f?mb:wn,g=h.get("show"),m=h.getModel("lineStyle"),y=m.get("width"),x=[u,c];D1(x,!l),u=x[0],c=x[1];for(var _=c-u,w=u,S=[],C=0;g&&C=I&&(P===0?0:i[P-1][0])Math.PI/2&&(Q+=Math.PI)):re==="tangential"?Q=-k-Math.PI/2:Tt(re)&&(Q=re*Math.PI/180),Q===0?h.add(new wt({style:$t(w,{text:W,x:Z,y:J,verticalAlign:H<-.8?"top":H>.8?"bottom":"middle",align:B<-.4?"left":B>.4?"right":"center"},{inheritColor:$}),silent:!0})):h.add(new wt({style:$t(w,{text:W,x:Z,y:J,verticalAlign:"middle",align:"center"},{inheritColor:$}),silent:!0,originX:Z,originY:J,rotation:Q}))}if(_.get("show")&&V!==S){var U=_.get("distance");U=U?U+c:c;for(var le=0;le<=C;le++){B=Math.cos(k),H=Math.sin(k);var de=new Tr({shape:{x1:B*(g-U)+f,y1:H*(g-U)+v,x2:B*(g-A-U)+f,y2:H*(g-A-U)+v},silent:!0,style:z});z.stroke==="auto"&&de.setStyle({stroke:i((V+le/C)/S)}),h.add(de),k+=P}k-=P}else k+=I}},t.prototype._renderPointer=function(r,n,a,i,o,s,l,u,c){var h=this.group,f=this._data,v=this._progressEls,g=[],m=r.get(["pointer","show"]),y=r.getModel("progress"),x=y.get("show"),_=r.getData(),w=_.mapDimension("value"),S=+r.get("min"),C=+r.get("max"),M=[S,C],A=[s,l];function k(P,j){var z=_.getItemModel(P),D=z.getModel("pointer"),B=me(D.get("width"),o.r),H=me(D.get("length"),o.r),V=r.get(["pointer","icon"]),U=D.get("offsetCenter"),F=me(U[0],o.r),W=me(U[1],o.r),$=D.get("keepAspect"),Z;return V?Z=Ar(V,F-B/2,W-H,B,H,null,$):Z=new _pe({shape:{angle:-Math.PI/2,width:B,r:H,x:F,y:W}}),Z.rotation=-(j+Math.PI/2),Z.x=o.cx,Z.y=o.cy,Z}function I(P,j){var z=y.get("roundCap"),D=z?mb:wn,B=y.get("overlap"),H=B?y.get("width"):c/_.count(),V=B?o.r-H:o.r-(P+1)*H,U=B?o.r:o.r-P*H,F=new D({shape:{startAngle:s,endAngle:j,cx:o.cx,cy:o.cy,clockwise:u,r0:V,r:U}});return B&&(F.z2=Nt(_.get(w,P),[S,C],[100,0],!0)),F}(x||m)&&(_.diff(f).add(function(P){var j=_.get(w,P);if(m){var z=k(P,s);Qt(z,{rotation:-((isNaN(+j)?A[0]:Nt(j,M,A,!0))+Math.PI/2)},r),h.add(z),_.setItemGraphicEl(P,z)}if(x){var D=I(P,s),B=y.get("clip");Qt(D,{shape:{endAngle:Nt(j,M,A,B)}},r),h.add(D),DM(r.seriesIndex,_.dataType,P,D),g[P]=D}}).update(function(P,j){var z=_.get(w,P);if(m){var D=f.getItemGraphicEl(j),B=D?D.rotation:s,H=k(P,B);H.rotation=B,At(H,{rotation:-((isNaN(+z)?A[0]:Nt(z,M,A,!0))+Math.PI/2)},r),h.add(H),_.setItemGraphicEl(P,H)}if(x){var V=v[j],U=V?V.shape.endAngle:s,F=I(P,U),W=y.get("clip");At(F,{shape:{endAngle:Nt(z,M,A,W)}},r),h.add(F),DM(r.seriesIndex,_.dataType,P,F),g[P]=F}}).execute(),_.each(function(P){var j=_.getItemModel(P),z=j.getModel("emphasis"),D=z.get("focus"),B=z.get("blurScope"),H=z.get("disabled"),V=i(Nt(_.get(w,P),M,[0,1],!0));if(m){var U=_.getItemGraphicEl(P),F=_.getItemVisual(P,"style"),W=F.fill;if(U instanceof Qr){var $=U.style;U.useStyle(te({image:$.image,x:$.x,y:$.y,width:$.width,height:$.height},F))}else U.useStyle(F),U.type!=="pointer"&&U.setColor(W);U.setStyle(j.getModel(["pointer","itemStyle"]).getItemStyle()),U.style.fill==="auto"&&U.setStyle("fill",V),U.z2EmphasisLift=0,Vr(U,j),ir(U,D,B,H)}if(x){var Z=g[P];Z.useStyle(_.getItemVisual(P,"style")),Z.setStyle(j.getModel(["progress","itemStyle"]).getItemStyle()),Z.style.fill==="auto"&&Z.setStyle("fill",V),Z.z2EmphasisLift=0,Vr(Z,j),ir(Z,D,B,H)}}),this._progressEls=g)},t.prototype._renderAnchor=function(r,n){var a=r.getModel("anchor"),i=a.get("show");if(i){var o=a.get("size"),s=a.get("icon"),l=a.get("offsetCenter"),u=a.get("keepAspect"),c=Ar(s,n.cx-o/2+me(l[0],n.r),n.cy-o/2+me(l[1],n.r),o,o,null,u);c.z2=a.get("showAbove")?1:0,c.setStyle(a.getModel("itemStyle").getItemStyle()),this.group.add(c)}},t.prototype._renderTitleAndDetail=function(r,n,a,i,o){var s=this,l=r.getData(),u=l.mapDimension("value"),c=+r.get("min"),h=+r.get("max"),f=new De,v=[],g=[],m=r.isAnimationEnabled(),y=r.get(["pointer","showAbove"]);l.diff(this._data).add(function(x){v[x]=new wt({silent:!0}),g[x]=new wt({silent:!0})}).update(function(x,_){v[x]=s._titleEls[_],g[x]=s._detailEls[_]}).execute(),l.each(function(x){var _=l.getItemModel(x),w=l.get(u,x),S=new De,C=i(Nt(w,[c,h],[0,1],!0)),M=_.getModel("title");if(M.get("show")){var A=M.get("offsetCenter"),k=o.cx+me(A[0],o.r),I=o.cy+me(A[1],o.r),P=v[x];P.attr({z2:y?0:2,style:$t(M,{x:k,y:I,text:l.getName(x),align:"center",verticalAlign:"middle"},{inheritColor:C})}),S.add(P)}var j=_.getModel("detail");if(j.get("show")){var z=j.get("offsetCenter"),D=o.cx+me(z[0],o.r),B=o.cy+me(z[1],o.r),H=me(j.get("width"),o.r),V=me(j.get("height"),o.r),U=r.get(["progress","show"])?l.getItemVisual(x,"style").fill:C,P=g[x],F=j.get("formatter");P.attr({z2:y?0:2,style:$t(j,{x:D,y:B,text:H0(w,F),width:isNaN(H)?null:H,height:isNaN(V)?null:V,align:"center",verticalAlign:"middle"},{inheritColor:U})}),q7(P,{normal:j},w,function($){return H0($,F)}),m&&K7(P,x,l,r,{getFormattedLabel:function($,Z,J,re,Q,le){return H0(le?le.interpolatedValue:w,F)}}),S.add(P)}f.add(S)}),this.group.add(f),this._titleEls=v,this._detailEls=g},t.type="gauge",t}(Rt),Spe=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 Av(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}(Ut);function Cpe(e){e.registerChartView(wpe),e.registerSeriesModel(Spe)}var Wf="funnel",Tpe=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 Nv(be(this.getData,this),be(this.getRawData,this)),this._defaultLabelLine(r)},t.prototype.getInitialData=function(r,n){return Av(this,{coordDimensions:["value"],encodeDefaulter:nt(TL,this)})},t.prototype._defaultLabelLine=function(r){rh(r,"labelLine",["show"]);var n=r.labelLine,a=r.emphasis.labelLine;n.show=n.show&&r.label.show,a.show=a.show&&r.emphasis.label.show},t.prototype.getDataParams=function(r){var n=this.getData(),a=e.prototype.getDataParams.call(this,r),i=n.mapDimension("value"),o=n.getSum(i);return a.percent=o?+(n.get(i,r)/o*100).toFixed(2):0,a.$vars.push("percent"),a},t.type="series."+Wf,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}(Ut),Mpe=["itemStyle","opacity"],Ape=function(e){q(t,e);function t(r,n){var a=e.call(this)||this,i=a,o=new un,s=new wt;return i.setTextContent(s),a.setTextGuideLine(o),a.updateData(r,n,!0),a}return t.prototype.updateData=function(r,n,a){var i=this,o=r.hostModel,s=r.getItemModel(n),l=r.getItemLayout(n),u=s.getModel("emphasis"),c=s.get(Mpe);c=c??1,a||_i(i),i.useStyle(r.getItemVisual(n,"style")),i.style.lineJoin="round",a?(i.setShape({points:l.points}),i.style.opacity=0,Qt(i,{style:{opacity:c}},o,n)):At(i,{style:{opacity:c},shape:{points:l.points}},o,n),Vr(i,s),this._updateLabel(r,n),ir(this,u.get("focus"),u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r,n){var a=this,i=this.getTextGuideLine(),o=a.getTextContent(),s=r.hostModel,l=r.getItemModel(n),u=r.getItemLayout(n),c=u.label,h=r.getItemVisual(n,"style"),f=h.fill;Jr(o,Gr(l),{labelFetcher:r.hostModel,labelDataIndex:n,defaultOpacity:h.opacity,defaultText:r.getName(n)},{normal:{align:c.textAlign,verticalAlign:c.verticalAlign}});var v=l.getModel("label"),g=v.get("color"),m=g==="inherit"?f:null;a.setTextConfig({local:!0,inside:!!c.inside,insideStroke:m,outsideFill:m});var y=c.linePoints;i.setShape({points:y}),a.textGuideLineConfig={anchor:y?new Oe(y[0][0],y[0][1]):null},At(o,{style:{x:c.x,y:c.y}},s,n),o.attr({rotation:c.rotation,originX:c.x,originY:c.y,z2:10}),nI(a,aI(l),{stroke:f})},t}(Sn),Npe=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Wf,r.ignoreLabelLineUpdate=!0,r}return t.prototype.render=function(r,n,a){var i=r.getData(),o=this._data,s=this.group;i.diff(o).add(function(l){var u=new Ape(i,l);i.setItemGraphicEl(l,u),s.add(u)}).update(function(l,u){var c=o.getItemGraphicEl(u);c.updateData(i,l),s.add(c),i.setItemGraphicEl(l,c)}).remove(function(l){var u=o.getItemGraphicEl(l);Is(u,r,l)}).execute(),this._data=i},t.prototype.remove=function(){this.group.removeAll(),this._data=null},t.prototype.dispose=function(){},t.type=Wf,t}(Rt);function kpe(e,t){for(var r=e.mapDimension("value"),n=e.mapArray(r,function(l){return l}),a=[],i=t==="ascending",o=0,s=e.count();o-1&&(o="left"),r&&Ye(["left","right"],o)>-1&&(o="bottom")),o==="left"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,x=m-w,f=x-5,h="right"):o==="right"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,x=m+w,f=x+5,h="left"):o==="top"?(m=(u[3][0]+u[0][0])/2,y=(u[3][1]+u[0][1])/2,_=y-w,v=_-5,h="center"):o==="bottom"?(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,_=y+w,v=_+5,h="center"):o==="rightTop"?(m=r?u[3][0]:u[1][0],y=r?u[3][1]:u[1][1],r?(_=y-w,v=_-5,h="center"):(x=m+w,f=x+5,h="top")):o==="rightBottom"?(m=u[2][0],y=u[2][1],r?(_=y+w,v=_+5,h="center"):(x=m+w,f=x+5,h="bottom")):o==="leftTop"?(m=u[0][0],y=r?u[0][1]:u[1][1],r?(_=y-w,v=_-5,h="center"):(x=m-w,f=x-5,h="right")):o==="leftBottom"?(m=r?u[1][0]:u[3][0],y=r?u[1][1]:u[2][1],r?(_=y+w,v=_+5,h="center"):(x=m-w,f=x-5,h="right")):(m=(u[1][0]+u[2][0])/2,y=(u[1][1]+u[2][1])/2,r?(_=y+w,v=_+5,h="center"):(x=m+w,f=x+5,h="left")),r?(x=m,f=x):(_=y,v=_),g=[[m,y],[x,_]]}l.label={linePoints:g,x:f,y:v,verticalAlign:"middle",textAlign:h,inside:c}})}var Ipe=Hr(Wf,Ppe);function Ppe(e,t){e.eachSeriesByType(Wf,function(r){var n=r.getData(),a=n.mapDimension("value"),i=r.get("sort"),o=Ur(r,t),s=tr(r.getBoxLayoutParams(),o.refContainer),l=D9(r),u=s.width,c=s.height,h=kpe(n,i),f=s.x,v=s.y,g=l?[me(r.get("minSize"),c),me(r.get("maxSize"),c)]:[me(r.get("minSize"),u),me(r.get("maxSize"),u)],m=n.getDataExtent(a),y=r.get("min"),x=r.get("max");y==null&&(y=Math.min(m[0],0)),x==null&&(x=m[1]);var _=r.get("funnelAlign"),w=r.get("gap"),S=l?u:c,C=(S-w*(n.count()-1))/n.count(),M=function(H,V){if(l){var U=n.get(a,H)||0,F=Nt(U,[y,x],g,!0),W=void 0;switch(_){case"top":W=v;break;case"center":W=v+(c-F)/2;break;case"bottom":W=v+(c-F);break}return[[V,W],[V,W+F]]}var $=n.get(a,H)||0,Z=Nt($,[y,x],g,!0),J;switch(_){case"left":J=f;break;case"center":J=f+(u-Z)/2;break;case"right":J=f+u-Z;break}return[[J,V],[J+Z,V]]};i==="ascending"&&(C=-C,w=-w,l?f+=u:v+=c,h=h.reverse());for(var A=0;A$pe)return;var a=this._model.coordinateSystem.getSlidedAxisExpandWindow([e.offsetX,e.offsetY]);a.behavior!=="none"&&this._dispatchExpand({axisExpandWindow:a.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(e){if(!(this._mouseDownPoint||!l2(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 l2(e,t){var r=e._model;return r.get("axisExpandable")&&r.get("axisExpandTriggerOn")===t}var Ab="parallel",BA=Ab,Xpe=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&&Je(n,r,!0),this._initDimensions()},t.prototype.contains=function(r,n){var a=r.get("parallelIndex");return a!=null&&n.getComponent("parallel",a)===this},t.prototype.setAxisExpand=function(r){R(["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=[],a=It(this.ecModel.queryComponents({mainType:"parallelAxis"}),function(i){return(i.get("parallelIndex")||0)===this.componentIndex},this);R(a,function(i){r.push("dim"+i.get("dim")),n.push(i.componentIndex)})},t.type=BA,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}(ht),qpe=function(e){q(t,e);function t(r,n,a,i,o){var s=e.call(this,r,n,a)||this;return s.type=i||"value",s.axisIndex=o,s}return t.prototype.isHorizontal=function(){return this.coordinateSystem.getModel().get("layout")!=="horizontal"},t}(Ci);function uu(e,t,r,n,a,i){e=e||0;var o=pc(r[1],-r[0]);if(a!=null&&(a=Td(a,[0,o])),i!=null&&(i=Math.max(i,a??0)),n==="all"){var s=Math.abs(pc(t[1],-t[0]));s=Td(s,[0,o]),a=i=Td(s,[a,i]),n=0}t[0]=Td(t[0],r),t[1]=Td(t[1],r);var l=u2(t,n);t[n]+=e;var u=a||0,c=r.slice();l.sign<0?c[0]=pc(c[0],u):c[1]=pc(c[1],-u),t[n]=Td(t[n],c);var h;return h=u2(t,n),a!=null&&(h.sign!==l.sign||h.spani&&(t[1-n]=pc(t[n],h.sign*i)),t}function u2(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 Td(e,t){return Math.min(t[1]!=null?t[1]:1/0,Math.max(t[0]!=null?t[0]:-1/0,e))}var Kpe=function(){function e(t,r,n){this.type=Ab,this._axesMap=we(),this._axesLayout={},this.dimensions=t.dimensions,this._model=t,this._init(t,r,n)}return e.prototype._init=function(t,r,n){var a=t.dimensions,i=t.parallelAxisIndex;R(a,function(o,s){var l=i[s],u=r.getComponent("parallelAxis",l),c=Km(u),h=this._axesMap.set(o,new qpe(o,Sv(u,c,!1),[0,0],c,l));h.onBand=Qm(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){R(this.dimensions,function(n){var a=this._axesMap.get(n);fh(a,Vf),Gf(a)},this)},e.prototype.containPoint=function(t){var r=this._makeLayoutInfo(),n=r.axisBase,a=r.layoutBase,i=r.pixelDimIndex,o=t[1-i],s=t[i];return o>=n&&o<=n+r.axisLength&&s>=a&&s<=a+r.layoutLength},e.prototype.getModel=function(){return this._model},e.prototype.resize=function(t,r){var n=Ur(t,r).refContainer;this._rect=tr(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"],a=["width","height"],i=t.get("layout"),o=i==="horizontal"?0:1,s=r[a[o]],l=[0,s],u=this.dimensions.length,c=U0(t.get("axisExpandWidth"),l),h=U0(t.get("axisExpandCount")||0,[0,u]),f=t.get("axisExpandable")&&u>3&&u>h&&h>1&&c>0&&s>0,v=t.get("axisExpandWindow"),g;if(v)g=U0(v[1]-v[0],l),v[1]=v[0]+g;else{g=U0(c*(h-1),l);var m=t.get("axisExpandCenter")||mi(u/2);v=[c*m-g/2],v[1]=v[0]+g}var y=(s-g)/(u-h);y<3&&(y=0);var x=[mi(Mt(v[0]/c,1))+1,Ph(Mt(v[1]/c,1))-1],_=y/c*v[0];return{layout:i,pixelDimIndex:o,layoutBase:r[n[o]],layoutLength:s,axisBase:r[n[1-o]],axisLength:r[a[1-o]],axisExpandable:f,axisExpandWidth:c,axisCollapseWidth:y,axisExpandWindow:v,axisCount:u,winInnerIndices:x,axisExpandWindow0Pos:_}},e.prototype._layoutAxes=function(){var t=this._rect,r=this._axesMap,n=this.dimensions,a=this._makeLayoutInfo(),i=a.layout;r.each(function(o){var s=[0,a.axisLength],l=o.inverse?1:0;o.setExtent(s[l],s[1-l])}),R(n,function(o,s){var l=(a.axisExpandable?Qpe:Jpe)(s,a),u={horizontal:{x:l.position,y:a.axisLength},vertical:{x:0,y:l.position}},c={horizontal:R_/2,vertical:0},h=[u[i].x+t.x,u[i].y+t.y],f=c[i],v=ar();Js(v,v,f),Hi(v,v,h),this._axesLayout[o]={position:h,rotation:f,transform:v,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,a){n==null&&(n=0),a==null&&(a=t.count());var i=this._axesMap,o=this.dimensions,s=[],l=[];R(o,function(y){s.push(t.mapDimension(y)),l.push(i.get(y).model)});for(var u=this.hasAxisBrushed(),c=n;ci*(1-h[0])?(u="jump",l=s-i*(1-h[2])):(l=s-i*h[1])>=0&&(l=s-i*(1-h[1]))<=0&&(l=0),l*=r.axisExpandWidth/c,l?uu(l,a,o,"all"):u="none";else{var v=a[1]-a[0],g=o[1]*s/v;a=[at(0,g-v/2)],a[1]=Et(o[1],a[0]+v),a[0]=a[1]-v}return{axisExpandWindow:a,behavior:u}},e}();function U0(e,t){return Et(at(e,t[0]),t[1])}function Jpe(e,t){var r=t.layoutLength/(t.axisCount-1);return{position:r*e,axisNameAvailableWidth:r,axisLabelShow:!0}}function Qpe(e,t){var r=t.layoutLength,n=t.axisExpandWidth,a=t.axisCount,i=t.axisCollapseWidth,o=t.winInnerIndices,s,l=i,u=!1,c;return e=0;a--)on(n[a])},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 a=n[0];if(a[0]<=r&&r<=a[1])return"active"}else for(var i=0,o=n.length;iage}function F9(e){var t=e.length-1;return t<0&&(t=0),[e[0],e[t]]}function V9(e,t,r,n){var a=new De;return a.add(new it({name:"main",style:GI(r),silent:!0,draggable:!0,cursor:"move",drift:nt(t4,e,t,a,["n","s","w","e"]),ondragend:nt(wh,t,{isEnd:!0})})),R(n,function(i){a.add(new it({name:i.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:nt(t4,e,t,a,i),ondragend:nt(wh,t,{isEnd:!0})}))}),a}function G9(e,t,r,n){var a=n.brushStyle.lineWidth||0,i=$f(a,ige),o=r[0][0],s=r[1][0],l=o-a/2,u=s-a/2,c=r[0][1],h=r[1][1],f=c-i+a/2,v=h-i+a/2,g=c-o,m=h-s,y=g+a,x=m+a;ps(e,t,"main",o,s,g,m),n.transformable&&(ps(e,t,"w",l,u,i,x),ps(e,t,"e",f,u,i,x),ps(e,t,"n",l,u,y,i),ps(e,t,"s",l,v,y,i),ps(e,t,"nw",l,u,i,i),ps(e,t,"ne",f,u,i,i),ps(e,t,"sw",l,v,i,i),ps(e,t,"se",f,v,i,i))}function GA(e,t){var r=t.__brushOption,n=r.transformable,a=t.childAt(0);a.useStyle(GI(r)),a.attr({silent:!n,cursor:n?"move":"default"}),R([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],function(i){var o=t.childOfName(i.join("")),s=i.length===1?HA(e,i[0]):hge(e,i);o&&o.attr({silent:!n,invisible:!n,cursor:n?sge[s]+"-resize":null})})}function ps(e,t,r,n,a,i,o){var s=t.childOfName(r);s&&s.setShape(fge(HI(e,t,[[n,a],[n+i,a+o]])))}function GI(e){return Ee({strokeNoScale:!0},e.brushStyle)}function H9(e,t,r,n){var a=[Tm(e,r),Tm(t,n)],i=[$f(e,r),$f(t,n)];return[[a[0],i[0]],[a[1],i[1]]]}function cge(e){return Vc(e.group)}function HA(e,t){var r={w:"left",e:"right",n:"top",s:"bottom"},n={left:"w",right:"e",top:"n",bottom:"s"},a=O1(r[t],cge(e));return n[a]}function hge(e,t){var r=[HA(e,t[0]),HA(e,t[1])];return(r[0]==="e"||r[0]==="w")&&r.reverse(),r.join("")}function t4(e,t,r,n,a,i){var o=r.__brushOption,s=e.toRectRange(o.range),l=U9(t,a,i);R(n,function(u){var c=oge[u];s[c[0]][c[1]]+=l[c[0]]}),o.range=e.fromRectRange(H9(s[0][0],s[1][0],s[0][1],s[1][1])),BI(t,r),wh(t,{isEnd:!1})}function dge(e,t,r,n){var a=t.__brushOption.range,i=U9(e,r,n);R(a,function(o){o[0]+=i[0],o[1]+=i[1]}),BI(e,t),wh(e,{isEnd:!1})}function U9(e,t,r){var n=e.group,a=n.transformCoordToLocal(t,r),i=n.transformCoordToLocal(0,0);return[a[0]-i[0],a[1]-i[1]]}function HI(e,t,r){var n=B9(e,t);return n&&n!==bh?n.clipPath(r,e._transform):ke(r)}function fge(e){var t=Tm(e[0][0],e[1][0]),r=Tm(e[0][1],e[1][1]),n=$f(e[0][0],e[1][0]),a=$f(e[0][1],e[1][1]);return{x:t,y:r,width:n-t,height:a-r}}function vge(e,t,r){if(!(!e._brushType||gge(e,t.offsetX,t.offsetY))){var n=e._zr,a=e._covers,i=VI(e,t,r);if(!e._dragging)for(var o=0;on.getWidth()||r<0||r>n.getHeight()}var cw={lineX:a4(0),lineY:a4(1),rect:{createCover:function(e,t){function r(n){return n}return V9({toRectRange:r,fromRectRange:r},e,t,[["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]])},getCreatingRange:function(e){var t=F9(e);return H9(t[1][0],t[1][1],t[0][0],t[0][1])},updateCoverShape:function(e,t,r,n){G9(e,t,r,n)},updateCommon:GA,contain:WA},polygon:{createCover:function(e,t){var r=new De;return r.add(new un({name:"main",style:GI(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:nt(dge,e,t),ondragend:nt(wh,e,{isEnd:!0})}))},updateCoverShape:function(e,t,r,n){t.childAt(0).setShape({points:HI(e,t,r)})},updateCommon:GA,contain:WA}};function a4(e){return{createCover:function(t,r){return V9({toRectRange:function(n){var a=[n,[0,100]];return e&&a.reverse(),a},fromRectRange:function(n){return n[e]}},t,r,[[["w"],["e"]],[["n"],["s"]]][e])},getCreatingRange:function(t){var r=F9(t),n=Tm(r[0][e],r[1][e]),a=$f(r[0][e],r[1][e]);return[n,a]},updateCoverShape:function(t,r,n,a){var i,o=B9(t,r);if(o!==bh&&o.getLinearBrushOtherExtent)i=o.getLinearBrushOtherExtent(e);else{var s=t._zr;i=[0,[s.getWidth(),s.getHeight()][1-e]]}var l=[n,i];e&&l.reverse(),G9(t,r,l,a)},updateCommon:GA,contain:WA}}function $9(e){return e=UI(e),function(t){return iL(t,e)}}function Z9(e,t){return e=UI(e),function(r){var n=t??r,a=n?e.width:e.height,i=n?e.x:e.y;return[i,i+(a||0)]}}function Y9(e,t,r){var n=UI(e);return function(a,i){return n.contain(i[0],i[1])&&!V8(a,t,r)}}function UI(e){return je.create(e)}var mge=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 zI(n.getZr())).on("brush",be(this._onBrush,this))},t.prototype.render=function(r,n,a,i){if(!yge(r,n,i)){this.axisModel=r,this.api=a,this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new De,this.group.add(this._axisGroup),!!r.get("show")){var s=_ge(r,n),l=s.coordinateSystem,u=r.getAreaSelectStyle(),c=u.width,h=r.axis.dim,f=l.getAxisLayout(h),v=te({strokeContainThreshold:c},f),g=new ea(r,a,v);g.build(),this._axisGroup.add(g.group),this._refreshBrushController(v,u,r,s,c,a),$m(o,this._axisGroup,r)}}},t.prototype._refreshBrushController=function(r,n,a,i,o,s){var l=a.axis.getExtent(),u=l[1]-l[0],c=Math.min(30,Math.abs(u)*.1),h=je.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:$9(h),isTargetByCursor:Y9(h,s,i),getLinearBrushOtherExtent:Z9(h,0)}]).enableBrush({brushType:"lineX",brushStyle:n,removeOnClick:!0}).updateCovers(xge(a))},t.prototype._onBrush=function(r){var n=r.areas,a=this.axisModel,i=a.axis,o=oe(n,function(s){return[i.coordToData(s.range[0],!0),i.coordToData(s.range[1],!0)]});(!a.option.realtime===r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"axisAreaSelect",parallelAxisId:a.id,intervals:o})},t.prototype.dispose=function(){this._brushController.dispose()},t.type="parallelAxis",t}(Yt);function yge(e,t,r){return r&&r.type==="axisAreaSelect"&&t.findComponents({mainType:"parallelAxis",query:r})[0]===e}function xge(e){var t=e.axis;return oe(e.activeIntervals,function(r){return{brushType:"lineX",panelId:"pl",range:[t.dataToCoord(r[0],!0),t.dataToCoord(r[1],!0)]}})}function _ge(e,t){return t.getComponent("parallel",e.get("parallelIndex"))}var bge={type:"axisAreaSelect",event:"axisAreaSelected"};function wge(e){e.registerAction(bge,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 Sge={type:"value",areaSelectStyle:{width:20,borderWidth:1,borderColor:"rgba(160,197,232)",color:"rgba(160,197,232)",opacity:.3},realtime:!0,z:10};function X9(e){e.registerComponentView(Zpe),e.registerComponentModel(Xpe),e.registerCoordinateSystem("parallel",tge),e.registerPreprocessor(Hpe),e.registerComponentModel(FA),e.registerComponentView(mge),Uf(e,"parallel",FA,Sge),wge(e)}function Cge(e){rt(X9),e.registerChartView(Epe),e.registerSeriesModel(zpe),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,Gpe)}var Xs="sankey",Tge=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 a=r.edges||r.links||[],i=r.data||r.nodes||[],o=r.levels||[];this.levelModels=[];for(var s=this.levelModels,l=0;l=0&&(s[o[l].depth]=new vt(o[l],this,n));var u=PI(i,a,this,!0,c);return u.data;function c(h,f){h.wrapMethod("getItemModel",function(v,g){var m=v.parentModel,y=m.getData().getItemLayout(g);if(y){var x=y.depth,_=m.levelModels[x];_&&(v.parentModel=_)}return v}),f.wrapMethod("getItemModel",function(v,g){var m=v.parentModel,y=m.getGraph().getEdgeByIndex(g),x=y.node1.getLayout();if(x){var _=x.depth,w=m.levelModels[_];w&&(v.parentModel=w)}return v})}},t.prototype.setNodePosition=function(r,n){var a=this.option.data||this.option.nodes,i=a[r];i.localX=n[0],i.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,a){function i(v){return isNaN(v)||v==null}if(a==="edge"){var o=this.getDataParams(r,a),s=o.data,l=o.value,u=s.source+" -- "+s.target;return Er("nameValue",{name:u,value:l,noValue:i(l)})}else{var c=this.getGraph().getNodeByIndex(r),h=c.getLayout().value,f=this.getDataParams(r,a).data.name;return Er("nameValue",{name:f!=null?f+"":null,value:h,noValue:i(h)})}},t.prototype.optionUpdated=function(){},t.prototype.getDataParams=function(r,n){var a=e.prototype.getDataParams.call(this,r,n);if(a.value==null&&n==="node"){var i=this.getGraph().getNodeByIndex(r),o=i.getLayout().value;a.value=o}return a},t.prototype.__ownRoamView=function(){return this.coordinateSystem},t.type="series."+Xs,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}(Ut),Mge=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}(),Age=function(e){q(t,e);function t(r){return e.call(this,r)||this}return t.prototype.getDefaultShape=function(){return new Mge},t.prototype.buildPath=function(r,n){var a=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+a,n.y2),r.bezierCurveTo(n.cpx2+a,n.cpy2,n.cpx1+a,n.cpy1,n.x1+a,n.y1)):(r.lineTo(n.x2,n.y2+a),r.bezierCurveTo(n.cpx2,n.cpy2+a,n.cpx1,n.cpy1+a,n.x1,n.y1+a)),r.closePath()},t.prototype.highlight=function(){Us(this)},t.prototype.downplay=function(){Ws(this)},t}(pt),Nge=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Xs,r._mainGroup=new De,r}return t.prototype.init=function(r,n){this._controller=new Hh(n.getZr()),this.group.add(this._mainGroup),this._firstRender=!0},t.prototype.render=function(r,n,a){var i=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,a),sw(r,a,this._controller,e9(o),null),i.eachEdge(function(v){var g=new Age,m=Be(g);m.dataIndex=v.dataIndex,m.seriesIndex=r.seriesIndex,m.dataType="edge";var y=v.getModel(),x=y.getModel("lineStyle"),_=x.get("curveness"),w=v.node1.getLayout(),S=v.node1.getModel(),C=S.get("localX"),M=S.get("localY"),A=v.node2.getLayout(),k=v.node2.getModel(),I=k.get("localX"),P=k.get("localY"),j=v.getLayout(),z,D,B,H,V,U,F,W;g.shape.extent=Math.max(1,j.dy),g.shape.orient=f,f==="vertical"?(z=(C!=null?C*l:w.x)+j.sy,D=(M!=null?M*u:w.y)+w.dy,B=(I!=null?I*l:A.x)+j.ty,H=P!=null?P*u:A.y,V=z,U=D*(1-_)+H*_,F=B,W=D*_+H*(1-_)):(z=(C!=null?C*l:w.x)+w.dx,D=(M!=null?M*u:w.y)+j.sy,B=I!=null?I*l:A.x,H=(P!=null?P*u:A.y)+j.ty,V=z*(1-_)+B*_,U=D,F=z*_+B*(1-_),W=H),g.setShape({x1:z,y1:D,x2:B,y2:H,cpx1:V,cpy1:U,cpx2:F,cpy2:W}),g.useStyle(x.getItemStyle()),i4(g.style,f,v);var $=""+y.get("value"),Z=Gr(y,"edgeLabel");Jr(g,Z,{labelFetcher:{getFormattedLabel:function(Q,le,de,He,ye,ne){return r.getFormattedLabel(Q,le,"edge",He,ya(ye,Z.normal&&Z.normal.get("formatter"),$),ne)}},labelDataIndex:v.dataIndex,defaultText:$}),g.setTextConfig({position:"inside"});var J=y.getModel("emphasis");Vr(g,y,"lineStyle",function(Q){var le=Q.getItemStyle();return i4(le,f,v),le}),o.add(g),h.setItemGraphicEl(v.dataIndex,g);var re=J.get("focus");ir(g,re==="adjacency"?v.getAdjacentDataIndices():re==="trajectory"?v.getTrajectoryDataIndices():re,J.get("blurScope"),J.get("disabled"))}),i.eachNode(function(v){var g=v.getLayout(),m=v.getModel(),y=m.get("localX"),x=m.get("localY"),_=m.getModel("emphasis"),w=m.get(["itemStyle","borderRadius"])||0,S=new it({shape:{x:y!=null?y*l:g.x,y:x!=null?x*u:g.y,width:g.dx,height:g.dy,r:w},style:m.getModel("itemStyle").getItemStyle(),z2:10});Jr(S,Gr(m),{labelFetcher:{getFormattedLabel:function(M,A){return r.getFormattedLabel(M,A,"node")}},labelDataIndex:v.dataIndex,defaultText:v.id}),S.disableLabelAnimation=!0,S.setStyle("fill",v.getVisual("color")),S.setStyle("decal",v.getVisual("style").decal),Vr(S,m),o.add(S),c.setItemGraphicEl(v.dataIndex,S),Be(S).dataType="node";var C=_.get("focus");ir(S,C==="adjacency"?v.getAdjacentDataIndices():C==="trajectory"?v.getTrajectoryDataIndices():C,_.get("blurScope"),_.get("disabled"))}),c.eachItemGraphicEl(function(v,g){var m=c.getItemModel(g);m.get("draggable")&&(v.drift=function(y,x){this.shape.x+=y,this.shape.y+=x,this.dirty(),a.dispatchAction({type:"dragNode",seriesId:r.id,dataIndex:c.getRawIndex(g),localX:this.shape.x/l,localY:this.shape.y/u})},v.draggable=!0,v.cursor="move")}),!this._data&&r.isAnimationEnabled()&&o.setClipPath(kge(o.getBoundingRect(),r,function(){o.removeClipPath()})),this._data=r.getData(),this._firstRender=!1},t.prototype.__updateOnOwnRoam=function(r,n,a){lu(this.group,$o,n.coordinateSystem,null)},t.prototype.dispose=function(){this._controller&&this._controller.dispose()},t.prototype._updateViewCoordSys=function(r,n){var a=r.layoutInfo,i=r.coordinateSystem=TI(r,n,a.x,a.y,a.width,a.height);lu(this.group,$o,i,this._firstRender?null:r)},t.type=Xs,t}(Rt);function i4(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"),a=r.node2.getVisual("color");ve(n)&&ve(a)&&(e.fill=new Eh(0,0,+(t==="horizontal"),+(t==="vertical"),[{color:n,offset:0},{color:a,offset:1}]))}}function kge(e,t,r){var n=new it({shape:{x:e.x-10,y:e.y-10,width:0,height:e.height+20}});return Qt(n,{shape:{width:e.width+20}},t,r),n}var Lge=Hr(Xs,Ige);function Ige(e,t){e.eachSeriesByType(Xs,function(r){var n=r.get("nodeWidth"),a=r.get("nodeGap"),i=Ur(r,t).refContainer,o=tr(r.getBoxLayoutParams(),i);r.layoutInfo=o;var s=o.width,l=o.height,u=r.getGraph(),c=u.nodes,h=u.edges;Dge(c);var f=It(c,function(y){return y.getLayout().value===0}),v=f.length!==0?0:r.get("layoutIterations"),g=r.get("orient"),m=r.get("nodeAlign");Pge(c,h,n,a,s,l,v,g,m)})}function Pge(e,t,r,n,a,i,o,s,l){jge(e,t,r,a,i,s,l),zge(e,t,i,a,n,o,s),Zge(e,s)}function Dge(e){R(e,function(t){var r=eu(t.outEdges,Nb),n=eu(t.inEdges,Nb),a=t.getValue()||0,i=Math.max(r,n,a);t.setLayout({value:i},!0)})}function jge(e,t,r,n,a,i,o){for(var s=[],l=[],u=[],c=[],h=0,f=0;f=0;x&&y.depth>v&&(v=y.depth),m.setLayout({depth:x?y.depth:h},!0),i==="vertical"?m.setLayout({dy:r},!0):m.setLayout({dx:r},!0);for(var _=0;_h-1?v:h-1;o&&o!=="left"&&Ege(e,o,i,A);var k=i==="vertical"?(a-r)/A:(n-r)/A;Oge(e,k,i)}function q9(e){var t=e.hostGraph.data.getRawDataItem(e.dataIndex);return t.depth!=null&&t.depth>=0}function Ege(e,t,r,n){if(t==="right"){for(var a=[],i=e,o=0;i.length;){for(var s=0;s0;i--)l*=.99,Vge(s,l,o),c2(s,a,r,n,o),$ge(s,l,o),c2(s,a,r,n,o)}function Bge(e,t){var r=[],n=t==="vertical"?"y":"x",a=AM(e,function(i){return i.getLayout()[n]});return on(a.keys),R(a.keys,function(i){r.push(a.buckets.get(i))}),r}function Fge(e,t,r,n,a,i){var o=1/0;R(e,function(s){var l=s.length,u=0;R(s,function(h){u+=h.getLayout().value});var c=i==="vertical"?(n-(l-1)*a)/u:(r-(l-1)*a)/u;c0&&(s=l.getLayout()[i]+u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[i]+l.getLayout()[f]+t;var g=a==="vertical"?n:r;if(u=c-t-g,u>0){s=l.getLayout()[i]-u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0),c=s;for(var v=h-2;v>=0;--v)l=o[v],u=l.getLayout()[i]+l.getLayout()[f]+t-c,u>0&&(s=l.getLayout()[i]-u,a==="vertical"?l.setLayout({x:s},!0):l.setLayout({y:s},!0)),c=l.getLayout()[i]}})}function Vge(e,t,r){R(e.slice().reverse(),function(n){R(n,function(a){if(a.outEdges.length){var i=eu(a.outEdges,Gge,r)/eu(a.outEdges,Nb);if(isNaN(i)){var o=a.outEdges.length;i=o?eu(a.outEdges,Hge,r)/o:0}if(r==="vertical"){var s=a.getLayout().x+(i-cu(a,r))*t;a.setLayout({x:s},!0)}else{var l=a.getLayout().y+(i-cu(a,r))*t;a.setLayout({y:l},!0)}}})})}function Gge(e,t){return cu(e.node2,t)*e.getValue()}function Hge(e,t){return cu(e.node2,t)}function Uge(e,t){return cu(e.node1,t)*e.getValue()}function Wge(e,t){return cu(e.node1,t)}function cu(e,t){return t==="vertical"?e.getLayout().x+e.getLayout().dx/2:e.getLayout().y+e.getLayout().dy/2}function Nb(e){return e.getValue()}function eu(e,t,r){for(var n=0,a=e.length,i=-1;++io&&(o=l)}),R(n,function(s){var l=new Kr({type:"color",mappingMethod:"linear",dataExtent:[i,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}))})}a.length&&R(a,function(s){var l=s.getModel().get("lineStyle");s.setVisual("style",l)})})}function qge(e){e.registerChartView(Nge),e.registerSeriesModel(Tge),e.registerLayout(Lge),e.registerVisual(Yge),e.registerAction({type:"dragNode",event:"dragnode",update:"update"},function(t,r){r.eachComponent({mainType:Ho,subType:Xs,query:t},function(n){n.setNodePosition(t.dataIndex,[t.localX,t.localY])})}),CI(e,Ho,Xs)}var K9=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,a=r.getComponent("xAxis",this.get("xAxisIndex")),i=r.getComponent("yAxis",this.get("yAxisIndex")),o=a.get("type"),s=i.get("type"),l,u=t.layout;o==="category"?(u="horizontal",n=a.getOrdinalMeta(),l=!this._hasEncodeRule("x")):s==="category"&&(u="vertical",n=i.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],v=c[1-h],g=[a,i],m=g[h].get("type"),y=g[1-h].get("type"),x=t.data;if(x&&l){var _=[];R(x,function(C,M){var A;ae(C)?(A=C.slice(),C.unshift(M)):ae(C.value)?(A=te({},C),A.value=A.value.slice(),C.value.unshift(M)):A=C,_.push(A)}),t.data=_}var w=this.defaultValueDimensions,S=[{name:f,type:nb(m),ordinalMeta:n,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:v,type:nb(y),dimsDef:w.slice()}];return Av(this,{coordDimensions:S,dimensionsCount:w.length+1,encodeDefaulter:nt(MH,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 kb(e,t){for(var r=t.ends.length,n=0,a=0;am){var S=[x,w];n.push(S)}}}return{boxData:r,outliers:n}}var lme={type:"echarts:boxplot",transform:function(t){var r=t.upstream;if(r.sourceFormat!==ln){var n="";Lt(n)}var a=sme(r.getRawData(),t.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:a.boxData},{data:a.outliers}]}};function ume(e){e.registerSeriesModel(J9),e.registerChartView(Kge),e.registerLayout(rme),e.registerTransform(lme),ome(e)}var hu="candlestick",e$=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,a){var i=n.getItemLayout(r);return i&&a.rect(i.brushRect)},t.type="series."+hu,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}(Ut);kr(e$,K9,!0);var cme=["itemStyle","borderColor"],hme=["itemStyle","borderColor0"],dme=["itemStyle","borderColorDoji"],fme=["itemStyle","color"],vme=["itemStyle","color0"];function WI(e,t){return t.get(e>0?fme:vme)}function $I(e,t){return t.get(e===0?dme:e>0?cme:hme)}var pme={seriesType:hu,plan:Bh(),performRawSeries:!0,reset:function(e,t){if(!t.isSeriesFiltered(e)){var r=e.pipelineContext.large;return!r&&{progress:function(n,a){for(var i;(i=n.next())!=null;){var o=a.getItemModel(i),s=a.getItemLayout(i).sign,l=o.getItemStyle();l.fill=WI(s,o),l.stroke=$I(s,o)||l.fill;var u=a.ensureUniqueItemVisual(i,"style");te(u,l)}}}}}},gme=["color","borderColor"],mme=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,a){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(r),this._isLargeDraw?this._renderLarge(r):this._renderNormal(r)},t.prototype.incrementalPrepareRender=function(r,n,a){this._clear(),this._updateDrawMode(r)},t.prototype.incrementalRender=function(r,n,a,i){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(r,n):this._incrementalRenderNormal(r,n)},t.prototype.eachRendered=function(r){Su(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(),a=this._data,i=this.group,o=n.getLayout("isSimpleBox"),s=r.get("clip",!0),l=r.coordinateSystem,u=l.getArea&&l.getArea(),c=s&&vh(l,!1,r);this._data||i.removeAll();var h=s4(r);n.diff(a).add(function(f){if(n.hasValue(f)){var v=n.getItemLayout(f),g=s?kb(u,v):hm;if(g===fm)return;var m=h2(v,f,h,!0);Qt(m,{shape:{points:v.ends}},r,f),ef(g===dm,m,c),d2(m,n,f,o),i.add(m),n.setItemGraphicEl(f,m)}}).update(function(f,v){var g=a.getItemGraphicEl(v);if(!n.hasValue(f)){i.remove(g);return}var m=n.getItemLayout(f),y=s?kb(u,m):hm;if(y===fm){i.remove(g);return}g?(At(g,{shape:{points:m.ends}},r,f),_i(g)):g=h2(m,f,h),d2(g,n,f,o),ef(y===dm,g,c),i.add(g),n.setItemGraphicEl(f,g)}).remove(function(f){var v=a.getItemGraphicEl(f);v&&i.remove(v)}).execute(),this._data=n},t.prototype._renderLarge=function(r){this._clear(),l4(r,this.group);var n=r.get("clip",!0)?vh(r.coordinateSystem,!1,r):null;ef(!!n,this.group,n)},t.prototype._incrementalRenderNormal=function(r,n){for(var a=n.getData(),i=a.getLayout("isSimpleBox"),o=s4(n),s;(s=r.next())!=null;){var l=a.getItemLayout(s),u=h2(l,s,o);d2(u,a,s,i),u.incremental=Io(n),this.group.add(u),this._progressiveEls.push(u)}},t.prototype._incrementalRenderLarge=function(r,n){l4(n,this.group,this._progressiveEls,!0)},t.prototype.remove=function(r){this._clear()},t.prototype._clear=function(){this.group.removeAll(),ef(!1,this.group,null),this._data=null},t.type=hu,t}(Rt),yme=function(){function e(){}return e}(),xme=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 yme},t.prototype.buildPath=function(r,n){var a=n.points;this.__simpleBox?(r.moveTo(a[4][0],a[4][1]),r.lineTo(a[6][0],a[6][1])):(r.moveTo(a[0][0],a[0][1]),r.lineTo(a[1][0],a[1][1]),r.lineTo(a[2][0],a[2][1]),r.lineTo(a[3][0],a[3][1]),r.closePath(),r.moveTo(a[4][0],a[4][1]),r.lineTo(a[5][0],a[5][1]),r.moveTo(a[6][0],a[6][1]),r.lineTo(a[7][0],a[7][1]))},t}(pt);function h2(e,t,r,n){var a=e.ends;return new xme({shape:{points:n?_me(a,r,e):a},z2:100})}function d2(e,t,r,n){var a=t.getItemModel(r);e.useStyle(t.getItemVisual(r,"style")),e.style.strokeNoScale=!0;var i=a.getShallow("cursor");i&&e.attr("cursor",i),e.__simpleBox=n,Vr(e,a);var o=t.getItemLayout(r).sign;R(e.states,function(l,u){var c=a.getModel(u),h=WI(o,c),f=$I(o,c)||h,v=l.style||(l.style={});h&&(v.fill=h),f&&(v.stroke=f)});var s=a.getModel("emphasis");ir(e,s.get("focus"),s.get("blurScope"),s.get("disabled"))}function _me(e,t,r){return oe(e,function(n){return n=n.slice(),n[t]=r.initBaseline,n})}function s4(e){return e.getWhiskerBoxesLayout()==="horizontal"?1:0}var bme=function(){function e(){}return e}(),f2=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 bme},t.prototype.buildPath=function(r,n){for(var a=n.points,i=0;iC?j[i]:P[i],ends:B,brushRect:W(M,A,w)})}function U(Z,J){var re=[];return re[a]=J,re[i]=Z,isNaN(J)||isNaN(Z)?[NaN,NaN]:t.dataToPoint(re)}function F(Z,J,re){var Q=J.slice(),le=J.slice();Q[a]=Ox(Q[a]+n/2,1,!1),le[a]=Ox(le[a]-n/2,1,!0),re?Z.push(Q,le):Z.push(le,Q)}function W(Z,J,re){var Q=U(Z,re),le=U(J,re);return Q[a]-=n/2,le[a]-=n/2,{x:Q[0],y:Q[1],width:i?n:le[0]-Q[0],height:i?le[1]-Q[1]:n}}function $(Z){return Z[a]=Ox(Z[a],1),Z}}function g(m,y){for(var x=So(m.count*4),_=0,w,S=[],C=[],M,A=y.getStore(),k=!!e.get(["itemStyle","borderColorDoji"]);(M=m.next())!=null;){var I=A.get(s,M),P=A.get(u,M),j=A.get(c,M),z=A.get(h,M),D=A.get(f,M);if(isNaN(I)||isNaN(z)||isNaN(D)){x[_++]=NaN,_+=3;continue}x[_++]=u4(A,M,P,j,c,k),S[a]=I,S[i]=z,w=t.dataToPoint(S,null,C),x[_++]=w?w[0]:NaN,x[_++]=w?w[1]:NaN,S[i]=D,w=t.dataToPoint(S,null,C),x[_++]=w?w[1]:NaN}y.setLayout("largePoints",x)}}};function u4(e,t,r,n,a,i){var o;return r>n?o=-1:r0?e.get(a,t-1)<=n?1:-1:1,o}function Tme(e,t){var r=e.getBaseAxis(),n=Cn(r,{fromStat:{key:Uc(hu)},min:1}).w,a=me(Te(e.get("barMaxWidth"),n),n),i=me(Te(e.get("barMinWidth"),1),n),o=e.get("barWidth");return o!=null?me(o,n):at(Et(n/2,a),i)}function Mme(e){Sme(e,function(){var t=Uc(hu);tI(e,{key:t,seriesType:hu,getMetrics:pI}),K1(t,tw(t))})}function Ame(e){e.registerChartView(mme),e.registerSeriesModel(e$),e.registerPreprocessor(wme),e.registerVisual(pme),e.registerLayout(Cme),Mme(e)}function c4(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 Nme=function(e){q(t,e);function t(r,n){var a=e.call(this)||this,i=new ey(r,n),o=new De;return a.add(i),a.add(o),a.updateData(r,n),a}return t.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},t.prototype.startEffectAnimation=function(r){for(var n=r.symbolType,a=r.color,i=r.rippleNumber,o=this.childAt(1),s=0;s0&&(s=this._getLineLength(i)/c*1e3),s!==this._period||l!==this._loop||u!==this._roundTrip){i.stopAnimation();var f=void 0;Le(h)?f=h(a):f=h,i.__t>0&&(f=-s*i.__t),this._animateSymbol(i,s,f,l,u)}this._period=s,this._loop=l,this._roundTrip=u}},t.prototype._animateSymbol=function(r,n,a,i,o){if(n>0){r.__t=0;var s=this,l=r.animate("",i).when(o?n*2:n,{__t:o?2:1}).delay(a).during(function(){s._updateSymbolPosition(r)});i||l.done(function(){s.remove(r)}),l.start()}},t.prototype._getLineLength=function(r){return Ss(r.__p1,r.__cp1)+Ss(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,a){this.childAt(0).updateData(r,n,a),this._updateEffectSymbol(r,n)},t.prototype._updateSymbolPosition=function(r){var n=r.__p1,a=r.__p2,i=r.__cp1,o=r.__t<=1?r.__t:2-r.__t,s=[r.x,r.y],l=s.slice(),u=an,c=dM;s[0]=u(n[0],i[0],a[0],o),s[1]=u(n[1],i[1],a[1],o);var h=r.__t<=1?c(n[0],i[0],a[0],o):c(a[0],i[0],n[0],1-o),f=r.__t<=1?c(n[1],i[1],a[1],o):c(a[1],i[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&&!(i[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-i[l])/(i[l+1]-i[l]),h=a[l],f=a[l+1];r.x=h[0]*(1-c)+c*f[0],r.y=h[1]*(1-c)+c*f[1];var v=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,v)-Math.PI/2,this._lastFrame=l,this._lastFramePercent=n,r.ignore=!1}},t}(t$),Dme=function(){function e(){this.polyline=!1,this.curveness=0,this.segs=[]}return e}(),jme=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 Dme},t.prototype.buildPath=function(r,n){var a=n.segs,i=n.curveness,o;if(n.polyline)for(o=this._off;o0){r.moveTo(a[o++],a[o++]);for(var l=1;l0){var v=(u+h)/2-(c-f)*i,g=(c+f)/2-(h-u)*i;r.quadraticCurveTo(v,g,h,f)}else r.lineTo(h,f)}this.incremental&&(this._off=o,this.notClear=!0)},t.prototype.findDataIndex=function(r,n){var a=this.shape,i=a.segs,o=a.curveness,s=this.style.lineWidth;if(a.polyline)for(var l=0,u=0;u0)for(var h=i[u++],f=i[u++],v=1;v0){var y=(h+g)/2-(f-m)*o,x=(f+m)/2-(g-h)*o;if(u7(h,f,y,x,g,m,s,r,n))return l}else if(Sl(h,f,g,m,s,r,n))return l;l++}return-1},t.prototype.contain=function(r,n){var a=this.transformCoordToLocal(r,n),i=this.getBoundingRect();if(r=a[0],n=a[1],i.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,a=n.segs,i=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}(),n$={seriesType:"lines",plan:Bh(),reset:function(e){var t=e.coordinateSystem;if(t){var r=e.get("polyline"),n=e.pipelineContext.large;return{progress:function(a,i){var o=[];if(n){var s=void 0,l=a.end-a.start;if(r){for(var u=0,c=a.start;c0&&c&&u.configLayer(s,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(l/10+.9,1),0)}),o.updateData(i);var h=r.get("clip",!0)&&vh(r.coordinateSystem,!1,r);h?this.group.setClipPath(h):this.group.removeClipPath(),this._lastZlevel=s,this._finished=!0},t.prototype.incrementalPrepareRender=function(r,n,a){var i=r.getData(),o=this._updateLineDraw(i,r);o.incrementalPrepareUpdate(i),this._clearLayer(a),this._finished=!1},t.prototype.incrementalRender=function(r,n,a){this._lineDraw.incrementalUpdate(r,n.getData(),Io(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,a){var i=r.getData(),o=this._lineDraw;if(!this._finished||!o||!o.updateLayout)return{update:!0};var s=n$.reset(r,n,a);s.progress&&s.progress({start:0,end:i.count(),count:i.count()},i),o.updateLayout(),this._clearLayer(a)},t.prototype._updateLineDraw=function(r,n){var a=this._lineDraw,i=this._showEffect(n),o=!!n.get("polyline"),s=n.pipelineContext,l=s.large;return(!a||i!==this._hasEffet||o!==this._isPolyline||l!==this._isLargeDraw)&&(a&&a.remove(),a=this._lineDraw=l?new Eme:new OI(o?i?Pme:r$:i?t$:RI),this._hasEffet=i,this._isPolyline=o,this._isLargeDraw=l),this.group.add(a.group),a},t.prototype._showEffect=function(r){return!!r.get(["effect","show"])},t.prototype._clearLayer=function(r){var n=GM(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}(Rt),Ome=typeof Uint32Array>"u"?Array:Uint32Array,zme=typeof Float64Array>"u"?Array:Float64Array;function d4(e){var t=e.data;t&&t[0]&&t[0][0]&&t[0][0].coord&&(e.data=oe(t,function(r){var n=[r[0].coord,r[1].coord],a={coords:n};return r[0].name&&(a.fromName=r[0].name),r[1].name&&(a.toName=r[1].name),y1([a,r[0],r[1]])}))}var Bme=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||[],d4(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(d4(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=Lf(this._flatCoords,n.flatCoords),this._flatCoordsOffset=Lf(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),a=n.option instanceof Array?n.option:n.getShallow("coords");return a},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 a=this._flatCoordsOffset[r*2],i=this._flatCoordsOffset[r*2+1],o=0;o ")}return Er("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}(Ut);function W0(e){return e instanceof Array||(e=[e,e]),e}var Fme={seriesType:"lines",reset:function(e){var t=W0(e.get("symbol")),r=W0(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 a(i,o){var s=i.getItemModel(o),l=W0(s.getShallow("symbol",!0)),u=W0(s.getShallow("symbolSize",!0));l[0]&&i.setItemVisual(o,"fromSymbol",l[0]),l[1]&&i.setItemVisual(o,"toSymbol",l[1]),u[0]&&i.setItemVisual(o,"fromSymbolSize",u[0]),u[1]&&i.setItemVisual(o,"toSymbolSize",u[1])}return{dataEach:n.hasItemOption?a:null}}};function Vme(e){e.registerChartView(Rme),e.registerSeriesModel(Bme),e.registerLayout(n$),e.registerVisual(Fme)}var Gme=256,Hme=function(){function e(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var t=qr.createCanvas();this.canvas=t}return e.prototype.update=function(t,r,n,a,i,o){var s=this._getBrush(),l=this._getGradient(i,"inRange"),u=this._getGradient(i,"outOfRange"),c=this.pointSize+this.blurSize,h=this.canvas,f=h.getContext("2d"),v=t.length;h.width=r,h.height=n;for(var g=0;g0){var z=o(w)?l:u;w>0&&(w=w*P+k),C[M++]=z[j],C[M++]=z[j+1],C[M++]=z[j+2],C[M++]=z[j+3]*w*256}else M+=4}return f.putImageData(S,0,0),h},e.prototype._getBrush=function(){var t=this._brushCanvas||(this._brushCanvas=qr.createCanvas()),r=this.pointSize+this.blurSize,n=r*2;t.width=n,t.height=n;var a=t.getContext("2d");return a.clearRect(0,0,n,n),a.shadowOffsetX=n,a.shadowBlur=this.blurSize,a.shadowColor=K.color.neutral99,a.beginPath(),a.arc(-r,r,this.pointSize,0,Math.PI*2,!0),a.closePath(),a.fill(),t},e.prototype._getGradient=function(t,r){for(var n=this._gradientPixels,a=n[r]||(n[r]=new Uint8ClampedArray(256*4)),i=[0,0,0,0],o=0,s=0;s<256;s++)t[r](s/255,!0,i),a[o++]=i[0],a[o++]=i[1],a[o++]=i[2],a[o++]=i[3];return a},e}();function Ume(e,t,r){var n=e[1]-e[0];t=oe(t,function(o){return{interval:[(o.interval[0]-e[0])/n,(o.interval[1]-e[0])/n]}});var a=t.length,i=0;return function(o){var s;for(s=i;s=0;s--){var l=t[s].interval;if(l[0]<=o&&o<=l[1]){i=s;break}}return s>=0&&s=t[0]&&n<=t[1]}}var $me=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,a){var i;n.eachComponent("visualMap",function(s){s.eachTargetSeries(function(l){l===r&&(i=s)})}),this._progressiveEls=null,this.group.removeAll();var o=r.coordinateSystem;o.type==="cartesian2d"||o.type==="calendar"||o.type==="matrix"?this._renderOnGridLike(r,a,0,r.getData().count()):f5(o)&&this._renderOnGeo(o,r,i,a)},t.prototype.incrementalPrepareRender=function(r,n,a){this.group.removeAll()},t.prototype.incrementalRender=function(r,n,a,i){var o=n.coordinateSystem;o&&(f5(o)?this.render(n,a,i):(this._progressiveEls=[],this._renderOnGridLike(n,i,r.start,r.end,!0)))},t.prototype.eachRendered=function(r){Su(this._progressiveEls||this.group,r)},t.prototype._renderOnGridLike=function(r,n,a,i,o){var s=r.coordinateSystem,l=ph(s,"cartesian2d"),u=ph(s,"matrix"),c,h,f,v;if(l){var g=s.getAxis("x"),m=s.getAxis("y");c=Cn(g).w+.5,h=Cn(m).w+.5,f=g.scale.getExtent(),v=m.scale.getExtent()}for(var y=this.group,x=r.getData(),_=r.getModel(["emphasis","itemStyle"]).getItemStyle(),w=r.getModel(["blur","itemStyle"]).getItemStyle(),S=r.getModel(["select","itemStyle"]).getItemStyle(),C=r.get(["itemStyle","borderRadius"]),M=Gr(r),A=r.getModel("emphasis"),k=A.get("focus"),I=A.get("blurScope"),P=A.get("disabled"),j=l||u?[x.mapDimension("x"),x.mapDimension("y"),x.mapDimension("value")]:[x.mapDimension("time"),x.mapDimension("value")],z=a;zf[1]||Vv[1])continue;var U=s.dataToPoint([H,V]);D=new it({shape:{x:U[0]-c/2,y:U[1]-h/2,width:c,height:h},style:B})}else if(u){var F=s.dataToLayout([x.get(j[0],z),x.get(j[1],z)]).rect;if(yn(F.x))continue;D=new it({z2:1,shape:F,style:B})}else{if(isNaN(x.get(j[1],z)))continue;var W=s.dataToLayout([x.get(j[0],z)]),F=W.contentRect||W.rect;if(yn(F.x)||yn(F.y))continue;D=new it({z2:1,shape:F,style:B})}if(x.hasItemOption){var $=x.getItemModel(z),Z=$.getModel("emphasis");_=Z.getModel("itemStyle").getItemStyle(),w=$.getModel(["blur","itemStyle"]).getItemStyle(),S=$.getModel(["select","itemStyle"]).getItemStyle(),C=$.get(["itemStyle","borderRadius"]),k=Z.get("focus"),I=Z.get("blurScope"),P=Z.get("disabled"),M=Gr($)}D.shape.r=C;var J=r.getRawValue(z),re="-";J&&J[2]!=null&&(re=J[2]+""),Jr(D,M,{labelFetcher:r,labelDataIndex:z,defaultOpacity:B.opacity,defaultText:re}),D.ensureState("emphasis").style=_,D.ensureState("blur").style=w,D.ensureState("select").style=S,ir(D,k,I,P),D.incremental=Io(r,o),o&&(D.states.emphasis.hoverLayer=vv),y.add(D),x.setItemGraphicEl(z,D),this._progressiveEls&&this._progressiveEls.push(D)}},t.prototype._renderOnGeo=function(r,n,a,i){var o=a.targetVisuals.inRange,s=a.targetVisuals.outOfRange,l=n.getData(),u=this._hmLayer||this._hmLayer||new Hme;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),v=Math.max(c.y,0),g=Math.min(c.width+c.x,i.getWidth()),m=Math.min(c.height+c.y,i.getHeight()),y=g-f,x=m-v,_=[l.mapDimension("lng"),l.mapDimension("lat"),l.mapDimension("value")],w=l.mapArray(_,function(A,k,I){var P=r.dataToPoint([A,k]);return P[0]-=f,P[1]-=v,P.push(I),P}),S=a.getExtent(),C=a.type==="visualMap.continuous"?Wme(S,a.option.range):Ume(S,a.getPieceList(),a.option.selected);u.update(w,y,x,o.color.getNormalizer(),{inRange:o.color.getColorMapper(),outOfRange:s.color.getColorMapper()},C);var M=new Qr({style:{width:y,height:x,x:f,y:v,image:u.canvas},silent:!0});this.group.add(M)},t.type="heatmap",t}(Rt),Zme=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 Jo(null,this,{generateCoord:"value"})},t.prototype.preventIncremental=function(){var r=yv.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}(Ut);function Yme(e){e.registerChartView($me),e.registerSeriesModel(Zme)}var Xme=["itemStyle","borderWidth"],f4=[{xy:"x",wh:"width",index:0,posDesc:["left","right"]},{xy:"y",wh:"height",index:1,posDesc:["top","bottom"]}],p2=new Ko,qme=function(e){q(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=vm,r}return t.prototype.render=function(r,n,a){var i=this.group,o=r.getData(),s=this._data,l=r.coordinateSystem,u=l.getBaseAxis(),c=u.isHorizontal(),h=l.master.getRect(),f={ecSize:{width:a.getWidth(),height:a.getHeight()},seriesModel:r,coordSys:l,coordSysExtent:[[h.x,h.x+h.width],[h.y,h.y+h.height]],isHorizontal:c,valueDim:f4[+c],categoryDim:f4[1-+c]};o.diff(s).add(function(g){if(o.hasValue(g)){var m=p4(o,g),y=v4(o,g,m,f),x=g4(o,f,y);o.setItemGraphicEl(g,x),i.add(x),y4(x,f,y)}}).update(function(g,m){var y=s.getItemGraphicEl(m);if(!o.hasValue(g)){i.remove(y);return}var x=p4(o,g),_=v4(o,g,x,f),w=u$(o,_);y&&w!==y.__pictorialShapeStr&&(i.remove(y),o.setItemGraphicEl(g,null),y=null),y?nye(y,f,_):y=g4(o,f,_,!0),o.setItemGraphicEl(g,y),y.__pictorialSymbolMeta=_,i.add(y),y4(y,f,_)}).remove(function(g){var m=s.getItemGraphicEl(g);m&&m4(s,g,m.__pictorialSymbolMeta.animationModel,m)}).execute();var v=r.get("clip",!0)?vh(r.coordinateSystem,!1,r):null;return v?i.setClipPath(v):i.removeClipPath(),this._data=o,this.group},t.prototype.remove=function(r,n){var a=this.group,i=this._data;r.get("animation")?i&&i.eachItemGraphicEl(function(o){m4(i,Be(o).dataIndex,r,o)}):a.removeAll()},t.type=vm,t}(Rt);function v4(e,t,r,n){var a=e.getItemLayout(t),i=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:a,itemModel:r,symbolType:e.getItemVisual(t,"symbol")||"circle",style:e.getItemVisual(t,"style"),symbolClip:o,symbolRepeat:i,symbolRepeatDirection:r.get("symbolRepeatDirection"),symbolPatternSize:c,rotation:u,animationModel:h?r:null,hoverScale:h&&r.get(["emphasis","scale"]),z2:r.getShallow("z",!0)||0};Kme(r,i,a,n,f),Jme(e,t,a,i,o,f.boundingLength,f.pxSign,c,n,f),Qme(r,f.symbolScale,u,n,f);var v=f.symbolSize,g=Fh(r.get("symbolOffset"),v);return eye(r,v,a,i,o,g,s,f.valueLineWidth,f.boundingLength,f.repeatCutLength,n,f),f}function Kme(e,t,r,n,a){var i=n.valueDim,o=e.get("symbolBoundingData"),s=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),l=s.toGlobalCoord(s.dataToCoord(0)),u=1-+(r[i.wh]<=0),c;if(ae(o)){var h=[g2(s,o[0])-l,g2(s,o[1])-l];h[1]=0?1:-1:c>0?1:-1}function g2(e,t){return e.toGlobalCoord(e.dataToCoord(e.scale.parse(t)))}function Jme(e,t,r,n,a,i,o,s,l,u){var c=l.valueDim,h=l.categoryDim,f=Math.abs(r[h.wh]),v=e.getItemVisual(t,"symbolSize"),g;ae(v)?g=v.slice():v==null?g=["100%","100%"]:g=[v,v],g[h.index]=me(g[h.index],f),g[c.index]=me(g[c.index],n?f:Math.abs(i)),u.symbolSize=g;var m=u.symbolScale=[g[0]/s,g[1]/s];m[c.index]*=(l.isHorizontal?-1:1)*o}function Qme(e,t,r,n,a){var i=e.get(Xme)||0;i&&(p2.attr({scaleX:t[0],scaleY:t[1],rotation:r}),p2.updateTransform(),i/=p2.getLineScale(),i*=t[n.valueDim.index]),a.valueLineWidth=i||0}function eye(e,t,r,n,a,i,o,s,l,u,c,h){var f=c.categoryDim,v=c.valueDim,g=h.pxSign,m=Math.max(t[v.index]+s,0),y=m;if(n){var x=Math.abs(l),_=zn(e.get("symbolMargin"),"15%")+"",w=!1;_.lastIndexOf("!")===_.length-1&&(w=!0,_=_.slice(0,_.length-1));var S=me(_,t[v.index]),C=Math.max(m+S*2,0),M=w?0:S*2,A=Fk(n),k=A?n:x4((x+M)/C),I=x-k*m;S=I/2/(w?k:Math.max(k-1,1)),C=m+S*2,M=w?0:S*2,!A&&n!=="fixed"&&(k=u?x4((Math.abs(u)+M)/C):0),y=k*C-M,h.repeatTimes=k,h.symbolMargin=S}var P=g*(y/2),j=h.pathPosition=[];j[f.index]=r[f.wh]/2,j[v.index]=o==="start"?P:o==="end"?l-P:l/2,i&&(j[0]+=i[0],j[1]+=i[1]);var z=h.bundlePosition=[];z[f.index]=r[f.xy],z[v.index]=r[v.xy];var D=h.barRectShape=te({},r);D[v.wh]=g*Math.max(Math.abs(r[v.wh]),Math.abs(j[v.index]+P)),D[f.wh]=r[f.wh];var B=h.clipShape={};B[f.xy]=-r[f.xy],B[f.wh]=c.ecSize[f.wh],B[v.xy]=0,B[v.wh]=r[v.wh]}function a$(e){var t=e.symbolPatternSize,r=Ar(e.symbolType,-t/2,-t/2,t,t);return r.attr({culling:!0}),r.type!=="image"&&r.setStyle({strokeNoScale:!0}),r}function i$(e,t,r,n){var a=e.__pictorialBundle,i=r.symbolSize,o=r.valueLineWidth,s=r.pathPosition,l=t.valueDim,u=r.repeatTimes||0,c=0,h=i[t.valueDim.index]+o+r.symbolMargin*2;for(ZI(e,function(m){m.__pictorialAnimationIndex=c,m.__pictorialRepeatTimes=u,c0:x<0)&&(_=u-1-m),y[l.index]=h*(_-u/2+.5)+s[l.index],{x:y[0],y:y[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation}}}function o$(e,t,r,n){var a=e.__pictorialBundle,i=e.__pictorialMainPath;i?_f(i,null,{x:r.pathPosition[0],y:r.pathPosition[1],scaleX:r.symbolScale[0],scaleY:r.symbolScale[1],rotation:r.rotation},r,n):(i=e.__pictorialMainPath=a$(r),a.add(i),_f(i,{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 s$(e,t,r){var n=te({},t.barRectShape),a=e.__pictorialBarRect;a?_f(a,null,{shape:n},t,r):(a=e.__pictorialBarRect=new it({z2:2,shape:n,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}}),a.disableMorphing=!0,e.add(a))}function l$(e,t,r,n){if(r.symbolClip){var a=e.__pictorialClipPath,i=te({},r.clipShape),o=t.valueDim,s=r.animationModel,l=r.dataIndex;if(a)At(a,{shape:i},s,l);else{i[o.wh]=0,a=new it({shape:i}),e.__pictorialBundle.setClipPath(a),e.__pictorialClipPath=a;var u={};u[o.wh]=r.clipShape[o.wh],Rh[n?"updateProps":"initProps"](a,{shape:u},s,l)}}}function p4(e,t){var r=e.getItemModel(t);return r.getAnimationDelayParams=tye,r.isAnimationEnabled=rye,r}function tye(e){return{index:e.__pictorialAnimationIndex,count:e.__pictorialRepeatTimes}}function rye(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function g4(e,t,r,n){var a=new De,i=new De;return a.add(i),a.__pictorialBundle=i,i.x=r.bundlePosition[0],i.y=r.bundlePosition[1],r.symbolRepeat?i$(a,t,r):o$(a,t,r),s$(a,r,n),l$(a,t,r,n),a.__pictorialShapeStr=u$(e,r),a.__pictorialSymbolMeta=r,a}function nye(e,t,r){var n=r.animationModel,a=r.dataIndex,i=e.__pictorialBundle;At(i,{x:r.bundlePosition[0],y:r.bundlePosition[1]},n,a),r.symbolRepeat?i$(e,t,r,!0):o$(e,t,r,!0),s$(e,r,!0),l$(e,t,r,!0)}function m4(e,t,r,n){var a=n.__pictorialBarRect;a&&a.removeTextContent();var i=[];ZI(n,function(o){i.push(o)}),n.__pictorialMainPath&&i.push(n.__pictorialMainPath),n.__pictorialClipPath&&(r=null),R(i,function(o){su(o,{scaleX:0,scaleY:0},r,t,function(){n.parent&&n.parent.remove(n)})}),e.setItemGraphicEl(t,null)}function u$(e,t){return[e.getItemVisual(t.dataIndex,"symbol")||"none",!!t.symbolRepeat,!!t.symbolClip].join(":")}function ZI(e,t,r){R(e.__pictorialBundle.children(),function(n){n!==e.__pictorialBarRect&&t.call(r,n)})}function _f(e,t,r,n,a,i){t&&e.attr(t),n.symbolClip&&!a?r&&e.attr(r):r&&Rh[a?"updateProps":"initProps"](e,r,n.animationModel,n.dataIndex,i)}function y4(e,t,r){var n=r.dataIndex,a=r.itemModel,i=a.getModel("emphasis"),o=i.getModel("itemStyle").getItemStyle(),s=a.getModel(["blur","itemStyle"]).getItemStyle(),l=a.getModel(["select","itemStyle"]).getItemStyle(),u=a.getShallow("cursor"),c=i.get("focus"),h=i.get("blurScope"),f=i.get("scale");ZI(e,function(m){if(m instanceof Qr){var y=m.style;m.useStyle(te({image:y.image,x:y.x,y:y.y,width:y.width,height:y.height},r.style))}else m.useStyle(r.style);var x=m.ensureState("emphasis");x.style=o,f&&(x.scaleX=m.scaleX*1.1,x.scaleY=m.scaleY*1.1),m.ensureState("blur").style=s,m.ensureState("select").style=l,u&&(m.cursor=u),m.z2=r.z2});var v=t.valueDim.posDesc[+(r.boundingLength>0)],g=e.__pictorialBarRect;g.ignoreClip=!0,Jr(g,Gr(a),{labelFetcher:t.seriesModel,labelDataIndex:n,defaultText:Hf(t.seriesModel.getData(),n),inheritColor:r.style.fill,defaultOpacity:r.style.opacity,defaultOutsidePosition:v}),ir(e,c,h,i.get("disabled"))}function x4(e){var t=Math.round(e);return Math.abs(e-t)<1e-4?t:Math.ceil(e)}var aye=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."+vm,t.dependencies=["grid"],t.defaultOption=Cu(pm.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}(pm);function iye(e){e.registerChartView(qme),e.registerSeriesModel(aye),e.registerLayout(e.PRIORITY.VISUAL.LAYOUT,y8(vm)),e.registerLayout(e.PRIORITY.VISUAL.PROGRESSIVE_LAYOUT,x8(vm)),b8(e)}var m2=2,Zf="themeRiver",oye=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 Nv(be(this.getData,this),be(this.getRawData,this))},t.prototype.fixData=function(r){var n=r.length,a={},i=AM(r,function(f){return a.hasOwnProperty(f[0]+"")||(a[f[0]+""]=-1),f[2]}),o=[];i.buckets.each(function(f,v){o.push({name:v,dataList:f})});for(var s=o.length,l=0;li&&(i=s),n.push(s)}for(var u=0;ui&&(i=h)}return{y0:a,max:i}}function dye(e){e.registerChartView(sye),e.registerSeriesModel(oye),e.registerLayout(uye),e.registerProcessor(ay(Zf))}var fye=2,vye=4,b4=function(e){q(t,e);function t(r,n,a,i){var o=e.call(this)||this;o.z2=fye,o.textConfig={inside:!0},Be(o).seriesIndex=n.seriesIndex;var s=new wt({z2:vye,silent:r.getModel().get(["label","silent"])});return o.setTextContent(s),o.updateData(!0,r,n,a,i),o}return t.prototype.updateData=function(r,n,a,i,o){this.node=n,n.piece=this,a=a||this._seriesModel,i=i||this._ecModel;var s=this;Be(s).dataIndex=n.dataIndex;var l=n.getModel(),u=l.getModel("emphasis"),c=n.getLayout(),h=te({},c);h.label=null;var f=n.getVisual("style");f.lineJoin="bevel";var v=n.getVisual("decal");v&&(f.decal=zf(v,o));var g=Co(l.getModel("itemStyle"),h,!0);te(h,g),R(ra,function(_){var w=s.ensureState(_),S=l.getModel([_,"itemStyle"]);w.style=S.getItemStyle();var C=Co(S,h);C&&(w.shape=C)}),r?(s.setShape(h),s.shape.r=c.r0,Qt(s,{shape:{r:c.r}},a,n.dataIndex)):(At(s,{shape:h},a),_i(s)),s.useStyle(f),this._updateLabel(a);var m=l.getShallow("cursor");m&&s.attr("cursor",m),this._seriesModel=a||this._seriesModel,this._ecModel=i||this._ecModel;var y=u.get("focus"),x=y==="relative"?Lf(n.getAncestorsIndices(),n.getDescendantIndices()):y==="ancestor"?n.getAncestorsIndices():y==="descendant"?n.getDescendantIndices():y;ir(this,x,u.get("blurScope"),u.get("disabled"))},t.prototype._updateLabel=function(r){var n=this,a=this.node.getModel(),i=a.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(),v=this.node.dataIndex,g=i.get("minAngle")/180*Math.PI,m=i.get("show")&&!(g!=null&&Math.abs(s)B&&!th(V-B)&&V0?(o.virtualPiece?o.virtualPiece.updateData(!1,_,r,n,a):(o.virtualPiece=new b4(_,r,n,a),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 a=!1,i=r.seriesModel.getViewRoot();i.eachNode(function(o){if(!a&&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";Z_(u,c)}}a=!0}})})},t.prototype._rootToNode=function(r){r!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:$A,from:this.uid,seriesId:this.seriesModel.id,targetNode:r})},t.prototype.containPoint=function(r,n){var a=n.getData(),i=a.getItemLayout(0);if(i){var o=r[0]-i.cx,s=r[1]-i.cy,l=Math.sqrt(o*o+s*s);return l<=i.r&&l>=i.r0}},t.type=Sh,t}(Rt),xye=Hr(Sh,_ye);function _ye(e){var t={};function r(n,a,i){if(n.depth===0)return K.color.neutral50;for(var o=n;o&&o.depth>1;)o=o.parentNode;var s=a.getColorFromPalette(o.name||o.dataIndex+"",t);return n.depth>1&&ve(s)&&(s=L_(s,(n.depth-1)/(i-1)*.5)),s}e.eachSeriesByType(Sh,function(n){var a=n.getData(),i=a.tree;i.eachNode(function(o){var s=o.getModel(),l=s.getModel("itemStyle").getItemStyle();l.fill||(l.fill=r(o,n,i.root.height));var u=a.ensureUniqueItemVisual(o.dataIndex,"style");te(u,l)})})}var S4=Math.PI/180,bye=Hr(Sh,wye);function wye(e,t){e.eachSeriesByType(Sh,function(r){var n=r.get("center"),a=r.get("radius");ae(a)||(a=[0,a]),ae(n)||(n=[n,n]);var i=t.getWidth(),o=t.getHeight(),s=Math.min(i,o),l=me(n[0],i),u=me(n[1],o),c=me(a[0],s/2),h=me(a[1],s/2),f=-r.get("startAngle")*S4,v=r.get("minAngle")*S4,g=r.getData().tree.root,m=r.getViewRoot(),y=m.depth,x=r.get("sort");x!=null&&h$(m,x);var _=0;R(m.children,function(H){!isNaN(H.getValue())&&_++});var w=m.getValue(),S=Math.PI/(w||_)*2,C=m.depth>0,M=m.height-(C?-1:1),A=(h-c)/(M||1),k=r.get("clockwise"),I=r.get("stillShowZeroSum"),P=k?1:-1,j=function(H,V){if(H){var U=V;if(H!==g){var F=H.getValue(),W=w===0&&I?S:F*S;Wn[1]&&n.reverse(),{coordSys:{type:"polar",cx:e.cx,cy:e.cy,r:n[1],r0:n[0]},api:{coord:function(a){var i=t.dataToRadius(a[0]),o=r.dataToAngle(a[1]),s=e.coordToPoint([i,o]);return s.push(i,o*Math.PI/180),s},size:be(Dye,e)}}}function Eye(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,a){return e.dataToPoint(n,a)},layout:function(n,a){return e.dataToLayout(n,a)}}}}function Rye(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 d$={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},T4=mt(d$);gi(Gs,function(e,t){return e[t]=1,e},{});Gs.join(", ");var Lb=["","style","shape","extra"],Yf=Qe();function YI(e,t,r,n,a){var i=e+"Animation",o=fv(e,n,a)||{},s=Yf(t).userDuring;return o.duration>0&&(o.during=s?be(Vye,{el:t,userDuring:s}):null,o.setToFinal=!0,o.scope=e),te(o,r[i]),o}function Yx(e,t,r,n){n=n||{};var a=n.dataIndex,i=n.isInit,o=n.clearStyle,s=r.isAnimationEnabled(),l=Yf(e),u=t.style;l.userDuring=t.during;var c={},h={};if(Hye(e,t,h),e.type==="compound")for(var f=e.shape.paths,v=t.shape.paths,g=0;g0&&e.animateFrom(y,x)}else zye(e,t,a||0,r,c);f$(e,t),u?e.dirty():e.markRedraw()}function f$(e,t){for(var r=Yf(e).leaveToProps,n=0;n0&&e.animateFrom(a,i)}}function Bye(e,t){Se(t,"silent")&&(e.silent=t.silent),Se(t,"ignore")&&(e.ignore=t.ignore),e instanceof xi&&Se(t,"invisible")&&(e.invisible=t.invisible),e instanceof pt&&Se(t,"autoBatch")&&(e.autoBatch=t.autoBatch)}var fo={},Fye={setTransform:function(e,t){return fo.el[e]=t,this},getTransform:function(e){return fo.el[e]},setShape:function(e,t){var r=fo.el,n=r.shape||(r.shape={});return n[e]=t,r.dirtyShape&&r.dirtyShape(),this},getShape:function(e){var t=fo.el.shape;if(t)return t[e]},setStyle:function(e,t){var r=fo.el,n=r.style;return n&&(n[e]=t,r.dirtyStyle&&r.dirtyStyle()),this},getStyle:function(e){var t=fo.el.style;if(t)return t[e]},setExtra:function(e,t){var r=fo.el.extra||(fo.el.extra={});return r[e]=t,this},getExtra:function(e){var t=fo.el.extra;if(t)return t[e]}};function Vye(){var e=this,t=e.el;if(t){var r=Yf(t).userDuring,n=e.userDuring;if(r!==n){e.el=e.userDuring=null;return}fo.el=t,n(Fye)}}function M4(e,t,r,n){var a=r[e];if(a){var i=t[e],o;if(i){var s=r.transition,l=a.transition;if(l)if(!o&&(o=n[e]={}),Wc(l))te(o,i);else for(var u=Zt(l),c=0;c=0){!o&&(o=n[e]={});for(var v=mt(i),c=0;c=0)){var f=e.getAnimationStyleProps(),v=f?f.style:null;if(v){!i&&(i=n.style={});for(var g=mt(r),u=0;u=0?t.getStore().get(F,V):void 0}var W=t.get(U.name,V),$=U&&U.ordinalMeta;return $?$.categories[W]:W}function A(H,V){V==null&&(V=c);var U=t.getItemVisual(V,"style"),F=U&&U.fill,W=U&&U.opacity,$=w(V,El).getItemStyle();F!=null&&($.fill=F),W!=null&&($.opacity=W);var Z={inheritColor:ve(F)?F:K.color.neutral99},J=S(V,El),re=$t(J,null,Z,!1,!0);re.text=J.getShallow("show")?Te(e.getFormattedLabel(V,El),Hf(t,V)):null;var Q=G_(J,Z,!1);return P(H,$),$=p5($,re,Q),H&&I($,H),$.legacy=!0,$}function k(H,V){V==null&&(V=c);var U=w(V,js).getItemStyle(),F=S(V,js),W=$t(F,null,null,!0,!0);W.text=F.getShallow("show")?ya(e.getFormattedLabel(V,js),e.getFormattedLabel(V,El),Hf(t,V)):null;var $=G_(F,null,!0);return P(H,U),U=p5(U,W,$),H&&I(U,H),U.legacy=!0,U}function I(H,V){for(var U in V)Se(V,U)&&(H[U]=V[U])}function P(H,V){H&&(H.textFill&&(V.textFill=H.textFill),H.textPosition&&(V.textPosition=H.textPosition))}function j(H,V){if(V==null&&(V=c),Se(C4,H)){var U=t.getItemVisual(V,"style");return U?U[C4[H]]:null}if(Se(Tye,H))return t.getItemVisual(V,H)}function z(H){if(o.type==="cartesian2d"){var V=o.getBaseAxis();return Qce(Ee({axis:V},H))}}function D(){return r.getCurrentSeriesIndices()}function B(H){return uL(H,r)}}function e0e(e){var t={};return R(e.dimensions,function(r){var n=e.getDimensionInfo(r);if(!n.isExtraCoord){var a=n.coordDim,i=t[a]=t[a]||[];i[n.coordDimIndex]=e.getDimensionIndex(r)}}),t}function b2(e,t,r,n,a,i,o){if(!n){i.remove(t);return}var s=QI(e,t,r,n,a,i);return s&&o.setItemGraphicEl(r,s),s&&ir(s,n.focus,n.blurScope,n.emphasisDisabled),s}function QI(e,t,r,n,a,i){var o=-1,s=t;t&&m$(t,n,a)&&(o=Ye(i.childrenRef(),t),t=null);var l=!t,u=t;u?u.clearStates():(u=KI(n),s&&qye(s,u)),n.morph===!1?u.disableMorphing=!0:u.disableMorphing&&(u.disableMorphing=!1),n.tooltipDisabled&&(u.tooltipDisabled=!0),Ya.normal.cfg=Ya.normal.conOpt=Ya.emphasis.cfg=Ya.emphasis.conOpt=Ya.blur.cfg=Ya.blur.conOpt=Ya.select.cfg=Ya.select.conOpt=null,Ya.isLegacy=!1,r0e(u,r,n,a,l,Ya),t0e(u,r,n,a,l),JI(e,u,r,n,Ya,a,l),Se(n,"info")&&(Ds(u).info=n.info);for(var c=0;c=0?i.replaceAt(u,o):i.add(u),u}function m$(e,t,r){var n=Ds(e),a=t.type,i=t.shape,o=t.style;return r.isUniversalTransitionEnabled()||a!=null&&a!==n.customGraphicType||a==="path"&&s0e(i)&&y$(i)!==n.customPathData||a==="image"&&Se(o,"image")&&o.image!==n.customImagePath}function t0e(e,t,r,n,a){var i=r.clipPath;if(i===!1)e&&e.getClipPath()&&e.removeClipPath();else if(i){var o=e.getClipPath();o&&m$(o,i,n)&&(o=null),o||(o=KI(i),e.setClipPath(o)),JI(null,o,t,i,null,n,a)}}function r0e(e,t,r,n,a,i){if(!(e.isGroup||e.type==="compoundPath")){N4(r,null,i),N4(r,js,i);var o=i.normal.conOpt,s=i.emphasis.conOpt,l=i.blur.conOpt,u=i.select.conOpt;if(o!=null||s!=null||u!=null||l!=null){var c=e.getTextContent();if(o===!1)c&&e.removeTextContent();else{o=i.normal.conOpt=o||{type:"text"},c?c.clearStates():(c=KI(o),e.setTextContent(c)),JI(null,c,t,o,null,n,a);for(var h=o&&o.style,f=0;f=c;v--){var g=t.childAt(v);a0e(t,g,a)}}}function a0e(e,t,r){t&&hw(t,Ds(e).option,r)}function i0e(e){new $s(e.oldChildren,e.newChildren,k4,k4,e).add(L4).update(L4).remove(o0e).execute()}function k4(e,t){var r=e&&e.name;return r??Yye+t}function L4(e,t){var r=this.context,n=e!=null?r.newChildren[e]:null,a=t!=null?r.oldChildren[t]:null;QI(r.api,a,r.dataIndex,n,r.seriesModel,r.group)}function o0e(e){var t=this.context,r=t.oldChildren[e];r&&hw(r,Ds(r).option,t.seriesModel)}function y$(e){return e&&(e.pathData||e.d)}function s0e(e){return e&&(Se(e,"pathData")||Se(e,"d"))}function l0e(e){e.registerChartView(Kye),e.registerSeriesModel(Mye)}var Cc=Qe(),I4=ke,w2=be,tP=function(){function e(){this._dragging=!1,this.animationThreshold=15}return e.prototype.render=function(t,r,n,a){var i=r.get("value"),o=r.get("status");if(this._axisModel=t,this._axisPointerModel=r,this._api=n,!(!a&&this._lastValue===i&&this._lastStatus===o)){this._lastValue=i,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,i,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 De,this.createPointerEl(s,u,t,r),this.createLabelEl(s,u,t,r),n.getZr().add(s);else{var f=nt(P4,r,h);this.updatePointerEl(s,u,f),this.updateLabelEl(s,u,f,r)}j4(s,r,!0),this._renderHandle(i)}},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"),a=t.axis,i=a.type==="category",o=r.get("snap");if(!o&&!i)return!1;if(n==="auto"||n==null){var s=this.animationThreshold;if(i&&Cn(a).w>s)return!0;if(o){var l=mI(t).seriesDataCount,u=a.getExtent();return Math.abs(u[0]-u[1])/l>s}return!1}return n===!0},e.prototype.makeElOption=function(t,r,n,a,i){},e.prototype.createPointerEl=function(t,r,n,a){var i=r.pointer;if(i){var o=Cc(t).pointerEl=new Rh[i.type](I4(r.pointer));t.add(o)}},e.prototype.createLabelEl=function(t,r,n,a){if(r.label){var i=Cc(t).labelEl=new wt(I4(r.label));t.add(i),D4(i,a)}},e.prototype.updatePointerEl=function(t,r,n){var a=Cc(t).pointerEl;a&&r.pointer&&(a.setStyle(r.pointer.style),n(a,{shape:r.pointer.shape}))},e.prototype.updateLabelEl=function(t,r,n,a){var i=Cc(t).labelEl;i&&(i.setStyle(r.label.style),n(i,{x:r.label.x,y:r.label.y}),D4(i,a))},e.prototype._renderHandle=function(t){if(!(this._dragging||!this.updateHandleTransform)){var r=this._axisPointerModel,n=this._api.getZr(),a=this._handle,i=r.getModel("handle"),o=r.get("status");if(!i.get("show")||!o||o==="hide"){a&&n.remove(a),this._handle=null;return}var s;this._handle||(s=!0,a=this._handle=pv(i.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(u){Vs(u.event)},onmousedown:w2(this._onHandleDragMove,this,0,0),drift:w2(this._onHandleDragMove,this),ondragend:w2(this._onHandleDragEnd,this)}),n.add(a)),j4(a,r,!1),a.setStyle(i.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var l=i.get("size");ae(l)||(l=[l,l]),a.scaleX=l[0]/2,a.scaleY=l[1]/2,xv(this,"_doDispatchAxisPointer",i.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,s)}},e.prototype._moveHandleToValue=function(t,r){P4(this._axisPointerModel,!r&&this._moveAnimation,this._handle,S2(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},e.prototype._onHandleDragMove=function(t,r){var n=this._handle;if(n){this._dragging=!0;var a=this.updateHandleTransform(S2(n),[t,r],this._axisModel,this._axisPointerModel);this._payloadInfo=a,n.stopAnimation(),n.attr(S2(a)),Cc(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,a=this._handle;r&&n&&(this._lastGraphicKey=null,n&&r.remove(n),a&&r.remove(a),this._group=null,this._handle=null,this._payloadInfo=null),rm(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 P4(e,t,r,n){x$(Cc(r).lastProp,n)||(Cc(r).lastProp=n,t?At(r,n,e):(r.stopAnimation(),r.attr(n)))}function x$(e,t){if(Re(e)&&Re(t)){var r=!0;return R(t,function(n,a){r=r&&x$(e[a],n)}),!!r}else return e===t}function D4(e,t){e[t.get(["label","show"])?"show":"hide"]()}function S2(e){return{x:e.x||0,y:e.y||0,rotation:e.rotation||0}}function j4(e,t,r){var n=t.get("z"),a=t.get("zlevel");e&&e.traverse(function(i){i.type!=="group"&&(n!=null&&(i.z=n),a!=null&&(i.zlevel=a),i.silent=r)})}function rP(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 _$(e,t,r,n,a){var i=r.get("value"),o=b$(i,t.axis,t.ecModel,r.get("seriesDataIndices"),{precision:r.get(["label","precision"]),formatter:r.get(["label","formatter"])}),s=r.getModel("label"),l=mv(s.get("padding")||0),u=s.getFont(),c=S1(o,u),h=a.position,f=c.width+l[1]+l[3],v=c.height+l[0]+l[2],g=a.align;g==="right"&&(h[0]-=f),g==="center"&&(h[0]-=f/2);var m=a.verticalAlign;m==="bottom"&&(h[1]-=v),m==="middle"&&(h[1]-=v/2),u0e(h,f,v,n);var y=s.get("backgroundColor");(!y||y==="auto")&&(y=t.get(["axisLine","lineStyle","color"])),e.label={x:h[0],y:h[1],style:$t(s,{text:o,font:u,fill:s.getTextColor(),padding:l,backgroundColor:y}),z2:10}}function u0e(e,t,r,n){var a=n.getWidth(),i=n.getHeight();e[0]=Math.min(e[0]+t,a)-t,e[1]=Math.min(e[1]+r,i)-r,e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0)}function b$(e,t,r,n,a){e=t.scale.parse(e);var i=t.scale.getLabel({value:e},{precision:a.precision}),o=a.formatter;if(o){var s={value:ob(t,{value:e}),axisDimension:t.dim,axisIndex:t.index,seriesData:[]};R(n,function(l){var u=r.getSeriesByIndex(l.seriesIndex),c=l.dataIndexInside,h=u&&u.getDataParams(c);h&&s.seriesData.push(h)}),ve(o)?i=o.replace("{value}",i):Le(o)&&(i=o(s))}return i}function nP(e,t,r){var n=ar();return Js(n,n,r.rotation),Hi(n,n,r.position),Fi([e.dataToCoord(t),(r.labelOffset||0)+(r.labelDirection||1)*(r.labelMargin||0)],n)}function w$(e,t,r,n,a,i){var o=ea.innerTextLayout(r.rotation,0,r.labelDirection);r.labelMargin=a.get(["label","margin"]),_$(t,n,a,i,{position:nP(n.axis,e,r),align:o.textAlign,verticalAlign:o.textVerticalAlign})}function aP(e,t,r){return r=r||0,{x1:e[r],y1:e[1-r],x2:t[r],y2:t[1-r]}}function S$(e,t,r){return r=r||0,{x:e[r],y:e[1-r],width:t[r],height:t[1-r]}}function E4(e,t,r,n,a,i){return{cx:e,cy:t,r0:r,r:n,startAngle:a,endAngle:i,clockwise:!0}}function iP(e,t,r){return Cn(e,{fromStat:{sers:oe(t,function(n){return r.getSeriesByIndex(n.seriesIndex)})},min:1}).w}function oP(e,t,r){return[at(Et(t[0],t[1]),e-r/2),Et(e+r/2,at(t[0],t[1]))]}var c0e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.grid,u=i.get("type"),c=s.getGlobalExtent(),h=R4(l,s).getOtherAxis(s).getGlobalExtent(),f=s.toGlobalCoord(s.dataToCoord(n,!0));if(u&&u!=="none"){var v=rP(i),g=h0e[u](s,f,c,h,i.get("seriesDataIndices"),i.ecModel);g.style=v,r.graphicKey=g.type,r.pointer=g}var m=pb(l.getRect(),a);w$(n,r,m,a,i,o)},t.prototype.getHandleTransform=function(r,n,a){var i=pb(n.axis.grid.getRect(),n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=nP(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.grid,l=o.getGlobalExtent(!0),u=R4(s,o).getOtherAxis(o).getGlobalExtent(),c=o.dim==="x"?0:1,h=[r.x,r.y];h[c]+=n[c],h[c]=Et(l[1],h[c]),h[c]=at(l[0],h[c]);var f=(u[1]+u[0])/2,v=[f,f];v[c]=h[c];var g=[{verticalAlign:"middle"},{align:"center"}];return{x:h[0],y:h[1],rotation:r.rotation,cursorPoint:v,tooltipOption:g[c]}},t}(tP);function R4(e,t){var r={};return r[t.dim+"AxisIndex"]=t.index,e.getCartesian(r)}var h0e={line:function(e,t,r,n){var a=aP([t,n[0]],[t,n[1]],O4(e));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(e,t,r,n,a,i){var o=iP(e,a,i),s=n[1]-n[0],l=oP(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:S$([u,n[0]],[c-u,s],O4(e))}}};function O4(e){return e.dim==="x"?0:1}var d0e=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}(ht),Ms=Qe(),f0e=R;function C$(e,t,r){if(!xt.node){var n=t.getZr();Ms(n).records||(Ms(n).records={}),v0e(n,t);var a=Ms(n).records[e]||(Ms(n).records[e]={});a.handler=r}}function v0e(e,t){if(Ms(e).initialized)return;Ms(e).initialized=!0,r("click",nt(C2,"click")),r("mousemove",nt(C2,"mousemove")),r("mousewheel",nt(C2,"mousewheel")),r("globalout",g0e);function r(n,a){e.on(n,function(i){var o=m0e(t);f0e(Ms(e).records,function(s){s&&a(s,i,o.dispatchAction)}),p0e(o.pendings,t)})}}function p0e(e,t){var r=e.showTip.length,n=e.hideTip.length,a;r?a=e.showTip[r-1]:n&&(a=e.hideTip[n-1]),a&&(a.dispatchAction=null,t.dispatchAction(a))}function g0e(e,t,r){e.handler("leave",null,r)}function C2(e,t,r,n){t.handler(e,r,n)}function m0e(e){var t={showTip:[],hideTip:[]},r=function(n){var a=t[n.type];a?a.push(n):(n.dispatchAction=r,e.dispatchAction(n))};return{dispatchAction:r,pendings:t}}function XA(e,t){if(!xt.node){var r=t.getZr(),n=(Ms(r).records||{})[e];n&&(Ms(r).records[e]=null)}}var y0e=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,a){var i=n.getComponent("tooltip"),o=r.get("triggerOn")||i&&i.get("triggerOn")||"mousemove|click|mousewheel";C$("axisPointer",a,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){XA("axisPointer",n)},t.prototype.dispose=function(r,n){XA("axisPointer",n)},t.type="axisPointer",t}(Yt);function T$(e,t){var r=[],n=e.seriesIndex,a;if(n==null||!(a=t.getSeriesByIndex(n)))return{point:[]};var i=a.getData(),o=nh(i,e);if(o==null||o<0||ae(o))return{point:[]};var s=i.getItemGraphicEl(o),l=a.coordinateSystem;if(a.getTooltipPosition)r=a.getTooltipPosition(o)||[];else if(l&&l.dataToPoint)if(e.isStacked){var u=l.getBaseAxis(),c=l.getOtherAxis(u),h=c.dim,f=u.dim,v=h==="x"||h==="radius"?1:0,g=i.mapDimension(f),m=[];m[v]=i.get(g,o),m[1-v]=i.get(i.getCalculationInfo("stackResultDimension"),o),r=l.dataToPoint(m)||[]}else r=l.dataToPoint(i.getValues(oe(l.dimensions,function(x){return i.mapDimension(x)}),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 z4=Qe();function x0e(e,t,r){var n=e.currTrigger,a=[e.x,e.y],i=e,o=e.dispatchAction||be(r.dispatchAction,r),s=t.getComponent("axisPointer").coordSysAxesInfo;if(s){Xx(a)&&(a=T$({seriesIndex:i.seriesIndex,dataIndex:i.dataIndex},t).point);var l=Xx(a),u=i.axesInfo,c=s.axesInfo,h=n==="leave"||Xx(a),f={},v={},g={list:[],map:{}},m={showPointer:nt(b0e,v),showTooltip:nt(w0e,g)};R(s.coordSysMap,function(x,_){var w=l||x.containPoint(a);R(s.coordSysAxesInfo[_],function(S,C){var M=S.axis,A=M0e(u,S);if(!h&&w&&(!u||A)){var k=A&&A.value;k==null&&!l&&(k=M.pointToData(a)),k!=null&&B4(S,k,m,!1,f)}})});var y={};return R(c,function(x,_){var w=x.linkGroup;w&&!v[_]&&R(w.axesInfo,function(S,C){var M=v[C];if(S!==x&&M){var A=M.value;w.mapper&&(A=x.axis.scale.parse(w.mapper(A,F4(S),F4(x)))),y[x.key]=A}})}),R(y,function(x,_){B4(c[_],x,m,!0,f)}),S0e(v,c,f),C0e(g,a,e,o),T0e(c,o,r),f}}function B4(e,t,r,n,a){var i=e.axis;if(!(i.scale.isBlank()||!i.containData(t))){if(!e.involveSeries){r.showPointer(e,t);return}var o=_0e(t,e),s=o.payloadBatch,l=o.snapToValue;s[0]&&a.seriesIndex==null&&te(a,s[0]),!n&&e.snap&&i.containData(l)&&l!=null&&(t=l),r.showPointer(e,t,s),r.showTooltip(e,o,l)}}function _0e(e,t){var r=t.axis,n=r.dim,a=e,i=[],o=Number.MAX_VALUE,s=-1;return R(t.seriesModels,function(l,u){var c=l.getData().mapDimensionsAll(n),h,f;if(l.getAxisTooltipData){var v=l.getAxisTooltipData(c,e,r);f=v.dataIndices,h=v.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(yi(h)){var g=e-h,m=Math.abs(g);m<=o&&((m=0&&s<0)&&(o=m,s=g,a=h,i.length=0),R(f,function(y){i.push({seriesIndex:l.seriesIndex,dataIndexInside:y,dataIndex:l.getData().getRawIndex(y)})}))}}),{payloadBatch:i,snapToValue:a}}function b0e(e,t,r,n){e[t.key]={value:r,payloadBatch:n}}function w0e(e,t,r,n){var a=r.payloadBatch,i=t.axis,o=i.model,s=t.axisPointerModel;if(!(!t.triggerTooltip||!a.length)){var l=t.coordSys.model,u=gm(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:i.dim,axisIndex:o.componentIndex,axisType:o.type,axisId:o.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:a.slice()})}}function S0e(e,t,r){var n=r.axesInfo=[];R(t,function(a,i){var o=a.axisPointerModel.option,s=e[i];s?(!a.useHandle&&(o.status="show"),o.value=s.value,o.seriesDataIndices=(s.payloadBatch||[]).slice()):!a.useHandle&&(o.status="hide"),o.status==="show"&&n.push({axisDim:a.axis.dim,axisIndex:a.axis.model.componentIndex,value:o.value})})}function C0e(e,t,r,n){if(Xx(t)||!e.list.length){n({type:"hideTip"});return}var a=((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:a.dataIndexInside,dataIndex:a.dataIndex,seriesIndex:a.seriesIndex,dataByCoordSys:e.list})}function T0e(e,t,r){var n=r.getZr(),a="axisPointerLastHighlights",i=z4(n)[a]||{},o=z4(n)[a]={};R(e,function(c,h){var f=c.axisPointerModel.option;f.status==="show"&&c.triggerEmphasis&&R(f.seriesDataIndices,function(v){o[v.seriesIndex+"|"+v.dataIndex]=v})});var s=[],l=[];function u(c){return{seriesIndex:c.seriesIndex,dataIndex:c.dataIndex}}R(i,function(c,h){!o[h]&&l.push(u(c))}),R(o,function(c,h){!i[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 M0e(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 F4(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 Xx(e){return!e||e[0]==null||isNaN(e[0])||e[1]==null||isNaN(e[1])}function iy(e){Gh.registerAxisPointerClass("CartesianAxisPointer",c0e),e.registerComponentModel(d0e),e.registerComponentView(y0e),e.registerPreprocessor(function(t){if(t){(!t.axisPointer||t.axisPointer.length===0)&&(t.axisPointer={});var r=t.axisPointer.link;r&&!ae(r)&&(t.axisPointer.link=[r])}}),e.registerProcessor(e.PRIORITY.PROCESSOR.STATISTIC,{overallReset:function(t,r){t.getComponent("axisPointer").coordSysAxesInfo=Yhe(t,r)}}),e.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},x0e)}function A0e(e){rt(O8),rt(iy)}var N0e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.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=i.get("type");if(f&&f!=="none"){var v=rP(i),g=L0e[f](s,l,h,u,c,i.get("seriesDataIndices"),i.ecModel);g.style=v,r.graphicKey=g.type,r.pointer=g}var m=i.get(["label","margin"]),y=k0e(n,a,i,l,m);_$(r,a,i,o,y)},t}(tP);function k0e(e,t,r,n,a){var i=t.axis,o=i.dataToCoord(e),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l=n.getRadiusAxis().getExtent(),u,c,h;if(i.dim==="radius"){var f=ar();Js(f,f,s),Hi(f,f,[n.cx,n.cy]),u=Fi([o,-a],f);var v=t.getModel("axisLabel").get("rotate")||0,g=ea.innerTextLayout(s,v*Math.PI/180,-1);c=g.textAlign,h=g.textVerticalAlign}else{var m=l[1];u=n.coordToPoint([m+a,o]);var y=n.cx,x=n.cy;c=Math.abs(u[0]-y)/m<.3?"center":u[0]>y?"left":"right",h=Math.abs(u[1]-x)/m<.3?"middle":u[1]>x?"top":"bottom"}return{position:u,align:c,verticalAlign:h}}var L0e={line:function(e,t,r,n,a){return e.dim==="angle"?{type:"Line",shape:aP(t.coordToPoint([a[0],r]),t.coordToPoint([a[1],r]))}:{type:"Circle",shape:{cx:t.cx,cy:t.cy,r}}},shadow:function(e,t,r,n,a,i,o){var s=Math.PI/180,l=iP(e,i,o),u;if(e.dim==="angle")u=E4(t.cx,t.cy,a[0],a[1],(-r-l/2)*s,(-r+l/2)*s);else{var c=oP(r,n,l),h=c[0],f=c[1];u=E4(t.cx,t.cy,h,f,0,Math.PI*2)}return{type:"Sector",shape:u}}},jo="polar",V4=jo,I0e=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,a=this.ecModel;return a.eachComponent(r,function(i){i.getCoordSysModel()===this&&(n=i)},this),n},t.type=jo,t.dependencies=["radiusAxis","angleAxis"],t.defaultOption={z:0,center:["50%","50%"],radius:"80%"},t}(ht),sP=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",pr).models[0]},t.type="polarAxis",t}(ht);kr(sP,Tv);var P0e=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}(sP),D0e=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}(sP),lP=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}(Ci);lP.prototype.dataToRadius=Ci.prototype.dataToCoord;lP.prototype.radiusToData=Ci.prototype.coordToData;var j0e=Qe(),uP=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(),a=r.scale,i=a.getExtent(),o=a.count();if(i[1]-i[0]<1)return 0;var s=i[0],l=r.dataToCoord(s+1)-r.dataToCoord(s),u=Math.abs(l),c=S1(s==null?"":s+"",n.getFont(),"center","top"),h=Math.max(c.height,7),f=h/u;isNaN(f)&&(f=1/0);var v=Math.max(0,Math.floor(f)),g=j0e(r.model),m=g.lastAutoInterval,y=g.lastTickCount;return m!=null&&y!=null&&Math.abs(m-v)<=1&&Math.abs(y-o)<=1&&m>v?v=m:(g.lastTickCount=o,g.lastAutoInterval=v),v},t}(Ci);uP.prototype.dataToAngle=Ci.prototype.dataToCoord;uP.prototype.angleToData=Ci.prototype.coordToData;var M$=["radius","angle"],E0e=function(){function e(t){this.dimensions=M$,this.type=jo,this.cx=0,this.cy=0,this._radiusAxis=new lP,this._angleAxis=new uP,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,a=this._radiusAxis;return n.scale.type===t&&r.push(n),a.scale.type===t&&r.push(a),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 a=this.pointToCoord(t);return n[0]=this._radiusAxis.radiusToData(a[0],r),n[1]=this._angleAxis.angleToData(a[1],r),n},e.prototype.pointToCoord=function(t){var r=t[0]-this.cx,n=t[1]-this.cy,a=this.getAngleAxis(),i=a.getExtent(),o=Math.min(i[0],i[1]),s=Math.max(i[0],i[1]);a.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],a=t[1]/180*Math.PI;return r[0]=Math.cos(a)*n+this.cx,r[1]=-Math.sin(a)*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 a=t.getExtent(),i=Math.PI/180,o=1e-4;return{cx:this.cx,cy:this.cy,r0:n[0],r:n[1],startAngle:-a[0]*i,endAngle:-a[1]*i,clockwise:t.inverse,contain:function(s,l){var u=s-this.cx,c=l-this.cy,h=u*u+c*c,f=this.r,v=this.r0;return f!==v&&h-o<=f*f&&h+o>=v*v},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 a=G4(r);return a===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var a=G4(r);return a===this?this.pointToData(n):null},e}();function G4(e){var t=e.seriesModel,r=e.polarModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function R0e(e,t,r){var n=t.get("center"),a=Ur(t,r).refContainer;e.cx=me(n[0],a.width)+a.x,e.cy=me(n[1],a.height)+a.y;var i=e.getRadiusAxis(),o=Math.min(a.width,a.height)/2,s=t.get("radius");s==null?s=[0,"100%"]:ae(s)||(s=[0,s]);var l=[me(s[0],o),me(s[1],o)];i.inverse?i.setExtent(l[1],l[0]):i.setExtent(l[0],l[1])}function O0e(e,t){var r=this,n=r.getAngleAxis(),a=r.getRadiusAxis();if(fh(n,Vf),fh(a,Vf),Gf(n),Gf(a),n.type==="category"&&!n.onBand){var i=n.getExtent(),o=360/n.scale.count();n.inverse?i[1]+=o:i[1]-=o,n.setExtent(i[0],i[1])}}function z0e(e){return e.mainType==="angleAxis"}function H4(e,t){var r;if(e.type=Km(t),e.scale=Sv(t,e.type,!1),e.onBand=Qm(e.scale,t),e.inverse=t.get("inverse"),z0e(t)){e.inverse=e.inverse!==t.get("clockwise");var n=t.get("startAngle"),a=(r=t.get("endAngle"))!==null&&r!==void 0?r:n+(e.inverse?-360:360);e.setExtent(n,a)}t.axis=e,e.model=t}var B0e={dimensions:M$,create:function(e,t){var r=[];return e.eachComponent(V4,function(n,a){var i=new E0e(a+"");i.update=O0e;var o=i.getRadiusAxis(),s=i.getAngleAxis(),l=n.findAxisModel("radiusAxis"),u=n.findAxisModel("angleAxis");H4(o,l),H4(s,u),R0e(i,n,t),r.push(i),n.coordinateSystem=i,i.model=n}),e.eachSeries(function(n){if(n.get("coordinateSystem")===jo){var a=n.getReferringComponents(V4,pr).models[0],i=n.coordinateSystem=a.coordinateSystem;i&&(dh(i.getRadiusAxis(),n,jo),dh(i.getAngleAxis(),n,jo))}}),r}},F0e=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function $0(e,t,r){t[1]>t[0]&&(t=t.slice().reverse());var n=e.coordToPoint([t[0],r]),a=e.coordToPoint([t[1],r]);return{x1:n[0],y1:n[1],x2:a[0],y2:a[1]}}function Z0(e){var t=e.getRadiusAxis();return t.inverse?0:1}function U4(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 V0e=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 a=r.axis,i=a.polar,o=i.getRadiusAxis().getExtent(),s=a.getTicksCoords({breakTicks:"none"}),l=a.getMinorTicksCoords(),u=[];R(a.getViewLabels(),function(c){if(!c.tick.offInterval){c=ke(c);var h=a.scale;c.coord=a.dataToCoord(Cv(h,c.tick)),u.push(c)}}),U4(u),U4(s),R(F0e,function(c){r.get([c,"show"])&&(!a.scale.isBlank()||c==="axisLine")&&G0e[c](this.group,r,i,s,l,o,u)},this)}},t.type="angleAxis",t}(Gh),G0e={axisLine:function(e,t,r,n,a,i){var o=t.getModel(["axisLine","lineStyle"]),s=r.getAngleAxis(),l=Math.PI/180,u=s.getExtent(),c=Z0(r),h=c?0:1,f,v=Math.abs(u[1]-u[0])===360?"Circle":"Arc";i[h]===0?f=new Rh[v]({shape:{cx:r.cx,cy:r.cy,r:i[c],startAngle:-u[0]*l,endAngle:-u[1]*l,clockwise:s.inverse},style:o.getLineStyle(),z2:1,silent:!0}):f=new hv({shape:{cx:r.cx,cy:r.cy,r:i[c],r0:i[h]},style:o.getLineStyle(),z2:1,silent:!0}),f.style.fill=null,e.add(f)},axisTick:function(e,t,r,n,a,i){var o=t.getModel("axisTick"),s=(o.get("inside")?-1:1)*o.get("length"),l=i[Z0(r)],u=oe(n,function(c){return new Tr({shape:$0(r,[l,l+s],c.coord)})});e.add(Na(u,{style:Ee(o.getModel("lineStyle").getLineStyle(),{stroke:t.get(["axisLine","lineStyle","color"])})}))},minorTick:function(e,t,r,n,a,i){if(a.length){for(var o=t.getModel("axisTick"),s=t.getModel("minorTick"),l=(o.get("inside")?-1:1)*s.get("length"),u=i[Z0(r)],c=[],h=0;hx?"left":"right",S=Math.abs(y[1]-_)/m<.3?"middle":y[1]>_?"top":"bottom";if(s&&s[g]){var C=s[g];Re(C)&&C.textStyle&&(v=new vt(C.textStyle,l,l.ecModel))}var M=new wt({silent:ea.isLabelSilent(t),style:$t(v,{x:y[0],y:y[1],fill:v.getTextColor()||t.get(["axisLine","lineStyle","color"]),text:h.formattedLabel,align:w,verticalAlign:S})});if(e.add(M),el({el:M,componentModel:t,itemName:h.formattedLabel,formatterParamsExtra:{isTruncated:function(){return M.isTruncated},value:h.rawLabel,tickIndex:f}}),c){var A=ea.makeAxisEventDataBase(t);A.targetType="axisLabel",A.value=h.rawLabel,Be(M).eventData=A}},this)},splitLine:function(e,t,r,n,a,i){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",I=w;x&&(n[i][A]||(n[i][A]={p:w,n:w}),I=n[i][A][k]);var P=void 0,j=void 0,z=void 0,D=void 0;if(c.dim==="radius"){var B=c.dataToCoord(M)-w,H=e.dataToCoord(A);cr(B)=D})}}function K0e(e,t){var r=Vh(t,jo),n=Cn(e,{fromStat:{key:r},min:1}).w,a=n,i=0,o="20%",s="30%",l={};hh(e,r,function(y){var x=A$(y);l[x]||i++,l[x]=l[x]||{width:0,maxWidth:0};var _=me(y.get("barWidth"),n),w=me(y.get("barMaxWidth"),n),S=y.get("barGap"),C=y.get("barCategoryGap");_&&!l[x].width&&(_=Et(a,_),l[x].width=_,a-=_),w&&(l[x].maxWidth=w),S!=null&&(s=S),C!=null&&(o=C)});var u={},c=me(o,n),h=me(s,1),f=(a-c)/(i+(i-1)*h);f=at(f,0),R(l,function(y,x){var _=y.maxWidth;_&&_=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 a=this.getAxis();return n[0]=a.coordToData(a.toLocalCoord(t[a.orient==="horizontal"?0:1])),n},e.prototype.dataToPoint=function(t,r,n){var a=this.getAxis(),i=this.getRect();n=n||[];var o=a.orient==="horizontal"?0:1;return t instanceof Array&&(t=t[0]),n[o]=a.toGlobalCoord(a.dataToCoord(+t)),n[1-o]=o===0?i.y+i.height/2:i.x+i.width/2,n},e.prototype.convertToPixel=function(t,r,n){var a=W4(r);return a===this?this.dataToPoint(n):null},e.prototype.convertFromPixel=function(t,r,n){var a=W4(r);return a===this?this.pointToData(n):null},e}();function W4(e){var t=e.seriesModel,r=e.singleAxisModel;return r&&r.coordinateSystem||t&&t.coordinateSystem}function lxe(e,t){var r=[];return e.eachComponent(LA,function(n,a){var i=new sxe(n,e,t);i.name="single_"+a,i.resize(n,t),n.coordinateSystem=i,r.push(i)}),e.eachSeries(function(n){if(n.get("coordinateSystem")===ide){var a=n.getReferringComponents(LA,pr).models[0],i=n.coordinateSystem=a&&a.coordinateSystem;i&&dh(i.getAxis(),n,rw)}}),r}var uxe={create:lxe,dimensions:N$},$4=["x","y"],cxe=["width","height"],hxe=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeElOption=function(r,n,a,i,o){var s=a.axis,l=s.coordinateSystem,u=Db(s),c=Y0(l,u),h=Y0(l,1-u),f=l.dataToPoint(n)[0],v=i.get("type");if(v&&v!=="none"){var g=rP(i),m=dxe[v](s,f,c,h,i.get("seriesDataIndices"),i.ecModel);m.style=g,r.graphicKey=m.type,r.pointer=m}var y=qA(a);w$(n,r,y,a,i,o)},t.prototype.getHandleTransform=function(r,n,a){var i=qA(n,{labelInside:!1});i.labelMargin=a.get(["handle","margin"]);var o=nP(n.axis,r,i);return{x:o[0],y:o[1],rotation:i.rotation+(i.labelDirection<0?Math.PI:0)}},t.prototype.updateHandleTransform=function(r,n,a,i){var o=a.axis,s=o.coordinateSystem,l=Db(o),u=Y0(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=Y0(s,1-l),f=(h[1]+h[0])/2,v=[f,f];return v[l]=c[l],{x:c[0],y:c[1],rotation:r.rotation,cursorPoint:v,tooltipOption:{verticalAlign:"middle"}}},t}(tP),dxe={line:function(e,t,r,n){var a=aP([t,n[0]],[t,n[1]],Db(e));return{type:"Line",subPixelOptimize:!0,shape:a}},shadow:function(e,t,r,n,a,i){var o=iP(e,a,i),s=n[1]-n[0],l=oP(t,r,o),u=l[0],c=l[1];return{type:"Rect",shape:S$([u,n[0]],[c-u,s],Db(e))}}};function Db(e){return e.isHorizontal()?0:1}function Y0(e,t){var r=e.getRect();return[r[$4[t]],r[$4[t]]+r[cxe[t]]]}var fxe=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}(Yt);function vxe(e){rt(iy),Gh.registerAxisPointerClass("SingleAxisPointer",hxe),e.registerComponentView(fxe),e.registerComponentView(axe),e.registerComponentModel($x),Uf(e,"single",$x,$x.defaultOption),e.registerCoordinateSystem("single",uxe)}var pxe=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,a){var i=zh(r);e.prototype.init.apply(this,arguments),Z4(r,i)},t.prototype.mergeOption=function(r){e.prototype.mergeOption.apply(this,arguments),Z4(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}(ht);function Z4(e,t){var r=e.cellSize,n;ae(r)?n=r:n=e.cellSize=[r,r],n.length===1&&(n[1]=n[0]);var a=oe([0,1],function(i){return gae(t,i)&&(n[i]="auto"),n[i]!=null&&n[i]!=="auto"});Uo(e,t,{type:"box",ignoreSize:a})}var gxe=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,a){var i=this.group;i.removeAll();var o=r.coordinateSystem,s=o.getRangeInfo(),l=o.getOrient(),u=n.getLocaleModel();this._renderDayRect(r,s,i),this._renderLines(r,s,l,i),this._renderYearText(r,s,l,i),this._renderMonthText(r,u,l,i),this._renderWeekText(r,u,s,l,i)},t.prototype._renderDayRect=function(r,n,a){for(var i=r.coordinateSystem,o=r.getModel("itemStyle").getItemStyle(),s=i.getCellWidth(),l=i.getCellHeight(),u=n.start.time;u<=n.end.time;u=i.getNextNDay(u,1).time){var c=i.dataToCalendarLayout([u],!1).tl,h=new it({shape:{x:c[0],y:c[1],width:s,height:l},cursor:"default",style:o});a.add(h)}},t.prototype._renderLines=function(r,n,a,i){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 v=h.date;v.setMonth(v.getMonth()+1),h=s.getDateInfo(v)}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,a);o._tlpoints.push(y[0]),o._blpoints.push(y[y.length-1]),u&&o._drawSplitline(y,l,i)}u&&this._drawSplitline(o._getEdgesPoints(o._tlpoints,c,a),l,i),u&&this._drawSplitline(o._getEdgesPoints(o._blpoints,c,a),l,i)},t.prototype._getEdgesPoints=function(r,n,a){var i=[r[0].slice(),r[r.length-1].slice()],o=a==="horizontal"?0:1;return i[0][o]=i[0][o]-n/2,i[1][o]=i[1][o]+n/2,i},t.prototype._drawSplitline=function(r,n,a){var i=new un({z2:20,shape:{points:r},style:n});a.add(i)},t.prototype._getLinePointsOfOneWeek=function(r,n,a){for(var i=r.coordinateSystem,o=i.getDateInfo(n),s=[],l=0;l<7;l++){var u=i.getNextNDay(o.time,l),c=i.dataToCalendarLayout([u.time],!1);s[2*u.day]=c.tl,s[2*u.day+1]=c[a==="horizontal"?"bl":"tr"]}return s},t.prototype._formatterLabel=function(r,n){return ve(r)&&r?uH(r,n):Le(r)?r(n):n.nameMap},t.prototype._yearTextPositionControl=function(r,n,a,i,o){var s=n[0],l=n[1],u=["center","bottom"];i==="bottom"?(l+=o,u=["center","top"]):i==="left"?s-=o:i==="right"?(s+=o,u=["center","top"]):l-=o;var c=0;return(i==="left"||i==="right")&&(c=Math.PI/2),{rotation:c,x:s,y:l,style:{align:u[0],verticalAlign:u[1]}}},t.prototype._renderYearText=function(r,n,a,i){var o=r.getModel("yearLabel");if(o.get("show")){var s=o.get("margin"),l=o.get("position");l||(l=a!=="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=a==="horizontal"?0:1,v={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},x=this._formatterLabel(m,y),_=new wt({z2:30,style:$t(o,{text:x}),silent:o.get("silent")});_.attr(this._yearTextPositionControl(_,v[l],a,l,s)),i.add(_)}},t.prototype._monthTextPositionControl=function(r,n,a,i,o){var s="left",l="top",u=r[0],c=r[1];return a==="horizontal"?(c=c+o,n&&(s="center"),i==="start"&&(l="bottom")):(u=u+o,n&&(l="middle"),i==="start"&&(s="right")),{x:u,y:c,align:s,verticalAlign:l}},t.prototype._renderMonthText=function(r,n,a,i){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||ve(s))&&(s&&(n=UM(s)||n),s=n.get(["time","monthAbbr"])||[]);var f=u==="start"?0:1,v=a==="horizontal"?0:1;l=u==="start"?-l:l;for(var g=c==="center",m=o.get("silent"),y=0;y=i.start.time&&a.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 a=Math.floor(r[1].time/T2)-Math.floor(r[0].time/T2)+1,i=new Date(r[0].time),o=i.getDate(),s=r[1].date.getDate();i.setDate(o+a-1);var l=i.getDate();if(l!==s)for(var u=i.getTime()-r[1].time>0?1:-1;(l=i.getDate())!==s&&(i.getTime()-r[1].time)*u>0;)a-=u,i.setDate(l-u);var c=Math.floor((a+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:a,weeks:c,nthWeek:h,fweek:r[0].day,lweek:r[1].day}},e.prototype._getDateByWeeksAndDay=function(t,r,n){var a=this._getRangeInfo(n);if(t>a.weeks||t===0&&ra.lweek)return null;var i=(t-1)*7-a.fweek+r,o=new Date(a.start.time);return o.setDate(+a.start.d+i),this.getDateInfo(o)},e.create=function(t,r){var n=[];return t.eachComponent("calendar",function(a){var i=new e(a,t,r);n.push(i),a.coordinateSystem=i}),t.eachComponent(function(a,i){Ym({targetModel:i,coordSysType:"calendar",coordSysProvider:gH})}),n},e.dimensions=["time","value"],e}();function M2(e){var t=e.calendarModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}function yxe(e){e.registerComponentModel(pxe),e.registerComponentView(gxe),e.registerCoordinateSystem("calendar",mxe)}var _s={level:1,leaf:2,nonLeaf:3},Es={none:0,all:1,body:2,corner:3};function KA(e,t,r){var n=t[We[r]].getCell(e);return!n&&Tt(e)&&e<0&&(n=t[We[1-r]].getUnitLayoutInfo(r,Math.round(e))),n}function k$(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 L$(e,t,r,n,a){Y4(e[0],t,a,r,n,0),Y4(e[1],t,a,r,n,1)}function Y4(e,t,r,n,a,i){e[0]=1/0,e[1]=-1/0;var o=n[i],s=ae(o)?o:[o],l=s.length,u=!!r;if(l>=1?(X4(e,t,s,u,a,i,0),l>1&&X4(e,t,s,u,a,i,l-1)):e[0]=e[1]=NaN,u){var c=-a[We[1-i]].getLocatorCount(i),h=a[We[i]].getLocatorCount(i)-1;r===Es.body?c=at(0,c):r===Es.corner&&(h=Et(-1,h)),h=t[0]&&e[0]<=t[1]}function J4(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 bxe(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 Q4(e,t,r,n){var a=KA(t[n][0],r,n),i=KA(t[n][1],r,n);e[We[n]]=e[_r[n]]=NaN,a&&i&&(e[We[n]]=a.xy,e[_r[n]]=i.xy+i.wh-a.xy)}function bp(e,t,r,n){return e[We[t]]=r,e[We[1-t]]=n,e}function wxe(e){return e&&(e.type===_s.leaf||e.type===_s.nonLeaf)?e:null}function jb(){return{x:NaN,y:NaN,width:NaN,height:NaN}}var ez=function(){function e(t,r){this._cells=[],this._levels=[],this.dim=t,this.dimIdx=t==="x"?0:1,this._model=r,this._uniqueValueGen=Sxe(t);var n=r.get("data",!0),a=r.get("length",!0);if(n!=null&&!ae(n)&&(n=[]),n)this._initByDimModelData(n);else if(a!=null){n=Array(a);for(var i=0;i=1,w=r[We[n]],S=i.getLocatorCount(n)-1,C=new Yl;for(o.resetLayoutIterator(C,n);C.next();)M(C.item);for(i.resetLayoutIterator(C,n);C.next();)M(C.item);function M(A){yn(A.wh)&&(A.wh=x),A.xy=w,A.id[We[n]]===S&&!_&&(A.wh=r[We[n]]+r[_r[n]]-A.xy),w+=A.wh}}function sz(e,t){for(var r=t[We[e]].resetCellIterator();r.next();){var n=r.item;Eb(n.rect,e,n.id,n.span,t),Eb(n.rect,1-e,n.id,n.span,t),n.type===_s.nonLeaf&&(n.xy=n.rect[We[e]],n.wh=n.rect[_r[e]])}}function lz(e,t){e.travelExistingCells(function(r){var n=r.span;if(n){var a=r.spanRect,i=r.id;Eb(a,0,i,n,t),Eb(a,1,i,n,t)}})}function Eb(e,t,r,n,a){e[_r[t]]=0;var i=r[We[t]],o=i<0?a[We[1-t]]:a[We[t]],s=o.getUnitLayoutInfo(t,r[We[t]]);if(e[We[t]]=s.xy,e[_r[t]]=s.wh,n[We[t]]>1){var l=o.getUnitLayoutInfo(t,r[We[t]]+n[We[t]]-1);e[_r[t]]=l.xy+l.wh-s.xy}}function Rxe(e,t,r){var n=O_(e,r[_r[t]]);return QA(n,r[_r[t]])}function QA(e,t){return Math.max(Math.min(e,Te(t,1/0)),0)}function k2(e){var t=e.matrixModel,r=e.seriesModel,n=t?t.coordinateSystem:r?r.coordinateSystem:null;return n}var pn={inBody:1,inCorner:2,outside:3},co={x:null,y:null,point:[]};function uz(e,t,r,n,a){var i=r[We[t]],o=r[We[1-t]],s=i.getUnitLayoutInfo(t,i.getLocatorCount(t)-1),l=i.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[We[t]]=pn.outside;return}if(a===Es.body){l?(e[We[t]]=pn.inBody,h=Et(s.xy+s.wh,at(l.xy,h)),e.point[t]=h):e[We[t]]=pn.outside;return}else if(a===Es.corner){c?(e[We[t]]=pn.inCorner,h=Et(c.xy+c.wh,at(u.xy,h)),e.point[t]=h):e[We[t]]=pn.outside;return}var f=l?l.xy:c?c.xy+c.wh:NaN,v=u?u.xy:f,g=s?s.xy+s.wh:f;if(hg){if(!a){e[We[t]]=pn.outside;return}h=g}e.point[t]=h,e[We[t]]=f<=h&&h<=g?pn.inBody:v<=h&&h<=f?pn.inCorner:pn.outside}function cz(e,t,r,n){var a=1-r;if(e[We[r]]!==pn.outside)for(n[We[r]].resetCellIterator(N2);N2.next();){var i=N2.item;if(dz(e.point[r],i.rect,r)&&dz(e.point[a],i.rect,a)){t[r]=i.ordinal,t[a]=i.id[We[a]];return}}}function hz(e,t,r,n){if(e[We[r]]!==pn.outside){var a=e[We[r]]===pn.inCorner?n[We[1-r]]:n[We[r]];for(a.resetLayoutIterator(Q0,r);Q0.next();)if(Oxe(e.point[r],Q0.item)){t[r]=Q0.item.id[We[r]];return}}}function Oxe(e,t){return t.xy<=e&&e<=t.xy+t.wh}function dz(e,t,r){return t[We[r]]<=e&&e<=t[We[r]]+t[_r[r]]}function zxe(e){e.registerComponentModel(Axe),e.registerComponentView(Pxe),e.registerCoordinateSystem("matrix",Exe)}function Bxe(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 fz(e,t){var r;return R(t,function(n){e[n]!=null&&e[n]!=="auto"&&(r=!0)}),r}function Fxe(e,t,r){var n=te({},r),a=e[t],i=r.$action||"merge";i==="merge"?a?(Je(a,n,!0),Uo(a,n,{ignoreSize:!0}),bH(r,a),ex(r,a),ex(r,a,"shape"),ex(r,a,"style"),ex(r,a,"extra"),r.clipPath=a.clipPath):e[t]=n:i==="replace"?e[t]=n:i==="remove"&&a&&(e[t]=null)}var P$=["transition","enterFrom","leaveTo"],Vxe=P$.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function ex(e,t,r){if(r&&(!e[r]&&t[r]&&(e[r]={}),e=e[r],t=t[r]),!(!e||!t))for(var n=r?P$:Vxe,a=0;a=0;c--){var h=a[c],f=Fr(h.id,null),v=f!=null?o.get(f):null;if(v){var g=v.parent,x=ti(g),_=g===i?{width:s,height:l}:{width:x.width,height:x.height},w={},S=V1(v,h,_,null,{hv:h.hv,boundingMode:h.bounding},w);if(!ti(v).isNew&&S){for(var C=h.transition,M={},A=0;A=0)?M[k]=I:v[k]=I}At(v,M,r,0)}else v.attr(w)}}},t.prototype._clear=function(){var r=this,n=this._elMap;n.each(function(a){qx(a,ti(a).option,n,r._lastGraphicModel)}),this._elMap=we()},t.prototype.dispose=function(){this._clear()},t.type="graphic",t}(Yt);function eN(e){var t=Se(vz,e)?vz[e]:Jg(e),r=new t({});return ti(r).type=e,r}function pz(e,t,r,n){var a=eN(r);return t.add(a),n.set(e,a),ti(a).id=e,ti(a).isNew=!0,a}function qx(e,t,r,n){var a=e&&e.parent;a&&(e.type==="group"&&e.traverse(function(i){qx(i,t,r,n)}),hw(e,t,n),r.removeKey(ti(e).id))}function gz(e,t,r,n){e.isGroup||R([["cursor",xi.prototype.cursor],["zlevel",n||0],["z",r||0],["z2",0]],function(a){var i=a[0];Se(t,i)?e[i]=Te(t[i],a[1]):e[i]==null&&(e[i]=a[1])}),R(mt(t),function(a){if(a.indexOf("on")===0){var i=t[a];e[a]=Le(i)?i:null}}),Se(t,"draggable")&&(e.draggable=t.draggable),t.name!=null&&(e.name=t.name),t.id!=null&&(e.id=t.id)}function Wxe(e){return e=te({},e),R(["id","parentId","$action","hv","bounding","textContent","clipPath"].concat(mH),function(t){delete e[t]}),e}function $xe(e,t,r){var n=Be(e).eventData;!e.silent&&!e.ignore&&!n&&(n=Be(e).eventData={componentType:"graphic",componentIndex:t.componentIndex,name:e.name}),n&&(n.info=r.info)}function Zxe(e){e.registerComponentModel(Hxe),e.registerComponentView(Uxe),e.registerPreprocessor(function(t){var r=t.graphic;ae(r)?!r[0]||!r[0].elements?t.graphic=[{elements:r}]:t.graphic=[t.graphic[0]]:r&&!r.elements&&(t.graphic=[{elements:[r]}])})}var mz=["x","y","radius","angle","single"],Yxe=Qe(),Xxe=["cartesian2d","polar","singleAxis"];function qxe(e){var t=e.get("coordinateSystem");return Ye(Xxe,t)>=0}function Rl(e){return e+"Axis"}function Kxe(e,t){var r=we(),n=[],a=we();e.eachComponent({mainType:"dataZoom",query:t},function(c){a.get(c.uid)||s(c)});var i;do i=!1,e.eachComponent("dataZoom",o);while(i);function o(c){!a.get(c.uid)&&l(c)&&(s(c),i=!0)}function s(c){a.set(c.uid,!0),n.push(c),u(c)}function l(c){var h=!1;return c.eachTargetAxis(function(f,v){var g=r.get(f);g&&g[v]&&(h=!0)}),h}function u(c){c.eachTargetAxis(function(h,f){(r.get(h)||r.set(h,[]))[f]=!0})}return n}function D$(e){var t=e.ecModel,r={infoList:[],infoMap:we()};return e.eachTargetAxis(function(n,a){var i=t.getComponent(Rl(n),a);if(i){var o=i.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(i)}}}),r}function j$(e){var t=Yxe(pU(e));return t.axisProxyMap||(t.axisProxyMap=we())}function Rb(e){if(e)return j$(e.ecModel).get(e.uid)}function Jxe(e,t){j$(e.ecModel).set(e.uid,t)}function E$(e,t){var r=t.getAxisModel().axis.__alignTo;return r&&e.getAxisProxy(r.dim,r.model.componentIndex)?Rb(r.model):null}var L2=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}(),Mm=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,a){var i=yz(r);this.settledOption=i,this.mergeDefaultAndTheme(r,a),this._doInit(i)},t.prototype.mergeOption=function(r){var n=yz(r);Je(this.option,r,!0),Je(this.settledOption,n,!0),this._doInit(n)},t.prototype._doInit=function(r){var n=this.option;this._setDefaultThrottle(r),this._updateRangeUse(r);var a=this.settledOption;R([["start","startValue"],["end","endValue"]],function(i,o){this._rangePropMode[o]==="value"&&(n[i[0]]=a[i[0]]=null)},this),this._resetTarget()},t.prototype._resetTarget=function(){var r=this.get("orient",!0),n=this._targetAxisInfoMap=we(),a=this._fillSpecifiedTargetAxis(n);a?this._orient=r||this._makeAutoOrientByTargetAxis():(this._orient=r||"horizontal",this._fillAutoTargetAxisByOrient(n,this._orient)),this._noTarget=!0,n.each(function(i){i.indexList.length&&(this._noTarget=!1)},this)},t.prototype._fillSpecifiedTargetAxis=function(r){var n=!1;return R(mz,function(a){var i=this.getReferringComponents(Rl(a),Bte);if(i.specified){n=!0;var o=new L2;R(i.models,function(s){o.add(s.componentIndex)}),r.set(a,o)}},this),n},t.prototype._fillAutoTargetAxisByOrient=function(r,n){var a=this.ecModel,i=!0;if(i){var o=n==="vertical"?"y":"x",s=a.findComponents({mainType:o+"Axis"});l(s,o)}if(i){var s=a.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 L2;if(f.add(h.componentIndex),r.set(c,f),i=!1,c==="x"||c==="y"){var v=h.getReferringComponents("grid",pr).models[0];v&&R(u,function(g){h.componentIndex!==g.componentIndex&&v===g.getReferringComponents("grid",pr).models[0]&&f.add(g.componentIndex)})}}}i&&R(mz,function(u){if(i){var c=a.findComponents({mainType:Rl(u),filter:function(f){return f.get("type",!0)==="category"}});if(c[0]){var h=new L2;h.add(c[0].componentIndex),r.set(u,h),i=!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,a=this.get("rangeMode");R([["start","startValue"],["end","endValue"]],function(i,o){var s=r[i[0]]!=null,l=r[i[1]]!=null;s&&!l?n[o]="percent":!s&&l?n[o]="value":a?n[o]=a[o]:s&&(n[o]="percent")})},t.prototype.noTarget=function(){return this._noTarget},t.prototype.getFirstTargetAxisModel=function(){var r;return this.eachTargetAxis(function(n,a){r==null&&(r=this.ecModel.getComponent(Rl(n),a))},this),r},t.prototype.eachTargetAxis=function(r,n){this._targetAxisInfoMap.each(function(a,i){R(a.indexList,function(o){r.call(n,i,o)})})},t.prototype.getAxisProxy=function(r,n){return Rb(this.getAxisModel(r,n))},t.prototype.getAxisModel=function(r,n){var a=this._targetAxisInfoMap.get(r);if(a&&a.indexMap[n])return this.ecModel.getComponent(Rl(r),n)},t.prototype.setRawRange=function(r){var n=this.option,a=this.settledOption;R([["start","startValue"],["end","endValue"]],function(i){(r[i[0]]!=null||r[i[1]]!=null)&&(n[i[0]]=a[i[0]]=r[i[0]],n[i[1]]=a[i[1]]=r[i[1]])},this),this._updateRangeUse(r)},t.prototype.setCalculatedRange=function(r){var n=this.option;R(["start","startValue","end","endValue"],function(a){n[a]=r[a]})},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 a=this.findRepresentativeAxisProxy();if(a)return a.getWindow().value}else return this.getAxisProxy(r,n).getWindow().value},t.prototype.findRepresentativeAxisProxy=function(r){if(r)return Rb(r);for(var n,a=this._targetAxisInfoMap.keys(),i=0;io[1];if(w&&!S&&!C)return!0;w&&(y=!0),S&&(g=!0),C&&(m=!0)}return y&&g&&m})}else R(c,function(v){if(i==="empty")l.setData(u=u.map(v,function(m){return s(m)?m:NaN}));else{var g={};g[v]=o,u.selectRange(g)}});R(c,function(v){u.setApproximateExtent(o,v)})}});function s(l){return l>=o[0]&&l<=o[1]}},e.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},r=this._dataZoomModel,n=this._extent;R(["min","max"],function(a){var i=r.get(a+"Span"),o=r.get(a+"ValueSpan");o!=null&&(o=this.getAxisModel().axis.scale.parse(o)),o!=null?i=Nt(n[0]+o,n,[0,100],!0):i!=null&&(o=Nt(i,[0,100],n,!0)-n[0]),t[a+"Span"]=i,t[a+"ValueSpan"]=o},this)},e}(),r_e={dirtyOnOverallProgress:!0,getTargetSeries:function(e){function t(a){e.eachComponent("dataZoom",function(i){i.eachTargetAxis(function(o,s){var l=e.getComponent(Rl(o),s);a(o,s,l,i)})})}var r=[];t(function(a,i,o,s){if(!Rb(o)){var l=new t_e(a,i,s,e);r.push(l),Jxe(o,l)}});var n=we();return R(r,function(a){R(a.getTargetSeriesModels(),function(i){n.set(i.uid,i)})}),n},overallReset:function(e,t){e.eachComponent("dataZoom",function(r){var n=[];r.eachTargetAxis(function(a,i){var o=r.getAxisProxy(a,i),s=E$(r,o);s?n.push([o,s]):o.reset(r,null)}),R(n,function(a){a[0].reset(r,a[1].getWindow().percentInverted)}),r.eachTargetAxis(function(a,i){r.getAxisProxy(a,i).filterData(r,t)})}),e.eachComponent("dataZoom",function(r){var n=r.findRepresentativeAxisProxy();if(n){var a=n.getWindow(),i=a.percent,o=a.value;r.setCalculatedRange({start:i[0],end:i[1],startValue:o[0],endValue:o[1]})}})}};function n_e(e){e.registerAction("dataZoom",function(t,r){var n=Kxe(r,t);R(n,function(a){a.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})})}var a_e=lv();function fP(e){a_e(e,function(){e.registerProcessor(e.PRIORITY.PROCESSOR.FILTER,r_e),n_e(e),e.registerSubTypeDefaulter("dataZoom",function(){return"slider"})})}function i_e(e){e.registerComponentModel(Qxe),e.registerComponentView(e_e),fP(e)}var Eo=function(){function e(){}return e}(),R$={};function Rd(e,t){R$[e]=t}function O$(e){return R$[e]}var o_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.prototype.init=function(r,n,a){var i=a.getTheme().get("toolbox"),o=i?i.feature:null;o&&(this._themeFeatureOption=te({},o),i.feature={}),e.prototype.init.call(this,r,n,a),o&&(i.feature=o)},t.prototype.optionUpdated=function(){R(this.option.feature,function(r,n){var a=this._themeFeatureOption,i=O$(n);i&&(i.getDefaultOption&&(i.defaultOption=i.getDefaultOption(this.ecModel)),a&&a[n]&&(Je(r,a[n]),a[n]=null),Je(r,i.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}(ht);function z$(e,t){var r=mv(t.get("padding")),n=t.getItemStyle(["color","opacity"]);n.fill=t.get("backgroundColor");var a=new it({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 a}var s_e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a,i){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=we()),h=[];R(u,function(_,w){h.push(w)}),new $s(this._featureNames||[],h).add(f).update(f).remove(nt(f,null)).execute(),this._featureNames=It(h,function(_){return c.hasKey(_)});function f(_,w){var S=_!=null&&w==null,C=_!=null&&w!=null,M=_==null,A=S||C?h[_]:h[w],k=u[A],I=S||C?new vt(k,r,n):null,P=I&&I.get("show"),j;if(S){if(!P)return;if(l_e(A))j={onclick:I.option.onclick,featureName:A};else{var z=O$(A);if(!z)return;j=new z}c.set(A,j)}else j=c.get(A);if(M||!P){xz(j)&&j.dispose&&j.dispose(n,a),c.removeKey(A);return}i&&i.newTitle!=null&&i.featureName===A&&(k.title=i.newTitle),S&&(j.uid=Oh("toolbox-feature")),j.model=I,j.ecModel=n,j.api=a,v(I,j,A),I.setIconStatus=function(D,B){var H=this.option,V=this.iconPaths;H.iconStatus=H.iconStatus||{},H.iconStatus[D]=B,V[D]&&(B==="emphasis"?Us:Ws)(V[D])},xz(j)&&j.render&&j.render(I,n,a,i)}function v(_,w,S){var C=_.getModel("iconStyle"),M=_.getModel(["emphasis","iconStyle"]),A=w instanceof Eo&&w.getIcons?w.getIcons():_.get("icon"),k=_.get("title")||{},I,P;ve(A)?(I={},I[S]=A):I=A,ve(k)?(P={},P[S]=k):P=k;var j=_.iconPaths={};R(I,function(z,D){var B=pv(z,{},{x:-s/2,y:-s/2,width:s,height:s});B.setStyle(C.getItemStyle());var H=B.ensureState("emphasis");H.style=M.getItemStyle();var V=new wt({style:{text:P[D],align:M.get("textAlign"),borderRadius:M.get("textBorderRadius"),padding:M.get("textPadding"),fill:null,font:uL({fontStyle:M.get("textFontStyle"),fontFamily:M.get("textFontFamily"),fontSize:M.get("textFontSize"),fontWeight:M.get("textFontWeight")},n)},ignore:!0});B.setTextContent(V),el({el:B,componentModel:r,itemName:D,formatterParamsExtra:{title:P[D]}}),B.__title=P[D],B.on("mouseover",function(){var U=M.getItemStyle(),F=l?r.get("right")==null&&r.get("left")!=="right"?"right":"left":r.get("bottom")==null&&r.get("top")!=="bottom"?"bottom":"top";V.setStyle({fill:M.get("textFill")||U.fill||U.stroke||K.color.neutral99,backgroundColor:M.get("textBackgroundColor")}),B.setTextConfig({position:M.get("textPosition")||F}),V.ignore=!r.get("showTitle"),a.enterEmphasis(this)}).on("mouseout",function(){_.get(["iconStatus",D])!=="emphasis"&&a.leaveEmphasis(this),V.hide()}),(_.get(["iconStatus",D])==="emphasis"?Us:Ws)(B),o.add(B),B.on("click",be(w.onclick,w,n,a,D)),j[D]=B})}var g=Ur(r,a).refContainer,m=r.getBoxLayoutParams(),y=r.get("padding"),x=tr(m,g,y);Gc(r.get("orient"),o,r.get("itemGap"),x.width,x.height),V1(o,m,g,y),o.add(z$(o.getBoundingRect(),r)),l||o.eachChild(function(_){var w=_.__title,S=_.ensureState("emphasis"),C=S.textConfig||(S.textConfig={}),M=_.getTextContent(),A=M&&M.ensureState("emphasis");if(A&&!Le(A)&&w){var k=A.style||(A.style={}),I=S1(w,wt.makeFont(k)),P=_.x+o.x,j=_.y+o.y+s,z=!1;j+I.height>a.getHeight()&&(C.position="top",z=!0);var D=z?-5-I.height:s+10;P+I.width/2>a.getWidth()?(C.position=["100%",D],k.align="right"):P-I.width/2<0&&(C.position=[0,D],k.align="left")}})},t.prototype.updateView=function(r,n,a,i){R(this._features,function(o){o&&o instanceof Eo&&o.updateView&&o.updateView(o.model,n,a,i)})},t.prototype.dispose=function(r,n){R(this._features,function(a){a&&a instanceof Eo&&a.dispose&&a.dispose(r,n)})},t.type="toolbox",t}(Yt);function l_e(e){return e.indexOf("my")===0}function xz(e){return e instanceof Eo}var u_e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){var a=this.model,i=a.get("name")||r.get("title.0.text")||"echarts",o=n.getZr().painter.getType()==="svg",s=o?"svg":a.get("type",!0)||"png",l=n.getConnectedDataURL({type:s,backgroundColor:a.get("backgroundColor",!0)||r.get("backgroundColor")||K.color.neutral00,connectedBackgroundColor:a.get("connectedBackgroundColor"),excludeComponents:a.get("excludeComponents"),pixelRatio:a.get("pixelRatio")}),u=xt.browser;if(typeof MouseEvent=="function"&&(u.newEdge||!u.ie&&!u.edge)){var c=document.createElement("a");c.download=i+"."+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(","),v=f[0].indexOf("base64")>-1,g=o?decodeURIComponent(f[1]):f[1];v&&(g=window.atob(g));var m=i+"."+s;if(window.navigator.msSaveOrOpenBlob){for(var y=g.length,x=new Uint8Array(y);y--;)x[y]=g.charCodeAt(y);var _=new Blob([x]);window.navigator.msSaveOrOpenBlob(_,m)}else{var w=document.createElement("iframe");document.body.appendChild(w);var S=w.contentWindow,C=S.document;C.open("image/svg+xml","replace"),C.write(g),C.close(),S.focus(),C.execCommand("SaveAs",!0,m),document.body.removeChild(w)}}else{var M=a.get("lang"),A='',k=window.open();k.document.write(A),k.document.title=i}},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}(Eo),_z="__ec_magicType_stack__",c_e=[["line","bar"],["stack"]],h_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"),a={};return R(r.get("type"),function(i){n[i]&&(a[i]=n[i])}),a},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,a){var i=this.model,o=i.get(["seriesIndex",a]);if(bz[a]){var s={series:[]},l=function(h){var f=h.subType,v=h.id,g=bz[a](f,v,h,i);g&&(Ee(g,h.option),s.series.push(g));var m=h.coordinateSystem;if(m&&m.type==="cartesian2d"&&(a==="line"||a==="bar")){var y=m.getAxesByScale("ordinal")[0];if(y){var x=y.dim,_=x+"Axis",w=h.getReferringComponents(_,pr).models[0],S=w.componentIndex;s[_]=s[_]||[];for(var C=0;C<=S;C++)s[_][S]=s[_][S]||{};s[_][S].boundaryGap=a==="bar"}}};R(c_e,function(h){Ye(h,a)>=0&&R(h,function(f){i.setIconStatus(f,"normal")})}),i.setIconStatus(a,"emphasis"),r.eachComponent({mainType:"series",query:o==null?null:{seriesIndex:o}},l);var u,c=a;a==="stack"&&(u=Je({stack:i.option.title.tiled,tiled:i.option.title.stack},i.option.title),i.get(["iconStatus",a])!=="emphasis"&&(c="tiled")),n.dispatchAction({type:"changeMagicType",currentType:c,newOption:s,newTitle:u,featureName:"magicType"})}},t}(Eo),bz={line:function(e,t,r,n){if(e==="bar")return Je({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 Je({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 a=r.get("stack")===_z;if(e==="line"||e==="bar")return n.setIconStatus("stack",a?"normal":"emphasis"),Je({id:t,stack:a?"":_z},n.get(["option","stack"])||{},!0)}};Xi({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(e,t){t.mergeOption(e.newOption)});var dw=new Array(60).join("-"),Xf=" ";function d_e(e){var t={},r=[],n=[];return e.eachRawSeries(function(a){var i=a.coordinateSystem;if(i&&(i.type==="cartesian2d"||i.type==="polar")){var o=i.getBaseAxis();if(o.type==="category"){var s=Yce(o);t[s]||(t[s]={categoryAxis:o,valueAxis:i.getOtherAxis(o),series:[]},n.push({axisDim:o.dim,axisIndex:o.index})),t[s].series.push(a)}else r.push(a)}else r.push(a)}),{seriesGroupByCategoryAxis:t,other:r,meta:n}}function f_e(e){var t=[];return R(e,function(r,n){var a=r.categoryAxis,i=r.valueAxis,o=i.dim,s=[" "].concat(oe(r.series,function(v){return v.name})),l=[a.model.getCategories()];R(r.series,function(v){var g=v.getRawData();l.push(v.getRawData().mapArray(g.mapDimension(o),function(m){return m}))});for(var u=[s.join(Xf)],c=0;c=0)return!0}var tN=new RegExp("["+Xf+"]+","g");function g_e(e){for(var t=e.split(/\n+/g),r=Ob(t.shift()).split(tN),n=[],a=oe(r,function(l){return{name:l,data:[]}}),i=0;i=0)return!0}var tN=new RegExp("["+Xf+"]+","g");function m_e(e){for(var t=e.split(/\n+/g),r=Ob(t.shift()).split(tN),n=[],a=oe(r,function(l){return{name:l,data:[]}}),i=0;i=0;i--){var o=r[i];if(o[a])break}if(i<0){var s=e.queryComponents({mainType:"dataZoom",subType:"select",id:a})[0];if(s){var l=s.getPercentRange();r[0][a]={dataZoomId:a,start:l[0],end:l[1]}}}}),r.push(t)}function w_e(e){var t=fP(e),r=t[t.length-1];t.length>1&&t.pop();var n={};return z$(r,function(a,i){for(var o=t.length-1;o>=0;o--)if(a=t[o][i],a){n[i]=a;break}}),n}function S_e(e){B$(e).snapshots=null}function C_e(e){return fP(e).length}function fP(e){var t=B$(e);return t.snapshots||(t.snapshots=[{}]),t.snapshots}var T_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){S_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}(Eo);Xi({type:"restore",event:"restore",update:"prepareAndUpdate"},function(e,t){t.resetOption("recreate")});var M_e=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],vP=function(){function e(t,r,n){var a=this;this._targetInfoList=[];var i=bz(r,t);R(A_e,function(o,s){(!n||!n.include||Ye(n.include,s)>=0)&&o(i,a._targetInfoList)})}return e.prototype.setOutputRanges=function(t,r){return this.matchOutputRanges(t,r,function(n,a,i){if((n.coordRanges||(n.coordRanges=[])).push(a),!n.coordRange){n.coordRange=a;var o=I2[n.brushType](0,i,a);n.__rangeOffset={offset:Tz[n.brushType](o.values,n.range,[1,1]),xyMinMax:o.xyMinMax}}}),t},e.prototype.matchOutputRanges=function(t,r,n){R(t,function(a){var i=this.findTargetInfo(a,r);i&&i!==!0&&R(i.coordSyses,function(o){var s=I2[a.brushType](1,o,a.range,!0);n(a,s.values,o,r)})},this)},e.prototype.setInputRanges=function(t,r){R(t,function(n){var a=this.findTargetInfo(n,r);if(n.range=n.range||[],a&&a!==!0){n.panelId=a.panelId;var i=I2[n.brushType](0,a.coordSys,n.coordRange),o=n.__rangeOffset;n.range=o?Tz[n.brushType](i.values,o.offset,N_e(i.xyMinMax,o.xyMinMax)):i.values}},this)},e.prototype.makePanelOpts=function(t,r){return oe(this._targetInfoList,function(n){var a=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:r?r(n):null,clipPath:W9(a),isTargetByCursor:Z9(a,t,n.coordSysModel),getLinearBrushOtherExtent:$9(a)}})},e.prototype.controlSeries=function(t,r,n){var a=this.findTargetInfo(t,n);return a===!0||a&&Ye(a.coordSyses,r.coordinateSystem)>=0},e.prototype.findTargetInfo=function(t,r){for(var n=this._targetInfoList,a=bz(r,t),i=0;ie[1]&&e.reverse(),e}function bz(e,t){return ff(e,t,{includeMainTypes:M_e})}var A_e={grid:function(e,t){var r=e.xAxisModels,n=e.yAxisModels,a=e.gridModels,i=we(),o={},s={};!r&&!n&&!a||(R(r,function(l){var u=l.axis.grid.model;i.set(u.id,u),o[u.id]=!0}),R(n,function(l){var u=l.axis.grid.model;i.set(u.id,u),s[u.id]=!0}),R(a,function(l){i.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),i.each(function(l){var u=l.coordinateSystem,c=[];R(u.getCartesians(),function(h,f){(Ye(r,h.getAxis("x").model)>=0||Ye(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:Sz.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(e,t){R(e.geoModels,function(r){var n=r.coordinateSystem;t.push({panelId:"geo--"+r.id,geoModel:r,coordSysModel:r,coordSys:n,coordSyses:[n],getPanelRect:Sz.geo})})}},wz=[function(e,t){var r=e.xAxisModel,n=e.yAxisModel,a=e.gridModel;return!a&&r&&(a=r.axis.grid.model),!a&&n&&(a=n.axis.grid.model),a&&a===t.gridModel},function(e,t){var r=e.geoModel;return r&&r===t.geoModel}],Sz={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys.view,t=U8(null,e);return dG(t,t,_b(null,e)),t}},I2={lineX:nt(Cz,0),lineY:nt(Cz,1),rect:function(e,t,r,n){var a=e?t.pointToData([r[0][0],r[1][0]],n):t.dataToPoint([r[0][0],r[1][0]],n),i=e?t.pointToData([r[0][1],r[1][1]],n):t.dataToPoint([r[0][1],r[1][1]],n),o=[rN([a[0],i[0]]),rN([a[1],i[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,r,n){var a=[gn(),gn()],i=oe(r,function(o){var s=e?t.pointToData(o,n):t.dataToPoint(o,n);return a[0][0]=Math.min(a[0][0],s[0]),a[1][0]=Math.min(a[1][0],s[1]),a[0][1]=Math.max(a[0][1],s[0]),a[1][1]=Math.max(a[1][1],s[1]),s});return{values:i,xyMinMax:a}}};function Cz(e,t,r,n){var a=r.getAxis(["x","y"][e]),i=rN(oe([0,1],function(s){return t?a.coordToData(a.toLocalCoord(n[s]),!0):a.toGlobalCoord(a.dataToCoord(n[s]))})),o=[];return o[e]=i,o[1-e]=[NaN,NaN],{values:i,xyMinMax:o}}var Tz={lineX:nt(Mz,0),lineY:nt(Mz,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 oe(e,function(n,a){return[n[0]-r[0]*t[a][0],n[1]-r[1]*t[a][1]]})}};function Mz(e,t,r,n){return[t[0]-n[e]*r[0],t[1]-n[e]*r[1]]}function N_e(e,t){var r=Az(e),n=Az(t),a=[r[0]/n[0],r[1]/n[1]];return isNaN(a[0])&&(a[0]=1),isNaN(a[1])&&(a[1]=1),a}function Az(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var nN=R,k_e=Dte("toolbox-dataZoom_"),L_e={x:"width",y:"height"},I_e=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a,i){this._brushController||(this._brushController=new OI(a.getZr()),this._brushController.on("brush",be(this._onBrush,this)).mount()),j_e(r,n,this,i,a),D_e(r,n)},t.prototype.onclick=function(r,n,a){P_e[a].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 a={},i=this.ecModel;this._brushController.updateCovers([]);var o=new vP(pP(this.model),i,{include:["grid"]});o.matchOutputRanges(n,i,function(u,c,h){if(h.type==="cartesian2d"){var f=h.master.getRect().clone(),v=u.brushType;v==="rect"?(s("x",h,f,c[0]),s("y",h,f,c[1])):s({lineX:"x",lineY:"y"}[v],h,f,c)}}),b_e(i,a),this._dispatchZoomAction(a);function s(u,c,h,f){var v=c.getAxis(u),g=v.model,m=l(u,g,i),y=m.findRepresentativeAxisProxy(g).getMinMaxSpan(),x=v.scale.getExtent();(y.minValueSpan!=null||y.maxValueSpan!=null)&&(f=uu(0,f.slice(),x,0,y.minValueSpan,y.maxValueSpan));var _=Rk(x,h[L_e[u]],.5);m&&(a[m.id]={dataZoomId:m.id,startValue:isFinite(_)?Mt(f[0],_):f[0],endValue:isFinite(_)?Mt(f[1],_):f[1]})}function l(u,c,h){var f;return h.eachComponent({mainType:"dataZoom",subType:"select"},function(v){var g=v.getAxisModel(u,c.componentIndex);g&&(f=v)}),f}},t.prototype._dispatchZoomAction=function(r){var n=[];nN(r,function(a,i){n.push(ke(a))}),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}(Eo),P_e={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(w_e(this.ecModel))}};function pP(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 D_e(e,t){e.setIconStatus("back",C_e(t)>1?"emphasis":"normal")}function j_e(e,t,r,n,a){var i=r._isZoomActive;n&&n.type==="takeGlobalCursor"&&(i=n.key==="dataZoomSelect"?n.dataZoomSelectActive:!1),r._isZoomActive=i,e.setIconStatus("zoom",i?"emphasis":"normal");var o=new vP(pP(e),t,{include:["grid"]}),s=o.makePanelOpts(a,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});r._brushController.setPanels(s).enableBrush(i&&s.length?{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()}:!1)}bae("dataZoom",function(e){var t=e.getComponent("toolbox",0),r=["feature","dataZoom"];if(!t||t.get(r)==null)return;var n=t.getModel(r),a=[],i=pP(n),o=ff(e,i);nN(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),nN(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:k_e+u+h};f[c]=h,a.push(f)}return a});function E_e(e){e.registerComponentModel(i_e),e.registerComponentView(o_e),Rd("saveAsImage",l_e),Rd("magicType",c_e),Rd("dataView",x_e),Rd("dataZoom",I_e),Rd("restore",T_e),rt(a_e)}var R_e=function(e){X(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}(ht);function F$(e){var t=e.get("confine");return t!=null?!!t:e.get("renderMode")==="richText"}function V$(e){if(xt.domSupported){for(var t=document.documentElement.style,r=0,n=e.length;r-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=i==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=i==="top"?225:45)+"deg)");var c=u*Math.PI/180,h=o+a,f=h*Math.abs(Math.cos(c))+h*Math.abs(Math.sin(c)),v=Math.round(((f-Math.SQRT2*a)/2+Math.SQRT2*a-(f-h)/2)*100)/100;s+=";"+i+":-"+v+"px";var g=t+" solid "+a+"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 H_e(e,t,r){var n="cubic-bezier(0.23,1,0.32,1)",a="",i="";return r&&(a=" "+e/2+"s "+n,i="opacity"+a+",visibility"+a),t||(a=" "+e+"s "+n,i+=(i.length?",":"")+(xt.transformSupported?""+gP+a:",left"+a+",top"+a)),B_e+":"+i}function Nz(e,t,r){var n=e.toFixed(0)+"px",a=t.toFixed(0)+"px";if(!xt.transformSupported)return r?"top:"+a+";left:"+n+";":[["top",a],["left",n]];var i=xt.transform3dSupported,o="translate"+(i?"3d":"")+"("+n+","+a+(i?",0":"")+")";return r?"top:0;left:0;"+gP+":"+o+";":[["top",0],["left",0],[G$,o]]}function U_e(e){var t=[],r=e.get("fontSize"),n=e.getTextColor();n&&t.push("color:"+n),t.push("font:"+e.getFont());var a=Te(e.get("lineHeight"),Math.round(r*3/2));r&&t.push("line-height:"+a+"px");var i=e.get("textShadowColor"),o=e.get("textShadowBlur")||0,s=e.get("textShadowOffsetX")||0,l=e.get("textShadowOffsetY")||0;return i&&o&&t.push("text-shadow:"+s+"px "+l+"px "+o+"px "+i),R(["decoration","align"],function(u){var c=e.get(u);c&&t.push("text-"+u+":"+c)}),t.join(";")}function W_e(e,t,r,n){var a=[],i=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=JH(e,"html"),v=u+"px "+c+"px "+s+"px "+l;return a.push("box-shadow:"+v),t&&i>0&&a.push(H_e(i,r,n)),o&&a.push("background-color:"+o),R(["width","color","radius"],function(g){var m="border-"+g,y=bL(m),x=e.get(y);x!=null&&a.push(m+":"+x+(g==="color"?"":"px"))}),a.push(U_e(h)),f!=null&&a.push("padding:"+mv(f).join("px ")+"px"),a.join(";")+";"}function kz(e,t,r,n,a){var i=t&&t.painter;if(r){var o=i&&i.getViewportRoot();o&&ZQ(e,o,r,n,a)}else{e[0]=n,e[1]=a;var s=i&&i.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var $_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,xt.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var a=this._zr=t.getZr(),i=r.appendTo,o=i&&(ve(i)?document.querySelector(i):Qc(i)?i:Le(i)&&i(t.getDom()));kz(this._styleCoord,a,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=a.handler,c=a.painter.getViewportRoot();Ka(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=z_e(r,"position"),a=r.style;a.position!=="absolute"&&n!=="absolute"&&(a.position="relative")}var i=t.get("alwaysShowContent");i&&this._moveIfResized(),this._alwaysShowContent=i,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,a=n.style,i=this._styleCoord;n.innerHTML?a.cssText=F_e+W_e(t,!this._firstShow,this._longHide,this._enableDisplayTransition)+Nz(i[0],i[1],!0)+("border-color:"+uh(r)+";")+(t.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):a.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(t,r,n,a,i){var o=this.el;if(t==null){o.innerHTML="";return}var s="";if(ve(i)&&n.get("trigger")==="item"&&!F$(n)&&(s=G_e(n,a,i)),ve(t))o.innerHTML=t+s;else if(t){o.innerHTML="",ae(t)||(t=[t]);for(var l=0;l=0?this._tryShow(i,o):a==="leave"&&this._hide(o))},this))},t.prototype._keepShow=function(){var r=this._tooltipModel,n=this._ecModel,a=this._api,i=r.get("triggerOn");if(r.get("trigger")!=="axis"&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&i!=="none"&&i!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!a.isDisposed()&&o.manuallyShowTip(r,n,a,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(r,n,a,i){if(!(i.from===this.uid||xt.node||!a.getDom())){var o=Pz(i,a);this._ticket="";var s=i.dataByCoordSys,l=Q_e(i,n,a);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:i.position,positionDefault:"bottom"},o)}else if(i.tooltip&&i.x!=null&&i.y!=null){var c=Y_e;c.x=i.x,c.y=i.y,c.update(),Be(c).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:c},o)}else if(s)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:s,tooltipOption:i.tooltipOption},o);else if(i.seriesIndex!=null){if(this._manuallyAxisShowTip(r,n,a,i))return;var h=C$(i,n),f=h.point[0],v=h.point[1];f!=null&&v!=null&&this._tryShow({offsetX:f,offsetY:v,target:h.el,position:i.position,positionDefault:"bottom"},o)}else i.x!=null&&i.y!=null&&(a.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:a.getZr().findHover(i.x,i.y).target},o))}},t.prototype.manuallyHideTip=function(r,n,a,i){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,i.from!==this.uid&&this._hide(Pz(i,a))},t.prototype._manuallyAxisShowTip=function(r,n,a,i){var o=i.seriesIndex,s=i.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=Sp([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.get("trigger")==="axis")return a.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:i.position}),!0}}},t.prototype._tryShow=function(r,n){var a=r.target,i=this._tooltipModel;if(i){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(a){var s=Be(a);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null,this._cbParamsList=null;var l,u;Dc(a,function(c){if(c.tooltipDisabled)return l=u=null,!0;l||u||(Be(c).dataIndex!=null?l=c:Be(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 a=r.get("showDelay");n=be(n,this),clearTimeout(this._showTimout),a>0?this._showTimout=setTimeout(n,a):n()},t.prototype._showAxisTooltip=function(r,n){var a=this._ecModel,i=this._tooltipModel,o=[n.offsetX,n.offsetY],s=Sp([n.tooltipOption],i),l=this._renderMode,u=[],c=Er("section",{blocks:[],noHeader:!0}),h=[],f=new sC;R(r,function(_){R(_.dataByAxis,function(w){var S=a.getComponent(w.axisDim+"Axis",w.axisIndex),C=w.value,M=S.axis,A=M.scale.parse(C);if(!(!S||C==null)){var I=_$(C,M,a,w.seriesDataIndices,w.valueLabelOpt),k=Er("section",{header:I,noHeader:!ka(I),sortBlocks:!0,blocks:[]});c.blocks.push(k),R(w.seriesDataIndices,function(P){var D=a.getSeriesByIndex(P.seriesIndex),z=P.dataIndexInside,j=D.getDataParams(z);if(!(j.dataIndex<0)){j.axisDim=w.axisDim,j.axisIndex=w.axisIndex,j.axisType=w.axisType,j.axisId=w.axisId,j.axisValue=ob(S.axis,{value:A}),j.axisValueLabel=I,j.marker=f.makeTooltipMarker("item",uh(j.color),l);var B=BR(D.formatTooltip(z,!0,null)),H=B.frag;if(H){var V=Sp([D],i).get("valueFormatter");k.blocks.push(V?te({valueFormatter:V},H):H)}B.text&&h.push(B.text),u.push(j)}})}})}),c.blocks.reverse(),h.reverse();var v=n.position,g=s.get("order"),m=WR(c,f,l,g,a.get("useUTC"),s.get("textStyle"));m&&h.unshift(m);var y=l==="richText"?` +*`,"g")),n={series:[]};return R(r,function(a,i){if(g_e(a)){var o=m_e(a),s=t[i],l=s.axisDim+"Axis";s&&(n[l]=n[l]||[],n[l][s.axisIndex]={data:o.categories},n.series=n.series.concat(o.series))}else{var o=y_e(a);n.series.push(o)}}),n}var __e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){setTimeout(function(){n.dispatchAction({type:"hideTip"})});var a=n.getDom(),i=this.model;this._dom&&a.removeChild(this._dom);var o=document.createElement("div");o.style.cssText="position:absolute;top:0;bottom:0;left:0;right:0;padding:5px",o.style.backgroundColor=i.get("backgroundColor")||K.color.neutral00;var s=document.createElement("h4"),l=i.get("lang")||[];s.innerHTML=l[0]||i.get("title"),s.style.cssText="margin:10px 20px",s.style.color=i.get("textColor");var u=document.createElement("div"),c=document.createElement("textarea");u.style.cssText="overflow:auto";var h=i.get("optionToContent"),f=i.get("contentToOption"),v=p_e(r);if(Le(h)){var g=h(n.getOption());ve(g)?u.innerHTML=g:Qc(g)&&u.appendChild(g)}else{c.readOnly=i.get("readOnly");var m=c.style;m.cssText="display:block;width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none;box-sizing:border-box;outline:none",m.color=i.get("textColor"),m.borderColor=i.get("textareaBorderColor"),m.backgroundColor=i.get("textareaColor"),c.value=v.value,u.appendChild(c)}var y=v.meta,x=document.createElement("div");x.style.cssText="position:absolute;bottom:5px;left:0;right:0";var _="float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px",w=document.createElement("div"),S=document.createElement("div");_+=";background-color:"+i.get("buttonColor"),_+=";color:"+i.get("buttonTextColor");var C=this;function M(){a.removeChild(o),C._dom=null}uM(w,"click",M),uM(S,"click",function(){if(f==null&&h!=null||f!=null&&h==null){M();return}var A;try{Le(f)?A=f(u,n.getOption()):A=x_e(c.value,y)}catch(k){throw M(),new Error("Data view format error "+k)}A&&n.dispatchAction({type:"changeDataView",newOption:A}),M()}),w.innerHTML=l[1],S.innerHTML=l[2],S.style.cssText=w.style.cssText=_,!i.get("readOnly")&&x.appendChild(S),x.appendChild(w),o.appendChild(s),o.appendChild(u),o.appendChild(x),u.style.height=a.clientHeight-80+"px",a.appendChild(o),this._dom=o},t.prototype.dispose=function(r,n){this._dom&&n.getDom().removeChild(this._dom)},t.getDefaultOption=function(r){var n={show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:"M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28",title:r.getLocaleModel().get(["toolbox","dataView","title"]),lang:r.getLocaleModel().get(["toolbox","dataView","lang"]),backgroundColor:K.color.background,textColor:K.color.primary,textareaColor:K.color.background,textareaBorderColor:K.color.border,buttonColor:K.color.accent50,buttonTextColor:K.color.neutral00};return n},t}(Eo);function b_e(e,t){return oe(e,function(r,n){var a=t&&t[n];if(Re(a)&&!ae(a)){var i=Re(r)&&!ae(r);i||(r={value:r});var o=a.name!=null&&r.name==null;return r=Ee(r,a),o&&delete r.name,r}else return r})}Xi({type:"changeDataView",event:"dataViewChanged",update:"prepareAndUpdate"},function(e,t){var r=[];R(e.newOption.series,function(n){var a=t.getSeriesByName(n.name)[0];if(!a)r.push(te({type:"scatter"},n));else{var i=a.get("data");r.push({name:n.name,data:b_e(n.data,i)})}}),t.mergeOption(Ee({series:r},e.newOption))});var B$=R,F$=Qe();function w_e(e,t){var r=vP(e);B$(t,function(n,a){for(var i=r.length-1;i>=0;i--){var o=r[i];if(o[a])break}if(i<0){var s=e.queryComponents({mainType:"dataZoom",subType:"select",id:a})[0];if(s){var l=s.getPercentRange();r[0][a]={dataZoomId:a,start:l[0],end:l[1]}}}}),r.push(t)}function S_e(e){var t=vP(e),r=t[t.length-1];t.length>1&&t.pop();var n={};return B$(r,function(a,i){for(var o=t.length-1;o>=0;o--)if(a=t[o][i],a){n[i]=a;break}}),n}function C_e(e){F$(e).snapshots=null}function T_e(e){return vP(e).length}function vP(e){var t=F$(e);return t.snapshots||(t.snapshots=[{}]),t.snapshots}var M_e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(r,n){C_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}(Eo);Xi({type:"restore",event:"restore",update:"prepareAndUpdate"},function(e,t){t.resetOption("recreate")});var A_e=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],pP=function(){function e(t,r,n){var a=this;this._targetInfoList=[];var i=wz(r,t);R(N_e,function(o,s){(!n||!n.include||Ye(n.include,s)>=0)&&o(i,a._targetInfoList)})}return e.prototype.setOutputRanges=function(t,r){return this.matchOutputRanges(t,r,function(n,a,i){if((n.coordRanges||(n.coordRanges=[])).push(a),!n.coordRange){n.coordRange=a;var o=I2[n.brushType](0,i,a);n.__rangeOffset={offset:Mz[n.brushType](o.values,n.range,[1,1]),xyMinMax:o.xyMinMax}}}),t},e.prototype.matchOutputRanges=function(t,r,n){R(t,function(a){var i=this.findTargetInfo(a,r);i&&i!==!0&&R(i.coordSyses,function(o){var s=I2[a.brushType](1,o,a.range,!0);n(a,s.values,o,r)})},this)},e.prototype.setInputRanges=function(t,r){R(t,function(n){var a=this.findTargetInfo(n,r);if(n.range=n.range||[],a&&a!==!0){n.panelId=a.panelId;var i=I2[n.brushType](0,a.coordSys,n.coordRange),o=n.__rangeOffset;n.range=o?Mz[n.brushType](i.values,o.offset,k_e(i.xyMinMax,o.xyMinMax)):i.values}},this)},e.prototype.makePanelOpts=function(t,r){return oe(this._targetInfoList,function(n){var a=n.getPanelRect();return{panelId:n.panelId,defaultBrushType:r?r(n):null,clipPath:$9(a),isTargetByCursor:Y9(a,t,n.coordSysModel),getLinearBrushOtherExtent:Z9(a)}})},e.prototype.controlSeries=function(t,r,n){var a=this.findTargetInfo(t,n);return a===!0||a&&Ye(a.coordSyses,r.coordinateSystem)>=0},e.prototype.findTargetInfo=function(t,r){for(var n=this._targetInfoList,a=wz(r,t),i=0;ie[1]&&e.reverse(),e}function wz(e,t){return ff(e,t,{includeMainTypes:A_e})}var N_e={grid:function(e,t){var r=e.xAxisModels,n=e.yAxisModels,a=e.gridModels,i=we(),o={},s={};!r&&!n&&!a||(R(r,function(l){var u=l.axis.grid.model;i.set(u.id,u),o[u.id]=!0}),R(n,function(l){var u=l.axis.grid.model;i.set(u.id,u),s[u.id]=!0}),R(a,function(l){i.set(l.id,l),o[l.id]=!0,s[l.id]=!0}),i.each(function(l){var u=l.coordinateSystem,c=[];R(u.getCartesians(),function(h,f){(Ye(r,h.getAxis("x").model)>=0||Ye(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:Cz.grid,xAxisDeclared:o[l.id],yAxisDeclared:s[l.id]})}))},geo:function(e,t){R(e.geoModels,function(r){var n=r.coordinateSystem;t.push({panelId:"geo--"+r.id,geoModel:r,coordSysModel:r,coordSys:n,coordSyses:[n],getPanelRect:Cz.geo})})}},Sz=[function(e,t){var r=e.xAxisModel,n=e.yAxisModel,a=e.gridModel;return!a&&r&&(a=r.axis.grid.model),!a&&n&&(a=n.axis.grid.model),a&&a===t.gridModel},function(e,t){var r=e.geoModel;return r&&r===t.geoModel}],Cz={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var e=this.coordSys.view,t=W8(null,e);return fG(t,t,_b(null,e)),t}},I2={lineX:nt(Tz,0),lineY:nt(Tz,1),rect:function(e,t,r,n){var a=e?t.pointToData([r[0][0],r[1][0]],n):t.dataToPoint([r[0][0],r[1][0]],n),i=e?t.pointToData([r[0][1],r[1][1]],n):t.dataToPoint([r[0][1],r[1][1]],n),o=[rN([a[0],i[0]]),rN([a[1],i[1]])];return{values:o,xyMinMax:o}},polygon:function(e,t,r,n){var a=[gn(),gn()],i=oe(r,function(o){var s=e?t.pointToData(o,n):t.dataToPoint(o,n);return a[0][0]=Math.min(a[0][0],s[0]),a[1][0]=Math.min(a[1][0],s[1]),a[0][1]=Math.max(a[0][1],s[0]),a[1][1]=Math.max(a[1][1],s[1]),s});return{values:i,xyMinMax:a}}};function Tz(e,t,r,n){var a=r.getAxis(["x","y"][e]),i=rN(oe([0,1],function(s){return t?a.coordToData(a.toLocalCoord(n[s]),!0):a.toGlobalCoord(a.dataToCoord(n[s]))})),o=[];return o[e]=i,o[1-e]=[NaN,NaN],{values:i,xyMinMax:o}}var Mz={lineX:nt(Az,0),lineY:nt(Az,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 oe(e,function(n,a){return[n[0]-r[0]*t[a][0],n[1]-r[1]*t[a][1]]})}};function Az(e,t,r,n){return[t[0]-n[e]*r[0],t[1]-n[e]*r[1]]}function k_e(e,t){var r=Nz(e),n=Nz(t),a=[r[0]/n[0],r[1]/n[1]];return isNaN(a[0])&&(a[0]=1),isNaN(a[1])&&(a[1]=1),a}function Nz(e){return e?[e[0][1]-e[0][0],e[1][1]-e[1][0]]:[NaN,NaN]}var nN=R,L_e=jte("toolbox-dataZoom_"),I_e={x:"width",y:"height"},P_e=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a,i){this._brushController||(this._brushController=new zI(a.getZr()),this._brushController.on("brush",be(this._onBrush,this)).mount()),E_e(r,n,this,i,a),j_e(r,n)},t.prototype.onclick=function(r,n,a){D_e[a].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 a={},i=this.ecModel;this._brushController.updateCovers([]);var o=new pP(gP(this.model),i,{include:["grid"]});o.matchOutputRanges(n,i,function(u,c,h){if(h.type==="cartesian2d"){var f=h.master.getRect().clone(),v=u.brushType;v==="rect"?(s("x",h,f,c[0]),s("y",h,f,c[1])):s({lineX:"x",lineY:"y"}[v],h,f,c)}}),w_e(i,a),this._dispatchZoomAction(a);function s(u,c,h,f){var v=c.getAxis(u),g=v.model,m=l(u,g,i),y=m.findRepresentativeAxisProxy(g).getMinMaxSpan(),x=v.scale.getExtent();(y.minValueSpan!=null||y.maxValueSpan!=null)&&(f=uu(0,f.slice(),x,0,y.minValueSpan,y.maxValueSpan));var _=Ok(x,h[I_e[u]],.5);m&&(a[m.id]={dataZoomId:m.id,startValue:isFinite(_)?Mt(f[0],_):f[0],endValue:isFinite(_)?Mt(f[1],_):f[1]})}function l(u,c,h){var f;return h.eachComponent({mainType:"dataZoom",subType:"select"},function(v){var g=v.getAxisModel(u,c.componentIndex);g&&(f=v)}),f}},t.prototype._dispatchZoomAction=function(r){var n=[];nN(r,function(a,i){n.push(ke(a))}),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}(Eo),D_e={zoom:function(){var e=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:e})},back:function(){this._dispatchZoomAction(S_e(this.ecModel))}};function gP(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 j_e(e,t){e.setIconStatus("back",T_e(t)>1?"emphasis":"normal")}function E_e(e,t,r,n,a){var i=r._isZoomActive;n&&n.type==="takeGlobalCursor"&&(i=n.key==="dataZoomSelect"?n.dataZoomSelectActive:!1),r._isZoomActive=i,e.setIconStatus("zoom",i?"emphasis":"normal");var o=new pP(gP(e),t,{include:["grid"]}),s=o.makePanelOpts(a,function(l){return l.xAxisDeclared&&!l.yAxisDeclared?"lineX":!l.xAxisDeclared&&l.yAxisDeclared?"lineY":"rect"});r._brushController.setPanels(s).enableBrush(i&&s.length?{brushType:"auto",brushStyle:e.getModel("brushStyle").getItemStyle()}:!1)}wae("dataZoom",function(e){var t=e.getComponent("toolbox",0),r=["feature","dataZoom"];if(!t||t.get(r)==null)return;var n=t.getModel(r),a=[],i=gP(n),o=ff(e,i);nN(o.xAxisModels,function(l){return s(l,"xAxis","xAxisIndex")}),nN(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:L_e+u+h};f[c]=h,a.push(f)}return a});function R_e(e){e.registerComponentModel(o_e),e.registerComponentView(s_e),Rd("saveAsImage",u_e),Rd("magicType",h_e),Rd("dataView",__e),Rd("dataZoom",P_e),Rd("restore",M_e),rt(i_e)}var O_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}(ht);function V$(e){var t=e.get("confine");return t!=null?!!t:e.get("renderMode")==="richText"}function G$(e){if(xt.domSupported){for(var t=document.documentElement.style,r=0,n=e.length;r-1?(s+="top:50%",l+="translateY(-50%) rotate("+(u=i==="left"?-225:-45)+"deg)"):(s+="left:50%",l+="translateX(-50%) rotate("+(u=i==="top"?225:45)+"deg)");var c=u*Math.PI/180,h=o+a,f=h*Math.abs(Math.cos(c))+h*Math.abs(Math.sin(c)),v=Math.round(((f-Math.SQRT2*a)/2+Math.SQRT2*a-(f-h)/2)*100)/100;s+=";"+i+":-"+v+"px";var g=t+" solid "+a+"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 U_e(e,t,r){var n="cubic-bezier(0.23,1,0.32,1)",a="",i="";return r&&(a=" "+e/2+"s "+n,i="opacity"+a+",visibility"+a),t||(a=" "+e+"s "+n,i+=(i.length?",":"")+(xt.transformSupported?""+mP+a:",left"+a+",top"+a)),F_e+":"+i}function kz(e,t,r){var n=e.toFixed(0)+"px",a=t.toFixed(0)+"px";if(!xt.transformSupported)return r?"top:"+a+";left:"+n+";":[["top",a],["left",n]];var i=xt.transform3dSupported,o="translate"+(i?"3d":"")+"("+n+","+a+(i?",0":"")+")";return r?"top:0;left:0;"+mP+":"+o+";":[["top",0],["left",0],[H$,o]]}function W_e(e){var t=[],r=e.get("fontSize"),n=e.getTextColor();n&&t.push("color:"+n),t.push("font:"+e.getFont());var a=Te(e.get("lineHeight"),Math.round(r*3/2));r&&t.push("line-height:"+a+"px");var i=e.get("textShadowColor"),o=e.get("textShadowBlur")||0,s=e.get("textShadowOffsetX")||0,l=e.get("textShadowOffsetY")||0;return i&&o&&t.push("text-shadow:"+s+"px "+l+"px "+o+"px "+i),R(["decoration","align"],function(u){var c=e.get(u);c&&t.push("text-"+u+":"+c)}),t.join(";")}function $_e(e,t,r,n){var a=[],i=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=QH(e,"html"),v=u+"px "+c+"px "+s+"px "+l;return a.push("box-shadow:"+v),t&&i>0&&a.push(U_e(i,r,n)),o&&a.push("background-color:"+o),R(["width","color","radius"],function(g){var m="border-"+g,y=wL(m),x=e.get(y);x!=null&&a.push(m+":"+x+(g==="color"?"":"px"))}),a.push(W_e(h)),f!=null&&a.push("padding:"+mv(f).join("px ")+"px"),a.join(";")+";"}function Lz(e,t,r,n,a){var i=t&&t.painter;if(r){var o=i&&i.getViewportRoot();o&&YQ(e,o,r,n,a)}else{e[0]=n,e[1]=a;var s=i&&i.getViewportRootOffset();s&&(e[0]+=s.offsetLeft,e[1]+=s.offsetTop)}e[2]=e[0]/t.getWidth(),e[3]=e[1]/t.getHeight()}var Z_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,xt.wxa)return null;var n=document.createElement("div");n.domBelongToZr=!0,this.el=n;var a=this._zr=t.getZr(),i=r.appendTo,o=i&&(ve(i)?document.querySelector(i):Qc(i)?i:Le(i)&&i(t.getDom()));Lz(this._styleCoord,a,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=a.handler,c=a.painter.getViewportRoot();Ja(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=B_e(r,"position"),a=r.style;a.position!=="absolute"&&n!=="absolute"&&(a.position="relative")}var i=t.get("alwaysShowContent");i&&this._moveIfResized(),this._alwaysShowContent=i,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,a=n.style,i=this._styleCoord;n.innerHTML?a.cssText=V_e+$_e(t,!this._firstShow,this._longHide,this._enableDisplayTransition)+kz(i[0],i[1],!0)+("border-color:"+uh(r)+";")+(t.get("extraCssText")||"")+(";pointer-events:"+(this._enterable?"auto":"none")):a.display="none",this._show=!0,this._firstShow=!1,this._longHide=!1},e.prototype.setContent=function(t,r,n,a,i){var o=this.el;if(t==null){o.innerHTML="";return}var s="";if(ve(i)&&n.get("trigger")==="item"&&!V$(n)&&(s=H_e(n,a,i)),ve(t))o.innerHTML=t+s;else if(t){o.innerHTML="",ae(t)||(t=[t]);for(var l=0;l=0?this._tryShow(i,o):a==="leave"&&this._hide(o))},this))},t.prototype._keepShow=function(){var r=this._tooltipModel,n=this._ecModel,a=this._api,i=r.get("triggerOn");if(r.get("trigger")!=="axis"&&(this._lastDataByCoordSys=null,this._cbParamsList=null),this._lastX!=null&&this._lastY!=null&&i!=="none"&&i!=="click"){var o=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){!a.isDisposed()&&o.manuallyShowTip(r,n,a,{x:o._lastX,y:o._lastY,dataByCoordSys:o._lastDataByCoordSys})})}},t.prototype.manuallyShowTip=function(r,n,a,i){if(!(i.from===this.uid||xt.node||!a.getDom())){var o=Dz(i,a);this._ticket="";var s=i.dataByCoordSys,l=ebe(i,n,a);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:i.position,positionDefault:"bottom"},o)}else if(i.tooltip&&i.x!=null&&i.y!=null){var c=X_e;c.x=i.x,c.y=i.y,c.update(),Be(c).tooltipConfig={name:null,option:i.tooltip},this._tryShow({offsetX:i.x,offsetY:i.y,target:c},o)}else if(s)this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,dataByCoordSys:s,tooltipOption:i.tooltipOption},o);else if(i.seriesIndex!=null){if(this._manuallyAxisShowTip(r,n,a,i))return;var h=T$(i,n),f=h.point[0],v=h.point[1];f!=null&&v!=null&&this._tryShow({offsetX:f,offsetY:v,target:h.el,position:i.position,positionDefault:"bottom"},o)}else i.x!=null&&i.y!=null&&(a.dispatchAction({type:"updateAxisPointer",x:i.x,y:i.y}),this._tryShow({offsetX:i.x,offsetY:i.y,position:i.position,target:a.getZr().findHover(i.x,i.y).target},o))}},t.prototype.manuallyHideTip=function(r,n,a,i){var o=this._tooltipContent;this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,this._cbParamsList=null,i.from!==this.uid&&this._hide(Dz(i,a))},t.prototype._manuallyAxisShowTip=function(r,n,a,i){var o=i.seriesIndex,s=i.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=Sp([c.getItemModel(s),u,(u.coordinateSystem||{}).model],this._tooltipModel);if(h.get("trigger")==="axis")return a.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:s,position:i.position}),!0}}},t.prototype._tryShow=function(r,n){var a=r.target,i=this._tooltipModel;if(i){this._lastX=r.offsetX,this._lastY=r.offsetY;var o=r.dataByCoordSys;if(o&&o.length)this._showAxisTooltip(o,r);else if(a){var s=Be(a);if(s.ssrType==="legend")return;this._lastDataByCoordSys=null,this._cbParamsList=null;var l,u;Dc(a,function(c){if(c.tooltipDisabled)return l=u=null,!0;l||u||(Be(c).dataIndex!=null?l=c:Be(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 a=r.get("showDelay");n=be(n,this),clearTimeout(this._showTimout),a>0?this._showTimout=setTimeout(n,a):n()},t.prototype._showAxisTooltip=function(r,n){var a=this._ecModel,i=this._tooltipModel,o=[n.offsetX,n.offsetY],s=Sp([n.tooltipOption],i),l=this._renderMode,u=[],c=Er("section",{blocks:[],noHeader:!0}),h=[],f=new sC;R(r,function(_){R(_.dataByAxis,function(w){var S=a.getComponent(w.axisDim+"Axis",w.axisIndex),C=w.value,M=S.axis,A=M.scale.parse(C);if(!(!S||C==null)){var k=b$(C,M,a,w.seriesDataIndices,w.valueLabelOpt),I=Er("section",{header:k,noHeader:!La(k),sortBlocks:!0,blocks:[]});c.blocks.push(I),R(w.seriesDataIndices,function(P){var j=a.getSeriesByIndex(P.seriesIndex),z=P.dataIndexInside,D=j.getDataParams(z);if(!(D.dataIndex<0)){D.axisDim=w.axisDim,D.axisIndex=w.axisIndex,D.axisType=w.axisType,D.axisId=w.axisId,D.axisValue=ob(S.axis,{value:A}),D.axisValueLabel=k,D.marker=f.makeTooltipMarker("item",uh(D.color),l);var B=FR(j.formatTooltip(z,!0,null)),H=B.frag;if(H){var V=Sp([j],i).get("valueFormatter");I.blocks.push(V?te({valueFormatter:V},H):H)}B.text&&h.push(B.text),u.push(D)}})}})}),c.blocks.reverse(),h.reverse();var v=n.position,g=s.get("order"),m=$R(c,f,l,g,a.get("useUTC"),s.get("textStyle"));m&&h.unshift(m);var y=l==="richText"?` -`:"
",x=h.join(y);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,u)?this._updatePosition(s,v,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,x,u,Math.random()+"",o[0],o[1],v,null,f)})},t.prototype._showSeriesItemTooltip=function(r,n,a){var i=this._ecModel,o=Be(n),s=o.seriesIndex,l=i.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,h=o.dataType,f=u.getData(h),v=this._renderMode,g=r.positionDefault,m=Sp([f.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,g?{position:g}:null),y=m.get("trigger");if(!(y!=null&&y!=="item")){var x=u.getDataParams(c,h),_=new sC;x.marker=_.makeTooltipMarker("item",uh(x.color),v);var w=BR(u.formatTooltip(c,!1,h)),S=m.get("order"),C=m.get("valueFormatter"),M=w.frag,A=M?WR(C?te({valueFormatter:C},M):M,_,v,S,i.get("useUTC"),m.get("textStyle")):w.text,I="item_"+u.name+"_"+c;this._showOrMove(m,function(){this._showTooltipContent(m,A,x,I,r.offsetX,r.offsetY,r.position,r.target,_)}),a({type:"showTip",dataIndexInside:c,dataIndex:f.getRawIndex(c),seriesIndex:s,from:this.uid})}},t.prototype._showComponentItemTooltip=function(r,n,a){var i=this._renderMode==="html",o=Be(n),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(ve(l)){var c=l;l={content:c,formatter:c},u=!0}u&&i&&l.content&&(l=ke(l),l.content=Rn(l.content));var h=[l],f=this._ecModel.getComponent(o.componentMainType,o.componentIndex);f&&h.push(f),h.push({formatter:l.content});var v=r.positionDefault,g=Sp(h,this._tooltipModel,v?{position:v}:null),m=g.get("content"),y=Math.random()+"",x=new sC;this._showOrMove(g,function(){var _=ke(g.get("formatterParams")||{});this._showTooltipContent(g,m,_,y,r.offsetX,r.offsetY,r.position,n,x)}),a({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(r,n,a,i,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 v=n,g=this._getNearestPoint([o,s],a,r.get("trigger"),r.get("borderColor"),r.get("defaultBorderColor",!0)),m=g.color;if(f)if(ve(f)){var y=r.ecModel.get("useUTC"),x=ae(a)?a[0]:a,_=x&&x.axisType&&x.axisType.indexOf("time")>=0;v=f,_&&(v=Zm(x.axisValue,v,y)),v=wL(v,a,!0)}else if(Le(f)){var w=be(function(S,C){S===this._ticket&&(h.setContent(C,c,r,m,l),this._updatePosition(r,l,o,s,h,a,u))},this);this._ticket=i,v=f(a,i,w)}else v=f;h.setContent(v,c,r,m,l),h.show(r,m),this._updatePosition(r,l,o,s,h,a,u)}},t.prototype._getNearestPoint=function(r,n,a,i,o){if(a==="axis"||ae(n))return{color:i||o};if(!ae(n))return{color:i||n.color||n.borderColor}},t.prototype._updatePosition=function(r,n,a,i,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"),v=r.get("verticalAlign"),g=l&&l.getBoundingRect().clone();if(l&&g.applyTransform(l.transform),Le(n)&&(n=n([a,i],s,o.el,g,{viewSize:[u,c],contentSize:h.slice()})),ae(n))a=me(n[0],u),i=me(n[1],c);else if(Re(n)){var m=n;m.width=h[0],m.height=h[1];var y=tr(m,{width:u,height:c});a=y.x,i=y.y,f=null,v=null}else if(ve(n)&&l){var x=J_e(n,g,h,r.get("borderWidth"));a=x[0],i=x[1]}else{var x=q_e(a,i,o,u,c,f?null:20,v?null:20);a=x[0],i=x[1]}if(f&&(a-=Dz(f)?h[0]/2:f==="right"?h[0]:0),v&&(i-=Dz(v)?h[1]/2:v==="bottom"?h[1]:0),F$(r)){var x=K_e(a,i,o,u,c);a=x[0],i=x[1]}o.moveTo(a,i)},t.prototype._updateContentNotChangedOnAxis=function(r,n){var a=this._lastDataByCoordSys,i=this._cbParamsList,o=!!a&&a.length===r.length;return o&&R(a,function(s,l){var u=s.dataByAxis||[],c=r[l]||{},h=c.dataByAxis||[];o=o&&u.length===h.length,o&&R(u,function(f,v){var g=h[v]||{},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&&R(m,function(x,_){var w=y[_];o=o&&x.seriesIndex===w.seriesIndex&&x.dataIndex===w.dataIndex}),i&&R(f.seriesDataIndices,function(x){var _=x.seriesIndex,w=n[_],S=i[_];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){xt.node||!n.getDom()||(rm(this,"_updatePosition"),this._tooltipContent.dispose(),XA("itemTooltip",n),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type="tooltip",t}(Yt);function Sp(e,t,r){var n=t.ecModel,a;r?(a=new vt(r,n,n),a=new vt(t.option,a,n)):a=t;for(var i=e.length-1;i>=0;i--){var o=e[i];o&&(o instanceof vt&&(o=o.get("tooltip",!0)),ve(o)&&(o={formatter:o}),o&&(a=new vt(o,a,n)))}return a}function Pz(e,t){return e.dispatchAction||be(t.dispatchAction,t)}function q_e(e,t,r,n,a,i,o){var s=r.getSize(),l=s[0],u=s[1];return i!=null&&(e+l+i+2>n?e-=l+i:e+=i),o!=null&&(t+u+o>a?t-=u+o:t+=o),[e,t]}function K_e(e,t,r,n,a){var i=r.getSize(),o=i[0],s=i[1];return e=Math.min(e+o,n)-o,t=Math.min(t+s,a)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function J_e(e,t,r,n){var a=r[0],i=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-a/2,l=t.y+c/2-i/2;break;case"top":s=t.x+u/2-a/2,l=t.y-i-o;break;case"bottom":s=t.x+u/2-a/2,l=t.y+c+o;break;case"left":s=t.x-a-o,l=t.y+c/2-i/2;break;case"right":s=t.x+u+o,l=t.y+c/2-i/2}return[s,l]}function Dz(e){return e==="center"||e==="middle"}function Q_e(e,t,r){var n=Gk(e).queryOptionMap,a=n.keys()[0];if(!(!a||a==="series")){var i=sv(t,a,n.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=i.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=Be(u).tooltipConfig;if(c&&c.name===e.name)return l=u,!0}),l)return{componentMainType:a,componentIndex:o.componentIndex,el:l}}}}function ebe(e){rt(iy),e.registerComponentModel(R_e),e.registerComponentView(X_e),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},hr),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},hr)}var tbe=["rect","polygon","keep","clear"];function rbe(e,t){var r=Zt(e?e.brush:[]);if(r.length){var n=[];R(r,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(n=n.concat(u))});var a=e&&e.toolbox;ae(a)&&(a=a[0]),a||(a={feature:{}},e.toolbox=[a]);var i=a.feature||(a.feature={}),o=i.brush||(i.brush={}),s=o.type||(o.type=[]);s.push.apply(s,n),N1(s,function(l){return l+""},null),t&&!s.length&&s.push.apply(s,tbe)}}var jz=R;function Ez(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function aN(e,t,r){var n={};return jz(t,function(i){var o=n[i]=a();jz(e[i],function(s,l){if(Kr.isValidType(l)){var u={type:l,visual:s};r&&r(u,i),o[l]=new Kr(u),l==="opacity"&&(u=ke(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new Kr(u))}})}),n;function a(){var i=function(){};i.prototype.__hidden=i.prototype;var o=new i;return o}}function U$(e,t,r){var n;R(r,function(a){t.hasOwnProperty(a)&&Ez(t[a])&&(n=!0)}),n&&R(r,function(a){t.hasOwnProperty(a)&&Ez(t[a])?e[a]=ke(t[a]):delete e[a]})}function nbe(e,t,r,n,a,i){var o={};R(e,function(h){var f=Kr.prepareVisualTypes(t[h]);o[h]=f});var s;function l(h){return PL(r,s,h)}function u(h,f){lU(r,s,h,f)}r.each(c);function c(h,f){s=h;var v=r.getRawDataItem(s);if(!(v&&v.visualMap===!1))for(var g=n.call(a,h),m=t[g],y=o[g],x=0,_=y.length;x<_;x++){var w=y[x];m[w]&&m[w].applyVisual(h,l,u)}}}function abe(e,t,r,n){var a={};return R(e,function(i){var o=Kr.prepareVisualTypes(t[i]);a[i]=o}),{progress:function(o,s){var l;n!=null&&(l=s.getDimensionIndex(n));function u(C){return PL(s,h,C)}function c(C,M){lU(s,h,C,M)}for(var h,f=s.getStore();(h=o.next())!=null;){var v=s.getRawDataItem(h);if(!(v&&v.visualMap===!1))for(var g=n!=null?f.get(l,h):h,m=r(g),y=t[m],x=a[m],_=0,w=x.length;_t[0][1]&&(t[0][1]=i[0]),i[1]t[1][1]&&(t[1][1]=i[1])}return t&&Fz(t)}};function Fz(e){return new je(e[0][0],e[1][0],e[0][1]-e[0][0],e[1][1]-e[1][0])}var dbe=function(e){X(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 OI(n.getZr())).on("brush",be(this._onBrush,this)).mount()},t.prototype.render=function(r,n,a,i){this.model=r,this._updateController(r,n,a,i)},t.prototype.updateTransform=function(r,n,a,i){W$(n),this._updateController(r,n,a,i)},t.prototype.updateVisual=function(r,n,a,i){this.updateTransform(r,n,a,i)},t.prototype.updateView=function(r,n,a,i){this._updateController(r,n,a,i)},t.prototype._updateController=function(r,n,a,i){(!i||i.$from!==r.id)&&this._brushController.setPanels(r.brushTargetManager.makePanelOpts(a)).enableBrush(r.brushOption).updateCovers(r.areas.slice())},t.prototype.dispose=function(){this._brushController.dispose()},t.prototype._onBrush=function(r){var n=this.model.id,a=this.model.brushTargetManager.setOutputRanges(r.areas,this.ecModel);(!r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:ke(a),$from:n}),r.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:n,areas:ke(a),$from:n})},t.type="brush",t}(Yt),fbe=function(e){X(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 a=this.option;!n&&U$(a,r,["inBrush","outOfBrush"]);var i=a.inBrush=a.inBrush||{};a.outOfBrush=a.outOfBrush||{color:this.option.defaultOutOfBrushColor},i.hasOwnProperty("liftZ")||(i.liftZ=5)},t.prototype.setAreas=function(r){r&&(this.areas=oe(r,function(n){return Vz(this.option,n)},this))},t.prototype.setBrushOption=function(r){this.brushOption=Vz(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}(ht);function Vz(e,t){return Je({brushType:e.brushType,brushMode:e.brushMode,transformable:e.transformable,brushStyle:new vt(e.brushStyle).getItemStyle(),removeOnClick:e.removeOnClick,z:e.z},t,!0)}var vbe=["rect","polygon","lineX","lineY","keep","clear"],pbe=function(e){X(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a){var i,o,s;n.eachComponent({mainType:"brush"},function(l){i=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=i,this._brushMode=o,R(r.get("type",!0),function(l){r.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===i)?"emphasis":"normal")})},t.prototype.updateView=function(r,n,a){this.render(r,n,a)},t.prototype.getIcons=function(){var r=this.model,n=r.get("icon",!0),a={};return R(r.get("type",!0),function(i){n[i]&&(a[i]=n[i])}),a},t.prototype.onclick=function(r,n,a){var i=this._brushType,o=this._brushMode;a==="clear"?(n.dispatchAction({type:"axisAreaSelect",intervals:[]}),n.dispatchAction({type:"brush",command:"clear",areas:[]})):n.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:a==="keep"?i:i===a?!1:a,brushMode:a==="keep"?o==="multiple"?"single":"multiple":o}})},t.getDefaultOption=function(r){var n={show:!0,type:vbe.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}(Eo);function gbe(e){e.registerComponentView(dbe),e.registerComponentModel(fbe),e.registerPreprocessor(rbe),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,obe),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"},hr),e.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},hr),Rd("brush",pbe)}var mbe=function(e){X(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}(ht),ybe=function(e){X(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,a){if(this.group.removeAll(),!!r.get("show")){var i=this.group,o=r.getModel("textStyle"),s=r.getModel("subtextStyle"),l=r.get("textAlign"),u=Te(r.get("textBaseline"),r.get("textVerticalAlign")),c=new wt({style:$t(o,{text:r.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),h=c.getBoundingRect(),f=r.get("subtext"),v=new wt({style:$t(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,v.silent=!m&&!y,g&&c.on("click",function(){Z_(g,"_"+r.get("target"))}),m&&v.on("click",function(){Z_(m,"_"+r.get("subtarget"))}),Be(c).eventData=Be(v).eventData=y?{componentType:"title",componentIndex:r.componentIndex}:null,i.add(c),f&&i.add(v);var x=i.getBoundingRect(),_=r.getBoxLayoutParams();_.width=x.width,_.height=x.height;var w=Ur(r,a),S=tr(_,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"),i.x=S.x,i.y=S.y,i.markRedraw();var C={align:l,verticalAlign:u};c.setStyle(C),v.setStyle(C),x=i.getBoundingRect();var M=S.margin,A=r.getItemStyle(["color","opacity"]);A.fill=r.get("backgroundColor");var I=new it({shape:{x:x.x-M[3],y:x.y-M[0],width:x.width+M[1]+M[3],height:x.height+M[0]+M[2],r:r.get("borderRadius")},style:A,subPixelOptimize:!0,silent:!0});i.add(I)}},t.type="title",t}(Yt);function xbe(e){e.registerComponentModel(mbe),e.registerComponentView(ybe)}var Gz=function(e){X(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,a){this.mergeDefaultAndTheme(r,a),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||[],a=r.axisType,i=this._names=[],o;a==="category"?(o=[],R(n,function(u,c){var h=Fr(ov(u),""),f;Re(u)?(f=ke(u),f.value=c):f=c,o.push(f),i.push(h)})):o=n;var s={category:"ordinal",time:"time",value:"number"}[a]||"number",l=this._data=new Bn([{name:"value",type:s}],this);l.initData(o,i)},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}(ht),$$=function(e){X(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=Cu(Gz.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}(Gz);kr($$,H1.prototype);var _be=function(e){X(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=t.type,r}return t.type="timeline",t}(Yt),bbe=function(e){X(t,e);function t(r,n,a,i){var o=e.call(this,r,n,a)||this;return o.type=i||"value",o}return t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},t}(Si),D2=Math.PI,Hz=Qe(),wbe=function(e){X(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,a){if(this.model=r,this.api=a,this.ecModel=n,this.group.removeAll(),r.get("show",!0)){var i=this._layout(r,a),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(i,r);r.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return Er("nameValue",{noName:!0,value:c})},R(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](i,o,l,r)},this),this._renderAxisLabel(i,s,l,r),this._position(i,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 a=r.get(["label","position"]),i=r.get("orient"),o=Sbe(r,n),s;a==null||a==="auto"?s=i==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:D2/2},h=i==="vertical"?o.height:o.width,f=r.getModel("controlStyle"),v=f.get("show",!0),g=v?f.get("itemSize"):0,m=v?f.get("itemGap"):0,y=g+m,x=r.get(["label","rotate"])||0;x=x*D2/180;var _,w,S,C=f.get("position",!0),M=v&&f.get("showPlayBtn",!0),A=v&&f.get("showPrevBtn",!0),I=v&&f.get("showNextBtn",!0),k=0,P=h;C==="left"||C==="bottom"?(M&&(_=[0,0],k+=y),A&&(w=[k,0],k+=y),I&&(S=[P-g,0],P-=y)):(M&&(_=[P-g,0],P-=y),A&&(w=[0,0],k+=y),I&&(S=[P-g,0],P-=y));var D=[k,P];return r.get("inverse")&&D.reverse(),{viewRect:o,mainLength:h,orient:i,rotation:c[i],labelRotation:x,labelPosOpt:s,labelAlign:r.get(["label","align"])||l[i],labelBaseline:r.get(["label","verticalAlign"])||r.get(["label","baseline"])||u[i],playPosition:_,prevBtnPosition:w,nextBtnPosition:S,axisExtent:D,controlSize:g,controlGap:m}},t.prototype._position=function(r,n){var a=this._mainGroup,i=this._labelGroup,o=r.viewRect;if(r.orient==="vertical"){var s=ar(),l=o.x,u=o.y+o.height;Hi(s,s,[-l,-u]),Js(s,s,-D2/2),Hi(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=_(o),h=_(a.getBoundingRect()),f=_(i.getBoundingRect()),v=[a.x,a.y],g=[i.x,i.y];g[0]=v[0]=c[0][0];var m=r.labelPosOpt;if(m==null||ve(m)){var y=m==="+"?0:1;w(v,h,c,1,y),w(g,f,c,1,1-y)}else{var y=m>=0?0:1;w(v,h,c,1,y),g[1]=v[1]+m}a.setPosition(v),i.setPosition(g),a.rotation=i.rotation=r.rotation,x(a),x(i);function x(S){S.originX=c[0][0]-S.x,S.originY=c[1][0]-S.y}function _(S){return[[S.x,S.x+S.width],[S.y,S.y+S.height]]}function w(S,C,M,A,I){S[A]+=M[A][I]-C[A][I]}},t.prototype._createAxis=function(r,n){var a=n.getData(),i=n.get("axisType")||n.get("type");i!=="category"&&i!=="time"&&(i="value");var o=Sv(n,i,!1);o.getTicks=function(){return a.mapArray(["value"],function(u){return{value:u}})};var s=a.getDataExtent("value");o.setExtent(s[0],s[1]),hW(o,{fixMinMax:[!0,!0]});var l=new bbe("value",o,r.axisExtent,i);return l.model=n,l},t.prototype._createGroup=function(r){var n=this[r]=new De;return this.group.add(n),n},t.prototype._renderAxisLine=function(r,n,a,i){var o=a.getExtent();if(i.get(["lineStyle","show"])){var s=new Tr({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:te({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});n.add(s);var l=this._progressLine=new Tr({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:Ee({lineCap:"round",lineWidth:s.style.lineWidth},i.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});n.add(l)}},t.prototype._renderAxisTick=function(r,n,a,i){var o=this,s=i.getData(),l=a.scale.getTicks();this._tickSymbols=[],R(l,function(u){var c=a.dataToCoord(u.value),h=s.getItemModel(u.value),f=h.getModel("itemStyle"),v=h.getModel(["emphasis","itemStyle"]),g=h.getModel(["progress","itemStyle"]),m={x:c,y:0,onclick:be(o._changeTimeline,o,u.value)},y=Uz(h,f,n,m);y.ensureState("emphasis").style=v.getItemStyle(),y.ensureState("progress").style=g.getItemStyle(),ql(y);var x=Be(y);h.get("tooltip")?(x.dataIndex=u.value,x.dataModel=i):x.dataIndex=x.dataModel=null,o._tickSymbols.push(y)})},t.prototype._renderAxisLabel=function(r,n,a,i){var o=this,s=a.getLabelModel();if(s.get("show")){var l=i.getData(),u=a.getViewLabels();this._tickLabels=[],R(u,function(c){if(!c.tick.offInterval){var h=c.tick.value,f=l.getItemModel(h),v=f.getModel("label"),g=f.getModel(["emphasis","label"]),m=f.getModel(["progress","label"]),y=a.dataToCoord(h),x=new wt({x:y,y:0,rotation:r.labelRotation-r.rotation,onclick:be(o._changeTimeline,o,h),silent:!1,style:$t(v,{text:c.formattedLabel,align:r.labelAlign,verticalAlign:r.labelBaseline})});x.ensureState("emphasis").style=$t(g),x.ensureState("progress").style=$t(m),n.add(x),ql(x),Hz(x).dataIndex=h,o._tickLabels.push(x)}})}},t.prototype._renderControl=function(r,n,a,i){var o=r.controlSize,s=r.rotation,l=i.getModel("controlStyle").getItemStyle(),u=i.getModel(["emphasis","controlStyle"]).getItemStyle(),c=i.getPlayState(),h=i.get("inverse",!0);f(r.nextBtnPosition,"next",be(this._changeTimeline,this,h?"-":"+")),f(r.prevBtnPosition,"prev",be(this._changeTimeline,this,h?"+":"-")),f(r.playPosition,c?"stop":"play",be(this._handlePlayClick,this,!c),!0);function f(v,g,m,y){if(v){var x=Bo(Te(i.get(["controlStyle",g+"BtnSize"]),o),o),_=[0,-x/2,x,x],w=Cbe(i,g+"Icon",_,{x:v[0],y:v[1],originX:o/2,originY:0,rotation:y?-s:0,rectHover:!0,style:l,onclick:m});w.ensureState("emphasis").style=u,n.add(w),ql(w)}}},t.prototype._renderCurrentPointer=function(r,n,a,i){var o=i.getData(),s=i.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(h){h.draggable=!0,h.drift=be(u._handlePointerDrag,u),h.ondragend=be(u._handlePointerDragend,u),Wz(h,u._progressLine,s,a,i,!0)},onUpdate:function(h){Wz(h,u._progressLine,s,a,i)}};this._currentPointer=Uz(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,a){this._clearTimer(),this._pointerChangeTimeline([a.offsetX,a.offsetY])},t.prototype._handlePointerDragend=function(r){this._pointerChangeTimeline([r.offsetX,r.offsetY],!0)},t.prototype._pointerChangeTimeline=function(r,n){var a=this._toAxisCoord(r)[0],i=this._axis,o=on(i.getExtent().slice());a>o[1]&&(a=o[1]),a=0&&(s[o]=+s[o].toFixed(g)),[s,v]}var ax={min:nt(nx,"min"),max:nt(nx,"max"),average:nt(nx,"average"),median:nt(nx,"median")};function Am(e,t){if(t){var r=e.getData(),n=e.coordinateSystem,a=n&&n.dimensions;if(!Lbe(t)&&!ae(t.coord)&&ae(a)){var i=Z$(t,r,n,e);if(t=ke(t),t.type&&ax[t.type]&&i.baseAxis&&i.valueAxis){var o=Ye(a,i.baseAxis.dim),s=Ye(a,i.valueAxis.dim),l=ax[t.type](r,i.valueAxis.dim,i.baseDataDim,i.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||!ae(a)){t.coord=[];var u=e.getBaseAxis();if(u&&t.type&&ax[t.type]){var c=n.getOtherAxis(u);c&&(t.value=zb(r,r.mapDimension(c.dim),t.type))}}else for(var h=t.coord,f=0;f<2;f++)ax[h[f]]&&(h[f]=zb(r,r.mapDimension(a[f]),h[f]));return t}}function Z$(e,t,r,n){var a={};return e.valueIndex!=null||e.valueDim!=null?(a.valueDataDim=e.valueIndex!=null?t.getDimension(e.valueIndex):e.valueDim,a.valueAxis=r.getAxis(Ibe(n,a.valueDataDim)),a.baseAxis=r.getOtherAxis(a.valueAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim)):(a.baseAxis=n.getBaseAxis(),a.valueAxis=r.getOtherAxis(a.baseAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim),a.valueDataDim=t.mapDimension(a.valueAxis.dim)),a}function Ibe(e,t){var r=e.getData().getDimensionInfo(t);return r&&r.coordDim}function Nm(e,t){return e&&e.containData&&t.coord&&!oN(t)?e.containData(t.coord):!0}function Pbe(e,t,r){return e&&e.containZone&&t.coord&&r.coord&&!oN(t)&&!oN(r)?e.containZone(t.coord,r.coord):!0}function Y$(e,t){return e?function(r,n,a,i){var o=i<2?r.coord&&r.coord[i]:r.value;return Kl(o,t[i])}:function(r,n,a,i){return Kl(r.value,t[i])}}function zb(e,t,r){if(r==="average"){var n=0,a=0;return e.each(t,function(i,o){isNaN(i)||(n+=i,a++)}),n/a}else return r==="median"?e.getMedian(t):e.getDataExtent(t)[r==="max"?1:0]}var j2=Qe(),yP=function(e){X(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=we()},t.prototype.render=function(r,n,a){var i=this,o=this.markerGroupMap;o.each(function(s){j2(s).keep=!1}),n.eachSeries(function(s){var l=Zo.getMarkerModelFromSeries(s,i.type);l&&i.renderSeries(s,l,n,a)}),o.each(function(s){!j2(s).keep&&i.group.remove(s.group)}),Dbe(n,o,this.type)},t.prototype.markKeep=function(r){j2(r).keep=!0},t.prototype.toggleBlurSeries=function(r,n){var a=this;R(r,function(i){var o=Zo.getMarkerModelFromSeries(i,a.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(n?w7(l):Kk(l))})}})},t.type="marker",t}(Yt);function Dbe(e,t,r){e.eachSeries(function(n){var a=Zo.getMarkerModelFromSeries(n,r),i=t.get(n.id);if(a&&i&&i.group){var o=lh(a),s=o.z,l=o.zlevel;z1(i.group,s,l)}})}function Zz(e,t,r){var n=t.coordinateSystem,a=r.getWidth(),i=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:a,h=u?o?o.height:0:i,f=u&&o?o.x:0,v=u&&o?o.y:0,g,m=me(l.get("x"),c)+f,y=me(l.get("y"),h)+v;if(!isNaN(m)&&!isNaN(y))g=[m,y];else if(t.getMarkerPosition)g=t.getMarkerPosition(e.getValues(e.dimensions,s));else if(n){var x=e.get(n.dimensions[0],s),_=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 jbe=function(e){X(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,a){n.eachSeries(function(i){var o=Zo.getMarkerModelFromSeries(i,"markPoint");o&&(Zz(o.getData(),i,a),this.markerGroupMap.get(i.id).updateLayout())},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new ty),h=Ebe(o,r,n);n.setData(h),Zz(n.getData(),r,i),h.each(function(f){var v=h.getItemModel(f),g=v.getShallow("symbol"),m=v.getShallow("symbolSize"),y=v.getShallow("symbolRotate"),x=v.getShallow("symbolOffset"),_=v.getShallow("symbolKeepAspect");if(Le(g)||Le(m)||Le(y)||Le(x)){var w=n.getRawValue(f),S=n.getDataParams(f);Le(g)&&(g=g(w,S)),Le(m)&&(m=m(w,S)),Le(y)&&(y=y(w,S)),Le(x)&&(x=x(w,S))}var C=v.getModel("itemStyle").getItemStyle(),M=v.get("z2"),A=Xm(l,"color");C.fill||(C.fill=A),h.setItemVisual(f,{z2:Te(M,0),symbol:g,symbolSize:m,symbolRotate:y,symbolOffset:x,symbolKeepAspect:_,style:C})}),c.updateData(h),this.group.add(c.group),h.eachItemGraphicEl(function(f){f.traverse(function(v){Be(v).dataModel=n})}),this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markPoint",t}(yP);function Ebe(e,t,r){var n;e?n=oe(e&&e.dimensions,function(s){var l=t.getData(),u=l.getDimensionInfo(l.mapDimension(s))||{};return te(te({},u),{name:s,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Bn(n,r),i=oe(r.get("data"),nt(Am,t));e&&(i=It(i,nt(Nm,e)));var o=Y$(!!e,n);return a.initData(i,null,o),a}function Rbe(e){e.registerComponentModel(kbe),e.registerComponentView(jbe),e.registerPreprocessor(function(t){mP(t.series,"markPoint")&&(t.markPoint=t.markPoint||{})})}var Obe=function(e){X(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,a){return new t(r,n,a)},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}(Zo),ix=Qe(),zbe=function(e,t,r,n){var a=e.getData(),i;if(ae(n))i=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=On(n.yAxis,n.xAxis);else{var u=Z$(n,a,t,e);s=u.valueAxis;var c=$L(a,u.valueDataDim);l=zb(a,c,o)}var h=s.dim==="x"?0:1,f=1-h,v=ke(n),g={coord:[]};v.type=null,v.coord=[],v.coord[f]=-1/0,g.coord[f]=1/0;var m=r.get("precision");m>=0&&Tt(l)&&(l=+l.toFixed(Math.min(m,20))),v.coord[h]=g.coord[h]=l,i=[v,g,{type:o,valueIndex:n.valueIndex,value:l}]}else i=[]}var y=[Am(e,i[0]),Am(e,i[1]),te({},i[2])];return y[2].type=y[2].type||null,Je(y[2],y[0]),Je(y[2],y[1]),y};function Bb(e){return!isNaN(e)&&!isFinite(e)}function Yz(e,t,r,n){var a=1-e,i=n.dimensions[e];return Bb(t[a])&&Bb(r[a])&&t[e]===r[e]&&n.getAxis(i).containData(t[e])}function Bbe(e,t){if(e.type==="cartesian2d"){var r=t[0].coord,n=t[1].coord;if(r&&n&&(Yz(1,r,n,e)||Yz(0,r,n,e)))return!0}return Nm(e,t[0])&&Nm(e,t[1])}function E2(e,t,r,n,a){var i=n.coordinateSystem,o=e.getItemModel(t),s,l=me(o.get("x"),a.getWidth()),u=me(o.get("y"),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition)s=n.getMarkerPosition(e.getValues(e.dimensions,t));else{var c=i.dimensions,h=e.get(c[0],t),f=e.get(c[1],t);s=i.dataToPoint([h,f])}if(ph(i,"cartesian2d")){var v=i.getAxis("x"),g=i.getAxis("y"),c=i.dimensions;Bb(e.get(c[0],t))?s[0]=v.toGlobalCoord(v.getExtent()[r?0:1]):Bb(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 Fbe=function(e){X(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,a){n.eachSeries(function(i){var o=Zo.getMarkerModelFromSeries(i,"markLine");if(o){var s=o.getData(),l=ix(o).from,u=ix(o).to;l.each(function(c){E2(l,c,!0,i,a),E2(u,c,!1,i,a)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(i.id).updateLayout()}},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new RI);this.group.add(c.group);var h=Vbe(o,r,n),f=h.from,v=h.to,g=h.line;ix(n).from=f,ix(n).to=v,n.setData(g);var m=n.get("symbol"),y=n.get("symbolSize"),x=n.get("symbolRotate"),_=n.get("symbolOffset");ae(m)||(m=[m,m]),ae(y)||(y=[y,y]),ae(x)||(x=[x,x]),ae(_)||(_=[_,_]),h.from.each(function(S){w(f,S,!0),w(v,S,!1)}),g.each(function(S){var C=g.getItemModel(S),M=C.getModel("lineStyle").getLineStyle();g.setItemLayout(S,[f.getItemLayout(S),v.getItemLayout(S)]);var A=C.get("z2");M.stroke==null&&(M.stroke=f.getItemVisual(S,"style").fill),g.setItemVisual(S,{z2:Te(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:v.getItemVisual(S,"symbolKeepAspect"),toSymbolOffset:v.getItemVisual(S,"symbolOffset"),toSymbolRotate:v.getItemVisual(S,"symbolRotate"),toSymbolSize:v.getItemVisual(S,"symbolSize"),toSymbol:v.getItemVisual(S,"symbol"),style:M})}),c.updateData(g),h.line.eachItemGraphicEl(function(S){Be(S).dataModel=n,S.traverse(function(C){Be(C).dataModel=n})});function w(S,C,M){var A=S.getItemModel(C);E2(S,C,M,r,i);var I=A.getModel("itemStyle").getItemStyle();I.fill==null&&(I.fill=Xm(l,"color")),S.setItemVisual(C,{symbolKeepAspect:A.get("symbolKeepAspect"),symbolOffset:Te(A.get("symbolOffset",!0),_[M?0:1]),symbolRotate:Te(A.get("symbolRotate",!0),x[M?0:1]),symbolSize:Te(A.get("symbolSize"),y[M?0:1]),symbol:Te(A.get("symbol",!0),m[M?0:1]),style:I})}this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markLine",t}(yP);function Vbe(e,t,r){var n;e?n=oe(e&&e.dimensions,function(u){var c=t.getData(),h=c.getDimensionInfo(c.mapDimension(u))||{};return te(te({},h),{name:u,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Bn(n,r),i=new Bn(n,r),o=new Bn([],r),s=oe(r.get("data"),nt(zbe,t,e,r));e&&(s=It(s,nt(Bbe,e)));var l=Y$(!!e,n);return a.initData(oe(s,function(u){return u[0]}),null,l),i.initData(oe(s,function(u){return u[1]}),null,l),o.initData(oe(s,function(u){return u[2]})),o.hasItemOption=!0,{from:a,to:i,line:o}}function Gbe(e){e.registerComponentModel(Obe),e.registerComponentView(Fbe),e.registerPreprocessor(function(t){mP(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var Hbe=function(e){X(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,a){return new t(r,n,a)},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}(Zo),ox=Qe(),Ube=function(e,t,r,n){var a=n[0],i=n[1];if(!(!a||!i)){var o=Am(e,a),s=Am(e,i),l=o.coord,u=s.coord;l[0]=On(l[0],-1/0),l[1]=On(l[1],-1/0),u[0]=On(u[0],1/0),u[1]=On(u[1],1/0);var c=y1([{},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 Fb(e){return!isNaN(e)&&!isFinite(e)}function Xz(e,t,r,n){var a=1-e;return Fb(t[a])&&Fb(r[a])}function Wbe(e,t){var r=t.coord[0],n=t.coord[1],a={coord:r,x:t.x0,y:t.y0},i={coord:n,x:t.x1,y:t.y1};return ph(e,"cartesian2d")?r&&n&&(Xz(1,r,n)||Xz(0,r,n))?!0:Pbe(e,a,i):Nm(e,a)||Nm(e,i)}function qz(e,t,r,n,a){var i=n.coordinateSystem,o=e.getItemModel(t),s,l=me(o.get(r[0]),a.getWidth()),u=me(o.get(r[1]),a.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=i.clampData(c),v=i.clampData(h),g=[];r[0]==="x0"?g[0]=f[0]>v[0]?h[0]:c[0]:g[0]=f[0]>v[0]?c[0]:h[0],r[1]==="y0"?g[1]=f[1]>v[1]?h[1]:c[1]:g[1]=f[1]>v[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),x=[m,y];i.clampData&&i.clampData(x,x),s=i.dataToPoint(x,!0)}if(ph(i,"cartesian2d")){var _=i.getAxis("x"),w=i.getAxis("y"),m=e.get(r[0],t),y=e.get(r[1],t);Fb(m)?s[0]=_.toGlobalCoord(_.getExtent()[r[0]==="x0"?0:1]):Fb(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 Kz=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],$be=function(e){X(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,a){n.eachSeries(function(i){var o=Zo.getMarkerModelFromSeries(i,"markArea");if(o){var s=o.getData();s.each(function(l){var u=oe(Kz,function(h){return qz(s,l,h,i,a)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new De});this.group.add(c.group),this.markKeep(c);var h=Zbe(o,r,n);n.setData(h),h.each(function(f){var v=oe(Kz,function(P){return qz(h,f,P,r,i)}),g=o.getAxis("x").scale,m=o.getAxis("y").scale,y=g.getExtent(),x=m.getExtent(),_=[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))];on(_),on(w);var S=!(y[0]>_[1]||y[1]<_[0]||x[0]>w[1]||x[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}(ht),Ad=nt,lN=R,sx=De,X$=function(e){X(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 sx),this.group.add(this._selectorGroup=new sx),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(r,n,a){var i=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,a,l,s,u);var c=Ur(r,a).refContainer,h=r.getBoxLayoutParams(),f=r.get("padding"),v=tr(h,c,f),g=this.layoutInner(r,o,v,i,l,u),m=tr(Ee({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=O$(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,a,i,o,s,l){var u=this.getContentGroup(),c=we(),h=n.get("selectedMode"),f=n.get("triggerEvent"),v=[];a.eachRawSeries(function(g){!g.get("legendHoverLink")&&v.push(g.id)}),lN(n.getData(),function(g,m){var y=this,x=g.get("name");if(!this.newlineDisabled&&(x===""||x===` -`)){var _=new sx;_.newline=!0,u.add(_);return}var w=a.getSeriesByName(x)[0];if(!c.get(x))if(w){var S=w.getData(),C=S.getVisual("legendLineStyle")||{},M=S.getVisual("legendIcon"),A=S.getVisual("style"),I=this._createItem(w,x,m,g,n,r,C,A,M,h,i);I.on("click",Ad(Jz,x,null,i,v)).on("mouseover",Ad(uN,w.name,null,i,v)).on("mouseout",Ad(cN,w.name,null,i,v)),a.ssr&&I.eachChild(function(k){var P=Be(k);P.seriesIndex=w.seriesIndex,P.dataIndex=m,P.ssrType="legend"}),f&&I.eachChild(function(k){y.packEventData(k,n,w,m,x)}),c.set(x,!0)}else a.eachRawSeries(function(k){var P=this;if(!c.get(x)&&k.legendVisualProvider){var D=k.legendVisualProvider;if(!D.containName(x))return;var z=D.indexOfName(x),j=D.getItemVisual(z,"style"),B=D.getItemVisual(z,"legendIcon"),H=zn(j.fill);H&&H[3]===0&&(H[3]=.2,j=te(te({},j),{fill:ui(H,"rgba")}));var V=this._createItem(k,x,m,g,n,r,{},j,B,h,i);V.on("click",Ad(Jz,null,x,i,v)).on("mouseover",Ad(uN,null,x,i,v)).on("mouseout",Ad(cN,null,x,i,v)),a.ssr&&V.eachChild(function(U){var F=Be(U);F.seriesIndex=k.seriesIndex,F.dataIndex=m,F.ssrType="legend"}),f&&V.eachChild(function(U){P.packEventData(U,n,k,m,x)}),c.set(x,!0)}},this)},this),o&&this._createSelector(o,n,i,s,l)},t.prototype.packEventData=function(r,n,a,i,o){var s={componentType:"legend",componentIndex:n.componentIndex,dataIndex:i,value:o,seriesIndex:a.seriesIndex};Be(r).eventData=s},t.prototype._createSelector=function(r,n,a,i,o){var s=this.getSelectorGroup();lN(r,function(u){var c=u.type,h=new wt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect",legendId:n.id})}});s.add(h);var f=n.getModel("selectorLabel"),v=n.getModel(["emphasis","selectorLabel"]);Jr(h,{normal:f,emphasis:v},{defaultText:u.title}),ql(h)})},t.prototype._createItem=function(r,n,a,i,o,s,l,u,c,h,f){var v=r.visualDrawType,g=o.get("itemWidth"),m=o.get("itemHeight"),y=o.isSelected(n),x=i.get("symbolRotate"),_=i.get("symbolKeepAspect"),w=i.get("icon");c=w||c||"roundRect";var S=qbe(c,i,l,u,v,y,f),C=new sx,M=i.getModel("textStyle");if(Le(r.getLegendIcon)&&(!w||w==="inherit"))C.add(r.getLegendIcon({itemWidth:g,itemHeight:m,icon:c,iconRotate:x,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:_}));else{var A=w==="inherit"&&r.getData().getVisual("symbol")?x==="inherit"?r.getData().getVisual("symbolRotate"):x:0;C.add(Kbe({itemWidth:g,itemHeight:m,icon:c,iconRotate:A,itemStyle:S.itemStyle,symbolKeepAspect:_}))}var I=s==="left"?g+5:-5,k=s,P=o.get("formatter"),D=n;ve(P)&&P?D=P.replace("{name}",n??""):Le(P)&&(D=P(n));var z=y?M.getTextColor():i.get("inactiveColor");C.add(new wt({style:$t(M,{text:D,x:I,y:m/2,fill:z,align:k,verticalAlign:"middle"},{inheritColor:z})}));var j=new it({shape:C.getBoundingRect(),style:{fill:"transparent"}}),B=i.getModel("tooltip");return B.get("show")&&el({el:j,componentModel:o,itemName:n,itemTooltipOption:B.option}),C.add(j),C.eachChild(function(H){H.silent=!0}),j.silent=!h,this.getContentGroup().add(C),ql(C),C.__legendDataIndex=a,C},t.prototype.layoutInner=function(r,n,a,i,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();Gc(r.get("orient"),l,r.get("itemGap"),a.width,a.height);var c=l.getBoundingRect(),h=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){Gc("horizontal",u,r.get("selectorItemGap",!0));var f=u.getBoundingRect(),v=[-f.x,-f.y],g=r.get("selectorButtonGap",!0),m=r.getOrient().index,y=m===0?"width":"height",x=m===0?"height":"width",_=m===0?"y":"x";s==="end"?v[m]+=c[y]+g:h[m]+=f[y]+g,v[1-m]+=c[x]/2-f[x]/2,u.x=v[0],u.y=v[1],l.x=h[0],l.y=h[1];var w={x:0,y:0};return w[y]=c[y]+g+f[y],w[x]=Math.max(c[x],f[x]),w[_]=Math.min(0,f[_]+v[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}(Yt);function qbe(e,t,r,n,a,i,o){function s(y,x){y.lineWidth==="auto"&&(y.lineWidth=x.lineWidth>0?2:0),lN(y,function(_,w){y[w]==="inherit"&&(y[w]=x[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:zf(h,o),u.fill==="inherit"&&(u.fill=n[a]),u.stroke==="inherit"&&(u.stroke=n[c]),u.opacity==="inherit"&&(u.opacity=(a==="fill"?n:r).opacity),s(u,n);var f=t.getModel("lineStyle"),v=f.getLineStyle();if(s(v,r),u.fill==="auto"&&(u.fill=n.fill),u.stroke==="auto"&&(u.stroke=n.fill),v.stroke==="auto"&&(v.stroke=n.fill),!i){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"),v.stroke=f.get("inactiveColor"),v.lineWidth=f.get("inactiveWidth")}return{itemStyle:u,lineStyle:v}}function Kbe(e){var t=e.icon||"roundRect",r=Ar(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 Jz(e,t,r,n){cN(e,t,r,n),r.dispatchAction({type:"legendToggleSelect",name:e??t}),uN(e,t,r,n)}function uN(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"highlight",seriesName:e,name:t,excludeSeriesId:n})}function cN(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"downplay",seriesName:e,name:t,excludeSeriesId:n})}function Tp(e,t,r){var n=e==="allSelect"||e==="inverseSelect",a={},i=[];r.eachComponent({mainType:"legend",query:t},function(s){n?s[e]():s[e](t.name),Qz(s,a),i.push(s.componentIndex)});var o={};return r.eachComponent("legend",function(s){R(a,function(l,u){s[l?"select":"unSelect"](u)}),Qz(s,o)}),n?{selected:o,legendIndex:i}:{name:t.name,selected:o}}function Qz(e,t){var r=t||{};return R(e.getData(),function(n){var a=n.get("name");if(!(a===` -`||a==="")){var i=e.isSelected(a);Se(r,a)?r[a]=r[a]&&i:r[a]=i}}),r}function Jbe(e){e.registerAction("legendToggleSelect","legendselectchanged",nt(Tp,"toggleSelected")),e.registerAction("legendAllSelect","legendselectall",nt(Tp,"allSelect")),e.registerAction("legendInverseSelect","legendinverseselect",nt(Tp,"inverseSelect")),e.registerAction("legendSelect","legendselected",nt(Tp,"select")),e.registerAction("legendUnSelect","legendunselected",nt(Tp,"unSelect"))}var Qbe=Vm(e1e);function e1e(e){var t=e.findComponents({mainType:"legend"});t&&t.length&&e.filterSeries(function(r){for(var n=0;na[o],y=[-v.x,-v.y];n||(y[i]=c[u]);var x=[0,0],_=[-g.x,-g.y],w=Te(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(m){var S=r.get("pageButtonPosition",!0);S==="end"?_[i]+=a[o]-g[o]:x[i]+=g[o]+w}_[1-i]+=v[s]/2-g[s]/2,c.setPosition(y),h.setPosition(x),f.setPosition(_);var C={x:0,y:0};if(C[o]=m?a[o]:v[o],C[s]=Math.max(v[s],g[s]),C[l]=Math.min(0,g[l]+_[1-i]),h.__rectSize=a[o],m){var M={x:0,y:0};M[o]=Math.max(a[o]-g[o]-w,0),M[s]=C[s],h.setClipPath(new it({shape:M})),h.__rectSize=M[o]}else f.eachChild(function(I){I.attr({invisible:!0,silent:!0})});var A=this._getPageInfo(r);return A.pageIndex!=null&&At(c,{x:A.contentPosition[0],y:A.contentPosition[1]},m?r:null),this._updatePageInfoView(r,A),C},t.prototype._pageGo=function(r,n,a){var i=this._getPageInfo(n)[r];i!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:n.id})},t.prototype._updatePageInfoView=function(r,n){var a=this._controllerGroup;R(["pagePrev","pageNext"],function(c){var h=c+"DataIndex",f=n[h]!=null,v=a.childOfName(c);v&&(v.setStyle("fill",f?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),v.cursor=f?"pointer":"default")});var i=a.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;i&&o&&i.setStyle("text",ve(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),a=this.getContentGroup(),i=this._containerGroup.__rectSize,o=r.getOrient().index,s=R2[o],l=O2[o],u=this._findTargetItemIndex(n),c=a.children(),h=c[u],f=c.length,v=f?1:0,g={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return g;var m=S(h);g.contentPosition[o]=-m.s;for(var y=u+1,x=m,_=m,w=null;y<=f;++y)w=S(c[y]),(!w&&_.e>x.s+i||w&&!C(w,x.s))&&(_.i>x.i?x=_:x=w,x&&(g.pageNextDataIndex==null&&(g.pageNextDataIndex=x.i),++g.pageCount)),_=w;for(var y=u-1,x=m,_=m,w=null;y>=-1;--y)w=S(c[y]),(!w||!C(_,w.s))&&x.i<_.i&&(_=x,g.pagePrevDataIndex==null&&(g.pagePrevDataIndex=x.i),++g.pageCount,++g.pageIndex),x=w;return g;function S(M){if(M){var A=M.getBoundingRect(),I=A[l]+M[l];return{s:I,e:I+A[s],i:M.__legendDataIndex}}}function C(M,A){return M.e>=A&&M.s<=A+i}},t.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,a=this.getContentGroup(),i;return a.eachChild(function(o,s){var l=o.__legendDataIndex;i==null&&l!=null&&(i=s),l===r&&(n=s)}),n??i},t.type="legend.scroll",t}(X$);function n1e(e){e.registerAction("legendScroll","legendscroll",function(t,r){var n=t.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:t},function(a){a.setScrollDataIndex(n)})})}function a1e(e){rt(q$),e.registerComponentModel(t1e),e.registerComponentView(r1e),n1e(e)}function i1e(e){rt(q$),rt(a1e)}var o1e=function(e){X(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=Cu(Mm.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(Mm),xP=Qe();function s1e(e,t,r){xP(e).coordSysRecordMap.each(function(n){var a=n.dataZoomInfoMap.get(t.uid);a&&(a.getRange=r)})}function l1e(e,t){for(var r=xP(e).coordSysRecordMap,n=r.keys(),a=0;ai[a+n]&&(n=h),o=o&&c.get("preventDefaultMouseMove",!0),s=Te(c.get("cursorGrab",!0),s),l=Te(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 f1e(e){e.registerUpdateLifecycle("coordsys:aftercreate",function(t,r){var n=xP(r),a=n.coordSysRecordMap||(n.coordSysRecordMap=we());a.each(function(i){i.dataZoomInfoMap=null}),t.eachComponent({mainType:"dataZoom",subType:"inside"},function(i){var o=P$(i);R(o.infoList,function(s){var l=s.model.uid,u=a.get(l)||a.set(l,u1e(r,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=we());c.set(i.uid,{dzReferCoordSysInfo:s,model:i,getRange:null})})}),a.each(function(i){var o=i.controller,s,l=i.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){K$(a,i);return}var c=d1e(l,i,r);o.enable(c.controlType,c.opt),xv(i,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var v1e=function(e){X(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,a){if(e.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),s1e(a,r,{pan:be(z2.pan,this),zoom:be(z2.zoom,this),scrollMove:be(z2.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){l1e(this.api,this.dataZoomModel),this.range=null},t.type="dataZoom.inside",t}(hP),z2={zoom:function(e,t,r,n){var a=this.range,i=a.slice(),o=e.axisModels[0];if(o){var s=B2[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*(i[1]-i[0])+i[0],u=Math.max(1/n.scale,0);i[0]=(i[0]-l)*u+l,i[1]=(i[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(uu(0,i,[0,100],0,c.minSpan,c.maxSpan),this.range=i,a[0]!==i[0]||a[1]!==i[1])return i}},pan:rB(function(e,t,r,n,a,i){var o=B2[n]([i.oldX,i.oldY],[i.newX,i.newY],t,a,r);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:rB(function(e,t,r,n,a,i){var o=B2[n]([0,0],[i.scrollDelta,i.scrollDelta],t,a,r);return o.signal*(e[1]-e[0])*i.scrollDelta})};function rB(e){return function(t,r,n,a){var i=this.range,o=i.slice(),s=t.axisModels[0];if(s){var l=e(o,s,t,r,n,a);if(uu(l,o,[0,100],"all"),this.range=o,i[0]!==o[0]||i[1]!==o[1])return o}}}var B2={grid:function(e,t,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem.getRect();return e=e||[0,0],i.dim==="x"?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=i.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=i.inverse?-1:1),o},polar:function(e,t,r,n,a){var i=r.axis,o={},s=a.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=i.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=i.inverse?-1:1),o},singleAxis:function(e,t,r,n,a){var i=r.axis,o=a.model.coordinateSystem.getRect(),s={};return e=e||[0,0],i.orient==="horizontal"?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=i.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=i.inverse?-1:1),s}};function J$(e){dP(e),e.registerComponentModel(o1e),e.registerComponentView(v1e),f1e(e)}var p1e=function(e){X(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=Cu(Mm.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}(Mm),Mp=it,g1e=1,F2=30,m1e=7,Ap="horizontal",nB="vertical",y1e=5,x1e=["line","bar","candlestick","scatter"],_1e={easing:"cubicOut",duration:100,delay:0},b1e=function(e){X(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=be(this._onBrush,this),this._onBrushEnd=be(this._onBrushEnd,this)},t.prototype.render=function(r,n,a,i){if(e.prototype.render.apply(this,arguments),xv(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}(!i||i.type!=="dataZoom"||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){rm(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 De;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),r.add(n),this._positionGroup()},t.prototype._resetLocation=function(){var r=this.dataZoomModel,n=this.api,a=r.get("brushSelect"),i=a?m1e:0,o=Ur(r,n).refContainer,s=this._findCoordRect(),l=r.get("defaultLocationEdgeGap",!0)||0,u=this._orient===Ap?{right:o.width-s.x-s.width,top:o.height-F2-l-i,width:s.width,height:F2}:{right:l,top:s.y,width:F2,height:s.height},c=zh(r.option);R(["right","top","width","height"],function(f){c[f]==="ph"&&(c[f]=u[f])});var h=tr(c,o);this._location={x:h.x,y:h.y},this._size=[h.width,h.height],this._orient===nB&&this._size.reverse()},t.prototype._positionGroup=function(){var r=this.group,n=this._location,a=this._orient,i=this.dataZoomModel.getFirstTargetAxisModel(),o=i&&i.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(a===Ap&&!o?{scaleY:l?1:-1,scaleX:1}:a===Ap&&o?{scaleY:l?1:-1,scaleX:-1}:a===nB&&!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,a=this._displayables.sliderGroup,i=r.get("brushSelect");a.add(new Mp({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:r.get("backgroundColor")},z2:-40}));var o=new Mp({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:be(this._onClickPanel,this)}),s=this.api.getZr();i?(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)),a.add(o)},t.prototype._renderDataShadow=function(){var r=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!r)return;var n=this._size,a=this._shadowSize||[],i=r.series,o=i.getRawData(),s=i.getShadowDim&&i.getShadowDim(),l=s&&o.getDimensionInfo(s)?i.getShadowDim():r.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==a[0]||n[1]!==a[1]){var h=o.getDataExtent(r.thisDim),f=o.getDataExtent(l),v=(f[1]-f[0])*.3;f=[f[0]-v,f[1]+v];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",C=-_,M=Math.round(o.count()/n[0]),A;o.each([r.thisDim,l],function(z,j,B){if(M>0&&B%M){S||(C+=_);return}C=S?(+z-h[0])*w:C+_;var H=j==null||isNaN(j)||j==="",V=H?0:Nt(j,f,g,!0);H&&!A&&B?(y.push([y[y.length-1][0],0]),x.push([x[x.length-1][0],0])):!H&&A&&(y.push([C,0]),x.push([C,0])),H||(y.push([C,V]),x.push([C,V])),A=H}),u=this._shadowPolygonPts=y,c=this._shadowPolylinePts=x}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var I=this.dataZoomModel;function k(z){var j=I.getModel(z?"selectedDataBackground":"dataBackground"),B=new De,H=new Sn({shape:{points:u},segmentIgnoreThreshold:1,style:j.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),V=new un({shape:{points:c},segmentIgnoreThreshold:1,style:j.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return B.add(H),B.add(V),B}for(var P=0;P<3;P++){var D=k(P===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 a,i=this.ecModel;return r.eachTargetAxis(function(o,s){var l=r.getAxisProxy(o,s).getTargetSeriesModels();R(l,function(u){if(!a&&!(n!==!0&&Ye(x1e,u.get("type"))<0)){var c=i.getComponent(Rl(o),s).axis,h=w1e(o),f,v=u.coordinateSystem;h!=null&&v.getOtherAxis&&(f=v.getOtherAxis(c).inverse),h=u.getData().mapDimension(h);var g=u.getData().mapDimension(o);a={thisAxis:c,series:u,thisDim:g,otherDim:h,otherAxisInverse:f}}},this)},this),a}},t.prototype._renderHandle=function(){var r=this.group,n=this._displayables,a=n.handles=[null,null],i=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 Mp({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(f),o.add(new Mp({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:g1e,fill:K.color.transparent}})),R([0,1],function(w){var S=l.get("handleIcon");!q_[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var C=Ar(S,-1,0,2,2,null,!0);C.attr({cursor:S1e(this._orient),draggable:!0,drift:be(this._onDragMove,this,w),ondragend:be(this._onDragEnd,this),onmouseover:be(this._onOverDataInfoTriggerArea,this,!0),onmouseout:be(this._onOverDataInfoTriggerArea,this,!1),z2:5});var M=C.getBoundingRect(),A=l.get("handleSize");this._handleHeight=me(A,this._size[1]),this._handleWidth=M.width/M.height*this._handleHeight,C.setStyle(l.getModel("handleStyle").getItemStyle()),C.style.strokeNoScale=!0,C.rectHover=!0,C.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),ql(C);var I=l.get("handleColor");I!=null&&(C.style.fill=I),o.add(a[w]=C);var k=l.getModel("textStyle"),P=l.get("handleLabel")||{},D=P.show||!1;r.add(i[w]=new wt({silent:!0,invisible:!D,style:$t(k,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:k.getTextColor(),font:k.getFont()}),z2:10}))},this);var v=f;if(h){var g=me(l.get("moveHandleSize"),s[1]),m=n.moveHandle=new it({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:g}}),y=g*.8,x=n.moveHandleIcon=Ar(l.get("moveHandleIcon"),-y/2,-y/2,y,y,K.color.neutral00,!0);x.silent=!0,x.y=s[1]+g/2-.5,m.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var _=Math.min(s[1]/2,Math.max(g,10));v=n.moveZone=new it({invisible:!0,shape:{y:s[1]-_,height:g+_}}),v.on("mouseover",function(){u.enterEmphasis(m)}).on("mouseout",function(){u.leaveEmphasis(m)}),o.add(m),o.add(x),o.add(v)}v.attr({draggable:!0,cursor:"grab",drift:be(this._onActualMoveZoneDrift,this),ondragstart:be(this._onActualMoveZoneDragStart,this),ondragend:be(this._onActualMoveZoneDragEnd,this),onmouseover:be(this._onOverDataInfoTriggerArea,this,!0),onmouseout:be(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var r=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[Nt(r[0],[0,100],n,!0),Nt(r[1],[0,100],n,!0)]},t.prototype._updateInterval=function(r,n){var a=this.dataZoomModel,i=this._handleEnds,o=this._getViewExtent(),s=a.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];uu(n,i,o,a.get("zoomLock")?"all":r,s.minSpan!=null?Nt(s.minSpan,l,o,!0):null,s.maxSpan!=null?Nt(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=on([Nt(i[0],o,l,!0),Nt(i[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},t.prototype._updateView=function(r){var n=this._displayables,a=this._handleEnds,i=on(a.slice()),o=this._size;R([0,1],function(v){var g=n.handles[v],m=this._handleHeight;g.attr({scaleX:m/2,scaleY:m/2,x:a[v]+(v?-1:1),y:o[1]/2-m/2})},this),n.filler.setShape({x:i[0],y:0,width:i[1]-i[0],height:o[1]});var s={x:i[0],width:i[1]-i[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,i[0],i[1],o[0]],c=0;cn[0]||a[1]<0||a[1]>n[1])){var i=this._handleEnds,o=(i[0]+i[1])/2,s=this._updateInterval("all",a[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(r){var n=r.offsetX,a=r.offsetY;this._brushStart=new Oe(n,a),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 a=n.shape,i=+new Date;if(!(i-this._brushStartTime<200&&Math.abs(a.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[a.x,a.x+a.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();uu(0,l,o,0,u.minSpan!=null?Nt(u.minSpan,s,o,!0):null,u.maxSpan!=null?Nt(u.maxSpan,s,o,!0):null),this._range=on([Nt(l[0],o,s,!0),Nt(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(r){this._brushing&&(Vs(r.event),this._updateBrushRect(r.offsetX,r.offsetY))},t.prototype._updateBrushRect=function(r,n){var a=this._displayables,i=this.dataZoomModel,o=a.brushRect;o||(o=a.brushRect=new Mp({silent:!0,style:i.getModel("brushStyle").getItemStyle()}),a.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?_1e:null,start:n[0],end:n[1]})},t.prototype._findCoordRect=function(){var r,n=P$(this.dataZoomModel).infoList;if(!r&&n.length){var a=n[0].model.coordinateSystem;r=a.getRect&&a.getRect()}if(!r){var i=this.api.getWidth(),o=this.api.getHeight();r={x:i*.2,y:o*.2,width:i*.6,height:o*.6}}return r},t.type="dataZoom.slider",t}(hP);function aB(e,t,r,n){var a=e.get("labelFormatter"),i=e.get("labelPrecision");(i==null||i==="auto")&&(i=r.valuePrecision);var o=r.value[t],s=o==null||isNaN(o)?"":Vn(n)||qm(n)?n.getLabel({value:Math.round(o)}):isFinite(i)?Mt(o,i,!0):o+"";return Le(a)?a(o,s):ve(a)?a.replace("{value}",s):s}function w1e(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}function S1e(e){return e==="vertical"?"ns-resize":"ew-resize"}function Q$(e){e.registerComponentModel(p1e),e.registerComponentView(b1e),dP(e)}function C1e(e){rt(J$),rt(Q$)}var eZ={get:function(e,t,r){var n=ke((T1e[e]||{})[t]);return r&&ae(n)?n[n.length-1]:n}},T1e={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]}},iB=Kr.mapVisual,M1e=Kr.eachVisual,A1e=ae,V2=R,N1e=on,k1e=Nt,Vb=function(e){X(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,a){this.mergeDefaultAndTheme(r,a)},t.prototype.optionUpdated=function(r,n){var a=this.option;!n&&U$(a,r,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(r){var n=this.stateList;r=be(r,this),this.controllerVisuals=aN(this.option.controller,n,r),this.targetVisuals=aN(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 a=[];return V2(n,function(l){if(l.seriesIndex!=null)a.push(l.seriesIndex);else if(l.seriesId!=null){var u;r.ecModel.eachSeries(function(c){c.id===l.seriesId&&(u=c)}),u&&a.push(u.componentIndex)}}),a}var i=this.option.seriesId,o=this.option.seriesIndex;o==null&&i==null&&(o="all");var s=sv(this.ecModel,"series",{index:o,id:i},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return oe(s,function(l){return l.componentIndex})},t.prototype.eachTargetSeries=function(r,n){R(this.getTargetSeriesIndices(),function(a){var i=this.ecModel.getSeriesByIndex(a);i&&r.call(n,i)},this)},t.prototype.isTargetSeries=function(r){var n=!1;return this.eachTargetSeries(function(a){a===r&&(n=!0)}),n},t.prototype.formatValueText=function(r,n,a){var i=this.option,o=i.precision,s=this.dataBound,l=i.formatter,u;a=a||["<",">"],ae(r)&&(r=r.slice(),u=!0);var c=n?r:u?[h(r[0]),h(r[1])]:h(r);if(ve(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(Le(l))return u?l(r[0],r[1]):l(r);if(u)return r[0]===s[0]?a[0]+" "+c[1]:r[1]===s[1]?a[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=N1e([r.min,r.max]);this._dataExtent=n},t.prototype.getDimension=function(r){var n=this,a=this.option.seriesTargets;if(a){var i=Ks(a,function(o){return o.seriesIndex!=null&&o.seriesIndex===r||o.seriesId!=null&&o.seriesId===n.ecModel.getSeriesByIndex(r).id});if(i)return i.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(r){var n=r.hostModel.seriesIndex,a=this.getDimension(n);if(a!=null)return r.getDimensionIndex(a);for(var i=r.dimensions,o=i.length-1;o>=0;o--){var s=i[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,a={inRange:n.inRange,outOfRange:n.outOfRange},i=n.target||(n.target={}),o=n.controller||(n.controller={});Je(i,a),Je(o,a);var s=this.isCategory();l.call(this,i),l.call(this,o),u.call(this,i,"inRange","outOfRange"),c.call(this,o);function l(h){A1e(n.color)&&!h.inRange&&(h.inRange={color:n.color.slice().reverse()}),h.inRange=h.inRange||{color:r.get("gradientColor")}}function u(h,f,v){var g=h[f],m=h[v];g&&!m&&(m=h[v]={},V2(g,function(y,x){if(Kr.isValidType(x)){var _=eZ.get(x,"inactive",s);_!=null&&(m[x]=_,x==="color"&&!m.hasOwnProperty("opacity")&&!m.hasOwnProperty("colorAlpha")&&(m.opacity=[0,0]))}}))}function c(h){var f=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,v=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,g=this.get("inactiveColor"),m=this.getItemSymbol(),y=m||"roundRect";V2(this.stateList,function(x){var _=this.itemSize,w=h[x];w||(w=h[x]={color:s?g:[g]}),w.symbol==null&&(w.symbol=f&&ke(f)||(s?y:[y])),w.symbolSize==null&&(w.symbolSize=v&&ke(v)||(s?_[0]:[_[0],_[0]])),w.symbol=iB(w.symbol,function(M){return M==="none"?y:M});var S=w.symbolSize;if(S!=null){var C=-1/0;M1e(S,function(M){M>C&&(C=M)}),w.symbolSize=iB(S,function(M){return k1e(M,[0,C],[0,_[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}(ht),oB=[20,140],L1e=function(e){X(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(a){a.mappingMethod="linear",a.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]=oB[0]),(r[1]==null||isNaN(r[1]))&&(r[1]=oB[1])},t.prototype._resetRange=function(){var r=this.getExtent(),n=this.option.range;!n||n.auto?(r.auto=1,this.option.range=r):ae(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),R(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=on((this.get("range")||[]).slice());return n[0]>r[1]&&(n[0]=r[1]),n[1]>r[1]&&(n[1]=r[1]),n[0]=a[1]||r<=n[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[];return this.eachTargetSeries(function(a){var i=[],o=a.getData();o.each(this.getDataDimensionIndex(o),function(s,l){r[0]<=s&&s<=r[1]&&i.push(l)},this),n.push({seriesId:a.id,dataIndex:i})},this),n},t.prototype.getVisualMeta=function(r){var n=sB(this,"outOfRange",this.getExtent()),a=sB(this,"inRange",this.option.range.slice()),i=[];function o(v,g){i.push({value:v,color:r(v,g)})}for(var s=0,l=0,u=a.length,c=n.length;lr[1])break;i.push({color:this.getControllerVisual(l,"color",n),offset:s/a})}return i.push({color:this.getControllerVisual(r[1],"color",n),offset:1}),i},t.prototype._createBarPoints=function(r,n){var a=this.visualMapModel.itemSize;return[[a[0]-n[0],r[0]],[a[0],r[0]],[a[0],r[1]],[a[0]-n[1],r[1]]]},t.prototype._createBarGroup=function(r){var n=this._orient,a=this.visualMapModel.get("inverse");return new De(n==="horizontal"&&!a?{scaleX:r==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&a?{scaleX:r==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!a?{scaleX:r==="left"?1:-1,scaleY:-1}:{scaleX:r==="left"?1:-1})},t.prototype._updateHandle=function(r,n){if(this._useHandle){var a=this._shapes,i=this.visualMapModel,o=a.handleThumbs,s=a.handleLabels,l=i.itemSize,u=i.getExtent(),c=this._applyTransform("left",a.mainGroup);I1e([0,1],function(h){var f=o[h];f.setStyle("fill",n.handlesColor[h]),f.y=r[h];var v=vo(r[h],[0,l[1]],u,!0),g=this.getControllerVisual(v,"symbolSize");f.scaleX=f.scaleY=g/l[0],f.x=l[0]-g/2;var m=Fi(a.handleLabelPoints[h],Vc(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:i.formatValueText(this._dataInterval[h]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",a.mainGroup):"center"})},this)}},t.prototype._showIndicator=function(r,n,a,i){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},v=this.getControllerVisual(r,"color",f),g=this.getControllerVisual(r,"symbolSize"),m=vo(r,s,u,!0),y=l[0]-g/2,x={x:h.x,y:h.y};h.y=m,h.x=y;var _=Fi(c.indicatorLabelPoint,Vc(h,this.group)),w=c.indicatorLabel;w.attr("invisible",!1);var S=this._applyTransform("left",c.mainGroup),C=this._orient,M=C==="horizontal";w.setStyle({text:(a||"")+o.formatValueText(n),verticalAlign:M?S:"middle",align:M?"center":S});var A={x:y,y:m,style:{fill:v}},I={style:{x:_[0],y:_[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var k={duration:100,easing:"cubicInOut",additive:!0};h.x=x.x,h.y=x.y,h.animateTo(A,k),w.animateTo(I,k)}else h.attr(A),w.attr(I);this._firstShowIndicator=!1;var P=this._shapes.handleLabels;if(P)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,v=[];(n||hB(a))&&(v=this._hoverLinkDataIndices=a.findTargetDataIndices(h));var g=Rte(f,v);this._dispatchHighDown("downplay",Kx(g[0],a)),this._dispatchHighDown("highlight",Kx(g[1],a))}},t.prototype._hoverLinkFromSeriesMouseOver=function(r){var n;if(Dc(r.target,function(l){var u=Be(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var a=this.ecModel.getSeriesByIndex(n.seriesIndex),i=this.visualMapModel;if(i.isTargetSeries(a)){var o=a.getData(n.dataType),s=o.getStore().get(i.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 a=0;a=0&&(i.dimension=o,n.push(i))}}),e.getData().setVisual("visualMeta",n)}}];function B1e(e,t,r,n){for(var a=t.targetVisuals[n],i=Kr.prepareVisualTypes(a),o={color:Xm(e.getData(),"color")},s=0,l=i.length;s0:t.splitNumber>0)||t.calculable)?"continuous":"piecewise"}),e.registerAction(R1e,O1e),R(z1e,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(F1e))}function aZ(e){e.registerComponentModel(L1e),e.registerComponentView(j1e),nZ(e)}var V1e=function(e){X(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 a=this._mode=this._determineMode();this._pieceList=[],G1e[this._mode].call(this,this._pieceList),this._resetSelected(r,n);var i=this.option.categories;this.resetVisual(function(o,s){a==="categories"?(o.mappingMethod="category",o.categories=ke(i)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=oe(this._pieceList,function(l){return l=ke(l),s!=="inRange"&&(l.visual=null),l}))})},t.prototype.completeVisualOption=function(){var r=this.option,n={},a=Kr.listVisualTypes(),i=this.isCategory();R(r.pieces,function(s){R(a,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),R(n,function(s,l){var u=!1;R(this.stateList,function(c){u=u||o(r,c,l)||o(r.target,c,l)},this),!u&&R(this.stateList,function(c){(r[c]||(r[c]={}))[l]=eZ.get(l,c==="inRange"?"active":"inactive",i)})},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 a=this.option,i=this._pieceList,o=(n?a:r).selected||{};if(a.selected=o,R(i,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),a.selectedMode==="single"){var s=!1;R(i,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=ke(r)},t.prototype.getValueState=function(r){var n=Kr.findPieceIndex(r,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[],a=this._pieceList;return this.eachTargetSeries(function(i){var o=[],s=i.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=Kr.findPieceIndex(l,a);c===r&&o.push(u)},this),n.push({seriesId:i.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 a=r.interval||[];n=a[0]===-1/0&&a[1]===1/0?0:(a[0]+a[1])/2}return n},t.prototype.getVisualMeta=function(r){if(this.isCategory())return;var n=[],a=["",""],i=this;function o(c,h){var f=i.getRepresentValue({interval:c});h||(h=i.getValueState(f));var v=r(f,h);c[0]===-1/0?a[0]=v:c[1]===1/0?a[1]=v:n.push({value:c[0],color:v},{value:c[1],color:v})}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 R(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:a}},t.type="visualMap.piecewise",t.defaultOption=Cu(Vb.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}(Vb),G1e={splitNumber:function(e){var t=this.option,r=Math.min(t.precision,20),n=this.getExtent(),a=t.splitNumber;a=Math.max(parseInt(a,10),1),t.splitNumber=a;for(var i=(n[1]-n[0])/a;+i.toFixed(r)!==i&&r<5;)r++;t.precision=r,i=+i.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,a)},this)}};function pB(e,t){var r=e.inverse;(e.orient==="vertical"?!r:r)&&t.reverse()}var H1e=function(e){X(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,a=n.get("textGap"),i=n.textStyleModel,o=this._getItemAlign(),s=n.itemSize,l=this._getViewData(),u=l.endsText,c=On(n.get("showLabel",!0),!u),h=!n.get("selectedMode");u&&this._renderEndsText(r,u[0],s,c,o),R(l.viewPieceList,function(f){var v=f.piece,g=new De;g.onclick=be(this._onItemClick,this,v),this._enableHoverLink(g,f.indexInModelPieceList);var m=n.getRepresentValue(v);if(this._createItemSymbol(g,m,[0,0,s[0],s[1]],h),c){var y=this.visualMapModel.getValueState(m),x=i.get("align")||o;g.add(new wt({style:$t(i,{x:x==="right"?-a:s[0]+a,y:s[1]/2,text:v.text,verticalAlign:i.get("verticalAlign")||"middle",align:x,opacity:Te(i.get("opacity"),y==="outOfRange"?.5:1)}),silent:h}))}r.add(g)},this),u&&this._renderEndsText(r,u[1],s,c,o),Gc(n.get("orient"),r,n.get("itemGap")),this.renderBackground(r),this.positionGroup(r)},t.prototype._enableHoverLink=function(r,n){var a=this;r.on("mouseover",function(){return i("highlight")}).on("mouseout",function(){return i("downplay")});var i=function(o){var s=a.visualMapModel;s.option.hoverLink&&a.api.dispatchAction({type:o,batch:Kx(s.findTargetDataIndices(n),s)})}},t.prototype._getItemAlign=function(){var r=this.visualMapModel,n=r.option;if(n.orient==="vertical")return rZ(r,this.api,r.itemSize);var a=n.align;return(!a||a==="auto")&&(a="left"),a},t.prototype._renderEndsText=function(r,n,a,i,o){if(n){var s=new De,l=this.visualMapModel.textStyleModel;s.add(new wt({style:$t(l,{x:i?o==="right"?a[0]:0:a[0]/2,y:a[1]/2,verticalAlign:"middle",align:i?o:"center",text:n})})),r.add(s)}},t.prototype._getViewData=function(){var r=this.visualMapModel,n=oe(r.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),a=r.get("text"),i=r.get("orient"),o=r.get("inverse");return(i==="horizontal"?o:!o)?n.reverse():a&&(a=a.slice().reverse()),{viewPieceList:n,endsText:a}},t.prototype._createItemSymbol=function(r,n,a,i){var o=Ar(this.getControllerVisual(n,"symbol"),a[0],a[1],a[2],a[3],this.getControllerVisual(n,"color"));o.silent=i,r.add(o)},t.prototype._onItemClick=function(r){var n=this.visualMapModel,a=n.option,i=a.selectedMode;if(i){var o=ke(a.selected),s=n.getSelectedMapKey(r);i==="single"||i===!0?(o[s]=!0,R(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}(tZ);function iZ(e){e.registerComponentModel(V1e),e.registerComponentView(H1e),nZ(e)}function U1e(e){rt(aZ),rt(iZ)}var W1e=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:$7(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}(),$1e=function(e){X(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 W1e(this);if(this._target=null,this.ecModel.eachSeries(function(a){Z3(a,null)}),this.shouldShow()){var n=this.getTarget();Z3(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}(ht),Z1e=function(e){X(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,a){if(this._api=a,this._model=r,this._coordSys||(this._coordSys=new iw),!this._isEnabled()){this._clear();return}this._renderVersion=a.getECUpdateCycleVersion();var i=this.group;i.removeAll();var o=r.getModel("itemStyle"),s=o.getItemStyle();s.fill==null&&(s.fill=n.get("backgroundColor")||K.color.neutral00);var l=Ur(r,a).refContainer,u=tr(mH(r,!0),l),c=s.lineWidth||0,h=this._contentRect=sh(u.clone(),c/2,!0,!0),f=new De;i.add(f),f.setClipPath(new it({shape:h.plain()}));var v=this._targetGroup=new De;f.add(v);var g=u.plain();g.r=o.getShallow("borderRadius",!0),i.add(this._bgRect=new it({style:s,shape:g,silent:!1,cursor:"grab"}));var m=r.getModel("windowStyle"),y=m.getShallow("borderRadius",!0);f.add(this._windowRect=new it({shape:{x:0,y:0,width:0,height:0,r:y},style:m.getItemStyle(),silent:!1,cursor:"grab"})),this._dealRenderContent(),this._dealUpdateWindow(),mB(r,this)},t.prototype.renderContent=function(r){this._bridgeRendered=r,this._isEnabled()&&(this._dealRenderContent(),this._dealUpdateWindow(),mB(this._model,this))},t.prototype._dealRenderContent=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=this._targetGroup,a=this._coordSys,i=this._contentRect;if(n.removeAll(),!!r){var o=r.group,s=o.getBoundingRect();n.add(o),this._bgRect.z2=r.z2Range.min-10,ow(a,s.x,s.y,s.width,s.height);var l=tr({left:"center",top:"center",aspect:s.width/s.height},i);bb(a,l.x,l.y,l.width,l.height),ym(o,a,mh),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=Ra([],r.targetTrans),a=ja([],_b(null,this._coordSys),n);this._transThisToTarget=Ra([],a);var i=r.viewportRect;i?i=i.clone():i=new je(0,0,this._api.getWidth(),this._api.getHeight()),i.applyTransform(a);var o=this._windowRect,s=o.shape.r;o.setShape(Ee({r:s},i))}},t.prototype._resetRoamController=function(r){var n=this,a=this._api,i=this._roamController;if(i||(i=this._roamController=new Hh(a.getZr())),!r||!this._isEnabled()){i.disable();return}i.enable(r,{api:a,zInfo:{component:this._model},triggerInfo:{roamTrigger:null,isInSelf:function(o,s,l){return n._contentRect.contain(s,l)}}}),i.off("pan").off("zoom").on("pan",be(this._onPan,this)).on("zoom",be(this._onZoom,this))},t.prototype._onPan=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=dr([],[r.oldX,r.oldY],n),i=dr([],[r.oldX-r.dx,r.oldY-r.dy],n);this._api.dispatchAction(gB(this._model.getTarget().baseMapProvider,{dx:i[0]-a[0],dy:i[1]-a[1]}))}},t.prototype._onZoom=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=dr([],[r.originX,r.originY],n);this._api.dispatchAction(gB(this._model.getTarget().baseMapProvider,{zoom:1/r.scale,originX:a[0],originY:a[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}(Yt);function gB(e,t){var r=e.mainType==="series"?e.subType+"Roam":e.mainType+"Roam",n={type:r};return n[e.mainType+"Id"]=e.id,te(n,t),n}function mB(e,t){var r=lh(e);z1(t.group,r.z,r.zlevel)}function Y1e(e){e.registerComponentModel($1e),e.registerComponentView(Z1e)}var X1e={label:{enabled:!0},decal:{show:!1}},yB=Qe(),xB=Qe(),q1e=Vm(K1e);function K1e(e,t){var r=e.getModel("aria");if(!r.get("enabled"))return;var n=xB(e).scope||(xB(e).scope={}),a=ke(X1e);Je(a.label,e.getLocaleModel().get("aria"),!1),Je(r.option,a,!1),i(),o();function i(){var c=r.getModel("decal"),h=c.get("show");if(h){var f=we();e.eachSeries(function(v){v.isColorBySeries()||(yB(v).scope=f.get(v.type)||f.set(v.type,{}))}),e.eachSeries(function(v){if(Le(v.enableAriaDecal)){v.enableAriaDecal();return}var g=v.getData();if(v.isColorBySeries()){var w=YM(v.ecModel,v.name,n,e.getSeriesCount()),S=g.getVisual("decal");g.setVisual("decal",C(S,w))}else{var m=v.getRawData(),y={},x=yB(v).scope;g.each(function(M){var A=g.getRawIndex(M);y[A]=M});var _=m.count();m.each(function(M){var A=y[M],I=m.getName(M)||M+"",k=YM(v.ecModel,I,x,_),P=g.getItemVisual(A,"decal");g.setItemVisual(A,"decal",C(P,k))})}function C(M,A){var I=M?te(te({},A),M):A;return I.dirty=!0,I}})}}function o(){var c=t.getZr().dom;if(c){var h=e.getLocaleModel().get("aria"),f=r.getModel("label");if(f.option=Ee(f.option,h),!!f.get("enabled")){if(c.setAttribute("role","img"),f.get("description")){c.setAttribute("aria-label",f.get("description"));return}var v=e.getSeriesCount(),g=f.get(["data","maxCount"])||10,m=f.get(["series","maxCount"])||10,y=Math.min(v,m),x;if(!(v<1)){var _=l();if(_){var w=f.get(["general","withTitle"]);x=s(w,{title:_})}else x=f.get(["general","withoutTitle"]);var S=[],C=v>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);x+=s(C,{seriesCount:v}),e.eachSeries(function(k,P){if(P1?f.get(["series","multiple",j]):f.get(["series","single",j]),D=s(D,{seriesId:k.seriesIndex,seriesName:k.get("name"),seriesType:u(k.subType)});var B=k.getData();if(B.count()>g){var H=f.get(["data","partialData"]);D+=s(H,{displayCnt:g})}else D+=f.get(["data","allData"]);for(var V=f.get(["data","separator","middle"]),U=f.get(["data","separator","end"]),F=f.get(["data","excludeDimensionId"]),W=[],$=0;$":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},ewe=function(){function e(t){var r=this._condVal=ve(t)?new RegExp(t):aG(t)?t:null;if(r==null){var n="";Lt(n)}}return e.prototype.evaluate=function(t){var r=typeof t;return ve(r)?this._condVal.test(t):Tt(r)?this._condVal.test(t+""):!1},e}(),twe=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),rwe=function(){function e(){}return e.prototype.evaluate=function(){for(var t=this.children,r=0;r2&&n.push(a),a=[j,B]}function c(j,B,H,V){tf(j,H)&&tf(B,V)||a.push(j,B,H,V,H,V)}function h(j,B,H,V,U,F){var W=Math.abs(B-j),$=Math.tan(W/4)*4/3,Z=BI:D2&&n.push(a),n}function dN(e,t,r,n,a,i,o,s,l,u){if(tf(e,r)&&tf(t,n)&&tf(a,o)&&tf(i,s)){l.push(o,s);return}var c=2/u,h=c*c,f=o-e,v=s-t,g=Math.sqrt(f*f+v*v);f/=g,v/=g;var m=r-e,y=n-t,x=a-o,_=i-s,w=m*m+y*y,S=x*x+_*_;if(w=0&&I=0){l.push(o,s);return}var k=[],P=[];iu(e,r,a,o,.5,k),iu(t,n,i,s,.5,P),dN(k[0],P[0],k[1],P[1],k[2],P[2],k[3],P[3],l,u),dN(k[4],P[4],k[5],P[5],k[6],P[6],k[7],P[7],l,u)}function gwe(e,t){var r=hN(e),n=[];t=t||1;for(var a=0;a0)for(var u=0;uMath.abs(u),h=sZ([l,u],c?0:1,t),f=(c?s:u)/h.length,v=0;va,o=sZ([n,a],i?0:1,t),s=i?"width":"height",l=i?"height":"width",u=i?"x":"y",c=i?"y":"x",h=e[s]/o.length,f=0;f1?null:new Oe(m*l+e,m*u+t)}function xwe(e,t,r){var n=new Oe;Oe.sub(n,r,t),n.normalize();var a=new Oe;Oe.sub(a,e,t);var i=a.dot(n);return i}function kd(e,t){var r=e[e.length-1];r&&r[0]===t[0]&&r[1]===t[1]||e.push(t)}function _we(e,t,r){for(var n=e.length,a=[],i=0;io?(u.x=c.x=s+i/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+i),_we(t,u,c)}function Gb(e,t,r,n){if(r===1)n.push(t);else{var a=Math.floor(r/2),i=e(t);Gb(e,i[0],a,n),Gb(e,i[1],r-a,n)}return n}function bwe(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 Wb(e){var t=1/0,r=1/0,n=-1/0,a=-1/0,i=oe(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),a=Math.max(h,a),[c,h]}),o=oe(i,function(s,l){return{cp:s,z:Lwe(s[0],s[1],t,r,n,a),path:e[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function cZ(e){return Cwe(e.path,e.count)}function fN(){return{fromIndividuals:[],toIndividuals:[],count:0}}function Iwe(e,t,r){var n=[];function a(C){for(var M=0;M=0;a--)if(!r[a].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var i=l.length,u=Math.ceil(i/2);r[a].many=l.slice(u,i),r[s].many=l.slice(0,u),s++}return r}var Dwe={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=te({setToFinal:!0},o),u,c;NB(e)&&(u=e,c=t),NB(t)&&(u=t,c=e);function h(x,_,w,S,C){var M=x.many,A=x.one;if(M.length===1&&!C){var I=_?M[0]:A,k=_?A:M[0];if(Hb(I))h({many:[I],one:k},!0,w,S,!0);else{var P=s?Ee({delay:s(w,S)},l):l;bP(I,k,P),i(I,k,I,k,P)}}else for(var D=Ee({dividePath:Dwe[r],individualDelay:s&&function(U,F,W,$){return s(U+w,S)}},l),z=_?Iwe(M,A,D):Pwe(A,M,D),j=z.fromIndividuals,B=z.toIndividuals,H=j.length,V=0;Vt.length,v=u?kB(c,u):kB(f?t:e,[f?e:t]),g=0,m=0;mhZ))for(var i=n.getIndices(),o=0;o0&&M.group.traverse(function(I){I instanceof pt&&!I.animators.length&&I.animateFrom({style:{opacity:0}},A)})})}function jB(e){var t=e.getModel("universalTransition").get("seriesKey");return t||e.id}function EB(e){return ae(e)?e.sort().join(","):e}function Cl(e){if(e.hostModel)return e.hostModel.getModel("universalTransition").get("divideShape")}function Fwe(e,t){var r=we(),n=we(),a=we();return R(e.oldSeries,function(i,o){var s=e.oldDataGroupIds[o],l=e.oldData[o],u=jB(i),c=EB(u);n.set(c,{dataGroupId:s,data:l}),ae(u)&&R(u,function(h){a.set(h,{key:c,dataGroupId:s,data:l})})}),R(t.updatedSeries,function(i){if(i.isUniversalTransitionEnabled()&&i.isAnimationEnabled()){var o=i.get("dataGroupId"),s=i.getData(),l=jB(i),u=EB(l),c=n.get(u);if(c)r.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:Cl(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:Cl(s),data:s}]});else if(ae(l)){var h=[];R(l,function(g){var m=n.get(g);m.data&&h.push({dataGroupId:m.dataGroupId,divide:Cl(m.data),data:m.data})}),h.length&&r.set(u,{oldSeries:h,newSeries:[{dataGroupId:o,data:s,divide:Cl(s)}]})}else{var f=a.get(l);if(f){var v=r.get(f.key);v||(v={oldSeries:[{dataGroupId:f.dataGroupId,data:f.data,divide:Cl(f.data)}],newSeries:[]},r.set(f.key,v)),v.newSeries.push({dataGroupId:o,data:s,divide:Cl(s)})}}}}),r}function RB(e,t){for(var r=0;r=0&&a.push({dataGroupId:t.oldDataGroupIds[s],data:t.oldData[s],divide:Cl(t.oldData[s]),groupIdDim:o.dimension})}),R(Zt(e.to),function(o){var s=RB(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();i.push({dataGroupId:t.oldDataGroupIds[s],data:l,divide:Cl(l),groupIdDim:o.dimension})}}),a.length>0&&i.length>0&&dZ(a,i,n)}function Gwe(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){R(Zt(n.seriesTransition),function(a){R(Zt(a.to),function(i){for(var o=n.updatedSeries,s=0;ss.vmin?n+=s.vmin-a+(t-s.vmin)/(s.vmax-s.vmin)*s.gapReal:n+=t-a,a=s.vmax,i=!1;break}n+=s.vmin-a+s.gapReal,a=s.vmax}return i&&(n+=t-a),n},transformOut:function(t,r){if(r&&r.depth===Ps)return t;for(var n=OB,a=zB,i=!0,o=0,s=0;su?o=l.vmin+(t-u)/(c-u)*(l.vmax-l.vmin):o=a+t-n,a=l.vmax,i=!1;break}n=c,a=l.vmax}return i&&(o=a+t-n),o}},e}();function Uwe(e,t){return new Hwe(e,t)}var OB=0,zB=0;function Wwe(e,t){var r=0,n={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},a=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},i={S:{tpAbs:a(),tpPrct:a()},E:{tpAbs:a(),tpPrct:a()}};R(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(r+=l.val);var u=wP(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 v=c?"S":"E";i[v][l.type].has=!0,i[v][l.type].span=f,i[v][l.type].inExtFrac=f/(s.vmax-s.vmin),i[v][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)+(i.S.tpAbs.has?(i.S.tpAbs.val-i.S.tpAbs.span)*i.S.tpAbs.inExtFrac:0)+(i.E.tpAbs.has?(i.E.tpAbs.val-i.E.tpAbs.span)*i.E.tpAbs.inExtFrac:0)-n.tpPrct.span-(i.S.tpPrct.has?i.S.tpPrct.span*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.span*i.E.tpPrct.inExtFrac:0))/(1-n.tpPrct.val-(i.S.tpPrct.has?i.S.tpPrct.val*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.val*i.E.tpPrct.inExtFrac:0));R(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(s.gapReal=r!==0?at(o,0)*l.val/r:0),l.type==="tpAbs"&&(s.gapReal=l.val),s.gapReal==null&&(s.gapReal=0)})}function $we(e,t,r,n,a,i){e!=="no"&&R(r,function(o){var s=wP(o,i);if(s)for(var l=t.length-1;l>=0;l--){var u=t[l],c=n(u),h=a*3/4;c>s.vmin-h&&ct[0]&&r=0&&o<1-1e-5}R(e,function(o){if(!(!o||o.start==null||o.end==null)&&!o.isExpanded){var s={breakOption:ke(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(ve(o.gap)){var u=ka(o.gap);if(u.match(/%$/)){var c=parseFloat(u)/100;a(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&&R(["vmin","vmax"],function(v){s[v]<0&&(s[v]=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 i=-1/0;return R(n,function(o,s){i>o.vmin&&(n[s]=null),i=o.vmax}),{breaks:It(n,function(o){return!!o})}}function SP(e,t){return pN(t)===pN(e)}function pN(e){return e.start+"_\0_"+e.end}function Ywe(e,t,r){var n=[];R(e,function(i,o){var s=t(i);s&&s.type==="vmin"&&n.push([o])}),R(e,function(i,o){var s=t(i);if(s&&s.type==="vmax"){var l=Ks(n,function(u){return SP(t(e[u[0]]).parsedBreak.breakOption,s.parsedBreak.breakOption)});l&&l.push(o)}});var a=[];return R(n,function(i){i.length===2&&a.push(r?i:[e[i[0]],e[i[1]]])}),a}function Xwe(e,t,r,n){if(t.break){var a=t.break.parsedBreak,i=Ks(r,function(c){return SP(c.breakOption,t.break.parsedBreak.breakOption)}),o={lookup:n,depth:Ps},s=e.transformOut(a.vmin,o),l=e.transformOut(a.vmax,o),u={vmin:s,vmax:l,breakOption:a.breakOption,gapParsed:ke(i.gapParsed),gapReal:a.gapReal};return{tickVal:u[t.break.type],vBreak:{type:t.break.type,parsedBreak:u}}}}function qwe(e,t,r,n,a){a.original=vN(e,t,r);var i=a.transformed=vN(e,t,r),o=a.lookup;i.breaks=oe(i.breaks,function(s,l){var u={depth:Ps},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 Kwe={vmin:"start",vmax:"end"};function Jwe(e,t){return t&&(e=e||{},e.break={type:Kwe[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function Qwe(){Jne({createBreakScaleMapper:Uwe,pruneTicksByBreak:$we,addBreaksToTicks:Zwe,parseAxisBreakOption:vN,identifyAxisBreak:SP,serializeAxisBreakIdentifier:pN,retrieveAxisBreakPairs:Ywe,getTicksBreakOutwardTransform:Xwe,parseAxisBreakOptionInwardTransform:qwe,makeAxisLabelFormatterParamBreak:Jwe})}var BB=Qe();function eSe(e,t){var r=Ks(e,function(n){return Mr().identifyAxisBreak(n.parsedBreak.breakOption,t.breakOption)});return r||e.push(r={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),r}function tSe(e){R(e,function(t){return t.shouldRemove=!0})}function rSe(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function nSe(e,t,r,n,a){var i=r.axis;if(i.scale.isBlank()||!Mr())return;var o=Mr().retrieveAxisBreakPairs(i.scale.getTicks({breakTicks:"only_break"}),function(k){return k.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"),v=s.getModel("itemStyle"),g=v.getItemStyle(),m=g.stroke,y=g.lineWidth,x=g.lineDash,_=g.fill,w=new De({ignoreModelZ:!0}),S=i.isHorizontal(),C=BB(t).visualList||(BB(t).visualList=[]);tSe(C);for(var M=function(k){var P=o[k][0].break.parsedBreak,D=[];D[0]=i.toGlobalCoord(i.dataToCoord(P.vmin,!0)),D[1]=i.toGlobalCoord(i.dataToCoord(P.vmax,!0)),D[1]=F;de&&(re=F);var He=[],ye=[];He[V]=D,ye[V]=z,!le&&!de&&(He[V]+=J?-l:l,ye[V]-=J?l:-l),He[U]=re,ye[U]=re,$.push(He),Z.push(ye);var ne=void 0;if(Q_[1]&&_.reverse(),{coordPair:_,brkId:Mr().serializeAxisBreakIdentifier(x.breakOption)}});l.sort(function(y,x){return y.coordPair[0]-x.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,v=Math.min(f,f-c.x),g=Math.max(f,f-c.x),m=g<0?g:v>0?v:0;s=(f-m)/c.x}var y=new Oe,x=new Oe;Oe.scale(y,n,-s),Oe.scale(x,n,1-s),vA(r[0],y),vA(r[1],x)}function oSe(e,t){var r={breaks:[]};return R(t.breaks,function(n){if(n){var a=Ks(e.get("breaks",!0),function(s){return Mr().identifyAxisBreak(s,n)});if(a){var i=t.type,o={isExpanded:!!a.isExpanded};a.isExpanded=i===ew?!0:i===n8?!1:i===a8?!a.isExpanded:a.isExpanded,r.breaks.push({start:a.start,end:a.end,isExpanded:!!a.isExpanded,old:o})}}}),r}function sSe(){Sce({adjustBreakLabelPair:iSe,buildAxisBreakLine:aSe,rectCoordBuildBreakAxis:nSe,updateModelAxisBreak:oSe})}function lSe(e){Ace(e),Qwe(),sSe()}function uSe(){Hhe(cSe)}function cSe(e,t){R(e,function(r){if(!r.model.get(["axisLabel","inside"])){var n=hSe(r);if(n){var a=r.isHorizontal()?"height":"width",i=r.model.get(["axisLabel","margin"]);t[a]-=n[a]+i,r.position==="top"?t.y+=n.height+i:r.position==="left"&&(t.x+=n.width+i)}}})}function hSe(e){var t=e.model,r=e.scale;if(!t.get(["axisLabel","show"])||r.isBlank())return;var n,a,i=r.getExtent();r instanceof sm?a=r.count():(n=r.getTicks(),a=n.length);var o=e.getLabelModel(),s=Jm(e),l,u=1;a>40&&(u=Math.ceil(a/40));for(var c=0;c1&&arguments[1]!==void 0?arguments[1]:60,a=null;return function(){for(var i=this,o=arguments.length,s=new Array(o),l=0;l12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function NSe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function kSe(e){return e==="ROUTER"||e==="ROUTER_LATE"?30:e==="REPEATER"||e==="TRACKER"?25:e==="CLIENT_MUTE"?7:e==="CLIENT_BASE"?12:15}function LSe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const a=E.useRef(null),[i,o]=E.useState("connected"),s=E.useMemo(()=>{const y=new Set;return t.forEach(x=>{y.add(x.from_node),y.add(x.to_node)}),y},[t]),l=E.useMemo(()=>{let y=e;return i==="connected"?y=y.filter(x=>s.has(x.node_num)):i==="infra"&&(y=y.filter(x=>GB.includes(x.role))),y},[e,i,s]),u=E.useMemo(()=>new Map(l.map(y=>[y.node_num,y])),[l]),c=E.useMemo(()=>t.filter(y=>u.has(y.from_node)&&u.has(y.to_node)),[t,u]),h=E.useMemo(()=>{const y=new Set;return r!==null&&c.forEach(x=>{x.from_node===r&&y.add(x.to_node),x.to_node===r&&y.add(x.from_node)}),y},[r,c]),f=E.useMemo(()=>{const y=l.map(_=>{const w=NSe(_.latitude),S=VB[w%VB.length],C=GB.includes(_.role),M=_.node_num===r,A=h.has(_.node_num),I=r===null||M||A;return{id:String(_.node_num),name:_.short_name,value:_.node_num,symbolSize:kSe(_.role),itemStyle:{color:C?S:"#111827",borderColor:S,borderWidth:C?0:2,opacity:I?1:.15},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace",color:I?"#94a3b8":"#94a3b820"},nodeNum:_.node_num,longName:_.long_name,role:_.role}}),x=c.map(_=>{const w=r===null||_.from_node===r||_.to_node===r;return{source:String(_.from_node),target:String(_.to_node),value:_.snr,lineStyle:{color:ASe(_.snr),width:w&&r!==null?2:1,opacity:r===null?.4:w?.6:.04}}});return{nodes:y,links:x}},[l,c,r,h]),v=E.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 x=y.data;return`${x.name}
${x.longName}
Role: ${x.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=E.useCallback(y=>{if(y.data&&"nodeNum"in y.data){const x=y.data.nodeNum;n(r===x?null:x??null)}},[r,n]),m=E.useMemo(()=>({click:g}),[g]);return E.useEffect(()=>{var x;const y=(x=a.current)==null?void 0:x.getEchartsInstance();y&&y.setOption(v,{notMerge:!1,lazyUpdate:!0})},[v]),d.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[d.jsx(MSe,{ref:a,option:v,style:{height:"540px",width:"100%"},onEvents:m,opts:{renderer:"canvas"}}),d.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:[d.jsx(EV,{size:14,className:"text-slate-500"}),d.jsx("div",{className:"flex gap-1",children:[{key:"connected",label:"Connected"},{key:"infra",label:"Infra"},{key:"all",label:"All"}].map(({key:y,label:x})=>d.jsx("button",{onClick:()=>o(y),className:`px-2 py-1 text-xs rounded transition-colors ${i===y?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:x},y))}),d.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[l.length," nodes • ",c.length," edges"]})]}),d.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[d.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Edge Quality (SNR)"}),d.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=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:y.color}}),d.jsx("span",{className:"text-xs text-slate-500",children:y.label})]},y.label))})]}),d.jsxs("div",{className:"absolute bottom-4 right-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[d.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Node Type"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-3 h-3 rounded-full bg-sky-400"}),d.jsx("span",{className:"text-xs text-slate-500",children:"Infrastructure"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-900 border-2 border-sky-400"}),d.jsx("span",{className:"text-xs text-slate-500",children:"Client"})]})]})]})]})}function pZ(e,t){const r=E.useRef(t);E.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 ISe(e,t,r){t.center!==r.center&&e.setLatLng(t.center),t.radius!=null&&t.radius!==r.radius&&e.setRadius(t.radius)}const PSe=1;function DSe(e){return Object.freeze({__version:PSe,map:e})}function AP(e,t){return Object.freeze({...e,...t})}const gZ=E.createContext(null),mZ=gZ.Provider;function gw(){const e=E.useContext(gZ);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function jSe(e){function t(r,n){const{instance:a,context:i}=e(r).current;return E.useImperativeHandle(n,()=>a),r.children==null?null:bf.createElement(mZ,{value:i},r.children)}return E.forwardRef(t)}function ESe(e){function t(r,n){const[a,i]=E.useState(!1),{instance:o}=e(r,i).current;E.useImperativeHandle(n,()=>o),E.useEffect(function(){a&&o.update()},[o,a,r.children]);const s=o._contentNode;return s?pV.createPortal(r.children,s):null}return E.forwardRef(t)}function RSe(e){function t(r,n){const{instance:a}=e(r).current;return E.useImperativeHandle(n,()=>a),null}return E.forwardRef(t)}function NP(e,t){const r=E.useRef();E.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 mw(e,t){const r=e.pane??t.pane;return r?{...e,pane:r}:e}function OSe(e,t){return function(n,a){const i=gw(),o=e(mw(n,i),i);return pZ(i.map,n.attribution),NP(o.current,n.eventHandlers),t(o.current,i,n,a),o}}var yN={exports:{}};/* @preserve +`:"
",x=h.join(y);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(r,u)?this._updatePosition(s,v,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,x,u,Math.random()+"",o[0],o[1],v,null,f)})},t.prototype._showSeriesItemTooltip=function(r,n,a){var i=this._ecModel,o=Be(n),s=o.seriesIndex,l=i.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,h=o.dataType,f=u.getData(h),v=this._renderMode,g=r.positionDefault,m=Sp([f.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,g?{position:g}:null),y=m.get("trigger");if(!(y!=null&&y!=="item")){var x=u.getDataParams(c,h),_=new sC;x.marker=_.makeTooltipMarker("item",uh(x.color),v);var w=FR(u.formatTooltip(c,!1,h)),S=m.get("order"),C=m.get("valueFormatter"),M=w.frag,A=M?$R(C?te({valueFormatter:C},M):M,_,v,S,i.get("useUTC"),m.get("textStyle")):w.text,k="item_"+u.name+"_"+c;this._showOrMove(m,function(){this._showTooltipContent(m,A,x,k,r.offsetX,r.offsetY,r.position,r.target,_)}),a({type:"showTip",dataIndexInside:c,dataIndex:f.getRawIndex(c),seriesIndex:s,from:this.uid})}},t.prototype._showComponentItemTooltip=function(r,n,a){var i=this._renderMode==="html",o=Be(n),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(ve(l)){var c=l;l={content:c,formatter:c},u=!0}u&&i&&l.content&&(l=ke(l),l.content=On(l.content));var h=[l],f=this._ecModel.getComponent(o.componentMainType,o.componentIndex);f&&h.push(f),h.push({formatter:l.content});var v=r.positionDefault,g=Sp(h,this._tooltipModel,v?{position:v}:null),m=g.get("content"),y=Math.random()+"",x=new sC;this._showOrMove(g,function(){var _=ke(g.get("formatterParams")||{});this._showTooltipContent(g,m,_,y,r.offsetX,r.offsetY,r.position,n,x)}),a({type:"showTip",from:this.uid})},t.prototype._showTooltipContent=function(r,n,a,i,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 v=n,g=this._getNearestPoint([o,s],a,r.get("trigger"),r.get("borderColor"),r.get("defaultBorderColor",!0)),m=g.color;if(f)if(ve(f)){var y=r.ecModel.get("useUTC"),x=ae(a)?a[0]:a,_=x&&x.axisType&&x.axisType.indexOf("time")>=0;v=f,_&&(v=Zm(x.axisValue,v,y)),v=SL(v,a,!0)}else if(Le(f)){var w=be(function(S,C){S===this._ticket&&(h.setContent(C,c,r,m,l),this._updatePosition(r,l,o,s,h,a,u))},this);this._ticket=i,v=f(a,i,w)}else v=f;h.setContent(v,c,r,m,l),h.show(r,m),this._updatePosition(r,l,o,s,h,a,u)}},t.prototype._getNearestPoint=function(r,n,a,i,o){if(a==="axis"||ae(n))return{color:i||o};if(!ae(n))return{color:i||n.color||n.borderColor}},t.prototype._updatePosition=function(r,n,a,i,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"),v=r.get("verticalAlign"),g=l&&l.getBoundingRect().clone();if(l&&g.applyTransform(l.transform),Le(n)&&(n=n([a,i],s,o.el,g,{viewSize:[u,c],contentSize:h.slice()})),ae(n))a=me(n[0],u),i=me(n[1],c);else if(Re(n)){var m=n;m.width=h[0],m.height=h[1];var y=tr(m,{width:u,height:c});a=y.x,i=y.y,f=null,v=null}else if(ve(n)&&l){var x=Q_e(n,g,h,r.get("borderWidth"));a=x[0],i=x[1]}else{var x=K_e(a,i,o,u,c,f?null:20,v?null:20);a=x[0],i=x[1]}if(f&&(a-=jz(f)?h[0]/2:f==="right"?h[0]:0),v&&(i-=jz(v)?h[1]/2:v==="bottom"?h[1]:0),V$(r)){var x=J_e(a,i,o,u,c);a=x[0],i=x[1]}o.moveTo(a,i)},t.prototype._updateContentNotChangedOnAxis=function(r,n){var a=this._lastDataByCoordSys,i=this._cbParamsList,o=!!a&&a.length===r.length;return o&&R(a,function(s,l){var u=s.dataByAxis||[],c=r[l]||{},h=c.dataByAxis||[];o=o&&u.length===h.length,o&&R(u,function(f,v){var g=h[v]||{},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&&R(m,function(x,_){var w=y[_];o=o&&x.seriesIndex===w.seriesIndex&&x.dataIndex===w.dataIndex}),i&&R(f.seriesDataIndices,function(x){var _=x.seriesIndex,w=n[_],S=i[_];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){xt.node||!n.getDom()||(rm(this,"_updatePosition"),this._tooltipContent.dispose(),XA("itemTooltip",n),this._tooltipContent=null,this._tooltipModel=null,this._lastDataByCoordSys=null,this._cbParamsList=null)},t.type="tooltip",t}(Yt);function Sp(e,t,r){var n=t.ecModel,a;r?(a=new vt(r,n,n),a=new vt(t.option,a,n)):a=t;for(var i=e.length-1;i>=0;i--){var o=e[i];o&&(o instanceof vt&&(o=o.get("tooltip",!0)),ve(o)&&(o={formatter:o}),o&&(a=new vt(o,a,n)))}return a}function Dz(e,t){return e.dispatchAction||be(t.dispatchAction,t)}function K_e(e,t,r,n,a,i,o){var s=r.getSize(),l=s[0],u=s[1];return i!=null&&(e+l+i+2>n?e-=l+i:e+=i),o!=null&&(t+u+o>a?t-=u+o:t+=o),[e,t]}function J_e(e,t,r,n,a){var i=r.getSize(),o=i[0],s=i[1];return e=Math.min(e+o,n)-o,t=Math.min(t+s,a)-s,e=Math.max(e,0),t=Math.max(t,0),[e,t]}function Q_e(e,t,r,n){var a=r[0],i=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-a/2,l=t.y+c/2-i/2;break;case"top":s=t.x+u/2-a/2,l=t.y-i-o;break;case"bottom":s=t.x+u/2-a/2,l=t.y+c+o;break;case"left":s=t.x-a-o,l=t.y+c/2-i/2;break;case"right":s=t.x+u+o,l=t.y+c/2-i/2}return[s,l]}function jz(e){return e==="center"||e==="middle"}function ebe(e,t,r){var n=Hk(e).queryOptionMap,a=n.keys()[0];if(!(!a||a==="series")){var i=sv(t,a,n.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=i.models[0];if(o){var s=r.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=Be(u).tooltipConfig;if(c&&c.name===e.name)return l=u,!0}),l)return{componentMainType:a,componentIndex:o.componentIndex,el:l}}}}function tbe(e){rt(iy),e.registerComponentModel(O_e),e.registerComponentView(q_e),e.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},hr),e.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},hr)}var rbe=["rect","polygon","keep","clear"];function nbe(e,t){var r=Zt(e?e.brush:[]);if(r.length){var n=[];R(r,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(n=n.concat(u))});var a=e&&e.toolbox;ae(a)&&(a=a[0]),a||(a={feature:{}},e.toolbox=[a]);var i=a.feature||(a.feature={}),o=i.brush||(i.brush={}),s=o.type||(o.type=[]);s.push.apply(s,n),N1(s,function(l){return l+""},null),t&&!s.length&&s.push.apply(s,rbe)}}var Ez=R;function Rz(e){if(e){for(var t in e)if(e.hasOwnProperty(t))return!0}}function aN(e,t,r){var n={};return Ez(t,function(i){var o=n[i]=a();Ez(e[i],function(s,l){if(Kr.isValidType(l)){var u={type:l,visual:s};r&&r(u,i),o[l]=new Kr(u),l==="opacity"&&(u=ke(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new Kr(u))}})}),n;function a(){var i=function(){};i.prototype.__hidden=i.prototype;var o=new i;return o}}function W$(e,t,r){var n;R(r,function(a){t.hasOwnProperty(a)&&Rz(t[a])&&(n=!0)}),n&&R(r,function(a){t.hasOwnProperty(a)&&Rz(t[a])?e[a]=ke(t[a]):delete e[a]})}function abe(e,t,r,n,a,i){var o={};R(e,function(h){var f=Kr.prepareVisualTypes(t[h]);o[h]=f});var s;function l(h){return DL(r,s,h)}function u(h,f){uU(r,s,h,f)}r.each(c);function c(h,f){s=h;var v=r.getRawDataItem(s);if(!(v&&v.visualMap===!1))for(var g=n.call(a,h),m=t[g],y=o[g],x=0,_=y.length;x<_;x++){var w=y[x];m[w]&&m[w].applyVisual(h,l,u)}}}function ibe(e,t,r,n){var a={};return R(e,function(i){var o=Kr.prepareVisualTypes(t[i]);a[i]=o}),{progress:function(o,s){var l;n!=null&&(l=s.getDimensionIndex(n));function u(C){return DL(s,h,C)}function c(C,M){uU(s,h,C,M)}for(var h,f=s.getStore();(h=o.next())!=null;){var v=s.getRawDataItem(h);if(!(v&&v.visualMap===!1))for(var g=n!=null?f.get(l,h):h,m=r(g),y=t[m],x=a[m],_=0,w=x.length;_t[0][1]&&(t[0][1]=i[0]),i[1]t[1][1]&&(t[1][1]=i[1])}return t&&Vz(t)}};function Vz(e){return new je(e[0][0],e[1][0],e[0][1]-e[0][0],e[1][1]-e[1][0])}var fbe=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 zI(n.getZr())).on("brush",be(this._onBrush,this)).mount()},t.prototype.render=function(r,n,a,i){this.model=r,this._updateController(r,n,a,i)},t.prototype.updateTransform=function(r,n,a,i){$$(n),this._updateController(r,n,a,i)},t.prototype.updateVisual=function(r,n,a,i){this.updateTransform(r,n,a,i)},t.prototype.updateView=function(r,n,a,i){this._updateController(r,n,a,i)},t.prototype._updateController=function(r,n,a,i){(!i||i.$from!==r.id)&&this._brushController.setPanels(r.brushTargetManager.makePanelOpts(a)).enableBrush(r.brushOption).updateCovers(r.areas.slice())},t.prototype.dispose=function(){this._brushController.dispose()},t.prototype._onBrush=function(r){var n=this.model.id,a=this.model.brushTargetManager.setOutputRanges(r.areas,this.ecModel);(!r.isEnd||r.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:ke(a),$from:n}),r.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:n,areas:ke(a),$from:n})},t.type="brush",t}(Yt),vbe=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 a=this.option;!n&&W$(a,r,["inBrush","outOfBrush"]);var i=a.inBrush=a.inBrush||{};a.outOfBrush=a.outOfBrush||{color:this.option.defaultOutOfBrushColor},i.hasOwnProperty("liftZ")||(i.liftZ=5)},t.prototype.setAreas=function(r){r&&(this.areas=oe(r,function(n){return Gz(this.option,n)},this))},t.prototype.setBrushOption=function(r){this.brushOption=Gz(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}(ht);function Gz(e,t){return Je({brushType:e.brushType,brushMode:e.brushMode,transformable:e.transformable,brushStyle:new vt(e.brushStyle).getItemStyle(),removeOnClick:e.removeOnClick,z:e.z},t,!0)}var pbe=["rect","polygon","lineX","lineY","keep","clear"],gbe=function(e){q(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.render=function(r,n,a){var i,o,s;n.eachComponent({mainType:"brush"},function(l){i=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=i,this._brushMode=o,R(r.get("type",!0),function(l){r.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===i)?"emphasis":"normal")})},t.prototype.updateView=function(r,n,a){this.render(r,n,a)},t.prototype.getIcons=function(){var r=this.model,n=r.get("icon",!0),a={};return R(r.get("type",!0),function(i){n[i]&&(a[i]=n[i])}),a},t.prototype.onclick=function(r,n,a){var i=this._brushType,o=this._brushMode;a==="clear"?(n.dispatchAction({type:"axisAreaSelect",intervals:[]}),n.dispatchAction({type:"brush",command:"clear",areas:[]})):n.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:a==="keep"?i:i===a?!1:a,brushMode:a==="keep"?o==="multiple"?"single":"multiple":o}})},t.getDefaultOption=function(r){var n={show:!0,type:pbe.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}(Eo);function mbe(e){e.registerComponentView(fbe),e.registerComponentModel(vbe),e.registerPreprocessor(nbe),e.registerVisual(e.PRIORITY.VISUAL.BRUSH,sbe),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"},hr),e.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},hr),Rd("brush",gbe)}var ybe=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}(ht),xbe=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,a){if(this.group.removeAll(),!!r.get("show")){var i=this.group,o=r.getModel("textStyle"),s=r.getModel("subtextStyle"),l=r.get("textAlign"),u=Te(r.get("textBaseline"),r.get("textVerticalAlign")),c=new wt({style:$t(o,{text:r.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),h=c.getBoundingRect(),f=r.get("subtext"),v=new wt({style:$t(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,v.silent=!m&&!y,g&&c.on("click",function(){Z_(g,"_"+r.get("target"))}),m&&v.on("click",function(){Z_(m,"_"+r.get("subtarget"))}),Be(c).eventData=Be(v).eventData=y?{componentType:"title",componentIndex:r.componentIndex}:null,i.add(c),f&&i.add(v);var x=i.getBoundingRect(),_=r.getBoxLayoutParams();_.width=x.width,_.height=x.height;var w=Ur(r,a),S=tr(_,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"),i.x=S.x,i.y=S.y,i.markRedraw();var C={align:l,verticalAlign:u};c.setStyle(C),v.setStyle(C),x=i.getBoundingRect();var M=S.margin,A=r.getItemStyle(["color","opacity"]);A.fill=r.get("backgroundColor");var k=new it({shape:{x:x.x-M[3],y:x.y-M[0],width:x.width+M[1]+M[3],height:x.height+M[0]+M[2],r:r.get("borderRadius")},style:A,subPixelOptimize:!0,silent:!0});i.add(k)}},t.type="title",t}(Yt);function _be(e){e.registerComponentModel(ybe),e.registerComponentView(xbe)}var Hz=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,a){this.mergeDefaultAndTheme(r,a),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||[],a=r.axisType,i=this._names=[],o;a==="category"?(o=[],R(n,function(u,c){var h=Fr(ov(u),""),f;Re(u)?(f=ke(u),f.value=c):f=c,o.push(f),i.push(h)})):o=n;var s={category:"ordinal",time:"time",value:"number"}[a]||"number",l=this._data=new Fn([{name:"value",type:s}],this);l.initData(o,i)},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}(ht),Z$=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=Cu(Hz.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}(Hz);kr(Z$,H1.prototype);var bbe=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}(Yt),wbe=function(e){q(t,e);function t(r,n,a,i){var o=e.call(this,r,n,a)||this;return o.type=i||"value",o}return t.prototype.getLabelModel=function(){return this.model.getModel("label")},t.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},t}(Ci),D2=Math.PI,Uz=Qe(),Sbe=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,a){if(this.model=r,this.api=a,this.ecModel=n,this.group.removeAll(),r.get("show",!0)){var i=this._layout(r,a),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(i,r);r.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return Er("nameValue",{noName:!0,value:c})},R(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](i,o,l,r)},this),this._renderAxisLabel(i,s,l,r),this._position(i,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 a=r.get(["label","position"]),i=r.get("orient"),o=Cbe(r,n),s;a==null||a==="auto"?s=i==="horizontal"?o.y+o.height/2=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:D2/2},h=i==="vertical"?o.height:o.width,f=r.getModel("controlStyle"),v=f.get("show",!0),g=v?f.get("itemSize"):0,m=v?f.get("itemGap"):0,y=g+m,x=r.get(["label","rotate"])||0;x=x*D2/180;var _,w,S,C=f.get("position",!0),M=v&&f.get("showPlayBtn",!0),A=v&&f.get("showPrevBtn",!0),k=v&&f.get("showNextBtn",!0),I=0,P=h;C==="left"||C==="bottom"?(M&&(_=[0,0],I+=y),A&&(w=[I,0],I+=y),k&&(S=[P-g,0],P-=y)):(M&&(_=[P-g,0],P-=y),A&&(w=[0,0],I+=y),k&&(S=[P-g,0],P-=y));var j=[I,P];return r.get("inverse")&&j.reverse(),{viewRect:o,mainLength:h,orient:i,rotation:c[i],labelRotation:x,labelPosOpt:s,labelAlign:r.get(["label","align"])||l[i],labelBaseline:r.get(["label","verticalAlign"])||r.get(["label","baseline"])||u[i],playPosition:_,prevBtnPosition:w,nextBtnPosition:S,axisExtent:j,controlSize:g,controlGap:m}},t.prototype._position=function(r,n){var a=this._mainGroup,i=this._labelGroup,o=r.viewRect;if(r.orient==="vertical"){var s=ar(),l=o.x,u=o.y+o.height;Hi(s,s,[-l,-u]),Js(s,s,-D2/2),Hi(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=_(o),h=_(a.getBoundingRect()),f=_(i.getBoundingRect()),v=[a.x,a.y],g=[i.x,i.y];g[0]=v[0]=c[0][0];var m=r.labelPosOpt;if(m==null||ve(m)){var y=m==="+"?0:1;w(v,h,c,1,y),w(g,f,c,1,1-y)}else{var y=m>=0?0:1;w(v,h,c,1,y),g[1]=v[1]+m}a.setPosition(v),i.setPosition(g),a.rotation=i.rotation=r.rotation,x(a),x(i);function x(S){S.originX=c[0][0]-S.x,S.originY=c[1][0]-S.y}function _(S){return[[S.x,S.x+S.width],[S.y,S.y+S.height]]}function w(S,C,M,A,k){S[A]+=M[A][k]-C[A][k]}},t.prototype._createAxis=function(r,n){var a=n.getData(),i=n.get("axisType")||n.get("type");i!=="category"&&i!=="time"&&(i="value");var o=Sv(n,i,!1);o.getTicks=function(){return a.mapArray(["value"],function(u){return{value:u}})};var s=a.getDataExtent("value");o.setExtent(s[0],s[1]),dW(o,{fixMinMax:[!0,!0]});var l=new wbe("value",o,r.axisExtent,i);return l.model=n,l},t.prototype._createGroup=function(r){var n=this[r]=new De;return this.group.add(n),n},t.prototype._renderAxisLine=function(r,n,a,i){var o=a.getExtent();if(i.get(["lineStyle","show"])){var s=new Tr({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:te({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});n.add(s);var l=this._progressLine=new Tr({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:Ee({lineCap:"round",lineWidth:s.style.lineWidth},i.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});n.add(l)}},t.prototype._renderAxisTick=function(r,n,a,i){var o=this,s=i.getData(),l=a.scale.getTicks();this._tickSymbols=[],R(l,function(u){var c=a.dataToCoord(u.value),h=s.getItemModel(u.value),f=h.getModel("itemStyle"),v=h.getModel(["emphasis","itemStyle"]),g=h.getModel(["progress","itemStyle"]),m={x:c,y:0,onclick:be(o._changeTimeline,o,u.value)},y=Wz(h,f,n,m);y.ensureState("emphasis").style=v.getItemStyle(),y.ensureState("progress").style=g.getItemStyle(),ql(y);var x=Be(y);h.get("tooltip")?(x.dataIndex=u.value,x.dataModel=i):x.dataIndex=x.dataModel=null,o._tickSymbols.push(y)})},t.prototype._renderAxisLabel=function(r,n,a,i){var o=this,s=a.getLabelModel();if(s.get("show")){var l=i.getData(),u=a.getViewLabels();this._tickLabels=[],R(u,function(c){if(!c.tick.offInterval){var h=c.tick.value,f=l.getItemModel(h),v=f.getModel("label"),g=f.getModel(["emphasis","label"]),m=f.getModel(["progress","label"]),y=a.dataToCoord(h),x=new wt({x:y,y:0,rotation:r.labelRotation-r.rotation,onclick:be(o._changeTimeline,o,h),silent:!1,style:$t(v,{text:c.formattedLabel,align:r.labelAlign,verticalAlign:r.labelBaseline})});x.ensureState("emphasis").style=$t(g),x.ensureState("progress").style=$t(m),n.add(x),ql(x),Uz(x).dataIndex=h,o._tickLabels.push(x)}})}},t.prototype._renderControl=function(r,n,a,i){var o=r.controlSize,s=r.rotation,l=i.getModel("controlStyle").getItemStyle(),u=i.getModel(["emphasis","controlStyle"]).getItemStyle(),c=i.getPlayState(),h=i.get("inverse",!0);f(r.nextBtnPosition,"next",be(this._changeTimeline,this,h?"-":"+")),f(r.prevBtnPosition,"prev",be(this._changeTimeline,this,h?"+":"-")),f(r.playPosition,c?"stop":"play",be(this._handlePlayClick,this,!c),!0);function f(v,g,m,y){if(v){var x=Bo(Te(i.get(["controlStyle",g+"BtnSize"]),o),o),_=[0,-x/2,x,x],w=Tbe(i,g+"Icon",_,{x:v[0],y:v[1],originX:o/2,originY:0,rotation:y?-s:0,rectHover:!0,style:l,onclick:m});w.ensureState("emphasis").style=u,n.add(w),ql(w)}}},t.prototype._renderCurrentPointer=function(r,n,a,i){var o=i.getData(),s=i.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(h){h.draggable=!0,h.drift=be(u._handlePointerDrag,u),h.ondragend=be(u._handlePointerDragend,u),$z(h,u._progressLine,s,a,i,!0)},onUpdate:function(h){$z(h,u._progressLine,s,a,i)}};this._currentPointer=Wz(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,a){this._clearTimer(),this._pointerChangeTimeline([a.offsetX,a.offsetY])},t.prototype._handlePointerDragend=function(r){this._pointerChangeTimeline([r.offsetX,r.offsetY],!0)},t.prototype._pointerChangeTimeline=function(r,n){var a=this._toAxisCoord(r)[0],i=this._axis,o=on(i.getExtent().slice());a>o[1]&&(a=o[1]),a=0&&(s[o]=+s[o].toFixed(g)),[s,v]}var ax={min:nt(nx,"min"),max:nt(nx,"max"),average:nt(nx,"average"),median:nt(nx,"median")};function Am(e,t){if(t){var r=e.getData(),n=e.coordinateSystem,a=n&&n.dimensions;if(!Ibe(t)&&!ae(t.coord)&&ae(a)){var i=Y$(t,r,n,e);if(t=ke(t),t.type&&ax[t.type]&&i.baseAxis&&i.valueAxis){var o=Ye(a,i.baseAxis.dim),s=Ye(a,i.valueAxis.dim),l=ax[t.type](r,i.valueAxis.dim,i.baseDataDim,i.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||!ae(a)){t.coord=[];var u=e.getBaseAxis();if(u&&t.type&&ax[t.type]){var c=n.getOtherAxis(u);c&&(t.value=zb(r,r.mapDimension(c.dim),t.type))}}else for(var h=t.coord,f=0;f<2;f++)ax[h[f]]&&(h[f]=zb(r,r.mapDimension(a[f]),h[f]));return t}}function Y$(e,t,r,n){var a={};return e.valueIndex!=null||e.valueDim!=null?(a.valueDataDim=e.valueIndex!=null?t.getDimension(e.valueIndex):e.valueDim,a.valueAxis=r.getAxis(Pbe(n,a.valueDataDim)),a.baseAxis=r.getOtherAxis(a.valueAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim)):(a.baseAxis=n.getBaseAxis(),a.valueAxis=r.getOtherAxis(a.baseAxis),a.baseDataDim=t.mapDimension(a.baseAxis.dim),a.valueDataDim=t.mapDimension(a.valueAxis.dim)),a}function Pbe(e,t){var r=e.getData().getDimensionInfo(t);return r&&r.coordDim}function Nm(e,t){return e&&e.containData&&t.coord&&!oN(t)?e.containData(t.coord):!0}function Dbe(e,t,r){return e&&e.containZone&&t.coord&&r.coord&&!oN(t)&&!oN(r)?e.containZone(t.coord,r.coord):!0}function X$(e,t){return e?function(r,n,a,i){var o=i<2?r.coord&&r.coord[i]:r.value;return Kl(o,t[i])}:function(r,n,a,i){return Kl(r.value,t[i])}}function zb(e,t,r){if(r==="average"){var n=0,a=0;return e.each(t,function(i,o){isNaN(i)||(n+=i,a++)}),n/a}else return r==="median"?e.getMedian(t):e.getDataExtent(t)[r==="max"?1:0]}var j2=Qe(),xP=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=we()},t.prototype.render=function(r,n,a){var i=this,o=this.markerGroupMap;o.each(function(s){j2(s).keep=!1}),n.eachSeries(function(s){var l=Zo.getMarkerModelFromSeries(s,i.type);l&&i.renderSeries(s,l,n,a)}),o.each(function(s){!j2(s).keep&&i.group.remove(s.group)}),jbe(n,o,this.type)},t.prototype.markKeep=function(r){j2(r).keep=!0},t.prototype.toggleBlurSeries=function(r,n){var a=this;R(r,function(i){var o=Zo.getMarkerModelFromSeries(i,a.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(n?S7(l):Jk(l))})}})},t.type="marker",t}(Yt);function jbe(e,t,r){e.eachSeries(function(n){var a=Zo.getMarkerModelFromSeries(n,r),i=t.get(n.id);if(a&&i&&i.group){var o=lh(a),s=o.z,l=o.zlevel;z1(i.group,s,l)}})}function Yz(e,t,r){var n=t.coordinateSystem,a=r.getWidth(),i=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:a,h=u?o?o.height:0:i,f=u&&o?o.x:0,v=u&&o?o.y:0,g,m=me(l.get("x"),c)+f,y=me(l.get("y"),h)+v;if(!isNaN(m)&&!isNaN(y))g=[m,y];else if(t.getMarkerPosition)g=t.getMarkerPosition(e.getValues(e.dimensions,s));else if(n){var x=e.get(n.dimensions[0],s),_=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 Ebe=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,a){n.eachSeries(function(i){var o=Zo.getMarkerModelFromSeries(i,"markPoint");o&&(Yz(o.getData(),i,a),this.markerGroupMap.get(i.id).updateLayout())},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new ty),h=Rbe(o,r,n);n.setData(h),Yz(n.getData(),r,i),h.each(function(f){var v=h.getItemModel(f),g=v.getShallow("symbol"),m=v.getShallow("symbolSize"),y=v.getShallow("symbolRotate"),x=v.getShallow("symbolOffset"),_=v.getShallow("symbolKeepAspect");if(Le(g)||Le(m)||Le(y)||Le(x)){var w=n.getRawValue(f),S=n.getDataParams(f);Le(g)&&(g=g(w,S)),Le(m)&&(m=m(w,S)),Le(y)&&(y=y(w,S)),Le(x)&&(x=x(w,S))}var C=v.getModel("itemStyle").getItemStyle(),M=v.get("z2"),A=Xm(l,"color");C.fill||(C.fill=A),h.setItemVisual(f,{z2:Te(M,0),symbol:g,symbolSize:m,symbolRotate:y,symbolOffset:x,symbolKeepAspect:_,style:C})}),c.updateData(h),this.group.add(c.group),h.eachItemGraphicEl(function(f){f.traverse(function(v){Be(v).dataModel=n})}),this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markPoint",t}(xP);function Rbe(e,t,r){var n;e?n=oe(e&&e.dimensions,function(s){var l=t.getData(),u=l.getDimensionInfo(l.mapDimension(s))||{};return te(te({},u),{name:s,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Fn(n,r),i=oe(r.get("data"),nt(Am,t));e&&(i=It(i,nt(Nm,e)));var o=X$(!!e,n);return a.initData(i,null,o),a}function Obe(e){e.registerComponentModel(Lbe),e.registerComponentView(Ebe),e.registerPreprocessor(function(t){yP(t.series,"markPoint")&&(t.markPoint=t.markPoint||{})})}var zbe=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,a){return new t(r,n,a)},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}(Zo),ix=Qe(),Bbe=function(e,t,r,n){var a=e.getData(),i;if(ae(n))i=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=zn(n.yAxis,n.xAxis);else{var u=Y$(n,a,t,e);s=u.valueAxis;var c=ZL(a,u.valueDataDim);l=zb(a,c,o)}var h=s.dim==="x"?0:1,f=1-h,v=ke(n),g={coord:[]};v.type=null,v.coord=[],v.coord[f]=-1/0,g.coord[f]=1/0;var m=r.get("precision");m>=0&&Tt(l)&&(l=+l.toFixed(Math.min(m,20))),v.coord[h]=g.coord[h]=l,i=[v,g,{type:o,valueIndex:n.valueIndex,value:l}]}else i=[]}var y=[Am(e,i[0]),Am(e,i[1]),te({},i[2])];return y[2].type=y[2].type||null,Je(y[2],y[0]),Je(y[2],y[1]),y};function Bb(e){return!isNaN(e)&&!isFinite(e)}function Xz(e,t,r,n){var a=1-e,i=n.dimensions[e];return Bb(t[a])&&Bb(r[a])&&t[e]===r[e]&&n.getAxis(i).containData(t[e])}function Fbe(e,t){if(e.type==="cartesian2d"){var r=t[0].coord,n=t[1].coord;if(r&&n&&(Xz(1,r,n,e)||Xz(0,r,n,e)))return!0}return Nm(e,t[0])&&Nm(e,t[1])}function E2(e,t,r,n,a){var i=n.coordinateSystem,o=e.getItemModel(t),s,l=me(o.get("x"),a.getWidth()),u=me(o.get("y"),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition)s=n.getMarkerPosition(e.getValues(e.dimensions,t));else{var c=i.dimensions,h=e.get(c[0],t),f=e.get(c[1],t);s=i.dataToPoint([h,f])}if(ph(i,"cartesian2d")){var v=i.getAxis("x"),g=i.getAxis("y"),c=i.dimensions;Bb(e.get(c[0],t))?s[0]=v.toGlobalCoord(v.getExtent()[r?0:1]):Bb(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 Vbe=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,a){n.eachSeries(function(i){var o=Zo.getMarkerModelFromSeries(i,"markLine");if(o){var s=o.getData(),l=ix(o).from,u=ix(o).to;l.each(function(c){E2(l,c,!0,i,a),E2(u,c,!1,i,a)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(i.id).updateLayout()}},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new OI);this.group.add(c.group);var h=Gbe(o,r,n),f=h.from,v=h.to,g=h.line;ix(n).from=f,ix(n).to=v,n.setData(g);var m=n.get("symbol"),y=n.get("symbolSize"),x=n.get("symbolRotate"),_=n.get("symbolOffset");ae(m)||(m=[m,m]),ae(y)||(y=[y,y]),ae(x)||(x=[x,x]),ae(_)||(_=[_,_]),h.from.each(function(S){w(f,S,!0),w(v,S,!1)}),g.each(function(S){var C=g.getItemModel(S),M=C.getModel("lineStyle").getLineStyle();g.setItemLayout(S,[f.getItemLayout(S),v.getItemLayout(S)]);var A=C.get("z2");M.stroke==null&&(M.stroke=f.getItemVisual(S,"style").fill),g.setItemVisual(S,{z2:Te(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:v.getItemVisual(S,"symbolKeepAspect"),toSymbolOffset:v.getItemVisual(S,"symbolOffset"),toSymbolRotate:v.getItemVisual(S,"symbolRotate"),toSymbolSize:v.getItemVisual(S,"symbolSize"),toSymbol:v.getItemVisual(S,"symbol"),style:M})}),c.updateData(g),h.line.eachItemGraphicEl(function(S){Be(S).dataModel=n,S.traverse(function(C){Be(C).dataModel=n})});function w(S,C,M){var A=S.getItemModel(C);E2(S,C,M,r,i);var k=A.getModel("itemStyle").getItemStyle();k.fill==null&&(k.fill=Xm(l,"color")),S.setItemVisual(C,{symbolKeepAspect:A.get("symbolKeepAspect"),symbolOffset:Te(A.get("symbolOffset",!0),_[M?0:1]),symbolRotate:Te(A.get("symbolRotate",!0),x[M?0:1]),symbolSize:Te(A.get("symbolSize"),y[M?0:1]),symbol:Te(A.get("symbol",!0),m[M?0:1]),style:k})}this.markKeep(c),c.group.silent=n.get("silent")||r.get("silent")},t.type="markLine",t}(xP);function Gbe(e,t,r){var n;e?n=oe(e&&e.dimensions,function(u){var c=t.getData(),h=c.getDimensionInfo(c.mapDimension(u))||{};return te(te({},h),{name:u,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Fn(n,r),i=new Fn(n,r),o=new Fn([],r),s=oe(r.get("data"),nt(Bbe,t,e,r));e&&(s=It(s,nt(Fbe,e)));var l=X$(!!e,n);return a.initData(oe(s,function(u){return u[0]}),null,l),i.initData(oe(s,function(u){return u[1]}),null,l),o.initData(oe(s,function(u){return u[2]})),o.hasItemOption=!0,{from:a,to:i,line:o}}function Hbe(e){e.registerComponentModel(zbe),e.registerComponentView(Vbe),e.registerPreprocessor(function(t){yP(t.series,"markLine")&&(t.markLine=t.markLine||{})})}var Ube=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,a){return new t(r,n,a)},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}(Zo),ox=Qe(),Wbe=function(e,t,r,n){var a=n[0],i=n[1];if(!(!a||!i)){var o=Am(e,a),s=Am(e,i),l=o.coord,u=s.coord;l[0]=zn(l[0],-1/0),l[1]=zn(l[1],-1/0),u[0]=zn(u[0],1/0),u[1]=zn(u[1],1/0);var c=y1([{},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 Fb(e){return!isNaN(e)&&!isFinite(e)}function qz(e,t,r,n){var a=1-e;return Fb(t[a])&&Fb(r[a])}function $be(e,t){var r=t.coord[0],n=t.coord[1],a={coord:r,x:t.x0,y:t.y0},i={coord:n,x:t.x1,y:t.y1};return ph(e,"cartesian2d")?r&&n&&(qz(1,r,n)||qz(0,r,n))?!0:Dbe(e,a,i):Nm(e,a)||Nm(e,i)}function Kz(e,t,r,n,a){var i=n.coordinateSystem,o=e.getItemModel(t),s,l=me(o.get(r[0]),a.getWidth()),u=me(o.get(r[1]),a.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=i.clampData(c),v=i.clampData(h),g=[];r[0]==="x0"?g[0]=f[0]>v[0]?h[0]:c[0]:g[0]=f[0]>v[0]?c[0]:h[0],r[1]==="y0"?g[1]=f[1]>v[1]?h[1]:c[1]:g[1]=f[1]>v[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),x=[m,y];i.clampData&&i.clampData(x,x),s=i.dataToPoint(x,!0)}if(ph(i,"cartesian2d")){var _=i.getAxis("x"),w=i.getAxis("y"),m=e.get(r[0],t),y=e.get(r[1],t);Fb(m)?s[0]=_.toGlobalCoord(_.getExtent()[r[0]==="x0"?0:1]):Fb(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 Jz=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],Zbe=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,a){n.eachSeries(function(i){var o=Zo.getMarkerModelFromSeries(i,"markArea");if(o){var s=o.getData();s.each(function(l){var u=oe(Jz,function(h){return Kz(s,l,h,i,a)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},t.prototype.renderSeries=function(r,n,a,i){var o=r.coordinateSystem,s=r.id,l=r.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new De});this.group.add(c.group),this.markKeep(c);var h=Ybe(o,r,n);n.setData(h),h.each(function(f){var v=oe(Jz,function(P){return Kz(h,f,P,r,i)}),g=o.getAxis("x").scale,m=o.getAxis("y").scale,y=g.getExtent(),x=m.getExtent(),_=[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))];on(_),on(w);var S=!(y[0]>_[1]||y[1]<_[0]||x[0]>w[1]||x[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}(ht),Ad=nt,lN=R,sx=De,q$=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 sx),this.group.add(this._selectorGroup=new sx),this._isFirstRender=!0},t.prototype.getContentGroup=function(){return this._contentGroup},t.prototype.getSelectorGroup=function(){return this._selectorGroup},t.prototype.render=function(r,n,a){var i=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,a,l,s,u);var c=Ur(r,a).refContainer,h=r.getBoxLayoutParams(),f=r.get("padding"),v=tr(h,c,f),g=this.layoutInner(r,o,v,i,l,u),m=tr(Ee({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=z$(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,a,i,o,s,l){var u=this.getContentGroup(),c=we(),h=n.get("selectedMode"),f=n.get("triggerEvent"),v=[];a.eachRawSeries(function(g){!g.get("legendHoverLink")&&v.push(g.id)}),lN(n.getData(),function(g,m){var y=this,x=g.get("name");if(!this.newlineDisabled&&(x===""||x===` +`)){var _=new sx;_.newline=!0,u.add(_);return}var w=a.getSeriesByName(x)[0];if(!c.get(x))if(w){var S=w.getData(),C=S.getVisual("legendLineStyle")||{},M=S.getVisual("legendIcon"),A=S.getVisual("style"),k=this._createItem(w,x,m,g,n,r,C,A,M,h,i);k.on("click",Ad(Qz,x,null,i,v)).on("mouseover",Ad(uN,w.name,null,i,v)).on("mouseout",Ad(cN,w.name,null,i,v)),a.ssr&&k.eachChild(function(I){var P=Be(I);P.seriesIndex=w.seriesIndex,P.dataIndex=m,P.ssrType="legend"}),f&&k.eachChild(function(I){y.packEventData(I,n,w,m,x)}),c.set(x,!0)}else a.eachRawSeries(function(I){var P=this;if(!c.get(x)&&I.legendVisualProvider){var j=I.legendVisualProvider;if(!j.containName(x))return;var z=j.indexOfName(x),D=j.getItemVisual(z,"style"),B=j.getItemVisual(z,"legendIcon"),H=Bn(D.fill);H&&H[3]===0&&(H[3]=.2,D=te(te({},D),{fill:ci(H,"rgba")}));var V=this._createItem(I,x,m,g,n,r,{},D,B,h,i);V.on("click",Ad(Qz,null,x,i,v)).on("mouseover",Ad(uN,null,x,i,v)).on("mouseout",Ad(cN,null,x,i,v)),a.ssr&&V.eachChild(function(U){var F=Be(U);F.seriesIndex=I.seriesIndex,F.dataIndex=m,F.ssrType="legend"}),f&&V.eachChild(function(U){P.packEventData(U,n,I,m,x)}),c.set(x,!0)}},this)},this),o&&this._createSelector(o,n,i,s,l)},t.prototype.packEventData=function(r,n,a,i,o){var s={componentType:"legend",componentIndex:n.componentIndex,dataIndex:i,value:o,seriesIndex:a.seriesIndex};Be(r).eventData=s},t.prototype._createSelector=function(r,n,a,i,o){var s=this.getSelectorGroup();lN(r,function(u){var c=u.type,h=new wt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect",legendId:n.id})}});s.add(h);var f=n.getModel("selectorLabel"),v=n.getModel(["emphasis","selectorLabel"]);Jr(h,{normal:f,emphasis:v},{defaultText:u.title}),ql(h)})},t.prototype._createItem=function(r,n,a,i,o,s,l,u,c,h,f){var v=r.visualDrawType,g=o.get("itemWidth"),m=o.get("itemHeight"),y=o.isSelected(n),x=i.get("symbolRotate"),_=i.get("symbolKeepAspect"),w=i.get("icon");c=w||c||"roundRect";var S=Kbe(c,i,l,u,v,y,f),C=new sx,M=i.getModel("textStyle");if(Le(r.getLegendIcon)&&(!w||w==="inherit"))C.add(r.getLegendIcon({itemWidth:g,itemHeight:m,icon:c,iconRotate:x,itemStyle:S.itemStyle,lineStyle:S.lineStyle,symbolKeepAspect:_}));else{var A=w==="inherit"&&r.getData().getVisual("symbol")?x==="inherit"?r.getData().getVisual("symbolRotate"):x:0;C.add(Jbe({itemWidth:g,itemHeight:m,icon:c,iconRotate:A,itemStyle:S.itemStyle,symbolKeepAspect:_}))}var k=s==="left"?g+5:-5,I=s,P=o.get("formatter"),j=n;ve(P)&&P?j=P.replace("{name}",n??""):Le(P)&&(j=P(n));var z=y?M.getTextColor():i.get("inactiveColor");C.add(new wt({style:$t(M,{text:j,x:k,y:m/2,fill:z,align:I,verticalAlign:"middle"},{inheritColor:z})}));var D=new it({shape:C.getBoundingRect(),style:{fill:"transparent"}}),B=i.getModel("tooltip");return B.get("show")&&el({el:D,componentModel:o,itemName:n,itemTooltipOption:B.option}),C.add(D),C.eachChild(function(H){H.silent=!0}),D.silent=!h,this.getContentGroup().add(C),ql(C),C.__legendDataIndex=a,C},t.prototype.layoutInner=function(r,n,a,i,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();Gc(r.get("orient"),l,r.get("itemGap"),a.width,a.height);var c=l.getBoundingRect(),h=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){Gc("horizontal",u,r.get("selectorItemGap",!0));var f=u.getBoundingRect(),v=[-f.x,-f.y],g=r.get("selectorButtonGap",!0),m=r.getOrient().index,y=m===0?"width":"height",x=m===0?"height":"width",_=m===0?"y":"x";s==="end"?v[m]+=c[y]+g:h[m]+=f[y]+g,v[1-m]+=c[x]/2-f[x]/2,u.x=v[0],u.y=v[1],l.x=h[0],l.y=h[1];var w={x:0,y:0};return w[y]=c[y]+g+f[y],w[x]=Math.max(c[x],f[x]),w[_]=Math.min(0,f[_]+v[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}(Yt);function Kbe(e,t,r,n,a,i,o){function s(y,x){y.lineWidth==="auto"&&(y.lineWidth=x.lineWidth>0?2:0),lN(y,function(_,w){y[w]==="inherit"&&(y[w]=x[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:zf(h,o),u.fill==="inherit"&&(u.fill=n[a]),u.stroke==="inherit"&&(u.stroke=n[c]),u.opacity==="inherit"&&(u.opacity=(a==="fill"?n:r).opacity),s(u,n);var f=t.getModel("lineStyle"),v=f.getLineStyle();if(s(v,r),u.fill==="auto"&&(u.fill=n.fill),u.stroke==="auto"&&(u.stroke=n.fill),v.stroke==="auto"&&(v.stroke=n.fill),!i){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"),v.stroke=f.get("inactiveColor"),v.lineWidth=f.get("inactiveWidth")}return{itemStyle:u,lineStyle:v}}function Jbe(e){var t=e.icon||"roundRect",r=Ar(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 Qz(e,t,r,n){cN(e,t,r,n),r.dispatchAction({type:"legendToggleSelect",name:e??t}),uN(e,t,r,n)}function uN(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"highlight",seriesName:e,name:t,excludeSeriesId:n})}function cN(e,t,r,n){r.usingTHL()||r.dispatchAction({type:"downplay",seriesName:e,name:t,excludeSeriesId:n})}function Tp(e,t,r){var n=e==="allSelect"||e==="inverseSelect",a={},i=[];r.eachComponent({mainType:"legend",query:t},function(s){n?s[e]():s[e](t.name),eB(s,a),i.push(s.componentIndex)});var o={};return r.eachComponent("legend",function(s){R(a,function(l,u){s[l?"select":"unSelect"](u)}),eB(s,o)}),n?{selected:o,legendIndex:i}:{name:t.name,selected:o}}function eB(e,t){var r=t||{};return R(e.getData(),function(n){var a=n.get("name");if(!(a===` +`||a==="")){var i=e.isSelected(a);Se(r,a)?r[a]=r[a]&&i:r[a]=i}}),r}function Qbe(e){e.registerAction("legendToggleSelect","legendselectchanged",nt(Tp,"toggleSelected")),e.registerAction("legendAllSelect","legendselectall",nt(Tp,"allSelect")),e.registerAction("legendInverseSelect","legendinverseselect",nt(Tp,"inverseSelect")),e.registerAction("legendSelect","legendselected",nt(Tp,"select")),e.registerAction("legendUnSelect","legendunselected",nt(Tp,"unSelect"))}var e1e=Vm(t1e);function t1e(e){var t=e.findComponents({mainType:"legend"});t&&t.length&&e.filterSeries(function(r){for(var n=0;na[o],y=[-v.x,-v.y];n||(y[i]=c[u]);var x=[0,0],_=[-g.x,-g.y],w=Te(r.get("pageButtonGap",!0),r.get("itemGap",!0));if(m){var S=r.get("pageButtonPosition",!0);S==="end"?_[i]+=a[o]-g[o]:x[i]+=g[o]+w}_[1-i]+=v[s]/2-g[s]/2,c.setPosition(y),h.setPosition(x),f.setPosition(_);var C={x:0,y:0};if(C[o]=m?a[o]:v[o],C[s]=Math.max(v[s],g[s]),C[l]=Math.min(0,g[l]+_[1-i]),h.__rectSize=a[o],m){var M={x:0,y:0};M[o]=Math.max(a[o]-g[o]-w,0),M[s]=C[s],h.setClipPath(new it({shape:M})),h.__rectSize=M[o]}else f.eachChild(function(k){k.attr({invisible:!0,silent:!0})});var A=this._getPageInfo(r);return A.pageIndex!=null&&At(c,{x:A.contentPosition[0],y:A.contentPosition[1]},m?r:null),this._updatePageInfoView(r,A),C},t.prototype._pageGo=function(r,n,a){var i=this._getPageInfo(n)[r];i!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:n.id})},t.prototype._updatePageInfoView=function(r,n){var a=this._controllerGroup;R(["pagePrev","pageNext"],function(c){var h=c+"DataIndex",f=n[h]!=null,v=a.childOfName(c);v&&(v.setStyle("fill",f?r.get("pageIconColor",!0):r.get("pageIconInactiveColor",!0)),v.cursor=f?"pointer":"default")});var i=a.childOfName("pageText"),o=r.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;i&&o&&i.setStyle("text",ve(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),a=this.getContentGroup(),i=this._containerGroup.__rectSize,o=r.getOrient().index,s=R2[o],l=O2[o],u=this._findTargetItemIndex(n),c=a.children(),h=c[u],f=c.length,v=f?1:0,g={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!h)return g;var m=S(h);g.contentPosition[o]=-m.s;for(var y=u+1,x=m,_=m,w=null;y<=f;++y)w=S(c[y]),(!w&&_.e>x.s+i||w&&!C(w,x.s))&&(_.i>x.i?x=_:x=w,x&&(g.pageNextDataIndex==null&&(g.pageNextDataIndex=x.i),++g.pageCount)),_=w;for(var y=u-1,x=m,_=m,w=null;y>=-1;--y)w=S(c[y]),(!w||!C(_,w.s))&&x.i<_.i&&(_=x,g.pagePrevDataIndex==null&&(g.pagePrevDataIndex=x.i),++g.pageCount,++g.pageIndex),x=w;return g;function S(M){if(M){var A=M.getBoundingRect(),k=A[l]+M[l];return{s:k,e:k+A[s],i:M.__legendDataIndex}}}function C(M,A){return M.e>=A&&M.s<=A+i}},t.prototype._findTargetItemIndex=function(r){if(!this._showController)return 0;var n,a=this.getContentGroup(),i;return a.eachChild(function(o,s){var l=o.__legendDataIndex;i==null&&l!=null&&(i=s),l===r&&(n=s)}),n??i},t.type="legend.scroll",t}(q$);function a1e(e){e.registerAction("legendScroll","legendscroll",function(t,r){var n=t.scrollDataIndex;n!=null&&r.eachComponent({mainType:"legend",subType:"scroll",query:t},function(a){a.setScrollDataIndex(n)})})}function i1e(e){rt(K$),e.registerComponentModel(r1e),e.registerComponentView(n1e),a1e(e)}function o1e(e){rt(K$),rt(i1e)}var s1e=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=Cu(Mm.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),t}(Mm),_P=Qe();function l1e(e,t,r){_P(e).coordSysRecordMap.each(function(n){var a=n.dataZoomInfoMap.get(t.uid);a&&(a.getRange=r)})}function u1e(e,t){for(var r=_P(e).coordSysRecordMap,n=r.keys(),a=0;ai[a+n]&&(n=h),o=o&&c.get("preventDefaultMouseMove",!0),s=Te(c.get("cursorGrab",!0),s),l=Te(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 v1e(e){e.registerUpdateLifecycle("coordsys:aftercreate",function(t,r){var n=_P(r),a=n.coordSysRecordMap||(n.coordSysRecordMap=we());a.each(function(i){i.dataZoomInfoMap=null}),t.eachComponent({mainType:"dataZoom",subType:"inside"},function(i){var o=D$(i);R(o.infoList,function(s){var l=s.model.uid,u=a.get(l)||a.set(l,c1e(r,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=we());c.set(i.uid,{dzReferCoordSysInfo:s,model:i,getRange:null})})}),a.each(function(i){var o=i.controller,s,l=i.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){J$(a,i);return}var c=f1e(l,i,r);o.enable(c.controlType,c.opt),xv(i,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var p1e=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,a){if(e.prototype.render.apply(this,arguments),r.noTarget()){this._clear();return}this.range=r.getPercentRange(),l1e(a,r,{pan:be(z2.pan,this),zoom:be(z2.zoom,this),scrollMove:be(z2.scrollMove,this)})},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){u1e(this.api,this.dataZoomModel),this.range=null},t.type="dataZoom.inside",t}(dP),z2={zoom:function(e,t,r,n){var a=this.range,i=a.slice(),o=e.axisModels[0];if(o){var s=B2[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*(i[1]-i[0])+i[0],u=Math.max(1/n.scale,0);i[0]=(i[0]-l)*u+l,i[1]=(i[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(uu(0,i,[0,100],0,c.minSpan,c.maxSpan),this.range=i,a[0]!==i[0]||a[1]!==i[1])return i}},pan:nB(function(e,t,r,n,a,i){var o=B2[n]([i.oldX,i.oldY],[i.newX,i.newY],t,a,r);return o.signal*(e[1]-e[0])*o.pixel/o.pixelLength}),scrollMove:nB(function(e,t,r,n,a,i){var o=B2[n]([0,0],[i.scrollDelta,i.scrollDelta],t,a,r);return o.signal*(e[1]-e[0])*i.scrollDelta})};function nB(e){return function(t,r,n,a){var i=this.range,o=i.slice(),s=t.axisModels[0];if(s){var l=e(o,s,t,r,n,a);if(uu(l,o,[0,100],"all"),this.range=o,i[0]!==o[0]||i[1]!==o[1])return o}}}var B2={grid:function(e,t,r,n,a){var i=r.axis,o={},s=a.model.coordinateSystem.getRect();return e=e||[0,0],i.dim==="x"?(o.pixel=t[0]-e[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=i.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=i.inverse?-1:1),o},polar:function(e,t,r,n,a){var i=r.axis,o={},s=a.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=i.inverse?1:-1):(o.pixel=t[1]-e[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=i.inverse?-1:1),o},singleAxis:function(e,t,r,n,a){var i=r.axis,o=a.model.coordinateSystem.getRect(),s={};return e=e||[0,0],i.orient==="horizontal"?(s.pixel=t[0]-e[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=i.inverse?1:-1):(s.pixel=t[1]-e[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=i.inverse?-1:1),s}};function Q$(e){fP(e),e.registerComponentModel(s1e),e.registerComponentView(p1e),v1e(e)}var g1e=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=Cu(Mm.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}(Mm),Mp=it,m1e=1,F2=30,y1e=7,Ap="horizontal",aB="vertical",x1e=5,_1e=["line","bar","candlestick","scatter"],b1e={easing:"cubicOut",duration:100,delay:0},w1e=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=be(this._onBrush,this),this._onBrushEnd=be(this._onBrushEnd,this)},t.prototype.render=function(r,n,a,i){if(e.prototype.render.apply(this,arguments),xv(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}(!i||i.type!=="dataZoom"||i.from!==this.uid)&&this._buildView(),this._updateView()},t.prototype.dispose=function(){this._clear(),e.prototype.dispose.apply(this,arguments)},t.prototype._clear=function(){rm(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 De;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),r.add(n),this._positionGroup()},t.prototype._resetLocation=function(){var r=this.dataZoomModel,n=this.api,a=r.get("brushSelect"),i=a?y1e:0,o=Ur(r,n).refContainer,s=this._findCoordRect(),l=r.get("defaultLocationEdgeGap",!0)||0,u=this._orient===Ap?{right:o.width-s.x-s.width,top:o.height-F2-l-i,width:s.width,height:F2}:{right:l,top:s.y,width:F2,height:s.height},c=zh(r.option);R(["right","top","width","height"],function(f){c[f]==="ph"&&(c[f]=u[f])});var h=tr(c,o);this._location={x:h.x,y:h.y},this._size=[h.width,h.height],this._orient===aB&&this._size.reverse()},t.prototype._positionGroup=function(){var r=this.group,n=this._location,a=this._orient,i=this.dataZoomModel.getFirstTargetAxisModel(),o=i&&i.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(a===Ap&&!o?{scaleY:l?1:-1,scaleX:1}:a===Ap&&o?{scaleY:l?1:-1,scaleX:-1}:a===aB&&!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,a=this._displayables.sliderGroup,i=r.get("brushSelect");a.add(new Mp({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:r.get("backgroundColor")},z2:-40}));var o=new Mp({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:be(this._onClickPanel,this)}),s=this.api.getZr();i?(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)),a.add(o)},t.prototype._renderDataShadow=function(){var r=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!r)return;var n=this._size,a=this._shadowSize||[],i=r.series,o=i.getRawData(),s=i.getShadowDim&&i.getShadowDim(),l=s&&o.getDimensionInfo(s)?i.getShadowDim():r.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==a[0]||n[1]!==a[1]){var h=o.getDataExtent(r.thisDim),f=o.getDataExtent(l),v=(f[1]-f[0])*.3;f=[f[0]-v,f[1]+v];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",C=-_,M=Math.round(o.count()/n[0]),A;o.each([r.thisDim,l],function(z,D,B){if(M>0&&B%M){S||(C+=_);return}C=S?(+z-h[0])*w:C+_;var H=D==null||isNaN(D)||D==="",V=H?0:Nt(D,f,g,!0);H&&!A&&B?(y.push([y[y.length-1][0],0]),x.push([x[x.length-1][0],0])):!H&&A&&(y.push([C,0]),x.push([C,0])),H||(y.push([C,V]),x.push([C,V])),A=H}),u=this._shadowPolygonPts=y,c=this._shadowPolylinePts=x}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var k=this.dataZoomModel;function I(z){var D=k.getModel(z?"selectedDataBackground":"dataBackground"),B=new De,H=new Sn({shape:{points:u},segmentIgnoreThreshold:1,style:D.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),V=new un({shape:{points:c},segmentIgnoreThreshold:1,style:D.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return B.add(H),B.add(V),B}for(var P=0;P<3;P++){var j=I(P===1);this._displayables.sliderGroup.add(j),this._displayables.dataShadowSegs.push(j)}},t.prototype._prepareDataShadowInfo=function(){var r=this.dataZoomModel,n=r.get("showDataShadow");if(n!==!1){var a,i=this.ecModel;return r.eachTargetAxis(function(o,s){var l=r.getAxisProxy(o,s).getTargetSeriesModels();R(l,function(u){if(!a&&!(n!==!0&&Ye(_1e,u.get("type"))<0)){var c=i.getComponent(Rl(o),s).axis,h=S1e(o),f,v=u.coordinateSystem;h!=null&&v.getOtherAxis&&(f=v.getOtherAxis(c).inverse),h=u.getData().mapDimension(h);var g=u.getData().mapDimension(o);a={thisAxis:c,series:u,thisDim:g,otherDim:h,otherAxisInverse:f}}},this)},this),a}},t.prototype._renderHandle=function(){var r=this.group,n=this._displayables,a=n.handles=[null,null],i=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 Mp({silent:h,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(f),o.add(new Mp({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:m1e,fill:K.color.transparent}})),R([0,1],function(w){var S=l.get("handleIcon");!q_[S]&&S.indexOf("path://")<0&&S.indexOf("image://")<0&&(S="path://"+S);var C=Ar(S,-1,0,2,2,null,!0);C.attr({cursor:C1e(this._orient),draggable:!0,drift:be(this._onDragMove,this,w),ondragend:be(this._onDragEnd,this),onmouseover:be(this._onOverDataInfoTriggerArea,this,!0),onmouseout:be(this._onOverDataInfoTriggerArea,this,!1),z2:5});var M=C.getBoundingRect(),A=l.get("handleSize");this._handleHeight=me(A,this._size[1]),this._handleWidth=M.width/M.height*this._handleHeight,C.setStyle(l.getModel("handleStyle").getItemStyle()),C.style.strokeNoScale=!0,C.rectHover=!0,C.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),ql(C);var k=l.get("handleColor");k!=null&&(C.style.fill=k),o.add(a[w]=C);var I=l.getModel("textStyle"),P=l.get("handleLabel")||{},j=P.show||!1;r.add(i[w]=new wt({silent:!0,invisible:!j,style:$t(I,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:I.getTextColor(),font:I.getFont()}),z2:10}))},this);var v=f;if(h){var g=me(l.get("moveHandleSize"),s[1]),m=n.moveHandle=new it({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:g}}),y=g*.8,x=n.moveHandleIcon=Ar(l.get("moveHandleIcon"),-y/2,-y/2,y,y,K.color.neutral00,!0);x.silent=!0,x.y=s[1]+g/2-.5,m.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var _=Math.min(s[1]/2,Math.max(g,10));v=n.moveZone=new it({invisible:!0,shape:{y:s[1]-_,height:g+_}}),v.on("mouseover",function(){u.enterEmphasis(m)}).on("mouseout",function(){u.leaveEmphasis(m)}),o.add(m),o.add(x),o.add(v)}v.attr({draggable:!0,cursor:"grab",drift:be(this._onActualMoveZoneDrift,this),ondragstart:be(this._onActualMoveZoneDragStart,this),ondragend:be(this._onActualMoveZoneDragEnd,this),onmouseover:be(this._onOverDataInfoTriggerArea,this,!0),onmouseout:be(this._onOverDataInfoTriggerArea,this,!1)})},t.prototype._resetInterval=function(){var r=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[Nt(r[0],[0,100],n,!0),Nt(r[1],[0,100],n,!0)]},t.prototype._updateInterval=function(r,n){var a=this.dataZoomModel,i=this._handleEnds,o=this._getViewExtent(),s=a.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];uu(n,i,o,a.get("zoomLock")?"all":r,s.minSpan!=null?Nt(s.minSpan,l,o,!0):null,s.maxSpan!=null?Nt(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=on([Nt(i[0],o,l,!0),Nt(i[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},t.prototype._updateView=function(r){var n=this._displayables,a=this._handleEnds,i=on(a.slice()),o=this._size;R([0,1],function(v){var g=n.handles[v],m=this._handleHeight;g.attr({scaleX:m/2,scaleY:m/2,x:a[v]+(v?-1:1),y:o[1]/2-m/2})},this),n.filler.setShape({x:i[0],y:0,width:i[1]-i[0],height:o[1]});var s={x:i[0],width:i[1]-i[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,i[0],i[1],o[0]],c=0;cn[0]||a[1]<0||a[1]>n[1])){var i=this._handleEnds,o=(i[0]+i[1])/2,s=this._updateInterval("all",a[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},t.prototype._onBrushStart=function(r){var n=r.offsetX,a=r.offsetY;this._brushStart=new Oe(n,a),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 a=n.shape,i=+new Date;if(!(i-this._brushStartTime<200&&Math.abs(a.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[a.x,a.x+a.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();uu(0,l,o,0,u.minSpan!=null?Nt(u.minSpan,s,o,!0):null,u.maxSpan!=null?Nt(u.maxSpan,s,o,!0):null),this._range=on([Nt(l[0],o,s,!0),Nt(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},t.prototype._onBrush=function(r){this._brushing&&(Vs(r.event),this._updateBrushRect(r.offsetX,r.offsetY))},t.prototype._updateBrushRect=function(r,n){var a=this._displayables,i=this.dataZoomModel,o=a.brushRect;o||(o=a.brushRect=new Mp({silent:!0,style:i.getModel("brushStyle").getItemStyle()}),a.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?b1e:null,start:n[0],end:n[1]})},t.prototype._findCoordRect=function(){var r,n=D$(this.dataZoomModel).infoList;if(!r&&n.length){var a=n[0].model.coordinateSystem;r=a.getRect&&a.getRect()}if(!r){var i=this.api.getWidth(),o=this.api.getHeight();r={x:i*.2,y:o*.2,width:i*.6,height:o*.6}}return r},t.type="dataZoom.slider",t}(dP);function iB(e,t,r,n){var a=e.get("labelFormatter"),i=e.get("labelPrecision");(i==null||i==="auto")&&(i=r.valuePrecision);var o=r.value[t],s=o==null||isNaN(o)?"":Gn(n)||qm(n)?n.getLabel({value:Math.round(o)}):isFinite(i)?Mt(o,i,!0):o+"";return Le(a)?a(o,s):ve(a)?a.replace("{value}",s):s}function S1e(e){var t={x:"y",y:"x",radius:"angle",angle:"radius"};return t[e]}function C1e(e){return e==="vertical"?"ns-resize":"ew-resize"}function eZ(e){e.registerComponentModel(g1e),e.registerComponentView(w1e),fP(e)}function T1e(e){rt(Q$),rt(eZ)}var tZ={get:function(e,t,r){var n=ke((M1e[e]||{})[t]);return r&&ae(n)?n[n.length-1]:n}},M1e={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]}},oB=Kr.mapVisual,A1e=Kr.eachVisual,N1e=ae,V2=R,k1e=on,L1e=Nt,Vb=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,a){this.mergeDefaultAndTheme(r,a)},t.prototype.optionUpdated=function(r,n){var a=this.option;!n&&W$(a,r,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},t.prototype.resetVisual=function(r){var n=this.stateList;r=be(r,this),this.controllerVisuals=aN(this.option.controller,n,r),this.targetVisuals=aN(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 a=[];return V2(n,function(l){if(l.seriesIndex!=null)a.push(l.seriesIndex);else if(l.seriesId!=null){var u;r.ecModel.eachSeries(function(c){c.id===l.seriesId&&(u=c)}),u&&a.push(u.componentIndex)}}),a}var i=this.option.seriesId,o=this.option.seriesIndex;o==null&&i==null&&(o="all");var s=sv(this.ecModel,"series",{index:o,id:i},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return oe(s,function(l){return l.componentIndex})},t.prototype.eachTargetSeries=function(r,n){R(this.getTargetSeriesIndices(),function(a){var i=this.ecModel.getSeriesByIndex(a);i&&r.call(n,i)},this)},t.prototype.isTargetSeries=function(r){var n=!1;return this.eachTargetSeries(function(a){a===r&&(n=!0)}),n},t.prototype.formatValueText=function(r,n,a){var i=this.option,o=i.precision,s=this.dataBound,l=i.formatter,u;a=a||["<",">"],ae(r)&&(r=r.slice(),u=!0);var c=n?r:u?[h(r[0]),h(r[1])]:h(r);if(ve(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(Le(l))return u?l(r[0],r[1]):l(r);if(u)return r[0]===s[0]?a[0]+" "+c[1]:r[1]===s[1]?a[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=k1e([r.min,r.max]);this._dataExtent=n},t.prototype.getDimension=function(r){var n=this,a=this.option.seriesTargets;if(a){var i=Ks(a,function(o){return o.seriesIndex!=null&&o.seriesIndex===r||o.seriesId!=null&&o.seriesId===n.ecModel.getSeriesByIndex(r).id});if(i)return i.dimension}return this.option.dimension},t.prototype.getDataDimensionIndex=function(r){var n=r.hostModel.seriesIndex,a=this.getDimension(n);if(a!=null)return r.getDimensionIndex(a);for(var i=r.dimensions,o=i.length-1;o>=0;o--){var s=i[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,a={inRange:n.inRange,outOfRange:n.outOfRange},i=n.target||(n.target={}),o=n.controller||(n.controller={});Je(i,a),Je(o,a);var s=this.isCategory();l.call(this,i),l.call(this,o),u.call(this,i,"inRange","outOfRange"),c.call(this,o);function l(h){N1e(n.color)&&!h.inRange&&(h.inRange={color:n.color.slice().reverse()}),h.inRange=h.inRange||{color:r.get("gradientColor")}}function u(h,f,v){var g=h[f],m=h[v];g&&!m&&(m=h[v]={},V2(g,function(y,x){if(Kr.isValidType(x)){var _=tZ.get(x,"inactive",s);_!=null&&(m[x]=_,x==="color"&&!m.hasOwnProperty("opacity")&&!m.hasOwnProperty("colorAlpha")&&(m.opacity=[0,0]))}}))}function c(h){var f=(h.inRange||{}).symbol||(h.outOfRange||{}).symbol,v=(h.inRange||{}).symbolSize||(h.outOfRange||{}).symbolSize,g=this.get("inactiveColor"),m=this.getItemSymbol(),y=m||"roundRect";V2(this.stateList,function(x){var _=this.itemSize,w=h[x];w||(w=h[x]={color:s?g:[g]}),w.symbol==null&&(w.symbol=f&&ke(f)||(s?y:[y])),w.symbolSize==null&&(w.symbolSize=v&&ke(v)||(s?_[0]:[_[0],_[0]])),w.symbol=oB(w.symbol,function(M){return M==="none"?y:M});var S=w.symbolSize;if(S!=null){var C=-1/0;A1e(S,function(M){M>C&&(C=M)}),w.symbolSize=oB(S,function(M){return L1e(M,[0,C],[0,_[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}(ht),sB=[20,140],I1e=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(a){a.mappingMethod="linear",a.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]=sB[0]),(r[1]==null||isNaN(r[1]))&&(r[1]=sB[1])},t.prototype._resetRange=function(){var r=this.getExtent(),n=this.option.range;!n||n.auto?(r.auto=1,this.option.range=r):ae(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),R(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=on((this.get("range")||[]).slice());return n[0]>r[1]&&(n[0]=r[1]),n[1]>r[1]&&(n[1]=r[1]),n[0]=a[1]||r<=n[1])?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[];return this.eachTargetSeries(function(a){var i=[],o=a.getData();o.each(this.getDataDimensionIndex(o),function(s,l){r[0]<=s&&s<=r[1]&&i.push(l)},this),n.push({seriesId:a.id,dataIndex:i})},this),n},t.prototype.getVisualMeta=function(r){var n=lB(this,"outOfRange",this.getExtent()),a=lB(this,"inRange",this.option.range.slice()),i=[];function o(v,g){i.push({value:v,color:r(v,g)})}for(var s=0,l=0,u=a.length,c=n.length;lr[1])break;i.push({color:this.getControllerVisual(l,"color",n),offset:s/a})}return i.push({color:this.getControllerVisual(r[1],"color",n),offset:1}),i},t.prototype._createBarPoints=function(r,n){var a=this.visualMapModel.itemSize;return[[a[0]-n[0],r[0]],[a[0],r[0]],[a[0],r[1]],[a[0]-n[1],r[1]]]},t.prototype._createBarGroup=function(r){var n=this._orient,a=this.visualMapModel.get("inverse");return new De(n==="horizontal"&&!a?{scaleX:r==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&a?{scaleX:r==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!a?{scaleX:r==="left"?1:-1,scaleY:-1}:{scaleX:r==="left"?1:-1})},t.prototype._updateHandle=function(r,n){if(this._useHandle){var a=this._shapes,i=this.visualMapModel,o=a.handleThumbs,s=a.handleLabels,l=i.itemSize,u=i.getExtent(),c=this._applyTransform("left",a.mainGroup);P1e([0,1],function(h){var f=o[h];f.setStyle("fill",n.handlesColor[h]),f.y=r[h];var v=vo(r[h],[0,l[1]],u,!0),g=this.getControllerVisual(v,"symbolSize");f.scaleX=f.scaleY=g/l[0],f.x=l[0]-g/2;var m=Fi(a.handleLabelPoints[h],Vc(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:i.formatValueText(this._dataInterval[h]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",a.mainGroup):"center"})},this)}},t.prototype._showIndicator=function(r,n,a,i){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},v=this.getControllerVisual(r,"color",f),g=this.getControllerVisual(r,"symbolSize"),m=vo(r,s,u,!0),y=l[0]-g/2,x={x:h.x,y:h.y};h.y=m,h.x=y;var _=Fi(c.indicatorLabelPoint,Vc(h,this.group)),w=c.indicatorLabel;w.attr("invisible",!1);var S=this._applyTransform("left",c.mainGroup),C=this._orient,M=C==="horizontal";w.setStyle({text:(a||"")+o.formatValueText(n),verticalAlign:M?S:"middle",align:M?"center":S});var A={x:y,y:m,style:{fill:v}},k={style:{x:_[0],y:_[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var I={duration:100,easing:"cubicInOut",additive:!0};h.x=x.x,h.y=x.y,h.animateTo(A,I),w.animateTo(k,I)}else h.attr(A),w.attr(k);this._firstShowIndicator=!1;var P=this._shapes.handleLabels;if(P)for(var j=0;jo[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,v=[];(n||dB(a))&&(v=this._hoverLinkDataIndices=a.findTargetDataIndices(h));var g=Ote(f,v);this._dispatchHighDown("downplay",Kx(g[0],a)),this._dispatchHighDown("highlight",Kx(g[1],a))}},t.prototype._hoverLinkFromSeriesMouseOver=function(r){var n;if(Dc(r.target,function(l){var u=Be(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var a=this.ecModel.getSeriesByIndex(n.seriesIndex),i=this.visualMapModel;if(i.isTargetSeries(a)){var o=a.getData(n.dataType),s=o.getStore().get(i.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 a=0;a=0&&(i.dimension=o,n.push(i))}}),e.getData().setVisual("visualMeta",n)}}];function F1e(e,t,r,n){for(var a=t.targetVisuals[n],i=Kr.prepareVisualTypes(a),o={color:Xm(e.getData(),"color")},s=0,l=i.length;s0:t.splitNumber>0)||t.calculable)?"continuous":"piecewise"}),e.registerAction(O1e,z1e),R(B1e,function(t){e.registerVisual(e.PRIORITY.VISUAL.COMPONENT,t)}),e.registerPreprocessor(V1e))}function iZ(e){e.registerComponentModel(I1e),e.registerComponentView(E1e),aZ(e)}var G1e=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 a=this._mode=this._determineMode();this._pieceList=[],H1e[this._mode].call(this,this._pieceList),this._resetSelected(r,n);var i=this.option.categories;this.resetVisual(function(o,s){a==="categories"?(o.mappingMethod="category",o.categories=ke(i)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=oe(this._pieceList,function(l){return l=ke(l),s!=="inRange"&&(l.visual=null),l}))})},t.prototype.completeVisualOption=function(){var r=this.option,n={},a=Kr.listVisualTypes(),i=this.isCategory();R(r.pieces,function(s){R(a,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),R(n,function(s,l){var u=!1;R(this.stateList,function(c){u=u||o(r,c,l)||o(r.target,c,l)},this),!u&&R(this.stateList,function(c){(r[c]||(r[c]={}))[l]=tZ.get(l,c==="inRange"?"active":"inactive",i)})},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 a=this.option,i=this._pieceList,o=(n?a:r).selected||{};if(a.selected=o,R(i,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),a.selectedMode==="single"){var s=!1;R(i,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=ke(r)},t.prototype.getValueState=function(r){var n=Kr.findPieceIndex(r,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},t.prototype.findTargetDataIndices=function(r){var n=[],a=this._pieceList;return this.eachTargetSeries(function(i){var o=[],s=i.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=Kr.findPieceIndex(l,a);c===r&&o.push(u)},this),n.push({seriesId:i.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 a=r.interval||[];n=a[0]===-1/0&&a[1]===1/0?0:(a[0]+a[1])/2}return n},t.prototype.getVisualMeta=function(r){if(this.isCategory())return;var n=[],a=["",""],i=this;function o(c,h){var f=i.getRepresentValue({interval:c});h||(h=i.getValueState(f));var v=r(f,h);c[0]===-1/0?a[0]=v:c[1]===1/0?a[1]=v:n.push({value:c[0],color:v},{value:c[1],color:v})}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 R(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:a}},t.type="visualMap.piecewise",t.defaultOption=Cu(Vb.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}(Vb),H1e={splitNumber:function(e){var t=this.option,r=Math.min(t.precision,20),n=this.getExtent(),a=t.splitNumber;a=Math.max(parseInt(a,10),1),t.splitNumber=a;for(var i=(n[1]-n[0])/a;+i.toFixed(r)!==i&&r<5;)r++;t.precision=r,i=+i.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,a)},this)}};function gB(e,t){var r=e.inverse;(e.orient==="vertical"?!r:r)&&t.reverse()}var U1e=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,a=n.get("textGap"),i=n.textStyleModel,o=this._getItemAlign(),s=n.itemSize,l=this._getViewData(),u=l.endsText,c=zn(n.get("showLabel",!0),!u),h=!n.get("selectedMode");u&&this._renderEndsText(r,u[0],s,c,o),R(l.viewPieceList,function(f){var v=f.piece,g=new De;g.onclick=be(this._onItemClick,this,v),this._enableHoverLink(g,f.indexInModelPieceList);var m=n.getRepresentValue(v);if(this._createItemSymbol(g,m,[0,0,s[0],s[1]],h),c){var y=this.visualMapModel.getValueState(m),x=i.get("align")||o;g.add(new wt({style:$t(i,{x:x==="right"?-a:s[0]+a,y:s[1]/2,text:v.text,verticalAlign:i.get("verticalAlign")||"middle",align:x,opacity:Te(i.get("opacity"),y==="outOfRange"?.5:1)}),silent:h}))}r.add(g)},this),u&&this._renderEndsText(r,u[1],s,c,o),Gc(n.get("orient"),r,n.get("itemGap")),this.renderBackground(r),this.positionGroup(r)},t.prototype._enableHoverLink=function(r,n){var a=this;r.on("mouseover",function(){return i("highlight")}).on("mouseout",function(){return i("downplay")});var i=function(o){var s=a.visualMapModel;s.option.hoverLink&&a.api.dispatchAction({type:o,batch:Kx(s.findTargetDataIndices(n),s)})}},t.prototype._getItemAlign=function(){var r=this.visualMapModel,n=r.option;if(n.orient==="vertical")return nZ(r,this.api,r.itemSize);var a=n.align;return(!a||a==="auto")&&(a="left"),a},t.prototype._renderEndsText=function(r,n,a,i,o){if(n){var s=new De,l=this.visualMapModel.textStyleModel;s.add(new wt({style:$t(l,{x:i?o==="right"?a[0]:0:a[0]/2,y:a[1]/2,verticalAlign:"middle",align:i?o:"center",text:n})})),r.add(s)}},t.prototype._getViewData=function(){var r=this.visualMapModel,n=oe(r.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),a=r.get("text"),i=r.get("orient"),o=r.get("inverse");return(i==="horizontal"?o:!o)?n.reverse():a&&(a=a.slice().reverse()),{viewPieceList:n,endsText:a}},t.prototype._createItemSymbol=function(r,n,a,i){var o=Ar(this.getControllerVisual(n,"symbol"),a[0],a[1],a[2],a[3],this.getControllerVisual(n,"color"));o.silent=i,r.add(o)},t.prototype._onItemClick=function(r){var n=this.visualMapModel,a=n.option,i=a.selectedMode;if(i){var o=ke(a.selected),s=n.getSelectedMapKey(r);i==="single"||i===!0?(o[s]=!0,R(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}(rZ);function oZ(e){e.registerComponentModel(G1e),e.registerComponentView(U1e),aZ(e)}function W1e(e){rt(iZ),rt(oZ)}var $1e=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:Z7(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}(),Z1e=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 $1e(this);if(this._target=null,this.ecModel.eachSeries(function(a){Y3(a,null)}),this.shouldShow()){var n=this.getTarget();Y3(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}(ht),Y1e=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,a){if(this._api=a,this._model=r,this._coordSys||(this._coordSys=new iw),!this._isEnabled()){this._clear();return}this._renderVersion=a.getECUpdateCycleVersion();var i=this.group;i.removeAll();var o=r.getModel("itemStyle"),s=o.getItemStyle();s.fill==null&&(s.fill=n.get("backgroundColor")||K.color.neutral00);var l=Ur(r,a).refContainer,u=tr(yH(r,!0),l),c=s.lineWidth||0,h=this._contentRect=sh(u.clone(),c/2,!0,!0),f=new De;i.add(f),f.setClipPath(new it({shape:h.plain()}));var v=this._targetGroup=new De;f.add(v);var g=u.plain();g.r=o.getShallow("borderRadius",!0),i.add(this._bgRect=new it({style:s,shape:g,silent:!1,cursor:"grab"}));var m=r.getModel("windowStyle"),y=m.getShallow("borderRadius",!0);f.add(this._windowRect=new it({shape:{x:0,y:0,width:0,height:0,r:y},style:m.getItemStyle(),silent:!1,cursor:"grab"})),this._dealRenderContent(),this._dealUpdateWindow(),yB(r,this)},t.prototype.renderContent=function(r){this._bridgeRendered=r,this._isEnabled()&&(this._dealRenderContent(),this._dealUpdateWindow(),yB(this._model,this))},t.prototype._dealRenderContent=function(){var r=this._bridgeRendered;if(!(!r||r.renderVersion!==this._renderVersion)){var n=this._targetGroup,a=this._coordSys,i=this._contentRect;if(n.removeAll(),!!r){var o=r.group,s=o.getBoundingRect();n.add(o),this._bgRect.z2=r.z2Range.min-10,ow(a,s.x,s.y,s.width,s.height);var l=tr({left:"center",top:"center",aspect:s.width/s.height},i);bb(a,l.x,l.y,l.width,l.height),ym(o,a,mh),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=Oa([],r.targetTrans),a=Ea([],_b(null,this._coordSys),n);this._transThisToTarget=Oa([],a);var i=r.viewportRect;i?i=i.clone():i=new je(0,0,this._api.getWidth(),this._api.getHeight()),i.applyTransform(a);var o=this._windowRect,s=o.shape.r;o.setShape(Ee({r:s},i))}},t.prototype._resetRoamController=function(r){var n=this,a=this._api,i=this._roamController;if(i||(i=this._roamController=new Hh(a.getZr())),!r||!this._isEnabled()){i.disable();return}i.enable(r,{api:a,zInfo:{component:this._model},triggerInfo:{roamTrigger:null,isInSelf:function(o,s,l){return n._contentRect.contain(s,l)}}}),i.off("pan").off("zoom").on("pan",be(this._onPan,this)).on("zoom",be(this._onZoom,this))},t.prototype._onPan=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=dr([],[r.oldX,r.oldY],n),i=dr([],[r.oldX-r.dx,r.oldY-r.dy],n);this._api.dispatchAction(mB(this._model.getTarget().baseMapProvider,{dx:i[0]-a[0],dy:i[1]-a[1]}))}},t.prototype._onZoom=function(r){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=dr([],[r.originX,r.originY],n);this._api.dispatchAction(mB(this._model.getTarget().baseMapProvider,{zoom:1/r.scale,originX:a[0],originY:a[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}(Yt);function mB(e,t){var r=e.mainType==="series"?e.subType+"Roam":e.mainType+"Roam",n={type:r};return n[e.mainType+"Id"]=e.id,te(n,t),n}function yB(e,t){var r=lh(e);z1(t.group,r.z,r.zlevel)}function X1e(e){e.registerComponentModel(Z1e),e.registerComponentView(Y1e)}var q1e={label:{enabled:!0},decal:{show:!1}},xB=Qe(),_B=Qe(),K1e=Vm(J1e);function J1e(e,t){var r=e.getModel("aria");if(!r.get("enabled"))return;var n=_B(e).scope||(_B(e).scope={}),a=ke(q1e);Je(a.label,e.getLocaleModel().get("aria"),!1),Je(r.option,a,!1),i(),o();function i(){var c=r.getModel("decal"),h=c.get("show");if(h){var f=we();e.eachSeries(function(v){v.isColorBySeries()||(xB(v).scope=f.get(v.type)||f.set(v.type,{}))}),e.eachSeries(function(v){if(Le(v.enableAriaDecal)){v.enableAriaDecal();return}var g=v.getData();if(v.isColorBySeries()){var w=YM(v.ecModel,v.name,n,e.getSeriesCount()),S=g.getVisual("decal");g.setVisual("decal",C(S,w))}else{var m=v.getRawData(),y={},x=xB(v).scope;g.each(function(M){var A=g.getRawIndex(M);y[A]=M});var _=m.count();m.each(function(M){var A=y[M],k=m.getName(M)||M+"",I=YM(v.ecModel,k,x,_),P=g.getItemVisual(A,"decal");g.setItemVisual(A,"decal",C(P,I))})}function C(M,A){var k=M?te(te({},A),M):A;return k.dirty=!0,k}})}}function o(){var c=t.getZr().dom;if(c){var h=e.getLocaleModel().get("aria"),f=r.getModel("label");if(f.option=Ee(f.option,h),!!f.get("enabled")){if(c.setAttribute("role","img"),f.get("description")){c.setAttribute("aria-label",f.get("description"));return}var v=e.getSeriesCount(),g=f.get(["data","maxCount"])||10,m=f.get(["series","maxCount"])||10,y=Math.min(v,m),x;if(!(v<1)){var _=l();if(_){var w=f.get(["general","withTitle"]);x=s(w,{title:_})}else x=f.get(["general","withoutTitle"]);var S=[],C=v>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);x+=s(C,{seriesCount:v}),e.eachSeries(function(I,P){if(P1?f.get(["series","multiple",D]):f.get(["series","single",D]),j=s(j,{seriesId:I.seriesIndex,seriesName:I.get("name"),seriesType:u(I.subType)});var B=I.getData();if(B.count()>g){var H=f.get(["data","partialData"]);j+=s(H,{displayCnt:g})}else j+=f.get(["data","allData"]);for(var V=f.get(["data","separator","middle"]),U=f.get(["data","separator","end"]),F=f.get(["data","excludeDimensionId"]),W=[],$=0;$":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},twe=function(){function e(t){var r=this._condVal=ve(t)?new RegExp(t):iG(t)?t:null;if(r==null){var n="";Lt(n)}}return e.prototype.evaluate=function(t){var r=typeof t;return ve(r)?this._condVal.test(t):Tt(r)?this._condVal.test(t+""):!1},e}(),rwe=function(){function e(){}return e.prototype.evaluate=function(){return this.value},e}(),nwe=function(){function e(){}return e.prototype.evaluate=function(){for(var t=this.children,r=0;r2&&n.push(a),a=[D,B]}function c(D,B,H,V){tf(D,H)&&tf(B,V)||a.push(D,B,H,V,H,V)}function h(D,B,H,V,U,F){var W=Math.abs(B-D),$=Math.tan(W/4)*4/3,Z=Bk:j2&&n.push(a),n}function dN(e,t,r,n,a,i,o,s,l,u){if(tf(e,r)&&tf(t,n)&&tf(a,o)&&tf(i,s)){l.push(o,s);return}var c=2/u,h=c*c,f=o-e,v=s-t,g=Math.sqrt(f*f+v*v);f/=g,v/=g;var m=r-e,y=n-t,x=a-o,_=i-s,w=m*m+y*y,S=x*x+_*_;if(w=0&&k=0){l.push(o,s);return}var I=[],P=[];iu(e,r,a,o,.5,I),iu(t,n,i,s,.5,P),dN(I[0],P[0],I[1],P[1],I[2],P[2],I[3],P[3],l,u),dN(I[4],P[4],I[5],P[5],I[6],P[6],I[7],P[7],l,u)}function mwe(e,t){var r=hN(e),n=[];t=t||1;for(var a=0;a0)for(var u=0;uMath.abs(u),h=lZ([l,u],c?0:1,t),f=(c?s:u)/h.length,v=0;va,o=lZ([n,a],i?0:1,t),s=i?"width":"height",l=i?"height":"width",u=i?"x":"y",c=i?"y":"x",h=e[s]/o.length,f=0;f1?null:new Oe(m*l+e,m*u+t)}function _we(e,t,r){var n=new Oe;Oe.sub(n,r,t),n.normalize();var a=new Oe;Oe.sub(a,e,t);var i=a.dot(n);return i}function kd(e,t){var r=e[e.length-1];r&&r[0]===t[0]&&r[1]===t[1]||e.push(t)}function bwe(e,t,r){for(var n=e.length,a=[],i=0;io?(u.x=c.x=s+i/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+i),bwe(t,u,c)}function Gb(e,t,r,n){if(r===1)n.push(t);else{var a=Math.floor(r/2),i=e(t);Gb(e,i[0],a,n),Gb(e,i[1],r-a,n)}return n}function wwe(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 Wb(e){var t=1/0,r=1/0,n=-1/0,a=-1/0,i=oe(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),a=Math.max(h,a),[c,h]}),o=oe(i,function(s,l){return{cp:s,z:Iwe(s[0],s[1],t,r,n,a),path:e[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function hZ(e){return Twe(e.path,e.count)}function fN(){return{fromIndividuals:[],toIndividuals:[],count:0}}function Pwe(e,t,r){var n=[];function a(C){for(var M=0;M=0;a--)if(!r[a].many.length){var l=r[s].many;if(l.length<=1)if(s)s=0;else return r;var i=l.length,u=Math.ceil(i/2);r[a].many=l.slice(u,i),r[s].many=l.slice(0,u),s++}return r}var jwe={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=te({setToFinal:!0},o),u,c;kB(e)&&(u=e,c=t),kB(t)&&(u=t,c=e);function h(x,_,w,S,C){var M=x.many,A=x.one;if(M.length===1&&!C){var k=_?M[0]:A,I=_?A:M[0];if(Hb(k))h({many:[k],one:I},!0,w,S,!0);else{var P=s?Ee({delay:s(w,S)},l):l;wP(k,I,P),i(k,I,k,I,P)}}else for(var j=Ee({dividePath:jwe[r],individualDelay:s&&function(U,F,W,$){return s(U+w,S)}},l),z=_?Pwe(M,A,j):Dwe(A,M,j),D=z.fromIndividuals,B=z.toIndividuals,H=D.length,V=0;Vt.length,v=u?LB(c,u):LB(f?t:e,[f?e:t]),g=0,m=0;mdZ))for(var i=n.getIndices(),o=0;o0&&M.group.traverse(function(k){k instanceof pt&&!k.animators.length&&k.animateFrom({style:{opacity:0}},A)})})}function EB(e){var t=e.getModel("universalTransition").get("seriesKey");return t||e.id}function RB(e){return ae(e)?e.sort().join(","):e}function Cl(e){if(e.hostModel)return e.hostModel.getModel("universalTransition").get("divideShape")}function Vwe(e,t){var r=we(),n=we(),a=we();return R(e.oldSeries,function(i,o){var s=e.oldDataGroupIds[o],l=e.oldData[o],u=EB(i),c=RB(u);n.set(c,{dataGroupId:s,data:l}),ae(u)&&R(u,function(h){a.set(h,{key:c,dataGroupId:s,data:l})})}),R(t.updatedSeries,function(i){if(i.isUniversalTransitionEnabled()&&i.isAnimationEnabled()){var o=i.get("dataGroupId"),s=i.getData(),l=EB(i),u=RB(l),c=n.get(u);if(c)r.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:Cl(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:Cl(s),data:s}]});else if(ae(l)){var h=[];R(l,function(g){var m=n.get(g);m.data&&h.push({dataGroupId:m.dataGroupId,divide:Cl(m.data),data:m.data})}),h.length&&r.set(u,{oldSeries:h,newSeries:[{dataGroupId:o,data:s,divide:Cl(s)}]})}else{var f=a.get(l);if(f){var v=r.get(f.key);v||(v={oldSeries:[{dataGroupId:f.dataGroupId,data:f.data,divide:Cl(f.data)}],newSeries:[]},r.set(f.key,v)),v.newSeries.push({dataGroupId:o,data:s,divide:Cl(s)})}}}}),r}function OB(e,t){for(var r=0;r=0&&a.push({dataGroupId:t.oldDataGroupIds[s],data:t.oldData[s],divide:Cl(t.oldData[s]),groupIdDim:o.dimension})}),R(Zt(e.to),function(o){var s=OB(r.updatedSeries,o);if(s>=0){var l=r.updatedSeries[s].getData();i.push({dataGroupId:t.oldDataGroupIds[s],data:l,divide:Cl(l),groupIdDim:o.dimension})}}),a.length>0&&i.length>0&&fZ(a,i,n)}function Hwe(e){e.registerUpdateLifecycle("series:beforeupdate",function(t,r,n){R(Zt(n.seriesTransition),function(a){R(Zt(a.to),function(i){for(var o=n.updatedSeries,s=0;ss.vmin?n+=s.vmin-a+(t-s.vmin)/(s.vmax-s.vmin)*s.gapReal:n+=t-a,a=s.vmax,i=!1;break}n+=s.vmin-a+s.gapReal,a=s.vmax}return i&&(n+=t-a),n},transformOut:function(t,r){if(r&&r.depth===Ps)return t;for(var n=zB,a=BB,i=!0,o=0,s=0;su?o=l.vmin+(t-u)/(c-u)*(l.vmax-l.vmin):o=a+t-n,a=l.vmax,i=!1;break}n=c,a=l.vmax}return i&&(o=a+t-n),o}},e}();function Wwe(e,t){return new Uwe(e,t)}var zB=0,BB=0;function $we(e,t){var r=0,n={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},a=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},i={S:{tpAbs:a(),tpPrct:a()},E:{tpAbs:a(),tpPrct:a()}};R(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(r+=l.val);var u=SP(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 v=c?"S":"E";i[v][l.type].has=!0,i[v][l.type].span=f,i[v][l.type].inExtFrac=f/(s.vmax-s.vmin),i[v][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)+(i.S.tpAbs.has?(i.S.tpAbs.val-i.S.tpAbs.span)*i.S.tpAbs.inExtFrac:0)+(i.E.tpAbs.has?(i.E.tpAbs.val-i.E.tpAbs.span)*i.E.tpAbs.inExtFrac:0)-n.tpPrct.span-(i.S.tpPrct.has?i.S.tpPrct.span*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.span*i.E.tpPrct.inExtFrac:0))/(1-n.tpPrct.val-(i.S.tpPrct.has?i.S.tpPrct.val*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.val*i.E.tpPrct.inExtFrac:0));R(e.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(s.gapReal=r!==0?at(o,0)*l.val/r:0),l.type==="tpAbs"&&(s.gapReal=l.val),s.gapReal==null&&(s.gapReal=0)})}function Zwe(e,t,r,n,a,i){e!=="no"&&R(r,function(o){var s=SP(o,i);if(s)for(var l=t.length-1;l>=0;l--){var u=t[l],c=n(u),h=a*3/4;c>s.vmin-h&&ct[0]&&r=0&&o<1-1e-5}R(e,function(o){if(!(!o||o.start==null||o.end==null)&&!o.isExpanded){var s={breakOption:ke(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(ve(o.gap)){var u=La(o.gap);if(u.match(/%$/)){var c=parseFloat(u)/100;a(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&&R(["vmin","vmax"],function(v){s[v]<0&&(s[v]=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 i=-1/0;return R(n,function(o,s){i>o.vmin&&(n[s]=null),i=o.vmax}),{breaks:It(n,function(o){return!!o})}}function CP(e,t){return pN(t)===pN(e)}function pN(e){return e.start+"_\0_"+e.end}function Xwe(e,t,r){var n=[];R(e,function(i,o){var s=t(i);s&&s.type==="vmin"&&n.push([o])}),R(e,function(i,o){var s=t(i);if(s&&s.type==="vmax"){var l=Ks(n,function(u){return CP(t(e[u[0]]).parsedBreak.breakOption,s.parsedBreak.breakOption)});l&&l.push(o)}});var a=[];return R(n,function(i){i.length===2&&a.push(r?i:[e[i[0]],e[i[1]]])}),a}function qwe(e,t,r,n){if(t.break){var a=t.break.parsedBreak,i=Ks(r,function(c){return CP(c.breakOption,t.break.parsedBreak.breakOption)}),o={lookup:n,depth:Ps},s=e.transformOut(a.vmin,o),l=e.transformOut(a.vmax,o),u={vmin:s,vmax:l,breakOption:a.breakOption,gapParsed:ke(i.gapParsed),gapReal:a.gapReal};return{tickVal:u[t.break.type],vBreak:{type:t.break.type,parsedBreak:u}}}}function Kwe(e,t,r,n,a){a.original=vN(e,t,r);var i=a.transformed=vN(e,t,r),o=a.lookup;i.breaks=oe(i.breaks,function(s,l){var u={depth:Ps},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 Jwe={vmin:"start",vmax:"end"};function Qwe(e,t){return t&&(e=e||{},e.break={type:Jwe[t.type],start:t.parsedBreak.vmin,end:t.parsedBreak.vmax}),e}function eSe(){Qne({createBreakScaleMapper:Wwe,pruneTicksByBreak:Zwe,addBreaksToTicks:Ywe,parseAxisBreakOption:vN,identifyAxisBreak:CP,serializeAxisBreakIdentifier:pN,retrieveAxisBreakPairs:Xwe,getTicksBreakOutwardTransform:qwe,parseAxisBreakOptionInwardTransform:Kwe,makeAxisLabelFormatterParamBreak:Qwe})}var FB=Qe();function tSe(e,t){var r=Ks(e,function(n){return Mr().identifyAxisBreak(n.parsedBreak.breakOption,t.breakOption)});return r||e.push(r={zigzagRandomList:[],parsedBreak:t,shouldRemove:!1}),r}function rSe(e){R(e,function(t){return t.shouldRemove=!0})}function nSe(e){for(var t=e.length-1;t>=0;t--)e[t].shouldRemove&&e.splice(t,1)}function aSe(e,t,r,n,a){var i=r.axis;if(i.scale.isBlank()||!Mr())return;var o=Mr().retrieveAxisBreakPairs(i.scale.getTicks({breakTicks:"only_break"}),function(I){return I.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"),v=s.getModel("itemStyle"),g=v.getItemStyle(),m=g.stroke,y=g.lineWidth,x=g.lineDash,_=g.fill,w=new De({ignoreModelZ:!0}),S=i.isHorizontal(),C=FB(t).visualList||(FB(t).visualList=[]);rSe(C);for(var M=function(I){var P=o[I][0].break.parsedBreak,j=[];j[0]=i.toGlobalCoord(i.dataToCoord(P.vmin,!0)),j[1]=i.toGlobalCoord(i.dataToCoord(P.vmax,!0)),j[1]=F;de&&(re=F);var He=[],ye=[];He[V]=j,ye[V]=z,!le&&!de&&(He[V]+=J?-l:l,ye[V]-=J?l:-l),He[U]=re,ye[U]=re,$.push(He),Z.push(ye);var ne=void 0;if(Q_[1]&&_.reverse(),{coordPair:_,brkId:Mr().serializeAxisBreakIdentifier(x.breakOption)}});l.sort(function(y,x){return y.coordPair[0]-x.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,v=Math.min(f,f-c.x),g=Math.max(f,f-c.x),m=g<0?g:v>0?v:0;s=(f-m)/c.x}var y=new Oe,x=new Oe;Oe.scale(y,n,-s),Oe.scale(x,n,1-s),vA(r[0],y),vA(r[1],x)}function sSe(e,t){var r={breaks:[]};return R(t.breaks,function(n){if(n){var a=Ks(e.get("breaks",!0),function(s){return Mr().identifyAxisBreak(s,n)});if(a){var i=t.type,o={isExpanded:!!a.isExpanded};a.isExpanded=i===ew?!0:i===a8?!1:i===i8?!a.isExpanded:a.isExpanded,r.breaks.push({start:a.start,end:a.end,isExpanded:!!a.isExpanded,old:o})}}}),r}function lSe(){Cce({adjustBreakLabelPair:oSe,buildAxisBreakLine:iSe,rectCoordBuildBreakAxis:aSe,updateModelAxisBreak:sSe})}function uSe(e){Nce(e),eSe(),lSe()}function cSe(){Uhe(hSe)}function hSe(e,t){R(e,function(r){if(!r.model.get(["axisLabel","inside"])){var n=dSe(r);if(n){var a=r.isHorizontal()?"height":"width",i=r.model.get(["axisLabel","margin"]);t[a]-=n[a]+i,r.position==="top"?t.y+=n.height+i:r.position==="left"&&(t.x+=n.width+i)}}})}function dSe(e){var t=e.model,r=e.scale;if(!t.get(["axisLabel","show"])||r.isBlank())return;var n,a,i=r.getExtent();r instanceof sm?a=r.count():(n=r.getTicks(),a=n.length);var o=e.getLabelModel(),s=Jm(e),l,u=1;a>40&&(u=Math.ceil(a/40));for(var c=0;c1&&arguments[1]!==void 0?arguments[1]:60,a=null;return function(){for(var i=this,o=arguments.length,s=new Array(o),l=0;l12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function kSe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function LSe(e){return e==="ROUTER"||e==="ROUTER_LATE"?30:e==="REPEATER"||e==="TRACKER"?25:e==="CLIENT_MUTE"?7:e==="CLIENT_BASE"?12:15}function ISe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const a=E.useRef(null),[i,o]=E.useState("connected"),s=E.useMemo(()=>{const y=new Set;return t.forEach(x=>{y.add(x.from_node),y.add(x.to_node)}),y},[t]),l=E.useMemo(()=>{let y=e;return i==="connected"?y=y.filter(x=>s.has(x.node_num)):i==="infra"&&(y=y.filter(x=>HB.includes(x.role))),y},[e,i,s]),u=E.useMemo(()=>new Map(l.map(y=>[y.node_num,y])),[l]),c=E.useMemo(()=>t.filter(y=>u.has(y.from_node)&&u.has(y.to_node)),[t,u]),h=E.useMemo(()=>{const y=new Set;return r!==null&&c.forEach(x=>{x.from_node===r&&y.add(x.to_node),x.to_node===r&&y.add(x.from_node)}),y},[r,c]),f=E.useMemo(()=>{const y=l.map(_=>{const w=kSe(_.latitude),S=GB[w%GB.length],C=HB.includes(_.role),M=_.node_num===r,A=h.has(_.node_num),k=r===null||M||A;return{id:String(_.node_num),name:_.short_name,value:_.node_num,symbolSize:LSe(_.role),itemStyle:{color:C?S:"#111827",borderColor:S,borderWidth:C?0:2,opacity:k?1:.15},label:{show:!0,position:"bottom",distance:5,fontSize:10,fontFamily:"JetBrains Mono, monospace",color:k?"#94a3b8":"#94a3b820"},nodeNum:_.node_num,longName:_.long_name,role:_.role}}),x=c.map(_=>{const w=r===null||_.from_node===r||_.to_node===r;return{source:String(_.from_node),target:String(_.to_node),value:_.snr,lineStyle:{color:NSe(_.snr),width:w&&r!==null?2:1,opacity:r===null?.4:w?.6:.04}}});return{nodes:y,links:x}},[l,c,r,h]),v=E.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 x=y.data;return`${x.name}
${x.longName}
Role: ${x.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=E.useCallback(y=>{if(y.data&&"nodeNum"in y.data){const x=y.data.nodeNum;n(r===x?null:x??null)}},[r,n]),m=E.useMemo(()=>({click:g}),[g]);return E.useEffect(()=>{var x;const y=(x=a.current)==null?void 0:x.getEchartsInstance();y&&y.setOption(v,{notMerge:!1,lazyUpdate:!0})},[v]),d.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[d.jsx(ASe,{ref:a,option:v,style:{height:"540px",width:"100%"},onEvents:m,opts:{renderer:"canvas"}}),d.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:[d.jsx(RV,{size:14,className:"text-slate-500"}),d.jsx("div",{className:"flex gap-1",children:[{key:"connected",label:"Connected"},{key:"infra",label:"Infra"},{key:"all",label:"All"}].map(({key:y,label:x})=>d.jsx("button",{onClick:()=>o(y),className:`px-2 py-1 text-xs rounded transition-colors ${i===y?"bg-accent text-white":"bg-bg-hover text-slate-400 hover:text-slate-200"}`,children:x},y))}),d.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[l.length," nodes • ",c.length," edges"]})]}),d.jsxs("div",{className:"absolute bottom-4 left-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[d.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Edge Quality (SNR)"}),d.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=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-4 h-0.5",style:{backgroundColor:y.color}}),d.jsx("span",{className:"text-xs text-slate-500",children:y.label})]},y.label))})]}),d.jsxs("div",{className:"absolute bottom-4 right-4 bg-bg-card/90 backdrop-blur-sm border border-border rounded p-3",children:[d.jsx("div",{className:"text-xs text-slate-400 font-medium mb-2",children:"Node Type"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-3 h-3 rounded-full bg-sky-400"}),d.jsx("span",{className:"text-xs text-slate-500",children:"Infrastructure"})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-900 border-2 border-sky-400"}),d.jsx("span",{className:"text-xs text-slate-500",children:"Client"})]})]})]})]})}function gZ(e,t){const r=E.useRef(t);E.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 PSe(e,t,r){t.center!==r.center&&e.setLatLng(t.center),t.radius!=null&&t.radius!==r.radius&&e.setRadius(t.radius)}const DSe=1;function jSe(e){return Object.freeze({__version:DSe,map:e})}function NP(e,t){return Object.freeze({...e,...t})}const mZ=E.createContext(null),yZ=mZ.Provider;function gw(){const e=E.useContext(mZ);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function ESe(e){function t(r,n){const{instance:a,context:i}=e(r).current;return E.useImperativeHandle(n,()=>a),r.children==null?null:bf.createElement(yZ,{value:i},r.children)}return E.forwardRef(t)}function RSe(e){function t(r,n){const[a,i]=E.useState(!1),{instance:o}=e(r,i).current;E.useImperativeHandle(n,()=>o),E.useEffect(function(){a&&o.update()},[o,a,r.children]);const s=o._contentNode;return s?gV.createPortal(r.children,s):null}return E.forwardRef(t)}function OSe(e){function t(r,n){const{instance:a}=e(r).current;return E.useImperativeHandle(n,()=>a),null}return E.forwardRef(t)}function kP(e,t){const r=E.useRef();E.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 mw(e,t){const r=e.pane??t.pane;return r?{...e,pane:r}:e}function zSe(e,t){return function(n,a){const i=gw(),o=e(mw(n,i),i);return gZ(i.map,n.attribution),kP(o.current,n.eventHandlers),t(o.current,i,n,a),o}}var yN={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)})(jY,function(r){var n="1.9.4";function a(p){var b,T,N,O;for(T=1,N=arguments.length;T"u"||!L||!L.Mixin)){p=w(p)?p:[p];for(var b=0;b0?Math.floor(p):Math.ceil(p)};F.prototype={clone:function(){return new F(this.x,this.y)},add:function(p){return this.clone()._add($(p))},_add:function(p){return this.x+=p.x,this.y+=p.y,this},subtract:function(p){return this.clone()._subtract($(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 F(this.x*p.x,this.y*p.y)},unscaleBy:function(p){return new F(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=W(this.x),this.y=W(this.y),this},distanceTo:function(p){p=$(p);var b=p.x-this.x,T=p.y-this.y;return Math.sqrt(b*b+T*T)},equals:function(p){return p=$(p),p.x===this.x&&p.y===this.y},contains:function(p){return p=$(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 $(p,b,T){return p instanceof F?p:w(p)?new F(p[0],p[1]):p==null?p:typeof p=="object"&&"x"in p&&"y"in p?new F(p.x,p.y):new F(p,b,T)}function Z(p,b){if(p)for(var T=b?[p,b]:p,N=0,O=T.length;N=this.min.x&&T.x<=this.max.x&&b.y>=this.min.y&&T.y<=this.max.y},intersects:function(p){p=J(p);var b=this.min,T=this.max,N=p.min,O=p.max,G=O.x>=b.x&&N.x<=T.x,Y=O.y>=b.y&&N.y<=T.y;return G&&Y},overlaps:function(p){p=J(p);var b=this.min,T=this.max,N=p.min,O=p.max,G=O.x>b.x&&N.xb.y&&N.y=b.lat&&O.lat<=T.lat&&N.lng>=b.lng&&O.lng<=T.lng},intersects:function(p){p=Q(p);var b=this._southWest,T=this._northEast,N=p.getSouthWest(),O=p.getNorthEast(),G=O.lat>=b.lat&&N.lat<=T.lat,Y=O.lng>=b.lng&&N.lng<=T.lng;return G&&Y},overlaps:function(p){p=Q(p);var b=this._southWest,T=this._northEast,N=p.getSouthWest(),O=p.getNorthEast(),G=O.lat>b.lat&&N.latb.lng&&N.lng1,Xe=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}(),lt=function(){return!!document.createElement("canvas").getContext}(),Pt=!!(document.createElementNS&&qe("svg").createSVGRect),fr=!!Pt&&function(){var p=document.createElement("div");return p.innerHTML="",(p.firstChild&&p.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),Tn=!Pt&&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}}(),Ct=navigator.platform.indexOf("Mac")===0,as=navigator.platform.indexOf("Linux")===0;function Mn(p){return navigator.userAgent.toLowerCase().indexOf(p)>=0}var $e={ie:bt,ielt9:et,edge:Ke,webkit:St,android:ce,android23:st,androidStock:Ft,opera:jt,chrome:Lr,gecko:Qo,safari:tl,phantom:Ki,opera12:Uh,win:Gn,ie3d:es,webkit3d:ts,gecko3d:Au,any3d:Wh,mobile:Va,mobileWebkit:$h,mobileWebkit3d:Nu,msPointer:ku,pointer:rl,touch:Iu,touchNative:Lu,mobileOpera:rs,mobileGecko:ns,retina:ue,passiveEvents:Xe,canvas:lt,svg:Pt,vml:Tn,inlineSvg:fr,mac:Ct,linux:as},Zh=$e.msPointer?"MSPointerDown":"pointerdown",Ne=$e.msPointer?"MSPointerMove":"pointermove",aa=$e.msPointer?"MSPointerUp":"pointerup",Pu=$e.msPointer?"MSPointerCancel":"pointercancel",Lv={touchstart:Zh,touchmove:Ne,touchend:aa,touchcancel:Pu},oy={touchstart:ly,touchmove:Yh,touchend:Yh,touchcancel:Yh},Ga={},sy=!1;function xw(p,b,T){return b==="touchstart"&&Rr(),oy[b]?(T=oy[b].bind(this,T),p.addEventListener(Lv[b],T,!1),T):(console.warn("wrong event specified:",b),h)}function _w(p,b,T){if(!Lv[b]){console.warn("wrong event specified:",b);return}p.removeEventListener(Lv[b],T,!1)}function bw(p){Ga[p.pointerId]=p}function ww(p){Ga[p.pointerId]&&(Ga[p.pointerId]=p)}function is(p){delete Ga[p.pointerId]}function Rr(){sy||(document.addEventListener(Zh,bw,!0),document.addEventListener(Ne,ww,!0),document.addEventListener(aa,is,!0),document.addEventListener(Pu,is,!0),sy=!0)}function Yh(p,b){if(b.pointerType!==(b.MSPOINTER_TYPE_MOUSE||"mouse")){b.touches=[];for(var T in Ga)b.touches.push(Ga[T]);b.changedTouches=[b],p(b)}}function ly(p,b){b.MSPOINTER_TYPE_TOUCH&&b.pointerType===b.MSPOINTER_TYPE_TOUCH&&hn(b),Yh(p,b)}function uy(p){var b={},T,N;for(N in p)T=p[N],b[N]=T&&T.bind?T.bind(p):T;return p=b,b.type="dblclick",b.detail=2,b.isTrusted=!1,b._simulated=!0,b}var cy=200;function hy(p,b){p.addEventListener("dblclick",b);var T=0,N;function O(G){if(G.detail!==1){N=G.detail;return}if(!(G.pointerType==="mouse"||G.sourceCapabilities&&!G.sourceCapabilities.firesTouchEvents)){var Y=EP(G);if(!(Y.some(function(ie){return ie instanceof HTMLLabelElement&&ie.attributes.for})&&!Y.some(function(ie){return ie instanceof HTMLInputElement||ie instanceof HTMLSelectElement}))){var ee=Date.now();ee-T<=cy?(N++,N===2&&b(uy(G))):N=1,T=ee}}}return p.addEventListener("click",O),{dblclick:b,simDblclick:O}}function dy(p,b){p.removeEventListener("dblclick",b.dblclick),p.removeEventListener("click",b.simDblclick)}var Xh=Ji(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),nl=Ji(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Iv=nl==="webkitTransition"||nl==="OTransition"?nl+"End":"transitionend";function se(p){return typeof p=="string"?document.getElementById(p):p}function ut(p,b){var T=p.style[b]||p.currentStyle&&p.currentStyle[b];if((!T||T==="auto")&&document.defaultView){var N=document.defaultView.getComputedStyle(p,null);T=N?N[b]:null}return T==="auto"?null:T}function Ze(p,b,T){var N=document.createElement(p);return N.className=b||"",T&&T.appendChild(N),N}function mt(p){var b=p.parentNode;b&&b.removeChild(p)}function rr(p){for(;p.firstChild;)p.removeChild(p.firstChild)}function ia(p){var b=p.parentNode;b&&b.lastChild!==p&&b.appendChild(p)}function cn(p){var b=p.parentNode;b&&b.firstChild!==p&&b.insertBefore(p,b.firstChild)}function An(p,b){if(p.classList!==void 0)return p.classList.contains(b);var T=ot(p);return T.length>0&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(T)}function q(p,b){if(p.classList!==void 0)for(var T=g(b),N=0,O=T.length;N0?2*window.devicePixelRatio:1;function OP(p){return $e.edge?p.wheelDeltaY/2:p.deltaY&&p.deltaMode===0?-p.deltaY/FZ: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 Aw(p,b){var T=b.relatedTarget;if(!T)return!0;try{for(;T&&T!==p;)T=T.parentNode}catch{return!1}return T!==p}var VZ={__proto__:null,on:Ie,off:Wt,stopPropagation:Eu,disableScrollPropagation:Mw,disableClickPropagation:Pv,preventDefault:hn,stop:Ru,getPropagationPath:EP,getMousePosition:RP,getWheelDelta:OP,isExternalTarget:Aw,addListener:Ie,removeListener:Wt},zP=U.extend({run:function(p,b,T,N){this.stop(),this._el=p,this._inProgress=!0,this._duration=T||.25,this._easeOutPower=1/Math.max(N||.5,.2),this._startPos=eo(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,T=this._duration*1e3;bthis.options.maxZoom)?this.setZoom(p):this},panInsideBounds:function(p,b){this._enforcingBounds=!0;var T=this.getCenter(),N=this._limitCenter(T,this._zoom,Q(p));return T.equals(N)||this.panTo(N,b),this._enforcingBounds=!1,this},panInside:function(p,b){b=b||{};var T=$(b.paddingTopLeft||b.padding||[0,0]),N=$(b.paddingBottomRight||b.padding||[0,0]),O=this.project(this.getCenter()),G=this.project(p),Y=this.getPixelBounds(),ee=J([Y.min.add(T),Y.max.subtract(N)]),ie=ee.getSize();if(!ee.contains(G)){this._enforcingBounds=!0;var pe=G.subtract(ee.getCenter()),ze=ee.extend(G).getSize().subtract(ie);O.x+=pe.x<0?-ze.x:ze.x,O.y+=pe.y<0?-ze.y:ze.y,this.panTo(this.unproject(O),b),this._enforcingBounds=!1}return this},invalidateSize:function(p){if(!this._loaded)return this;p=a({animate:!1,pan:!0},p===!0?{animate:!0}:p);var b=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var T=this.getSize(),N=b.divideBy(2).round(),O=T.divideBy(2).round(),G=N.subtract(O);return!G.x&&!G.y?this:(p.animate&&p.pan?this.panBy(G):(p.pan&&this._rawPanBy(G),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:T}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(p){if(p=this._locateOptions=a({timeout:1e4,watch:!1},p),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var b=o(this._handleGeolocationResponse,this),T=o(this._handleGeolocationError,this);return p.watch?this._locationWatchId=navigator.geolocation.watchPosition(b,T,p):navigator.geolocation.getCurrentPosition(b,T,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,T=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: "+T+"."})}},_handleGeolocationResponse:function(p){if(this._container._leaflet_id){var b=p.coords.latitude,T=p.coords.longitude,N=new le(b,T),O=N.toBounds(p.coords.accuracy*2),G=this._locateOptions;if(G.setView){var Y=this.getBoundsZoom(O);this.setView(N,G.maxZoom?Math.min(Y,G.maxZoom):Y)}var ee={latlng:N,bounds:O,timestamp:p.timestamp};for(var ie in p.coords)typeof p.coords[ie]=="number"&&(ee[ie]=p.coords[ie]);this.fire("locationfound",ee)}},addHandler:function(p,b){if(!b)return this;var T=this[p]=new b(this);return this._handlers.push(T),this.options[p]&&T.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(),mt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(z(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)mt(this._panes[p]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(p,b){var T="leaflet-pane"+(p?" leaflet-"+p.replace("Pane","")+"-pane":""),N=Ze("div",T,b||this._mapPane);return p&&(this._panes[p]=N),N},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()),T=this.unproject(p.getTopRight());return new re(b,T)},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,T){p=Q(p),T=$(T||[0,0]);var N=this.getZoom()||0,O=this.getMinZoom(),G=this.getMaxZoom(),Y=p.getNorthWest(),ee=p.getSouthEast(),ie=this.getSize().subtract(T),pe=J(this.project(ee,N),this.project(Y,N)).getSize(),ze=$e.any3d?this.options.zoomSnap:1,ft=ie.x/pe.x,kt=ie.y/pe.y,Un=b?Math.max(ft,kt):Math.min(ft,kt);return N=this.getScaleZoom(Un,N),ze&&(N=Math.round(N/(ze/100))*(ze/100),N=b?Math.ceil(N/ze)*ze:Math.floor(N/ze)*ze),Math.max(O,Math.min(G,N))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new F(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(p,b){var T=this._getTopLeftPoint(p,b);return new Z(T,T.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 T=this.options.crs;return b=b===void 0?this._zoom:b,T.scale(p)/T.scale(b)},getScaleZoom:function(p,b){var T=this.options.crs;b=b===void 0?this._zoom:b;var N=T.zoom(p*T.scale(b));return isNaN(N)?1/0:N},project:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.latLngToPoint(de(p),b)},unproject:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.pointToLatLng($(p),b)},layerPointToLatLng:function(p){var b=$(p).add(this.getPixelOrigin());return this.unproject(b)},latLngToLayerPoint:function(p){var b=this.project(de(p))._round();return b._subtract(this.getPixelOrigin())},wrapLatLng:function(p){return this.options.crs.wrapLatLng(de(p))},wrapLatLngBounds:function(p){return this.options.crs.wrapLatLngBounds(Q(p))},distance:function(p,b){return this.options.crs.distance(de(p),de(b))},containerPointToLayerPoint:function(p){return $(p).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(p){return $(p).add(this._getMapPanePos())},containerPointToLatLng:function(p){var b=this.containerPointToLayerPoint($(p));return this.layerPointToLatLng(b)},latLngToContainerPoint:function(p){return this.layerPointToContainerPoint(this.latLngToLayerPoint(de(p)))},mouseEventToContainerPoint:function(p){return RP(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=se(p);if(b){if(b._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Ie(b,"scroll",this._onScroll,this),this._containerId=l(b)},_initLayout:function(){var p=this._container;this._fadeAnimated=this.options.fadeAnimation&&$e.any3d,q(p,"leaflet-container"+($e.touch?" leaflet-touch":"")+($e.retina?" leaflet-retina":"")+($e.ielt9?" leaflet-oldie":"")+($e.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var b=ut(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),gr(this._mapPane,new F(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(q(p.markerPane,"leaflet-zoom-hide"),q(p.shadowPane,"leaflet-zoom-hide"))},_resetView:function(p,b,T){gr(this._mapPane,new F(0,0));var N=!this._loaded;this._loaded=!0,b=this._limitZoom(b),this.fire("viewprereset");var O=this._zoom!==b;this._moveStart(O,T)._move(p,b)._moveEnd(O),this.fire("viewreset"),N&&this.fire("load")},_moveStart:function(p,b){return p&&this.fire("zoomstart"),b||this.fire("movestart"),this},_move:function(p,b,T,N){b===void 0&&(b=this._zoom);var O=this._zoom!==b;return this._zoom=b,this._lastCenter=p,this._pixelOrigin=this._getNewPixelOrigin(p),N?T&&T.pinch&&this.fire("zoom",T):((O||T&&T.pinch)&&this.fire("zoom",T),this.fire("move",T)),this},_moveEnd:function(p){return p&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return z(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(p){gr(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?Wt:Ie;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),$e.any3d&&this.options.transform3DLimit&&(p?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){z(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 T=[],N,O=b==="mouseout"||b==="mouseover",G=p.target||p.srcElement,Y=!1;G;){if(N=this._targets[l(G)],N&&(b==="click"||b==="preclick")&&this._draggableMoved(N)){Y=!0;break}if(N&&N.listens(b,!0)&&(O&&!Aw(G,p)||(T.push(N),O))||G===this._container)break;G=G.parentNode}return!T.length&&!Y&&!O&&this.listens(b,!0)&&(T=[this]),T},_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 T=p.type;T==="mousedown"&&ju(b),this._fireDOMEvent(p,T)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(p,b,T){if(p.type==="click"){var N=a({},p);N.type="preclick",this._fireDOMEvent(N,N.type,T)}var O=this._findEventTargets(p,b);if(T){for(var G=[],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(),T=this.getMaxZoom(),N=$e.any3d?this.options.zoomSnap:1;return N&&(p=Math.round(p/N)*N),Math.max(b,Math.min(T,p))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Me(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(p,b){var T=this._getCenterOffset(p)._trunc();return(b&&b.animate)!==!0&&!this.getSize().contains(T)?!1:(this.panBy(T,b),!0)},_createAnimProxy:function(){var p=this._proxy=Ze("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(p),this.on("zoomanim",function(b){var T=Xh,N=this._proxy.style[T];Qi(this._proxy,this.project(b.center,b.zoom),this.getZoomScale(b.zoom,1)),N===this._proxy.style[T]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){mt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var p=this.getCenter(),b=this.getZoom();Qi(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,T){if(this._animatingZoom)return!0;if(T=T||{},!this._zoomAnimated||T.animate===!1||this._nothingToAnimate()||Math.abs(b-this._zoom)>this.options.zoomAnimationThreshold)return!1;var N=this.getZoomScale(b),O=this._getCenterOffset(p)._divideBy(1-1/N);return T.animate!==!0&&!this.getSize().contains(O)?!1:(D(function(){this._moveStart(!0,T.noMoveStart||!1)._animateZoom(p,b,!0)},this),!0)},_animateZoom:function(p,b,T,N){this._mapPane&&(T&&(this._animatingZoom=!0,this._animateToCenter=p,this._animateToZoom=b,q(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:p,zoom:b,noUpdate:N}),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&&Me(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 GZ(p,b){return new zt(p,b)}var Ti=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),T=this.getPosition(),N=p._controlCorners[T];return q(b,"leaflet-control"),T.indexOf("bottom")!==-1?N.insertBefore(b,N.firstChild):N.appendChild(b),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(mt(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()}}),Dv=function(p){return new Ti(p)};zt.include({addControl:function(p){return p.addTo(this),this},removeControl:function(p){return p.remove(),this},_initControlPos:function(){var p=this._controlCorners={},b="leaflet-",T=this._controlContainer=Ze("div",b+"control-container",this._container);function N(O,G){var Y=b+O+" "+b+G;p[O+G]=Ze("div",Y,T)}N("top","left"),N("top","right"),N("bottom","left"),N("bottom","right")},_clearControlPos:function(){for(var p in this._controlCorners)mt(this._controlCorners[p]);mt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var BP=Ti.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(p,b,T,N){return T1,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)),T=b.overlay?p.type==="add"?"overlayadd":"overlayremove":p.type==="add"?"baselayerchange":null;T&&this._map.fire(T,b)},_createRadioElement:function(p,b){var T='",N=document.createElement("div");return N.innerHTML=T,N.firstChild},_addItem:function(p){var b=document.createElement("label"),T=this._map.hasLayer(p.layer),N;p.overlay?(N=document.createElement("input"),N.type="checkbox",N.className="leaflet-control-layers-selector",N.defaultChecked=T):N=this._createRadioElement("leaflet-base-layers_"+l(this),T),this._layerControlInputs.push(N),N.layerId=l(p.layer),Ie(N,"click",this._onInputClick,this);var O=document.createElement("span");O.innerHTML=" "+p.name;var G=document.createElement("span");b.appendChild(G),G.appendChild(N),G.appendChild(O);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,T,N=[],O=[];this._handlingClick=!0;for(var G=p.length-1;G>=0;G--)b=p[G],T=this._getLayer(b.layerId).layer,b.checked?N.push(T):b.checked||O.push(T);for(G=0;G=0;O--)b=p[O],T=this._getLayer(b.layerId).layer,b.disabled=T.options.minZoom!==void 0&&NT.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var p=this._section;this._preventClick=!0,Ie(p,"click",hn),this.expand();var b=this;setTimeout(function(){Wt(p,"click",hn),b._preventClick=!1})}}),HZ=function(p,b,T){return new BP(p,b,T)},Nw=Ti.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(p){var b="leaflet-control-zoom",T=Ze("div",b+" leaflet-bar"),N=this.options;return this._zoomInButton=this._createButton(N.zoomInText,N.zoomInTitle,b+"-in",T,this._zoomIn),this._zoomOutButton=this._createButton(N.zoomOutText,N.zoomOutTitle,b+"-out",T,this._zoomOut),this._updateDisabled(),p.on("zoomend zoomlevelschange",this._updateDisabled,this),T},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,T,N,O){var G=Ze("a",T,N);return G.innerHTML=p,G.href="#",G.title=b,G.setAttribute("role","button"),G.setAttribute("aria-label",b),Pv(G),Ie(G,"click",Ru),Ie(G,"click",O,this),Ie(G,"click",this._refocusOnMap,this),G},_updateDisabled:function(){var p=this._map,b="leaflet-disabled";Me(this._zoomInButton,b),Me(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||p._zoom===p.getMinZoom())&&(q(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||p._zoom===p.getMaxZoom())&&(q(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});zt.mergeOptions({zoomControl:!0}),zt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Nw,this.addControl(this.zoomControl))});var UZ=function(p){return new Nw(p)},FP=Ti.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(p){var b="leaflet-control-scale",T=Ze("div",b),N=this.options;return this._addScales(N,b+"-line",T),p.on(N.updateWhenIdle?"moveend":"move",this._update,this),p.whenReady(this._update,this),T},onRemove:function(p){p.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(p,b,T){p.metric&&(this._mScale=Ze("div",b,T)),p.imperial&&(this._iScale=Ze("div",b,T))},_update:function(){var p=this._map,b=p.getSize().y/2,T=p.distance(p.containerPointToLatLng([0,b]),p.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(T)},_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),T=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,T,b/p)},_updateImperial:function(p){var b=p*3.2808399,T,N,O;b>5280?(T=b/5280,N=this._getRoundNum(T),this._updateScale(this._iScale,N+" mi",N/T)):(O=this._getRoundNum(b),this._updateScale(this._iScale,O+" ft",O/b))},_updateScale:function(p,b,T){p.style.width=Math.round(this.options.maxWidth*T)+"px",p.innerHTML=b},_getRoundNum:function(p){var b=Math.pow(10,(Math.floor(p)+"").length-1),T=p/b;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:1,b*T}}),WZ=function(p){return new FP(p)},$Z='',kw=Ti.extend({options:{position:"bottomright",prefix:''+($e.inlineSvg?$Z+" ":"")+"Leaflet"},initialize:function(p){m(this,p),this._attributions={}},onAdd:function(p){p.attributionControl=this,this._container=Ze("div","leaflet-control-attribution"),Pv(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 T=[];this.options.prefix&&T.push(this.options.prefix),p.length&&T.push(p.join(", ")),this._container.innerHTML=T.join(' ')}}});zt.mergeOptions({attributionControl:!0}),zt.addInitHook(function(){this.options.attributionControl&&new kw().addTo(this)});var ZZ=function(p){return new kw(p)};Ti.Layers=BP,Ti.Zoom=Nw,Ti.Scale=FP,Ti.Attribution=kw,Dv.layers=HZ,Dv.zoom=UZ,Dv.scale=WZ,Dv.attribution=ZZ;var ro=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}});ro.addTo=function(p,b){return p.addHandler(b,this),this};var YZ={Events:V},VP=$e.touch?"touchstart mousedown":"mousedown",sl=U.extend({options:{clickTolerance:3},initialize:function(p,b,T,N){m(this,N),this._element=p,this._dragStartTarget=b||p,this._preventOutline=T},enable:function(){this._enabled||(Ie(this._dragStartTarget,VP,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(sl._dragging===this&&this.finishDrag(!0),Wt(this._dragStartTarget,VP,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(p){if(this._enabled&&(this._moved=!1,!An(this._element,"leaflet-zoom-anim"))){if(p.touches&&p.touches.length!==1){sl._dragging===this&&this.finishDrag();return}if(!(sl._dragging||p.shiftKey||p.which!==1&&p.button!==1&&!p.touches)&&(sl._dragging=this,this._preventOutline&&ju(this._element),Kh(),al(),!this._moving)){this.fire("down");var b=p.touches?p.touches[0]:p,T=to(this._element);this._startPoint=new F(b.clientX,b.clientY),this._startPos=eo(this._element),this._parentScale=Vt(T);var N=p.type==="mousedown";Ie(document,N?"mousemove":"touchmove",this._onMove,this),Ie(document,N?"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,T=new F(b.clientX,b.clientY)._subtract(this._startPoint);!T.x&&!T.y||Math.abs(T.x)+Math.abs(T.y)G&&(Y=ee,G=ie);G>T&&(b[Y]=1,Iw(p,b,T,N,Y),Iw(p,b,T,Y,O))}function JZ(p,b){for(var T=[p[0]],N=1,O=0,G=p.length;Nb&&(T.push(p[N]),O=N);return Ob.max.x&&(T|=2),p.yb.max.y&&(T|=8),T}function QZ(p,b){var T=b.x-p.x,N=b.y-p.y;return T*T+N*N}function jv(p,b,T,N){var O=b.x,G=b.y,Y=T.x-O,ee=T.y-G,ie=Y*Y+ee*ee,pe;return ie>0&&(pe=((p.x-O)*Y+(p.y-G)*ee)/ie,pe>1?(O=T.x,G=T.y):pe>0&&(O+=Y*pe,G+=ee*pe)),Y=p.x-O,ee=p.y-G,N?Y*Y+ee*ee:new F(O,G)}function Ha(p){return!w(p[0])||typeof p[0][0]!="object"&&typeof p[0][0]<"u"}function YP(p){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ha(p)}function XP(p,b){var T,N,O,G,Y,ee,ie,pe;if(!p||p.length===0)throw new Error("latlngs not passed");Ha(p)||(console.warn("latlngs are not flat! Only the first ring will be used"),p=p[0]);var ze=de([0,0]),ft=Q(p),kt=ft.getNorthWest().distanceTo(ft.getSouthWest())*ft.getNorthEast().distanceTo(ft.getNorthWest());kt<1700&&(ze=Lw(p));var Un=p.length,en=[];for(T=0;TN){ie=(G-N)/O,pe=[ee.x-ie*(ee.x-Y.x),ee.y-ie*(ee.y-Y.y)];break}var oa=b.unproject($(pe));return de([oa.lat+ze.lat,oa.lng+ze.lng])}var eY={__proto__:null,simplify:UP,pointToSegmentDistance:WP,closestPointOnSegment:qZ,clipSegment:ZP,_getEdgeIntersection:fy,_getBitCode:Ou,_sqClosestPointOnSegment:jv,isFlat:Ha,_flat:YP,polylineCenter:XP},Pw={project:function(p){return new F(p.lng,p.lat)},unproject:function(p){return new le(p.y,p.x)},bounds:new Z([-180,-90],[180,90])},Dw={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,T=this.R,N=p.lat*b,O=this.R_MINOR/T,G=Math.sqrt(1-O*O),Y=G*Math.sin(N),ee=Math.tan(Math.PI/4-N/2)/Math.pow((1-Y)/(1+Y),G/2);return N=-T*Math.log(Math.max(ee,1e-10)),new F(p.lng*b*T,N)},unproject:function(p){for(var b=180/Math.PI,T=this.R,N=this.R_MINOR/T,O=Math.sqrt(1-N*N),G=Math.exp(-p.y/T),Y=Math.PI/2-2*Math.atan(G),ee=0,ie=.1,pe;ee<15&&Math.abs(ie)>1e-7;ee++)pe=O*Math.sin(Y),pe=Math.pow((1-pe)/(1+pe),O/2),ie=Math.PI/2-2*Math.atan(G*pe)-Y,Y+=ie;return new le(Y*b,p.x*b/T)}},tY={__proto__:null,LonLat:Pw,Mercator:Dw,SphericalMercator:xe},rY=a({},ye,{code:"EPSG:3395",projection:Dw,transformation:function(){var p=.5/(Math.PI*Dw.R);return ge(p,.5,-p,.5)}()}),qP=a({},ye,{code:"EPSG:4326",projection:Pw,transformation:ge(1/180,1,-1/180,.5)}),nY=a({},He,{projection:Pw,transformation:ge(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 T=b.lng-p.lng,N=b.lat-p.lat;return Math.sqrt(T*T+N*N)},infinite:!0});He.Earth=ye,He.EPSG3395=rY,He.EPSG3857=tt,He.EPSG900913=Ue,He.EPSG4326=qP,He.Simple=nY;var Mi=U.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 T=this.getEvents();b.on(T,this),this.once("remove",function(){b.off(T,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});zt.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 T in this._layers)p.call(b,this._layers[T]);return this},_addLayers:function(p){p=p?w(p)?p:[p]:[];for(var b=0,T=p.length;bthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&b[0]instanceof le&&b[0].equals(b[T-1])&&b.pop(),b},_setLatLngs:function(p){ls.prototype._setLatLngs.call(this,p),Ha(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ha(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var p=this._renderer._bounds,b=this.options.weight,T=new F(b,b);if(p=new Z(p.min.subtract(T),p.max.add(T)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(p))){if(this.options.noClip){this._parts=this._rings;return}for(var N=0,O=this._rings.length,G;Np.y!=O.y>p.y&&p.x<(O.x-N.x)*(p.y-N.y)/(O.y-N.y)+N.x&&(b=!b);return b||ls.prototype._containsPoint.call(this,p,!0)}});function hY(p,b){return new rd(p,b)}var us=ss.extend({initialize:function(p,b){m(this,b),this._layers={},p&&this.addData(p)},addData:function(p){var b=w(p)?p:p.features,T,N,O;if(b){for(T=0,N=b.length;T0&&O.push(O[0].slice()),O}function nd(p,b){return p.feature?a({},p.feature,{geometry:b}):xy(b)}function xy(p){return p.type==="Feature"||p.type==="FeatureCollection"?p:{type:"Feature",properties:{},geometry:p}}var Ow={toGeoJSON:function(p){return nd(this,{type:"Point",coordinates:Rw(this.getLatLng(),p)})}};vy.include(Ow),jw.include(Ow),py.include(Ow),ls.include({toGeoJSON:function(p){var b=!Ha(this._latlngs),T=yy(this._latlngs,b?1:0,!1,p);return nd(this,{type:(b?"Multi":"")+"LineString",coordinates:T})}}),rd.include({toGeoJSON:function(p){var b=!Ha(this._latlngs),T=b&&!Ha(this._latlngs[0]),N=yy(this._latlngs,T?2:b?1:0,!0,p);return b||(N=[N]),nd(this,{type:(T?"Multi":"")+"Polygon",coordinates:N})}}),ed.include({toMultiPoint:function(p){var b=[];return this.eachLayer(function(T){b.push(T.toGeoJSON(p).geometry.coordinates)}),nd(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 T=b==="GeometryCollection",N=[];return this.eachLayer(function(O){if(O.toGeoJSON){var G=O.toGeoJSON(p);if(T)N.push(G.geometry);else{var Y=xy(G);Y.type==="FeatureCollection"?N.push.apply(N,Y.features):N.push(Y)}}}),T?nd(this,{geometries:N,type:"GeometryCollection"}):{type:"FeatureCollection",features:N}}});function QP(p,b){return new us(p,b)}var dY=QP,_y=Mi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(p,b,T){this._url=p,this._bounds=Q(b),m(this,T)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(q(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){mt(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&&ia(this._image),this},bringToBack:function(){return this._map&&cn(this._image),this},setUrl:function(p){return this._url=p,this._image&&(this._image.src=p),this},setBounds:function(p){return this._bounds=Q(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:Ze("img");if(q(b,"leaflet-image-layer"),this._zoomAnimated&&q(b,"leaflet-zoom-animated"),this.options.className&&q(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),T=this._map._latLngBoundsToNewLayerBounds(this._bounds,p.zoom,p.center).min;Qi(this._image,T,b)},_reset:function(){var p=this._image,b=new Z(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),T=b.getSize();gr(p,b.min),p.style.width=T.x+"px",p.style.height=T.y+"px"},_updateOpacity:function(){dt(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()}}),fY=function(p,b,T){return new _y(p,b,T)},eD=_y.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:Ze("video");if(q(b,"leaflet-image-layer"),this._zoomAnimated&&q(b,"leaflet-zoom-animated"),this.options.className&&q(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onloadeddata=o(this.fire,this,"load"),p){for(var T=b.getElementsByTagName("source"),N=[],O=0;O0?N:[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 G=0;GO?(b.height=O+"px",q(p,G)):Me(p,G),this._containerWidth=this._container.offsetWidth},_animateZoom:function(p){var b=this._map._latLngToNewLayerPoint(this._latlng,p.zoom,p.center),T=this._getAnchor();gr(this._container,b.add(T))},_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(ut(this._container,"marginBottom"),10)||0,T=this._container.offsetHeight+b,N=this._containerWidth,O=new F(this._containerLeft,-T-this._containerBottom);O._add(eo(this._container));var G=p.layerPointToContainerPoint(O),Y=$(this.options.autoPanPadding),ee=$(this.options.autoPanPaddingTopLeft||Y),ie=$(this.options.autoPanPaddingBottomRight||Y),pe=p.getSize(),ze=0,ft=0;G.x+N+ie.x>pe.x&&(ze=G.x+N-pe.x+ie.x),G.x-ze-ee.x<0&&(ze=G.x-ee.x),G.y+T+ie.y>pe.y&&(ft=G.y+T-pe.y+ie.y),G.y-ft-ee.y<0&&(ft=G.y-ee.y),(ze||ft)&&(this.options.keepInView&&(this._autopanning=!0),p.fire("autopanstart").panBy([ze,ft]))}},_getAnchor:function(){return $(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),gY=function(p,b){return new by(p,b)};zt.mergeOptions({closePopupOnClick:!0}),zt.include({openPopup:function(p,b,T){return this._initOverlay(by,p,b,T).openOn(this),this},closePopup:function(p){return p=arguments.length?p:this._popup,p&&p.close(),this}}),Mi.include({bindPopup:function(p,b){return this._popup=this._initOverlay(by,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 ss||(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)){Ru(p);var b=p.layer||p.target;if(this._popup._source===b&&!(b instanceof ll)){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 wy=no.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(p){no.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){no.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=no.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=Ze("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(p){var b,T,N=this._map,O=this._container,G=N.latLngToContainerPoint(N.getCenter()),Y=N.layerPointToContainerPoint(p),ee=this.options.direction,ie=O.offsetWidth,pe=O.offsetHeight,ze=$(this.options.offset),ft=this._getAnchor();ee==="top"?(b=ie/2,T=pe):ee==="bottom"?(b=ie/2,T=0):ee==="center"?(b=ie/2,T=pe/2):ee==="right"?(b=0,T=pe/2):ee==="left"?(b=ie,T=pe/2):Y.xthis.options.maxZoom||TN?this._retainParent(O,G,Y,N):!1)},_retainChildren:function(p,b,T,N){for(var O=2*p;O<2*p+2;O++)for(var G=2*b;G<2*b+2;G++){var Y=new F(O,G);Y.z=T+1;var ee=this._tileCoordsToKey(Y),ie=this._tiles[ee];if(ie&&ie.active){ie.retain=!0;continue}else ie&&ie.loaded&&(ie.retain=!0);T+1this.options.maxZoom||this.options.minZoom!==void 0&&O1){this._setView(p,T);return}for(var ft=O.min.y;ft<=O.max.y;ft++)for(var kt=O.min.x;kt<=O.max.x;kt++){var Un=new F(kt,ft);if(Un.z=this._tileZoom,!!this._isValidTile(Un)){var en=this._tiles[this._tileCoordsToKey(Un)];en?en.current=!0:Y.push(Un)}}if(Y.sort(function(oa,id){return oa.distanceTo(G)-id.distanceTo(G)}),Y.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Ua=document.createDocumentFragment();for(kt=0;ktT.max.x)||!b.wrapLat&&(p.yT.max.y))return!1}if(!this.options.bounds)return!0;var N=this._tileCoordsToBounds(p);return Q(this.options.bounds).overlaps(N)},_keyToBounds:function(p){return this._tileCoordsToBounds(this._keyToTileCoords(p))},_tileCoordsToNwSe:function(p){var b=this._map,T=this.getTileSize(),N=p.scaleBy(T),O=N.add(T),G=b.unproject(N,p.z),Y=b.unproject(O,p.z);return[G,Y]},_tileCoordsToBounds:function(p){var b=this._tileCoordsToNwSe(p),T=new re(b[0],b[1]);return this.options.noWrap||(T=this._map.wrapLatLngBounds(T)),T},_tileCoordsToKey:function(p){return p.x+":"+p.y+":"+p.z},_keyToTileCoords:function(p){var b=p.split(":"),T=new F(+b[0],+b[1]);return T.z=+b[2],T},_removeTile:function(p){var b=this._tiles[p];b&&(mt(b.el),delete this._tiles[p],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(p)}))},_initTile:function(p){q(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,$e.ielt9&&this.options.opacity<1&&dt(p,this.options.opacity)},_addTile:function(p,b){var T=this._getTilePos(p),N=this._tileCoordsToKey(p),O=this.createTile(this._wrapCoords(p),o(this._tileReady,this,p));this._initTile(O),this.createTile.length<2&&D(o(this._tileReady,this,p,null,O)),gr(O,T),this._tiles[N]={el:O,coords:p,current:!0},b.appendChild(O),this.fire("tileloadstart",{tile:O,coords:p})},_tileReady:function(p,b,T){b&&this.fire("tileerror",{error:b,tile:T,coords:p});var N=this._tileCoordsToKey(p);T=this._tiles[N],T&&(T.loaded=+new Date,this._map._fadeAnimated?(dt(T.el,0),z(this._fadeFrame),this._fadeFrame=D(this._updateOpacity,this)):(T.active=!0,this._pruneTiles()),b||(q(T.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:T.el,coords:p})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),$e.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 F(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 xY(p){return new Rv(p)}var ad=Rv.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&&$e.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 T=document.createElement("img");return Ie(T,"load",o(this._tileOnLoad,this,b,T)),Ie(T,"error",o(this._tileOnError,this,b,T)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(T.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(T.referrerPolicy=this.options.referrerPolicy),T.alt="",T.src=this.getTileUrl(p),T},getTileUrl:function(p){var b={r:$e.retina?"@2x":"",s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var T=this._globalTileRange.max.y-p.y;this.options.tms&&(b.y=T),b["-y"]=T}return _(this._url,a(b,this.options))},_tileOnLoad:function(p,b){$e.ielt9?setTimeout(o(p,this,null,b),0):p(null,b)},_tileOnError:function(p,b,T){var N=this.options.errorTileUrl;N&&b.getAttribute("src")!==N&&(b.src=N),p(T,b)},_onTileRemove:function(p){p.tile.onload=null},_getZoomForUrl:function(){var p=this._tileZoom,b=this.options.maxZoom,T=this.options.zoomReverse,N=this.options.zoomOffset;return T&&(p=b-p),p+N},_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=C;var T=this._tiles[p].coords;mt(b),delete this._tiles[p],this.fire("tileabort",{tile:b,coords:T})}},_removeTile:function(p){var b=this._tiles[p];if(b)return b.el.setAttribute("src",C),Rv.prototype._removeTile.call(this,p)},_tileReady:function(p,b,T){if(!(!this._map||T&&T.getAttribute("src")===C))return Rv.prototype._tileReady.call(this,p,b,T)}});function nD(p,b){return new ad(p,b)}var aD=ad.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 T=a({},this.defaultWmsParams);for(var N in b)N in this.options||(T[N]=b[N]);b=m(this,b);var O=b.detectRetina&&$e.retina?2:1,G=this.getTileSize();T.width=G.x*O,T.height=G.y*O,this.wmsParams=T},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,ad.prototype.onAdd.call(this,p)},getTileUrl:function(p){var b=this._tileCoordsToNwSe(p),T=this._crs,N=J(T.project(b[0]),T.project(b[1])),O=N.min,G=N.max,Y=(this._wmsVersion>=1.3&&this._crs===qP?[O.y,O.x,G.y,G.x]:[O.x,O.y,G.x,G.y]).join(","),ee=ad.prototype.getTileUrl.call(this,p);return ee+y(this.wmsParams,ee,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+Y},setParams:function(p,b){return a(this.wmsParams,p),b||this.redraw(),this}});function _Y(p,b){return new aD(p,b)}ad.WMS=aD,nD.wms=_Y;var cs=Mi.extend({options:{padding:.1},initialize:function(p){m(this,p),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),q(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 T=this._map.getZoomScale(b,this._zoom),N=this._map.getSize().multiplyBy(.5+this.options.padding),O=this._map.project(this._center,b),G=N.multiplyBy(-T).add(O).subtract(this._map._getNewPixelOrigin(p,b));$e.any3d?Qi(this._container,G,T):gr(this._container,G)},_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(),T=this._map.containerPointToLayerPoint(b.multiplyBy(-p)).round();this._bounds=new Z(T,T.add(b.multiplyBy(1+p*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),iD=cs.extend({options:{tolerance:0},getEvents:function(){var p=cs.prototype.getEvents.call(this);return p.viewprereset=this._onViewPreReset,p},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){cs.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var p=this._container=document.createElement("canvas");Ie(p,"mousemove",this._onMouseMove,this),Ie(p,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ie(p,"mouseout",this._handleMouseOut,this),p._leaflet_disable_events=!0,this._ctx=p.getContext("2d")},_destroyContainer:function(){z(this._redrawRequest),delete this._ctx,mt(this._container),Wt(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)){cs.prototype._update.call(this);var p=this._bounds,b=this._container,T=p.getSize(),N=$e.retina?2:1;gr(b,p.min),b.width=N*T.x,b.height=N*T.y,b.style.width=T.x+"px",b.style.height=T.y+"px",$e.retina&&this._ctx.scale(2,2),this._ctx.translate(-p.min.x,-p.min.y),this.fire("update")}},_reset:function(){cs.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,T=b.next,N=b.prev;T?T.prev=N:this._drawLast=N,N?N.next=T:this._drawFirst=T,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(/[, ]+/),T=[],N,O;for(O=0;O')}}catch{}return function(p){return document.createElement("<"+p+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),bY={_initContainer:function(){this._container=Ze("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(cs.prototype._update.call(this),this.fire("update"))},_initPath:function(p){var b=p._container=Ov("shape");q(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",p._path=Ov("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;mt(b),p.removeInteractiveTarget(b),delete this._layers[l(p)]},_updateStyle:function(p){var b=p._stroke,T=p._fill,N=p.options,O=p._container;O.stroked=!!N.stroke,O.filled=!!N.fill,N.stroke?(b||(b=p._stroke=Ov("stroke")),O.appendChild(b),b.weight=N.weight+"px",b.color=N.color,b.opacity=N.opacity,N.dashArray?b.dashStyle=w(N.dashArray)?N.dashArray.join(" "):N.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=N.lineCap.replace("butt","flat"),b.joinstyle=N.lineJoin):b&&(O.removeChild(b),p._stroke=null),N.fill?(T||(T=p._fill=Ov("fill")),O.appendChild(T),T.color=N.fillColor||N.color,T.opacity=N.fillOpacity):T&&(O.removeChild(T),p._fill=null)},_updateCircle:function(p){var b=p._point.round(),T=Math.round(p._radius),N=Math.round(p._radiusY||T);this._setPath(p,p._empty()?"M0 0":"AL "+b.x+","+b.y+" "+T+","+N+" 0,"+65535*360)},_setPath:function(p,b){p._path.v=b},_bringToFront:function(p){ia(p._container)},_bringToBack:function(p){cn(p._container)}},Sy=$e.vml?Ov:qe,zv=cs.extend({_initContainer:function(){this._container=Sy("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Sy("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){mt(this._container),Wt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){cs.prototype._update.call(this);var p=this._bounds,b=p.getSize(),T=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,T.setAttribute("width",b.x),T.setAttribute("height",b.y)),gr(T,p.min),T.setAttribute("viewBox",[p.min.x,p.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(p){var b=p._path=Sy("path");p.options.className&&q(b,p.options.className),p.options.interactive&&q(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){mt(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,T=p.options;b&&(T.stroke?(b.setAttribute("stroke",T.color),b.setAttribute("stroke-opacity",T.opacity),b.setAttribute("stroke-width",T.weight),b.setAttribute("stroke-linecap",T.lineCap),b.setAttribute("stroke-linejoin",T.lineJoin),T.dashArray?b.setAttribute("stroke-dasharray",T.dashArray):b.removeAttribute("stroke-dasharray"),T.dashOffset?b.setAttribute("stroke-dashoffset",T.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),T.fill?(b.setAttribute("fill",T.fillColor||T.color),b.setAttribute("fill-opacity",T.fillOpacity),b.setAttribute("fill-rule",T.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(p,b){this._setPath(p,Fe(p._parts,b))},_updateCircle:function(p){var b=p._point,T=Math.max(Math.round(p._radius),1),N=Math.max(Math.round(p._radiusY),1)||T,O="a"+T+","+N+" 0 1,0 ",G=p._empty()?"M0 0":"M"+(b.x-T)+","+b.y+O+T*2+",0 "+O+-T*2+",0 ";this._setPath(p,G)},_setPath:function(p,b){p._path.setAttribute("d",b)},_bringToFront:function(p){ia(p._path)},_bringToBack:function(p){cn(p._path)}});$e.vml&&zv.include(bY);function sD(p){return $e.svg||$e.vml?new zv(p):null}zt.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&&oD(p)||sD(p)}});var lD=rd.extend({initialize:function(p,b){rd.prototype.initialize.call(this,this._boundsToLatLngs(p),b)},setBounds:function(p){return this.setLatLngs(this._boundsToLatLngs(p))},_boundsToLatLngs:function(p){return p=Q(p),[p.getSouthWest(),p.getNorthWest(),p.getNorthEast(),p.getSouthEast()]}});function wY(p,b){return new lD(p,b)}zv.create=Sy,zv.pointsToPath=Fe,us.geometryToLayer=gy,us.coordsToLatLng=Ew,us.coordsToLatLngs=my,us.latLngToCoords=Rw,us.latLngsToCoords=yy,us.getFeature=nd,us.asFeature=xy,zt.mergeOptions({boxZoom:!0});var uD=ro.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(){Ie(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Wt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){mt(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(),al(),Kh(),this._startPoint=this._map.mouseEventToContainerPoint(p),Ie(document,{contextmenu:Ru,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(p){this._moved||(this._moved=!0,this._box=Ze("div","leaflet-zoom-box",this._container),q(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(p);var b=new Z(this._point,this._startPoint),T=b.getSize();gr(this._box,b.min),this._box.style.width=T.x+"px",this._box.style.height=T.y+"px"},_finish:function(){this._moved&&(mt(this._box),Me(this._container,"leaflet-crosshair")),il(),Jh(),Wt(document,{contextmenu:Ru,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())}});zt.addInitHook("addHandler","boxZoom",uD),zt.mergeOptions({doubleClickZoom:!0});var cD=ro.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,T=b.getZoom(),N=b.options.zoomDelta,O=p.originalEvent.shiftKey?T-N:T+N;b.options.doubleClickZoom==="center"?b.setZoom(O):b.setZoomAround(p.containerPoint,O)}});zt.addInitHook("addHandler","doubleClickZoom",cD),zt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var hD=ro.extend({addHooks:function(){if(!this._draggable){var p=this._map;this._draggable=new sl(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))}q(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Me(this._map._container,"leaflet-grab"),Me(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=Q(this._map.options.maxBounds);this._offsetLimit=J(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,T=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(T),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),T=this._initialWorldOffset,N=this._draggable._newPos.x,O=(N-b+T)%p+b-T,G=(N+b+T)%p-b-T,Y=Math.abs(O+T)0?G:-G))-b;this._delta=0,this._startTime=null,Y&&(p.options.scrollWheelZoom==="center"?p.setZoom(b+Y):p.setZoomAround(this._lastMousePos,b+Y))}});zt.addInitHook("addHandler","scrollWheelZoom",fD);var SY=600;zt.mergeOptions({tapHold:$e.touchNative&&$e.safari&&$e.mobile,tapTolerance:15});var vD=ro.extend({addHooks:function(){Ie(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Wt(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 F(b.clientX,b.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(Ie(document,"touchend",hn),Ie(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),SY),Ie(document,"touchend touchcancel contextmenu",this._cancel,this),Ie(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function p(){Wt(document,"touchend",hn),Wt(document,"touchend touchcancel",p)},_cancel:function(){clearTimeout(this._holdTimeout),Wt(document,"touchend touchcancel contextmenu",this._cancel,this),Wt(document,"touchmove",this._onMove,this)},_onMove:function(p){var b=p.touches[0];this._newPos=new F(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(p,b){var T=new MouseEvent(p,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});T._simulated=!0,b.target.dispatchEvent(T)}});zt.addInitHook("addHandler","tapHold",vD),zt.mergeOptions({touchZoom:$e.touch,bounceAtZoomLimits:!0});var pD=ro.extend({addHooks:function(){q(this._map._container,"leaflet-touch-zoom"),Ie(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Me(this._map._container,"leaflet-touch-zoom"),Wt(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 T=b.mouseEventToContainerPoint(p.touches[0]),N=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(T.add(N)._divideBy(2))),this._startDist=T.distanceTo(N),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),Ie(document,"touchmove",this._onTouchMove,this),Ie(document,"touchend touchcancel",this._onTouchEnd,this),hn(p)}},_onTouchMove:function(p){if(!(!p.touches||p.touches.length!==2||!this._zooming)){var b=this._map,T=b.mouseEventToContainerPoint(p.touches[0]),N=b.mouseEventToContainerPoint(p.touches[1]),O=T.distanceTo(N)/this._startDist;if(this._zoom=b.getScaleZoom(O,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoomb.getMaxZoom()&&O>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,O===1)return}else{var G=T._add(N)._divideBy(2)._subtract(this._centerPoint);if(O===1&&G.x===0&&G.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(G),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),z(this._animRequest);var Y=o(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=D(Y,this,!0),hn(p)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,z(this._animRequest),Wt(document,"touchmove",this._onTouchMove,this),Wt(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))}});zt.addInitHook("addHandler","touchZoom",pD),zt.BoxZoom=uD,zt.DoubleClickZoom=cD,zt.Drag=hD,zt.Keyboard=dD,zt.ScrollWheelZoom=fD,zt.TapHold=vD,zt.TouchZoom=pD,r.Bounds=Z,r.Browser=$e,r.CRS=He,r.Canvas=iD,r.Circle=jw,r.CircleMarker=py,r.Class=B,r.Control=Ti,r.DivIcon=rD,r.DivOverlay=no,r.DomEvent=VZ,r.DomUtil=Ot,r.Draggable=sl,r.Evented=U,r.FeatureGroup=ss,r.GeoJSON=us,r.GridLayer=Rv,r.Handler=ro,r.Icon=td,r.ImageOverlay=_y,r.LatLng=le,r.LatLngBounds=re,r.Layer=Mi,r.LayerGroup=ed,r.LineUtil=eY,r.Map=zt,r.Marker=vy,r.Mixin=YZ,r.Path=ll,r.Point=F,r.PolyUtil=XZ,r.Polygon=rd,r.Polyline=ls,r.Popup=by,r.PosAnimation=zP,r.Projection=tY,r.Rectangle=lD,r.Renderer=cs,r.SVG=zv,r.SVGOverlay=tD,r.TileLayer=ad,r.Tooltip=wy,r.Transformation=he,r.Util=j,r.VideoOverlay=eD,r.bind=o,r.bounds=J,r.canvas=oD,r.circle=uY,r.circleMarker=lY,r.control=Dv,r.divIcon=yY,r.extend=a,r.featureGroup=iY,r.geoJSON=QP,r.geoJson=dY,r.gridLayer=xY,r.icon=oY,r.imageOverlay=fY,r.latLng=de,r.latLngBounds=Q,r.layerGroup=aY,r.map=GZ,r.marker=sY,r.point=$,r.polygon=hY,r.polyline=cY,r.popup=gY,r.rectangle=wY,r.setOptions=m,r.stamp=l,r.svg=sD,r.svgOverlay=pY,r.tileLayer=nD,r.tooltip=mY,r.transformation=ge,r.version=n,r.videoOverlay=vY;var CY=window.L;r.noConflict=function(){return window.L=CY,this},window.L=r})})(yN,yN.exports);var Mu=yN.exports;const yw=_N(Mu);function kv(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function kP(e,t){return t==null?function(n,a){const i=E.useRef();return i.current||(i.current=e(n,a)),i}:function(n,a){const i=E.useRef();i.current||(i.current=e(n,a));const o=E.useRef(n),{instance:s}=i.current;return E.useEffect(function(){o.current!==n&&(t(s,n,o.current),o.current=n)},[s,n,a]),i}}function yZ(e,t){E.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var i;(i=t.layerContainer)==null||i.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function zSe(e){return function(r){const n=gw(),a=e(mw(r,n),n);return pZ(n.map,r.attribution),NP(a.current,r.eventHandlers),yZ(a.current,n),a}}function BSe(e,t){const r=E.useRef();E.useEffect(function(){if(t.pathOptions!==r.current){const a=t.pathOptions??{};e.instance.setStyle(a),r.current=a}},[e,t])}function FSe(e){return function(r){const n=gw(),a=e(mw(r,n),n);return NP(a.current,r.eventHandlers),yZ(a.current,n),BSe(a.current,r),a}}function xZ(e,t){const r=kP(e),n=OSe(r,t);return ESe(n)}function LP(e,t){const r=kP(e,t),n=FSe(r);return jSe(n)}function VSe(e,t){const r=kP(e,t),n=zSe(r);return RSe(n)}function GSe(e,t,r){const{opacity:n,zIndex:a}=t;n!=null&&n!==r.opacity&&e.setOpacity(n),a!=null&&a!==r.zIndex&&e.setZIndex(a)}function IP(){return gw().map}function HSe(e){const t=IP();return E.useEffect(function(){return t.on(e),function(){t.off(e)}},[t,e]),t}const _Z=LP(function({center:t,children:r,...n},a){const i=new Mu.CircleMarker(t,n);return kv(i,AP(a,{overlayContainer:i}))},ISe);function xN(){return xN=Object.assign||function(e){for(var t=1;t(v==null?void 0:v.map)??null,[v]);const m=E.useCallback(x=>{if(x!==null&&v===null){const _=new Mu.Map(x,c);r!=null&&u!=null?_.setView(r,u):e!=null&&_.fitBounds(e,t),l!=null&&_.whenReady(l),g(DSe(_))}},[]);E.useEffect(()=>()=>{v==null||v.map.remove()},[v]);const y=v?bf.createElement(mZ,{value:v},n):o??null;return bf.createElement("div",xN({},f,{ref:m}),y)}const bZ=E.forwardRef(USe),WSe=LP(function({positions:t,...r},n){const a=new Mu.Polyline(t,r);return kv(a,AP(n,{overlayContainer:a}))},function(t,r,n){r.positions!==n.positions&&t.setLatLngs(r.positions)}),$Se=xZ(function(t,r){const n=new Mu.Popup(t,r.overlayContainer);return kv(n,r)},function(t,r,{position:n},a){E.useEffect(function(){const{instance:o}=t;function s(u){u.popup===o&&(o.update(),a(!0))}function l(u){u.popup===o&&a(!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,a,n])}),ZSe=LP(function({bounds:t,...r},n){const a=new Mu.Rectangle(t,r);return kv(a,AP(n,{overlayContainer:a}))},function(t,r,n){r.bounds!==n.bounds&&t.setBounds(r.bounds)}),wZ=VSe(function({url:t,...r},n){const a=new Mu.TileLayer(t,mw(r,n));return kv(a,n)},function(t,r,n){GSe(t,r,n);const{url:a}=r;a!=null&&a!==n.url&&t.setUrl(a)}),YSe=xZ(function(t,r){const n=new Mu.Tooltip(t,r.overlayContainer);return kv(n,r)},function(t,r,{position:n},a){E.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(),a(!0))},u=c=>{c.tooltip===s&&a(!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,a,n])}),SZ="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=",CZ="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==",TZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete yw.Icon.Default.prototype._getIconUrl;yw.Icon.Default.mergeOptions({iconUrl:SZ,iconRetinaUrl:CZ,shadowUrl:TZ});const HB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],XSe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function qSe(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function KSe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function JSe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function QSe({bounds:e}){const t=IP();return E.useEffect(()=>{e&&t.fitBounds(e,{padding:[50,50]})},[t,e]),null}function eCe({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 d.jsxs("div",{className:"min-w-[200px]",children:[d.jsx("div",{className:"font-semibold text-slate-800",children:e.short_name}),d.jsx("div",{className:"text-xs text-slate-600 mb-2",children:e.long_name}),d.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[d.jsx("div",{className:"text-slate-500",children:"Role"}),d.jsx("div",{className:"text-slate-700 font-medium",children:e.role}),d.jsx("div",{className:"text-slate-500",children:"Hardware"}),d.jsx("div",{className:"text-slate-700",children:e.hardware||"Unknown"}),d.jsx("div",{className:"text-slate-500",children:"Battery"}),d.jsx("div",{className:"text-slate-700",children:r}),d.jsx("div",{className:"text-slate-500",children:"Last Heard"}),d.jsx("div",{className:"text-slate-700",children:JSe(e.last_heard)})]}),t&&d.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-200 flex gap-2",children:[d.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:[d.jsx(Jc,{size:10}),"Google Maps"]}),d.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:[d.jsx(Jc,{size:10}),"OSM"]})]})]})}function tCe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const a=E.useMemo(()=>e.filter(h=>h.latitude!==null&&h.longitude!==null),[e]),i=e.length-a.length,o=E.useMemo(()=>new Map(a.map(h=>[h.node_num,h])),[a]),s=E.useMemo(()=>t.filter(h=>o.has(h.from_node)&&o.has(h.to_node)),[t,o]),l=E.useMemo(()=>{if(a.length===0)return null;const h=a.map(v=>v.latitude),f=a.map(v=>v.longitude);return[[Math.min(...h),Math.min(...f)],[Math.max(...h),Math.max(...f)]]},[a]),u=[43.6,-114.4],c=E.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 d.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[d.jsxs(bZ,{center:u,zoom:7,style:{width:"100%",height:"540px"},className:"z-0",children:[d.jsx(wZ,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),d.jsx(QSe,{bounds:l}),s.map((h,f)=>{const v=o.get(h.from_node),g=o.get(h.to_node),m=r===null||h.from_node===r||h.to_node===r;return d.jsx(WSe,{positions:[[v.latitude,v.longitude],[g.latitude,g.longitude]],color:qSe(h.snr),weight:m&&r!==null?2.5:1.5,opacity:r===null?.3:m?.6:.08},f)}),a.map(h=>{const f=h.node_num===r,v=c.has(h.node_num),g=r===null||f||v,m=XSe.includes(h.role),y=KSe(h.latitude),x=HB[y%HB.length];return d.jsxs(_Z,{center:[h.latitude,h.longitude],radius:m?8:5,fillColor:m?x:"#111827",fillOpacity:g?.9:.2,stroke:!0,color:f?"#ffffff":x,weight:f?3:m?0:2,opacity:g?1:.3,eventHandlers:{click:()=>n(f?null:h.node_num)},children:[d.jsx(YSe,{direction:"top",offset:[0,-8],children:d.jsx("span",{className:"font-mono text-xs",children:h.short_name})}),d.jsx($Se,{children:d.jsx(eCe,{node:h})})]},h.node_num)})]}),d.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:[d.jsx(av,{size:12}),d.jsxs("span",{children:["Showing ",a.length," of ",e.length," nodes",i>0&&d.jsxs("span",{className:"text-slate-500",children:[" (",i," without coordinates)"]})]})]})]})}const UB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],rCe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function WB(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function nCe(e){return e>12?"excellent":e>8?"good":e>5?"fair":e>3?"marginal":"poor"}function aCe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function iCe(e){return["Northern ID","Central ID","SW Idaho","SC Idaho"][e]||"Unknown"}function oCe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function sCe(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 lCe({node:e,edges:t,nodes:r,onSelectNode:n}){const a=E.useMemo(()=>{if(!e)return[];const h=new Map(r.map(v=>[v.node_num,v])),f=[];return t.forEach(v=>{if(v.from_node===e.node_num){const g=h.get(v.to_node);g&&f.push({node:g,snr:v.snr,quality:v.quality})}else if(v.to_node===e.node_num){const g=h.get(v.from_node);g&&f.push({node:g,snr:v.snr,quality:v.quality})}}),f.sort((v,g)=>g.snr-v.snr)},[e,t,r]);if(!e)return d.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:[d.jsx("div",{className:"w-12 h-12 rounded-full bg-bg-hover border border-border flex items-center justify-center mb-3",children:d.jsx(_i,{size:24,className:"text-slate-500"})}),d.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Click a node to inspect"})]});const i=rCe.includes(e.role),o=aCe(e.latitude),s=UB[o%UB.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 d.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border flex flex-col h-[540px] overflow-hidden",children:[d.jsxs("div",{className:"p-4 border-b border-border",children:[d.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}),d.jsx("div",{className:"font-mono text-lg text-slate-100",children:e.short_name}),d.jsx("div",{className:"text-xs text-slate-500 truncate",children:e.long_name})]}),d.jsxs("div",{className:"p-4 border-b border-border grid grid-cols-2 gap-3",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Role"}),d.jsx("div",{className:`text-sm font-medium ${i?"text-accent":"text-slate-300"}`,children:e.role})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Region"}),d.jsx("div",{className:"text-sm text-slate-300",children:iCe(o)})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Battery"}),d.jsxs("div",{className:"text-sm text-slate-300 flex items-center gap-1",children:[c&&d.jsx(rM,{size:12,className:"text-amber-400"}),u]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Status"}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${sCe(e.last_heard)}`}),d.jsx("span",{className:"text-sm text-slate-300",children:oCe(e.last_heard)})]})]}),d.jsxs("div",{className:"col-span-2",children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Hardware"}),d.jsx("div",{className:"text-sm text-slate-300 font-mono truncate",children:e.hardware||"Unknown"})]})]}),l&&d.jsxs("div",{className:"px-4 py-3 border-b border-border flex gap-3",children:[d.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:[d.jsx(Jc,{size:10}),"Google Maps"]}),d.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:[d.jsx(Jc,{size:10}),"OSM"]})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d.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 (",a.length,")"]}),a.length>0?d.jsx("div",{className:"divide-y divide-border",children:a.map(h=>d.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:WB(h.snr)},children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm text-slate-200 font-mono truncate",children:h.node.short_name}),d.jsx("div",{className:"text-xs text-slate-500 truncate",children:h.node.long_name})]}),d.jsxs("div",{className:"text-right flex-shrink-0",children:[d.jsxs("div",{className:"text-xs font-mono",style:{color:WB(h.snr)},children:[h.snr.toFixed(1)," dB"]}),d.jsx("div",{className:"text-xs text-slate-500",children:nCe(h.snr)})]})]},h.node.node_num))}):d.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No known neighbors"})]})]})}const $B=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function uCe(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 cCe(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function hCe(e){return e.battery_level===null?"—":e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`}function ZB(e){return e===null?"—":e>46?"Northern":e>44.5?"Central":e>43?"SW Idaho":"SC Idaho"}function dCe({nodes:e,selectedNodeId:t,onSelectNode:r}){const[n,a]=E.useState(""),[i,o]=E.useState("short_name"),[s,l]=E.useState("asc"),[u,c]=E.useState("all"),h=E.useMemo(()=>{let g=[...e];if(u==="infra"?g=g.filter(m=>$B.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)||ZB(y.latitude).toLowerCase().includes(m))}return g.sort((m,y)=>{let x="",_="";switch(i){case"short_name":x=m.short_name.toLowerCase(),_=y.short_name.toLowerCase();break;case"role":x=m.role,_=y.role;break;case"battery_level":x=m.battery_level??-1,_=y.battery_level??-1;break;case"last_heard":x=m.last_heard?new Date(m.last_heard).getTime():0,_=y.last_heard?new Date(y.last_heard).getTime():0;break;case"hardware":x=m.hardware.toLowerCase(),_=y.hardware.toLowerCase();break}return x<_?s==="asc"?-1:1:x>_?s==="asc"?1:-1:0}),g},[e,n,i,s,u]),f=g=>{i===g?l(s==="asc"?"desc":"asc"):(o(g),l("asc"))},v=({field:g})=>i!==g?null:s==="asc"?d.jsx(gJ,{size:14,className:"inline ml-1"}):d.jsx(Em,{size:14,className:"inline ml-1"});return d.jsxs("div",{className:"bg-bg-card border border-border overflow-hidden",children:[d.jsxs("div",{className:"p-3 border-b border-border flex items-center gap-3",children:[d.jsxs("div",{className:"relative flex-1 max-w-xs",children:[d.jsx(v1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),d.jsx("input",{type:"text",placeholder:"Search nodes...",value:n,onChange:g=>a(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"})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(EV,{size:14,className:"text-slate-500 mr-1"}),["all","infra","online"].map(g=>d.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))]}),d.jsxs("div",{className:"text-xs text-slate-500 ml-auto",children:[h.length," of ",e.length," nodes"]})]}),d.jsxs("div",{className:"overflow-x-auto",children:[d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-bg-hover text-slate-400 text-xs",children:[d.jsx("th",{className:"w-8 px-3 py-2"}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("short_name"),children:["Name ",d.jsx(v,{field:"short_name"})]}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("role"),children:["Role ",d.jsx(v,{field:"role"})]}),d.jsx("th",{className:"px-3 py-2 text-left",children:"Region"}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("battery_level"),children:[d.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"})," ",d.jsx(v,{field:"battery_level"})]}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("last_heard"),children:[d.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"})," ",d.jsx(v,{field:"last_heard"})]}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("hardware"),children:["Hardware ",d.jsx(v,{field:"hardware"})]})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:h.slice(0,100).map(g=>{const m=$B.includes(g.role),y=g.node_num===t;return d.jsxs("tr",{onClick:()=>r(g.node_num),className:`cursor-pointer transition-colors ${y?"bg-accent/10":"hover:bg-bg-hover"}`,children:[d.jsx("td",{className:"px-3 py-2",children:d.jsx("div",{className:`w-2 h-2 rounded-full ${uCe(g.last_heard)}`})}),d.jsxs("td",{className:"px-3 py-2",children:[d.jsx("div",{className:"font-mono text-slate-200",children:g.short_name}),d.jsx("div",{className:"text-xs text-slate-500 truncate max-w-[200px]",children:g.long_name})]}),d.jsx("td",{className:"px-3 py-2",children:d.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})}),d.jsx("td",{className:"px-3 py-2 text-slate-400",children:ZB(g.latitude)}),d.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:hCe(g)}),d.jsx("td",{className:"px-3 py-2 text-slate-400",children:cCe(g.last_heard)}),d.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&&d.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&&d.jsx("div",{className:"px-3 py-8 text-sm text-slate-500 text-center",children:"No nodes match your filters"})]})]})}function MZ(){const[e,t]=E.useState([]),[r,n]=E.useState([]),[a,i]=E.useState([]),[o,s]=E.useState(null),[l,u]=E.useState("topo"),[c,h]=E.useState(!0),[f,v]=E.useState(null);E.useEffect(()=>{document.title="Mesh — MeshAI",Promise.all([LJ(),IJ(),BJ()]).then(([y,x,_])=>{t(y),n(x),i(_),h(!1)}).catch(y=>{v(y.message),h(!1)})},[]);const g=E.useMemo(()=>e.find(y=>y.node_num===o)||null,[e,o]),m=E.useCallback(y=>{s(y)},[]);return c?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading mesh data..."})}):f?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsxs("div",{className:"text-red-400",children:["Error: ",f]})}):d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"text-sm text-slate-400",children:[e.length," nodes • ",r.length," edges"]}),d.jsxs("div",{className:"flex items-center bg-bg-card border border-border p-1",children:[d.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:[d.jsx(Sk,{size:14}),d.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"})]}),d.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:[d.jsx(zV,{size:14}),d.jsx("span",{title:"Nodes plotted by lat/lon on a basemap. Nodes without a reported position are clustered at the top edge.",children:"Geographic"})]})]})]}),d.jsxs("div",{className:"flex gap-0",children:[d.jsx("div",{className:"flex-1 min-w-0",children:l==="topo"?d.jsx(LSe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m}):d.jsx(tCe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m})}),d.jsx(lCe,{node:g,edges:r,nodes:e,onSelectNode:m})]}),d.jsx(dCe,{nodes:e,selectedNodeId:o,onSelectNode:m})]})}function $p({envVar:e,label:t="API Key",helper:r="",info:n=""}){const[a,i]=E.useState(null),[o,s]=E.useState(""),[l,u]=E.useState(!1),[c,h]=E.useState(!1),[f,v]=E.useState(""),[g,m]=E.useState(""),y=async()=>{try{const w=await fetch("/api/secrets");if(w.ok){const C=(await w.json()).find(M=>M.env_var===e);i(C?C.is_set:!1)}}catch{i(!1)}};E.useEffect(()=>{y()},[e]);const x=async()=>{if(o.trim()){h(!0),m(""),v("");try{const w=await fetch("/api/secrets/"+encodeURIComponent(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:o})});if(w.ok)s(""),u(!1),v("Saved — restart required to take effect"),await y();else{const S=await w.text();m("Save failed: "+(S||String(w.status)))}}catch{m("Save failed: network error")}finally{h(!1)}}},_=a?"env set — enter a new value to change":"not set — enter a value";return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[t,a===null?d.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-slate-800 text-slate-500",children:"Loading"}):a?d.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-green-500/10 text-green-400",children:"Set"}):d.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-slate-800 text-slate-500",children:"Not set"})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx("input",{type:l?"text":"password",value:o,onChange:w=>s(w.target.value),placeholder:_,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"}),d.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?d.jsx(h1,{size:16}):d.jsx(rv,{size:16})})]}),d.jsx("button",{type:"button",onClick:x,disabled:!o.trim()||c,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:c?"Saving…":"Save"})]}),r&&d.jsx("p",{className:"text-xs text-slate-600",children:r}),d.jsx("p",{className:"text-xs text-slate-600 font-mono",children:e}),f&&d.jsx("p",{className:"text-xs text-yellow-400",children:f}),g&&d.jsx("p",{className:"text-xs text-red-400",children:g})]})}function PP({label:e,value:t,onChange:r,helper:n,info:a,roleFilter:i,valueType:o="short_name"}){const[s,l]=E.useState([]),[u,c]=E.useState(!0),[h,f]=E.useState(""),[v,g]=E.useState(!1);E.useEffect(()=>{fetch("/api/nodes").then(S=>S.json()).then(S=>{l(S),c(!1)}).catch(()=>{l([]),c(!1)})},[]);const m=E.useMemo(()=>{let S=s;if(i&&(S=S.filter(C=>i==="ROUTER"||i==="infrastructure"?C.is_infrastructure||C.role==="ROUTER"||C.role==="ROUTER_CLIENT"||C.role==="REPEATER":C.role===i)),h.trim()){const C=h.toLowerCase();S=S.filter(M=>{var A,I,k,P;return((A=M.short_name)==null?void 0:A.toLowerCase().includes(C))||((I=M.long_name)==null?void 0:I.toLowerCase().includes(C))||((k=M.role)==null?void 0:k.toLowerCase().includes(C))||((P=M.node_id_hex)==null?void 0:P.toLowerCase().includes(C))})}return S.sort((C,M)=>(C.short_name||"").localeCompare(M.short_name||""))},[s,h,i]),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)}},x=S=>{const C=y(S);return t.includes(C)},_=S=>{const C=y(S);t.includes(C)?r(t.filter(M=>M!==C)):r([...t,C])},w=S=>{const C=[S.short_name];return S.long_name&&S.long_name!==S.short_name&&C.push(`— ${S.long_name}`),S.role&&C.push(`(${S.role})`),C.join(" ")};return!u&&s.length===0?d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),d.jsx("input",{type:"text",value:t.join(", "),onChange:S=>r(S.target.value.split(",").map(C=>C.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&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}):d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),t.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(S=>{const C=s.find(M=>y(M)===S);return d.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-accent/20 text-accent rounded text-sm",children:[C?C.short_name:S,d.jsx("button",{type:"button",onClick:()=>r(t.filter(M=>M!==S)),className:"hover:text-white",children:d.jsx(_u,{size:14})})]},S)})}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"relative",children:[d.jsx(v1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),d.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"})]}),v&&!u&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),d.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?d.jsx("div",{className:"p-3 text-sm text-slate-500 text-center",children:"No nodes found"}):m.map(S=>d.jsxs("button",{type:"button",onClick:()=>_(S),className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[#1e2a3a] ${x(S)?"bg-accent/10":""}`,children:[d.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${x(S)?"bg-accent border-accent":"border-slate-600"}`,children:x(S)&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsx("span",{className:"text-slate-200",children:w(S)})]},S.node_num))})]})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function DP(e){const[t,r]=E.useState([]),[n,a]=E.useState(!0);E.useEffect(()=>{fetch("/api/channels").then(f=>f.json()).then(f=>{r(f),a(!1)}).catch(()=>{r([]),a(!1)})},[]);const i=f=>{const v=f.role==="PRIMARY"?"Primary":f.role==="SECONDARY"?"Secondary":"";return`${f.index}: ${f.name}${v?` (${v})`:""}`};if(!n&&t.length===0)return e.mode==="single"?d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),d.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&&d.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]}):d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),d.jsx("input",{type:"text",value:e.value.join(", "),onChange:f=>{const v=f.target.value.split(",").map(g=>parseInt(g.trim())).filter(g=>!isNaN(g));e.onChange(v)},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&&d.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]});if(e.mode==="single"){const{value:f,onChange:v,label:g,helper:m,includeDisabled:y}=e,x=t.filter(_=>_.enabled);return d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:g}),d.jsxs("select",{value:f,onChange:_=>v(Number(_.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&&d.jsx("option",{value:-1,children:"Disabled"}),x.map(_=>d.jsx("option",{value:_.index,children:i(_)},_.index))]}),m&&d.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(v=>v!==f)):s([...o,f].sort((v,g)=>v-g))};return d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:l}),d.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[c.map(f=>d.jsxs("label",{onClick:()=>h(f.index),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[d.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)&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsx("span",{className:"text-sm text-slate-200",children:i(f)})]},f.index)),c.length===0&&d.jsx("div",{className:"text-sm text-slate-500 p-2",children:"No channels available"})]}),u&&d.jsx("p",{className:"text-xs text-slate-600",children:u})]})}function AZ({value:e,onChange:t,label:r="Serial Port",helper:n="Device path for your USB radio — click Detect to auto-fill a stable by-id path"}){const[a,i]=E.useState(null),[o,s]=E.useState(""),[l,u]=E.useState(!1),[c,h]=E.useState(null),f=async()=>{u(!0),h(null);try{const v=await NJ();i(v.ports),s(v.note||"")}catch(v){h(v instanceof Error?v.message:"Failed to list serial ports"),i([])}finally{u(!1)}};return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:r}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{type:"text",value:e,onChange:v=>t(v.target.value),placeholder:"/dev/serial/by-id/usb-... (or /dev/ttyACM0)",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-slate-600"}),d.jsxs("button",{type:"button",onClick:f,disabled:l,className:"flex items-center gap-2 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] hover:border-accent disabled:opacity-50 disabled:cursor-not-allowed rounded text-sm text-slate-300 whitespace-nowrap transition-colors",children:[d.jsx(Zi,{size:14,className:l?"animate-spin":""}),l?"Detecting...":"Detect USB devices"]})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}),c&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:c}),a!==null&&!c&&(a.length===0?d.jsx("div",{className:"text-sm text-slate-500 p-3 border border-[#1e2a3a] rounded",children:"No USB serial devices found — is the device passed through to the container?"}):d.jsx("div",{className:"border border-[#1e2a3a] rounded p-2 space-y-1",children:a.map(v=>{const g=e===v.stable_path,m=v.product||v.description||v.device;return d.jsxs("button",{type:"button",onClick:()=>t(v.stable_path),className:`w-full text-left flex items-start gap-2 p-2 rounded hover:bg-[#0a0e17] transition-colors ${g?"bg-[#0a0e17] ring-1 ring-accent":""}`,children:[d.jsx("div",{className:`mt-0.5 w-4 h-4 rounded-full border flex items-center justify-center flex-shrink-0 ${g?"bg-accent border-accent":"border-slate-600"}`,children:g&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-sm text-slate-200 truncate",children:m}),v.likely_radio&&d.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wide bg-accent/15 text-accent border border-accent/30 flex-shrink-0",children:[d.jsx(_i,{size:10})," likely radio"]})]}),d.jsx("div",{className:"text-xs text-slate-500 font-mono truncate",children:v.stable_path}),v.manufacturer&&d.jsx("div",{className:"text-xs text-slate-600 truncate",children:v.manufacturer})]})]},v.stable_path+v.device)})})),o&&d.jsx("p",{className:"text-xs text-slate-600 italic",children:o})]})}const Y2=[{key:"bot",label:"Bot",icon:_k},{key:"response",label:"Response",icon:wk},{key:"history",label:"History",icon:jV},{key:"memory",label:"Memory",icon:pJ},{key:"context",label:"Context",icon:rv},{key:"commands",label:"Commands",icon:HV},{key:"llm",label:"LLM",icon:DV},{key:"weather",label:"Weather",icon:kh},{key:"knowledge",label:"Knowledge",icon:kV},{key:"mesh_intelligence",label:"Intelligence",icon:Oo},{key:"dashboard",label:"Dashboard",icon:OV}],ba={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."},fCe=[{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:"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"}],vCe=[{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 Wi({info:e,link:t,linkText:r="Learn more"}){const[n,a]=E.useState(!1),i=E.useRef(null);return E.useEffect(()=>{if(!n)return;function o(l){i.current&&!i.current.contains(l.target)&&a(!1)}const s=setTimeout(()=>document.addEventListener("mousedown",o),0);return()=>{clearTimeout(s),document.removeEventListener("mousedown",o)}},[n]),d.jsxs("div",{className:"relative inline-block",ref:i,children:[d.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),a(!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&&d.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:[d.jsx("button",{type:"button",onClick:()=>a(!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:d.jsx(_u,{size:12})}),d.jsx("div",{className:"pr-4",children:e}),t&&d.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," ",d.jsx(Jc,{size:10})]})]})]})}function wa({text:e}){return d.jsx("p",{className:"text-sm text-slate-500 mb-6 pb-4 border-b border-[#1e2a3a]",children:e})}function yt({label:e,value:t,onChange:r,type:n="text",placeholder:a="",helper:i="",info:o="",infoLink:s=""}){const[l,u]=E.useState(!1),c=n==="password";return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&d.jsx(Wi,{info:o,link:s})]}),d.jsxs("div",{className:"relative",children:[d.jsx("input",{type:c&&!l?"password":"text",value:t,onChange:h=>r(h.target.value),placeholder: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 placeholder-slate-600"}),c&&d.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?d.jsx(h1,{size:16}):d.jsx(rv,{size:16})})]}),i&&d.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function Ae({label:e,value:t,onChange:r,min:n,max:a,step:i=1,helper:o="",info:s="",infoLink:l=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&d.jsx(Wi,{info:s,link:l})]}),d.jsx("input",{type:"number",value:t,onChange:u=>r(Number(u.target.value)),min:n,max:a,step: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"}),o&&d.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function qt({label:e,checked:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){return d.jsxs("div",{className:"flex items-center justify-between py-2",children:[d.jsxs("div",{children:[d.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,a&&d.jsx(Wi,{info:a,link:i})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}),d.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function Dn({label:e,value:t,onChange:r,options:n,helper:a="",info:i="",infoLink:o=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&d.jsx(Wi,{info:i,link:o})]}),d.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=>d.jsx("option",{value:s.value,children:s.label},s.value))}),a&&d.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function pCe({label:e,value:t,onChange:r,rows:n=4,helper:a="",info:i="",infoLink:o=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&d.jsx(Wi,{info:i,link:o})]}),d.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"}),a&&d.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function la({label:e,value:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){const[o,s]=E.useState(t.join(", "));E.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>c.trim()).filter(Boolean);r(u)};return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Wi,{info:a,link:i})]}),d.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&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function X2({label:e,value:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){const[o,s]=E.useState(t.join(", "));E.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>parseInt(c.trim(),10)).filter(c=>!isNaN(c));r(u)};return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Wi,{info:a,link:i})]}),d.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&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function Pn({label:e,description:t,checked:r,onChange:n,threshold:a,onThresholdChange:i,thresholdLabel:o,thresholdMin:s,thresholdMax:l,thresholdStep:u=1,thresholdSuffix:c=""}){return d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx("span",{className:"text-sm text-slate-300",children:e}),d.jsx("p",{className:"text-xs text-slate-600",children:t})]}),d.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:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${r?"translate-x-5":""}`})})]}),r&&a!==void 0&&i&&d.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-[#1e2a3a]",children:[d.jsxs("span",{className:"text-xs text-slate-500",children:[o||"Threshold",":"]}),d.jsx("input",{type:"number",value:a,onChange:h=>i(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&&d.jsx("span",{className:"text-xs text-slate-500",children:c})]})]})}function gCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.bot}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{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."}),d.jsx(yt,{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."}),d.jsx(yt,{label:"Contact Email",value:e.contact_email||"",onChange:r=>t({...e,contact_email:r}),helper:"Used to synthesize the NWS User-Agent",info:"An email address identifying the operator; sent as the User-Agent when fetching NWS weather data (NWS requires a contact). Stored in local.yaml."})]}),d.jsx(qt,{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."}),d.jsx(qt,{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 mCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.connection}),d.jsx(Dn,{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"?d.jsx(AZ,{label:"Serial Port",value:e.serial_port,onChange:r=>t({...e,serial_port:r}),helper:"Device path for your USB radio — Detect fills a stable by-id path"}):d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{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"}),d.jsx(Ae,{label:"TCP Port",value:e.tcp_port,onChange:r=>t({...e,tcp_port:r}),min:1,max:65535,helper:"Default 4403 for meshtasticd"})]}),d.jsx("div",{className:"pt-2",children:d.jsx(uf,{to:"/meshcore/connection",className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-accent transition-colors",children:"→ MeshCore connection"})})]})}function yCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.response}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{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."}),d.jsx(Ae,{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."})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{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."}),d.jsx(Ae,{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 xCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.history}),d.jsx(yt,{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."}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{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."}),d.jsx(Ae,{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."})]}),d.jsx(qt,{label:"Auto Cleanup",checked:e.auto_cleanup,onChange:r=>t({...e,auto_cleanup:r}),helper:"Automatically prune old conversations"}),e.auto_cleanup&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Cleanup Interval (hours)",value:e.cleanup_interval_hours,onChange:r=>t({...e,cleanup_interval_hours:r}),min:1,helper:"Hours between cleanup runs"}),d.jsx(Ae,{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 _Ce({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.memory}),d.jsx(qt,{label:"Enable Memory",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Keep conversation context between messages"}),e.enabled&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{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."}),d.jsx(Ae,{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 bCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.context}),d.jsx(qt,{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&&d.jsx(d.Fragment,{children:d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Chat context retention (days)",value:Math.round((e.max_age??1209600)/86400),onChange:r=>t({...e,max_age:r*86400}),min:1,helper:"How long the bot remembers recent channel chat for context (applies to both meshes). Default 14 days."}),d.jsx(Ae,{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 wCe({data:e,onChange:t}){const r=new Set(e.disabled_commands.map(s=>s.toLowerCase())),[n,a]=E.useState(()=>Object.entries(e.custom_commands||{}));E.useEffect(()=>{const s={};for(const[l,u]of n)l.trim()&&(s[l.trim()]=u);JSON.stringify(s)!==JSON.stringify(e.custom_commands||{})&&a(Object.entries(e.custom_commands||{}))},[e.custom_commands]);const i=s=>{a(s);const l={};for(const[u,c]of s)u.trim()&&(l[u.trim()]=c);t({...e,custom_commands:l})},o=s=>{const l=s.toLowerCase();r.has(l)?t({...e,disabled_commands:e.disabled_commands.filter(u=>u.toLowerCase()!==l)}):t({...e,disabled_commands:[...e.disabled_commands,s]})};return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.commands}),d.jsx(qt,{label:"Enable Commands",checked:e.enabled,onChange:s=>t({...e,enabled:s}),helper:"Allow !commands on the mesh"}),e.enabled&&d.jsxs(d.Fragment,{children:[d.jsx(yt,{label:"Command Prefix",value:e.prefix,onChange:s=>t({...e,prefix:s}),helper:"Character that triggers commands (e.g. ! for !help)",info:"Users type this character followed by the command name. Only single characters recommended."}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Available Commands",d.jsx(Wi,{info:"Toggle commands on or off. Disabled commands won't respond when users invoke them."})]}),d.jsx("div",{className:"grid gap-1",children:fCe.map(s=>{const l=!r.has(s.name.toLowerCase());return d.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#0a0e17] border border-[#1e2a3a] rounded hover:border-[#2a3a4a] transition-colors",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("code",{className:"text-accent text-sm",children:["!",s.name]}),d.jsx("span",{className:"text-xs text-slate-500",children:s.description})]}),d.jsx("button",{type:"button",onClick:()=>o(s.name),className:`relative w-9 h-5 rounded-full transition-colors ${l?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${l?"translate-x-4":""}`})})]},s.name)})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Custom Commands",d.jsx(Wi,{info:"Define your own commands. When a user types the prefix followed by the name, the bot replies with the response text verbatim."})]}),n.map(([s,l],u)=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("input",{type:"text",value:s,onChange:c=>{const h=n.map((f,v)=>v===u?[c.target.value,f[1]]:f);i(h)},placeholder:"name",className:"w-40 flex-shrink-0 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"}),d.jsx("input",{type:"text",value:l,onChange:c=>{const h=n.map((f,v)=>v===u?[f[0],c.target.value]:f);i(h)},placeholder:"response text",className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsx("button",{type:"button",onClick:()=>i(n.filter((c,h)=>h!==u)),className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded flex-shrink-0","aria-label":"Remove custom command",children:d.jsx(li,{size:14})})]},u)),d.jsxs("button",{type:"button",onClick:()=>i([...n,["",""]]),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:[d.jsx(si,{size:16})," Add Custom Command"]})]})]})]})}function SCe({data:e,onChange:t}){const r={openai:"OPENAI_API_KEY",anthropic:"ANTHROPIC_API_KEY",google:"GOOGLE_API_KEY"}[(e.backend||"").toLowerCase()]||"LLM_API_KEY";return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.llm}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Dn,{label:"Backend",value:e.backend,onChange:n=>t({...e,backend:n}),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."}),d.jsx(yt,{label:"Model",value:e.model,onChange:n=>t({...e,model:n}),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)."})]}),d.jsx($p,{envVar:r,label:"API Key",helper:"Secret stored in /data/secrets/.env; config holds the ${VAR} ref"}),d.jsx(yt,{label:"Base URL",value:e.base_url,onChange:n=>t({...e,base_url:n}),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."}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Timeout (sec)",value:e.timeout,onChange:n=>t({...e,timeout:n}),min:5,max:120,helper:"Maximum seconds to wait for response"}),d.jsx(Ae,{label:"Max Response Tokens",value:e.max_response_tokens,onChange:n=>t({...e,max_response_tokens:n}),min:100,helper:"Token limit for LLM responses"})]}),d.jsx(qt,{label:"Use System Prompt",checked:e.use_system_prompt,onChange:n=>t({...e,use_system_prompt:n}),helper:"Enable custom system instructions"}),e.use_system_prompt&&d.jsx(pCe,{label:"System Prompt",value:e.system_prompt,onChange:n=>t({...e,system_prompt:n}),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."}),d.jsx(qt,{label:"Web Search",checked:e.web_search,onChange:n=>t({...e,web_search:n}),helper:"Enable web search tool (Open WebUI feature)"}),d.jsx(qt,{label:"Google Grounding",checked:e.google_grounding,onChange:n=>t({...e,google_grounding:n}),helper:"Ground responses in web search (Gemini only)"})]})}function CCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.weather}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Dn,{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"}),d.jsx(Dn,{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"})]}),d.jsx(yt,{label:"Default Location",value:e.default_location,onChange:r=>t({...e,default_location:r}),placeholder:"Your city, state",helper:"Location when none specified"}),d.jsx(yt,{label:"Open-Meteo base URL (advanced)",value:e.openmeteo.url,onChange:r=>t({...e,openmeteo:{...e.openmeteo,url:r}}),placeholder:"https://api.open-meteo.com/v1",helper:"Override the Open-Meteo API endpoint (leave default unless self-hosting)"}),d.jsx(yt,{label:"wttr.in base URL (advanced)",value:e.wttr.url,onChange:r=>t({...e,wttr:{...e.wttr,url:r}}),placeholder:"https://wttr.in",helper:"Override the wttr.in endpoint (leave default unless self-hosting)"})]})}function TCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.meshmonitor}),d.jsx(qt,{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&&d.jsxs(d.Fragment,{children:[d.jsx(yt,{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."}),d.jsx(qt,{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."}),d.jsx(Ae,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:r=>t({...e,refresh_interval:r}),min:10,helper:"How often to fetch patterns"}),d.jsx(qt,{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 MCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.knowledge}),d.jsx(qt,{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&&d.jsxs(d.Fragment,{children:[d.jsx(Dn,{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")&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{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."}),d.jsx(Ae,{label:"Qdrant Port",value:e.qdrant_port,onChange:r=>t({...e,qdrant_port:r}),helper:"Default 6333"})]}),d.jsx(yt,{label:"Collection",value:e.qdrant_collection,onChange:r=>t({...e,qdrant_collection:r}),helper:"Qdrant collection name"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{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."}),d.jsx(Ae,{label:"TEI Port",value:e.tei_port,onChange:r=>t({...e,tei_port:r}),helper:"Default 8090"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Sparse Host",value:e.sparse_host,onChange:r=>t({...e,sparse_host:r}),placeholder:"localhost",helper:"SPLADE sparse-embedding service host",info:"Host of the SPLADE service that generates sparse (keyword-weighted) embeddings for hybrid search."}),d.jsx(Ae,{label:"Sparse Port",value:e.sparse_port,onChange:r=>t({...e,sparse_port:r}),helper:"Default 8091"})]}),d.jsx(qt,{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."})]}),d.jsx(yt,{label:"SQLite DB Path",value:e.db_path,onChange:r=>t({...e,db_path:r}),helper:"Local knowledge database file"}),d.jsx(Ae,{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 ACe({source:e,onChange:t,onDelete:r}){const[n,a]=E.useState(!1),i={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 d.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>a(!n),children:[d.jsxs("div",{className:"flex items-center gap-3",children:[n?d.jsx(Em,{size:16}):d.jsx(Ah,{size:16}),d.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`}),d.jsx("span",{className:"font-mono text-sm text-slate-200",children:e.name||"Unnamed Source"}),d.jsx("span",{className:"text-xs text-slate-500 bg-[#1e2a3a] px-2 py-0.5 rounded",children:e.type})]}),d.jsx("button",{onClick:o=>{o.stopPropagation(),r()},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:d.jsx(li,{size:14})})]}),n&&d.jsxs("div",{className:"p-4 space-y-4 border-t border-[#1e2a3a]",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Name",value:e.name,onChange:o=>t({...e,name:o}),helper:"Friendly name for this source"}),d.jsx(Dn,{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:i[e.type]||""})]}),e.type!=="mqtt"&&d.jsx(yt,{label:"URL",value:e.url,onChange:o=>t({...e,url:o}),helper:"Full URL including protocol"}),e.type==="meshmonitor"&&d.jsx(yt,{label:"API Token",value:e.api_token,onChange:o=>t({...e,api_token:o}),type:"password",helper:"Bearer token for authentication"}),e.type==="mqtt"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Host",value:e.host||"",onChange:o=>t({...e,host:o}),helper:"MQTT broker hostname"}),d.jsx(Ae,{label:"Port",value:e.port||1883,onChange:o=>t({...e,port:o}),min:1,max:65535,helper:"1883 plain, 8883 TLS"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Username",value:e.username||"",onChange:o=>t({...e,username:o})}),d.jsx(yt,{label:"Password",value:e.password||"",onChange:o=>t({...e,password:o}),type:"password"})]}),d.jsx(yt,{label:"Topic Root",value:e.topic_root||"msh/US",onChange:o=>t({...e,topic_root:o}),helper:"Base topic to subscribe to"}),d.jsx(qt,{label:"Use TLS",checked:e.use_tls||!1,onChange:o=>t({...e,use_tls:o}),helper:"Encrypt MQTT connection"})]}),d.jsx(Ae,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:o=>t({...e,refresh_interval:o}),min:10,helper:"Polling frequency"}),d.jsx(qt,{label:"Enabled",checked:e.enabled,onChange:o=>t({...e,enabled:o})}),d.jsx(qt,{label:"Polite Mode",checked:e.polite_mode,onChange:o=>t({...e,polite_mode:o}),helper:"Reduce polling for shared instances"})]})]})}function NCe({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 d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.mesh_sources}),e.map((n,a)=>d.jsx(ACe,{source:n,onChange:i=>{const o=[...e];o[a]=i,t(o)},onDelete:()=>{confirm(`Delete source "${n.name}"?`)&&t(e.filter((i,o)=>o!==a))}},a)),d.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:[d.jsx(si,{size:16})," Add Source"]})]})}function NZ({data:e,onChange:t}){const[r,n]=E.useState(null);return d.jsxs("div",{className:"space-y-6",children:[d.jsx(wa,{text:ba.mesh_intelligence}),d.jsx(qt,{label:"Enable Mesh Intelligence",checked:e.enabled,onChange:a=>t({...e,enabled:a}),helper:"Activate health scoring and alerting"}),e.enabled&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Locality Radius (miles)",value:e.locality_radius_miles,onChange:a=>t({...e,locality_radius_miles:a}),min:1,step:.5,helper:"Region assignment radius",info:"Nodes within this distance of a region anchor point are assigned to that region."}),d.jsx(Ae,{label:"Offline Threshold (hours)",value:e.offline_threshold_hours,onChange:a=>t({...e,offline_threshold_hours:a}),min:1,helper:"Time until node marked offline",info:"A node is considered offline after not being heard for this many hours."})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Packet Threshold",value:e.packet_threshold,onChange:a=>t({...e,packet_threshold:a}),min:0,helper:"Min packets per 24h to flag",info:"Minimum packets per 24 hours. Nodes below this are flagged as low activity."}),d.jsx(Ae,{label:"Battery Warning %",value:e.battery_warning_percent,onChange:a=>t({...e,battery_warning_percent:a}),min:1,max:100,helper:"Global battery warning level"})]}),d.jsx(PP,{label:"Critical Nodes",value:e.critical_nodes,onChange:a=>t({...e,critical_nodes:a}),helper:"Critical infrastructure nodes",info:"Nodes that get priority alerting when they go offline.",roleFilter:"infrastructure"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(DP,{label:"Alert Channel",value:e.alert_channel,onChange:a=>t({...e,alert_channel:a}),helper:"Channel for broadcast alerts",info:"Meshtastic channel for broadcast alerts. Select Disabled to turn off channel broadcasting.",mode:"single",includeDisabled:!0}),d.jsx(Ae,{label:"Alert Cooldown (min)",value:e.alert_cooldown_minutes,onChange:a=>t({...e,alert_cooldown_minutes:a}),min:1,helper:"Min time between repeat alerts",info:"Minimum minutes between repeated alerts for the same condition. Uses scaling cooldown (12h, 24h, 48h)."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Regions",d.jsx(Wi,{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((a,i)=>d.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>n(r===i?null:i),children:[d.jsxs("div",{className:"flex items-center gap-3",children:[r===i?d.jsx(Em,{size:16}):d.jsx(Ah,{size:16}),d.jsx("span",{className:"font-medium text-slate-200",children:a.name||"Unnamed Region"}),d.jsx("span",{className:"text-xs text-slate-500",children:a.local_name})]}),d.jsx("button",{onClick:o=>{if(o.stopPropagation(),confirm(`Delete region "${a.name||"Unnamed Region"}"?`)){const s=e.regions.filter((l,u)=>u!==i);t({...e,regions:s})}},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:d.jsx(li,{size:14})})]}),r===i&&d.jsxs("div",{className:"p-4 space-y-3 border-t border-[#1e2a3a]",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"Name",value:a.name,onChange:o=>{const s=[...e.regions];s[i]={...a,name:o},t({...e,regions:s})}}),d.jsx(yt,{label:"Local Name",value:a.local_name,onChange:o=>{const s=[...e.regions];s[i]={...a,local_name:o},t({...e,regions:s})}})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Latitude",value:a.lat,onChange:o=>{const s=[...e.regions];s[i]={...a,lat:o},t({...e,regions:s})},step:1e-4}),d.jsx(Ae,{label:"Longitude",value:a.lon,onChange:o=>{const s=[...e.regions];s[i]={...a,lon:o},t({...e,regions:s})},step:1e-4})]}),d.jsx(yt,{label:"Description",value:a.description,onChange:o=>{const s=[...e.regions];s[i]={...a,description:o},t({...e,regions:s})}}),d.jsx(la,{label:"Aliases",value:a.aliases,onChange:o=>{const s=[...e.regions];s[i]={...a,aliases:o},t({...e,regions:s})}}),d.jsx(la,{label:"Cities",value:a.cities,onChange:o=>{const s=[...e.regions];s[i]={...a,cities:o},t({...e,regions:s})}})]})]},i)),d.jsxs("button",{onClick:()=>{const a={name:"",local_name:"",lat:0,lon:0,description:"",aliases:[],cities:[]};t({...e,regions:[...e.regions,a]}),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:[d.jsx(si,{size:16})," Add Region"]})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Rules",d.jsx(Wi,{info:"Configure which conditions trigger alerts. Each rule can have an optional threshold value."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Infrastructure"}),d.jsx(Pn,{label:"Infra Offline",description:"Alert when an infrastructure node (router/repeater) goes offline",checked:e.alert_rules.infra_offline,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_offline:a}})}),d.jsx(Pn,{label:"Infra Recovery",description:"Alert when an offline infrastructure node comes back online",checked:e.alert_rules.infra_recovery,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_recovery:a}})}),d.jsx(Pn,{label:"New Router",description:"Alert when a new router/repeater appears on the mesh",checked:e.alert_rules.new_router,onChange:a=>t({...e,alert_rules:{...e.alert_rules,new_router:a}})}),d.jsx(Pn,{label:"Feeder Offline",description:"Alert when a data source (MeshView/MeshMonitor) stops responding",checked:e.alert_rules.feeder_offline,onChange:a=>t({...e,alert_rules:{...e.alert_rules,feeder_offline:a}})}),d.jsx(Pn,{label:"Single Gateway",description:"Alert when an infrastructure node has only one connection path",checked:e.alert_rules.infra_single_gateway,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_single_gateway:a}})}),d.jsx(Pn,{label:"Region Blackout",description:"Alert when all infrastructure in a region goes offline",checked:e.alert_rules.region_total_blackout,onChange:a=>t({...e,alert_rules:{...e.alert_rules,region_total_blackout:a}})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Power"}),d.jsx(Pn,{label:"Battery Warning",description:"Alert when infra node battery drops below warning threshold",checked:e.alert_rules.battery_warning,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_warning:a}}),threshold:e.alert_rules.battery_warning_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_warning_threshold:a}}),thresholdLabel:"Below",thresholdMin:10,thresholdMax:90,thresholdSuffix:"%"}),d.jsx(Pn,{label:"Battery Critical",description:"Alert at critical battery level",checked:e.alert_rules.battery_critical,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_critical:a}}),threshold:e.alert_rules.battery_critical_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_critical_threshold:a}}),thresholdLabel:"Below",thresholdMin:5,thresholdMax:50,thresholdSuffix:"%"}),d.jsx(Pn,{label:"Battery Emergency",description:"Alert at emergency battery level",checked:e.alert_rules.battery_emergency,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_emergency:a}}),threshold:e.alert_rules.battery_emergency_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_emergency_threshold:a}}),thresholdLabel:"Below",thresholdMin:1,thresholdMax:25,thresholdSuffix:"%"}),d.jsx(Pn,{label:"Battery Trend Declining",description:"Alert when battery shows a declining trend over 7 days",checked:e.alert_rules.battery_trend_declining,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_trend_declining:a}})}),d.jsx(Pn,{label:"Power Source Change",description:"Alert when a node switches between battery and USB power",checked:e.alert_rules.power_source_change,onChange:a=>t({...e,alert_rules:{...e.alert_rules,power_source_change:a}})}),d.jsx(Pn,{label:"Solar Not Charging",description:"Alert when a solar-powered node isn't charging during daylight",checked:e.alert_rules.solar_not_charging,onChange:a=>t({...e,alert_rules:{...e.alert_rules,solar_not_charging:a}})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Utilization"}),d.jsx(Pn,{label:"High Utilization",description:"Alert when channel utilization stays high for extended periods",checked:e.alert_rules.sustained_high_util,onChange:a=>t({...e,alert_rules:{...e.alert_rules,sustained_high_util:a}}),threshold:e.alert_rules.high_util_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,high_util_threshold:a}}),thresholdLabel:"Above",thresholdMin:5,thresholdMax:50,thresholdSuffix:`% for ${e.alert_rules.high_util_hours}h`}),e.alert_rules.sustained_high_util&&d.jsx("div",{className:"pl-3",children:d.jsx(Ae,{label:"High-Util Window (hours)",value:e.alert_rules.high_util_hours,onChange:a=>t({...e,alert_rules:{...e.alert_rules,high_util_hours:a}}),min:1,helper:"Sustained duration above the utilization threshold before alerting"})}),d.jsx(Pn,{label:"Packet Flood",description:"Alert when a single node sends excessive packets",checked:e.alert_rules.packet_flood,onChange:a=>t({...e,alert_rules:{...e.alert_rules,packet_flood:a}}),threshold:e.alert_rules.packet_flood_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,packet_flood_threshold:a}}),thresholdLabel:"Over",thresholdMin:100,thresholdMax:2e3,thresholdSuffix:"pkts/24h"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Health Scores"}),d.jsx(Pn,{label:"Mesh Score Alert",description:"Alert when overall mesh health score drops below threshold",checked:e.alert_rules.mesh_score_alert,onChange:a=>t({...e,alert_rules:{...e.alert_rules,mesh_score_alert:a}}),threshold:e.alert_rules.mesh_score_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,mesh_score_threshold:a}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"}),d.jsx(Pn,{label:"Region Score Alert",description:"Alert when a region's health score drops below threshold",checked:e.alert_rules.region_score_alert,onChange:a=>t({...e,alert_rules:{...e.alert_rules,region_score_alert:a}}),threshold:e.alert_rules.region_score_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,region_score_threshold:a}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"})]})]})]})]})}function kCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.dashboard}),d.jsx(qt,{label:"Enable Dashboard",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Run the web dashboard"}),e.enabled&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{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."}),d.jsx(Ae,{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 LCe({timezone:e,onSave:t}){const[r,n]=E.useState(e);return E.useEffect(()=>{n(e)},[e]),d.jsxs("div",{className:"space-y-4 mb-6 pb-6 border-b border-[#1e2a3a]",children:[d.jsx("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:"General"}),d.jsx(yt,{label:"Timezone",value:r,onChange:a=>{n(a),t(a)},placeholder:"America/Boise",helper:"Global IANA timezone, e.g. America/Boise",info:"Global IANA timezone used for local time display across MeshAI. Saved immediately."})]})}function ICe(){var z;const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState("bot"),[s]=cJ();E.useEffect(()=>{const j=s.get("section");j&&Y2.some(B=>B.key===j)&&o(j)},[s]);const[l,u]=E.useState(!0),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(null),[y,x]=E.useState(!1),[_,w]=E.useState(!1),S=E.useCallback(async()=>{try{const j=await fetch("/api/config");if(!j.ok)throw new Error("Failed to fetch config");const B=await j.json();r(B),a(JSON.parse(JSON.stringify(B))),w(!1),v(null)}catch(j){v(j instanceof Error?j.message:"Unknown error")}finally{u(!1)}},[]);E.useEffect(()=>{document.title="Config — MeshAI",S()},[S]),E.useEffect(()=>{t&&n&&w(JSON.stringify(t)!==JSON.stringify(n))},[t,n]),E.useEffect(()=>(e(_),()=>e(!1)),[_,e]);const C=async()=>{if(t){h(!0),v(null),m(null);try{const j=t[i],B=await fetch(`/api/config/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)}),H=await B.json();if(!B.ok)throw new Error(H.detail||"Save failed");m(`${i} saved successfully`),a(JSON.parse(JSON.stringify(t))),w(!1),e(!1),H.restart_required&&(x(!0),bu(Array.isArray(H.changed_keys)?H.changed_keys:[])),setTimeout(()=>m(null),3e3)}catch(j){v(j instanceof Error?j.message:"Save failed")}finally{h(!1)}}},M=()=>{n&&(r(JSON.parse(JSON.stringify(n))),w(!1))},A=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{v("Restart failed")}},I=(j,B)=>{t&&r({...t,[j]:B})},k=async j=>{try{const B=await fetch("/api/config/timezone",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)}),H=await B.json();if(!B.ok)throw new Error(H.detail||"Save failed");r(V=>V&&{...V,timezone:j}),a(V=>V&&{...V,timezone:j})}catch(B){v(B instanceof Error?B.message:"Timezone save failed")}};if(l)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading configuration..."})});if(!t)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load configuration"})});const P=()=>{switch(i){case"bot":return d.jsxs(d.Fragment,{children:[d.jsx(LCe,{timezone:t.timezone,onSave:k}),d.jsx(gCe,{data:t.bot,onChange:j=>I("bot",j)})]});case"response":return d.jsx(yCe,{data:t.response,onChange:j=>I("response",j)});case"history":return d.jsx(xCe,{data:t.history,onChange:j=>I("history",j)});case"memory":return d.jsx(_Ce,{data:t.memory,onChange:j=>I("memory",j)});case"context":return d.jsx(bCe,{data:t.context,onChange:j=>I("context",j)});case"commands":return d.jsx(wCe,{data:t.commands,onChange:j=>I("commands",j)});case"llm":return d.jsx(SCe,{data:t.llm,onChange:j=>I("llm",j)});case"weather":return d.jsx(CCe,{data:t.weather,onChange:j=>I("weather",j)});case"knowledge":return d.jsx(MCe,{data:t.knowledge,onChange:j=>I("knowledge",j)});case"mesh_intelligence":return d.jsx(NZ,{data:t.mesh_intelligence,onChange:j=>I("mesh_intelligence",j)});case"dashboard":return d.jsx(kCe,{data:t.dashboard,onChange:j=>I("dashboard",j)});default:return null}},D=((z=Y2.find(j=>j.key===i))==null?void 0:z.label)||i;return d.jsxs("div",{className:"flex gap-6 h-[calc(100vh-8rem)]",children:[d.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:Y2.map(({key:j,label:B,icon:H})=>d.jsxs("button",{onClick:()=>o(j),className:`w-full flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${i===j?"bg-accent text-white":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover"}`,children:[d.jsx(H,{size:16}),d.jsx("span",{children:B}),_&&i===j&&d.jsx("span",{className:"ml-auto w-2 h-2 bg-amber-500 rounded-full"})]},j))}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[d.jsxs("div",{className:"flex items-center justify-between mb-6",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(FV,{size:20,className:"text-slate-500"}),d.jsx("h2",{className:"text-lg font-semibold text-slate-200",children:D})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[_&&d.jsxs("button",{onClick:M,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:[d.jsx(xa,{size:14}),"Discard"]}),d.jsxs("button",{onClick:C,disabled:c||!_,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:[c?d.jsx(Zi,{size:14,className:"animate-spin"}):d.jsx(_a,{size:14}),"Save"]})]})]}),y&&d.jsxs("div",{className:"flex items-center justify-between p-3 mb-4 bg-amber-500/10 border border-amber-500/30",children:[d.jsxs("div",{className:"flex items-center gap-2 text-amber-400",children:[d.jsx(vi,{size:16}),d.jsx("span",{className:"text-sm",children:"Restart required for changes to take effect"})]}),d.jsx("button",{onClick:A,className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",children:"Restart Now"})]}),f&&d.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:[d.jsx(_u,{size:16}),d.jsx("span",{className:"text-sm",children:f})]}),g&&d.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:[d.jsx(Yr,{size:16}),d.jsx("span",{className:"text-sm",children:g})]}),d.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:d.jsx("div",{className:"bg-bg-card border border-border p-6",children:P()})})]})]})}const PCe=["mesh_broadcast","mesh_dm"],DCe=["meshcore_broadcast","meshcore_dm"],jCe=["routine","priority","immediate"];function Yo({info:e}){const[t,r]=E.useState(!1);return d.jsxs("div",{className:"relative inline-block",children:[d.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&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),d.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 ECe({label:e,value:t,onChange:r,type:n="text",placeholder:a="",helper:i="",info:o=""}){const[s,l]=E.useState(!1),u=n==="password";return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&d.jsx(Yo,{info:o})]}),d.jsxs("div",{className:"relative",children:[d.jsx("input",{type:u&&!s?"password":"text",value:t,onChange:c=>r(c.target.value),placeholder: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 placeholder-slate-600"}),u&&d.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?d.jsx(h1,{size:16}):d.jsx(rv,{size:16})})]}),i&&d.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function qf({label:e,value:t,onChange:r,min:n,max:a,step:i=1,helper:o="",info:s=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&d.jsx(Yo,{info:s})]}),d.jsx("input",{type:"number",value:t,onChange:l=>r(Number(l.target.value)),min:n,max:a,step: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"}),o&&d.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Ch({label:e,checked:t,onChange:r,helper:n="",info:a=""}){return d.jsxs("div",{className:"flex items-center justify-between py-2",children:[d.jsxs("div",{children:[d.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,a&&d.jsx(Yo,{info:a})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}),d.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function q2({label:e,value:t,onChange:r,helper:n="",info:a=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Yo,{info:a})]}),d.jsx("input",{type:"time",value:t,onChange:i=>r(i.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&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function kZ({label:e,value:t,onChange:r,placeholder:n="Add item...",helper:a="",info:i=""}){const[o,s]=E.useState(""),l=()=>{o.trim()&&!t.includes(o.trim())&&(r([...t,o.trim()]),s(""))},u=c=>{r(t.filter((h,f)=>f!==c))};return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&d.jsx(Yo,{info:i})]}),d.jsxs("div",{className:"flex gap-2",children:[d.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}),d.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:d.jsx(si,{size:16})})]}),t.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.map((c,h)=>d.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-[#1e2a3a] rounded text-sm text-slate-300",children:[c,d.jsx("button",{type:"button",onClick:()=>u(h),className:"text-slate-500 hover:text-red-400",children:d.jsx(_u,{size:14})})]},h))}),a&&d.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function LZ({channels:e,severityChannels:t,onChange:r}){const n=a=>a.replace("meshcore_","mc_").replace("mesh_","").replace(/_/g," ");return d.jsxs("table",{className:"text-xs w-full",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{className:"text-left text-slate-600 font-normal w-20",children:"severity"}),e.map(a=>d.jsx("th",{className:"text-slate-500 font-normal px-1 whitespace-nowrap",children:n(a)},a))]})}),d.jsx("tbody",{children:jCe.map(a=>d.jsxs("tr",{children:[d.jsx("td",{className:"text-slate-400 pr-2 whitespace-nowrap",children:a}),e.map(i=>{const o=(t[a]||[]).includes(i);return d.jsx("td",{className:"text-center",children:d.jsx("input",{type:"checkbox",checked:o,onChange:s=>{const l={...t},u=new Set(l[a]||[]);s.target.checked?u.add(i):u.delete(i),l[a]=Array.from(u),r(l)}})},i)})]},a))})]})}const fu=[{key:"mesh_health",label:"Mesh Health",Icon:Oo},{key:"weather",label:"Weather",Icon:kh},{key:"fire",label:"Fire",Icon:Rm},{key:"rf_propagation",label:"RF Propagation",Icon:_i},{key:"roads",label:"Roads",Icon:u1},{key:"avalanche",label:"Avalanche",Icon:VV},{key:"satpass",label:"Satellite Passes",Icon:f1},{key:"seismic",label:"Seismic",Icon:kf},{key:"tracking",label:"Tracking",Icon:av}];function RCe(e){const t=new Set(fu.map(n=>n.key)),r=[];for(const n of e)!n||!n.key||t.has(n.key)||(t.add(n.key),r.push({key:n.key,label:n.label||n.key,Icon:RV}));return[...fu,...r]}let lx=null,K2=null;function IZ(){const[e,t]=E.useState(lx??fu);return E.useEffect(()=>{let r=!1;if(lx){t(lx);return}return K2||(K2=fetch("/api/notifications/families").then(n=>n.ok?n.json():[]).then(n=>{const a=RCe(Array.isArray(n)?n:[]);return lx=a,a}).catch(()=>fu)),K2.then(n=>{r||t(n)}),()=>{r=!0}},[]),e}function OCe(e,t,r){const n=e?{...e}:{...t,name:r};n.name=t.name||n.name||r;const a=(e==null?void 0:e.severity_channels)||{},i=t.severity_channels||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};return o.forEach(l=>{const u=(a[l]||[]).filter(h=>h.startsWith("meshcore_")),c=(i[l]||[]).filter(h=>!h.startsWith("meshcore_"));s[l]=[...u,...c]}),n.severity_channels=s,n.broadcast_channel=t.broadcast_channel,n.node_ids=t.node_ids,n}function zCe(e,t){const r=(t==null?void 0:t.mt_enabled)??(t==null?void 0:t.enabled)??!1,n=(e==null?void 0:e.mc_enabled)??!1,a=(e==null?void 0:e.cells)||{},i=(t==null?void 0:t.cells)||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};for(const l of o){const u=a[l]||{},c=i[l]||{},h=new Set([...Object.keys(u),...Object.keys(c)]),f={};for(const v of h){const g=u[v],m=c[v],y={mt:m!==void 0?m.mt:(g==null?void 0:g.mt)??null,mc:(g==null?void 0:g.mc)??null,min_severity:(m==null?void 0:m.min_severity)??(g==null?void 0:g.min_severity)??"routine",enabled:(m==null?void 0:m.enabled)??(g==null?void 0:g.enabled)??!0},x=y.mc;(y.mt!==null||x!==null&&x.trim()!=="")&&(f[v]=y)}Object.keys(f).length>0&&(s[l]=f)}return{mt_enabled:r,mc_enabled:n,cells:s}}function BCe({toggles:e,onChange:t,regions:r,regionRoutes:n,onRegionRoutesChange:a}){const i=IZ(),o=(h,f)=>t({...e,[h]:{...e[h]||{},...f}}),[s,l]=E.useState({}),u=(h,f,v)=>{var y,x,_;const g=((x=(y=n==null?void 0:n.cells)==null?void 0:y[h])==null?void 0:x[f])??{mt:null,mc:null,min_severity:"routine",enabled:!0},m={...(n==null?void 0:n.cells)||{},[h]:{...((_=n==null?void 0:n.cells)==null?void 0:_[h])||{},[f]:{...g,mt:v}}};a({mt_enabled:(n==null?void 0:n.mt_enabled)??(n==null?void 0:n.enabled)??!1,mc_enabled:(n==null?void 0:n.mc_enabled)??!1,cells:m})},c=h=>{var m;const f=((m=n==null?void 0:n.cells)==null?void 0:m[h])||{},v={};for(const[y,x]of Object.entries(f))v[y]={...x,mt:null};const g={...(n==null?void 0:n.cells)||{},[h]:v};a({mt_enabled:(n==null?void 0:n.mt_enabled)??(n==null?void 0:n.enabled)??!1,mc_enabled:(n==null?void 0:n.mc_enabled)??!1,cells:g})};return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Meshtastic Delivery",d.jsx(Yo,{info:"Per-family Meshtastic delivery matrix. Choose which channels fire at each severity, the broadcast channel index, and DM node IDs. Family on/off and severity threshold are configured on the Data Feeds page."})]}),d.jsx("div",{className:"border border-[#1e2a3a] p-3",children:d.jsx(Ch,{label:"Enable Meshtastic region routing",checked:(n==null?void 0:n.mt_enabled)??(n==null?void 0:n.enabled)??!1,onChange:h=>a({mt_enabled:h,mc_enabled:(n==null?void 0:n.mc_enabled)??!1,cells:(n==null?void 0:n.cells)||{}}),helper:"Master switch for per-region Meshtastic channel routing. When off, families deliver only to their default Meshtastic channels."})}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:i.map(({key:h,label:f,Icon:v})=>{var w;const g=e[h]||{},m=((w=n==null?void 0:n.cells)==null?void 0:w[h])||{},y=r.some(S=>{var C;return((C=m[S])==null?void 0:C.mt)!=null}),x=s[h],_=x!==void 0?x:y;return d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-200",children:[d.jsx(v,{size:15})," ",f]}),d.jsxs("div",{className:"space-y-3 p-3 bg-[#0a0e17] border border-[#1e2a3a]",children:[d.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-300",children:[d.jsx(_i,{size:13}),"Meshtastic"]}),d.jsx(LZ,{channels:PCe,severityChannels:g.severity_channels||{},onChange:S=>o(h,{severity_channels:S})}),d.jsx(qf,{label:"Broadcast channel",value:g.broadcast_channel??0,onChange:S=>o(h,{broadcast_channel:S}),min:0,helper:"Meshtastic channel index (0 = LongFast primary)",info:"The Meshtastic channel index used for mesh_broadcast delivery. 0 = primary channel."}),d.jsx(kZ,{label:"DM node IDs",value:g.node_ids||[],onChange:S=>o(h,{node_ids:S}),placeholder:"!hex_id",helper:"Meshtastic DM recipients (hex node IDs)",info:"Hex node IDs for mesh_dm delivery (e.g. !a1b2c3d4). Used when mesh_dm is enabled for a severity."})]}),d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[d.jsx(Ch,{label:"Region-based routing",checked:_,onChange:S=>{l(C=>({...C,[h]:S})),S||c(h)},helper:"Route this family to different MT channels per region"}),_&&(r.length===0?d.jsxs("p",{className:"text-xs text-slate-500 italic",children:["No regions yet — add them on the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage"})," page."]}):d.jsx("div",{className:"space-y-1.5 pt-1",children:r.map(S=>{const C=m[S]??{mt:null};return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-xs text-slate-400 flex-1 min-w-0 truncate",children:S}),d.jsx("input",{type:"number",value:C.mt!==null?C.mt:"",onChange:M=>{const A=M.target.value;u(h,S,A===""?null:parseInt(A,10))},min:0,max:7,placeholder:"ch",className:"w-16 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono focus:outline-none focus:border-accent"})]},S)})}))]})]},h)})})]})}function FCe(){const{setDirty:e}=$i(),t=IZ(),[r,n]=E.useState(null),[a,i]=E.useState(null),[o,s]=E.useState([]),[l,u]=E.useState(!0),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(null),[y,x]=E.useState(!1),_=E.useCallback(async()=>{try{const[C,M]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/regions")]);if(!C.ok)throw new Error("Failed to fetch notifications config");const A=await C.json(),I=M.ok?await M.json():[];n(A),i(JSON.parse(JSON.stringify(A))),s(Array.isArray(I)?I:[]),x(!1),v(null)}catch(C){v(C instanceof Error?C.message:"Unknown error")}finally{u(!1)}},[]);E.useEffect(()=>{document.title="Meshtastic Routing - MeshAI",_()},[_]),E.useEffect(()=>{r&&a&&x(JSON.stringify(r)!==JSON.stringify(a))},[r,a]),E.useEffect(()=>(e(y),()=>e(!1)),[y,e]);const w=async()=>{if(r){h(!0),v(null),m(null);try{const C=await fetch("/api/config/notifications");if(!C.ok)throw new Error("Failed to re-fetch notifications config");const M=await C.json(),A={...M,toggles:{...M.toggles||{}},region_routes:zCe(M.region_routes,r.region_routes)},I=r.toggles||{};for(const{key:D}of t){const z=I[D];z&&(A.toggles[D]=OCe((M.toggles||{})[D],z,D))}const k=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),P=await k.json();if(!k.ok)throw new Error(P.detail||"Save failed");n(A),i(JSON.parse(JSON.stringify(A))),x(!1),e(!1),m("Meshtastic routing saved successfully"),setTimeout(()=>m(null),3e3)}catch(C){v(C instanceof Error?C.message:"Save failed")}finally{h(!1)}}},S=()=>{a&&(n(JSON.parse(JSON.stringify(a))),x(!1))};return l?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading notifications config..."})}):r?d.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsxs("p",{className:"text-sm text-slate-500",children:["Per-family Meshtastic delivery. Family gating (enable, severity threshold, freshness/cooldown) is on"," ",d.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"}),". MeshCore delivery is on the"," ",d.jsx("a",{href:"/meshcore/routing",className:"text-accent hover:underline",children:"MeshCore Routing"})," page."]})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:_,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:S,disabled:!y,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:w,disabled:c||!y,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:[d.jsx(_a,{size:16}),c?"Saving...":"Save"]})]})]}),f&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:f}),g&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),g]}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:r.toggles?d.jsx(BCe,{toggles:r.toggles,onChange:C=>n({...r,toggles:C}),regions:o,regionRoutes:r.region_routes,onRegionRoutesChange:C=>n({...r,region_routes:C})}):d.jsx("p",{className:"text-sm text-slate-500",children:"No family configuration found."})})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})})}const VCe={wfigs:["allowed_incident_types","freshness_seconds","cooldown_seconds","broadcast_on_acres","broadcast_on_contained"],tomtom_incidents:["min_magnitude","drop_non_present","drop_zero_magnitude"],itd_511:["min_severity","enabled_categories","enabled_sub_types"],wzdx:["broadcast","min_severity","sub_types"],nws:["broadcast_severities","duplicate_allowed_after_seconds"],avalanche:["min_danger_level"],swpc:["geomag_kp_floor","flare_class_floor","proton_pfu_floor"],satpass:["enabled","observers","min_elevation","norad_ids","max_broadcasts_per_hour","dry_run"]},GCe=1500;function PZ({excludeKeys:e,hideLlmToggle:t}={}){const[r,n]=E.useState({}),[a,i]=E.useState({}),[o,s]=E.useState(!0),[l,u]=E.useState(null),[c,h]=E.useState({}),[f,v]=E.useState({}),[g,m]=E.useState({}),y=E.useCallback(async()=>{s(!0),u(null);try{const[M,A]=await Promise.all([fetch("/api/adapter-config"),fetch("/api/adapter-meta")]);if(!M.ok)throw new Error(`GET /adapter-config: ${M.status}`);if(!A.ok)throw new Error(`GET /adapter-meta: ${A.status}`);n(await M.json()),i(await A.json())}catch(M){u(String(M))}finally{s(!1)}},[]);E.useEffect(()=>{y()},[y]);const x=E.useCallback((M,A,I)=>{v(k=>({...k,[M]:A})),I&&m(k=>({...k,[M]:I})),A==="saved"&&setTimeout(()=>{v(k=>k[M]==="saved"?{...k,[M]:"idle"}:k)},GCe)},[]),_=E.useCallback(async(M,A,I)=>{const k=`${M}.${A}`;x(k,"saving");try{const P=await fetch(`/api/adapter-config/${M}/${A}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:I})});if(!P.ok){const j=(await P.json().catch(()=>({}))).detail||P.statusText;x(k,"error",String(j));return}const D=await P.json();n(z=>({...z,[M]:(z[M]||[]).map(j=>j.key===A?D:j)})),x(k,"saved")}catch(P){x(k,"error",String(P))}},[x]),w=E.useCallback(async(M,A)=>{const I=`${M}.${A}`;x(I,"saving");try{const k=await fetch(`/api/adapter-config/${M}/${A}/reset`,{method:"POST"});if(!k.ok){x(I,"error",`reset failed (${k.status})`);return}const P=await k.json();n(D=>({...D,[M]:(D[M]||[]).map(z=>z.key===A?P:z)})),x(I,"saved")}catch(k){x(I,"error",String(k))}},[x]),S=E.useCallback(async(M,A)=>{const I=`meta:${M}`;x(I,"saving");try{const k=await fetch(`/api/adapter-meta/${M}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!k.ok){const D=await k.json().catch(()=>({}));x(I,"error",String(D.detail||k.statusText));return}const P=await k.json();i(D=>({...D,[M]:P})),x(I,"saved")}catch(k){x(I,"error",String(k))}},[x]);if(o)return d.jsxs("div",{className:"p-6 flex items-center gap-2 text-[#777]",children:[d.jsx(nv,{className:"w-5 h-5 animate-spin"})," Loading adapter config…"]});if(l)return d.jsxs("div",{className:"p-6 text-red-400",children:[d.jsx(Nh,{className:"w-5 h-5 inline mr-2"}),"Failed to load: ",l]});const C=Array.from(new Set([...Object.keys(a),...Object.keys(r)])).sort();return d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2 text-white",children:[d.jsx(Bg,{className:"w-5 h-5"}),d.jsx("h1",{className:"text-xl font-semibold",children:"Adapter Config"}),d.jsxs("span",{className:"text-xs text-[#666] ml-2",children:[Object.entries(r).reduce((M,[A,I])=>M+(e!=null&&e[A]?I.filter(k=>!e[A].includes(k.key)).length:I.length),0)," settings across ",C.length," adapters"]})]}),d.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 ",d.jsx("a",{href:"/reference#adapter-config",className:"text-accent hover:underline",children:"Adapter Config & the CODE Rule"})," in Reference. The ",d.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."]}),C.map(M=>{var j;const A=a[M]||{display_name:M,include_in_llm_context:!0,description:""},I=r[M]||[],k=e!=null&&e[M]?I.filter(B=>!e[M].includes(B.key)):I,P=c[M]??!1,D=`meta:${M}`,z=f[D]||"idle";return d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"p-4 flex items-start gap-4",children:[d.jsx("button",{onClick:()=>h(B=>({...B,[M]:!B[M]})),className:"text-[#777] hover:text-white","aria-label":"toggle expand",children:P?d.jsx(Em,{className:"w-5 h-5"}):d.jsx(Ah,{className:"w-5 h-5"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h2",{className:"text-base font-semibold text-white",children:A.display_name}),d.jsx("code",{className:"text-xs text-[#666]",children:M}),k.length>0&&d.jsxs("span",{className:"text-xs text-[#777] ml-1",children:["(",k.length," settings",(j=e==null?void 0:e[M])!=null&&j.length?`, ${e[M].length} curated`:"",")"]}),k.length===0&&d.jsx("span",{className:"text-xs text-[#666] ml-1 italic",children:I.length>0?"(all curated)":"(meta only)"})]}),A.description&&d.jsx("p",{className:"text-xs text-[#777] mt-1",children:A.description})]}),!t&&d.jsxs("label",{className:"flex items-center gap-2 text-xs text-[#e0e0e0] select-none",children:[d.jsx("input",{type:"checkbox",checked:A.include_in_llm_context,onChange:B=>S(M,{include_in_llm_context:B.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"}),"LLM context",d.jsx(DZ,{status:z,error:g[D]})]})]}),P&&k.length>0&&d.jsx("div",{className:"border-t border-border divide-y divide-border",children:k.map(B=>d.jsx(HCe,{row:B,status:f[`${M}.${B.key}`]||"idle",error:g[`${M}.${B.key}`],onCommit:H=>_(M,B.key,H),onReset:()=>w(M,B.key)},B.key))})]},M)})]})}function HCe({row:e,status:t,error:r,onCommit:n,onReset:a}){const[i,o]=E.useState(J2(e));E.useEffect(()=>{o(J2(e))},[e.value,e.type]);const s=i!==J2(e),l=JSON.stringify(e.value)===JSON.stringify(e.default),u=()=>{const c=UCe(i,e.type);c.error||c.changed(e.value)&&n(c.value)};return d.jsxs("div",{className:"px-6 py-3 flex items-start gap-4",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("code",{className:"text-sm font-mono text-accent",children:e.key}),d.jsxs("span",{className:"text-xs text-[#666]",children:["[",e.type,"]"]}),!l&&d.jsx("span",{className:"text-xs text-accent",children:"edited"})]}),e.description&&d.jsx("p",{className:"text-xs text-[#777] mt-1",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 min-w-[280px] justify-end",children:[e.type==="bool"?d.jsx("input",{type:"checkbox",checked:e.value===!0,onChange:c=>n(c.target.checked),className:"w-5 h-5 accent-[#f59e0b]"}):e.type==="json"?d.jsx("textarea",{className:"w-72 h-20 bg-[#0d0d0d] border border-border px-2 py-1 text-xs font-mono text-white",value:i,onChange:c=>o(c.target.value),onBlur:u}):d.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:i,onChange:c=>o(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&c.target.blur()}}),d.jsx(DZ,{status:t,error:r,dirty:s}),d.jsx("button",{onClick:a,disabled:l,className:"text-[#777] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Reset to default",children:d.jsx(xa,{className:"w-4 h-4"})})]})]})}function DZ({status:e,error:t,dirty:r}){return e==="saving"?d.jsx(nv,{className:"w-4 h-4 text-accent animate-spin"}):e==="saved"?d.jsx(Yr,{className:"w-4 h-4 text-green-500"}):e==="error"?d.jsx("span",{title:t,className:"text-red-400 cursor-help",children:d.jsx(Nh,{className:"w-4 h-4"})}):r?d.jsx("span",{className:"w-2 h-2 bg-accent rounded-full",title:"unsaved"}):d.jsx("span",{className:"w-4 h-4"})}function J2(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 UCe(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 WCe=["routine","priority","immediate"];function YB(e){return{name:`source_${e}`,enabled:!0,url:"",items_path:"features",id_path:"",lat_path:"",lon_path:"",geometry_path:"geometry",title_path:"",time_path:"",category:"generic_alert",poll_seconds:300,severity:"routine",field_mappings:[],summary_template:"",emoji:"",headers:{}}}function Ya({label:e,value:t,onChange:r,placeholder:n,type:a="text",mono:i=!1}){return d.jsxs("div",{className:"min-w-0",children:[d.jsx("label",{className:"text-xs text-[#777] mb-1 block",children:e}),d.jsx("input",{type:a,value:t,placeholder:n,onChange:o=>r(o.target.value),className:`w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs ${i?"font-mono":""} text-[#e0e0e0] placeholder:text-[#555]`})]})}function ux({children:e}){return d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] pt-1",children:e})}function $Ce(){const[e,t]=E.useState(null),[r,n]=E.useState(""),[a,i]=E.useState(!0),[o,s]=E.useState(!1),[l,u]=E.useState(null),[c,h]=E.useState(null),{setDirty:f}=$i(),[v,g]=E.useState({}),[m,y]=E.useState({});E.useEffect(()=>{DJ().then(U=>{const W=(Array.isArray(U)?U:[]).map(($,Z)=>({...YB(Z+1),...$}));t(W),n(JSON.stringify(W))}).catch(U=>u(U instanceof Error?U.message:String(U))).finally(()=>i(!1))},[]);const x=e!==null&&JSON.stringify(e)!==r;E.useEffect(()=>(f(x),()=>f(!1)),[x,f]);const _=(U,F)=>{t(W=>W&&W.map(($,Z)=>Z===U?{...$,...F}:$))},w=()=>{t(U=>[...U??[],YB(((U==null?void 0:U.length)??0)+1)])},S=U=>{t(F=>F&&F.filter((W,$)=>$!==U)),g(F=>{const W={...F};return delete W[U],W})},C=U=>{t(F=>F&&F.map((W,$)=>$===U?{...W,field_mappings:[...W.field_mappings,{source_path:"",dest_key:""}]}:W))},M=(U,F,W)=>{t($=>$&&$.map((Z,J)=>J===U?{...Z,field_mappings:Z.field_mappings.map((re,Q)=>Q===F?{...re,...W}:re)}:Z))},A=(U,F)=>{t(W=>W&&W.map(($,Z)=>Z===U?{...$,field_mappings:$.field_mappings.filter((J,re)=>re!==F)}:$))},I=U=>Object.entries(U.headers??{}),k=(U,F)=>{const W={};for(const[$,Z]of F)W[$]=Z;_(U,{headers:W})},P=U=>{e&&k(U,[...I(e[U]),["",""]])},D=(U,F,W,$)=>{if(!e)return;const Z=I(e[U]);Z[F]=[W,$],k(U,Z)},z=(U,F)=>{if(!e)return;const W=I(e[U]);W.splice(F,1),k(U,W)},j=async U=>{if(!e)return;const F=e[U];y(W=>({...W,[U]:!0}));try{const W=await EJ(F.url,F.items_path,F.headers);g($=>({...$,[U]:W}))}catch(W){g($=>({...$,[U]:{ok:!1,error:W instanceof Error?W.message:String(W)}}))}finally{y(W=>({...W,[U]:!1}))}},B=()=>{r&&(t(JSON.parse(r)),g({}))},H=async()=>{if(e){s(!0),u(null),h(null);try{const U=await jJ(e);n(JSON.stringify(e)),h("Custom sources saved"),setTimeout(()=>h(null),3e3),U.restart_required&&bu(Array.isArray(U.changed_keys)?U.changed_keys:[])}catch(U){u(U instanceof Error?U.message:"Save failed")}finally{s(!1)}}};if(a)return d.jsx("div",{className:"flex items-center justify-center h-32 text-[#777]",children:"Loading custom sources…"});if(!e)return d.jsx("div",{className:"flex items-center justify-center h-32 text-red-400",children:l||"No config"});const V=d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{onClick:B,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:H,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",o?"Saving…":"Save"]})]});return d.jsxs("div",{className:"space-y-6 max-w-4xl",children:[d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("p",{className:"text-sm text-[#777]",children:["Point MeshAI at any public REST or GeoJSON feed — no code. Each source polls a URL, maps its JSON fields to an event via dotted paths, and broadcasts through the normal coverage-gated pipeline. Use ",d.jsx("span",{className:"text-accent",children:"Preview"})," to fetch a URL and read its structure before filling in the paths. Once saved, a custom source becomes a routable family —"," ",d.jsx("a",{href:"/meshtastic/routing",className:"text-accent hover:underline",children:"enable its family in Notifications"})," ","to route it to a channel."]}),x&&V]}),l&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:l}),c&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:c}),e.length===0&&d.jsx("div",{className:"border border-border p-6 text-center text-sm text-[#666]",children:"No custom sources yet. Click “Add source” to wire up a public feed."}),d.jsx("div",{className:"space-y-4",children:e.map((U,F)=>{const W=v[F],$=m[F];return d.jsxs("div",{className:"border border-border p-4 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("input",{type:"text",value:U.name,onChange:Z=>_(F,{name:Z.target.value}),placeholder:"source name (unique id)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-sm font-medium text-[#e0e0e0]"}),d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[d.jsx("span",{className:"text-xs text-[#666]",children:"Enabled"}),d.jsx("button",{type:"button",onClick:()=>_(F,{enabled:!U.enabled}),className:`relative w-9 h-4 rounded-full transition-colors ${U.enabled?"bg-accent":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${U.enabled?"translate-x-5":""}`})})]}),d.jsx("button",{onClick:()=>S(F),title:"Delete source",className:"flex items-center gap-1 px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(li,{size:12})})]}),d.jsx(ux,{children:"Basics"}),d.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[d.jsx("div",{className:"col-span-12",children:d.jsx(Ya,{label:"URL",value:U.url,onChange:Z=>_(F,{url:Z}),placeholder:"https://example.com/api/feed.geojson",mono:!0})}),d.jsx("div",{className:"col-span-3",children:d.jsx(Ya,{label:"Poll seconds",type:"number",value:U.poll_seconds,onChange:Z=>_(F,{poll_seconds:parseInt(Z,10)||0})})}),d.jsx("div",{className:"col-span-3",children:d.jsx(Ya,{label:"Category",value:U.category,onChange:Z=>_(F,{category:Z}),placeholder:"generic_alert"})}),d.jsxs("div",{className:"col-span-3",children:[d.jsx("label",{className:"text-xs text-[#777] mb-1 block",children:"Severity"}),d.jsx("select",{value:U.severity,onChange:Z=>_(F,{severity:Z.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs text-[#e0e0e0]",children:WCe.map(Z=>d.jsx("option",{value:Z,children:Z},Z))})]}),d.jsx("div",{className:"col-span-3",children:d.jsx(Ya,{label:"Emoji",value:U.emoji??"",onChange:Z=>_(F,{emoji:Z}),placeholder:"⚡"})})]}),d.jsx(ux,{children:"Extraction"}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx(Ya,{label:"items_path (array of items)",value:U.items_path,onChange:Z=>_(F,{items_path:Z}),placeholder:"features · object.outages",mono:!0}),d.jsx(Ya,{label:"id_path (unique id, for dedup)",value:U.id_path,onChange:Z=>_(F,{id_path:Z}),placeholder:"id · omsOutageId · properties.id",mono:!0})]}),d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Headers (optional)"}),d.jsxs("button",{onClick:()=>P(F),className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[d.jsx(si,{size:12})," Add header"]})]}),d.jsxs("p",{className:"text-xs text-[#555]",children:["Custom request headers, e.g. ",d.jsx("code",{children:"User-Agent"})," or"," ",d.jsx("code",{children:"Authorization"}),". Leave empty for the default browser UA."]}),Object.entries(U.headers??{}).length>0&&d.jsx("div",{className:"space-y-2",children:Object.entries(U.headers??{}).map(([Z,J],re)=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"text",value:Z,onChange:Q=>D(F,re,Q.target.value,J),placeholder:"header name (e.g. Authorization)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("span",{className:"text-[#555] text-xs",children:":"}),d.jsx("input",{type:"text",value:J,onChange:Q=>D(F,re,Z,Q.target.value),placeholder:"value (e.g. Bearer …)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("button",{onClick:()=>z(F,re),title:"Remove header",className:"flex items-center px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(li,{size:12})})]},re))})]}),d.jsx(ux,{children:"Location — GeoJSON geometry OR lat + lon paths"}),d.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[d.jsx(Ya,{label:"geometry_path",value:U.geometry_path??"",onChange:Z=>_(F,{geometry_path:Z}),placeholder:"geometry",mono:!0}),d.jsx(Ya,{label:"lat_path",value:U.lat_path??"",onChange:Z=>_(F,{lat_path:Z}),placeholder:"properties.lat",mono:!0}),d.jsx(Ya,{label:"lon_path",value:U.lon_path??"",onChange:Z=>_(F,{lon_path:Z}),placeholder:"properties.lon",mono:!0})]}),d.jsx(ux,{children:"Display"}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx(Ya,{label:"title_path",value:U.title_path??"",onChange:Z=>_(F,{title_path:Z}),placeholder:"properties.headline",mono:!0}),d.jsx(Ya,{label:"time_path",value:U.time_path??"",onChange:Z=>_(F,{time_path:Z}),placeholder:"properties.updated",mono:!0}),d.jsx("div",{className:"col-span-2",children:d.jsx(Ya,{label:"summary_template — use {dest_key} tokens from your field mappings",value:U.summary_template??"",onChange:Z=>_(F,{summary_template:Z}),placeholder:"⚡ Power out — {customers} affected, ETA {eta}",mono:!0})})]}),d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Field Mappings"}),d.jsxs("button",{onClick:()=>C(F),className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[d.jsx(si,{size:12})," Add mapping"]})]}),U.field_mappings.length===0?d.jsxs("p",{className:"text-xs text-[#555]",children:["No mappings. Each mapping pulls a dotted ",d.jsx("code",{children:"source_path"})," from an item into a ",d.jsx("code",{children:"dest_key"})," you can reference in the summary template."]}):d.jsx("div",{className:"space-y-2",children:U.field_mappings.map((Z,J)=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"text",value:Z.source_path,onChange:re=>M(F,J,{source_path:re.target.value}),placeholder:"source_path (e.g. properties.customers)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("span",{className:"text-[#555] text-xs",children:"→"}),d.jsx("input",{type:"text",value:Z.dest_key,onChange:re=>M(F,J,{dest_key:re.target.value}),placeholder:"dest_key (e.g. customers)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("button",{onClick:()=>A(F,J),title:"Remove mapping",className:"flex items-center px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(li,{size:12})})]},J))})]}),d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Preview"}),d.jsxs("button",{onClick:()=>j(F),disabled:!U.url||$,className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[$?d.jsx(nv,{size:12,className:"animate-spin"}):d.jsx(rv,{size:12}),$?"Fetching…":"Preview"]})]}),W&&d.jsxs("div",{className:"space-y-2",children:[W.ok?d.jsxs("div",{className:"text-xs text-green-400",children:["HTTP ",W.status??"200",typeof W.item_count=="number"&&d.jsxs("span",{className:"text-[#999]",children:[" ","— items_path resolved ",W.item_count," item",W.item_count===1?"":"s"]})]}):d.jsx("div",{className:"text-xs text-red-400 break-words",children:W.error}),W.items_path_note&&d.jsx("div",{className:"text-xs text-amber-400 break-words",children:W.items_path_note}),W.first_item&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] uppercase tracking-widest text-[#555] mb-1",children:"First item"}),d.jsx("pre",{className:"bg-[#0d0d0d] border border-border p-2 text-[11px] font-mono text-[#bbb] overflow-auto max-h-48 whitespace-pre",children:W.first_item})]}),W.sample&&d.jsxs("details",{open:!W.first_item,children:[d.jsx("summary",{className:"text-[10px] uppercase tracking-widest text-[#555] cursor-pointer",children:"Raw response"}),d.jsx("pre",{className:"mt-1 bg-[#0d0d0d] border border-border p-2 text-[11px] font-mono text-[#bbb] overflow-auto max-h-72 whitespace-pre",children:W.sample})]})]})]})]},F)})}),d.jsxs("div",{className:"flex items-center justify-between gap-2 pb-2",children:[d.jsxs("button",{onClick:w,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[d.jsx(si,{size:14})," Add source"]}),x&&V]})]})}const ZCe={enabled:!1,observers:[],tle_groups:["weather","stations"],norad_ids:[],min_elevation_deg:10,window_hours:24,tle_refresh_seconds:21600,broadcast_lead_seconds:3600,feed_source:"central"};function YCe({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 d.jsxs("div",{className:"bg-bg-hover p-4",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${t}`}),d.jsx("span",{className:"text-sm font-medium text-white uppercase",children:e.source})]}),d.jsx("span",{className:"text-xs text-[#777]",children:r})]}),d.jsxs("div",{className:"text-xs font-mono text-[#666] space-y-1",children:[d.jsxs("div",{children:["Events: ",e.event_count]}),d.jsxs("div",{children:["Last fetch: ",n]}),e.last_error&&d.jsx("div",{className:"text-accent truncate",children:e.last_error})]})]})}function XCe({event:e}){const t=e.severity.toLowerCase(),r=t==="extreme"||t==="severe"||t==="immediate"?{bg:"bg-red-500/10",border:"border-red-500",Icon:Nh,color:"text-red-500"}:t==="moderate"||t==="warning"||t==="priority"?{bg:"bg-accent/10",border:"border-amber-500",Icon:vi,color:"text-accent"}:{bg:"bg-sky-400/10",border:"border-sky-400",Icon:d1,color:"text-sky-400"},n=r.Icon;return d.jsx("div",{className:`p-3 ${r.bg} border-l-2 ${r.border}`,children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(n,{size:16,className:r.color}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-medium text-white",children:e.event_type}),d.jsx("span",{className:`text-xs px-1.5 py-0.5 ${r.bg} ${r.color}`,children:e.severity})]}),d.jsx("div",{className:"text-sm font-sans text-[#e0e0e0]",children:e.headline})]})]})})}function jZ({value:e,onChange:t,disabled:r,centralDisabled:n}){const a="px-2 py-1 text-xs transition-colors";return d.jsxs("div",{className:`flex border border-border overflow-hidden ${r?"opacity-40":""}`,children:[d.jsx("button",{type:"button",disabled:r,onClick:()=>t("native"),className:`${a} ${e==="native"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"native"}),d.jsx("button",{type:"button",disabled:r||n,title:n?"Central not available for this adapter":"",onClick:()=>{n||t("central")},className:`${a} ${n?"text-[#666] cursor-not-allowed":e==="central"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"central"})]})}function qCe({title:e,subtitle:t,enabled:r,onEnabled:n,feedSource:a,onFeedSource:i,hasCentral:o,nativeOnly:s,hasKey:l,health:u,events:c,children:h,llmContext:f,onLlmContext:v}){const g=s||!o;return d.jsxs("div",{className:"border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:e}),t&&d.jsx("p",{className:"text-xs text-[#666]",children:t})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[v!==void 0&&d.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",title:"Include this adapter's data in LLM (bot) context",children:[d.jsx("input",{type:"checkbox",checked:f??!0,onChange:m=>v(m.target.checked),className:"w-3.5 h-3.5 accent-[#f59e0b]"}),d.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"LLM"})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),d.jsx(jZ,{value:a,onChange:i,disabled:!r,centralDisabled:g})]}),d.jsx(qt,{label:"",checked:r,onChange:n})]})]}),!l&&d.jsx("div",{className:"text-xs text-accent bg-accent/10 p-2",children:"API key required — set it in the field below"}),s&&d.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available for this adapter — native only"}),d.jsx("div",{className:r?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:h}),(u||c&&c.length>0)&&d.jsxs("div",{className:"pt-2 border-t border-border space-y-3",children:[d.jsx("div",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"Live status"}),u?d.jsx(YCe,{feed:u}):d.jsx("div",{className:"text-xs text-[#666]",children:"No status reported."}),c&&c.length>0&&d.jsx("div",{className:"space-y-2",children:c.slice(0,5).map((m,y)=>d.jsx(XCe,{event:m},y))})]})]})}const dc={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}},KCe={firms:"FIRMS_MAP_KEY",roads511:"ROADS511_API_KEY",traffic:"TOMTOM_API_KEY"},Q2=[{key:"central",label:"Central",icon:MJ,adapters:[]},{key:"weather",label:"Weather",icon:kh,adapters:["nws"]},{key:"fire",label:"Fire",icon:Rm,adapters:["fires","firms"]},{key:"rf",label:"RF Propagation",icon:_i,adapters:["swpc","ducting"]},{key:"roads",label:"Roads",icon:u1,adapters:["traffic","roads511","wzdx"]},{key:"geohazards",label:"Geohazards",icon:kf,adapters:["usgs_quake","usgs","avalanche"]},{key:"tracking",label:"Tracking",icon:f1,adapters:["satpass"]},{key:"mesh",label:"Mesh Health",icon:Oo,adapters:[]},{key:"family_settings",label:"Family Settings",icon:NV,adapters:[]}];function JCe(){var cy,hy,dy,Xh,nl,Iv;const[e,t]=E.useState(null),[r,n]=E.useState(""),[a,i]=E.useState(null),[o,s]=E.useState([]),[l,u]=E.useState(!0),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(null),[y,x]=E.useState(!1),[_,w]=E.useState("weather"),[S,C]=E.useState("nws"),[M,A]=E.useState("curated"),[I,k]=E.useState({}),[P,D]=E.useState({}),[z,j]=E.useState({allowed_incident_types:["WF"],freshness_seconds:0,cooldown_seconds:28800,broadcast_on_acres:!0,broadcast_on_contained:!0}),[B,H]=E.useState(""),[V,U]=E.useState({min_magnitude:4,drop_non_present:!0,drop_zero_magnitude:!0}),[F,W]=E.useState(""),[$,Z]=E.useState({min_severity:"None",enabled_categories:["incident","closure"],enabled_sub_types:["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]}),[J,re]=E.useState(""),[Q,le]=E.useState({broadcast:!1,min_severity:"Minor",sub_types:["road_works","lane_closed","road_closed"]}),[de,He]=E.useState(""),[ye,ne]=E.useState({broadcast_severities:["Extreme","Severe"],duplicate_allowed_after_seconds:3600}),[xe,he]=E.useState(""),[ge,tt]=E.useState({min_danger_level:3}),[Ue,qe]=E.useState(""),[Fe,_t]=E.useState({geomag_kp_floor:7,flare_class_floor:"X1",proton_pfu_floor:10}),[bt,et]=E.useState(""),[Ke,St]=E.useState({enabled:!1,observers:[],min_elevation:30,norad_ids:[],max_broadcasts_per_hour:4,dry_run:!0}),[ce,st]=E.useState(""),[Bt,Ft]=E.useState(null),[jt,Lr]=E.useState(null),[Qo,tl]=E.useState(!1),[Ki,Uh]=E.useState([]),[Gn,es]=E.useState(null),[ts,Au]=E.useState(""),[Wh,Va]=E.useState(!1),[$h,Nu]=E.useState(null),[ku,rl]=E.useState(null);E.useEffect(()=>{document.title="Environment — MeshAI",(async()=>{var se,ut,Ze,mt,rr,ia,cn,An,q,Me,ct,ot,dt,os,Ji,Qi,gr,eo,al,il,qh,ol,Kh,Jh,Du,Qh;try{const Ci=await(await fetch("/api/config/environmental")).json();Ci.satpass={...ZCe,...Ci.satpass??{}},Ci.wzdx={states:["ID"],registry_url:"",...Ci.wzdx??{}},t(Ci),n(JSON.stringify(Ci));const to=Vt=>{const Ot={};if(Array.isArray(Vt))for(const Ie of Vt)Ot[Ie.key]={value:Ie.value};return Ot};try{const Vt=await fetch("/api/adapter-config/wfigs");if(Vt.ok){const Ot=to(await Vt.json()),Ie={allowed_incident_types:((se=Ot.allowed_incident_types)==null?void 0:se.value)??["WF"],freshness_seconds:((ut=Ot.freshness_seconds)==null?void 0:ut.value)??0,cooldown_seconds:((Ze=Ot.cooldown_seconds)==null?void 0:Ze.value)??28800,broadcast_on_acres:((mt=Ot.broadcast_on_acres)==null?void 0:mt.value)??!0,broadcast_on_contained:((rr=Ot.broadcast_on_contained)==null?void 0:rr.value)??!0};j(Ie),H(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/tomtom_incidents");if(Vt.ok){const Ot=to(await Vt.json()),Ie={min_magnitude:((ia=Ot.min_magnitude)==null?void 0:ia.value)??4,drop_non_present:((cn=Ot.drop_non_present)==null?void 0:cn.value)??!0,drop_zero_magnitude:((An=Ot.drop_zero_magnitude)==null?void 0:An.value)??!0};U(Ie),W(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/itd_511");if(Vt.ok){const Ot=to(await Vt.json()),Ie={min_severity:((q=Ot.min_severity)==null?void 0:q.value)??"None",enabled_categories:((Me=Ot.enabled_categories)==null?void 0:Me.value)??["incident","closure"],enabled_sub_types:((ct=Ot.enabled_sub_types)==null?void 0:ct.value)??["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]};Z(Ie),re(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/wzdx");if(Vt.ok){const Ot=to(await Vt.json()),Ie={broadcast:((ot=Ot.broadcast)==null?void 0:ot.value)??!1,min_severity:((dt=Ot.min_severity)==null?void 0:dt.value)??"Minor",sub_types:((os=Ot.sub_types)==null?void 0:os.value)??["road_works","lane_closed","road_closed"]};le(Ie),He(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/nws");if(Vt.ok){const Ot=to(await Vt.json()),Ie={broadcast_severities:((Ji=Ot.broadcast_severities)==null?void 0:Ji.value)??["Extreme","Severe"],duplicate_allowed_after_seconds:((Qi=Ot.duplicate_allowed_after_seconds)==null?void 0:Qi.value)??3600};ne(Ie),he(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/avalanche");if(Vt.ok){const Ie={min_danger_level:((gr=to(await Vt.json()).min_danger_level)==null?void 0:gr.value)??3};tt(Ie),qe(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/swpc");if(Vt.ok){const Ot=to(await Vt.json()),Ie={geomag_kp_floor:((eo=Ot.geomag_kp_floor)==null?void 0:eo.value)??7,flare_class_floor:((al=Ot.flare_class_floor)==null?void 0:al.value)??"X1",proton_pfu_floor:((il=Ot.proton_pfu_floor)==null?void 0:il.value)??10};_t(Ie),et(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-meta");if(Vt.ok){const Ot=await Vt.json(),Ie={};for(const[Hn,Wt]of Object.entries(Ot))Ie[Hn]=Wt.include_in_llm_context??!0;k(Ie)}}catch{}try{const Vt=await fetch("/api/adapter-config/satpass");if(Vt.ok){const Ot=await Vt.json(),Ie={};for(const Wt of Ot)Ie[Wt.key]=Wt;const Hn={enabled:((qh=Ie.enabled)==null?void 0:qh.value)??!1,observers:((ol=Ie.observers)==null?void 0:ol.value)??[],min_elevation:((Kh=Ie.min_elevation)==null?void 0:Kh.value)??30,norad_ids:((Jh=Ie.norad_ids)==null?void 0:Jh.value)??[],max_broadcasts_per_hour:((Du=Ie.max_broadcasts_per_hour)==null?void 0:Du.value)??4,dry_run:((Qh=Ie.dry_run)==null?void 0:Qh.value)??!0};St(Hn),st(JSON.stringify(Hn))}}catch{}}catch(ju){v(ju instanceof Error?ju.message:"Failed to load config")}finally{u(!1)}})()},[]),E.useEffect(()=>{(async()=>{try{const se=await fetch("/api/config/notifications");if(se.ok){const ut=await se.json();es(ut),Au(JSON.stringify(ut))}}catch{}})()},[]),E.useEffect(()=>{(async()=>{try{const se=await fetch("/api/config/coverage");if(se.ok){const ut=await se.json();tl(!!ut.enabled),Uh(Array.isArray(ut.excluded_adapters)?ut.excluded_adapters:[])}}catch{}})()},[]),E.useEffect(()=>{(async()=>{try{const se=await fetch("/api/secrets");if(se.ok){const ut=await se.json(),Ze={};for(const mt of ut)Ze[mt.env_var]=mt.is_set;D(Ze)}}catch{}})()},[]),E.useEffect(()=>{const se=async()=>{try{i(await WV()),s(await $V())}catch{}};se();const ut=setInterval(se,3e4);return()=>clearInterval(ut)},[]);const Lu=e!==null&&JSON.stringify(e)!==r,Iu=JSON.stringify(z)!==B,rs=JSON.stringify(V)!==F,ns=JSON.stringify($)!==J,ue=JSON.stringify(Q)!==de,Xe=JSON.stringify(ye)!==xe,lt=JSON.stringify(ge)!==Ue,Pt=JSON.stringify(Fe)!==bt,fr=JSON.stringify(Ke)!==ce,Tn=Lu||Iu||rs||ns||ue||Xe||lt||Pt||fr,Ct=async(se,ut,Ze)=>{const mt=await fetch(`/api/adapter-config/${se}/${ut}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:Ze})});if(!mt.ok){const rr=await mt.json().catch(()=>({}));throw new Error(rr.detail||`Failed to save ${se}.${ut}`)}},as=async(se,ut)=>{k(Ze=>({...Ze,[se]:ut}));try{await fetch(`/api/adapter-meta/${se}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({include_in_llm_context:ut})})}catch{}},Mn=async()=>{if(e){h(!0),v(null),m(null);try{if(Lu){const se=await fetch("/api/config/environmental",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),ut=await se.json();if(!se.ok)throw new Error(ut.detail||"Save failed");n(JSON.stringify(e)),ut.restart_required&&x(!0)}if(Iu){const se=JSON.parse(B);z.freshness_seconds!==se.freshness_seconds&&await Ct("wfigs","freshness_seconds",z.freshness_seconds),JSON.stringify(z.allowed_incident_types)!==JSON.stringify(se.allowed_incident_types)&&await Ct("wfigs","allowed_incident_types",z.allowed_incident_types),z.cooldown_seconds!==se.cooldown_seconds&&await Ct("wfigs","cooldown_seconds",z.cooldown_seconds),z.broadcast_on_acres!==se.broadcast_on_acres&&await Ct("wfigs","broadcast_on_acres",z.broadcast_on_acres),z.broadcast_on_contained!==se.broadcast_on_contained&&await Ct("wfigs","broadcast_on_contained",z.broadcast_on_contained),H(JSON.stringify(z))}if(rs){const se=JSON.parse(F);V.min_magnitude!==se.min_magnitude&&await Ct("tomtom_incidents","min_magnitude",V.min_magnitude),V.drop_non_present!==se.drop_non_present&&await Ct("tomtom_incidents","drop_non_present",V.drop_non_present),V.drop_zero_magnitude!==se.drop_zero_magnitude&&await Ct("tomtom_incidents","drop_zero_magnitude",V.drop_zero_magnitude),W(JSON.stringify(V))}if(ns){const se=JSON.parse(J);$.min_severity!==se.min_severity&&await Ct("itd_511","min_severity",$.min_severity),JSON.stringify($.enabled_categories)!==JSON.stringify(se.enabled_categories)&&await Ct("itd_511","enabled_categories",$.enabled_categories),JSON.stringify($.enabled_sub_types)!==JSON.stringify(se.enabled_sub_types)&&await Ct("itd_511","enabled_sub_types",$.enabled_sub_types),re(JSON.stringify($))}if(ue){const se=JSON.parse(de);Q.broadcast!==se.broadcast&&await Ct("wzdx","broadcast",Q.broadcast),Q.min_severity!==se.min_severity&&await Ct("wzdx","min_severity",Q.min_severity),JSON.stringify(Q.sub_types)!==JSON.stringify(se.sub_types)&&await Ct("wzdx","sub_types",Q.sub_types),He(JSON.stringify(Q))}if(Xe){const se=JSON.parse(xe);JSON.stringify(ye.broadcast_severities)!==JSON.stringify(se.broadcast_severities)&&await Ct("nws","broadcast_severities",ye.broadcast_severities),ye.duplicate_allowed_after_seconds!==se.duplicate_allowed_after_seconds&&await Ct("nws","duplicate_allowed_after_seconds",ye.duplicate_allowed_after_seconds),he(JSON.stringify(ye))}if(lt){const se=JSON.parse(Ue);ge.min_danger_level!==se.min_danger_level&&await Ct("avalanche","min_danger_level",ge.min_danger_level),qe(JSON.stringify(ge))}if(Pt){const se=JSON.parse(bt);Fe.geomag_kp_floor!==se.geomag_kp_floor&&await Ct("swpc","geomag_kp_floor",Fe.geomag_kp_floor),Fe.flare_class_floor!==se.flare_class_floor&&await Ct("swpc","flare_class_floor",Fe.flare_class_floor),Fe.proton_pfu_floor!==se.proton_pfu_floor&&await Ct("swpc","proton_pfu_floor",Fe.proton_pfu_floor),et(JSON.stringify(Fe))}if(fr){const se=JSON.parse(ce);Ke.enabled!==se.enabled&&await Ct("satpass","enabled",Ke.enabled),JSON.stringify(Ke.observers)!==JSON.stringify(se.observers)&&await Ct("satpass","observers",Ke.observers),Ke.min_elevation!==se.min_elevation&&await Ct("satpass","min_elevation",Ke.min_elevation),JSON.stringify(Ke.norad_ids)!==JSON.stringify(se.norad_ids)&&await Ct("satpass","norad_ids",Ke.norad_ids),Ke.max_broadcasts_per_hour!==se.max_broadcasts_per_hour&&await Ct("satpass","max_broadcasts_per_hour",Ke.max_broadcasts_per_hour),Ke.dry_run!==se.dry_run&&await Ct("satpass","dry_run",Ke.dry_run),st(JSON.stringify(Ke))}m("Config saved"),setTimeout(()=>m(null),3e3)}catch(se){v(se instanceof Error?se.message:"Save failed")}finally{h(!1)}}},$e=()=>{e&&t(JSON.parse(r)),j(JSON.parse(B||JSON.stringify(z))),U(JSON.parse(F||JSON.stringify(V))),Z(JSON.parse(J||JSON.stringify($))),le(JSON.parse(de||JSON.stringify(Q))),ne(JSON.parse(xe||JSON.stringify(ye))),tt(JSON.parse(Ue||JSON.stringify(ge))),_t(JSON.parse(bt||JSON.stringify(Fe))),St(JSON.parse(ce||JSON.stringify(Ke))),Ft(null),Lr(null)},Zh=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{v("Restart failed")}},Ne=se=>e&&t({...e,...se}),aa=se=>Qo&&!Ki.includes(se),Pu={nws:"nws",fires:"wfigs",firms:"firms",swpc:"swpc",ducting:"ducting",traffic:"tomtom_incidents",roads511:"itd_511",wzdx:"wzdx",usgs:"usgs",usgs_quake:"usgs_quake",avalanche:"avalanche",satpass:"satpass"},Lv=(Gn==null?void 0:Gn.toggles)||{},oy=Gn!==null&&JSON.stringify(Gn)!==ts,Ga=(se,ut)=>{if(!Gn)return;const Ze=Gn.toggles||{};es({...Gn,toggles:{...Ze,[se]:{...Ze[se]||{},name:se,...ut}}})},sy=async()=>{if(Gn){Va(!0),Nu(null),rl(null);try{const se=await fetch("/api/config/notifications");if(!se.ok)throw new Error("Failed to re-fetch notifications config");const ut=await se.json(),Ze={...ut,toggles:{...ut.toggles||{}}},mt=Gn.toggles||{};for(const{key:cn}of fu){const An=mt[cn];if(!An)continue;const q=(ut.toggles||{})[cn]||{};Ze.toggles[cn]={...q,name:q.name||cn,enabled:An.enabled,min_severity:An.min_severity,freshness_seconds:An.freshness_seconds??q.freshness_seconds??600,cooldown_seconds:An.cooldown_seconds??q.cooldown_seconds??0,regions:An.regions??q.regions??[]}}const rr=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ze)}),ia=await rr.json();if(!rr.ok)throw new Error(ia.detail||"Save failed");es(Ze),Au(JSON.stringify(Ze)),rl("Family settings saved"),setTimeout(()=>rl(null),3e3)}catch(se){Nu(se instanceof Error?se.message:"Save failed")}finally{Va(!1)}}},xw=()=>{ts&&es(JSON.parse(ts))};if(l)return d.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading environmental config…"});if(!e)return d.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:f||"No config"});const _w=se=>a==null?void 0:a.feeds.find(ut=>ut.source===dc[se].health),bw=se=>o.filter(ut=>ut.source===dc[se].health),ww=se=>{const ut=KCe[se];if(!ut)return!0;const Ze=P[ut];return Ze===void 0?!0:Ze},is=Q2.find(se=>se.key===_),Rr=is.adapters.length===0?null:S&&is.adapters.includes(S)?S:is.adapters[0],Yh=se=>{var ut,Ze,mt,rr,ia,cn,An;switch(se){case"nws":return d.jsxs(d.Fragment,{children:[aa("nws")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Geographic scope (zones, areas) is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),'. Enable "Use own config" for NWS on that page to edit zones here.']}):d.jsxs(d.Fragment,{children:[d.jsx(la,{label:"NWS Zones",value:e.nws_zones,onChange:q=>Ne({nws_zones:q}),helper:"Zone IDs like IDZ016, IDZ030",infoLink:"https://www.weather.gov/pimar/PubZone"}),d.jsx(la,{label:"NWS Areas",value:e.nws.areas??[],onChange:q=>Ne({nws:{...e.nws,areas:q}}),helper:"State codes NWS pulls, e.g. ID"})]}),e.nws.feed_source!=="central"&&d.jsxs(d.Fragment,{children:[d.jsx(yt,{label:"User Agent",value:e.nws.user_agent,onChange:q=>Ne({nws:{...e.nws,user_agent:q}}),placeholder:"(MeshAI, you@email.com)",helper:"Format: (app_name, contact_email)"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.nws.tick_seconds,onChange:q=>Ne({nws:{...e.nws,tick_seconds:q}}),min:30}),d.jsx(Dn,{label:"Min Severity",value:e.nws.severity_min,onChange:q=>Ne({nws:{...e.nws,severity_min:q}}),options:[{value:"minor",label:"Minor"},{value:"moderate",label:"Moderate"},{value:"severe",label:"Severe"},{value:"extreme",label:"Extreme"}]})]})]}),e.nws.feed_source==="central"&&d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsxs("div",{className:"mb-3",children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Severities to broadcast"}),d.jsx("div",{className:"flex gap-6",children:["Extreme","Severe","Moderate","Minor"].map(q=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:ye.broadcast_severities.includes(q),onChange:Me=>{const ct=ye.broadcast_severities;ne({...ye,broadcast_severities:Me.target.checked?[...ct,q]:ct.filter(ot=>ot!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:q})]},q))})]}),d.jsx(Ae,{label:"Re-broadcast Cooldown (seconds)",value:ye.duplicate_allowed_after_seconds,onChange:q=>ne({...ye,duplicate_allowed_after_seconds:q}),min:0,helper:"Minimum seconds before the same alert ID can be re-broadcast"})]})]});case"swpc":return d.jsx("div",{className:"space-y-6",children:d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Thresholds"}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(Dn,{label:"Geomag Kp Floor",value:String(Fe.geomag_kp_floor),onChange:q=>_t({...Fe,geomag_kp_floor:Number(q)}),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"}),d.jsx(Dn,{label:"Flare Class Floor",value:Fe.flare_class_floor,onChange:q=>_t({...Fe,flare_class_floor:q}),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"}),d.jsx(Dn,{label:"Proton pfu Floor",value:String(Fe.proton_pfu_floor),onChange:q=>_t({...Fe,proton_pfu_floor:Number(q)}),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 d.jsxs("div",{className:"space-y-3",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.ducting.tick_seconds,onChange:q=>Ne({ducting:{...e.ducting,tick_seconds:q}}),min:60}),aa("ducting")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Lat/lon is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Latitude",value:e.ducting.latitude,onChange:q=>Ne({ducting:{...e.ducting,latitude:q}}),step:.01}),d.jsx(Ae,{label:"Longitude",value:e.ducting.longitude,onChange:q=>Ne({ducting:{...e.ducting,longitude:q}}),step:.01})]})]});case"fires":return d.jsxs("div",{className:"space-y-6",children:[e.fires.feed_source!=="central"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.fires.tick_seconds,onChange:q=>Ne({fires:{...e.fires,tick_seconds:q}}),min:60}),aa("fires")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50 self-end",children:["State scoped by"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(Dn,{label:"State",value:e.fires.state,onChange:q=>Ne({fires:{...e.fires,state:q}}),options:vCe})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Incident Types"}),d.jsx("div",{className:"flex gap-6",children:[["WF","Wildfire"],["RX","Prescribed Burn"],["OTHER","Other"]].map(([q,Me])=>{var ct;return d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:((ct=z.allowed_incident_types)==null?void 0:ct.includes(q))??q==="WF",onChange:ot=>{const dt=z.allowed_incident_types??["WF"];j({...z,allowed_incident_types:ot.target.checked?[...dt,q]:dt.filter(os=>os!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Me})]},q)})})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Triggers"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on acres increase"}),d.jsx("input",{type:"checkbox",checked:z.broadcast_on_acres,onChange:q=>j({...z,broadcast_on_acres:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on containment increase"}),d.jsx("input",{type:"checkbox",checked:z.broadcast_on_contained,onChange:q=>j({...z,broadcast_on_contained:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Update Cooldown (hours)",value:Math.round(z.cooldown_seconds/3600),onChange:q=>j({...z,cooldown_seconds:q*3600}),min:0,helper:"Minimum hours between updates for the same fire"}),d.jsx(Ae,{label:"Freshness Window (hours)",value:Math.round(z.freshness_seconds/3600),onChange:q=>j({...z,freshness_seconds:q*3600}),min:0,helper:"0 = always broadcast regardless of event age"})]})]});case"avalanche":return d.jsxs("div",{className:"space-y-6",children:[e.avalanche.feed_source!=="central"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.avalanche.tick_seconds,onChange:q=>Ne({avalanche:{...e.avalanche,tick_seconds:q}}),min:60}),d.jsx(X2,{label:"Season Months",value:e.avalanche.season_months,onChange:q=>Ne({avalanche:{...e.avalanche,season_months:q}}),helper:"e.g., 12, 1, 2, 3, 4"})]}),aa("avalanche")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Avalanche center IDs are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(la,{label:"Center IDs",value:e.avalanche.center_ids,onChange:q=>Ne({avalanche:{...e.avalanche,center_ids:q}}),helper:"e.g., SNFAC",infoLink:"https://avalanche.org/avalanche-centers/"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsx(Dn,{label:"Min Danger Level",value:String(ge.min_danger_level),onChange:q=>tt({...ge,min_danger_level:Number(q)}),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 d.jsxs(d.Fragment,{children:[d.jsx(Ae,{label:"Tick Seconds",value:e.usgs.tick_seconds,onChange:q=>Ne({usgs:{...e.usgs,tick_seconds:q}}),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."}),aa("usgs")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Gauge site IDs are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(la,{label:"Site IDs",value:e.usgs.sites,onChange:q=>Ne({usgs:{...e.usgs,sites:q}}),helper:"USGS gauge site numbers",infoLink:"https://waterdata.usgs.gov/nwis"}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Flood Thresholds (advanced JSON)"}),d.jsx("textarea",{value:Bt??JSON.stringify(e.usgs.flood_thresholds??{},null,2),onChange:q=>{const Me=q.target.value;Ft(Me);try{const ct=JSON.parse(Me);Lr(null),Ne({usgs:{...e.usgs,flood_thresholds:ct}})}catch(ct){Lr(ct instanceof Error?ct.message:"Invalid JSON")}},rows:6,spellCheck:!1,className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm font-mono"}),jt&&d.jsxs("p",{className:"text-xs text-red-400 mt-1",children:["Invalid JSON — not saved: ",jt]}),d.jsxs("p",{className:"text-xs text-[#666] mt-1",children:["Per-site flood levels, shape ","{",'"site_id": ',"{",' "flow": X, "height": Y ',"}","}"]})]})]});case"usgs_quake":return d.jsxs("div",{className:"space-y-6",children:[e.usgs_quake.feed_source!=="central"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Tick Seconds",value:e.usgs_quake.tick_seconds,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,tick_seconds:q}}),min:60}),d.jsx(yt,{label:"Region Tag",value:e.usgs_quake.region,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,region:q}})})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Native Feed"}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(yt,{label:"Quake Feed URL",value:e.usgs_quake.feed_url,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,feed_url:q}})}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsx(Ae,{label:"Min Magnitude",value:e.usgs_quake.min_magnitude??2.5,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,min_magnitude:q}}),step:.1,min:0,helper:"Native quake magnitude floor"})}),aa("usgs_quake")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(X2,{label:"Bounding Box [W, S, E, N]",value:e.usgs_quake.bbox??[],onChange:q=>Ne({usgs_quake:{...e.usgs_quake,bbox:q}}),helper:"Four values: west, south, east, north"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Magnitude Thresholds"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ae,{label:"Global Floor",value:e.usgs_quake.global_mag_floor,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,global_mag_floor:q}}),step:.1,min:0,helper:"Broadcast anywhere at or above this magnitude"}),d.jsx(Ae,{label:"Regional Floor",value:e.usgs_quake.regional_mag_floor,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,regional_mag_floor:q}}),step:.1,min:0,helper:"Reduced floor within regional radius"}),d.jsx(Ae,{label:"Regional Radius (mi)",value:e.usgs_quake.regional_radius_mi,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,regional_radius_mi:q}}),min:50,helper:"Radius around region centroid for reduced floor"}),d.jsx(Ae,{label:"Escalation Floor",value:e.usgs_quake.escalate_mag_floor,onChange:q=>Ne({usgs_quake:{...e.usgs_quake,escalate_mag_floor:q}}),step:.1,min:0,helper:"Magnitude at which broadcast uses warning emoji"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"PAGER Alert Levels"}),d.jsx("div",{className:"text-xs text-[#666] mb-2",children:"Broadcast at any magnitude when USGS PAGER alert reaches these levels"}),d.jsx("div",{className:"flex gap-6",children:["green","yellow","orange","red"].map(q=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:(e.usgs_quake.broadcast_pager_alerts??[]).includes(q),onChange:Me=>{const ct=e.usgs_quake.broadcast_pager_alerts??[];Ne({usgs_quake:{...e.usgs_quake,broadcast_pager_alerts:Me.target.checked?[...ct,q]:ct.filter(ot=>ot!==q)}})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0] capitalize",children:q})]},q))})]})]});case"traffic":return d.jsxs(d.Fragment,{children:[d.jsx($p,{envVar:"TOMTOM_API_KEY",label:"API Key",helper:"developer.tomtom.com"}),d.jsx(Ae,{label:"Tick Seconds",value:e.traffic.tick_seconds,onChange:q=>Ne({traffic:{...e.traffic,tick_seconds:q}}),min:60}),aa("traffic")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Traffic corridors are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"text-xs text-[#666] mt-2",children:"Corridors:"}),(e.traffic.corridors||[]).map((q,Me)=>d.jsxs("div",{className:"grid grid-cols-4 gap-2 items-end",children:[d.jsx(yt,{label:"Name",value:q.name,onChange:ct=>{const ot=[...e.traffic.corridors];ot[Me]={...q,name:ct},Ne({traffic:{...e.traffic,corridors:ot}})}}),d.jsx(Ae,{label:"Lat",value:q.lat,onChange:ct=>{const ot=[...e.traffic.corridors];ot[Me]={...q,lat:ct},Ne({traffic:{...e.traffic,corridors:ot}})},step:.01}),d.jsx(Ae,{label:"Lon",value:q.lon,onChange:ct=>{const ot=[...e.traffic.corridors];ot[Me]={...q,lon:ct},Ne({traffic:{...e.traffic,corridors:ot}})},step:.01}),d.jsx("button",{onClick:()=>Ne({traffic:{...e.traffic,corridors:e.traffic.corridors.filter((ct,ot)=>ot!==Me)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},Me)),d.jsx("button",{onClick:()=>Ne({traffic:{...e.traffic,corridors:[...e.traffic.corridors||[],{name:"",lat:0,lon:0}]}}),className:"text-xs text-accent hover:underline",children:"+ Add Corridor"})]}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Magnitude"}),d.jsxs("select",{value:V.min_magnitude,onChange:q=>U({...V,min_magnitude:parseInt(q.target.value)}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[d.jsx("option",{value:1,children:"1 — Minor (all)"}),d.jsx("option",{value:2,children:"2 — Moderate (yellow+)"}),d.jsx("option",{value:3,children:"3 — Major (orange+)"}),d.jsx("option",{value:4,children:"4 — Severe (red only)"})]}),d.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop TomTom incidents below this severity level"})]})}),d.jsxs("div",{className:"mt-3 space-y-2",children:[d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop non-present time validity"}),d.jsx("input",{type:"checkbox",checked:V.drop_non_present,onChange:q=>U({...V,drop_non_present:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop zero-magnitude events"}),d.jsx("input",{type:"checkbox",checked:V.drop_zero_magnitude,onChange:q=>U({...V,drop_zero_magnitude:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]})]});case"roads511":return d.jsxs(d.Fragment,{children:[d.jsx(yt,{label:"Base URL",value:e.roads511.base_url,onChange:q=>Ne({roads511:{...e.roads511,base_url:q}}),placeholder:"https://511.yourstate.gov/api/v2"}),d.jsx($p,{envVar:"ROADS511_API_KEY",label:"API Key",helper:"Leave unset if 511 needs no key"}),d.jsx(Ae,{label:"Tick Seconds",value:e.roads511.tick_seconds,onChange:q=>Ne({roads511:{...e.roads511,tick_seconds:q}}),min:60}),d.jsx(la,{label:"Endpoints",value:e.roads511.endpoints,onChange:q=>Ne({roads511:{...e.roads511,endpoints:q}}),helper:"e.g., /get/event"}),aa("roads511")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((q,Me)=>{var ct;return d.jsx(Ae,{label:q,value:((ct=e.roads511.bbox)==null?void 0:ct[Me])??0,onChange:ot=>{const dt=[...e.roads511.bbox||[0,0,0,0]];dt[Me]=ot,Ne({roads511:{...e.roads511,bbox:dt}})},step:.01},q)})}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Severity"}),d.jsxs("select",{value:$.min_severity,onChange:q=>Z({...$,min_severity:q.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[d.jsx("option",{value:"None",children:"None (all)"}),d.jsx("option",{value:"Minor",children:"Minor+"}),d.jsx("option",{value:"Major",children:"Major only"})]}),d.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop ITD 511 events below this severity"})]})}),d.jsxs("div",{className:"mt-4",children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Categories"}),d.jsx("div",{className:"flex gap-6",children:[["incident","Incident"],["closure","Closure"],["special_event","Special Event"]].map(([q,Me])=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:$.enabled_categories.includes(q),onChange:ct=>{const ot=$.enabled_categories;Z({...$,enabled_categories:ct.target.checked?[...ot,q]:ot.filter(dt=>dt!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Me})]},q))})]}),d.jsxs("div",{className:"mt-4",children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),d.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(([q,Me])=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:$.enabled_sub_types.includes(q),onChange:ct=>{const ot=$.enabled_sub_types;Z({...$,enabled_sub_types:ct.target.checked?[...ot,q]:ot.filter(dt=>dt!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Me})]},q))})]})]})]});case"wzdx":return d.jsxs(d.Fragment,{children:[((ut=e.wzdx)==null?void 0:ut.feed_source)!=="central"&&d.jsxs(d.Fragment,{children:[d.jsx(yt,{label:"Base URL",value:((Ze=e.wzdx)==null?void 0:Ze.base_url)??"",onChange:q=>Ne({wzdx:{...e.wzdx,base_url:q}}),placeholder:"https://511.yourstate.gov/api/v2"}),d.jsx($p,{envVar:"WZDX_API_KEY",label:"API Key",helper:"Leave unset if not required"}),d.jsx(Ae,{label:"Tick Seconds",value:((mt=e.wzdx)==null?void 0:mt.tick_seconds)??300,onChange:q=>Ne({wzdx:{...e.wzdx,tick_seconds:q}}),min:60}),d.jsx(la,{label:"Endpoints",value:((rr=e.wzdx)==null?void 0:rr.endpoints)??["/get/event"],onChange:q=>Ne({wzdx:{...e.wzdx,endpoints:q}}),helper:"e.g., /get/event"}),aa("wzdx")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box and states are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((q,Me)=>{var ct,ot;return d.jsx(Ae,{label:q,value:((ot=(ct=e.wzdx)==null?void 0:ct.bbox)==null?void 0:ot[Me])??0,onChange:dt=>{var Ji;const os=[...((Ji=e.wzdx)==null?void 0:Ji.bbox)||[0,0,0,0]];os[Me]=dt,Ne({wzdx:{...e.wzdx,bbox:os}})},step:.01},q)})}),d.jsx("div",{className:"text-xs text-[#666]",children:"Bounding box [W,S,E,N] geographic filter"}),d.jsx(la,{label:"States",value:((ia=e.wzdx)==null?void 0:ia.states)??[],onChange:q=>Ne({wzdx:{...e.wzdx,states:q}}),helper:"2-letter state codes to include from the WZDx Feed Registry, e.g. ID, OR"})]}),d.jsx(yt,{label:"Registry URL",value:((cn=e.wzdx)==null?void 0:cn.registry_url)??"",onChange:q=>Ne({wzdx:{...e.wzdx,registry_url:q}}),placeholder:"https://datahub.transportation.gov/resource/69qe-yiui.json?$limit=200",helper:"FHWA WZDx Feed Registry (Socrata) URL — lists every state DOT feed"}),d.jsx(Ae,{label:"Registry TTL (sec)",value:((An=e.wzdx)==null?void 0:An.registry_ttl)??21600,onChange:q=>Ne({wzdx:{...e.wzdx,registry_ttl:q}}),min:0,helper:"How often to re-fetch the WZDx registry (default 21600 = 6h)"})]}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast work zone events"}),d.jsx("input",{type:"checkbox",checked:Q.broadcast,onChange:q=>le({...Q,broadcast:q.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),Q.broadcast?d.jsxs("div",{className:"space-y-3 mt-3",children:[d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Min Severity"}),d.jsxs("select",{value:Q.min_severity,onChange:q=>le({...Q,min_severity:q.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[d.jsx("option",{value:"None",children:"None (all)"}),d.jsx("option",{value:"Minor",children:"Minor+"}),d.jsx("option",{value:"Major",children:"Major only"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),d.jsx("div",{className:"flex gap-6",children:[["road_works","Road Works"],["lane_closed","Lane Closure"],["road_closed","Road Closed"]].map(([q,Me])=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:Q.sub_types.includes(q),onChange:ct=>{const ot=Q.sub_types;le({...Q,sub_types:ct.target.checked?[...ot,q]:ot.filter(dt=>dt!==q)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Me})]},q))})]})]}):d.jsxs("p",{className:"text-xs text-[#666] mt-2",children:["Work zone events stored for LLM context only ","—"," no mesh broadcasts."]})]})]});case"firms":return d.jsxs(d.Fragment,{children:[d.jsx($p,{envVar:"FIRMS_MAP_KEY",label:"MAP Key",helper:"NASA FIRMS MAP_KEY"}),d.jsx(Ae,{label:"Tick Seconds",value:e.firms.tick_seconds,onChange:q=>Ne({firms:{...e.firms,tick_seconds:q}}),min:300}),d.jsx(Dn,{label:"Satellite Source",value:e.firms.source,onChange:q=>Ne({firms:{...e.firms,source:q}}),options:[{value:"VIIRS_SNPP_NRT",label:"VIIRS SNPP (NRT)"},{value:"VIIRS_NOAA20_NRT",label:"VIIRS NOAA-20 (NRT)"},{value:"MODIS_NRT",label:"MODIS (NRT)"}]}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(Ae,{label:"Day Range",value:e.firms.day_range,onChange:q=>Ne({firms:{...e.firms,day_range:q}}),min:1,max:10}),d.jsx(Dn,{label:"Min Confidence",value:e.firms.confidence_min,onChange:q=>Ne({firms:{...e.firms,confidence_min:q}}),options:[{value:"low",label:"Low"},{value:"nominal",label:"Nominal"},{value:"high",label:"High"}]}),d.jsx(Ae,{label:"Proximity (km)",value:e.firms.proximity_km,onChange:q=>Ne({firms:{...e.firms,proximity_km:q}}),step:.5})]}),aa("firms")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((q,Me)=>{var ct;return d.jsx(Ae,{label:q,value:((ct=e.firms.bbox)==null?void 0:ct[Me])??0,onChange:ot=>{const dt=[...e.firms.bbox||[0,0,0,0]];dt[Me]=ot,Ne({firms:{...e.firms,bbox:dt}})},step:.01},q)})})]});case"satpass":{const q=e.satpass.enabled?Ke.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 d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:`px-4 py-2.5 text-sm rounded ${q.color}`,children:[d.jsx("span",{className:"font-semibold",children:q.label}),q.desc&&d.jsx("span",{className:"font-normal",children:q.desc})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Safety Controls"}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm text-[#e0e0e0]",children:"Dry run — log instead of transmit"}),d.jsx("p",{className:"text-xs text-[#666]",children:"When enabled, passes are logged but never broadcast to mesh"})]}),d.jsx("button",{onClick:()=>St({...Ke,dry_run:!Ke.dry_run}),className:`relative w-10 h-5 rounded-full transition-colors ${Ke.dry_run?"bg-sky-500":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${Ke.dry_run?"translate-x-5":""}`})})]}),d.jsx(Ae,{label:"Max broadcasts / hour",value:Ke.max_broadcasts_per_hour,onChange:Me=>St({...Ke,max_broadcasts_per_hour:Me}),min:1,max:60,helper:"Rate cap — broadcasts exceeding this limit are dropped"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Pass Filters"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsx(Ae,{label:"Min Elevation (deg)",value:Ke.min_elevation,onChange:Me=>St({...Ke,min_elevation:Me}),min:0,max:90,helper:"Minimum max elevation for a pass to be broadcast"})})]}),d.jsx(la,{label:"Observer Locations",value:Ke.observers,onChange:Me=>St({...Ke,observers:Me}),helper:"Observer names to include (empty = all)"}),d.jsx(la,{label:"NORAD IDs",value:Ke.norad_ids,onChange:Me=>St({...Ke,norad_ids:Me}),helper:"NORAD catalog IDs to broadcast (empty = broadcast nothing, opt-in only)"}),d.jsxs("div",{className:"border-t border-border pt-4 mt-2 space-y-6",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Native satpass (SGP4) — no Central required"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-[#777] mb-2",children:"Observers (ground stations the predictor computes passes for)"}),aa("satpass")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Observer locations are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"space-y-2",children:(e.satpass.observers||[]).map((Me,ct)=>d.jsxs("div",{className:"grid grid-cols-6 gap-2 items-end",children:[d.jsx(yt,{label:"Slug",value:Me.slug,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,slug:ot},Ne({satpass:{...e.satpass,observers:dt}})},placeholder:"tvly"}),d.jsx(yt,{label:"Name",value:Me.name,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,name:ot},Ne({satpass:{...e.satpass,observers:dt}})},placeholder:"Treasure Valley"}),d.jsx(Ae,{label:"Lat",value:Me.lat,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,lat:ot},Ne({satpass:{...e.satpass,observers:dt}})},step:1e-4}),d.jsx(Ae,{label:"Lon",value:Me.lon,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,lon:ot},Ne({satpass:{...e.satpass,observers:dt}})},step:1e-4}),d.jsx(Ae,{label:"Alt (m)",value:Me.alt_m,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Me,alt_m:ot},Ne({satpass:{...e.satpass,observers:dt}})},step:1}),d.jsx("button",{onClick:()=>Ne({satpass:{...e.satpass,observers:e.satpass.observers.filter((ot,dt)=>dt!==ct)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},ct))}),d.jsx("button",{onClick:()=>Ne({satpass:{...e.satpass,observers:[...e.satpass.observers||[],{slug:"",name:"",lat:0,lon:0,alt_m:0}]}}),className:"text-xs text-accent hover:underline mt-2",children:"+ Add Observer"})]})]}),d.jsx(la,{label:"TLE Groups",value:e.satpass.tle_groups,onChange:Me=>Ne({satpass:{...e.satpass,tle_groups:Me}}),helper:"Celestrak GP group selectors, e.g. weather, stations, amateur",infoLink:"https://celestrak.org/NORAD/elements/"}),d.jsx(X2,{label:"NORAD IDs (native)",value:e.satpass.norad_ids,onChange:Me=>Ne({satpass:{...e.satpass,norad_ids:Me}}),helper:"Specific NORAD catalog IDs to also fetch/predict, e.g. 25544, 33591"}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(Ae,{label:"Min Elevation (deg)",value:e.satpass.min_elevation_deg,onChange:Me=>Ne({satpass:{...e.satpass,min_elevation_deg:Me}}),min:0,max:90,helper:"Native SGP4 pass filter (separate from Central min elevation above)"}),d.jsx(Ae,{label:"Window (hours)",value:e.satpass.window_hours,onChange:Me=>Ne({satpass:{...e.satpass,window_hours:Me}}),min:1,max:168,helper:"Hours ahead to predict passes"}),d.jsx(Ae,{label:"TLE Refresh (sec)",value:e.satpass.tle_refresh_seconds,onChange:Me=>Ne({satpass:{...e.satpass,tle_refresh_seconds:Me}}),min:3600,helper:"How often to re-fetch TLEs (default 21600 = 6h)"}),d.jsx(Ae,{label:"Broadcast Lead (sec)",value:e.satpass.broadcast_lead_seconds??3600,onChange:Me=>Ne({satpass:{...e.satpass,broadcast_lead_seconds:Me}}),min:0,helper:"How far ahead of a pass to announce"})]})]})]})}}},ly=e,uy=(se,ut)=>{const Ze=e[se]||{};Ne({[se]:{...Ze,...ut}})};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-xl font-semibold text-white",children:"Data Feeds"}),d.jsx("div",{className:"flex items-center gap-3",children:M==="curated"&&d.jsxs(d.Fragment,{children:[d.jsx(qt,{label:"Feeds Enabled",checked:e.enabled,onChange:se=>Ne({enabled:se})}),Tn&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:$e,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:Mn,disabled:c,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",c?"Saving…":"Save"]})]})]})})]}),f&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:f}),g&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:g}),y&&d.jsxs("div",{className:"flex items-center justify-between text-sm text-accent bg-accent/10 border border-accent/30 p-3",children:[d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx(Zi,{size:14})," A restart is required for some changes to take effect."]}),d.jsx("button",{onClick:Zh,className:"px-3 py-1 bg-accent/20 hover:bg-amber-500/30",children:"Restart now"})]}),d.jsxs("div",{className:"flex gap-1 border-b border-border",children:[d.jsxs("button",{onClick:()=>A("curated"),className:`flex items-center gap-2 px-4 py-2 text-sm border-b-2 -mb-px transition-colors ${M==="curated"?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[d.jsx(kh,{size:15})," Data Feeds"]}),d.jsxs("button",{onClick:()=>A("advanced"),className:`flex items-center gap-2 px-4 py-2 text-sm border-b-2 -mb-px transition-colors ${M==="advanced"?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[d.jsx(Bg,{size:15})," Advanced (raw)"]})]}),M==="advanced"&&d.jsxs("div",{className:"-mx-6",children:[d.jsx("div",{className:"px-6 pb-2 text-xs text-[#777]",children:"Curated keys (owned by the Data Feeds panels above) are hidden here. Future or unknown keys from adapters will appear in this view."}),d.jsx(PZ,{excludeKeys:VCe,hideLlmToggle:!0})]}),M==="curated"&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:Q2.map(({key:se,label:ut,icon:Ze})=>d.jsxs("button",{onClick:()=>{w(se);const mt=Q2.find(rr=>rr.key===se);C(mt.adapters[0]??null)},className:`flex items-center gap-2 px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${_===se?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[d.jsx(Ze,{size:15})," ",ut]},se))}),_==="central"&&e.central&&d.jsxs("div",{className:"border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Central Connection"}),d.jsx("p",{className:"text-xs text-[#666]",children:'NATS JetStream source for any adapter set to "central"'})]}),d.jsx(qt,{label:"",checked:!!e.central.enabled,onChange:se=>Ne({central:{...e.central,enabled:se}})})]}),d.jsxs("div",{className:e.central.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[d.jsx(yt,{label:"URL",value:e.central.url||"",onChange:se=>Ne({central:{...e.central,url:se}}),placeholder:"nats://central.echo6.mesh:4222"}),d.jsx(yt,{label:"Durable",value:e.central.durable||"",onChange:se=>Ne({central:{...e.central,durable:se}}),placeholder:"meshai-v04"}),d.jsx(Ae,{label:"Connect Timeout (sec)",value:e.central.connect_timeout??10,onChange:se=>Ne({central:{...e.central,connect_timeout:se}}),step:.5,min:0,helper:"NATS connect timeout for the Central consumer"}),d.jsx(yt,{label:"Region",value:e.central.region||"",onChange:se=>Ne({central:{...e.central,region:se}}),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."})]})]}),_==="mesh"&&d.jsxs("div",{className:"border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Mesh Health"}),d.jsx("p",{className:"text-xs text-[#666]",children:"Node/infra telemetry — sourced from the mesh, not an environmental feed."})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),d.jsx(jZ,{value:"native",onChange:()=>{},disabled:!1,centralDisabled:!0})]})]}),d.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available — reserved for a future migration."})]}),_==="family_settings"&&d.jsxs("div",{className:"space-y-4",children:[d.jsxs("p",{className:"text-xs text-[#777]",children:["Per-family gating: enable/disable each notification family, set its minimum severity threshold, freshness window, and cooldown. Delivery routing (which mesh channels, email, webhook) is configured on the ",d.jsx("a",{href:"/meshtastic/routing",className:"text-accent hover:underline",children:"Meshtastic Routing"})," and"," ",d.jsx("a",{href:"/meshcore/routing",className:"text-accent hover:underline",children:"MeshCore Routing"})," pages."]}),$h&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:$h}),ku&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:ku}),Gn===null?d.jsx("div",{className:"text-xs text-[#666] italic",children:"Loading family settings…"}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:fu.map(({key:se,label:ut,Icon:Ze})=>{const mt=Lv[se]||{};return d.jsxs("div",{className:"border border-border p-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#e0e0e0]",children:[d.jsx(Ze,{size:15})," ",ut]}),d.jsx(qt,{label:"",checked:!!mt.enabled,onChange:rr=>Ga(se,{enabled:rr})})]}),d.jsxs("div",{className:mt.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[d.jsx(Dn,{label:"Min Severity",value:mt.min_severity||"priority",onChange:rr=>Ga(se,{min_severity:rr}),options:[{value:"routine",label:"Routine — informational"},{value:"priority",label:"Priority — needs attention"},{value:"immediate",label:"Immediate — act now"}]}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsx(Ae,{label:"Freshness (sec)",value:mt.freshness_seconds??600,onChange:rr=>Ga(se,{freshness_seconds:rr}),min:0,helper:"Drop events older than this"}),d.jsx(Ae,{label:"Cooldown (sec)",value:mt.cooldown_seconds??0,onChange:rr=>Ga(se,{cooldown_seconds:rr}),min:0,helper:"0 = no throttle"})]}),d.jsx(la,{label:"Regions",value:mt.regions??[],onChange:rr=>Ga(se,{regions:rr}),helper:"Empty = all regions; otherwise only these region names"})]})]},se)})}),oy&&d.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[d.jsxs("button",{onClick:xw,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:sy,disabled:Wh,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",Wh?"Saving…":"Save"]})]})]})]}),is.adapters.length>0&&Rr&&d.jsxs(d.Fragment,{children:[is.adapters.length>1&&d.jsx("div",{className:"flex gap-1",children:is.adapters.map(se=>d.jsx("button",{onClick:()=>C(se),className:`px-3 py-1.5 text-sm ${Rr===se?"bg-bg-hover text-white":"text-[#777] hover:text-white"}`,children:dc[se].label},se))}),d.jsx(qCe,{title:dc[Rr].label,subtitle:dc[Rr].subtitle,enabled:((cy=ly[Rr])==null?void 0:cy.enabled)??!1,onEnabled:se=>uy(Rr,{enabled:se}),feedSource:((hy=ly[Rr])==null?void 0:hy.feed_source)??"native",onFeedSource:se=>uy(Rr,{feed_source:se}),hasCentral:dc[Rr].hasCentral,nativeOnly:dc[Rr].nativeOnly,hasKey:ww(Rr),health:_w(Rr),events:bw(Rr),llmContext:Pu[Rr]!==void 0?I[Pu[Rr]]??!0:void 0,onLlmContext:Pu[Rr]!==void 0?se=>as(Pu[Rr],se):void 0,children:Yh(Rr)})]}),d.jsxs("div",{className:"pt-4 mt-2 border-t border-border space-y-4",children:[d.jsxs("div",{children:[d.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[d.jsx(Bg,{size:16})," Custom Sources"]}),d.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Point MeshAI at any public REST/GeoJSON feed; it becomes a routable family in Notifications — sitting alongside the built-in feeds above."})]}),d.jsx($Ce,{})]}),d.jsxs("details",{className:"group border border-border p-4",children:[d.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm font-medium text-[#e0e0e0] hover:text-white",children:[d.jsx(Ah,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced: Geocoder"]}),d.jsx("p",{className:"mt-2 text-xs text-[#666]",children:"Configures the Photon reverse-geocoder used to resolve place names."}),d.jsxs("div",{className:"mt-4 space-y-3 pl-6 border-l border-border",children:[d.jsx(yt,{label:"Geocoder URL",value:((dy=e.geocoder)==null?void 0:dy.url)??"https://photon.komoot.io",onChange:se=>Ne({geocoder:{...e.geocoder,url:se}}),placeholder:"https://photon.komoot.io",helper:"Photon geocoding endpoint"}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsx(Ae,{label:"Timeout (s)",value:((Xh=e.geocoder)==null?void 0:Xh.timeout_seconds)??2,onChange:se=>Ne({geocoder:{...e.geocoder,timeout_seconds:se}}),min:0,step:.5,helper:"HTTP timeout per geocode request"}),d.jsx(Ae,{label:"Search Radius (km)",value:((nl=e.geocoder)==null?void 0:nl.radius_km)??80,onChange:se=>Ne({geocoder:{...e.geocoder,radius_km:se}}),min:0,helper:"Bias radius around the configured center for results"}),d.jsx(Ae,{label:"Result Limit",value:((Iv=e.geocoder)==null?void 0:Iv.limit)??10,onChange:se=>Ne({geocoder:{...e.geocoder,limit:se}}),min:1,helper:"Max candidate results to consider"})]})]})]})]})]})}function QCe(e){if(e==null||e==="")return"—";let t;if(typeof e=="number")t=new Date(e<1e12?e*1e3:e);else{const r=Number(e);t=Number.isFinite(r)&&e.trim()!==""?new Date(r<1e12?r*1e3:r):new Date(e)}return isNaN(t.getTime())?"—":t.toLocaleString()}function e2e(e){switch(e){case"meshtastic":return{label:"Meshtastic",cls:"bg-blue-500/15 text-blue-400 border border-blue-500/30"};case"meshcore":return{label:"MeshCore",cls:"bg-green-500/15 text-green-400 border border-green-500/30"};default:return{label:"Legacy",cls:"bg-slate-500/15 text-slate-400 border border-slate-600/40"}}}function t2e(e){return e==null||e===""?"—":typeof e=="number"?`ch ${e}`:e.startsWith("#")?e:`#${e}`}const r2e={nws_alerts:"Weather",fires:"Fire",fire_digest_broadcasts:"Fire digest",satpass_events:"Satellite",band_conditions_broadcasts:"Band",traffic_events:"Traffic",quake_events:"Quake",swpc_events:"Space Wx",gauge_readings:"Hydro",event_log:"Avalanche"},n2e=[["🔥","Fire"],["🚧","Traffic"],["⚠️ Road Incident","Traffic"],["🚫","Traffic"],["⛷","Avalanche"],["🌊","Hydro"],["🧲","Space Wx"],["☀️","Space Wx"],["🌐","Quake"],["⏳","Weather"],["🌡️","Weather"],["🌬️","Weather"],["⛈️","Weather"],["🌩️","Weather"]];function a2e(e,t){if(e)return r2e[e]??e.replace(/_/g," ").replace(/s$/,"");if(t){for(const[r,n]of n2e)if(t.startsWith(r))return n}return"broadcast"}const i2e=[{value:"all",label:"All meshes"},{value:"meshtastic",label:"Meshtastic"},{value:"meshcore",label:"MeshCore"}],o2e=[{value:"all",label:"All types"},{value:"nws_alerts",label:"Weather"},{value:"fires",label:"Fires"},{value:"satpass_events",label:"Satellite"},{value:"band_conditions_broadcasts",label:"Band"},{value:"traffic_events",label:"Traffic"}],cx=100;function XB(){const[e,t]=E.useState([]),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState("all"),[l,u]=E.useState("all"),[c,h]=E.useState(cx);return E.useEffect(()=>{document.title="Activity Log — MeshAI"},[]),E.useEffect(()=>{let f=!0;const v=()=>{OJ(c,o,l).then(m=>{f&&(t(m),i(null),n(!1))}).catch(m=>{f&&(i(m.message),n(!1))})};v();const g=setInterval(v,5e3);return()=>{f=!1,clearInterval(g)}},[c,o,l]),r?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading activity…"})}):a?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsxs("div",{className:"text-red-400",children:["Error: ",a]})}):d.jsx("div",{className:"space-y-4",children:d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"p-4 border-b border-border flex items-center flex-wrap gap-2",children:[d.jsx(Oo,{size:14,className:"text-[#f59e0b]"}),d.jsx("h2",{className:"text-sm font-medium text-slate-300",children:"Activity Log"}),d.jsx("select",{value:o,onChange:f=>{s(f.target.value),h(cx)},className:"text-xs bg-bg-hover text-slate-300 border border-border rounded px-2 py-1",children:i2e.map(f=>d.jsx("option",{value:f.value,children:f.label},f.value))}),d.jsx("select",{value:l,onChange:f=>{u(f.target.value),h(cx)},className:"text-xs bg-bg-hover text-slate-300 border border-border rounded px-2 py-1",children:o2e.map(f=>d.jsx("option",{value:f.value,children:f.label},f.value))}),d.jsxs("span",{className:"text-xs text-slate-500 ml-auto",children:[e.length," broadcast",e.length===1?"":"s"," · newest first"]})]}),e.length===0?d.jsxs("div",{className:"flex items-center gap-2 text-slate-500 p-8",children:[d.jsx(_i,{size:18}),d.jsx("span",{children:"No outbound broadcasts recorded yet."})]}):d.jsx("ul",{className:"divide-y divide-border",children:e.map(f=>{const v=e2e(f.transport);return d.jsx("li",{className:"p-4 hover:bg-bg-hover transition-colors",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx("div",{className:"pt-0.5",children:f.success===1?d.jsx(bk,{size:16,className:"text-green-500"}):f.success===0?d.jsx(Fj,{size:16,className:"text-amber-500"}):d.jsx(Fj,{size:16,className:"text-slate-600"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center flex-wrap gap-2 mb-1",children:[d.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${v.cls}`,children:v.label}),d.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-bg-hover text-slate-400 border border-border",children:t2e(f.channel)}),d.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-[#f59e0b]/10 text-[#f59e0b]",children:a2e(f.source_event_table,f.text)}),f.success===1&&d.jsx("span",{className:"text-xs text-green-500",children:"Sent"}),f.success===0&&d.jsx("span",{className:"text-xs text-amber-500",children:"Skip"}),(f.success===null||f.success===void 0)&&d.jsx("span",{className:"text-xs text-slate-500",children:"—"})]}),d.jsx("div",{className:"text-sm text-slate-200 break-words whitespace-pre-wrap",children:f.text||d.jsx("span",{className:"text-slate-500 italic",children:"(no text)"})}),d.jsxs("div",{className:"flex items-center gap-1 mt-1.5 text-xs text-slate-500 font-mono",children:[d.jsx(LV,{size:12}),QCe(f.sent_at)]})]})]})},f.id)})}),e.length>=c&&d.jsx("div",{className:"p-3 border-t border-border flex justify-center",children:d.jsx("button",{onClick:()=>h(f=>f+cx),className:"text-xs px-3 py-1 rounded bg-bg-hover text-slate-300 border border-border hover:bg-bg-card transition-colors",children:"Load more"})})]})})}const qB=[{id:"stream-gauges",label:"Stream Gauges",icon:c1},{id:"wildfire",label:"Wildfire",icon:Rm},{id:"firms",label:"Satellite Fire Detection (FIRMS)",icon:f1},{id:"fire-tracker",label:"Fire Tracker (Fusion)",icon:xJ},{id:"weather-alerts",label:"Weather Alerts",icon:mJ},{id:"solar",label:"Solar & Geomagnetic",icon:GV},{id:"ducting",label:"Tropospheric Ducting",icon:_i},{id:"avalanche",label:"Avalanche Danger",icon:kf},{id:"traffic",label:"Traffic Flow",icon:u1},{id:"roads-511",label:"Road Conditions (511)",icon:IV},{id:"mesh-health",label:"Mesh Health",icon:Oo},{id:"broadcast-types",label:"Broadcast Types",icon:BV},{id:"reminders",label:"Reminder System",icon:LV},{id:"notifications",label:"Notifications",icon:NV},{id:"commands",label:"Commands",icon:HV},{id:"llm-dm",label:"LLM DM Queries",icon:wk},{id:"or-not-and",label:"OR-not-AND Architecture",icon:Sk},{id:"adapter-config",label:"Adapter Config & CODE Rule",icon:Bg},{id:"curation",label:"Curation: Gauges & Towns",icon:jV},{id:"schema",label:"Schema Migrations",icon:wJ},{id:"api",label:"API Reference",icon:yJ}];function mr({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 d.jsx("span",{className:`inline-block w-3 h-3 rounded-full ${t[e]}`})}function Gt({headers:e,rows:t}){return d.jsx("div",{className:"overflow-x-auto my-4",children:d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsx("tr",{className:"bg-[#1a2332] border-b border-[#2a3a4a]",children:e.map((r,n)=>d.jsx("th",{className:"px-4 py-2 text-left text-slate-400 font-medium",children:r},n))})}),d.jsx("tbody",{children:t.map((r,n)=>d.jsx("tr",{className:`border-b border-[#1e2a3a] ${n%2===0?"bg-[#0d1219]":"bg-[#0a0e17]"}`,children:r.map((a,i)=>d.jsx("td",{className:"px-4 py-2 text-slate-300",children:a},i))},n))})]})})}function er({href:e,children:t}){return d.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:[t," ",d.jsx(Jc,{size:12})]})}function _e({children:e}){return d.jsx("h3",{className:"text-lg font-semibold text-slate-200 mt-6 mb-3",children:e})}function yl({children:e}){return d.jsx("h4",{className:"text-base font-medium text-slate-300 mt-4 mb-2",children:e})}function fe({children:e}){return d.jsx("code",{className:"font-mono text-accent bg-[#1a2332] px-1 rounded",children:e})}function Ir({id:e,title:t,children:r}){return d.jsxs("section",{id:e,className:"mb-12 scroll-mt-6",children:[d.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-4 pb-2 border-b border-[#2a3a4a]",children:t}),d.jsx("div",{className:"text-slate-300 leading-relaxed space-y-4",children:r})]})}function s2e(){const e=xu(),[t,r]=E.useState(""),[n,a]=E.useState("stream-gauges"),i=E.useRef(null);E.useEffect(()=>{const l=e.hash.replace("#","");if(l&&qB.find(u=>u.id===l)){a(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"})}},[e.hash]);const o=qB.filter(l=>l.label.toLowerCase().includes(t.toLowerCase())),s=l=>{a(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"",`#${l}`)};return d.jsxs("div",{className:"flex h-full -m-6",children:[d.jsxs("aside",{className:"w-64 flex-shrink-0 bg-bg-card border-r border-border overflow-y-auto",children:[d.jsx("div",{className:"p-4 border-b border-border",children:d.jsxs("div",{className:"relative",children:[d.jsx(v1,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),d.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"})]})}),d.jsx("nav",{className:"py-2",children:o.map(l=>{const u=l.icon,c=n===l.id;return d.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:[d.jsx(u,{size:16}),l.label]},l.id)})})]}),d.jsx("div",{ref:i,className:"flex-1 overflow-y-auto p-6",children:d.jsxs("div",{className:"max-w-4xl",children:[d.jsx("p",{className:"text-slate-400 mb-8",children:"Everything you need to understand and configure MeshAI's monitoring and alerting systems."}),d.jsxs(Ir,{id:"stream-gauges",title:"Stream Gauges",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI watches river and stream levels at gauges you configure. Each gauge reports two things:"}),d.jsxs("p",{children:[d.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.`]}),d.jsxs("p",{children:[d.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:`]}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"A small creek: 50-200 CFS"}),d.jsx("li",{children:"A mid-size river: 1,000-5,000 CFS"}),d.jsx("li",{children:"A big river in spring runoff: 10,000+ CFS"})]}),d.jsx(_e,{children:"When Does It Flood?"}),d.jsxs("p",{children:["Flood levels are set by the ",d.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.']}),d.jsxs("p",{children:[d.jsx("strong",{children:"Action Stage"})," — water is rising, time to start paying attention. Usually still inside the riverbanks."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Minor Flood"})," — low-lying roads start getting water on them. NWS issues a Flood Advisory."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Moderate Flood"})," — water in buildings near the river. Some people need to evacuate. NWS issues a Flood Warning."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Major Flood"})," — widespread flooding. Many people evacuating. Serious property damage."]}),d.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."}),d.jsx(_e,{children:"Low Water / Drought"}),d.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.`}),d.jsx(_e,{children:"Setting It Up"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Find your gauge at ",d.jsx(er,{href:"https://waterdata.usgs.gov/nwis",children:"waterdata.usgs.gov/nwis"})]}),d.jsxs("li",{children:["Copy the site number (like ",d.jsx(fe,{children:"13090500"}),")"]}),d.jsx("li",{children:"Add it in Config → Environmental → USGS"}),d.jsx("li",{children:"MeshAI auto-fills the gauge name and flood levels from NWS"})]}),d.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."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://waterdata.usgs.gov/nwis",children:"USGS Water Data"})," — find gauges near you"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://water.noaa.gov",children:"NWS Water Prediction Service"})," — flood forecasts and thresholds"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.usgs.gov/special-topics/water-science-school/science/how-streamflow-measured",children:"Understanding Streamflow"})," — USGS explainer"]})]})]}),d.jsxs(Ir,{id:"wildfire",title:"Wildfire",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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."}),d.jsx(_e,{children:"Fire Size — How Big Is It?"}),d.jsx(Gt,{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."]]}),d.jsx("p",{children:"For reference, 1,000 acres is about 1.5 square miles."}),d.jsx(_e,{children:"Containment — Is It Under Control?"}),d.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."}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"0-30%"})," — Essentially uncontrolled. The fire goes where it wants."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"50%"})," — Good progress, but half the edge can still grow."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"80%+"})," — Well controlled. Major growth unlikely."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"100%"}),' — The edge is fully controlled. But the fire may STILL be actively burning inside. "100% contained" does NOT mean "out."']})]}),d.jsx(_e,{children:"How Far Away Should I Worry?"}),d.jsx(Gt,{headers:["Distance","What To Do"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Under 5 km (3 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Immediate threat."})," This is evacuation-order range. Embers can fly this far in wind."]})],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," 5-15 km (3-10 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Prepare."})," The fire could reach you in hours under bad conditions. Have a plan."]})],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," 15-30 km (10-20 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Watch."})," Smoke is likely. Wind shifts could change things fast."]})],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Over 30 km (20 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Awareness."})," Keep an eye on it, but no immediate threat."]})]]}),d.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."}),d.jsx(_e,{children:"Which Matters More — Size or Distance?"}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Setting It Up"}),d.jsxs("p",{children:["Just configure your state code (like ",d.jsx(fe,{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."]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://inciweb.nwcg.gov",children:"InciWeb"})," — detailed incident information"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://data-nifc.opendata.arcgis.com",children:"NIFC Fire Map"})," — raw perimeter data"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.ready.gov/wildfires",children:"Ready.gov Wildfires"})," — preparedness guide"]})]})]}),d.jsxs(Ir,{id:"firms",title:"Satellite Fire Detection (FIRMS)",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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.`}),d.jsxs("p",{children:[d.jsx("strong",{children:"Why this matters"}),": satellite hotspots show up ",d.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."]}),d.jsx(_e,{children:"Confidence — Is It Really a Fire?"}),d.jsx("p",{children:"Each detection gets a confidence rating:"}),d.jsx(Gt,{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."]]}),d.jsxs("p",{children:[d.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.`]}),d.jsx(_e,{children:"FRP — How Intense Is It?"}),d.jsx("p",{children:'FRP (Fire Radiative Power) measures the heat output in megawatts. Think of it as "how hot is this thing":'}),d.jsx(Gt,{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"]]}),d.jsx("p",{children:"Setting the minimum FRP to 5 MW filters out most industrial and agricultural false alarms."}),d.jsx(_e,{children:"New Ignition Detection"}),d.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 ",d.jsx("strong",{children:"potential new ignition"})," — maybe a new fire just started. These get elevated priority regardless of confidence level."]}),d.jsx(_e,{children:"Timing"}),d.jsxs("p",{children:["Satellite data arrives ",d.jsx("strong",{children:"1-3 hours"})," after the satellite passes overhead. Each location gets observed about ",d.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."`]}),d.jsx(_e,{children:"Getting an API Key"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Go to ",d.jsx(er,{href:"https://firms.modaps.eosdis.nasa.gov/api/area/",children:"FIRMS API page"})]}),d.jsx("li",{children:'Click "Get MAP_KEY"'}),d.jsx("li",{children:"Register for a free Earthdata account"}),d.jsx("li",{children:"Your key arrives by email"}),d.jsx("li",{children:"Enter it in Config → Environmental → FIRMS"})]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://firms.modaps.eosdis.nasa.gov",children:"FIRMS Fire Map"})," — see hotspots on a map"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://earthdata.nasa.gov/data/tools/firms/faq",children:"FIRMS FAQ"})," — how it works"]})]})]}),d.jsxs(Ir,{id:"fire-tracker",title:"Fire Tracker (Fusion)",children:[d.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."}),d.jsx(_e,{children:"What you'll see on the mesh"}),d.jsx("p",{children:"Six fire-family alert categories, in order of when they fire during an incident's lifecycle:"}),d.jsx(Gt,{headers:["Category","Severity","Trigger","Example broadcast"],rows:[[d.jsx(fe,{children:"unattributed_hotspot_cluster"}),"Priority","3+ FIRMS pixels within 1 mi over 60 min, no WFIGS match — possible new ignition before NIFC declares it",d.jsx("span",{className:"text-amber-300",children:"🔥 Possible new fire: 3 hotspots within 1 mi @ 42.93,-114.45 (combined 78 MW)"})],[d.jsx(fe,{children:"wildfire_declared"}),"Priority","WFIGS first-sight of a new IRWIN incident — the official 'this is a fire and here is its name' record",d.jsx("span",{className:"text-amber-300",children:"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained"})],[d.jsx(fe,{children:"wildfire_growth"}),"Priority","Per-pass centroid drift >= 0.5 mi (configurable) between consecutive satellite passes — the fire's footprint moved",d.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire moving NE 1.2 mi/h, ~3 mi from Almo"})],[d.jsx(fe,{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",d.jsx("span",{className:"text-amber-300",children:"🔥 Possible spotting 2.1 mi NE of Cache Peak Fire perimeter"})],[d.jsx(fe,{children:"wildfire_incident"}),"Priority","WFIGS acreage or containment increased on a fire already broadcast once (the Update path; the New path uses wildfire_declared)",d.jsx("span",{className:"text-amber-300",children:"🔥 Update: Cache Peak Fire: 1,847 ac, 23% contained"})],[d.jsx(fe,{children:"wildfire_halted"}),"Routine","No FIRMS pixels attributed for 12+ hours (configurable) — fire stalled or out",d.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire no growth in 14h"})]]}),d.jsx(_e,{children:"How attribution works"}),d.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 ",d.jsx(fe,{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."]}),d.jsxs("p",{children:["Pixels that match no fire feed the cluster detector instead: if at least"," ",d.jsx(fe,{children:"cluster_min_pixels"})," (default 3) lie within"," ",d.jsx(fe,{children:"cluster_max_radius_mi"})," (default 1.0) over"," ",d.jsx(fe,{children:"cluster_time_window_minutes"})," (default 60), the bot fires a single ",d.jsx(fe,{children:"unattributed_hotspot_cluster"})," broadcast and marks the member pixels so a fourth arrival doesn't re-fire the same cluster."]}),d.jsx(_e,{children:"How movement is computed"}),d.jsxs("p",{children:["Each VIIRS pass groups pixels into a ",d.jsx(fe,{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 ≥ ",d.jsx(fe,{children:"growth_drift_threshold_mi"})," the"," ",d.jsx(fe,{children:"wildfire_growth"})," broadcast fires."]}),d.jsx(_e,{children:"How spotting is detected"}),d.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 ≥"," ",d.jsx(fe,{children:"spotting_distance_threshold_mi"})," (default 1.5) fire the"," ",d.jsx(fe,{children:"wildfire_spotting"})," broadcast at ",d.jsx("em",{children:"immediate"})," severity — spread beyond the existing perimeter is the most actionable fire signal we emit. A per-fire cooldown (",d.jsx(fe,{children:"spotting_cooldown_seconds"}),", default 1 h) prevents an ember burst in the same area from spamming the mesh."]}),d.jsx(_e,{children:"Tunable knobs (Adapter Config → fires)"}),d.jsx(Gt,{headers:["Key","Default","What it does"],rows:[[d.jsx(fe,{children:"spread_radius_mi_default"}),"5.0 mi","Attribution radius for FIRMS → fire matching. Per-fire override in the fires.spread_radius_mi column."],[d.jsx(fe,{children:"growth_drift_threshold_mi"}),"0.5 mi","Per-pass centroid drift at or above this fires wildfire_growth."],[d.jsx(fe,{children:"halt_passes_threshold"}),"2","Consecutive empty satellite passes before wildfire_halted (documented; the time gate below is the operational rule)."],[d.jsx(fe,{children:"halt_minimum_seconds"}),"43,200 (12 h)","Minimum elapsed seconds since the most recent attributed pixel before wildfire_halted can fire."],[d.jsx(fe,{children:"spotting_distance_threshold_mi"}),"1.5 mi","Distance from prior-pass perimeter that fires wildfire_spotting."],[d.jsx(fe,{children:"spotting_cooldown_seconds"}),"3,600 (1 h)","Minimum seconds between consecutive spotting broadcasts per fire."]]})]}),d.jsxs(Ir,{id:"weather-alerts",title:"Weather Alerts",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI watches for NWS (National Weather Service) alerts affecting your area — warnings, watches, and advisories."}),d.jsx(_e,{children:"Alert Severity — How Serious Is It?"}),d.jsx(Gt,{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"]]}),d.jsx(_e,{children:"When Should I Act? (Urgency)"}),d.jsx(Gt,{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"]]}),d.jsx(_e,{children:"How Sure Are They? (Certainty)"}),d.jsx(Gt,{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"]]}),d.jsx(_e,{children:"These Are Separate Scales"}),d.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."'}),d.jsx(_e,{children:"What Minimum Severity Should I Set?"}),d.jsx(Gt,{headers:["Setting","What You Get","What You Miss"],rows:[["Minor","Everything — high volume","Nothing"],[d.jsxs(d.Fragment,{children:[d.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"]]}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Finding Your NWS Zone"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Go to ",d.jsx(er,{href:"https://www.weather.gov",children:"weather.gov"})]}),d.jsx("li",{children:"Enter your location"}),d.jsxs("li",{children:["Find your zone code at ",d.jsx(er,{href:"https://www.weather.gov/pimar/PubZone",children:"NWS Zone Map"})]}),d.jsxs("li",{children:["Zone codes look like: ",d.jsx(fe,{children:"IDZ016"}),", ",d.jsx(fe,{children:"UTZ040"}),", etc."]})]}),d.jsx(_e,{children:"The User-Agent Field"}),d.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:"}),d.jsx("p",{children:d.jsx(fe,{children:"(meshai, you@email.com)"})}),d.jsx("p",{children:"No registration. No waiting. Just type it in."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://alerts.weather.gov",children:"NWS Active Alerts"})," — see current alerts"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.weather.gov/documentation/services-web-api",children:"NWS API Docs"})," — technical details"]})]})]}),d.jsxs(Ir,{id:"solar",title:"Solar & Geomagnetic Conditions",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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."}),d.jsx(_e,{children:"Solar Flux Index (SFI)"}),d.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.'}),d.jsx(Gt,{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."]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Quick rule"}),": SFI above 90 and Kp below 4 = good day for HF radio."]}),d.jsx(_e,{children:"Kp Index"}),d.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."}),d.jsx(Gt,{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."],[d.jsx("strong",{children:"5"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Minor storm (G1)."})," HF noticeably degraded. Aurora visible at high latitudes (~60°N)."]})],[d.jsx("strong",{children:"6"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Moderate storm (G2)."})," HF getting rough. Aurora moving south (~55°N)."]})],[d.jsx("strong",{children:"7"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Strong storm (G3)."})," HF unreliable for 1-2 days. Aurora at mid-latitudes."]})],[d.jsx("strong",{children:"8-9"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Severe/Extreme storm."})," HF may black out completely. Aurora visible at very low latitudes. Power grid stress possible."]})]]}),d.jsx(_e,{children:"R / S / G Scales"}),d.jsx("p",{children:"NOAA's shorthand for three types of space weather events:"}),d.jsx(yl,{children:"R (Radio Blackouts) — from solar flares:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"R1-R2: Brief HF disruption. You might not notice."}),d.jsx("li",{children:"R3: HF goes out for about an hour on the sunlit side of Earth."}),d.jsx("li",{children:"R4-R5: HF dead for hours. Serious."})]}),d.jsx(yl,{children:"S (Solar Radiation Storms) — from energetic particles:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Mostly affects polar regions and satellites"}),d.jsx("li",{children:"S3+: Polar HF goes out entirely"})]}),d.jsx(yl,{children:"G (Geomagnetic Storms) — from solar wind disturbances:"}),d.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:d.jsx("li",{children:"Same as the Kp scale: G1 = Kp 5, up to G5 = Kp 9"})}),d.jsx(_e,{children:"Bz — The Storm Predictor"}),d.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."}),d.jsx(Gt,{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."]]}),d.jsx("p",{children:"Bz can change fast — minute to minute. What matters is whether it stays negative for hours, not brief dips."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://www.swpc.noaa.gov",children:"SWPC Space Weather Dashboard"})," — live data"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.swpc.noaa.gov/noaa-scales-explanation",children:"NOAA Space Weather Scales"})," — what R/S/G mean"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.hamqsl.com/solar.html",children:"HamQSL Solar Page"})," — ham-friendly display"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.swpc.noaa.gov/products/planetary-k-index",children:"Planetary K-Index"})," — live Kp"]})]})]}),d.jsxs(Ir,{id:"ducting",title:"Tropospheric Ducting",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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.'}),d.jsx("p",{children:"MeshAI watches for these conditions by analyzing weather data (temperature and humidity at different altitudes) over your mesh area."}),d.jsx(_e,{children:"How Do I Know If Ducting Is Happening?"}),d.jsx("p",{children:'MeshAI reports a "condition" based on the atmospheric profile:'}),d.jsx(Gt,{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.']]}),d.jsx(_e,{children:"What You'll Actually Notice"}),d.jsx("p",{children:"When ducting happens on your mesh:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Distant repeaters you've never heard suddenly come in"}),d.jsx("li",{children:"Nodes appear from far outside your normal range"}),d.jsx("li",{children:"You hear FM radio stations from other cities"}),d.jsx("li",{children:"ADS-B flight tracking range gets much longer"}),d.jsx("li",{children:"There might be interference from distant stations on your frequency"})]}),d.jsx(_e,{children:"The dM/dz Number"}),d.jsx("p",{children:`The dashboard shows a "dM/dz" value in "M-units/km." You don't need to understand the math — just know:`}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Around 118"})," = normal atmosphere"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Below 79"})," = enhanced propagation starting"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Below 0 (negative)"})," = ducting is happening"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Below -50"})," = strong ducting — classic VHF/UHF DX event"]})]}),d.jsx(_e,{children:"When Does Ducting Happen?"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Under high-pressure weather systems (clear, stable air)"}),d.jsx("li",{children:"When warm air sits on top of cool air (temperature inversion)"}),d.jsx("li",{children:"Most common in late summer and early fall"}),d.jsx("li",{children:"Strongest along coastlines and over water"}),d.jsx("li",{children:"In mountain valleys: cold air pooling in fall/winter can create surface ducts"})]}),d.jsx(_e,{children:"Setting It Up"}),d.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."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://dxinfocentre.com/tropo.html",children:"Tropo Forecast Maps (Hepburn)"})," — 6-day tropo prediction"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://dxmaps.com",children:"DX Maps"})," — real-time VHF/UHF propagation reports"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://en.wikipedia.org/wiki/Tropospheric_propagation",children:"Wikipedia: Tropospheric Propagation"})," — background"]})]})]}),d.jsxs(Ir,{id:"avalanche",title:"Avalanche Danger",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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."}),d.jsx(_e,{children:"The Danger Scale"}),d.jsx(Gt,{headers:["Level","Name","Color","What To Do"],rows:[["1","Low",d.jsx(mr,{color:"green"}),"Generally safe. Normal caution in steep terrain."],["2","Moderate",d.jsx(mr,{color:"yellow"}),"Be careful on specific terrain features. Evaluate conditions."],["3","Considerable",d.jsx(mr,{color:"orange"}),d.jsxs(d.Fragment,{children:[d.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",d.jsx(mr,{color:"red"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Very dangerous."})," Stay off anything steep."]})],["5","Extreme",d.jsx(mr,{color:"black"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Don't go out."})," Avalanches are happening on their own."]})]]}),d.jsx(_e,{children:"The Most Important Thing to Know"}),d.jsxs("p",{children:[d.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.']}),d.jsx(_e,{children:"Seasonal"}),d.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.'}),d.jsx(_e,{children:"Finding Your Avalanche Center"}),d.jsxs("p",{children:["Go to ",d.jsx(er,{href:"https://avalanche.org/avalanche-centers/",children:"avalanche.org/avalanche-centers/"})," for a map. Common center codes:"]}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"SNFAC"})," — Sawtooth (central Idaho)"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"UAC"})," — Utah"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"NWAC"})," — Cascades/Olympics (WA/OR)"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"CAIC"})," — Colorado"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"SAC"})," — Sierra Nevada (CA)"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GNFAC"})," — Gallatin (SW Montana)"]})]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://avalanche.org",children:"Avalanche.org"})," — US forecasts"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://avalanche.org/avalanche-encyclopedia/human/resources/north-american-public-avalanche-danger-scale/",children:"Avalanche Danger Scale"})," — full scale explanation"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://kbyg.org",children:"Know Before You Go"})," — avalanche awareness"]})]})]}),d.jsxs(Ir,{id:"traffic",title:"Traffic Flow",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI monitors traffic speed on road segments you configure, using data from TomTom (real vehicles with navigation apps reporting their speed)."}),d.jsx(_e,{children:"Speed Ratio — The Key Number"}),d.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:'}),d.jsx(Gt,{headers:["Ratio","What It Means"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Above 85%"]}),"Normal. Traffic flowing fine."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," 65-85%"]}),"Slow. Heavier than usual but moving."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," 40-65%"]}),"Congested. Significant delays."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Below 40%"]}),"Gridlock. Barely moving."]]}),d.jsxs("p",{children:[d.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.`]}),d.jsx(_e,{children:"Confidence — Can You Trust the Data?"}),d.jsx("p",{children:"TomTom's confidence score tells you how much of the reading comes from real vehicles right now vs historical averages:"}),d.jsx(Gt,{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",d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Unreliable"})," — mostly guessing from historical patterns. Don't alert on this."]})]]}),d.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."}),d.jsx(_e,{children:"Setting Up Corridors"}),d.jsx("p",{children:'Each "corridor" is a point on a road you want to monitor. To add one:'}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Go to Google Maps, find the road"}),d.jsx("li",{children:`Right-click the road → "What's here?" → copy the coordinates`}),d.jsx("li",{children:"Add the corridor in Config with a name and those coordinates"}),d.jsx("li",{children:"TomTom finds the nearest road segment automatically"})]}),d.jsx(_e,{children:"Getting an API Key"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Sign up at ",d.jsx(er,{href:"https://developer.tomtom.com",children:"developer.tomtom.com"})," (free)"]}),d.jsx("li",{children:"Create an app → get your API key"}),d.jsx("li",{children:"Free tier: 2,500 requests/day (plenty for 5-10 corridors)"})]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://developer.tomtom.com",children:"TomTom Developer Portal"})," — API docs and key signup"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.tomtom.com/traffic-index/",children:"TomTom Traffic Index"})," — city congestion rankings"]})]})]}),d.jsxs(Ir,{id:"roads-511",title:"Road Conditions (511)",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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."}),d.jsx(_e,{children:"Setting It Up"}),d.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."}),d.jsx("p",{children:"Configure in Config → Environmental → 511:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Base URL"})," — your state's API endpoint"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"API Key"})," — if required by your state"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Endpoints"})," — which data feeds to poll (varies by state)"]})]}),d.jsx(_e,{children:"Learn More"}),d.jsx("p",{children:"Check your state's 511 or DOT website for developer information."})]}),d.jsxs(Ir,{id:"mesh-health",title:"Mesh Health",children:[d.jsx(_e,{children:"Health Score"}),d.jsx("p",{children:"MeshAI computes a 0-100 health score for your mesh network by looking at five areas, each weighted differently:"}),d.jsx(Gt,{headers:["Pillar","Weight","What It Measures"],rows:[[d.jsx("strong",{children:"Infrastructure"}),"30%","Are your routers online?"],[d.jsx("strong",{children:"Utilization"}),"25%","Is the radio channel congested?"],[d.jsx("strong",{children:"Coverage"}),"20%","Do nodes have redundant paths to gateways?"],[d.jsx("strong",{children:"Behavior"}),"15%","Are any nodes flooding the channel?"],[d.jsx("strong",{children:"Power"}),"10%","Are battery-powered nodes running low?"]]}),d.jsx("p",{children:"The overall score is the weighted sum:"}),d.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%)"}),d.jsx(_e,{children:"How Each Pillar Is Calculated"}),d.jsx(yl,{children:"Infrastructure (30%)"}),d.jsx("p",{children:"This is the simplest pillar — what percentage of your infrastructure nodes are currently online?"}),d.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"(routers online ÷ total routers) × 100"}),d.jsxs("p",{children:["Only nodes with the ",d.jsx(fe,{children:"ROUTER"}),", ",d.jsx(fe,{children:"ROUTER_LATE"}),", or ",d.jsx(fe,{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."]}),d.jsxs("p",{children:[d.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."]}),d.jsx(yl,{children:"Utilization (25%)"}),d.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 ",d.jsx("strong",{children:"highest"})," value from any infrastructure node because the busiest router is the bottleneck for the whole mesh."]}),d.jsx("p",{children:d.jsx("strong",{children:"How it works:"})}),d.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-4",children:[d.jsxs("li",{children:["Collect ",d.jsx(fe,{children:"channel_utilization"})," from all infrastructure nodes that report it"]}),d.jsx("li",{children:"If no infra nodes have telemetry, try all nodes"}),d.jsxs("li",{children:["Use the ",d.jsx("strong",{children:"maximum"})," value for scoring (busiest node = bottleneck)"]}),d.jsx("li",{children:"If no nodes report utilization (older firmware), fall back to packet count estimate"})]}),d.jsxs("p",{className:"mt-4",children:[d.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."]}),d.jsx(Gt,{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"]]}),d.jsxs("p",{children:[d.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."]}),d.jsx(yl,{children:"Coverage (20%)"}),d.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.'}),d.jsxs("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:["coverage_ratio = average_gateways_per_node ÷ total_sources",d.jsx("br",{}),"single_gw_penalty = (single_gateway_nodes ÷ total_nodes) × 40"]}),d.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."}),d.jsx(Gt,{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"]]}),d.jsxs("p",{children:[d.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.)."]}),d.jsx(yl,{children:"Behavior (15%)"}),d.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."}),d.jsxs("p",{children:[d.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."]}),d.jsx(Gt,{headers:["Flagged Nodes","Score"],rows:[["0","100"],["1","80"],["2-3","60"],["4-5","40"],["6+","20"]]}),d.jsx("p",{children:"A single misbehaving node only drops the score to 80. It takes multiple problem nodes to seriously hurt the behavior pillar."}),d.jsx(yl,{children:"Power (10%)"}),d.jsx("p",{children:"Measures what fraction of battery-powered nodes are below the warning threshold (default 20%)."}),d.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"100 × (1 − low_battery_nodes ÷ total_battery_nodes)"}),d.jsx("p",{children:"If 2 out of 10 battery nodes are below 20%, power scores 80."}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Health Tiers"}),d.jsx(Gt,{headers:["Score","Tier","What It Means"],rows:[["90-100",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Healthy"]}),"Everything's working well."],["75-89",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," Slight degradation"]}),"Some issues but the mesh is functional."],["50-74",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," Unhealthy"]}),"Multiple problems. Reliability is affected."],["25-49",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Warning"]}),"Significant issues. The mesh is struggling."],["0-24",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"black"})," Critical"]}),"Major failures. Barely functional."]]}),d.jsx(_e,{children:"Channel Utilization — Is the Radio Channel Full?"}),d.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."}),d.jsx(Gt,{headers:["Utilization","What's Happening"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Under 25%"]}),"Healthy. The firmware itself starts throttling above 25% to protect the channel — so under 25% is the target."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," 25-40%"]}),"Getting busy. Common on larger meshes. Worth watching."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," 40-50%"]}),"Congested. The firmware throttles GPS updates above 40%. Messages are colliding and retrying."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Over 50%"]}),"Serious problem. More time is spent retrying than communicating. Mesh reliability drops fast."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"black"})," Over 65%"]}),"Documented failure point on busy LONG_FAST meshes. The mesh becomes unusable."]]}),d.jsx(_e,{children:"Packet Flooding"}),d.jsx("p",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-yellow-200",children:d.jsx("strong",{children:'⚠️ "Packet flooding" means a node sending too many RADIO PACKETS. This has nothing to do with water flooding.'})}),d.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."}),d.jsx(Gt,{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."]]}),d.jsx(_e,{children:"Battery Levels"}),d.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:"}),d.jsx(Gt,{headers:["Voltage","Charge","What To Do"],rows:[["4.20V","100%","Full"],["3.80V","~60%","Fine"],[d.jsx("strong",{children:"3.60V"}),d.jsx("strong",{children:"~30%"}),d.jsx(d.Fragment,{children:d.jsx("strong",{children:"⚠️ Warning — charge it soon"})})],[d.jsx("strong",{children:"3.50V"}),d.jsx("strong",{children:"~15%"}),d.jsx(d.Fragment,{children:d.jsx("strong",{children:"🔴 Low — charge it now"})})],[d.jsx("strong",{children:"3.40V"}),d.jsx("strong",{children:"~7%"}),d.jsx(d.Fragment,{children:d.jsx("strong",{children:"⚫ About to die"})})],["3.30V","~3%","Device shutting down"]]}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Node Offline Detection"}),d.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:`}),d.jsx(Gt,{headers:["Node Type","Recommended Threshold","Why"],rows:[["Fixed infrastructure (wall power)",d.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."]]}),d.jsxs("p",{children:[d.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.`]})]}),d.jsxs(Ir,{id:"broadcast-types",title:"Broadcast Types",children:[d.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:"}),d.jsx(Gt,{headers:["Prefix","What it means","When you see it"],rows:[[d.jsx(fe,{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"],[d.jsx(fe,{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"],[d.jsx(fe,{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"]]}),d.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."})]}),d.jsxs(Ir,{id:"reminders",title:"Reminder System",children:[d.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"," ",d.jsx(fe,{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."]}),d.jsx(_e,{children:"Cadences"}),d.jsx(Gt,{headers:["Adapter","Reminder cadence","Termination"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(fe,{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"],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{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"],[d.jsx(fe,{children:"itd_511_work_zone"}),"Per-zone, configurable in the rule UI","WZDx publishes the zone with end_date in the past"]]}),d.jsx(_e,{children:"The tombstone"}),d.jsxs("p",{children:["When a WFIGS update declares an incident closed, the bot stamps"," ",d.jsx(fe,{children:"fires.tombstoned_at"})," with the close time. The reminder scheduler treats ",d.jsx(fe,{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.`]}),d.jsx(_e,{children:"Turning reminders off"}),d.jsxs("p",{children:["Per-adapter on/off lives in ",d.jsx(fe,{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."]})]}),d.jsxs(Ir,{id:"notifications",title:"Notifications",children:[d.jsx(_e,{children:"How It Works"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Something happens"})," — a fire is detected, weather warning issued, node goes offline, etc."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"MeshAI checks your rules"})," — does this event match any of your notification rules? Is it severe enough?"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"If a rule matches"})," — MeshAI sends the notification through whatever delivery method that rule is configured for."]})]}),d.jsx(_e,{children:"Building Rules"}),d.jsx("p",{children:"Each rule answers three questions:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"WHEN"})," does it trigger? (which categories, what severity)"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"WHERE"})," does it send? (mesh broadcast, email, webhook, etc.)"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"HOW OFTEN"})," at most? (cooldown period)"]})]}),d.jsx("p",{children:'Use "Add from Template" to start with a pre-built rule and customize it, or build from scratch with "Add Rule."'}),d.jsx(_e,{children:"Severity Levels — What Should I Set?"}),d.jsx(Gt,{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"],[d.jsxs(d.Fragment,{children:[d.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"]]}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Webhook — The Swiss Army Knife"}),d.jsx("p",{children:"A webhook sends your alert as an HTTP POST to any URL. This one delivery method works with:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Discord"})," — use a Discord webhook URL"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Slack"})," — use a Slack incoming webhook URL"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"ntfy.sh"})," — POST to ",d.jsx(fe,{children:"https://ntfy.sh/your-topic"})]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Pushover"})," — POST to the Pushover API"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Home Assistant"})," — POST to an automation webhook URL"]}),d.jsx("li",{children:"Anything else that accepts HTTP POST"})]}),d.jsx("p",{children:"MeshAI doesn't need to know what's on the other end. Give it the URL and it works."})]}),d.jsxs(Ir,{id:"commands",title:"Commands",children:[d.jsxs("p",{children:["All commands use the ",d.jsx(fe,{children:"!"})," prefix (configurable). Send these as a direct message to MeshAI on your mesh."]}),d.jsx(_e,{children:"Basic Commands"}),d.jsx(Gt,{headers:["Command","What It Does"],rows:[[d.jsx(fe,{children:"!help"}),"Shows all available commands"],[d.jsx(fe,{children:"!ping"}),"Tests if the bot is alive"],[d.jsx(fe,{children:"!status"}),"Quick mesh summary (nodes online, health score)"],[d.jsx(fe,{children:"!health"}),"Detailed health report with pillar scores"],[d.jsx(fe,{children:"!weather"}),"Current weather for your area"]]}),d.jsx(_e,{children:"Environmental Commands"}),d.jsx(Gt,{headers:["Command","What It Does"],rows:[[d.jsx(fe,{children:"!alerts"}),"Active NWS weather alerts for your area"],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"!solar"})," (or ",d.jsx(fe,{children:"!hf"}),")"]}),"Current solar indices and RF conditions"],[d.jsx(fe,{children:"!fire"}),"Active wildfires near your mesh"],[d.jsx(fe,{children:"!avy"}),'Avalanche advisory (seasonal — shows "off season" in summer)'],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"!streams"})," (or ",d.jsx(fe,{children:"!gauges"}),")"]}),"Stream gauge readings"],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"!roads"})," (or ",d.jsx(fe,{children:"!traffic"}),")"]}),"Road conditions and traffic flow"],[d.jsx(fe,{children:"!hotspots"}),"Satellite fire detections"]]}),d.jsx(_e,{children:"Conversational"}),d.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`," ",d.jsx("a",{href:"#llm-dm",className:"text-accent hover:underline",children:"LLM DM Queries"}),"."]})]}),d.jsxs(Ir,{id:"llm-dm",title:"LLM DM (Natural-Language Queries)",children:[d.jsxs("p",{children:["Bang commands like ",d.jsx(fe,{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."]}),d.jsx(_e,{children:"What it can answer"}),d.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:"}),d.jsx(Gt,{headers:["Adapter block","Example question that hits it","What you get back"],rows:[[d.jsx(fe,{children:"build_fires_detail"}),'"are there any fires near me?"',"Active WFIGS-declared fires, acreage, containment, declared_at, county/state"],[d.jsx(fe,{children:"build_alerts_detail"}),'"any weather alerts?"',"Active NWS CAP alerts: type, severity, area, expiry"],[d.jsx(fe,{children:"build_quakes_detail"}),'"any earthquakes nearby?"',"USGS quakes in the last 24h: magnitude, depth, place"],[d.jsx(fe,{children:"build_traffic_detail"}),'"how is traffic on I-84?" / "any road closures?"',"TomTom + ITD 511 active incidents"],[d.jsx(fe,{children:"build_gauges_detail"}),'"what is the snake river level?"',"USGS NWIS latest readings + flood stages"],[d.jsx(fe,{children:"build_swpc_detail"}),'"what are the band conditions?" / "any space weather?"',"Recent SWPC events + band-conditions ratings"],[d.jsx(fe,{children:"build_drop_audit"}),`"why didn't I hear about anything today?"`,"Event log: what envelopes the dispatcher filtered, by adapter + category"]]}),d.jsx(_e,{children:"The grounding rule"}),d.jsxs("p",{children:["The bot is told to answer ",d.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.']}),d.jsx(_e,{children:"Excluding an adapter from LLM context"}),d.jsxs("p",{children:["The ",d.jsx(fe,{children:"include_in_llm_context"})," toggle on each adapter's row in Adapter Config decides whether that adapter's ",d.jsx(fe,{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."]}),d.jsx(_e,{children:"What it can't answer"}),d.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.`})]}),d.jsxs(Ir,{id:"or-not-and",title:"OR-not-AND Architecture",children:[d.jsx("p",{children:"Every environmental adapter pulls its data from one of two places:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.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."]}),d.jsxs("li",{children:[d.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."]})]}),d.jsx(_e,{children:"Why mutually exclusive"}),d.jsxs("p",{children:["An adapter is set to ",d.jsx("strong",{children:"either"})," Central ",d.jsx("strong",{children:"or"})," ","native, never both. Running both at the same time is what the codebase calls the ",d.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."]}),d.jsx(_e,{children:"The per-adapter source toggle"}),d.jsxs("p",{children:["Set ",d.jsx(fe,{children:"feed_source"})," on each adapter's row in Environment:"]}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"central"})," — disable the native poll loop, subscribe to the matching Central subject pattern."]}),d.jsxs("li",{children:[d.jsx(fe,{children:"native"})," — disable the Central subscription for this adapter, run the native poller."]})]}),d.jsxs("p",{children:["On the GUI, adapters with ",d.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.`]}),d.jsx(_e,{children:"Where this surfaces in tooltips"}),d.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`," ",d.jsxs(fe,{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."]})]}),d.jsxs(Ir,{id:"adapter-config",title:"Adapter Config & the CODE Rule",children:[d.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."}),d.jsx(_e,{children:"The CONFIG-vs-CODE rule"}),d.jsx("p",{children:"Not everything tunable becomes a GUI row. The codebase splits along one rule:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.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)."]}),d.jsxs("li",{children:[d.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)."]})]}),d.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."}),d.jsx(_e,{children:"Restart-required vs live"}),d.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:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Anything under the ",d.jsx(fe,{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."]}),d.jsx("li",{children:"The LLM backend swap (Google → Anthropic → OpenAI)."}),d.jsx("li",{children:"The dispatcher cold-start grace window."})]}),d.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.`}),d.jsxs(_e,{children:["The ",d.jsx(fe,{children:"include_in_llm_context"})," toggle"]}),d.jsxs("p",{children:[`Each adapter's card on Adapter Config carries a per-adapter "LLM context" switch. When off, that adapter's `,d.jsx(fe,{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."]})]}),d.jsxs(Ir,{id:"curation",title:"Curation: Gauge Sites & Town Anchors",children:[d.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."}),d.jsx(_e,{children:"Gauge Sites"}),d.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."}),d.jsxs("p",{children:[d.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."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Disabled rows"})," are ignored at dispatch time. The corresponding gauge still ingests into ",d.jsx(fe,{children:"gauge_readings"})," ","(so historical queries still work), it just doesn't broadcast."]}),d.jsx(_e,{children:"Town Anchors"}),d.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:']}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsx("li",{children:'Photon nearest-town lookup (the WFIGS path uses this — produces "near Long Creek Summit Home" style anchors)'}),d.jsx("li",{children:"Town Anchors table (your curated list)"}),d.jsx("li",{children:"Landclass label (county / federal-land identifier)"}),d.jsx("li",{children:"County + state fallback"}),d.jsx("li",{children:"Bare lat/lon coords"})]}),d.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.'}),d.jsxs("p",{children:["Example broadcast text rendered from a Town Anchors row:"," ",d.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"'})]})]}),d.jsxs(Ir,{id:"schema",title:"Schema Migrations",children:[d.jsxs("p",{children:["MeshAI persists state in a single SQLite database (",d.jsx(fe,{children:"/data/meshai.sqlite"}),") with WAL journaling. Schema migrations live in ",d.jsx(fe,{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 ",d.jsx(fe,{children:"schema_meta.version"})," in order. Idempotent re-runs are no-ops."]}),d.jsx(_e,{children:"v0.6 + v0.7 additions"}),d.jsx(Gt,{headers:["Migration","What it added"],rows:[[d.jsx(fe,{children:"v11"}),"first_broadcast_at + last_broadcast_at split + reminder_enabled per adapter (the schema basis for New / Update / Active)"],[d.jsx(fe,{children:"v12"}),"fires.tombstoned_at (WFIGS closure stamp; terminates the reminder loop)"],[d.jsx(fe,{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"],[d.jsx(fe,{children:"v14"}),"Fire Tracker Phase 2 — fire_passes table (per-satellite-pass centroid + drift) + last_pass_id + halt_broadcast_at on fires"],[d.jsx(fe,{children:"v15"}),"Fire Tracker Phase 3 — fire_passes.perimeter_geojson (convex hull) + fires.last_spotting_broadcast_at"],[d.jsx(fe,{children:"v16"}),"Fire Tracker Phase 4 — fire_digest_broadcasts table (idempotent twice-daily LLM digest)"]]}),d.jsx(_e,{children:"When migrations fail"}),d.jsxs("p",{children:["A migration failure leaves the database at the prior version and raises in the runner. Container logs surface the SQL error;"," ",d.jsx(fe,{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."]})]}),d.jsxs(Ir,{id:"api",title:"API Reference",children:[d.jsxs("p",{children:["MeshAI's REST API is available at ",d.jsx(fe,{children:"http://your-host:8080"}),". All endpoints return JSON."]}),d.jsx(_e,{children:"System"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/status"})," — version, uptime, node count"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/channels"})," — radio channel list"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"POST /api/restart"})," — restart the bot"]})]}),d.jsx(_e,{children:"Mesh Data"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/health"})," — health score and pillars"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/nodes"})," — all nodes with positions and telemetry"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/edges"})," — neighbor links with signal quality"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/regions"})," — region summaries"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/sources"})," — data source health"]})]}),d.jsx(_e,{children:"Configuration"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/config"})," — full config"]}),d.jsxs("li",{children:[d.jsxs(fe,{children:["GET /api/config/","{section}"]})," — one section"]}),d.jsxs("li",{children:[d.jsxs(fe,{children:["PUT /api/config/","{section}"]})," — update a section"]})]}),d.jsx(_e,{children:"Environmental"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/status"})," — per-feed health"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/active"})," — all active events"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/swpc"})," — solar/geomagnetic data"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/ducting"})," — atmospheric profile"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/fires"})," — wildfire perimeters"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/hotspots"})," — satellite fire detections"]})]}),d.jsx(_e,{children:"Alerts"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/alerts/active"})," — current alerts"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/alerts/history"})," — past alerts"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/notifications/categories"})," — available alert categories"]})]}),d.jsx(_e,{children:"Real-time"}),d.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:d.jsxs("li",{children:[d.jsx(fe,{children:"ws://your-host:8080/ws/live"})," — WebSocket for live updates"]})})]})]})})]})}const eT={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 EZ(){const[e,t]=E.useState([]),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState(null),[l,u]=E.useState(eT),[c,h]=E.useState(!1),[f,v]=E.useState("unknown"),g=E.useCallback(async()=>{n(!0),i(null);try{const S=await fetch("/api/gauge-sites");if(!S.ok)throw new Error(`GET: ${S.status}`);t(await S.json())}catch(S){i(String(S))}finally{n(!1)}},[]);E.useEffect(()=>{g()},[g]),E.useEffect(()=>{fetch("/api/config/environmental").then(S=>S.json()).then(S=>{var C;return v(((C=S==null?void 0:S.usgs)==null?void 0:C.feed_source)||"unknown")}).catch(()=>v("unknown"))},[]);const m=S=>{s(S.site_id),u({...S}),h(!1)},y=()=>{h(!0),s(null),u({...eT})},x=()=>{s(null),h(!1),u(eT)},_=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}x(),g()}catch(S){alert(String(S))}},w=async S=>{if(!confirm(`Delete ${S}?`))return;const C=await fetch(`/api/gauge-sites/${S}`,{method:"DELETE"});if(!C.ok){alert(`delete failed: ${C.status}`);return}g()};return r?d.jsxs("div",{className:"p-6 text-slate-400",children:[d.jsx(nv,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):a?d.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",a]}):d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(c1,{className:"w-5 h-5 text-accent"}),d.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Gauge Sites"}),d.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," sites"]}),d.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:[d.jsx(si,{className:"w-4 h-4"})," Add site"]})]}),d.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&&d.jsx(KB,{draft:l,setDraft:u,onSave:_,onCancel:x,adding:!0,feedSource:f}),d.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm text-slate-200",children:[d.jsx("thead",{className:"bg-[#161616] border-b border-border",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Site ID"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat,Lon"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Action"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Minor"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Moderate"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Major"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:e.map(S=>o===S.site_id?d.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:d.jsx("td",{colSpan:9,className:"px-3 py-2",children:d.jsx(KB,{draft:l,setDraft:u,onSave:_,onCancel:x,feedSource:f})})},S.site_id):d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:S.site_id}),d.jsx("td",{className:"px-3 py-2",children:S.gauge_name}),d.jsxs("td",{className:"px-3 py-2 text-right text-xs",children:[S.lat.toFixed(3),",",S.lon.toFixed(3)]}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.action_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_minor_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_moderate_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_major_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-center",children:S.enabled?d.jsx(Yr,{className:"w-4 h-4 text-emerald-400 inline"}):d.jsx(_u,{className:"w-4 h-4 text-slate-500 inline"})}),d.jsxs("td",{className:"px-3 py-2 text-right",children:[d.jsx("button",{onClick:()=>m(S),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),d.jsx("button",{onClick:()=>w(S.site_id),className:"text-red-400 hover:text-red-300",children:d.jsx(li,{className:"w-4 h-4 inline"})})]})]},S.site_id))})]})})]})}function KB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:a,feedSource:i}){const o=(g,m)=>t({...e,[g]:m}),[s,l]=E.useState(!1),[u,c]=E.useState(null),h=i!=="native"||!e.site_id.trim(),f=i!=="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",v=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 _=await m.json().catch(()=>({}));c(_.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(),x={...e};y.name&&!x.gauge_name&&(x.gauge_name=y.name),typeof y.lat=="number"&&(x.lat=y.lat),typeof y.lon=="number"&&(x.lon=y.lon),typeof y.action_ft=="number"&&(x.action_ft=y.action_ft),typeof y.flood_minor_ft=="number"&&(x.flood_minor_ft=y.flood_minor_ft),typeof y.flood_moderate_ft=="number"&&(x.flood_moderate_ft=y.flood_moderate_ft),typeof y.flood_major_ft=="number"&&(x.flood_major_ft=y.flood_major_ft),t(x)}catch(g){c(String(g))}finally{l(!1)}}};return d.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[d.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Site ID",d.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[d.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:!a}),d.jsxs("button",{type:"button",onClick:v,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?d.jsx(nv,{className:"w-3 h-3 animate-spin"}):d.jsx(v1,{className:"w-3 h-3"}),"USGS lookup"]})]}),u&&d.jsx("span",{className:"text-amber-400 text-xs mt-1 block",children:u})]}),d.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Gauge name",d.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)})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Action ft",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Minor flood ft",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Moderate flood ft",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Major flood ft",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-300 col-span-2 flex items-center gap-2 mt-2",children:[d.jsx("input",{type:"checkbox",checked:e.enabled,onChange:g=>o("enabled",g.target.checked),className:"accent-[#f59e0b]"}),"Enabled"]}),d.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[d.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),d.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 tT={anchor_id:0,name:"",lat:0,lon:0,state:"ID",enabled:!0,updated_at:0};function RZ(){const[e,t]=E.useState([]),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState(null),[l,u]=E.useState(!1),[c,h]=E.useState(tT),f=E.useCallback(async()=>{n(!0),i(null);try{const _=await fetch("/api/town-anchors");if(!_.ok)throw new Error(`GET: ${_.status}`);t(await _.json())}catch(_){i(String(_))}finally{n(!1)}},[]);E.useEffect(()=>{f()},[f]);const v=_=>{s(_.anchor_id),h({..._}),u(!1)},g=()=>{u(!0),s(null),h({...tT})},m=()=>{s(null),u(!1),h(tT)},y=async()=>{const _=l?"/api/town-anchors":`/api/town-anchors/${o}`,S=await fetch(_,{method:l?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const C=await S.json().catch(()=>({}));alert(`save failed: ${C.detail||S.statusText}`);return}m(),f()},x=async _=>{if(!confirm(`Delete anchor ${_}?`))return;const w=await fetch(`/api/town-anchors/${_}`,{method:"DELETE"});if(!w.ok){alert(`delete failed: ${w.status}`);return}f()};return r?d.jsxs("div",{className:"p-6 text-slate-400",children:[d.jsx(nv,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):a?d.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",a]}):d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(av,{className:"w-5 h-5 text-accent"}),d.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Town Anchors"}),d.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," towns"]}),d.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:[d.jsx(si,{className:"w-4 h-4"})," Add town"]})]}),d.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&&d.jsx(JB,{draft:c,setDraft:h,onSave:y,onCancel:m,adding:!0}),d.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm text-slate-200",children:[d.jsx("thead",{className:"bg-[#161616] border-b border-border",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lon"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"State"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:e.map(_=>o===_.anchor_id?d.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:d.jsx("td",{colSpan:6,className:"px-3 py-2",children:d.jsx(JB,{draft:c,setDraft:h,onSave:y,onCancel:m})})},_.anchor_id):d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-3 py-2 capitalize",children:_.name}),d.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lat.toFixed(4)}),d.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lon.toFixed(4)}),d.jsx("td",{className:"px-3 py-2 text-center text-xs",children:_.state||"-"}),d.jsx("td",{className:"px-3 py-2 text-center",children:_.enabled?d.jsx(Yr,{className:"w-4 h-4 text-emerald-400 inline"}):d.jsx(_u,{className:"w-4 h-4 text-slate-500 inline"})}),d.jsxs("td",{className:"px-3 py-2 text-right",children:[d.jsx("button",{onClick:()=>v(_),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),d.jsx("button",{onClick:()=>x(_.anchor_id),className:"text-red-400 hover:text-red-300",children:d.jsx(li,{className:"w-4 h-4 inline"})})]})]},_.anchor_id))})]})})]})}function JB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:a}){const i=(o,s)=>t({...e,[o]:s});return d.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[d.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Name (lowercased on save)",d.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=>i("name",o.target.value),disabled:!a})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["State",d.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=>i("state",o.target.value)})]}),d.jsxs("label",{className:"text-xs text-slate-400 flex items-center gap-2",children:[d.jsx("input",{type:"checkbox",checked:e.enabled,onChange:o=>i("enabled",o.target.checked),className:"accent-[#f59e0b] mt-4"}),"Enabled"]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",d.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=>i("lat",parseFloat(o.target.value))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",d.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=>i("lon",parseFloat(o.target.value))})]}),d.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[d.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),d.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 l2e(e,t,r){const n=e?{...e}:{...t,name:r};n.name=n.name||r;const a=(e==null?void 0:e.severity_channels)||{},i=t.severity_channels||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};return o.forEach(l=>{const u=(a[l]||[]).filter(h=>!h.startsWith("meshcore_")),c=(i[l]||[]).filter(h=>h.startsWith("meshcore_"));s[l]=[...u,...c]}),n.severity_channels=s,n.meshcore_channel=t.meshcore_channel??null,n.meshcore_dm_contacts=t.meshcore_dm_contacts||[],n}function u2e(e,t){const r=(t==null?void 0:t.mc_enabled)??!1,n=(e==null?void 0:e.mt_enabled)??(e==null?void 0:e.enabled)??!1,a=(e==null?void 0:e.cells)||{},i=(t==null?void 0:t.cells)||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};for(const l of o){const u=a[l]||{},c=i[l]||{},h=new Set([...Object.keys(u),...Object.keys(c)]),f={};for(const v of h){const g=u[v],m=c[v],y=m!==void 0?m.mc||null:(g==null?void 0:g.mc)??null,x={mt:(g==null?void 0:g.mt)??null,mc:y,min_severity:(m==null?void 0:m.min_severity)??(g==null?void 0:g.min_severity)??"routine",enabled:(m==null?void 0:m.enabled)??(g==null?void 0:g.enabled)??!0},_=x.mc;(x.mt!==null||_!==null&&_.trim()!=="")&&(f[v]=x)}Object.keys(f).length>0&&(s[l]=f)}return{mt_enabled:n,mc_enabled:r,cells:s}}function c2e(){var ye;const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState([]),[s,l]=E.useState(!0),[u,c]=E.useState(!1),[h,f]=E.useState(null),[v,g]=E.useState(null),[m,y]=E.useState(!1),[x,_]=E.useState([]),[w,S]=E.useState(!1),[C,M]=E.useState(null),[A,I]=E.useState(""),[k,P]=E.useState(null),[D,z]=E.useState({}),[j,B]=E.useState({}),H=(ne,xe)=>`${ne}|${xe}`,V=E.useCallback(async()=>{try{const[ne,xe]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/regions")]);if(!ne.ok)throw new Error("Failed to fetch notifications config");const he=await ne.json(),ge=xe.ok?await xe.json():[];r(he),a(JSON.parse(JSON.stringify(he))),o(Array.isArray(ge)?ge:[]),y(!1),f(null)}catch(ne){f(ne instanceof Error?ne.message:"Unknown error")}finally{l(!1)}},[]);E.useEffect(()=>{document.title="MeshCore Routing - MeshAI",V()},[V]);const U=E.useCallback(async()=>{try{const ne=await HJ();_(ne.active?ne.rooms:[]),S(ne.active)}catch{_([]),S(!1)}},[]);E.useEffect(()=>{U()},[U]),E.useEffect(()=>{t&&n&&y(JSON.stringify(t)!==JSON.stringify(n))},[t,n]),E.useEffect(()=>(e(m),()=>e(!1)),[m,e]);const F=(ne,xe)=>{if(!t)return;const he=t.toggles||{};r({...t,toggles:{...he,[ne]:{...he[ne]||{},name:ne,...xe}}})},W="room:",$=ne=>typeof ne=="string"&&ne.startsWith(W),Z=ne=>ne.slice(W.length),J=ne=>x.find(xe=>xe.pubkey===ne),re=(ne,xe,he)=>{var Ue,qe,Fe,_t,bt,et,Ke,St,ce;if(!t)return;const ge=((Fe=(qe=(Ue=t.region_routes)==null?void 0:Ue.cells)==null?void 0:qe[ne])==null?void 0:Fe[xe])??{mt:null,mc:null,min_severity:"routine",enabled:!0},tt={...((_t=t.region_routes)==null?void 0:_t.cells)||{},[ne]:{...((et=(bt=t.region_routes)==null?void 0:bt.cells)==null?void 0:et[ne])||{},[xe]:{...ge,mc:he}}};r({...t,region_routes:{mt_enabled:((Ke=t.region_routes)==null?void 0:Ke.mt_enabled)??((St=t.region_routes)==null?void 0:St.enabled)??!1,mc_enabled:((ce=t.region_routes)==null?void 0:ce.mc_enabled)??!1,cells:tt}})},Q=ne=>{var tt,Ue,qe,Fe,_t,bt;if(!t)return;const xe=((Ue=(tt=t.region_routes)==null?void 0:tt.cells)==null?void 0:Ue[ne])||{},he={};for(const[et,Ke]of Object.entries(xe))he[et]={...Ke,mc:null};const ge={...((qe=t.region_routes)==null?void 0:qe.cells)||{},[ne]:he};r({...t,region_routes:{mt_enabled:((Fe=t.region_routes)==null?void 0:Fe.mt_enabled)??((_t=t.region_routes)==null?void 0:_t.enabled)??!1,mc_enabled:((bt=t.region_routes)==null?void 0:bt.mc_enabled)??!1,cells:ge}})},le=async()=>{if(t){c(!0),f(null),g(null);try{const ne=await fetch("/api/config/notifications");if(!ne.ok)throw new Error("Failed to re-fetch notifications config");const xe=await ne.json(),he={...xe,toggles:{...xe.toggles||{}},region_routes:u2e(xe.region_routes,t.region_routes)},ge=t.toggles||{};for(const{key:qe}of fu){const Fe=ge[qe];Fe&&(he.toggles[qe]=l2e((xe.toggles||{})[qe],Fe,qe))}const tt=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(he)}),Ue=await tt.json();if(!tt.ok)throw new Error(Ue.detail||"Save failed");r(he),a(JSON.parse(JSON.stringify(he))),y(!1),e(!1),g("MeshCore routing saved successfully"),setTimeout(()=>g(null),3e3)}catch(ne){f(ne instanceof Error?ne.message:"Save failed")}finally{c(!1)}}},de=()=>{n&&(r(JSON.parse(JSON.stringify(n))),y(!1))};if(s)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading MeshCore routing..."})});if(!t)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})});const He=t.toggles||{};return d.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"Per-family MeshCore delivery. Choose which channels fire at each severity, the MeshCore channel name, and DM contacts."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:V,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:de,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:le,disabled:u||!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:[d.jsx(_a,{size:16}),u?"Saving...":"Save"]})]})]}),d.jsxs("div",{className:"flex items-start gap-2 p-3 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-400",children:[d.jsx(Jc,{size:16,className:"text-accent mt-0.5 flex-shrink-0"}),d.jsxs("div",{children:["Family gating (enable, severity threshold, freshness/cooldown) is on"," ",d.jsx(uf,{to:"/environment",className:"text-accent hover:underline",children:"Data Feeds"}),". Meshtastic delivery is on"," ",d.jsx(uf,{to:"/meshtastic/routing",className:"text-accent hover:underline",children:"Meshtastic Routing"}),". This page edits only the MeshCore delivery for each family."]})]}),h&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:h}),v&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),v]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["MeshCore Delivery",d.jsx(Yo,{info:"For each notification family, choose which MeshCore channels fire at each severity, the MeshCore channel name to broadcast on, and the DM contacts to unicast to. Enabling a family and its severity threshold are configured on the Data Feeds page."})]}),d.jsx("div",{className:"border border-[#1e2a3a] p-3",children:d.jsx(Ch,{label:"Enable MeshCore region routing",checked:((ye=t.region_routes)==null?void 0:ye.mc_enabled)??!1,onChange:ne=>{var xe,he,ge;return r({...t,region_routes:{mt_enabled:((xe=t.region_routes)==null?void 0:xe.mt_enabled)??((he=t.region_routes)==null?void 0:he.enabled)??!1,mc_enabled:ne,cells:((ge=t.region_routes)==null?void 0:ge.cells)||{}}})},helper:"Master switch for per-region MeshCore channel routing. When off, families deliver only to their default MeshCore channels."})}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:fu.map(({key:ne,label:xe,Icon:he})=>{var _t,bt;const ge=He[ne]||{},tt=((bt=(_t=t.region_routes)==null?void 0:_t.cells)==null?void 0:bt[ne])||{},Ue=i.some(et=>{var St;const Ke=(St=tt[et])==null?void 0:St.mc;return Ke!=null&&Ke.trim()!==""}),qe=D[ne],Fe=qe!==void 0?qe:Ue;return d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-200",children:[d.jsx(he,{size:15})," ",xe]}),d.jsxs("div",{className:"space-y-3 p-3 bg-[#0a0e17] border border-[#1e2a3a]",children:[d.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-300",children:[d.jsx(wk,{size:13}),"MeshCore"]}),d.jsx(LZ,{channels:DCe,severityChannels:ge.severity_channels||{},onChange:et=>F(ne,{severity_channels:et})}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"MeshCore channel name"}),d.jsx("input",{type:"text",value:ge.meshcore_channel!=null?ge.meshcore_channel:"",onChange:et=>F(ne,{meshcore_channel:et.target.value===""?null:et.target.value}),placeholder:"AIDA",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"}),d.jsx("p",{className:"text-xs text-slate-600",children:"Channel name on your MeshCore companion (e.g. AIDA). Blank = not broadcast on MeshCore."})]}),d.jsx(kZ,{label:"MeshCore DM contacts",value:ge.meshcore_dm_contacts||[],onChange:et=>F(ne,{meshcore_dm_contacts:et}),placeholder:"contact name or pubkey",helper:"MeshCore DM recipients (names or pubkeys)",info:"Contact names or pubkeys on the MeshCore companion. Used when meshcore_dm is enabled for a severity."})]}),d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[d.jsx(Ch,{label:"Region-based routing",checked:Fe,onChange:et=>{z(Ke=>({...Ke,[ne]:et})),et||Q(ne)},helper:"Route this family to different MC channels per region"}),Fe&&(i.length===0?d.jsxs("p",{className:"text-xs text-slate-500 italic",children:["No regions yet — add them on the"," ",d.jsx(uf,{to:"/coverage",className:"text-accent hover:underline",children:"Coverage"})," page."]}):d.jsx("div",{className:"space-y-1.5 pt-1",children:i.map(et=>{const St=(tt[et]??{mc:null}).mc??"",ce=H(ne,et),Bt=(j[ce]??($(St)?"room":"channel"))==="room",Ft=$(St)?J(Z(St)):void 0;return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-xs text-slate-400 flex-1 min-w-0 truncate",children:et}),d.jsxs("div",{className:"flex border border-[#1e2a3a] rounded overflow-hidden",children:[d.jsx("button",{type:"button",title:"Target a channel",onClick:()=>{B(jt=>({...jt,[ce]:"channel"})),$(St)&&re(ne,et,null)},className:`px-1.5 py-1 flex items-center ${Bt?"text-slate-500 hover:text-slate-300":"bg-accent text-white"}`,children:d.jsx(bJ,{size:12})}),d.jsx("button",{type:"button",title:w?"Target a room server":"MeshCore not connected",disabled:!w&&!$(St),onClick:()=>{B(jt=>({...jt,[ce]:"room"})),$(St)||re(ne,et,null)},className:`px-1.5 py-1 flex items-center ${Bt?"bg-accent text-white":"text-slate-500 hover:text-slate-300"} disabled:opacity-40 disabled:cursor-not-allowed`,children:d.jsx(SJ,{size:12})})]}),Bt?d.jsxs(d.Fragment,{children:[w||Ft?d.jsxs("div",{className:"flex items-center gap-1 w-40",children:[d.jsxs("select",{value:Ft?Ft.pubkey:"",onChange:jt=>{const Lr=jt.target.value;re(ne,et,Lr===""?null:W+Lr)},className:"flex-1 min-w-0 px-1.5 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 focus:outline-none focus:border-accent",children:[d.jsx("option",{value:"",children:"room…"}),!Ft&&$(St)&&d.jsxs("option",{value:Z(St),children:[Z(St).slice(0,10),"…"]}),x.map(jt=>d.jsx("option",{value:jt.pubkey,children:jt.name||jt.pubkey.slice(0,10)+"…"},jt.pubkey))]}),Ft&&d.jsx("span",{title:Ft.path_established?"Path established":"No path yet — first send discovers it",className:`text-[10px] ${Ft.path_established?"text-green-500":"text-slate-600"}`,children:"●"})]}):d.jsx("span",{className:"w-40 text-xs text-slate-600 italic truncate",children:"MeshCore not connected"}),Z(St)&&(()=>{var tl;const jt=Z(St),Lr=((tl=x.find(Ki=>Ki.pubkey===jt))==null?void 0:tl.password_set)??!1,Qo=C===jt;return d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("button",{type:"button",title:Lr?"Room password: set":"Room password: not set","aria-label":Lr?"Room password: set":"Room password: not set",onClick:()=>{P(null),Qo?M(null):(M(jt),I(""))},className:`px-1 py-1 text-xs ${Lr?"text-accent":"text-slate-600 hover:text-slate-400"}`,children:Lr?"🔒":"🔓"}),Qo&&d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("input",{type:"password",value:A,onChange:Ki=>I(Ki.target.value),placeholder:"room password",className:"w-28 px-1.5 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 focus:outline-none focus:border-accent"}),d.jsx("button",{type:"button",title:"Save room password",onClick:async()=>{try{P(null),await UJ(jt,A),await U(),M(null),I("")}catch{P("save failed")}},className:"px-1.5 py-1 bg-accent hover:bg-accent/80 rounded text-xs text-white",children:"Save"}),d.jsx("button",{type:"button",title:"Clear room password",onClick:async()=>{try{P(null),await WJ(jt),await U(),M(null),I("")}catch{P("clear failed")}},className:"px-1.5 py-1 border border-[#1e2a3a] rounded text-xs text-slate-400 hover:text-slate-200",children:"Clear"}),d.jsx("button",{type:"button",title:"Cancel",onClick:()=>{M(null),P(null)},className:"px-1.5 py-1 border border-[#1e2a3a] rounded text-xs text-slate-500 hover:text-slate-300",children:"Cancel"}),k&&d.jsx("span",{className:"text-[10px] text-red-400",children:k})]})]})})()]}):d.jsx("input",{type:"text",value:St,onChange:jt=>{const Lr=jt.target.value;re(ne,et,Lr===""?null:Lr)},placeholder:"channel",className:"w-40 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono focus:outline-none focus:border-accent"})]},et)})}))]})]},ne)})})]})]})}function h2e(){const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(null),[u,c]=E.useState(!0),[h,f]=E.useState(!1),[v,g]=E.useState(null),[m,y]=E.useState(null),[x,_]=E.useState(!1),[w,S]=E.useState(!1),[C,M]=E.useState([]),[A,I]=E.useState({}),[k,P]=E.useState(new Set),[D,z]=E.useState(null),[j,B]=E.useState(""),[H,V]=E.useState(""),[U,F]=E.useState(!1),[W,$]=E.useState(null),[Z,J]=E.useState(""),[re,Q]=E.useState(""),[le,de]=E.useState(!1),[He,ye]=E.useState(null),[ne,xe]=E.useState(null),he=E.useCallback(async()=>{c(!0);try{const[ce,st]=await Promise.all([Ao("connection"),Ao("meshcore_context")]);r(ce),a(JSON.parse(JSON.stringify(ce))),o(st),l(JSON.parse(JSON.stringify(st))),_(!1),g(null)}catch(ce){g(ce instanceof Error?ce.message:"Unknown error")}finally{c(!1)}},[]);E.useEffect(()=>{document.title="MeshCore Connection - MeshAI",he()},[he]);const ge=E.useCallback(async()=>{try{const ce=await ZV(),st=ce.channels.map(Ft=>Ft.name),Bt={};for(const Ft of ce.channels)Bt[Ft.name]=Ft.key;S(ce.active),M(st),I(Bt),B(Ft=>Ft&&st.includes(Ft)?Ft:st[0]??"")}catch{try{const ce=await FJ();S(ce.active),M(ce.channels),I({}),B(st=>st&&ce.channels.includes(st)?st:ce.channels[0]??"")}catch{S(!1)}}},[]);E.useEffect(()=>{ge()},[ge]);const tt=ce=>{P(st=>{const Bt=new Set(st);return Bt.has(ce)?Bt.delete(ce):Bt.add(ce),Bt})},Ue=async(ce,st)=>{try{await navigator.clipboard.writeText(st),z(ce),setTimeout(()=>z(Bt=>Bt===ce?null:Bt),1500)}catch{P(Bt=>new Set(Bt).add(ce))}},qe=async()=>{const ce=Z.trim();if(ce){de(!0),xe(null);try{await VJ(ce,re.trim()),J(""),Q(""),await ge()}catch(st){xe(st instanceof Error?st.message:"Failed to add channel")}finally{de(!1)}}},Fe=async ce=>{ye(ce),xe(null);try{await GJ(ce),o(st=>!st||!(st.observe_channels??[]).includes(ce)?st:{...st,observe_channels:(st.observe_channels??[]).filter(Bt=>Bt!==ce)}),await ge()}catch(st){xe(st instanceof Error?st.message:"Failed to remove channel")}finally{ye(null)}},_t=async()=>{F(!0),$(null);try{const ce=await YV({transport:"meshcore",channel:j,text:H.trim()||void 0});$(ce)}catch(ce){$({sent:!1,detail:ce instanceof Error?ce.message:"Send failed"})}finally{F(!1)}};E.useEffect(()=>{if(t&&n&&i&&s){const ce=JSON.stringify(t)!==JSON.stringify(n)||JSON.stringify(i)!==JSON.stringify(s);_(ce)}},[t,n,i,s]),E.useEffect(()=>(e(x),()=>e(!1)),[x,e]);const bt=ce=>r(st=>st&&{...st,...ce}),et=async()=>{if(!(!t||!i)){f(!0),g(null),y(null);try{const ce=await Promise.all([Da("connection",t),Da("meshcore_context",i)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),_(!1),e(!1),y("MeshCore connection saved successfully"),ce.some(st=>st.restart_required)&&bu([]),setTimeout(()=>y(null),3e3)}catch(ce){g(ce instanceof Error?ce.message:"Save failed")}finally{f(!1)}}},Ke=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),_(!1)},St=ce=>{o(st=>{if(!st)return st;const Bt=st.observe_channels??[],Ft=Bt.includes(ce)?Bt.filter(jt=>jt!==ce):[...Bt,ce];return{...st,observe_channels:Ft}})};return u?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading MeshCore connection..."})}):t?d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"MeshCore node connection."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:he,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:Ke,disabled:!x,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:et,disabled:h||!x,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:[d.jsx(_a,{size:16}),h?"Saving...":"Save"]})]})]}),v&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:v}),m&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),m]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"MeshCore Connection"}),d.jsx("p",{className:"text-xs text-slate-500",children:"Choose how MeshAI reaches your MeshCore node. TCP talks to a companion frame server; Serial connects to a USB-attached node; BLE pairs over Bluetooth. Meshtastic is always active."}),d.jsx(Dn,{label:"Connection Type",value:t.meshcore_conn_type??"tcp",onChange:ce=>bt({meshcore_conn_type:ce}),options:[{value:"tcp",label:"TCP (companion)"},{value:"serial",label:"Serial (USB)"},{value:"ble",label:"BLE"}],helper:"TCP for a companion frame server, Serial for a USB node, BLE for Bluetooth"}),(t.meshcore_conn_type??"tcp")==="tcp"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(yt,{label:"MeshCore Host",value:t.meshcore_host??"",onChange:ce=>bt({meshcore_host:ce}),placeholder:"192.168.1.100",helper:"IP or hostname of the companion frame server",info:"The MeshCore companion (frame server) host. Active when non-empty in TCP mode."}),d.jsx(Ae,{label:"MeshCore Port",value:t.meshcore_port??5525,onChange:ce=>bt({meshcore_port:ce}),min:1,max:65535,helper:"MeshCore TCP port (default 5525)"})]}),(t.meshcore_conn_type??"tcp")==="serial"&&d.jsxs(d.Fragment,{children:[d.jsx(AZ,{label:"MeshCore Serial Port",value:t.meshcore_serial_port??"",onChange:ce=>bt({meshcore_serial_port:ce}),helper:"USB-attached MeshCore node — Detect fills a stable by-id path"}),d.jsx(Ae,{label:"Baud Rate",value:t.meshcore_baud??115200,onChange:ce=>bt({meshcore_baud:ce}),min:1200,helper:"Serial baud rate (default 115200)"})]}),(t.meshcore_conn_type??"tcp")==="ble"&&d.jsx(yt,{label:"BLE Address",value:t.meshcore_ble_address??"",onChange:ce=>bt({meshcore_ble_address:ce}),placeholder:"AA:BB:CC:DD:EE:FF",helper:"Leave blank to scan/pair the first available device"}),d.jsx("div",{className:"pt-2",children:d.jsx(uf,{to:"/meshtastic/connection",className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-accent transition-colors",children:"→ Meshtastic connection"})}),d.jsx(qt,{label:"Auto-add contacts (AIDA adds any node it hears — required to DM anyone)",checked:t.meshcore_auto_add_contacts??!0,onChange:ce=>bt({meshcore_auto_add_contacts:ce}),helper:"Enables firmware CMD 58 (set_autoadd_config) at connect so AIDA automatically adds every node it hears an advert from as a contact, enabling DM send/decrypt without manual contact exchange"}),d.jsxs("details",{className:"group",children:[d.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[d.jsx(Ah,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced — MeshCore Reconnect"]}),d.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[d.jsx(qt,{label:"Auto-reconnect (MeshCore)",checked:t.meshcore_auto_reconnect??!0,onChange:ce=>bt({meshcore_auto_reconnect:ce}),helper:"Automatically reconnect to the MeshCore companion if the link drops"}),d.jsx(Ae,{label:"Max Reconnect Attempts",value:t.meshcore_max_reconnect_attempts??5,onChange:ce=>bt({meshcore_max_reconnect_attempts:ce}),min:0,helper:"Maximum reconnect attempts before giving up (0 = unlimited)"})]})]})]}),i&&d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Bot behavior"}),d.jsx(qt,{label:"Enable Passive Context",checked:!!i.enable_passive_context,onChange:ce=>o({...i,enable_passive_context:ce}),helper:"Listen to MeshCore channel traffic for context",info:"When enabled, the bot monitors MeshCore channels and includes recent messages in its context so it can reference what others said."}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Observe MeshCore Channels"}),d.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[C.map(ce=>{const st=(i.observe_channels??[]).includes(ce),Bt=A[ce]??null,Ft=k.has(ce);return d.jsxs("div",{className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17]",children:[d.jsxs("label",{onClick:()=>St(ce),className:"flex items-center gap-2 cursor-pointer shrink-0",children:[d.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${st?"bg-accent border-accent":"border-slate-600"}`,children:st&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsx("span",{className:"text-sm text-slate-200",children:ce})]}),d.jsx("div",{className:"flex items-center gap-1 flex-1 min-w-0 justify-end",children:Bt?d.jsxs(d.Fragment,{children:[d.jsx("code",{title:Ft?Bt:"Key hidden — click the eye to reveal",className:"text-xs font-mono text-slate-400 truncate max-w-[16rem]",children:Ft?Bt:"••••••••••••••••"}),d.jsx("button",{type:"button",title:Ft?"Hide key":"Reveal key","aria-label":Ft?`Hide key for ${ce}`:`Reveal key for ${ce}`,onClick:()=>tt(ce),className:"p-1 text-slate-600 hover:text-slate-300",children:Ft?d.jsx(h1,{size:14}):d.jsx(rv,{size:14})}),d.jsx("button",{type:"button",title:"Copy key to clipboard","aria-label":`Copy key for ${ce}`,onClick:()=>Ue(ce,Bt),className:"p-1 text-slate-600 hover:text-accent",children:D===ce?d.jsx(Yr,{size:14,className:"text-green-400"}):d.jsx(PV,{size:14})})]}):d.jsx("span",{className:"text-xs font-mono text-slate-600",title:"No retrievable key for this channel",children:"—"})}),d.jsx("button",{type:"button",title:`Remove channel '${ce}' from the companion`,"aria-label":`Remove channel ${ce}`,disabled:He===ce,onClick:()=>Fe(ce),className:"p-1 text-slate-600 hover:text-red-400 disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:d.jsx(li,{size:14})})]},ce)}),C.length===0&&d.jsxs("div",{className:"text-sm text-slate-500 p-2",children:["No channels available",w?"":" (MeshCore not connected)"]})]}),d.jsx("p",{className:"text-xs text-slate-600",children:"Choose which MeshCore channels feed MeshAI's context. Empty = none are watched — pick channels to include their chatter in what the bot knows about the mesh. Leave busy/public channels out to keep them out of context. Each channel's key (PSK) is shown on the right — reveal and copy it to share with people who want to join."}),d.jsxs("div",{className:"flex items-end gap-2 pt-2",children:[d.jsxs("div",{className:"flex-1 space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Name"}),d.jsx("input",{type:"text",value:Z,onChange:ce=>J(ce.target.value),placeholder:"#channel-name",disabled:!w,className:"w-full px-2 py-1.5 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent disabled:opacity-50"})]}),d.jsxs("div",{className:"flex-1 space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Key"}),d.jsx("input",{type:"text",value:re,onChange:ce=>Q(ce.target.value),placeholder:"PSK hex (32 chars) — leave blank for public #channel",disabled:!w,className:"w-full px-2 py-1.5 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent disabled:opacity-50"})]}),d.jsx("button",{type:"button",onClick:qe,disabled:!w||le||!Z.trim(),className:"px-3 py-1.5 bg-accent hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed rounded text-sm text-white whitespace-nowrap",children:le?"Saving…":"Save"})]}),ne&&d.jsx("p",{className:"text-xs text-red-400",children:ne})]}),d.jsx(la,{label:"Ignore MeshCore Contacts",value:i.ignore_contacts??[],onChange:ce=>o({...i,ignore_contacts:ce}),helper:"Contact names or pubkey prefixes to exclude from context (comma-separated)",info:"Messages from these MeshCore contacts won't be included in passive context. Enter contact names or public-key prefixes."}),d.jsx(qt,{label:"Answer direct messages",checked:!!i.respond_to_dms,onChange:ce=>o({...i,respond_to_dms:ce}),helper:"When on, MeshAI replies to MeshCore direct messages using the LLM. Applies to MeshCore only."})]}),d.jsxs("div",{className:`bg-bg-card border border-border p-6 space-y-4${w?"":" opacity-60"}`,children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Send Test Message"}),w?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Channel"}),d.jsx("select",{value:j,onChange:ce=>B(ce.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:C.map(ce=>d.jsx("option",{value:ce,children:ce},ce))})]}),d.jsx(yt,{label:"Message (optional)",value:H,onChange:V,placeholder:`🧪 MeshAI test — ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}),d.jsx("button",{onClick:_t,disabled:U,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 text-sm transition-colors",children:U?"Sending...":"Send test"}),W&&(W.sent?d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),W.detail]}):d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:W.detail}))]}):d.jsx("p",{className:"text-sm text-slate-500",children:"MeshCore not connected"})]})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load connection config"})})}const d2e={serial:"bg-emerald-500/15 text-emerald-400",tcp:"bg-sky-500/15 text-sky-400",ble:"bg-violet-500/15 text-violet-400"};function f2e(e){return e?e.target?e.target:e.conn_type==="serial"?e.serial_port?`${e.serial_port}@${e.baud??115200}`:"serial":e.conn_type==="ble"?e.ble_address||"ble":e.host?`${e.host}${e.port!=null?`:${e.port}`:""}`:"—":"—"}function v2e(e){const t=Math.floor(Date.now()/1e3-e);if(t<5)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function OZ(){const[e,t]=E.useState(null),[r,n]=E.useState(null),[a,i]=E.useState(!0),[o,s]=E.useState(null),[l,u]=E.useState(null),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(3),[y,x]=E.useState(!1),[_,w]=E.useState(!1);E.useEffect(()=>{document.title="Companion & Channels - MeshAI"},[]),E.useEffect(()=>{let k=!1;return(async()=>{i(!0),s(null);try{const[P,D]=await Promise.all([Hj(),ZV()]);if(k)return;t(P),n(D)}catch(P){if(k)return;s(P instanceof Error?P.message:"Failed to load companion status")}finally{k||i(!1)}})(),()=>{k=!0}},[]),E.useEffect(()=>{(async()=>{try{const k=await fetch("/api/config/connection");if(k.ok){const D=(await k.json()).meshcore_advert_interval_seconds;typeof D=="number"&&m(D>0?D/3600:0)}}catch{}})()},[]);const S=E.useCallback(async()=>{h(!0),v(null);try{const k=await qJ();if(v(k),k.sent)try{const P=await Hj();t(P)}catch{}}catch(k){v({sent:!1,detail:k instanceof Error?k.message:"Request failed"})}finally{h(!1)}},[]),C=E.useCallback(async()=>{x(!0),w(!1);try{const k=Math.round(g*3600);await Da("connection",{meshcore_advert_interval_seconds:k}),w(!0),setTimeout(()=>w(!1),2e3)}catch{}finally{x(!1)}},[g]),M=E.useCallback(async k=>{try{await navigator.clipboard.writeText(k),u(k),setTimeout(()=>u(P=>P===k?null:P),1500)}catch{}},[]),A=(e==null?void 0:e.connected)===!0,I=r!=null&&r.active?r.channels:[];return d.jsxs("div",{className:"max-w-3xl mx-auto space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:d.jsx(_k,{size:24,className:"text-accent"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"Companion & Channels"}),d.jsx("p",{className:"text-sm text-[#777]",children:"Live status for the AIDA MeshCore companion and its joined channels."})]})]}),a?d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-slate-400",children:"Loading..."})}):o?d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:o}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"bg-bg-card border border-border p-6",children:A?d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-green-500"}),d.jsx("span",{className:"text-sm font-medium text-green-400",children:"Connected"})]}),d.jsxs("dl",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-4 text-sm",children:[d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Node name"}),d.jsx("dd",{className:"text-slate-100",children:(e==null?void 0:e.name)??"unnamed"})]}),d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Connection"}),d.jsxs("dd",{className:"flex items-center gap-2",children:[d.jsx("span",{className:`px-1.5 py-0.5 text-[10px] uppercase tracking-wide rounded ${d2e[(e==null?void 0:e.conn_type)??""]??"bg-slate-600/30 text-slate-400"}`,children:(e==null?void 0:e.conn_type)??"unknown"}),d.jsx("span",{className:"text-slate-100 font-mono text-xs break-all",children:f2e(e)})]})]}),d.jsxs("div",{className:"sm:col-span-2",children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Public key"}),d.jsx("dd",{className:"text-slate-100 font-mono text-xs break-all",children:(e==null?void 0:e.pubkey)??"—"})]}),d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Channels joined"}),d.jsx("dd",{className:"text-slate-100",children:(e==null?void 0:e.channel_count)??0})]}),(e==null?void 0:e.last_advert_sent)!=null&&d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Last advertised"}),d.jsx("dd",{className:"text-slate-100",children:v2e(e.last_advert_sent)})]})]}),d.jsxs("div",{className:"pt-2 border-t border-border space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("button",{onClick:S,disabled:c,className:"flex items-center gap-2 px-3 py-1.5 text-sm bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(_i,{size:14}),c?"Sending…":"Send Advert"]}),f!=null&&d.jsx("span",{className:`text-sm ${f.sent?"text-green-400":"text-red-400"}`,children:f.sent?"Advert sent":f.detail})]}),d.jsx("p",{className:"text-xs text-[#555]",children:"Announce this node to the mesh so others can discover and DM it."})]})]}):d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-slate-600"}),d.jsx("span",{className:"text-sm font-medium text-slate-400",children:"Not connected"})]}),d.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"The MeshCore companion is offline or inactive. No node identity or channel membership is available while the companion is disconnected."})]})}),d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"px-4 py-3 border-b border-border",children:[d.jsx("h3",{className:"text-sm font-medium text-slate-200",children:"Channels"}),d.jsx("p",{className:"text-xs text-[#555] mt-1",children:"Key = the channel PSK; enter it (or the # name) on a companion radio to join."})]}),I.length>0?d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm text-slate-200",children:[d.jsx("thead",{className:"bg-[#161616] border-b border-border",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"On-air hash"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Key"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:I.map(k=>d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-3 py-2 font-mono",children:k.name}),d.jsx("td",{className:"px-3 py-2 font-mono text-xs text-[#999]",children:k.hash!=null?`0x${k.hash}`:"—"}),d.jsx("td",{className:"px-3 py-2",children:k.key!=null?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-mono text-xs text-[#999] break-all",children:k.key}),d.jsx("button",{onClick:()=>M(k.key),className:"flex-shrink-0 px-2 py-0.5 text-[10px] bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded transition-colors",title:"Copy key to clipboard",children:l===k.key?"Copied":"Copy"})]}):d.jsx("span",{className:"text-xs text-[#777]",children:"—"})})]},k.name))})]})}):d.jsx("div",{className:"px-4 py-3 text-sm text-[#777]",children:"No channels"})]}),d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsx("div",{className:"px-4 py-3 border-b border-border",children:d.jsx("h3",{className:"text-sm font-medium text-slate-200",children:"Advertising"})}),d.jsx("div",{className:"px-4 py-4 space-y-4",children:d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"text-xs font-medium text-[#777] uppercase tracking-wide",children:"Auto-advert interval"}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("select",{value:g,onChange:k=>m(Number(k.target.value)),className:"bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 text-sm rounded px-2 py-1.5 focus:outline-none focus:border-accent",children:[d.jsx("option",{value:0,children:"Disabled"}),d.jsx("option",{value:1,children:"Every 1 hour"}),d.jsx("option",{value:3,children:"Every 3 hours (default)"}),d.jsx("option",{value:6,children:"Every 6 hours"}),d.jsx("option",{value:12,children:"Every 12 hours"}),d.jsx("option",{value:24,children:"Every 24 hours"})]}),d.jsx("button",{onClick:C,disabled:y,className:"px-3 py-1.5 text-sm bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded disabled:opacity-50 transition-colors",children:y?"Saving…":_?"Saved":"Save"})]}),d.jsxs("p",{className:"text-xs text-[#555]",children:["AIDA sends a flood advertisement at this interval so it stays discoverable. Stored in ",d.jsx("code",{className:"text-accent/80",children:"connection.meshcore_advert_interval_seconds"}),"."]})]})})]})]})]})}function p2e(){const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(null),[u,c]=E.useState(null),[h,f]=E.useState(null),[v,g]=E.useState(!0),[m,y]=E.useState(!1),[x,_]=E.useState(null),[w,S]=E.useState(null),[C,M]=E.useState(!1),[A,I]=E.useState(0),[k,P]=E.useState(""),[D,z]=E.useState(!1),[j,B]=E.useState(null),H=async()=>{z(!0),B(null);try{const W=await YV({transport:"meshtastic",channel:A,text:k.trim()||void 0});B(W)}catch(W){B({sent:!1,detail:W instanceof Error?W.message:"Send failed"})}finally{z(!1)}},V=E.useCallback(async()=>{g(!0);try{const[W,$,Z]=await Promise.all([Ao("connection"),Ao("context"),Ao("bot")]);r(W),a(JSON.parse(JSON.stringify(W))),o($),l(JSON.parse(JSON.stringify($))),c(Z),f(JSON.parse(JSON.stringify(Z))),M(!1),_(null)}catch(W){_(W instanceof Error?W.message:"Unknown error")}finally{g(!1)}},[]);E.useEffect(()=>{document.title="Meshtastic Connection - MeshAI",V()},[V]),E.useEffect(()=>{if(t&&n&&i&&s&&u&&h){const W=JSON.stringify(t)!==JSON.stringify(n)||JSON.stringify(i)!==JSON.stringify(s)||JSON.stringify(u)!==JSON.stringify(h);M(W)}},[t,n,i,s,u,h]),E.useEffect(()=>(e(C),()=>e(!1)),[C,e]);const U=async()=>{if(!(!t||!i||!u)){y(!0),_(null),S(null);try{const W=await Promise.all([Da("connection",t),Da("context",i),Da("bot",u)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),f(JSON.parse(JSON.stringify(u))),M(!1),e(!1),S("Meshtastic connection saved successfully"),W.some($=>$.restart_required)&&bu([]),setTimeout(()=>S(null),3e3)}catch(W){_(W instanceof Error?W.message:"Save failed")}finally{y(!1)}}},F=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),h&&c(JSON.parse(JSON.stringify(h))),M(!1)};return v?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading Meshtastic connection..."})}):t?d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"Connection to your Meshtastic radio (serial or TCP)."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:V,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:F,disabled:!C,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:U,disabled:m||!C,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:[d.jsx(_a,{size:16}),m?"Saving...":"Save"]})]})]}),x&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:x}),w&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),w]}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(mCe,{data:t,onChange:r})}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsxs("details",{className:"group",children:[d.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[d.jsx(Ah,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced — Reconnect & Packet Tuning"]}),d.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[d.jsx(qt,{label:"Auto-reconnect",checked:t.reconnect??!0,onChange:W=>r({...t,reconnect:W}),helper:"Automatically reconnect if the mesh link drops"}),d.jsx(Ae,{label:"Reconnect Initial Delay (s)",value:t.reconnect_initial_delay??2,onChange:W=>r({...t,reconnect_initial_delay:W}),min:0,step:.5,helper:"Backoff delay before the first reconnect attempt"}),d.jsx(Ae,{label:"Reconnect Max Delay (s)",value:t.reconnect_max_delay??60,onChange:W=>r({...t,reconnect_max_delay:W}),min:0,helper:"Ceiling for exponential reconnect backoff"}),d.jsx(Ae,{label:"Reconnect Health Interval (s)",value:t.reconnect_health_interval??30,onChange:W=>r({...t,reconnect_health_interval:W}),min:1,helper:"How often the socket-probe watchdog checks link health"}),d.jsx(Ae,{label:"Mesh Max Chars",value:t.mesh_max_chars??140,onChange:W=>r({...t,mesh_max_chars:W}),min:1,helper:"Per-packet character budget for the transport"})]})]})}),i&&u&&d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Bot behavior"}),d.jsx(qt,{label:"Enable Passive Context",checked:!!i.enabled,onChange:W=>o({...i,enabled:W}),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."}),d.jsx(DP,{label:"Observe Channels",value:i.observe_channels??[],onChange:W=>o({...i,observe_channels:W}),helper:"Channels to monitor (empty = all)",info:"Meshtastic channels to listen on. Leave empty to monitor all channels.",mode:"multi"}),d.jsx(PP,{label:"Ignore Nodes",value:i.ignore_nodes??[],onChange:W=>o({...i,ignore_nodes:W}),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."}),d.jsx(qt,{label:"Answer direct messages",checked:!!u.respond_to_dms,onChange:W=>c({...u,respond_to_dms:W}),helper:"When on, MeshAI replies to Meshtastic direct messages using the LLM. Applies to Meshtastic only."})]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Send Test Message"}),d.jsx(Ae,{label:"Channel Index",value:A,onChange:I,min:0,max:7,helper:"Meshtastic channel number (0 = primary)"}),d.jsx(yt,{label:"Message (optional)",value:k,onChange:P,placeholder:`🧪 MeshAI test — ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}),d.jsx("button",{onClick:H,disabled:D,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 text-sm transition-colors",children:D?"Sending...":"Send test"}),j&&(j.sent?d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),j.detail]}):d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:j.detail}))]})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load connection config"})})}function zZ(){const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(null),[u,c]=E.useState(!0),[h,f]=E.useState(!1),[v,g]=E.useState(null),[m,y]=E.useState(null),[x,_]=E.useState(!1),w=E.useCallback(async()=>{c(!0);try{const[M,A]=await Promise.all([Ao("meshmonitor"),Ao("mesh_sources")]);r(M),a(JSON.parse(JSON.stringify(M))),o(A),l(JSON.parse(JSON.stringify(A))),_(!1),g(null)}catch(M){g(M instanceof Error?M.message:"Unknown error")}finally{c(!1)}},[]);E.useEffect(()=>{document.title="Meshtastic Sources - MeshAI",w()},[w]),E.useEffect(()=>{if(t&&n&&i&&s){const M=JSON.stringify(t)!==JSON.stringify(n),A=JSON.stringify(i)!==JSON.stringify(s);_(M||A)}},[t,n,i,s]),E.useEffect(()=>(e(x),()=>e(!1)),[x,e]);const S=async()=>{if(!(!t||!i)){f(!0),g(null),y(null);try{const[M,A]=await Promise.all([Da("meshmonitor",t),Da("mesh_sources",i)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),_(!1),e(!1),y("Meshtastic sources saved successfully"),(M.restart_required||A.restart_required)&&bu([]),setTimeout(()=>y(null),3e3)}catch(M){g(M instanceof Error?M.message:"Save failed")}finally{f(!1)}}},C=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),_(!1)};return u?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading Meshtastic sources..."})}):!t||!i?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load sources config"})}):d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"MeshMonitor integration and mesh awareness data sources."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:w,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:C,disabled:!x,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:S,disabled:h||!x,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:[d.jsx(_a,{size:16}),h?"Saving...":"Save"]})]})]}),v&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:v}),m&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),m]}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(TCe,{data:t,onChange:r})}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(NCe,{data:i,onChange:o})})]})}const g2e=[{key:"gauge-sites",label:"Gauge Sites"},{key:"town-anchors",label:"Town Anchors"}];function m2e(){const[e,t]=E.useState("gauge-sites");return E.useEffect(()=>{document.title="Places - MeshAI"},[]),d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-1 border-b border-border",children:g2e.map(({key:r,label:n})=>d.jsx("button",{onClick:()=>t(r),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===r?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:n},r))}),e==="gauge-sites"&&d.jsx(EZ,{}),e==="town-anchors"&&d.jsx(RZ,{})]})}const y2e=[{key:"nodes",label:"Nodes"},{key:"sources",label:"Sources"},{key:"health",label:"Health"}];function x2e(){const[e,t]=E.useState("nodes"),{setDirty:r}=$i(),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(!1),[u,c]=E.useState(!1),[h,f]=E.useState(null),[v,g]=E.useState(null),[m,y]=E.useState(!1);E.useEffect(()=>{document.title="Nodes & Health - MeshAI"},[]);const x=E.useCallback(async()=>{l(!0),f(null);try{const S=await Ao("mesh_intelligence");a(S),o(JSON.parse(JSON.stringify(S))),y(!1)}catch(S){f(S instanceof Error?S.message:"Failed to load mesh intelligence config")}finally{l(!1)}},[]);E.useEffect(()=>{e==="health"&&n===null&&!s&&x()},[e,n,s,x]),E.useEffect(()=>{n&&i&&y(JSON.stringify(n)!==JSON.stringify(i))},[n,i]),E.useEffect(()=>(r(m),()=>r(!1)),[m,r]);const _=async()=>{if(n){c(!0),f(null),g(null);try{const S=await Da("mesh_intelligence",n);o(JSON.parse(JSON.stringify(n))),y(!1),r(!1),g("Mesh intelligence saved successfully"),S.restart_required&&bu([]),setTimeout(()=>g(null),3e3)}catch(S){f(S instanceof Error?S.message:"Save failed")}finally{c(!1)}}},w=()=>{i&&a(JSON.parse(JSON.stringify(i))),y(!1)};return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-1 border-b border-border",children:y2e.map(({key:S,label:C})=>d.jsx("button",{onClick:()=>t(S),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===S?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:C},S))}),e==="nodes"&&d.jsx(MZ,{}),e==="sources"&&d.jsx(zZ,{}),e==="health"&&d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"Mesh health scoring, region management, and automated alerting."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:x,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:w,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:_,disabled:u||!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:[d.jsx(_a,{size:16}),u?"Saving...":"Save"]})]})]}),h&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:h}),v&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),v]}),s?d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-slate-400",children:"Loading..."})}):n?d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(NZ,{data:n,onChange:a})}):d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-red-400",children:"Failed to load config"})})]})]})}const _2e=15e3,Np=5,BZ=14,b2e=BZ*86400;function rT(e){return e.last_advert==null||e.last_advert<=0?!1:Math.floor(Date.now()/1e3)-e.last_advert>b2e}const w2e={room_not_found:"no room server with this key is on the companion",channel_not_found:"this channel is not on the companion",not_a_room:"this key belongs to a contact that is not a room server"};function QB(e){if(e==null)return"—";const t=Math.floor(Date.now()/1e3-e);if(t<0)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function S2e(e){if(!e)return"—";const t=Date.parse(e);if(Number.isNaN(t))return"—";const r=Math.floor((Date.now()-t)/1e3);if(r<5)return"just now";if(r<60)return`${r}s ago`;const n=Math.floor(r/60);if(n<60)return`${n}m ago`;const a=Math.floor(n/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}const C2e={1:{label:"Chat",className:"bg-sky-500/15 text-sky-400"},2:{label:"Repeater",className:"bg-amber-500/15 text-amber-400"},3:{label:"Room",className:"bg-violet-500/15 text-violet-400"},4:{label:"Sensor",className:"bg-emerald-500/15 text-emerald-400"}};function T2e({type:e}){const t=e!=null&&C2e[e]||{label:"Unknown",className:"bg-slate-600/30 text-slate-400"};return d.jsx("span",{className:`px-2 py-0.5 text-[10px] uppercase tracking-wide rounded ${t.className}`,children:t.label})}function eF(e){return e.name?e.name:e.pubkey?`${e.pubkey.slice(0,12)}…`:"unnamed"}function nT(e){return e.pubkey||e.name||""}function aT(e){return e.length>12?`${e.slice(0,12)}…`:e}function M2e(e){return e.lat!=null&&e.lon!=null?`${e.lat.toFixed(4)}, ${e.lon.toFixed(4)}`:"—"}const A2e=[{key:"battery_pct",label:"Battery",unit:"%",digits:0},{key:"voltage",label:"Voltage",unit:"V",digits:2},{key:"temperature",label:"Temp",unit:"°C",digits:1},{key:"humidity",label:"Humidity",unit:"%",digits:0},{key:"current",label:"Current",unit:"A",digits:2},{key:"illuminance",label:"Light",unit:"lx",digits:0},{key:"barometer",label:"Pressure",unit:"hPa",digits:1},{key:"power",label:"Power",unit:"W",digits:1},{key:"altitude",label:"Alt",unit:"m",digits:0},{key:"distance",label:"Dist",unit:"m",digits:0}];function N2e({data:e,polledLabel:t}){const r=A2e.flatMap(n=>{const a=e[n.key];return typeof a!="number"||Number.isNaN(a)?[]:[d.jsxs("span",{className:"px-2 py-0.5 text-xs rounded bg-[#0a0e17] border border-[#1e2a3a] text-slate-200",children:[d.jsx("span",{className:"text-[#777]",children:n.label})," ",a.toFixed(n.digits),n.unit]},n.key)]});return d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.length>0?r:d.jsx("span",{className:"text-xs text-[#777]",children:"Telemetry received (no standard sensor fields)"}),d.jsxs("span",{className:"text-[11px] text-[#777] ml-1",children:["polled ",t]})]})}function k2e(){const[e,t]=E.useState(null),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState(null),[l,u]=E.useState(null),[c,h]=E.useState(null),[f,v]=E.useState(!1),[g,m]=E.useState(null),[y,x]=E.useState(null),[_,w]=E.useState(null),[S,C]=E.useState(!1),[M,A]=E.useState(""),[I,k]=E.useState(""),[P,D]=E.useState(1),[z,j]=E.useState(!1),[B,H]=E.useState(null),[V,U]=E.useState(null),[F,W]=E.useState(null),[$,Z]=E.useState(null),[J,re]=E.useState(""),[Q,le]=E.useState("all"),[de,He]=E.useState("name"),[ye,ne]=E.useState(!0),[xe,he]=E.useState(null),[ge,tt]=E.useState(null),[Ue,qe]=E.useState(null),[Fe,_t]=E.useState({}),[bt,et]=E.useState(null),[Ke,St]=E.useState(30),[ce,st]=E.useState(!1),[Bt,Ft]=E.useState(!1);E.useEffect(()=>{document.title="MeshCore Contacts - MeshAI"},[]),E.useEffect(()=>{let ue=!1;return(async()=>{n(!0),i(null);try{const Xe=await Gj();ue||(t(Xe),w(Xe.last_synced_at??null))}catch(Xe){ue||i(Xe instanceof Error?Xe.message:"Failed to load contacts")}finally{ue||n(!1)}})(),()=>{ue=!0}},[]);const jt=E.useCallback(async()=>{try{const ue=await XJ();h(ue)}catch{}},[]);E.useEffect(()=>{jt()},[jt]),E.useEffect(()=>{let ue=!1;return(async()=>{try{const Xe=await KJ();if(ue)return;s(Xe);const lt=Xe.meshcore_telemetry_interval_seconds;typeof lt=="number"&<>0&&St(Math.max(Np,Math.round(lt/60)))}catch{}})(),()=>{ue=!0}},[]),E.useEffect(()=>{let ue=!1;const Xe=async()=>{try{const Pt=await JJ();ue||u(Pt)}catch{}};Xe();const lt=setInterval(Xe,_2e);return()=>{ue=!0,clearInterval(lt)}},[]);const Lr=(o==null?void 0:o.meshcore_telemetry_contacts)??[],Qo=E.useCallback(ue=>((l==null?void 0:l.entries)??[]).find(lt=>lt.contact===ue.pubkey||ue.name!=null&<.contact===ue.name),[l]),tl=E.useCallback(ue=>Lr.includes(ue.pubkey)||ue.name!=null&&Lr.includes(ue.name),[Lr]),Ki=E.useCallback(async(ue,Xe)=>{if(!o)return;const lt=nT(ue);if(!lt)return;et(null),he(lt);const Pt=o.meshcore_telemetry_contacts??[];let fr;Xe?fr=Pt.includes(lt)?Pt:[...Pt,lt]:fr=Pt.filter(Ct=>Ct!==ue.pubkey&&Ct!==ue.name);const Tn={...o,meshcore_telemetry_contacts:fr};try{await Da("connection",Tn),s(Tn),tt(lt),setTimeout(()=>tt(Ct=>Ct===lt?null:Ct),1500)}catch(Ct){et(Ct instanceof Error?Ct.message:"Failed to save")}finally{he(Ct=>Ct===lt?null:Ct)}},[o]),Uh=E.useCallback(async ue=>{const Xe=nT(ue);if(Xe){qe(Xe);try{const lt=await QJ(Xe);_t(Pt=>({...Pt,[Xe]:lt}))}catch(lt){_t(Pt=>({...Pt,[Xe]:{available:!1,contact:Xe,detail:lt instanceof Error?lt.message:"Poll failed"}}))}finally{qe(lt=>lt===Xe?null:lt)}}},[]),Gn=E.useCallback(async()=>{v(!0),m(null),x(null),et(null);try{const ue=await $J();t({active:ue.active,contacts:ue.contacts}),w(ue.last_synced_at),m(ue.stats),x(ue.channel_stats),jt()}catch(ue){et(ue instanceof Error?ue.message:"Resync failed")}finally{v(!1)}},[jt]),es=E.useCallback(async()=>{var lt;const ue=I.trim().toLowerCase(),Xe=M.trim();if(!/^[0-9a-f]{64}$/.test(ue)){H("Pubkey must be exactly 64 hex characters (the full key, not a prefix)");return}if(!Xe){H("A name is required");return}j(!0),H(null);try{const Pt=await ZJ([{pubkey:ue,name:Xe,type:P,flags:0,out_path_len:-1,out_path:"",last_advert:0}]);if(Pt.failed>0){H(((lt=Pt.errors[0])==null?void 0:lt.detail)||"Add failed");return}C(!1),A(""),k("");const fr=await Gj();t(fr),w(fr.last_synced_at??null),jt()}catch(Pt){H(Pt instanceof Error?Pt.message:"Add failed")}finally{j(!1)}},[I,M,P,jt]),ts=E.useCallback(()=>{window.location.href="/api/meshcore/contacts/export"},[]),Au=E.useCallback(async ue=>{W(ue.pubkey),et(null);try{const Xe=await YJ(ue.pubkey);t(lt=>({active:!0,contacts:Xe.contacts,last_synced_at:(lt==null?void 0:lt.last_synced_at)??null})),U(null),jt()}catch(Xe){et(Xe instanceof Error?Xe.message:"Delete failed")}finally{W(Xe=>Xe===ue.pubkey?null:Xe)}},[jt]),Wh=E.useCallback(async ue=>{try{await navigator.clipboard.writeText(ue)}catch{}},[]),Va=E.useCallback(ue=>{He(Xe=>Xe===ue?(ne(lt=>!lt),Xe):(ne(!0),ue))},[]),$h=E.useMemo(()=>{const ue=new Set;for(const Xe of(c==null?void 0:c.collisions)??[])ue.add(Xe.name);return ue},[c]),Nu=E.useMemo(()=>{let ue=(e==null?void 0:e.contacts)??[];const Xe=J.trim().toLowerCase();return Xe&&(ue=ue.filter(Pt=>(Pt.name??"").toLowerCase().includes(Xe)||Pt.pubkey.toLowerCase().includes(Xe))),Q==="rooms"?ue=ue.filter(Pt=>Pt.type===3):Q==="stale"&&(ue=ue.filter(rT)),[...ue].sort((Pt,fr)=>{let Tn=0;return de==="name"?Tn=(Pt.name??"").localeCompare(fr.name??""):de==="type"?Tn=(Pt.type??0)-(fr.type??0):Tn=(Pt.last_advert??0)-(fr.last_advert??0),ye?Tn:-Tn})},[e,J,Q,de,ye]),ku=E.useMemo(()=>((e==null?void 0:e.contacts)??[]).filter(rT).length,[e]),rl=E.useMemo(()=>((e==null?void 0:e.contacts)??[]).filter(ue=>ue.type===3).length,[e]),Lu=E.useCallback(async()=>{if(!o)return;const ue=Math.max(Np,Math.round(Ke)||Np),Xe={...o,meshcore_telemetry_interval_seconds:ue*60};st(!0),Ft(!1),et(null);try{await Da("connection",Xe),s(Xe),St(ue),Ft(!0),setTimeout(()=>Ft(!1),2e3)}catch(lt){et(lt instanceof Error?lt.message:"Failed to save interval")}finally{st(!1)}},[o,Ke]),Iu=(e==null?void 0:e.active)!==!1,rs=(c==null?void 0:c.dangling)??[],ns=(c==null?void 0:c.collisions)??[];return d.jsxs("div",{className:"max-w-5xl mx-auto space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:d.jsx(UV,{size:24,className:"text-accent"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"MeshCore Contacts"}),d.jsx("p",{className:"text-sm text-[#777]",children:"The companion's known contact roster — names, types, last-heard times, and telemetry auto-poll."})]})]}),rs.length>0&&d.jsx("div",{className:"border border-red-500/40 bg-red-500/10 p-4 space-y-2",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(vi,{size:18,className:"text-red-400 flex-shrink-0 mt-0.5"}),d.jsxs("div",{className:"space-y-2 min-w-0",children:[d.jsxs("h3",{className:"text-sm font-semibold text-red-300",children:[rs.length," routing ",rs.length===1?"cell points":"cells point"," at a destination that no longer exists"]}),d.jsx("p",{className:"text-xs text-red-300/70 max-w-prose",children:"These cells cannot be delivered — a send to a missing room or channel fails silently. Fix the target on the Routing page, or resync if the roster is stale."}),d.jsx("ul",{className:"space-y-1",children:rs.map(ue=>d.jsxs("li",{className:"text-xs text-slate-200 flex flex-wrap items-center gap-x-2 gap-y-1",children:[d.jsx("span",{className:"px-1.5 py-0.5 rounded bg-red-500/20 text-red-300 uppercase tracking-wide text-[10px]",children:ue.family}),d.jsx("span",{className:"text-slate-300",children:ue.region}),d.jsx("span",{className:"text-[#777]",children:"→"}),d.jsx("span",{className:"font-mono text-[11px] text-red-300 break-all",children:ue.target}),d.jsxs("span",{className:"text-[#777]",children:["— ",w2e[ue.reason]??ue.reason]}),!ue.enabled&&d.jsx("span",{className:"px-1.5 py-0.5 rounded bg-slate-600/30 text-slate-400 text-[10px] uppercase tracking-wide",children:"disabled"})]},`${ue.family}-${ue.region}-${ue.target}`))})]})]})}),ns.length>0&&d.jsx("div",{className:"border border-amber-500/40 bg-amber-500/10 p-4",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(vi,{size:18,className:"text-amber-400 flex-shrink-0 mt-0.5"}),d.jsxs("div",{className:"space-y-2 min-w-0",children:[d.jsxs("h3",{className:"text-sm font-semibold text-amber-300",children:[ns.length," duplicated ",ns.length===1?"name":"names"," on the roster"]}),d.jsx("p",{className:"text-xs text-amber-300/70 max-w-prose",children:"These names each map to more than one public key. A name alone cannot identify them — always confirm the key before routing to or deleting one."}),d.jsx("ul",{className:"space-y-1",children:ns.map(ue=>d.jsxs("li",{className:"text-xs text-slate-200",children:[d.jsx("span",{className:"text-slate-100",children:ue.name})," ",d.jsxs("span",{className:"text-[#777]",children:["×",ue.count]}),d.jsx("span",{className:"ml-2 font-mono text-[11px] text-amber-300/80",children:ue.contacts.map(Xe=>aT(Xe.pubkey)).join(" · ")})]},ue.name))})]})]})}),Iu&&d.jsxs("div",{className:"bg-bg-card border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsxs("button",{onClick:Gn,disabled:f,className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",title:"Refetch the full roster from the companion and drop entries it no longer has",children:[d.jsx(Zi,{size:14,className:f?"animate-spin":void 0}),f?"Resyncing…":"Resync from node"]}),d.jsxs("button",{onClick:ts,className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 hover:border-accent/40",title:"Download the roster as JSON",children:[d.jsx(_J,{size:14}),"Export JSON"]}),d.jsxs("button",{onClick:()=>{C(ue=>!ue),H(null)},className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 hover:border-accent/40",title:"Add a contact by public key",children:[d.jsx(si,{size:14}),"Add contact"]}),d.jsxs("span",{className:"text-xs text-[#777]",children:["Last synced ",_!=null?QB(_):"unknown"]}),g&&d.jsxs("span",{className:"text-xs text-slate-300",children:[d.jsxs("span",{className:"text-emerald-400",children:["+",g.added," added"]})," · ",d.jsxs("span",{className:"text-red-400",children:["−",g.removed," removed"]})," · ",d.jsxs("span",{className:"text-[#777]",children:[g.updated," updated"]})," · ",d.jsxs("span",{className:"text-[#777]",children:[g.after," total"]}),y&&d.jsxs("span",{className:"text-[#777]",children:[" · ","channels ",y.after,y.added.length>0&&d.jsxs("span",{className:"text-emerald-400",children:[" +",y.added.length]}),y.removed.length>0&&d.jsxs("span",{className:"text-red-400",children:[" −",y.removed.length]})]})]})]}),S&&d.jsxs("div",{className:"border border-[#1e2a3a] bg-[#0a0e17] p-3 space-y-2",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("input",{value:M,onChange:ue=>A(ue.target.value),placeholder:"Name",className:"w-40 px-2 py-1 text-sm bg-bg-card border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]"}),d.jsx("input",{value:I,onChange:ue=>k(ue.target.value),placeholder:"Full 64-character hex public key",className:"flex-1 min-w-[280px] px-2 py-1 text-sm font-mono bg-bg-card border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]"}),d.jsxs("select",{value:P,onChange:ue=>D(Number(ue.target.value)),className:"px-2 py-1 text-sm bg-bg-card border border-[#1e2a3a] rounded text-slate-200",children:[d.jsx("option",{value:1,children:"Chat"}),d.jsx("option",{value:2,children:"Repeater"}),d.jsx("option",{value:3,children:"Room"}),d.jsx("option",{value:4,children:"Sensor"})]}),d.jsx("button",{onClick:es,disabled:z,className:"px-3 py-1 text-sm rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",children:z?"Adding…":"Add"}),d.jsx("button",{onClick:()=>C(!1),className:"px-2 py-1 text-sm text-[#777] hover:text-slate-200",children:"Cancel"})]}),B&&d.jsx("p",{className:"text-xs text-red-400",children:B}),d.jsx("p",{className:"text-xs text-[#777] max-w-prose",children:"Writes the contact straight to the companion — nothing is transmitted. Use this when a node has been rebuilt with a new keypair, or is not yet in range to advert."})]}),d.jsx("p",{className:"text-xs text-[#777] max-w-prose",children:"The roster and channel list are a snapshot cached from the companion at connect. Resync re-reads both from the node and reconciles them — the only action that removes entries the companion has dropped, or picks up a channel added on the radio."})]}),Iu&&o&&d.jsxs("div",{className:"bg-bg-card border border-border p-4 space-y-2",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsx("label",{className:"text-sm text-slate-200",children:"Auto-poll every"}),d.jsx("input",{type:"number",min:Np,value:Ke,onChange:ue=>St(Number(ue.target.value)),className:"w-20 px-2 py-1 text-sm bg-[#0a0e17] border border-[#1e2a3a] rounded text-slate-100"}),d.jsx("span",{className:"text-sm text-slate-300",children:"minutes"}),d.jsx("button",{onClick:Lu,disabled:ce,className:"px-3 py-1 text-sm rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",children:ce?"Saving…":Bt?"Saved":"Save"})]}),d.jsxs("p",{className:"text-xs text-[#777] max-w-prose",children:["Polls only the nodes you select below. Keep this list small — telemetry uses mesh airtime. Minimum ",Np," minutes."]})]}),bt&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:bt}),r?d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-slate-400",children:"Loading..."})}):a?d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:a}):e&&e.active===!1?d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"The MeshCore companion is not connected. The contact roster is unavailable until the companion comes online."})}):e&&e.contacts.length===0?d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"No contacts yet. The companion is connected but has not discovered any nodes so far."})}):d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-4 py-3 border-b border-border",children:[d.jsx("input",{type:"search",value:J,onChange:ue=>re(ue.target.value),placeholder:"Search name or pubkey…",className:"flex-1 min-w-[180px] px-2 py-1 text-sm bg-[#0a0e17] border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]"}),d.jsx("div",{className:"flex gap-1",children:[{key:"all",label:`All ${(e==null?void 0:e.contacts.length)??0}`},{key:"rooms",label:`Rooms ${rl}`},{key:"stale",label:`Stale ${ku}`}].map(({key:ue,label:Xe})=>d.jsx("button",{onClick:()=>le(ue),className:`px-2.5 py-1 text-xs rounded border transition-colors ${Q===ue?"border-accent/40 bg-accent/15 text-accent":"border-[#1e2a3a] bg-[#0a0e17] text-[#777] hover:text-slate-200"}`,children:Xe},ue))})]}),d.jsxs("div",{className:"overflow-x-auto",children:[d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"border-b border-border text-left text-[11px] uppercase tracking-wide text-[#777]",children:[d.jsx("th",{className:"px-4 py-2.5 font-medium",children:d.jsxs("button",{onClick:()=>Va("name"),className:"hover:text-slate-200 uppercase",children:["Name",de==="name"?ye?" ▲":" ▼":""]})}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:d.jsxs("button",{onClick:()=>Va("type"),className:"hover:text-slate-200 uppercase",children:["Type",de==="type"?ye?" ▲":" ▼":""]})}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:d.jsxs("button",{onClick:()=>Va("last_advert"),className:"hover:text-slate-200 uppercase",children:["Last heard",de==="last_advert"?ye?" ▲":" ▼":""]})}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Position"}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Pubkey"}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Auto-poll"}),d.jsx("th",{className:"px-4 py-2.5 font-medium"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:Nu.map(ue=>{const Xe=nT(ue),lt=Qo(ue),Pt=tl(ue),fr=Fe[Xe],Tn=lt!=null&<.available===!1,Ct=xe===Xe||Tn&&!Pt;let as=null,Mn="",$e=!1;fr?fr.available&&fr.data?(as=fr.data,Mn="just now"):$e=!0:lt&&(lt.available&<.data?(as=lt.data,Mn=S2e(lt.polled_at)):$e=!0);const Zh=as!=null||$e;return d.jsxs(E.Fragment,{children:[d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-4 py-2.5 text-slate-100",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{children:eF(ue)}),ue.name!=null&&$h.has(ue.name)&&d.jsx("span",{className:"px-1.5 py-0.5 text-[10px] uppercase tracking-wide rounded bg-amber-500/15 text-amber-400",title:"Another contact advertises this same name with a different key — check the pubkey",children:"dup name"})]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsx(T2e,{type:ue.type})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-slate-300",children:QB(ue.last_advert)}),rT(ue)&&d.jsx("span",{className:"px-1.5 py-0.5 text-[10px] uppercase tracking-wide rounded bg-orange-500/15 text-orange-400",title:`Not heard from in over ${BZ} days`,children:"stale"})]})}),d.jsx("td",{className:"px-4 py-2.5 text-slate-300 font-mono text-xs",children:M2e(ue)}),d.jsx("td",{className:"px-4 py-2.5 text-slate-400 font-mono text-xs",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("button",{onClick:()=>Z(Ne=>Ne===ue.pubkey?null:ue.pubkey),className:"hover:text-accent",title:ue.pubkey,children:$===ue.pubkey?ue.pubkey:aT(ue.pubkey)}),d.jsx("button",{onClick:()=>Wh(ue.pubkey),className:"text-[#555] hover:text-accent flex-shrink-0",title:"Copy full pubkey",children:d.jsx(PV,{size:11})})]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsxs("label",{className:`inline-flex items-center gap-2 ${Ct?"opacity-50":"cursor-pointer"}`,title:Tn&&!Pt?"no telemetry available":void 0,children:[d.jsx("input",{type:"checkbox",checked:Pt,disabled:Ct,onChange:Ne=>Ki(ue,Ne.target.checked),className:"accent-accent"}),d.jsx("span",{className:"text-xs text-slate-300",children:xe===Xe?"saving…":ge===Xe?"saved":Tn&&!Pt?"no telemetry":"auto-poll"})]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[d.jsx("button",{onClick:()=>Uh(ue),disabled:Ue===Xe,className:"px-2 py-1 text-xs rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",children:Ue===Xe?"Polling…":"Poll now"}),V===ue.pubkey?d.jsxs(d.Fragment,{children:[d.jsx("button",{onClick:()=>Au(ue),disabled:F===ue.pubkey,className:"px-2 py-1 text-xs rounded bg-red-500/20 text-red-300 hover:bg-red-500/30 disabled:opacity-50",children:F===ue.pubkey?"Deleting…":"Confirm"}),d.jsx("button",{onClick:()=>U(null),className:"px-2 py-1 text-xs rounded text-[#777] hover:text-slate-200",children:"Cancel"})]}):d.jsx("button",{onClick:()=>U(ue.pubkey),className:"p-1 rounded text-[#555] hover:text-red-400 hover:bg-red-500/10",title:"Remove this contact from the companion",children:d.jsx(li,{size:13})})]})})]}),V===ue.pubkey&&d.jsx("tr",{className:"bg-red-500/5",children:d.jsx("td",{colSpan:7,className:"px-4 py-2 border-t border-red-500/20",children:d.jsxs("span",{className:"text-xs text-red-300",children:["Remove ",d.jsx("span",{className:"text-slate-100",children:eF(ue)})," ",d.jsx("span",{className:"font-mono text-[11px]",children:aT(ue.pubkey)})," ","from the companion? It will only return if the node advertises again."]})})}),Zh&&d.jsx("tr",{className:"bg-[#0a0e17]/40",children:d.jsx("td",{colSpan:7,className:"px-4 py-2 border-t border-border/50",children:as?d.jsx(N2e,{data:as,polledLabel:Mn}):d.jsxs("span",{className:"text-xs text-[#777]",children:["no telemetry",fr!=null&&fr.detail?` — ${fr.detail}`:""]})})})]},ue.pubkey)})})]}),Nu.length===0&&d.jsx("div",{className:"px-4 py-6 text-sm text-[#777]",children:"No contacts match this filter."})]})]})]})}const L2e=[{key:"contacts",label:"Contacts"},{key:"companion",label:"Companion"}];function I2e(){const[e,t]=E.useState("contacts");return E.useEffect(()=>{document.title="Contacts & Companion - MeshAI"},[]),d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-1 border-b border-border",children:L2e.map(({key:r,label:n})=>d.jsx("button",{onClick:()=>t(r),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===r?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:n},r))}),e==="contacts"&&d.jsx(k2e,{}),e==="companion"&&d.jsx(OZ,{})]})}function tF({family:e="meshtastic"}){const{setDirty:t}=$i(),[r,n]=E.useState(null),[a,i]=E.useState(null),[o,s]=E.useState(!0),[l,u]=E.useState(!1),[c,h]=E.useState(null),[f,v]=E.useState(null),[g,m]=E.useState(!1),y=E.useCallback(async()=>{s(!0),h(null);try{const S=await Ao("notifications");n(S),i(JSON.parse(JSON.stringify(S))),m(!1)}catch(S){h(S instanceof Error?S.message:"Failed to load config")}finally{s(!1)}},[]);E.useEffect(()=>{document.title="Scheduled Broadcasts - MeshAI",y()},[y]),E.useEffect(()=>{if(r&&a){const S=JSON.stringify(r)!==JSON.stringify(a);m(S)}},[r,a]),E.useEffect(()=>(t(g),()=>t(!1)),[g,t]);const x=async()=>{if(r){u(!0),h(null),v(null);try{const S=await Da("notifications",r);i(JSON.parse(JSON.stringify(r))),S.restart_required&&bu([]),m(!1),t(!1),v("Scheduled broadcasts saved successfully"),setTimeout(()=>v(null),3e3)}catch(S){h(S instanceof Error?S.message:"Save failed")}finally{u(!1)}}},_=()=>{a&&n(JSON.parse(JSON.stringify(a))),m(!1)},w=e==="meshcore"?"MeshCore scheduled broadcasts and band condition reports.":"Meshtastic scheduled broadcasts and band condition reports.";return o?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading scheduled broadcasts..."})}):r?d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:w})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:y,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:_,disabled:!g,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:x,disabled:l||!g,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:[d.jsx(_a,{size:16}),l?"Saving...":"Save"]})]})]}),c&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:c}),f&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),f]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Cold-start grace"})}),d.jsx(qf,{label:"Grace period (seconds)",value:r.cold_start_grace_seconds??60,onChange:S=>n({...r,cold_start_grace_seconds:S}),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."})]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Band Conditions (HF propagation)"})}),d.jsx(Ch,{label:"Enable scheduled band-conditions broadcasts",checked:r.band_conditions_enabled??!0,onChange:S=>n({...r,band_conditions_enabled:S}),helper:"3x/day HF propagation summary (Day/Night ratings per band group). 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."}),(r.band_conditions_enabled??!0)&&d.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[d.jsx(q2,{label:"Slot 1",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[0]||"06:00",onChange:S=>{const C=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];C[0]=S,n({...r,band_conditions_schedule:C})},helper:"Morning (default 06:00 MT)"}),d.jsx(q2,{label:"Slot 2",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[1]||"14:00",onChange:S=>{const C=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];C[1]=S,n({...r,band_conditions_schedule:C})},helper:"Afternoon (default 14:00 MT)"}),d.jsx(q2,{label:"Slot 3",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[2]||"22:00",onChange:S=>{const C=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];C[2]=S,n({...r,band_conditions_schedule:C})},helper:"Night (default 22:00 MT)"})]}),d.jsx("p",{className:"text-xs text-slate-600",children:"All times are Mountain Time (America/Boise). DST handled automatically."})]})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load config"})})}function P2e({info:e}){const[t,r]=E.useState(!1);return d.jsxs("div",{className:"relative inline-block",children:[d.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&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),d.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 D2e({label:e,value:t,onChange:r,helper:n,info:a,keyPlaceholder:i="Key",valuePlaceholder:o="Value"}){const[s,l]=E.useState(()=>Object.entries(t||{}));E.useEffect(()=>{const c={};for(const[h,f]of s)h.trim()&&(c[h.trim()]=f);JSON.stringify(c)!==JSON.stringify(t||{})&&l(Object.entries(t||{}))},[t]);const u=c=>{l(c),r(Object.fromEntries(c.filter(([h])=>h.trim())))};return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(P2e,{info:a})]}),s.map(([c,h],f)=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("input",{type:"text",value:c,onChange:v=>u(s.map((g,m)=>m===f?[v.target.value,g[1]]:g)),placeholder:i,className:"w-40 flex-shrink-0 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"}),d.jsx("input",{type:"text",value:h,onChange:v=>u(s.map((g,m)=>m===f?[g[0],v.target.value]:g)),placeholder:o,className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsx("button",{type:"button",onClick:()=>u(s.filter((v,g)=>g!==f)),className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded flex-shrink-0","aria-label":"Remove header",children:d.jsx(li,{size:14})})]},f)),d.jsxs("button",{type:"button",onClick:()=>u([...s,["",""]]),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:[d.jsx(si,{size:16})," Add Header"]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}const j2e=["CLIENT_BASE","ROUTER","ROUTER_LATE"],E2e=[{value:"mesh_dm",label:"Mesh DM (unicast to nodes)"},{value:"mesh_broadcast",label:"Mesh Broadcast (channel)"},{value:"email",label:"Email"},{value:"webhook",label:"Webhook"},{value:"none",label:"(None / log only)"}],R2e=[{key:"fire",label:"Fire",description:"Active wildfires (radius from fire perimeter).",Icon:Rm,showAcres:!0},{key:"weather",label:"Weather",description:"Severe weather warnings near a node.",Icon:kh},{key:"snow",label:"Snow (sub-gate of Weather)",description:"Snow-category weather events.",Icon:VV},{key:"flood",label:"Flood (sub-gate of Seismic)",description:"Stream/flood gauge events.",Icon:Oo},{key:"avalanche",label:"Avalanche",description:"Avalanche advisories near a node.",Icon:kf},{key:"seismic",label:"Seismic",description:"Earthquakes and seismic events near a node.",Icon:kf}];function Pd(){return{enabled:!1,buffer_mi:5,min_acres:0}}function rF(){return{enabled:!1,dry_run:!0,monitor_roles:["ROUTER","ROUTER_LATE","CLIENT_BASE"],default_buffer_mi:5,cooldown_minutes:360,fire:Pd(),weather:Pd(),snow:Pd(),flood:Pd(),avalanche:Pd(),seismic:Pd(),delivery_type:"mesh_dm",node_ids:[],broadcast_channel:null,webhook_url:"",webhook_headers:{}}}function O2e({label:e,value:t,onChange:r,options:n,info:a=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Yo,{info:a})]}),d.jsx("select",{value:t,onChange:i=>r(i.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(i=>d.jsx("option",{value:i.value,children:i.label},i.value))})]})}function z2e({meta:e,cfg:t,onChange:r}){const{Icon:n}=e;return d.jsxs("div",{className:`border border-[#1e2a3a] p-3 space-y-2 ${e.tabled?"opacity-50":""}`,children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-start gap-2 flex-1",children:[d.jsx(n,{size:15,className:"text-slate-400 mt-0.5 flex-shrink-0"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("span",{className:"text-sm text-slate-300",children:e.label}),d.jsx("p",{className:"text-xs text-slate-600",children:e.description}),e.tabled&&d.jsx("span",{className:"inline-block mt-1 px-2 py-0.5 text-[10px] uppercase tracking-wide rounded bg-slate-700 text-slate-300",children:"Tabled — needs snowfall + elevation pipeline"})]})]}),d.jsx("button",{type:"button",disabled:e.tabled,onClick:()=>{e.tabled||r({...t,enabled:!t.enabled})},className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${t.enabled?"bg-accent":"bg-[#1e2a3a]"} ${e.tabled?"cursor-not-allowed":""}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t.enabled?"translate-x-5":""}`})})]}),t.enabled&&!e.tabled&&d.jsxs("div",{className:`grid gap-3 pt-2 border-t border-[#1e2a3a] ${e.showAcres?"grid-cols-2":"grid-cols-1"}`,children:[d.jsx(qf,{label:"Buffer (mi)",value:t.buffer_mi??0,onChange:a=>r({...t,buffer_mi:a}),min:0,step:.5}),e.showAcres&&d.jsx(qf,{label:"Min Acres",value:t.min_acres??0,onChange:a=>r({...t,min_acres:a}),min:0,step:1})]})]})}function B2e(){const[e,t]=E.useState(!1),[r,n]=E.useState(null),[a,i]=E.useState(!0),[o,s]=E.useState(!1),[l,u]=E.useState(null),[c,h]=E.useState(null),f=E.useCallback(async()=>{i(!0),u(null);try{const y=await Ao("danger_zones"),x=rF();n({...x,...y,fire:{...x.fire,...y.fire||{}},weather:{...x.weather,...y.weather||{}},snow:{...x.snow,...y.snow||{}},flood:{...x.flood,...y.flood||{}},avalanche:{...x.avalanche,...y.avalanche||{}},seismic:{...x.seismic,...y.seismic||{}},monitor_roles:y.monitor_roles??x.monitor_roles,node_ids:y.node_ids??x.node_ids,webhook_headers:y.webhook_headers??x.webhook_headers})}catch(y){u(y instanceof Error?y.message:"Failed to load danger zones config"),n(rF())}finally{i(!1)}},[]);E.useEffect(()=>{f()},[f]);const v=async()=>{if(r){s(!0),u(null),h(null);try{await Da("danger_zones",r),h("Danger Zones config saved"),setTimeout(()=>h(null),3e3)}catch(y){u(y instanceof Error?y.message:"Save failed")}finally{s(!1)}}},g=y=>n(x=>x&&{...x,...y}),m=y=>{if(!r)return;const x=r.monitor_roles||[];g({monitor_roles:x.includes(y)?x.filter(_=>_!==y):[...x,y]})};return d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("button",{type:"button",onClick:()=>t(y=>!y),className:"w-full flex items-center justify-between p-4 text-left",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(vi,{size:18,className:"text-amber-400"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-sm font-medium text-slate-200",children:"Danger Zones"}),d.jsx("div",{className:"text-xs text-slate-500",children:"Alert when monitored infrastructure nodes are in/near a hazard"})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[r&&d.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${r.enabled?r.dry_run?"bg-yellow-500/10 text-yellow-400":"bg-green-500/10 text-green-400":"bg-slate-800 text-slate-500"}`,children:r.enabled?r.dry_run?"Dry-run":"Live":"Disabled"}),e?d.jsx(Em,{size:18,className:"text-slate-500"}):d.jsx(Ah,{size:18,className:"text-slate-500"})]})]}),e&&d.jsxs("div",{className:"p-6 pt-0 space-y-6",children:[d.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20",children:[d.jsx(Nh,{size:16,className:"text-amber-400 mt-0.5 flex-shrink-0"}),d.jsxs("div",{className:"text-xs text-amber-200/90 leading-relaxed",children:["Ships disabled; when enabled, defaults to dry-run / log-only — no mesh traffic until you turn dry-run off. Requires ",d.jsx("span",{className:"font-medium",children:"Enable Notifications"})," (above) and environmental feeds to be on, since hazard events only flow when those are active."]})]}),l&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:l}),c&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),c]}),a||!r?d.jsx("div",{className:"text-sm text-slate-500",children:"Loading danger zones config..."}):d.jsxs(d.Fragment,{children:[d.jsx(Ch,{label:"Enable Danger Zones",checked:r.enabled,onChange:y=>g({enabled:y}),helper:"Master switch for the infrastructure danger-zone correlator"}),d.jsx(Ch,{label:"Dry-run (log only)",checked:r.dry_run,onChange:y=>g({dry_run:y}),helper:"When on, matches are logged but nothing is sent to the mesh. Turn off only after verifying dry-run output."}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Monitored Roles",d.jsx(Yo,{info:"Which Meshtastic node roles to correlate against hazards. Only nodes that have a GPS position are scanned."})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:j2e.map(y=>{const x=(r.monitor_roles||[]).includes(y);return d.jsx("button",{type:"button",onClick:()=>m(y),className:`px-3 py-1.5 rounded text-sm transition-colors ${x?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:y},y)})})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(qf,{label:"Default Buffer (mi)",value:r.default_buffer_mi,onChange:y=>g({default_buffer_mi:y}),min:0,step:.5,helper:"Buffer used when a family has none set"}),d.jsx(qf,{label:"Cooldown (min)",value:r.cooldown_minutes,onChange:y=>g({cooldown_minutes:y}),min:0,helper:"Min time between repeat alerts per node+family"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Hazard Families",d.jsx(Yo,{info:"Enable each hazard family to monitor, with its own buffer distance and severity threshold. Snow is a sub-gate of Weather; Flood a sub-gate of Seismic."})]}),R2e.map(y=>d.jsx(z2e,{meta:y,cfg:r[y.key],onChange:x=>g({[y.key]:x})},y.key))]}),d.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[d.jsx(BV,{size:14}),"DELIVERY"]}),d.jsx(O2e,{label:"Delivery Method",value:r.delivery_type||"mesh_dm",onChange:y=>g({delivery_type:y}),options:E2e,info:"Where danger-zone alerts get delivered. Mesh DM unicasts to specific nodes; broadcast sends to a channel. Has no effect while dry-run is on."}),r.delivery_type==="mesh_dm"&&d.jsx(PP,{label:"Recipient Nodes",value:r.node_ids||[],onChange:y=>g({node_ids:y}),helper:"Nodes that receive direct messages",valueType:"node_id_hex"}),r.delivery_type==="mesh_broadcast"&&d.jsx(DP,{label:"Broadcast Channel",value:r.broadcast_channel??0,onChange:y=>g({broadcast_channel:y}),helper:"Select the mesh radio channel",mode:"single"}),r.delivery_type==="webhook"&&d.jsxs(d.Fragment,{children:[d.jsx(ECe,{label:"Webhook URL",value:r.webhook_url||"",onChange:y=>g({webhook_url:y}),placeholder:"https://discord.com/api/webhooks/...",helper:"POST alert as JSON"}),d.jsx(D2e,{label:"Webhook Headers",value:r.webhook_headers||{},onChange:y=>g({webhook_headers:y}),helper:"Custom HTTP headers sent with the danger-zone webhook",keyPlaceholder:"Header",valuePlaceholder:"Value"})]}),r.delivery_type==="email"&&d.jsx("p",{className:"text-xs text-slate-600",children:"Email delivery uses the SMTP settings configured for notification rules."})]}),d.jsx("div",{className:"flex justify-end",children:d.jsxs("button",{type:"button",onClick:v,disabled:o,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:[d.jsx(_a,{size:16}),o?"Saving...":"Save Danger Zones"]})})]})]})]})}function F2e(){return E.useEffect(()=>{document.title="Danger Zones - MeshAI"},[]),d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsx("p",{className:"text-sm text-slate-500",children:"Alert infrastructure nodes when they are within a configurable buffer distance of an active hazard."}),d.jsx(B2e,{})]})}function V2e(){return E.useEffect(()=>{document.title="Danger Zones - MeshAI"},[]),d.jsx("div",{className:"max-w-3xl mx-auto",children:d.jsx("div",{className:"bg-bg-card border border-border p-8",children:d.jsxs("div",{className:"flex items-start gap-4",children:[d.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:d.jsx(vi,{size:24,className:"text-accent"})}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"MeshCore Danger Zones"}),d.jsx("span",{className:"px-2 py-0.5 text-[10px] uppercase tracking-wide rounded bg-slate-700 text-slate-300",children:"Coming soon"})]}),d.jsx("p",{className:"text-sm text-slate-400 leading-relaxed max-w-prose",children:"MeshCore danger zone alerting will correlate infrastructure node positions with active hazards and deliver targeted DMs via the MeshCore companion. This becomes available once the MeshCore delivery pipeline supports infrastructure-targeted messaging."})]})]})})})}delete yw.Icon.Default.prototype._getIconUrl;yw.Icon.Default.mergeOptions({iconUrl:SZ,iconRetinaUrl:CZ,shadowUrl:TZ});const hx=e=>Math.round(e*1e6)/1e6,dx=["#f59e0b","#60a5fa","#34d399","#a78bfa","#f87171","#fb923c"],G2e=[{key:"fires",label:"NIFC Fire Perimeters"},{key:"nws",label:"NWS Weather Alerts"},{key:"wzdx",label:"WZDx Work Zones"},{key:"usgs_quake",label:"USGS Earthquakes"},{key:"firms",label:"NASA FIRMS Hotspots"},{key:"roads511",label:"511 Road Conditions"},{key:"usgs",label:"USGS Stream Gauges"},{key:"avalanche",label:"Avalanche Advisories"},{key:"traffic",label:"TomTom Traffic"},{key:"satpass",label:"Satellite Passes"},{key:"ducting",label:"Tropospheric Ducting"}];function H2e({bounds:e}){const t=IP(),r=E.useRef(!1);return E.useEffect(()=>{!r.current&&e&&(t.fitBounds(e,{padding:[40,40]}),r.current=!0)},[t,e]),null}function U2e({mode:e,firstCorner:t,onFirstClick:r,onSecondClick:n}){return HSe({click(a){const i=[a.latlng.lat,a.latlng.lng];e==="awaiting-first"?r(i):e==="awaiting-second"&&n(i)}}),t?d.jsx(_Z,{center:t,radius:6,pathOptions:{color:"#f59e0b",fillColor:"#f59e0b",fillOpacity:1}}):null}function W2e(){const[e,t]=E.useState(null),[r,n]=E.useState(""),[a,i]=E.useState(!0),[o,s]=E.useState(!1),[l,u]=E.useState(null),[c,h]=E.useState(null),{setDirty:f}=$i(),[v,g]=E.useState("idle"),[m,y]=E.useState(null);E.useEffect(()=>{document.title="Coverage — MeshAI",fetch("/api/config").then(j=>{if(!j.ok)throw new Error("Failed to fetch config");return j.json()}).then(j=>{const B=j.coverage??{bbox:[],enabled:!0,excluded_adapters:[],areas:[]};let H=Array.isArray(B.areas)?B.areas:[];if(H.length===0&&Array.isArray(B.bbox)&&B.bbox.length===4){const[U,F,W,$]=B.bbox;H=[{name:"Area 1",west:U,south:F,east:W,north:$}]}const V={bbox:Array.isArray(B.bbox)?B.bbox:[],enabled:B.enabled??!0,excluded_adapters:Array.isArray(B.excluded_adapters)?B.excluded_adapters:[],areas:H};t(V),n(JSON.stringify(V))}).catch(j=>u(j instanceof Error?j.message:String(j))).finally(()=>i(!1))},[]);const x=e!==null&&JSON.stringify(e)!==r;E.useEffect(()=>(f(x),()=>f(!1)),[x,f]);const _=(e==null?void 0:e.areas)??[],w=_.length>0?[[Math.min(..._.map(j=>j.south)),Math.min(..._.map(j=>j.west))],[Math.max(..._.map(j=>j.north)),Math.max(..._.map(j=>j.east))]]:null,S=[39.5,-98.35],C=E.useCallback(j=>{y(j),g("awaiting-second")},[]),M=E.useCallback(j=>{if(!m)return;const[B,H]=m,[V,U]=j;t(F=>{if(!F)return F;const W={name:`Area ${F.areas.length+1}`,west:hx(Math.min(H,U)),south:hx(Math.min(B,V)),east:hx(Math.max(H,U)),north:hx(Math.max(B,V))};return{...F,areas:[...F.areas,W]}}),y(null),g("idle")},[m]),A=(j,B,H)=>{t(V=>{if(!V)return V;const U=V.areas.map((F,W)=>{if(W!==j)return F;if(B==="name")return{...F,name:H};const $=parseFloat(H);return isNaN($)?F:{...F,[B]:$}});return{...V,areas:U}})},I=j=>{t(B=>B&&{...B,areas:B.areas.filter((H,V)=>V!==j)})},k=j=>{if(!e)return;const B=e.excluded_adapters??[];t({...e,excluded_adapters:B.includes(j)?B.filter(H=>H!==j):[...B,j]})},P=()=>{r&&(t(JSON.parse(r)),g("idle"),y(null))},D=async()=>{if(e){s(!0),u(null),h(null);try{const j=await fetch("/api/config/coverage",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({areas:e.areas,bbox:[],enabled:e.enabled,excluded_adapters:e.excluded_adapters})}),B=await j.json();if(!j.ok)throw new Error(B.detail||"Save failed");n(JSON.stringify(e)),h("Coverage saved"),setTimeout(()=>h(null),3e3),B.restart_required&&bu(Array.isArray(B.changed_keys)?B.changed_keys:[])}catch(j){u(j instanceof Error?j.message:"Save failed")}finally{s(!1)}}};if(a)return d.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading coverage config…"});if(!e)return d.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:l||"No config"});const z=v==="awaiting-first"?"Click the first corner of the new area on the map…":v==="awaiting-second"?"Click the opposite corner to complete the area…":_.length>0?`${_.length} area${_.length!==1?"s":""} defined`:"No areas defined — draw one on the map or enter coordinates below.";return d.jsxs("div",{className:"space-y-6 max-w-4xl",children:[d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("p",{className:"text-sm text-[#777]",children:[`Define one or more bounding boxes that scope every native adapter's geographic focus (set-union of all areas). Adapters with "Use own config" on ignore these areas and use the geographic settings on the`," ",d.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"})," ","page."]}),x&&d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{onClick:P,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:D,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",o?"Saving…":"Save"]})]})]}),l&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:l}),c&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:c}),d.jsxs("div",{className:"border border-border p-4 flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Use coverage areas to scope all adapters"}),d.jsx("p",{className:"text-xs text-[#666] mt-0.5",children:"When disabled, every adapter uses its own geographic config regardless of the areas below."})]}),d.jsx("button",{type:"button",onClick:()=>t({...e,enabled:!e.enabled}),className:`relative w-10 h-5 rounded-full transition-colors ${e.enabled?"bg-accent":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${e.enabled?"translate-x-5":""}`})})]}),d.jsxs("div",{className:"border border-border overflow-hidden",children:[d.jsxs("div",{className:"bg-bg-card border-b border-border px-4 py-2 flex items-center justify-between gap-4",children:[d.jsx("span",{className:"text-xs text-[#777] min-w-0 truncate font-mono",children:z}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[v!=="idle"&&d.jsx("button",{onClick:()=>{g("idle"),y(null)},className:"px-2 py-1 text-xs text-[#777] hover:text-white border border-border",children:"Cancel"}),d.jsxs("button",{onClick:()=>g("awaiting-first"),disabled:v!=="idle",className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[d.jsx(CJ,{size:12}),"Add area"]})]})]}),d.jsxs(bZ,{center:S,zoom:4,style:{width:"100%",height:"400px"},className:"z-0",children:[d.jsx(wZ,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),d.jsx(H2e,{bounds:w}),_.map((j,B)=>{const H=dx[B%dx.length],V=[[j.south,j.west],[j.north,j.east]];return d.jsx(ZSe,{bounds:V,pathOptions:{color:H,fillColor:H,fillOpacity:.08,weight:2}},B)}),d.jsx(U2e,{mode:v,firstCorner:m,onFirstClick:C,onSecondClick:M})]})]}),d.jsxs("div",{className:"border border-border p-4 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-xs font-sans font-medium uppercase tracking-widest text-[#666]",children:"Coverage Areas"}),d.jsxs("button",{onClick:()=>g("awaiting-first"),disabled:v!=="idle",className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[d.jsx(si,{size:12})," Add area"]})]}),_.length===0?d.jsx("p",{className:"text-xs text-[#555]",children:'No areas defined. Draw one on the map or click "Add area" to start.'}):d.jsx("div",{className:"space-y-3",children:_.map((j,B)=>{const H=dx[B%dx.length];return d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:H}}),d.jsx("input",{type:"text",value:j.name,onChange:V=>A(B,"name",V.target.value),className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1 text-sm font-medium text-[#e0e0e0]",placeholder:"Area name"}),d.jsx("button",{onClick:()=>I(B),title:"Delete area",className:"flex items-center gap-1 px-2 py-1 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(li,{size:12})})]}),d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["west","south","east","north"].map(V=>d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-[#777] mb-1 block capitalize",children:V}),d.jsx("input",{type:"number",step:"0.000001",value:j[V],onChange:U=>A(B,V,U.target.value),className:"w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono"})]},V))})]},B)})}),d.jsx("p",{className:"text-xs text-[#666]",children:"Decimal degrees. W/E = longitude; S/N = latitude. Each area is a bounding box; the coverage filter uses the set-union of all areas. Drawn coordinates are rounded to 6 decimal places."})]}),d.jsxs("div",{className:"border border-border p-4 space-y-4",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-sans font-medium uppercase tracking-widest text-[#666] mb-1",children:"Adapter Overrides"}),d.jsxs("p",{className:"text-xs text-[#777]",children:['Toggle "Use own config" to have that adapter ignore the coverage areas. Its geographic settings (state, bbox, corridors, observers…) then become active on the'," ",d.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"})," ","page."]})]}),d.jsx("div",{className:"divide-y divide-border",children:G2e.map(({key:j,label:B})=>{var V;const H=((V=e.excluded_adapters)==null?void 0:V.includes(j))??!1;return d.jsxs("div",{className:"flex items-center justify-between py-2.5",children:[d.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[d.jsx("span",{className:"text-sm text-[#e0e0e0]",children:B}),H?d.jsx("span",{className:"text-[10px] text-accent/70 uppercase tracking-wide",children:"own config"}):d.jsx("span",{className:"text-[10px] text-[#555] uppercase tracking-wide",children:"coverage areas"})]}),d.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[H&&d.jsx("a",{href:"/environment",className:"text-xs text-accent hover:underline",children:"Configure"}),d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[d.jsx("span",{className:"text-xs text-[#666] whitespace-nowrap",children:"Use own config"}),d.jsx("button",{type:"button",onClick:()=>k(j),className:`relative w-8 h-4 rounded-full transition-colors ${H?"bg-accent":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${H?"translate-x-4":""}`})})]})]})]},j)})})]}),x&&d.jsxs("div",{className:"flex justify-end gap-2 pb-2",children:[d.jsxs("button",{onClick:P,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:D,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",o?"Saving…":"Save"]})]})]})}function $2e(){return d.jsx(hJ,{children:d.jsx(nQ,{children:d.jsx(uQ,{children:d.jsxs(JK,{children:[d.jsx(nr,{path:"/",element:d.jsx(yQ,{})}),d.jsx(nr,{path:"/environment",element:d.jsx(JCe,{})}),d.jsx(nr,{path:"/config",element:d.jsx(ICe,{})}),d.jsx(nr,{path:"/alerts",element:d.jsx(XB,{})}),d.jsx(nr,{path:"/activity",element:d.jsx(XB,{})}),d.jsx(nr,{path:"/meshtastic/routing",element:d.jsx(FCe,{})}),d.jsx(nr,{path:"/notifications",element:d.jsx(jj,{to:"/meshtastic/routing",replace:!0})}),d.jsx(nr,{path:"/reference",element:d.jsx(s2e,{})}),d.jsx(nr,{path:"/adapter-config",element:d.jsx(PZ,{})}),d.jsx(nr,{path:"/places",element:d.jsx(m2e,{})}),d.jsx(nr,{path:"/coverage",element:d.jsx(W2e,{})}),d.jsx(nr,{path:"/data-sources",element:d.jsx(jj,{to:"/environment",replace:!0})}),d.jsx(nr,{path:"/gauge-sites",element:d.jsx(EZ,{})}),d.jsx(nr,{path:"/town-anchors",element:d.jsx(RZ,{})}),d.jsx(nr,{path:"/mesh",element:d.jsx(MZ,{})}),d.jsx(nr,{path:"/meshtastic/connection",element:d.jsx(p2e,{})}),d.jsx(nr,{path:"/meshtastic/sources",element:d.jsx(zZ,{})}),d.jsx(nr,{path:"/meshtastic/scheduled",element:d.jsx(tF,{family:"meshtastic"})}),d.jsx(nr,{path:"/meshtastic/nodes",element:d.jsx(x2e,{})}),d.jsx(nr,{path:"/meshtastic/danger-zones",element:d.jsx(F2e,{})}),d.jsx(nr,{path:"/meshcore/connection",element:d.jsx(h2e,{})}),d.jsx(nr,{path:"/meshcore/routing",element:d.jsx(c2e,{})}),d.jsx(nr,{path:"/meshcore/scheduled",element:d.jsx(tF,{family:"meshcore"})}),d.jsx(nr,{path:"/meshcore/contacts",element:d.jsx(I2e,{})}),d.jsx(nr,{path:"/meshcore/companion",element:d.jsx(OZ,{})}),d.jsx(nr,{path:"/meshcore/danger-zones",element:d.jsx(V2e,{})})]})})})})}iT.createRoot(document.getElementById("root")).render(d.jsx(bf.StrictMode,{children:d.jsx(oJ,{children:d.jsx($2e,{})})})); + */(function(e,t){(function(r,n){n(t)})(EY,function(r){var n="1.9.4";function a(p){var b,T,N,O;for(T=1,N=arguments.length;T"u"||!L||!L.Mixin)){p=w(p)?p:[p];for(var b=0;b0?Math.floor(p):Math.ceil(p)};F.prototype={clone:function(){return new F(this.x,this.y)},add:function(p){return this.clone()._add($(p))},_add:function(p){return this.x+=p.x,this.y+=p.y,this},subtract:function(p){return this.clone()._subtract($(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 F(this.x*p.x,this.y*p.y)},unscaleBy:function(p){return new F(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=W(this.x),this.y=W(this.y),this},distanceTo:function(p){p=$(p);var b=p.x-this.x,T=p.y-this.y;return Math.sqrt(b*b+T*T)},equals:function(p){return p=$(p),p.x===this.x&&p.y===this.y},contains:function(p){return p=$(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 $(p,b,T){return p instanceof F?p:w(p)?new F(p[0],p[1]):p==null?p:typeof p=="object"&&"x"in p&&"y"in p?new F(p.x,p.y):new F(p,b,T)}function Z(p,b){if(p)for(var T=b?[p,b]:p,N=0,O=T.length;N=this.min.x&&T.x<=this.max.x&&b.y>=this.min.y&&T.y<=this.max.y},intersects:function(p){p=J(p);var b=this.min,T=this.max,N=p.min,O=p.max,G=O.x>=b.x&&N.x<=T.x,X=O.y>=b.y&&N.y<=T.y;return G&&X},overlaps:function(p){p=J(p);var b=this.min,T=this.max,N=p.min,O=p.max,G=O.x>b.x&&N.xb.y&&N.y=b.lat&&O.lat<=T.lat&&N.lng>=b.lng&&O.lng<=T.lng},intersects:function(p){p=Q(p);var b=this._southWest,T=this._northEast,N=p.getSouthWest(),O=p.getNorthEast(),G=O.lat>=b.lat&&N.lat<=T.lat,X=O.lng>=b.lng&&N.lng<=T.lng;return G&&X},overlaps:function(p){p=Q(p);var b=this._southWest,T=this._northEast,N=p.getSouthWest(),O=p.getNorthEast(),G=O.lat>b.lat&&N.latb.lng&&N.lng1,Xe=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}(),lt=function(){return!!document.createElement("canvas").getContext}(),Pt=!!(document.createElementNS&&qe("svg").createSVGRect),fr=!!Pt&&function(){var p=document.createElement("div");return p.innerHTML="",(p.firstChild&&p.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),Tn=!Pt&&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}}(),Ct=navigator.platform.indexOf("Mac")===0,as=navigator.platform.indexOf("Linux")===0;function Mn(p){return navigator.userAgent.toLowerCase().indexOf(p)>=0}var $e={ie:bt,ielt9:et,edge:Ke,webkit:St,android:ce,android23:st,androidStock:Ft,opera:jt,chrome:Lr,gecko:Qo,safari:tl,phantom:Ki,opera12:Uh,win:Hn,ie3d:es,webkit3d:ts,gecko3d:Au,any3d:Wh,mobile:Ga,mobileWebkit:$h,mobileWebkit3d:Nu,msPointer:ku,pointer:rl,touch:Iu,touchNative:Lu,mobileOpera:rs,mobileGecko:ns,retina:ue,passiveEvents:Xe,canvas:lt,svg:Pt,vml:Tn,inlineSvg:fr,mac:Ct,linux:as},Zh=$e.msPointer?"MSPointerDown":"pointerdown",Me=$e.msPointer?"MSPointerMove":"pointermove",Un=$e.msPointer?"MSPointerUp":"pointerup",Pu=$e.msPointer?"MSPointerCancel":"pointercancel",Lv={touchstart:Zh,touchmove:Me,touchend:Un,touchcancel:Pu},oy={touchstart:ly,touchmove:Yh,touchend:Yh,touchcancel:Yh},Ha={},sy=!1;function xw(p,b,T){return b==="touchstart"&&Rr(),oy[b]?(T=oy[b].bind(this,T),p.addEventListener(Lv[b],T,!1),T):(console.warn("wrong event specified:",b),h)}function _w(p,b,T){if(!Lv[b]){console.warn("wrong event specified:",b);return}p.removeEventListener(Lv[b],T,!1)}function bw(p){Ha[p.pointerId]=p}function ww(p){Ha[p.pointerId]&&(Ha[p.pointerId]=p)}function is(p){delete Ha[p.pointerId]}function Rr(){sy||(document.addEventListener(Zh,bw,!0),document.addEventListener(Me,ww,!0),document.addEventListener(Un,is,!0),document.addEventListener(Pu,is,!0),sy=!0)}function Yh(p,b){if(b.pointerType!==(b.MSPOINTER_TYPE_MOUSE||"mouse")){b.touches=[];for(var T in Ha)b.touches.push(Ha[T]);b.changedTouches=[b],p(b)}}function ly(p,b){b.MSPOINTER_TYPE_TOUCH&&b.pointerType===b.MSPOINTER_TYPE_TOUCH&&hn(b),Yh(p,b)}function uy(p){var b={},T,N;for(N in p)T=p[N],b[N]=T&&T.bind?T.bind(p):T;return p=b,b.type="dblclick",b.detail=2,b.isTrusted=!1,b._simulated=!0,b}var cy=200;function hy(p,b){p.addEventListener("dblclick",b);var T=0,N;function O(G){if(G.detail!==1){N=G.detail;return}if(!(G.pointerType==="mouse"||G.sourceCapabilities&&!G.sourceCapabilities.firesTouchEvents)){var X=RP(G);if(!(X.some(function(ie){return ie instanceof HTMLLabelElement&&ie.attributes.for})&&!X.some(function(ie){return ie instanceof HTMLInputElement||ie instanceof HTMLSelectElement}))){var ee=Date.now();ee-T<=cy?(N++,N===2&&b(uy(G))):N=1,T=ee}}}return p.addEventListener("click",O),{dblclick:b,simDblclick:O}}function dy(p,b){p.removeEventListener("dblclick",b.dblclick),p.removeEventListener("click",b.simDblclick)}var Xh=Ji(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),nl=Ji(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Iv=nl==="webkitTransition"||nl==="OTransition"?nl+"End":"transitionend";function se(p){return typeof p=="string"?document.getElementById(p):p}function ut(p,b){var T=p.style[b]||p.currentStyle&&p.currentStyle[b];if((!T||T==="auto")&&document.defaultView){var N=document.defaultView.getComputedStyle(p,null);T=N?N[b]:null}return T==="auto"?null:T}function Ze(p,b,T){var N=document.createElement(p);return N.className=b||"",T&&T.appendChild(N),N}function yt(p){var b=p.parentNode;b&&b.removeChild(p)}function rr(p){for(;p.firstChild;)p.removeChild(p.firstChild)}function oa(p){var b=p.parentNode;b&&b.lastChild!==p&&b.appendChild(p)}function cn(p){var b=p.parentNode;b&&b.firstChild!==p&&b.insertBefore(p,b.firstChild)}function An(p,b){if(p.classList!==void 0)return p.classList.contains(b);var T=ot(p);return T.length>0&&new RegExp("(^|\\s)"+b+"(\\s|$)").test(T)}function Y(p,b){if(p.classList!==void 0)for(var T=g(b),N=0,O=T.length;N0?2*window.devicePixelRatio:1;function zP(p){return $e.edge?p.wheelDeltaY/2:p.deltaY&&p.deltaMode===0?-p.deltaY/VZ: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 Aw(p,b){var T=b.relatedTarget;if(!T)return!0;try{for(;T&&T!==p;)T=T.parentNode}catch{return!1}return T!==p}var GZ={__proto__:null,on:Ie,off:Wt,stopPropagation:Eu,disableScrollPropagation:Mw,disableClickPropagation:Pv,preventDefault:hn,stop:Ru,getPropagationPath:RP,getMousePosition:OP,getWheelDelta:zP,isExternalTarget:Aw,addListener:Ie,removeListener:Wt},BP=U.extend({run:function(p,b,T,N){this.stop(),this._el=p,this._inProgress=!0,this._duration=T||.25,this._easeOutPower=1/Math.max(N||.5,.2),this._startPos=eo(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=j(this._animate,this),this._step()},_step:function(p){var b=+new Date-this._startTime,T=this._duration*1e3;bthis.options.maxZoom)?this.setZoom(p):this},panInsideBounds:function(p,b){this._enforcingBounds=!0;var T=this.getCenter(),N=this._limitCenter(T,this._zoom,Q(p));return T.equals(N)||this.panTo(N,b),this._enforcingBounds=!1,this},panInside:function(p,b){b=b||{};var T=$(b.paddingTopLeft||b.padding||[0,0]),N=$(b.paddingBottomRight||b.padding||[0,0]),O=this.project(this.getCenter()),G=this.project(p),X=this.getPixelBounds(),ee=J([X.min.add(T),X.max.subtract(N)]),ie=ee.getSize();if(!ee.contains(G)){this._enforcingBounds=!0;var pe=G.subtract(ee.getCenter()),ze=ee.extend(G).getSize().subtract(ie);O.x+=pe.x<0?-ze.x:ze.x,O.y+=pe.y<0?-ze.y:ze.y,this.panTo(this.unproject(O),b),this._enforcingBounds=!1}return this},invalidateSize:function(p){if(!this._loaded)return this;p=a({animate:!1,pan:!0},p===!0?{animate:!0}:p);var b=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var T=this.getSize(),N=b.divideBy(2).round(),O=T.divideBy(2).round(),G=N.subtract(O);return!G.x&&!G.y?this:(p.animate&&p.pan?this.panBy(G):(p.pan&&this._rawPanBy(G),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:T}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(p){if(p=this._locateOptions=a({timeout:1e4,watch:!1},p),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var b=o(this._handleGeolocationResponse,this),T=o(this._handleGeolocationError,this);return p.watch?this._locationWatchId=navigator.geolocation.watchPosition(b,T,p):navigator.geolocation.getCurrentPosition(b,T,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,T=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: "+T+"."})}},_handleGeolocationResponse:function(p){if(this._container._leaflet_id){var b=p.coords.latitude,T=p.coords.longitude,N=new le(b,T),O=N.toBounds(p.coords.accuracy*2),G=this._locateOptions;if(G.setView){var X=this.getBoundsZoom(O);this.setView(N,G.maxZoom?Math.min(X,G.maxZoom):X)}var ee={latlng:N,bounds:O,timestamp:p.timestamp};for(var ie in p.coords)typeof p.coords[ie]=="number"&&(ee[ie]=p.coords[ie]);this.fire("locationfound",ee)}},addHandler:function(p,b){if(!b)return this;var T=this[p]=new b(this);return this._handlers.push(T),this.options[p]&&T.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(),yt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(z(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)yt(this._panes[p]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(p,b){var T="leaflet-pane"+(p?" leaflet-"+p.replace("Pane","")+"-pane":""),N=Ze("div",T,b||this._mapPane);return p&&(this._panes[p]=N),N},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()),T=this.unproject(p.getTopRight());return new re(b,T)},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,T){p=Q(p),T=$(T||[0,0]);var N=this.getZoom()||0,O=this.getMinZoom(),G=this.getMaxZoom(),X=p.getNorthWest(),ee=p.getSouthEast(),ie=this.getSize().subtract(T),pe=J(this.project(ee,N),this.project(X,N)).getSize(),ze=$e.any3d?this.options.zoomSnap:1,ft=ie.x/pe.x,kt=ie.y/pe.y,$n=b?Math.max(ft,kt):Math.min(ft,kt);return N=this.getScaleZoom($n,N),ze&&(N=Math.round(N/(ze/100))*(ze/100),N=b?Math.ceil(N/ze)*ze:Math.floor(N/ze)*ze),Math.max(O,Math.min(G,N))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new F(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(p,b){var T=this._getTopLeftPoint(p,b);return new Z(T,T.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 T=this.options.crs;return b=b===void 0?this._zoom:b,T.scale(p)/T.scale(b)},getScaleZoom:function(p,b){var T=this.options.crs;b=b===void 0?this._zoom:b;var N=T.zoom(p*T.scale(b));return isNaN(N)?1/0:N},project:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.latLngToPoint(de(p),b)},unproject:function(p,b){return b=b===void 0?this._zoom:b,this.options.crs.pointToLatLng($(p),b)},layerPointToLatLng:function(p){var b=$(p).add(this.getPixelOrigin());return this.unproject(b)},latLngToLayerPoint:function(p){var b=this.project(de(p))._round();return b._subtract(this.getPixelOrigin())},wrapLatLng:function(p){return this.options.crs.wrapLatLng(de(p))},wrapLatLngBounds:function(p){return this.options.crs.wrapLatLngBounds(Q(p))},distance:function(p,b){return this.options.crs.distance(de(p),de(b))},containerPointToLayerPoint:function(p){return $(p).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(p){return $(p).add(this._getMapPanePos())},containerPointToLatLng:function(p){var b=this.containerPointToLayerPoint($(p));return this.layerPointToLatLng(b)},latLngToContainerPoint:function(p){return this.layerPointToContainerPoint(this.latLngToLayerPoint(de(p)))},mouseEventToContainerPoint:function(p){return OP(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=se(p);if(b){if(b._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");Ie(b,"scroll",this._onScroll,this),this._containerId=l(b)},_initLayout:function(){var p=this._container;this._fadeAnimated=this.options.fadeAnimation&&$e.any3d,Y(p,"leaflet-container"+($e.touch?" leaflet-touch":"")+($e.retina?" leaflet-retina":"")+($e.ielt9?" leaflet-oldie":"")+($e.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var b=ut(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),gr(this._mapPane,new F(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Y(p.markerPane,"leaflet-zoom-hide"),Y(p.shadowPane,"leaflet-zoom-hide"))},_resetView:function(p,b,T){gr(this._mapPane,new F(0,0));var N=!this._loaded;this._loaded=!0,b=this._limitZoom(b),this.fire("viewprereset");var O=this._zoom!==b;this._moveStart(O,T)._move(p,b)._moveEnd(O),this.fire("viewreset"),N&&this.fire("load")},_moveStart:function(p,b){return p&&this.fire("zoomstart"),b||this.fire("movestart"),this},_move:function(p,b,T,N){b===void 0&&(b=this._zoom);var O=this._zoom!==b;return this._zoom=b,this._lastCenter=p,this._pixelOrigin=this._getNewPixelOrigin(p),N?T&&T.pinch&&this.fire("zoom",T):((O||T&&T.pinch)&&this.fire("zoom",T),this.fire("move",T)),this},_moveEnd:function(p){return p&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return z(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(p){gr(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?Wt:Ie;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),$e.any3d&&this.options.transform3DLimit&&(p?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){z(this._resizeRequest),this._resizeRequest=j(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 T=[],N,O=b==="mouseout"||b==="mouseover",G=p.target||p.srcElement,X=!1;G;){if(N=this._targets[l(G)],N&&(b==="click"||b==="preclick")&&this._draggableMoved(N)){X=!0;break}if(N&&N.listens(b,!0)&&(O&&!Aw(G,p)||(T.push(N),O))||G===this._container)break;G=G.parentNode}return!T.length&&!X&&!O&&this.listens(b,!0)&&(T=[this]),T},_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 T=p.type;T==="mousedown"&&ju(b),this._fireDOMEvent(p,T)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(p,b,T){if(p.type==="click"){var N=a({},p);N.type="preclick",this._fireDOMEvent(N,N.type,T)}var O=this._findEventTargets(p,b);if(T){for(var G=[],X=0;X0?Math.round(p-b)/2:Math.max(0,Math.ceil(p))-Math.max(0,Math.floor(b))},_limitZoom:function(p){var b=this.getMinZoom(),T=this.getMaxZoom(),N=$e.any3d?this.options.zoomSnap:1;return N&&(p=Math.round(p/N)*N),Math.max(b,Math.min(T,p))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Ae(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(p,b){var T=this._getCenterOffset(p)._trunc();return(b&&b.animate)!==!0&&!this.getSize().contains(T)?!1:(this.panBy(T,b),!0)},_createAnimProxy:function(){var p=this._proxy=Ze("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(p),this.on("zoomanim",function(b){var T=Xh,N=this._proxy.style[T];Qi(this._proxy,this.project(b.center,b.zoom),this.getZoomScale(b.zoom,1)),N===this._proxy.style[T]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){yt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var p=this.getCenter(),b=this.getZoom();Qi(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,T){if(this._animatingZoom)return!0;if(T=T||{},!this._zoomAnimated||T.animate===!1||this._nothingToAnimate()||Math.abs(b-this._zoom)>this.options.zoomAnimationThreshold)return!1;var N=this.getZoomScale(b),O=this._getCenterOffset(p)._divideBy(1-1/N);return T.animate!==!0&&!this.getSize().contains(O)?!1:(j(function(){this._moveStart(!0,T.noMoveStart||!1)._animateZoom(p,b,!0)},this),!0)},_animateZoom:function(p,b,T,N){this._mapPane&&(T&&(this._animatingZoom=!0,this._animateToCenter=p,this._animateToZoom=b,Y(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:p,zoom:b,noUpdate:N}),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&&Ae(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 HZ(p,b){return new zt(p,b)}var Ti=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),T=this.getPosition(),N=p._controlCorners[T];return Y(b,"leaflet-control"),T.indexOf("bottom")!==-1?N.insertBefore(b,N.firstChild):N.appendChild(b),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(yt(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()}}),Dv=function(p){return new Ti(p)};zt.include({addControl:function(p){return p.addTo(this),this},removeControl:function(p){return p.remove(),this},_initControlPos:function(){var p=this._controlCorners={},b="leaflet-",T=this._controlContainer=Ze("div",b+"control-container",this._container);function N(O,G){var X=b+O+" "+b+G;p[O+G]=Ze("div",X,T)}N("top","left"),N("top","right"),N("bottom","left"),N("bottom","right")},_clearControlPos:function(){for(var p in this._controlCorners)yt(this._controlCorners[p]);yt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var FP=Ti.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(p,b,T,N){return T1,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)),T=b.overlay?p.type==="add"?"overlayadd":"overlayremove":p.type==="add"?"baselayerchange":null;T&&this._map.fire(T,b)},_createRadioElement:function(p,b){var T='",N=document.createElement("div");return N.innerHTML=T,N.firstChild},_addItem:function(p){var b=document.createElement("label"),T=this._map.hasLayer(p.layer),N;p.overlay?(N=document.createElement("input"),N.type="checkbox",N.className="leaflet-control-layers-selector",N.defaultChecked=T):N=this._createRadioElement("leaflet-base-layers_"+l(this),T),this._layerControlInputs.push(N),N.layerId=l(p.layer),Ie(N,"click",this._onInputClick,this);var O=document.createElement("span");O.innerHTML=" "+p.name;var G=document.createElement("span");b.appendChild(G),G.appendChild(N),G.appendChild(O);var X=p.overlay?this._overlaysList:this._baseLayersList;return X.appendChild(b),this._checkDisabledLayers(),b},_onInputClick:function(){if(!this._preventClick){var p=this._layerControlInputs,b,T,N=[],O=[];this._handlingClick=!0;for(var G=p.length-1;G>=0;G--)b=p[G],T=this._getLayer(b.layerId).layer,b.checked?N.push(T):b.checked||O.push(T);for(G=0;G=0;O--)b=p[O],T=this._getLayer(b.layerId).layer,b.disabled=T.options.minZoom!==void 0&&NT.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var p=this._section;this._preventClick=!0,Ie(p,"click",hn),this.expand();var b=this;setTimeout(function(){Wt(p,"click",hn),b._preventClick=!1})}}),UZ=function(p,b,T){return new FP(p,b,T)},Nw=Ti.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(p){var b="leaflet-control-zoom",T=Ze("div",b+" leaflet-bar"),N=this.options;return this._zoomInButton=this._createButton(N.zoomInText,N.zoomInTitle,b+"-in",T,this._zoomIn),this._zoomOutButton=this._createButton(N.zoomOutText,N.zoomOutTitle,b+"-out",T,this._zoomOut),this._updateDisabled(),p.on("zoomend zoomlevelschange",this._updateDisabled,this),T},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,T,N,O){var G=Ze("a",T,N);return G.innerHTML=p,G.href="#",G.title=b,G.setAttribute("role","button"),G.setAttribute("aria-label",b),Pv(G),Ie(G,"click",Ru),Ie(G,"click",O,this),Ie(G,"click",this._refocusOnMap,this),G},_updateDisabled:function(){var p=this._map,b="leaflet-disabled";Ae(this._zoomInButton,b),Ae(this._zoomOutButton,b),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||p._zoom===p.getMinZoom())&&(Y(this._zoomOutButton,b),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||p._zoom===p.getMaxZoom())&&(Y(this._zoomInButton,b),this._zoomInButton.setAttribute("aria-disabled","true"))}});zt.mergeOptions({zoomControl:!0}),zt.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Nw,this.addControl(this.zoomControl))});var WZ=function(p){return new Nw(p)},VP=Ti.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(p){var b="leaflet-control-scale",T=Ze("div",b),N=this.options;return this._addScales(N,b+"-line",T),p.on(N.updateWhenIdle?"moveend":"move",this._update,this),p.whenReady(this._update,this),T},onRemove:function(p){p.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(p,b,T){p.metric&&(this._mScale=Ze("div",b,T)),p.imperial&&(this._iScale=Ze("div",b,T))},_update:function(){var p=this._map,b=p.getSize().y/2,T=p.distance(p.containerPointToLatLng([0,b]),p.containerPointToLatLng([this.options.maxWidth,b]));this._updateScales(T)},_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),T=b<1e3?b+" m":b/1e3+" km";this._updateScale(this._mScale,T,b/p)},_updateImperial:function(p){var b=p*3.2808399,T,N,O;b>5280?(T=b/5280,N=this._getRoundNum(T),this._updateScale(this._iScale,N+" mi",N/T)):(O=this._getRoundNum(b),this._updateScale(this._iScale,O+" ft",O/b))},_updateScale:function(p,b,T){p.style.width=Math.round(this.options.maxWidth*T)+"px",p.innerHTML=b},_getRoundNum:function(p){var b=Math.pow(10,(Math.floor(p)+"").length-1),T=p/b;return T=T>=10?10:T>=5?5:T>=3?3:T>=2?2:1,b*T}}),$Z=function(p){return new VP(p)},ZZ='',kw=Ti.extend({options:{position:"bottomright",prefix:''+($e.inlineSvg?ZZ+" ":"")+"Leaflet"},initialize:function(p){m(this,p),this._attributions={}},onAdd:function(p){p.attributionControl=this,this._container=Ze("div","leaflet-control-attribution"),Pv(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 T=[];this.options.prefix&&T.push(this.options.prefix),p.length&&T.push(p.join(", ")),this._container.innerHTML=T.join(' ')}}});zt.mergeOptions({attributionControl:!0}),zt.addInitHook(function(){this.options.attributionControl&&new kw().addTo(this)});var YZ=function(p){return new kw(p)};Ti.Layers=FP,Ti.Zoom=Nw,Ti.Scale=VP,Ti.Attribution=kw,Dv.layers=UZ,Dv.zoom=WZ,Dv.scale=$Z,Dv.attribution=YZ;var ro=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}});ro.addTo=function(p,b){return p.addHandler(b,this),this};var XZ={Events:V},GP=$e.touch?"touchstart mousedown":"mousedown",sl=U.extend({options:{clickTolerance:3},initialize:function(p,b,T,N){m(this,N),this._element=p,this._dragStartTarget=b||p,this._preventOutline=T},enable:function(){this._enabled||(Ie(this._dragStartTarget,GP,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(sl._dragging===this&&this.finishDrag(!0),Wt(this._dragStartTarget,GP,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(p){if(this._enabled&&(this._moved=!1,!An(this._element,"leaflet-zoom-anim"))){if(p.touches&&p.touches.length!==1){sl._dragging===this&&this.finishDrag();return}if(!(sl._dragging||p.shiftKey||p.which!==1&&p.button!==1&&!p.touches)&&(sl._dragging=this,this._preventOutline&&ju(this._element),Kh(),al(),!this._moving)){this.fire("down");var b=p.touches?p.touches[0]:p,T=to(this._element);this._startPoint=new F(b.clientX,b.clientY),this._startPos=eo(this._element),this._parentScale=Vt(T);var N=p.type==="mousedown";Ie(document,N?"mousemove":"touchmove",this._onMove,this),Ie(document,N?"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,T=new F(b.clientX,b.clientY)._subtract(this._startPoint);!T.x&&!T.y||Math.abs(T.x)+Math.abs(T.y)G&&(X=ee,G=ie);G>T&&(b[X]=1,Iw(p,b,T,N,X),Iw(p,b,T,X,O))}function QZ(p,b){for(var T=[p[0]],N=1,O=0,G=p.length;Nb&&(T.push(p[N]),O=N);return Ob.max.x&&(T|=2),p.yb.max.y&&(T|=8),T}function eY(p,b){var T=b.x-p.x,N=b.y-p.y;return T*T+N*N}function jv(p,b,T,N){var O=b.x,G=b.y,X=T.x-O,ee=T.y-G,ie=X*X+ee*ee,pe;return ie>0&&(pe=((p.x-O)*X+(p.y-G)*ee)/ie,pe>1?(O=T.x,G=T.y):pe>0&&(O+=X*pe,G+=ee*pe)),X=p.x-O,ee=p.y-G,N?X*X+ee*ee:new F(O,G)}function Ua(p){return!w(p[0])||typeof p[0][0]!="object"&&typeof p[0][0]<"u"}function XP(p){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ua(p)}function qP(p,b){var T,N,O,G,X,ee,ie,pe;if(!p||p.length===0)throw new Error("latlngs not passed");Ua(p)||(console.warn("latlngs are not flat! Only the first ring will be used"),p=p[0]);var ze=de([0,0]),ft=Q(p),kt=ft.getNorthWest().distanceTo(ft.getSouthWest())*ft.getNorthEast().distanceTo(ft.getNorthWest());kt<1700&&(ze=Lw(p));var $n=p.length,en=[];for(T=0;T<$n;T++){var Wa=de(p[T]);en.push(b.project(de([Wa.lat-ze.lat,Wa.lng-ze.lng])))}for(T=0,N=0;T<$n-1;T++)N+=en[T].distanceTo(en[T+1])/2;if(N===0)pe=en[0];else for(T=0,G=0;T<$n-1;T++)if(X=en[T],ee=en[T+1],O=X.distanceTo(ee),G+=O,G>N){ie=(G-N)/O,pe=[ee.x-ie*(ee.x-X.x),ee.y-ie*(ee.y-X.y)];break}var sa=b.unproject($(pe));return de([sa.lat+ze.lat,sa.lng+ze.lng])}var tY={__proto__:null,simplify:WP,pointToSegmentDistance:$P,closestPointOnSegment:KZ,clipSegment:YP,_getEdgeIntersection:fy,_getBitCode:Ou,_sqClosestPointOnSegment:jv,isFlat:Ua,_flat:XP,polylineCenter:qP},Pw={project:function(p){return new F(p.lng,p.lat)},unproject:function(p){return new le(p.y,p.x)},bounds:new Z([-180,-90],[180,90])},Dw={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,T=this.R,N=p.lat*b,O=this.R_MINOR/T,G=Math.sqrt(1-O*O),X=G*Math.sin(N),ee=Math.tan(Math.PI/4-N/2)/Math.pow((1-X)/(1+X),G/2);return N=-T*Math.log(Math.max(ee,1e-10)),new F(p.lng*b*T,N)},unproject:function(p){for(var b=180/Math.PI,T=this.R,N=this.R_MINOR/T,O=Math.sqrt(1-N*N),G=Math.exp(-p.y/T),X=Math.PI/2-2*Math.atan(G),ee=0,ie=.1,pe;ee<15&&Math.abs(ie)>1e-7;ee++)pe=O*Math.sin(X),pe=Math.pow((1-pe)/(1+pe),O/2),ie=Math.PI/2-2*Math.atan(G*pe)-X,X+=ie;return new le(X*b,p.x*b/T)}},rY={__proto__:null,LonLat:Pw,Mercator:Dw,SphericalMercator:xe},nY=a({},ye,{code:"EPSG:3395",projection:Dw,transformation:function(){var p=.5/(Math.PI*Dw.R);return ge(p,.5,-p,.5)}()}),KP=a({},ye,{code:"EPSG:4326",projection:Pw,transformation:ge(1/180,1,-1/180,.5)}),aY=a({},He,{projection:Pw,transformation:ge(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 T=b.lng-p.lng,N=b.lat-p.lat;return Math.sqrt(T*T+N*N)},infinite:!0});He.Earth=ye,He.EPSG3395=nY,He.EPSG3857=tt,He.EPSG900913=Ue,He.EPSG4326=KP,He.Simple=aY;var Mi=U.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 T=this.getEvents();b.on(T,this),this.once("remove",function(){b.off(T,this)},this)}this.onAdd(b),this.fire("add"),b.fire("layeradd",{layer:this})}}});zt.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 T in this._layers)p.call(b,this._layers[T]);return this},_addLayers:function(p){p=p?w(p)?p:[p]:[];for(var b=0,T=p.length;bthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&b[0]instanceof le&&b[0].equals(b[T-1])&&b.pop(),b},_setLatLngs:function(p){ls.prototype._setLatLngs.call(this,p),Ua(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ua(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var p=this._renderer._bounds,b=this.options.weight,T=new F(b,b);if(p=new Z(p.min.subtract(T),p.max.add(T)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(p))){if(this.options.noClip){this._parts=this._rings;return}for(var N=0,O=this._rings.length,G;Np.y!=O.y>p.y&&p.x<(O.x-N.x)*(p.y-N.y)/(O.y-N.y)+N.x&&(b=!b);return b||ls.prototype._containsPoint.call(this,p,!0)}});function dY(p,b){return new rd(p,b)}var us=ss.extend({initialize:function(p,b){m(this,b),this._layers={},p&&this.addData(p)},addData:function(p){var b=w(p)?p:p.features,T,N,O;if(b){for(T=0,N=b.length;T0&&O.push(O[0].slice()),O}function nd(p,b){return p.feature?a({},p.feature,{geometry:b}):xy(b)}function xy(p){return p.type==="Feature"||p.type==="FeatureCollection"?p:{type:"Feature",properties:{},geometry:p}}var Ow={toGeoJSON:function(p){return nd(this,{type:"Point",coordinates:Rw(this.getLatLng(),p)})}};vy.include(Ow),jw.include(Ow),py.include(Ow),ls.include({toGeoJSON:function(p){var b=!Ua(this._latlngs),T=yy(this._latlngs,b?1:0,!1,p);return nd(this,{type:(b?"Multi":"")+"LineString",coordinates:T})}}),rd.include({toGeoJSON:function(p){var b=!Ua(this._latlngs),T=b&&!Ua(this._latlngs[0]),N=yy(this._latlngs,T?2:b?1:0,!0,p);return b||(N=[N]),nd(this,{type:(T?"Multi":"")+"Polygon",coordinates:N})}}),ed.include({toMultiPoint:function(p){var b=[];return this.eachLayer(function(T){b.push(T.toGeoJSON(p).geometry.coordinates)}),nd(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 T=b==="GeometryCollection",N=[];return this.eachLayer(function(O){if(O.toGeoJSON){var G=O.toGeoJSON(p);if(T)N.push(G.geometry);else{var X=xy(G);X.type==="FeatureCollection"?N.push.apply(N,X.features):N.push(X)}}}),T?nd(this,{geometries:N,type:"GeometryCollection"}):{type:"FeatureCollection",features:N}}});function eD(p,b){return new us(p,b)}var fY=eD,_y=Mi.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(p,b,T){this._url=p,this._bounds=Q(b),m(this,T)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Y(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){yt(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&&oa(this._image),this},bringToBack:function(){return this._map&&cn(this._image),this},setUrl:function(p){return this._url=p,this._image&&(this._image.src=p),this},setBounds:function(p){return this._bounds=Q(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:Ze("img");if(Y(b,"leaflet-image-layer"),this._zoomAnimated&&Y(b,"leaflet-zoom-animated"),this.options.className&&Y(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),T=this._map._latLngBoundsToNewLayerBounds(this._bounds,p.zoom,p.center).min;Qi(this._image,T,b)},_reset:function(){var p=this._image,b=new Z(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),T=b.getSize();gr(p,b.min),p.style.width=T.x+"px",p.style.height=T.y+"px"},_updateOpacity:function(){dt(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()}}),vY=function(p,b,T){return new _y(p,b,T)},tD=_y.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:Ze("video");if(Y(b,"leaflet-image-layer"),this._zoomAnimated&&Y(b,"leaflet-zoom-animated"),this.options.className&&Y(b,this.options.className),b.onselectstart=h,b.onmousemove=h,b.onloadeddata=o(this.fire,this,"load"),p){for(var T=b.getElementsByTagName("source"),N=[],O=0;O0?N:[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 G=0;GO?(b.height=O+"px",Y(p,G)):Ae(p,G),this._containerWidth=this._container.offsetWidth},_animateZoom:function(p){var b=this._map._latLngToNewLayerPoint(this._latlng,p.zoom,p.center),T=this._getAnchor();gr(this._container,b.add(T))},_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(ut(this._container,"marginBottom"),10)||0,T=this._container.offsetHeight+b,N=this._containerWidth,O=new F(this._containerLeft,-T-this._containerBottom);O._add(eo(this._container));var G=p.layerPointToContainerPoint(O),X=$(this.options.autoPanPadding),ee=$(this.options.autoPanPaddingTopLeft||X),ie=$(this.options.autoPanPaddingBottomRight||X),pe=p.getSize(),ze=0,ft=0;G.x+N+ie.x>pe.x&&(ze=G.x+N-pe.x+ie.x),G.x-ze-ee.x<0&&(ze=G.x-ee.x),G.y+T+ie.y>pe.y&&(ft=G.y+T-pe.y+ie.y),G.y-ft-ee.y<0&&(ft=G.y-ee.y),(ze||ft)&&(this.options.keepInView&&(this._autopanning=!0),p.fire("autopanstart").panBy([ze,ft]))}},_getAnchor:function(){return $(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),mY=function(p,b){return new by(p,b)};zt.mergeOptions({closePopupOnClick:!0}),zt.include({openPopup:function(p,b,T){return this._initOverlay(by,p,b,T).openOn(this),this},closePopup:function(p){return p=arguments.length?p:this._popup,p&&p.close(),this}}),Mi.include({bindPopup:function(p,b){return this._popup=this._initOverlay(by,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 ss||(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)){Ru(p);var b=p.layer||p.target;if(this._popup._source===b&&!(b instanceof ll)){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 wy=no.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(p){no.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){no.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=no.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=Ze("div",b),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+l(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(p){var b,T,N=this._map,O=this._container,G=N.latLngToContainerPoint(N.getCenter()),X=N.layerPointToContainerPoint(p),ee=this.options.direction,ie=O.offsetWidth,pe=O.offsetHeight,ze=$(this.options.offset),ft=this._getAnchor();ee==="top"?(b=ie/2,T=pe):ee==="bottom"?(b=ie/2,T=0):ee==="center"?(b=ie/2,T=pe/2):ee==="right"?(b=0,T=pe/2):ee==="left"?(b=ie,T=pe/2):X.xthis.options.maxZoom||TN?this._retainParent(O,G,X,N):!1)},_retainChildren:function(p,b,T,N){for(var O=2*p;O<2*p+2;O++)for(var G=2*b;G<2*b+2;G++){var X=new F(O,G);X.z=T+1;var ee=this._tileCoordsToKey(X),ie=this._tiles[ee];if(ie&&ie.active){ie.retain=!0;continue}else ie&&ie.loaded&&(ie.retain=!0);T+1this.options.maxZoom||this.options.minZoom!==void 0&&O1){this._setView(p,T);return}for(var ft=O.min.y;ft<=O.max.y;ft++)for(var kt=O.min.x;kt<=O.max.x;kt++){var $n=new F(kt,ft);if($n.z=this._tileZoom,!!this._isValidTile($n)){var en=this._tiles[this._tileCoordsToKey($n)];en?en.current=!0:X.push($n)}}if(X.sort(function(sa,id){return sa.distanceTo(G)-id.distanceTo(G)}),X.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Wa=document.createDocumentFragment();for(kt=0;ktT.max.x)||!b.wrapLat&&(p.yT.max.y))return!1}if(!this.options.bounds)return!0;var N=this._tileCoordsToBounds(p);return Q(this.options.bounds).overlaps(N)},_keyToBounds:function(p){return this._tileCoordsToBounds(this._keyToTileCoords(p))},_tileCoordsToNwSe:function(p){var b=this._map,T=this.getTileSize(),N=p.scaleBy(T),O=N.add(T),G=b.unproject(N,p.z),X=b.unproject(O,p.z);return[G,X]},_tileCoordsToBounds:function(p){var b=this._tileCoordsToNwSe(p),T=new re(b[0],b[1]);return this.options.noWrap||(T=this._map.wrapLatLngBounds(T)),T},_tileCoordsToKey:function(p){return p.x+":"+p.y+":"+p.z},_keyToTileCoords:function(p){var b=p.split(":"),T=new F(+b[0],+b[1]);return T.z=+b[2],T},_removeTile:function(p){var b=this._tiles[p];b&&(yt(b.el),delete this._tiles[p],this.fire("tileunload",{tile:b.el,coords:this._keyToTileCoords(p)}))},_initTile:function(p){Y(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,$e.ielt9&&this.options.opacity<1&&dt(p,this.options.opacity)},_addTile:function(p,b){var T=this._getTilePos(p),N=this._tileCoordsToKey(p),O=this.createTile(this._wrapCoords(p),o(this._tileReady,this,p));this._initTile(O),this.createTile.length<2&&j(o(this._tileReady,this,p,null,O)),gr(O,T),this._tiles[N]={el:O,coords:p,current:!0},b.appendChild(O),this.fire("tileloadstart",{tile:O,coords:p})},_tileReady:function(p,b,T){b&&this.fire("tileerror",{error:b,tile:T,coords:p});var N=this._tileCoordsToKey(p);T=this._tiles[N],T&&(T.loaded=+new Date,this._map._fadeAnimated?(dt(T.el,0),z(this._fadeFrame),this._fadeFrame=j(this._updateOpacity,this)):(T.active=!0,this._pruneTiles()),b||(Y(T.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:T.el,coords:p})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),$e.ielt9||!this._map._fadeAnimated?j(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 F(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 _Y(p){return new Rv(p)}var ad=Rv.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&&$e.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 T=document.createElement("img");return Ie(T,"load",o(this._tileOnLoad,this,b,T)),Ie(T,"error",o(this._tileOnError,this,b,T)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(T.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(T.referrerPolicy=this.options.referrerPolicy),T.alt="",T.src=this.getTileUrl(p),T},getTileUrl:function(p){var b={r:$e.retina?"@2x":"",s:this._getSubdomain(p),x:p.x,y:p.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var T=this._globalTileRange.max.y-p.y;this.options.tms&&(b.y=T),b["-y"]=T}return _(this._url,a(b,this.options))},_tileOnLoad:function(p,b){$e.ielt9?setTimeout(o(p,this,null,b),0):p(null,b)},_tileOnError:function(p,b,T){var N=this.options.errorTileUrl;N&&b.getAttribute("src")!==N&&(b.src=N),p(T,b)},_onTileRemove:function(p){p.tile.onload=null},_getZoomForUrl:function(){var p=this._tileZoom,b=this.options.maxZoom,T=this.options.zoomReverse,N=this.options.zoomOffset;return T&&(p=b-p),p+N},_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=C;var T=this._tiles[p].coords;yt(b),delete this._tiles[p],this.fire("tileabort",{tile:b,coords:T})}},_removeTile:function(p){var b=this._tiles[p];if(b)return b.el.setAttribute("src",C),Rv.prototype._removeTile.call(this,p)},_tileReady:function(p,b,T){if(!(!this._map||T&&T.getAttribute("src")===C))return Rv.prototype._tileReady.call(this,p,b,T)}});function aD(p,b){return new ad(p,b)}var iD=ad.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 T=a({},this.defaultWmsParams);for(var N in b)N in this.options||(T[N]=b[N]);b=m(this,b);var O=b.detectRetina&&$e.retina?2:1,G=this.getTileSize();T.width=G.x*O,T.height=G.y*O,this.wmsParams=T},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,ad.prototype.onAdd.call(this,p)},getTileUrl:function(p){var b=this._tileCoordsToNwSe(p),T=this._crs,N=J(T.project(b[0]),T.project(b[1])),O=N.min,G=N.max,X=(this._wmsVersion>=1.3&&this._crs===KP?[O.y,O.x,G.y,G.x]:[O.x,O.y,G.x,G.y]).join(","),ee=ad.prototype.getTileUrl.call(this,p);return ee+y(this.wmsParams,ee,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+X},setParams:function(p,b){return a(this.wmsParams,p),b||this.redraw(),this}});function bY(p,b){return new iD(p,b)}ad.WMS=iD,aD.wms=bY;var cs=Mi.extend({options:{padding:.1},initialize:function(p){m(this,p),l(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Y(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 T=this._map.getZoomScale(b,this._zoom),N=this._map.getSize().multiplyBy(.5+this.options.padding),O=this._map.project(this._center,b),G=N.multiplyBy(-T).add(O).subtract(this._map._getNewPixelOrigin(p,b));$e.any3d?Qi(this._container,G,T):gr(this._container,G)},_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(),T=this._map.containerPointToLayerPoint(b.multiplyBy(-p)).round();this._bounds=new Z(T,T.add(b.multiplyBy(1+p*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),oD=cs.extend({options:{tolerance:0},getEvents:function(){var p=cs.prototype.getEvents.call(this);return p.viewprereset=this._onViewPreReset,p},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){cs.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var p=this._container=document.createElement("canvas");Ie(p,"mousemove",this._onMouseMove,this),Ie(p,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ie(p,"mouseout",this._handleMouseOut,this),p._leaflet_disable_events=!0,this._ctx=p.getContext("2d")},_destroyContainer:function(){z(this._redrawRequest),delete this._ctx,yt(this._container),Wt(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)){cs.prototype._update.call(this);var p=this._bounds,b=this._container,T=p.getSize(),N=$e.retina?2:1;gr(b,p.min),b.width=N*T.x,b.height=N*T.y,b.style.width=T.x+"px",b.style.height=T.y+"px",$e.retina&&this._ctx.scale(2,2),this._ctx.translate(-p.min.x,-p.min.y),this.fire("update")}},_reset:function(){cs.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,T=b.next,N=b.prev;T?T.prev=N:this._drawLast=N,N?N.next=T:this._drawFirst=T,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(/[, ]+/),T=[],N,O;for(O=0;O')}}catch{}return function(p){return document.createElement("<"+p+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),wY={_initContainer:function(){this._container=Ze("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(cs.prototype._update.call(this),this.fire("update"))},_initPath:function(p){var b=p._container=Ov("shape");Y(b,"leaflet-vml-shape "+(this.options.className||"")),b.coordsize="1 1",p._path=Ov("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;yt(b),p.removeInteractiveTarget(b),delete this._layers[l(p)]},_updateStyle:function(p){var b=p._stroke,T=p._fill,N=p.options,O=p._container;O.stroked=!!N.stroke,O.filled=!!N.fill,N.stroke?(b||(b=p._stroke=Ov("stroke")),O.appendChild(b),b.weight=N.weight+"px",b.color=N.color,b.opacity=N.opacity,N.dashArray?b.dashStyle=w(N.dashArray)?N.dashArray.join(" "):N.dashArray.replace(/( *, *)/g," "):b.dashStyle="",b.endcap=N.lineCap.replace("butt","flat"),b.joinstyle=N.lineJoin):b&&(O.removeChild(b),p._stroke=null),N.fill?(T||(T=p._fill=Ov("fill")),O.appendChild(T),T.color=N.fillColor||N.color,T.opacity=N.fillOpacity):T&&(O.removeChild(T),p._fill=null)},_updateCircle:function(p){var b=p._point.round(),T=Math.round(p._radius),N=Math.round(p._radiusY||T);this._setPath(p,p._empty()?"M0 0":"AL "+b.x+","+b.y+" "+T+","+N+" 0,"+65535*360)},_setPath:function(p,b){p._path.v=b},_bringToFront:function(p){oa(p._container)},_bringToBack:function(p){cn(p._container)}},Sy=$e.vml?Ov:qe,zv=cs.extend({_initContainer:function(){this._container=Sy("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Sy("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){yt(this._container),Wt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){cs.prototype._update.call(this);var p=this._bounds,b=p.getSize(),T=this._container;(!this._svgSize||!this._svgSize.equals(b))&&(this._svgSize=b,T.setAttribute("width",b.x),T.setAttribute("height",b.y)),gr(T,p.min),T.setAttribute("viewBox",[p.min.x,p.min.y,b.x,b.y].join(" ")),this.fire("update")}},_initPath:function(p){var b=p._path=Sy("path");p.options.className&&Y(b,p.options.className),p.options.interactive&&Y(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){yt(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,T=p.options;b&&(T.stroke?(b.setAttribute("stroke",T.color),b.setAttribute("stroke-opacity",T.opacity),b.setAttribute("stroke-width",T.weight),b.setAttribute("stroke-linecap",T.lineCap),b.setAttribute("stroke-linejoin",T.lineJoin),T.dashArray?b.setAttribute("stroke-dasharray",T.dashArray):b.removeAttribute("stroke-dasharray"),T.dashOffset?b.setAttribute("stroke-dashoffset",T.dashOffset):b.removeAttribute("stroke-dashoffset")):b.setAttribute("stroke","none"),T.fill?(b.setAttribute("fill",T.fillColor||T.color),b.setAttribute("fill-opacity",T.fillOpacity),b.setAttribute("fill-rule",T.fillRule||"evenodd")):b.setAttribute("fill","none"))},_updatePoly:function(p,b){this._setPath(p,Fe(p._parts,b))},_updateCircle:function(p){var b=p._point,T=Math.max(Math.round(p._radius),1),N=Math.max(Math.round(p._radiusY),1)||T,O="a"+T+","+N+" 0 1,0 ",G=p._empty()?"M0 0":"M"+(b.x-T)+","+b.y+O+T*2+",0 "+O+-T*2+",0 ";this._setPath(p,G)},_setPath:function(p,b){p._path.setAttribute("d",b)},_bringToFront:function(p){oa(p._path)},_bringToBack:function(p){cn(p._path)}});$e.vml&&zv.include(wY);function lD(p){return $e.svg||$e.vml?new zv(p):null}zt.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&&sD(p)||lD(p)}});var uD=rd.extend({initialize:function(p,b){rd.prototype.initialize.call(this,this._boundsToLatLngs(p),b)},setBounds:function(p){return this.setLatLngs(this._boundsToLatLngs(p))},_boundsToLatLngs:function(p){return p=Q(p),[p.getSouthWest(),p.getNorthWest(),p.getNorthEast(),p.getSouthEast()]}});function SY(p,b){return new uD(p,b)}zv.create=Sy,zv.pointsToPath=Fe,us.geometryToLayer=gy,us.coordsToLatLng=Ew,us.coordsToLatLngs=my,us.latLngToCoords=Rw,us.latLngsToCoords=yy,us.getFeature=nd,us.asFeature=xy,zt.mergeOptions({boxZoom:!0});var cD=ro.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(){Ie(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Wt(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){yt(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(),al(),Kh(),this._startPoint=this._map.mouseEventToContainerPoint(p),Ie(document,{contextmenu:Ru,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(p){this._moved||(this._moved=!0,this._box=Ze("div","leaflet-zoom-box",this._container),Y(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(p);var b=new Z(this._point,this._startPoint),T=b.getSize();gr(this._box,b.min),this._box.style.width=T.x+"px",this._box.style.height=T.y+"px"},_finish:function(){this._moved&&(yt(this._box),Ae(this._container,"leaflet-crosshair")),il(),Jh(),Wt(document,{contextmenu:Ru,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())}});zt.addInitHook("addHandler","boxZoom",cD),zt.mergeOptions({doubleClickZoom:!0});var hD=ro.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,T=b.getZoom(),N=b.options.zoomDelta,O=p.originalEvent.shiftKey?T-N:T+N;b.options.doubleClickZoom==="center"?b.setZoom(O):b.setZoomAround(p.containerPoint,O)}});zt.addInitHook("addHandler","doubleClickZoom",hD),zt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var dD=ro.extend({addHooks:function(){if(!this._draggable){var p=this._map;this._draggable=new sl(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))}Y(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Ae(this._map._container,"leaflet-grab"),Ae(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=Q(this._map.options.maxBounds);this._offsetLimit=J(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,T=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(T),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),T=this._initialWorldOffset,N=this._draggable._newPos.x,O=(N-b+T)%p+b-T,G=(N+b+T)%p-b-T,X=Math.abs(O+T)0?G:-G))-b;this._delta=0,this._startTime=null,X&&(p.options.scrollWheelZoom==="center"?p.setZoom(b+X):p.setZoomAround(this._lastMousePos,b+X))}});zt.addInitHook("addHandler","scrollWheelZoom",vD);var CY=600;zt.mergeOptions({tapHold:$e.touchNative&&$e.safari&&$e.mobile,tapTolerance:15});var pD=ro.extend({addHooks:function(){Ie(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Wt(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 F(b.clientX,b.clientY),this._holdTimeout=setTimeout(o(function(){this._cancel(),this._isTapValid()&&(Ie(document,"touchend",hn),Ie(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",b))},this),CY),Ie(document,"touchend touchcancel contextmenu",this._cancel,this),Ie(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function p(){Wt(document,"touchend",hn),Wt(document,"touchend touchcancel",p)},_cancel:function(){clearTimeout(this._holdTimeout),Wt(document,"touchend touchcancel contextmenu",this._cancel,this),Wt(document,"touchmove",this._onMove,this)},_onMove:function(p){var b=p.touches[0];this._newPos=new F(b.clientX,b.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(p,b){var T=new MouseEvent(p,{bubbles:!0,cancelable:!0,view:window,screenX:b.screenX,screenY:b.screenY,clientX:b.clientX,clientY:b.clientY});T._simulated=!0,b.target.dispatchEvent(T)}});zt.addInitHook("addHandler","tapHold",pD),zt.mergeOptions({touchZoom:$e.touch,bounceAtZoomLimits:!0});var gD=ro.extend({addHooks:function(){Y(this._map._container,"leaflet-touch-zoom"),Ie(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Ae(this._map._container,"leaflet-touch-zoom"),Wt(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 T=b.mouseEventToContainerPoint(p.touches[0]),N=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(T.add(N)._divideBy(2))),this._startDist=T.distanceTo(N),this._startZoom=b.getZoom(),this._moved=!1,this._zooming=!0,b._stop(),Ie(document,"touchmove",this._onTouchMove,this),Ie(document,"touchend touchcancel",this._onTouchEnd,this),hn(p)}},_onTouchMove:function(p){if(!(!p.touches||p.touches.length!==2||!this._zooming)){var b=this._map,T=b.mouseEventToContainerPoint(p.touches[0]),N=b.mouseEventToContainerPoint(p.touches[1]),O=T.distanceTo(N)/this._startDist;if(this._zoom=b.getScaleZoom(O,this._startZoom),!b.options.bounceAtZoomLimits&&(this._zoomb.getMaxZoom()&&O>1)&&(this._zoom=b._limitZoom(this._zoom)),b.options.touchZoom==="center"){if(this._center=this._startLatLng,O===1)return}else{var G=T._add(N)._divideBy(2)._subtract(this._centerPoint);if(O===1&&G.x===0&&G.y===0)return;this._center=b.unproject(b.project(this._pinchStartLatLng,this._zoom).subtract(G),this._zoom)}this._moved||(b._moveStart(!0,!1),this._moved=!0),z(this._animRequest);var X=o(b._move,b,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=j(X,this,!0),hn(p)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,z(this._animRequest),Wt(document,"touchmove",this._onTouchMove,this),Wt(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))}});zt.addInitHook("addHandler","touchZoom",gD),zt.BoxZoom=cD,zt.DoubleClickZoom=hD,zt.Drag=dD,zt.Keyboard=fD,zt.ScrollWheelZoom=vD,zt.TapHold=pD,zt.TouchZoom=gD,r.Bounds=Z,r.Browser=$e,r.CRS=He,r.Canvas=oD,r.Circle=jw,r.CircleMarker=py,r.Class=B,r.Control=Ti,r.DivIcon=nD,r.DivOverlay=no,r.DomEvent=GZ,r.DomUtil=Ot,r.Draggable=sl,r.Evented=U,r.FeatureGroup=ss,r.GeoJSON=us,r.GridLayer=Rv,r.Handler=ro,r.Icon=td,r.ImageOverlay=_y,r.LatLng=le,r.LatLngBounds=re,r.Layer=Mi,r.LayerGroup=ed,r.LineUtil=tY,r.Map=zt,r.Marker=vy,r.Mixin=XZ,r.Path=ll,r.Point=F,r.PolyUtil=qZ,r.Polygon=rd,r.Polyline=ls,r.Popup=by,r.PosAnimation=BP,r.Projection=rY,r.Rectangle=uD,r.Renderer=cs,r.SVG=zv,r.SVGOverlay=rD,r.TileLayer=ad,r.Tooltip=wy,r.Transformation=he,r.Util=D,r.VideoOverlay=tD,r.bind=o,r.bounds=J,r.canvas=sD,r.circle=cY,r.circleMarker=uY,r.control=Dv,r.divIcon=xY,r.extend=a,r.featureGroup=oY,r.geoJSON=eD,r.geoJson=fY,r.gridLayer=_Y,r.icon=sY,r.imageOverlay=vY,r.latLng=de,r.latLngBounds=Q,r.layerGroup=iY,r.map=HZ,r.marker=lY,r.point=$,r.polygon=dY,r.polyline=hY,r.popup=mY,r.rectangle=SY,r.setOptions=m,r.stamp=l,r.svg=lD,r.svgOverlay=gY,r.tileLayer=aD,r.tooltip=yY,r.transformation=ge,r.version=n,r.videoOverlay=pY;var TY=window.L;r.noConflict=function(){return window.L=TY,this},window.L=r})})(yN,yN.exports);var Mu=yN.exports;const yw=_N(Mu);function kv(e,t,r){return Object.freeze({instance:e,context:t,container:r})}function LP(e,t){return t==null?function(n,a){const i=E.useRef();return i.current||(i.current=e(n,a)),i}:function(n,a){const i=E.useRef();i.current||(i.current=e(n,a));const o=E.useRef(n),{instance:s}=i.current;return E.useEffect(function(){o.current!==n&&(t(s,n,o.current),o.current=n)},[s,n,a]),i}}function xZ(e,t){E.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var i;(i=t.layerContainer)==null||i.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function BSe(e){return function(r){const n=gw(),a=e(mw(r,n),n);return gZ(n.map,r.attribution),kP(a.current,r.eventHandlers),xZ(a.current,n),a}}function FSe(e,t){const r=E.useRef();E.useEffect(function(){if(t.pathOptions!==r.current){const a=t.pathOptions??{};e.instance.setStyle(a),r.current=a}},[e,t])}function VSe(e){return function(r){const n=gw(),a=e(mw(r,n),n);return kP(a.current,r.eventHandlers),xZ(a.current,n),FSe(a.current,r),a}}function _Z(e,t){const r=LP(e),n=zSe(r,t);return RSe(n)}function IP(e,t){const r=LP(e,t),n=VSe(r);return ESe(n)}function GSe(e,t){const r=LP(e,t),n=BSe(r);return OSe(n)}function HSe(e,t,r){const{opacity:n,zIndex:a}=t;n!=null&&n!==r.opacity&&e.setOpacity(n),a!=null&&a!==r.zIndex&&e.setZIndex(a)}function PP(){return gw().map}function USe(e){const t=PP();return E.useEffect(function(){return t.on(e),function(){t.off(e)}},[t,e]),t}const bZ=IP(function({center:t,children:r,...n},a){const i=new Mu.CircleMarker(t,n);return kv(i,NP(a,{overlayContainer:i}))},PSe);function xN(){return xN=Object.assign||function(e){for(var t=1;t(v==null?void 0:v.map)??null,[v]);const m=E.useCallback(x=>{if(x!==null&&v===null){const _=new Mu.Map(x,c);r!=null&&u!=null?_.setView(r,u):e!=null&&_.fitBounds(e,t),l!=null&&_.whenReady(l),g(jSe(_))}},[]);E.useEffect(()=>()=>{v==null||v.map.remove()},[v]);const y=v?bf.createElement(yZ,{value:v},n):o??null;return bf.createElement("div",xN({},f,{ref:m}),y)}const wZ=E.forwardRef(WSe),$Se=IP(function({positions:t,...r},n){const a=new Mu.Polyline(t,r);return kv(a,NP(n,{overlayContainer:a}))},function(t,r,n){r.positions!==n.positions&&t.setLatLngs(r.positions)}),ZSe=_Z(function(t,r){const n=new Mu.Popup(t,r.overlayContainer);return kv(n,r)},function(t,r,{position:n},a){E.useEffect(function(){const{instance:o}=t;function s(u){u.popup===o&&(o.update(),a(!0))}function l(u){u.popup===o&&a(!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,a,n])}),YSe=IP(function({bounds:t,...r},n){const a=new Mu.Rectangle(t,r);return kv(a,NP(n,{overlayContainer:a}))},function(t,r,n){r.bounds!==n.bounds&&t.setBounds(r.bounds)}),SZ=GSe(function({url:t,...r},n){const a=new Mu.TileLayer(t,mw(r,n));return kv(a,n)},function(t,r,n){HSe(t,r,n);const{url:a}=r;a!=null&&a!==n.url&&t.setUrl(a)}),XSe=_Z(function(t,r){const n=new Mu.Tooltip(t,r.overlayContainer);return kv(n,r)},function(t,r,{position:n},a){E.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(),a(!0))},u=c=>{c.tooltip===s&&a(!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,a,n])}),CZ="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=",TZ="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==",MZ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete yw.Icon.Default.prototype._getIconUrl;yw.Icon.Default.mergeOptions({iconUrl:CZ,iconRetinaUrl:TZ,shadowUrl:MZ});const UB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],qSe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function KSe(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function JSe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function QSe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function eCe({bounds:e}){const t=PP();return E.useEffect(()=>{e&&t.fitBounds(e,{padding:[50,50]})},[t,e]),null}function tCe({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 d.jsxs("div",{className:"min-w-[200px]",children:[d.jsx("div",{className:"font-semibold text-slate-800",children:e.short_name}),d.jsx("div",{className:"text-xs text-slate-600 mb-2",children:e.long_name}),d.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-xs",children:[d.jsx("div",{className:"text-slate-500",children:"Role"}),d.jsx("div",{className:"text-slate-700 font-medium",children:e.role}),d.jsx("div",{className:"text-slate-500",children:"Hardware"}),d.jsx("div",{className:"text-slate-700",children:e.hardware||"Unknown"}),d.jsx("div",{className:"text-slate-500",children:"Battery"}),d.jsx("div",{className:"text-slate-700",children:r}),d.jsx("div",{className:"text-slate-500",children:"Last Heard"}),d.jsx("div",{className:"text-slate-700",children:QSe(e.last_heard)})]}),t&&d.jsxs("div",{className:"mt-3 pt-2 border-t border-slate-200 flex gap-2",children:[d.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:[d.jsx(Jc,{size:10}),"Google Maps"]}),d.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:[d.jsx(Jc,{size:10}),"OSM"]})]})]})}function rCe({nodes:e,edges:t,selectedNodeId:r,onSelectNode:n}){const a=E.useMemo(()=>e.filter(h=>h.latitude!==null&&h.longitude!==null),[e]),i=e.length-a.length,o=E.useMemo(()=>new Map(a.map(h=>[h.node_num,h])),[a]),s=E.useMemo(()=>t.filter(h=>o.has(h.from_node)&&o.has(h.to_node)),[t,o]),l=E.useMemo(()=>{if(a.length===0)return null;const h=a.map(v=>v.latitude),f=a.map(v=>v.longitude);return[[Math.min(...h),Math.min(...f)],[Math.max(...h),Math.max(...f)]]},[a]),u=[43.6,-114.4],c=E.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 d.jsxs("div",{className:"relative bg-bg-card border border-border overflow-hidden",children:[d.jsxs(wZ,{center:u,zoom:7,style:{width:"100%",height:"540px"},className:"z-0",children:[d.jsx(SZ,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),d.jsx(eCe,{bounds:l}),s.map((h,f)=>{const v=o.get(h.from_node),g=o.get(h.to_node),m=r===null||h.from_node===r||h.to_node===r;return d.jsx($Se,{positions:[[v.latitude,v.longitude],[g.latitude,g.longitude]],color:KSe(h.snr),weight:m&&r!==null?2.5:1.5,opacity:r===null?.3:m?.6:.08},f)}),a.map(h=>{const f=h.node_num===r,v=c.has(h.node_num),g=r===null||f||v,m=qSe.includes(h.role),y=JSe(h.latitude),x=UB[y%UB.length];return d.jsxs(bZ,{center:[h.latitude,h.longitude],radius:m?8:5,fillColor:m?x:"#111827",fillOpacity:g?.9:.2,stroke:!0,color:f?"#ffffff":x,weight:f?3:m?0:2,opacity:g?1:.3,eventHandlers:{click:()=>n(f?null:h.node_num)},children:[d.jsx(XSe,{direction:"top",offset:[0,-8],children:d.jsx("span",{className:"font-mono text-xs",children:h.short_name})}),d.jsx(ZSe,{children:d.jsx(tCe,{node:h})})]},h.node_num)})]}),d.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:[d.jsx(av,{size:12}),d.jsxs("span",{children:["Showing ",a.length," of ",e.length," nodes",i>0&&d.jsxs("span",{className:"text-slate-500",children:[" (",i," without coordinates)"]})]})]})]})}const WB=["#3b82f6","#a78bfa","#06b6d4","#f59e0b","#22c55e","#ec4899","#8b5cf6","#14b8a6"],nCe=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function $B(e){return e>12?"#22c55e":e>8?"#4ade80":e>5?"#f59e0b":e>3?"#f97316":"#ef4444"}function aCe(e){return e>12?"excellent":e>8?"good":e>5?"fair":e>3?"marginal":"poor"}function iCe(e){return e===null||e>46?0:e>44.5?1:e>43?2:3}function oCe(e){return["Northern ID","Central ID","SW Idaho","SC Idaho"][e]||"Unknown"}function sCe(e){if(!e)return"Unknown";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function lCe(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 uCe({node:e,edges:t,nodes:r,onSelectNode:n}){const a=E.useMemo(()=>{if(!e)return[];const h=new Map(r.map(v=>[v.node_num,v])),f=[];return t.forEach(v=>{if(v.from_node===e.node_num){const g=h.get(v.to_node);g&&f.push({node:g,snr:v.snr,quality:v.quality})}else if(v.to_node===e.node_num){const g=h.get(v.from_node);g&&f.push({node:g,snr:v.snr,quality:v.quality})}}),f.sort((v,g)=>g.snr-v.snr)},[e,t,r]);if(!e)return d.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:[d.jsx("div",{className:"w-12 h-12 rounded-full bg-bg-hover border border-border flex items-center justify-center mb-3",children:d.jsx(bi,{size:24,className:"text-slate-500"})}),d.jsx("p",{className:"text-sm text-slate-500 text-center",children:"Click a node to inspect"})]});const i=nCe.includes(e.role),o=iCe(e.latitude),s=WB[o%WB.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 d.jsxs("div",{className:"w-[250px] flex-shrink-0 bg-bg-card border-l border-border flex flex-col h-[540px] overflow-hidden",children:[d.jsxs("div",{className:"p-4 border-b border-border",children:[d.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}),d.jsx("div",{className:"font-mono text-lg text-slate-100",children:e.short_name}),d.jsx("div",{className:"text-xs text-slate-500 truncate",children:e.long_name})]}),d.jsxs("div",{className:"p-4 border-b border-border grid grid-cols-2 gap-3",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Role"}),d.jsx("div",{className:`text-sm font-medium ${i?"text-accent":"text-slate-300"}`,children:e.role})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Region"}),d.jsx("div",{className:"text-sm text-slate-300",children:oCe(o)})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Battery"}),d.jsxs("div",{className:"text-sm text-slate-300 flex items-center gap-1",children:[c&&d.jsx(rM,{size:12,className:"text-amber-400"}),u]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Status"}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${lCe(e.last_heard)}`}),d.jsx("span",{className:"text-sm text-slate-300",children:sCe(e.last_heard)})]})]}),d.jsxs("div",{className:"col-span-2",children:[d.jsx("div",{className:"text-xs text-slate-500 mb-0.5",children:"Hardware"}),d.jsx("div",{className:"text-sm text-slate-300 font-mono truncate",children:e.hardware||"Unknown"})]})]}),l&&d.jsxs("div",{className:"px-4 py-3 border-b border-border flex gap-3",children:[d.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:[d.jsx(Jc,{size:10}),"Google Maps"]}),d.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:[d.jsx(Jc,{size:10}),"OSM"]})]}),d.jsxs("div",{className:"flex-1 overflow-y-auto",children:[d.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 (",a.length,")"]}),a.length>0?d.jsx("div",{className:"divide-y divide-border",children:a.map(h=>d.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:$B(h.snr)},children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm text-slate-200 font-mono truncate",children:h.node.short_name}),d.jsx("div",{className:"text-xs text-slate-500 truncate",children:h.node.long_name})]}),d.jsxs("div",{className:"text-right flex-shrink-0",children:[d.jsxs("div",{className:"text-xs font-mono",style:{color:$B(h.snr)},children:[h.snr.toFixed(1)," dB"]}),d.jsx("div",{className:"text-xs text-slate-500",children:aCe(h.snr)})]})]},h.node.node_num))}):d.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No known neighbors"})]})]})}const ZB=["ROUTER","ROUTER_LATE","REPEATER","TRACKER"];function cCe(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 hCe(e){if(!e)return"—";const t=new Date(e),n=new Date().getTime()-t.getTime(),a=Math.floor(n/6e4),i=Math.floor(n/36e5),o=Math.floor(n/864e5);return a<1?"Just now":a<60?`${a}m ago`:i<24?`${i}h ago`:`${o}d ago`}function dCe(e){return e.battery_level===null?"—":e.battery_level>100||e.voltage&&e.voltage>4.1?"USB ⚡":`${e.battery_level.toFixed(0)}%`}function YB(e){return e===null?"—":e>46?"Northern":e>44.5?"Central":e>43?"SW Idaho":"SC Idaho"}function fCe({nodes:e,selectedNodeId:t,onSelectNode:r}){const[n,a]=E.useState(""),[i,o]=E.useState("short_name"),[s,l]=E.useState("asc"),[u,c]=E.useState("all"),h=E.useMemo(()=>{let g=[...e];if(u==="infra"?g=g.filter(m=>ZB.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)||YB(y.latitude).toLowerCase().includes(m))}return g.sort((m,y)=>{let x="",_="";switch(i){case"short_name":x=m.short_name.toLowerCase(),_=y.short_name.toLowerCase();break;case"role":x=m.role,_=y.role;break;case"battery_level":x=m.battery_level??-1,_=y.battery_level??-1;break;case"last_heard":x=m.last_heard?new Date(m.last_heard).getTime():0,_=y.last_heard?new Date(y.last_heard).getTime():0;break;case"hardware":x=m.hardware.toLowerCase(),_=y.hardware.toLowerCase();break}return x<_?s==="asc"?-1:1:x>_?s==="asc"?1:-1:0}),g},[e,n,i,s,u]),f=g=>{i===g?l(s==="asc"?"desc":"asc"):(o(g),l("asc"))},v=({field:g})=>i!==g?null:s==="asc"?d.jsx(mJ,{size:14,className:"inline ml-1"}):d.jsx(Em,{size:14,className:"inline ml-1"});return d.jsxs("div",{className:"bg-bg-card border border-border overflow-hidden",children:[d.jsxs("div",{className:"p-3 border-b border-border flex items-center gap-3",children:[d.jsxs("div",{className:"relative flex-1 max-w-xs",children:[d.jsx(v1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),d.jsx("input",{type:"text",placeholder:"Search nodes...",value:n,onChange:g=>a(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"})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(RV,{size:14,className:"text-slate-500 mr-1"}),["all","infra","online"].map(g=>d.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))]}),d.jsxs("div",{className:"text-xs text-slate-500 ml-auto",children:[h.length," of ",e.length," nodes"]})]}),d.jsxs("div",{className:"overflow-x-auto",children:[d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-bg-hover text-slate-400 text-xs",children:[d.jsx("th",{className:"w-8 px-3 py-2"}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("short_name"),children:["Name ",d.jsx(v,{field:"short_name"})]}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("role"),children:["Role ",d.jsx(v,{field:"role"})]}),d.jsx("th",{className:"px-3 py-2 text-left",children:"Region"}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("battery_level"),children:[d.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"})," ",d.jsx(v,{field:"battery_level"})]}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("last_heard"),children:[d.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"})," ",d.jsx(v,{field:"last_heard"})]}),d.jsxs("th",{className:"px-3 py-2 text-left cursor-pointer hover:text-slate-200",onClick:()=>f("hardware"),children:["Hardware ",d.jsx(v,{field:"hardware"})]})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:h.slice(0,100).map(g=>{const m=ZB.includes(g.role),y=g.node_num===t;return d.jsxs("tr",{onClick:()=>r(g.node_num),className:`cursor-pointer transition-colors ${y?"bg-accent/10":"hover:bg-bg-hover"}`,children:[d.jsx("td",{className:"px-3 py-2",children:d.jsx("div",{className:`w-2 h-2 rounded-full ${cCe(g.last_heard)}`})}),d.jsxs("td",{className:"px-3 py-2",children:[d.jsx("div",{className:"font-mono text-slate-200",children:g.short_name}),d.jsx("div",{className:"text-xs text-slate-500 truncate max-w-[200px]",children:g.long_name})]}),d.jsx("td",{className:"px-3 py-2",children:d.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})}),d.jsx("td",{className:"px-3 py-2 text-slate-400",children:YB(g.latitude)}),d.jsx("td",{className:"px-3 py-2 font-mono text-slate-300",children:dCe(g)}),d.jsx("td",{className:"px-3 py-2 text-slate-400",children:hCe(g.last_heard)}),d.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&&d.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&&d.jsx("div",{className:"px-3 py-8 text-sm text-slate-500 text-center",children:"No nodes match your filters"})]})]})}function AZ(){const[e,t]=E.useState([]),[r,n]=E.useState([]),[a,i]=E.useState([]),[o,s]=E.useState(null),[l,u]=E.useState("topo"),[c,h]=E.useState(!0),[f,v]=E.useState(null);E.useEffect(()=>{document.title="Mesh — MeshAI",Promise.all([IJ(),PJ(),FJ()]).then(([y,x,_])=>{t(y),n(x),i(_),h(!1)}).catch(y=>{v(y.message),h(!1)})},[]);const g=E.useMemo(()=>e.find(y=>y.node_num===o)||null,[e,o]),m=E.useCallback(y=>{s(y)},[]);return c?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading mesh data..."})}):f?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsxs("div",{className:"text-red-400",children:["Error: ",f]})}):d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"text-sm text-slate-400",children:[e.length," nodes • ",r.length," edges"]}),d.jsxs("div",{className:"flex items-center bg-bg-card border border-border p-1",children:[d.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:[d.jsx(Sk,{size:14}),d.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"})]}),d.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:[d.jsx(BV,{size:14}),d.jsx("span",{title:"Nodes plotted by lat/lon on a basemap. Nodes without a reported position are clustered at the top edge.",children:"Geographic"})]})]})]}),d.jsxs("div",{className:"flex gap-0",children:[d.jsx("div",{className:"flex-1 min-w-0",children:l==="topo"?d.jsx(ISe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m}):d.jsx(rCe,{nodes:e,edges:r,selectedNodeId:o,onSelectNode:m})}),d.jsx(uCe,{node:g,edges:r,nodes:e,onSelectNode:m})]}),d.jsx(fCe,{nodes:e,selectedNodeId:o,onSelectNode:m})]})}function $p({envVar:e,label:t="API Key",helper:r="",info:n=""}){const[a,i]=E.useState(null),[o,s]=E.useState(""),[l,u]=E.useState(!1),[c,h]=E.useState(!1),[f,v]=E.useState(""),[g,m]=E.useState(""),y=async()=>{try{const w=await fetch("/api/secrets");if(w.ok){const C=(await w.json()).find(M=>M.env_var===e);i(C?C.is_set:!1)}}catch{i(!1)}};E.useEffect(()=>{y()},[e]);const x=async()=>{if(o.trim()){h(!0),m(""),v("");try{const w=await fetch("/api/secrets/"+encodeURIComponent(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:o})});if(w.ok)s(""),u(!1),v("Saved — restart required to take effect"),await y();else{const S=await w.text();m("Save failed: "+(S||String(w.status)))}}catch{m("Save failed: network error")}finally{h(!1)}}},_=a?"env set — enter a new value to change":"not set — enter a value";return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[t,a===null?d.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-slate-800 text-slate-500",children:"Loading"}):a?d.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-green-500/10 text-green-400",children:"Set"}):d.jsx("span",{className:"text-xs px-2 py-0.5 rounded ml-2 bg-slate-800 text-slate-500",children:"Not set"})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx("input",{type:l?"text":"password",value:o,onChange:w=>s(w.target.value),placeholder:_,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"}),d.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?d.jsx(h1,{size:16}):d.jsx(rv,{size:16})})]}),d.jsx("button",{type:"button",onClick:x,disabled:!o.trim()||c,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:c?"Saving…":"Save"})]}),r&&d.jsx("p",{className:"text-xs text-slate-600",children:r}),d.jsx("p",{className:"text-xs text-slate-600 font-mono",children:e}),f&&d.jsx("p",{className:"text-xs text-yellow-400",children:f}),g&&d.jsx("p",{className:"text-xs text-red-400",children:g})]})}function DP({label:e,value:t,onChange:r,helper:n,info:a,roleFilter:i,valueType:o="short_name"}){const[s,l]=E.useState([]),[u,c]=E.useState(!0),[h,f]=E.useState(""),[v,g]=E.useState(!1);E.useEffect(()=>{fetch("/api/nodes").then(S=>S.json()).then(S=>{l(S),c(!1)}).catch(()=>{l([]),c(!1)})},[]);const m=E.useMemo(()=>{let S=s;if(i&&(S=S.filter(C=>i==="ROUTER"||i==="infrastructure"?C.is_infrastructure||C.role==="ROUTER"||C.role==="ROUTER_CLIENT"||C.role==="REPEATER":C.role===i)),h.trim()){const C=h.toLowerCase();S=S.filter(M=>{var A,k,I,P;return((A=M.short_name)==null?void 0:A.toLowerCase().includes(C))||((k=M.long_name)==null?void 0:k.toLowerCase().includes(C))||((I=M.role)==null?void 0:I.toLowerCase().includes(C))||((P=M.node_id_hex)==null?void 0:P.toLowerCase().includes(C))})}return S.sort((C,M)=>(C.short_name||"").localeCompare(M.short_name||""))},[s,h,i]),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)}},x=S=>{const C=y(S);return t.includes(C)},_=S=>{const C=y(S);t.includes(C)?r(t.filter(M=>M!==C)):r([...t,C])},w=S=>{const C=[S.short_name];return S.long_name&&S.long_name!==S.short_name&&C.push(`— ${S.long_name}`),S.role&&C.push(`(${S.role})`),C.join(" ")};return!u&&s.length===0?d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),d.jsx("input",{type:"text",value:t.join(", "),onChange:S=>r(S.target.value.split(",").map(C=>C.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&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}):d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e}),t.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(S=>{const C=s.find(M=>y(M)===S);return d.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-accent/20 text-accent rounded text-sm",children:[C?C.short_name:S,d.jsx("button",{type:"button",onClick:()=>r(t.filter(M=>M!==S)),className:"hover:text-white",children:d.jsx(_u,{size:14})})]},S)})}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"relative",children:[d.jsx(v1,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),d.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"})]}),v&&!u&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1)}),d.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?d.jsx("div",{className:"p-3 text-sm text-slate-500 text-center",children:"No nodes found"}):m.map(S=>d.jsxs("button",{type:"button",onClick:()=>_(S),className:`w-full flex items-center gap-2 px-3 py-2 text-left text-sm hover:bg-[#1e2a3a] ${x(S)?"bg-accent/10":""}`,children:[d.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${x(S)?"bg-accent border-accent":"border-slate-600"}`,children:x(S)&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsx("span",{className:"text-slate-200",children:w(S)})]},S.node_num))})]})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function jP(e){const[t,r]=E.useState([]),[n,a]=E.useState(!0);E.useEffect(()=>{fetch("/api/channels").then(f=>f.json()).then(f=>{r(f),a(!1)}).catch(()=>{r([]),a(!1)})},[]);const i=f=>{const v=f.role==="PRIMARY"?"Primary":f.role==="SECONDARY"?"Secondary":"";return`${f.index}: ${f.name}${v?` (${v})`:""}`};if(!n&&t.length===0)return e.mode==="single"?d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),d.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&&d.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]}):d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:e.label}),d.jsx("input",{type:"text",value:e.value.join(", "),onChange:f=>{const v=f.target.value.split(",").map(g=>parseInt(g.trim())).filter(g=>!isNaN(g));e.onChange(v)},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&&d.jsx("p",{className:"text-xs text-slate-600",children:e.helper})]});if(e.mode==="single"){const{value:f,onChange:v,label:g,helper:m,includeDisabled:y}=e,x=t.filter(_=>_.enabled);return d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:g}),d.jsxs("select",{value:f,onChange:_=>v(Number(_.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&&d.jsx("option",{value:-1,children:"Disabled"}),x.map(_=>d.jsx("option",{value:_.index,children:i(_)},_.index))]}),m&&d.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(v=>v!==f)):s([...o,f].sort((v,g)=>v-g))};return d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:l}),d.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[c.map(f=>d.jsxs("label",{onClick:()=>h(f.index),className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17] cursor-pointer",children:[d.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)&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsx("span",{className:"text-sm text-slate-200",children:i(f)})]},f.index)),c.length===0&&d.jsx("div",{className:"text-sm text-slate-500 p-2",children:"No channels available"})]}),u&&d.jsx("p",{className:"text-xs text-slate-600",children:u})]})}function NZ({value:e,onChange:t,label:r="Serial Port",helper:n="Device path for your USB radio — click Detect to auto-fill a stable by-id path"}){const[a,i]=E.useState(null),[o,s]=E.useState(""),[l,u]=E.useState(!1),[c,h]=E.useState(null),f=async()=>{u(!0),h(null);try{const v=await kJ();i(v.ports),s(v.note||"")}catch(v){h(v instanceof Error?v.message:"Failed to list serial ports"),i([])}finally{u(!1)}};return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:r}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{type:"text",value:e,onChange:v=>t(v.target.value),placeholder:"/dev/serial/by-id/usb-... (or /dev/ttyACM0)",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-slate-600"}),d.jsxs("button",{type:"button",onClick:f,disabled:l,className:"flex items-center gap-2 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] hover:border-accent disabled:opacity-50 disabled:cursor-not-allowed rounded text-sm text-slate-300 whitespace-nowrap transition-colors",children:[d.jsx(Zi,{size:14,className:l?"animate-spin":""}),l?"Detecting...":"Detect USB devices"]})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}),c&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:c}),a!==null&&!c&&(a.length===0?d.jsx("div",{className:"text-sm text-slate-500 p-3 border border-[#1e2a3a] rounded",children:"No USB serial devices found — is the device passed through to the container?"}):d.jsx("div",{className:"border border-[#1e2a3a] rounded p-2 space-y-1",children:a.map(v=>{const g=e===v.stable_path,m=v.product||v.description||v.device;return d.jsxs("button",{type:"button",onClick:()=>t(v.stable_path),className:`w-full text-left flex items-start gap-2 p-2 rounded hover:bg-[#0a0e17] transition-colors ${g?"bg-[#0a0e17] ring-1 ring-accent":""}`,children:[d.jsx("div",{className:`mt-0.5 w-4 h-4 rounded-full border flex items-center justify-center flex-shrink-0 ${g?"bg-accent border-accent":"border-slate-600"}`,children:g&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-sm text-slate-200 truncate",children:m}),v.likely_radio&&d.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wide bg-accent/15 text-accent border border-accent/30 flex-shrink-0",children:[d.jsx(bi,{size:10})," likely radio"]})]}),d.jsx("div",{className:"text-xs text-slate-500 font-mono truncate",children:v.stable_path}),v.manufacturer&&d.jsx("div",{className:"text-xs text-slate-600 truncate",children:v.manufacturer})]})]},v.stable_path+v.device)})})),o&&d.jsx("p",{className:"text-xs text-slate-600 italic",children:o})]})}const Y2=[{key:"bot",label:"Bot",icon:_k},{key:"response",label:"Response",icon:wk},{key:"history",label:"History",icon:EV},{key:"memory",label:"Memory",icon:gJ},{key:"context",label:"Context",icon:rv},{key:"commands",label:"Commands",icon:UV},{key:"llm",label:"LLM",icon:jV},{key:"weather",label:"Weather",icon:kh},{key:"knowledge",label:"Knowledge",icon:LV},{key:"mesh_intelligence",label:"Intelligence",icon:Oo},{key:"dashboard",label:"Dashboard",icon:zV}],ba={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."},vCe=[{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:"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"}],pCe=[{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 Wi({info:e,link:t,linkText:r="Learn more"}){const[n,a]=E.useState(!1),i=E.useRef(null);return E.useEffect(()=>{if(!n)return;function o(l){i.current&&!i.current.contains(l.target)&&a(!1)}const s=setTimeout(()=>document.addEventListener("mousedown",o),0);return()=>{clearTimeout(s),document.removeEventListener("mousedown",o)}},[n]),d.jsxs("div",{className:"relative inline-block",ref:i,children:[d.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),a(!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&&d.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:[d.jsx("button",{type:"button",onClick:()=>a(!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:d.jsx(_u,{size:12})}),d.jsx("div",{className:"pr-4",children:e}),t&&d.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," ",d.jsx(Jc,{size:10})]})]})]})}function wa({text:e}){return d.jsx("p",{className:"text-sm text-slate-500 mb-6 pb-4 border-b border-[#1e2a3a]",children:e})}function gt({label:e,value:t,onChange:r,type:n="text",placeholder:a="",helper:i="",info:o="",infoLink:s=""}){const[l,u]=E.useState(!1),c=n==="password";return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&d.jsx(Wi,{info:o,link:s})]}),d.jsxs("div",{className:"relative",children:[d.jsx("input",{type:c&&!l?"password":"text",value:t,onChange:h=>r(h.target.value),placeholder: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 placeholder-slate-600"}),c&&d.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?d.jsx(h1,{size:16}):d.jsx(rv,{size:16})})]}),i&&d.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function Ne({label:e,value:t,onChange:r,min:n,max:a,step:i=1,helper:o="",info:s="",infoLink:l=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&d.jsx(Wi,{info:s,link:l})]}),d.jsx("input",{type:"number",value:t,onChange:u=>r(Number(u.target.value)),min:n,max:a,step: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"}),o&&d.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function qt({label:e,checked:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){return d.jsxs("div",{className:"flex items-center justify-between py-2",children:[d.jsxs("div",{children:[d.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,a&&d.jsx(Wi,{info:a,link:i})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}),d.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function jn({label:e,value:t,onChange:r,options:n,helper:a="",info:i="",infoLink:o=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&d.jsx(Wi,{info:i,link:o})]}),d.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=>d.jsx("option",{value:s.value,children:s.label},s.value))}),a&&d.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function gCe({label:e,value:t,onChange:r,rows:n=4,helper:a="",info:i="",infoLink:o=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&d.jsx(Wi,{info:i,link:o})]}),d.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"}),a&&d.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function Dn({label:e,value:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){const[o,s]=E.useState(t.join(", "));E.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>c.trim()).filter(Boolean);r(u)};return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Wi,{info:a,link:i})]}),d.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&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function X2({label:e,value:t,onChange:r,helper:n="",info:a="",infoLink:i=""}){const[o,s]=E.useState(t.join(", "));E.useEffect(()=>{s(t.join(", "))},[t]);const l=()=>{const u=o.split(",").map(c=>parseInt(c.trim(),10)).filter(c=>!isNaN(c));r(u)};return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Wi,{info:a,link:i})]}),d.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&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function Pn({label:e,description:t,checked:r,onChange:n,threshold:a,onThresholdChange:i,thresholdLabel:o,thresholdMin:s,thresholdMax:l,thresholdStep:u=1,thresholdSuffix:c=""}){return d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex-1",children:[d.jsx("span",{className:"text-sm text-slate-300",children:e}),d.jsx("p",{className:"text-xs text-slate-600",children:t})]}),d.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:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${r?"translate-x-5":""}`})})]}),r&&a!==void 0&&i&&d.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-[#1e2a3a]",children:[d.jsxs("span",{className:"text-xs text-slate-500",children:[o||"Threshold",":"]}),d.jsx("input",{type:"number",value:a,onChange:h=>i(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&&d.jsx("span",{className:"text-xs text-slate-500",children:c})]})]})}function mCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.bot}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{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."}),d.jsx(gt,{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."}),d.jsx(gt,{label:"Contact Email",value:e.contact_email||"",onChange:r=>t({...e,contact_email:r}),helper:"Used to synthesize the NWS User-Agent",info:"An email address identifying the operator; sent as the User-Agent when fetching NWS weather data (NWS requires a contact). Stored in local.yaml."})]}),d.jsx(qt,{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."}),d.jsx(qt,{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 yCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.connection}),d.jsx(jn,{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"?d.jsx(NZ,{label:"Serial Port",value:e.serial_port,onChange:r=>t({...e,serial_port:r}),helper:"Device path for your USB radio — Detect fills a stable by-id path"}):d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{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"}),d.jsx(Ne,{label:"TCP Port",value:e.tcp_port,onChange:r=>t({...e,tcp_port:r}),min:1,max:65535,helper:"Default 4403 for meshtasticd"})]}),d.jsx("div",{className:"pt-2",children:d.jsx(uf,{to:"/meshcore/connection",className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-accent transition-colors",children:"→ MeshCore connection"})})]})}function xCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.response}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{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."}),d.jsx(Ne,{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."})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{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."}),d.jsx(Ne,{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 _Ce({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.history}),d.jsx(gt,{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."}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{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."}),d.jsx(Ne,{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."})]}),d.jsx(qt,{label:"Auto Cleanup",checked:e.auto_cleanup,onChange:r=>t({...e,auto_cleanup:r}),helper:"Automatically prune old conversations"}),e.auto_cleanup&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Cleanup Interval (hours)",value:e.cleanup_interval_hours,onChange:r=>t({...e,cleanup_interval_hours:r}),min:1,helper:"Hours between cleanup runs"}),d.jsx(Ne,{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 bCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.memory}),d.jsx(qt,{label:"Enable Memory",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Keep conversation context between messages"}),e.enabled&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{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."}),d.jsx(Ne,{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 wCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.context}),d.jsx(qt,{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&&d.jsx(d.Fragment,{children:d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Chat context retention (days)",value:Math.round((e.max_age??1209600)/86400),onChange:r=>t({...e,max_age:r*86400}),min:1,helper:"How long the bot remembers recent channel chat for context (applies to both meshes). Default 14 days."}),d.jsx(Ne,{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 SCe({data:e,onChange:t}){const r=new Set(e.disabled_commands.map(s=>s.toLowerCase())),[n,a]=E.useState(()=>Object.entries(e.custom_commands||{}));E.useEffect(()=>{const s={};for(const[l,u]of n)l.trim()&&(s[l.trim()]=u);JSON.stringify(s)!==JSON.stringify(e.custom_commands||{})&&a(Object.entries(e.custom_commands||{}))},[e.custom_commands]);const i=s=>{a(s);const l={};for(const[u,c]of s)u.trim()&&(l[u.trim()]=c);t({...e,custom_commands:l})},o=s=>{const l=s.toLowerCase();r.has(l)?t({...e,disabled_commands:e.disabled_commands.filter(u=>u.toLowerCase()!==l)}):t({...e,disabled_commands:[...e.disabled_commands,s]})};return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.commands}),d.jsx(qt,{label:"Enable Commands",checked:e.enabled,onChange:s=>t({...e,enabled:s}),helper:"Allow !commands on the mesh"}),e.enabled&&d.jsxs(d.Fragment,{children:[d.jsx(gt,{label:"Command Prefix",value:e.prefix,onChange:s=>t({...e,prefix:s}),helper:"Character that triggers commands (e.g. ! for !help)",info:"Users type this character followed by the command name. Only single characters recommended."}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Available Commands",d.jsx(Wi,{info:"Toggle commands on or off. Disabled commands won't respond when users invoke them."})]}),d.jsx("div",{className:"grid gap-1",children:vCe.map(s=>{const l=!r.has(s.name.toLowerCase());return d.jsxs("div",{className:"flex items-center justify-between p-2 bg-[#0a0e17] border border-[#1e2a3a] rounded hover:border-[#2a3a4a] transition-colors",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("code",{className:"text-accent text-sm",children:["!",s.name]}),d.jsx("span",{className:"text-xs text-slate-500",children:s.description})]}),d.jsx("button",{type:"button",onClick:()=>o(s.name),className:`relative w-9 h-5 rounded-full transition-colors ${l?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${l?"translate-x-4":""}`})})]},s.name)})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Custom Commands",d.jsx(Wi,{info:"Define your own commands. When a user types the prefix followed by the name, the bot replies with the response text verbatim."})]}),n.map(([s,l],u)=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("input",{type:"text",value:s,onChange:c=>{const h=n.map((f,v)=>v===u?[c.target.value,f[1]]:f);i(h)},placeholder:"name",className:"w-40 flex-shrink-0 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"}),d.jsx("input",{type:"text",value:l,onChange:c=>{const h=n.map((f,v)=>v===u?[f[0],c.target.value]:f);i(h)},placeholder:"response text",className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsx("button",{type:"button",onClick:()=>i(n.filter((c,h)=>h!==u)),className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded flex-shrink-0","aria-label":"Remove custom command",children:d.jsx(ui,{size:14})})]},u)),d.jsxs("button",{type:"button",onClick:()=>i([...n,["",""]]),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:[d.jsx(li,{size:16})," Add Custom Command"]})]})]})]})}function CCe({data:e,onChange:t}){const r={openai:"OPENAI_API_KEY",anthropic:"ANTHROPIC_API_KEY",google:"GOOGLE_API_KEY"}[(e.backend||"").toLowerCase()]||"LLM_API_KEY";return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.llm}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(jn,{label:"Backend",value:e.backend,onChange:n=>t({...e,backend:n}),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."}),d.jsx(gt,{label:"Model",value:e.model,onChange:n=>t({...e,model:n}),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)."})]}),d.jsx($p,{envVar:r,label:"API Key",helper:"Secret stored in /data/secrets/.env; config holds the ${VAR} ref"}),d.jsx(gt,{label:"Base URL",value:e.base_url,onChange:n=>t({...e,base_url:n}),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."}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Timeout (sec)",value:e.timeout,onChange:n=>t({...e,timeout:n}),min:5,max:120,helper:"Maximum seconds to wait for response"}),d.jsx(Ne,{label:"Max Response Tokens",value:e.max_response_tokens,onChange:n=>t({...e,max_response_tokens:n}),min:100,helper:"Token limit for LLM responses"})]}),d.jsx(qt,{label:"Use System Prompt",checked:e.use_system_prompt,onChange:n=>t({...e,use_system_prompt:n}),helper:"Enable custom system instructions"}),e.use_system_prompt&&d.jsx(gCe,{label:"System Prompt",value:e.system_prompt,onChange:n=>t({...e,system_prompt:n}),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."}),d.jsx(qt,{label:"Web Search",checked:e.web_search,onChange:n=>t({...e,web_search:n}),helper:"Enable web search tool (Open WebUI feature)"}),d.jsx(qt,{label:"Google Grounding",checked:e.google_grounding,onChange:n=>t({...e,google_grounding:n}),helper:"Ground responses in web search (Gemini only)"})]})}function TCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.weather}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(jn,{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"}),d.jsx(jn,{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"})]}),d.jsx(gt,{label:"Default Location",value:e.default_location,onChange:r=>t({...e,default_location:r}),placeholder:"Your city, state",helper:"Location when none specified"}),d.jsx(gt,{label:"Open-Meteo base URL (advanced)",value:e.openmeteo.url,onChange:r=>t({...e,openmeteo:{...e.openmeteo,url:r}}),placeholder:"https://api.open-meteo.com/v1",helper:"Override the Open-Meteo API endpoint (leave default unless self-hosting)"}),d.jsx(gt,{label:"wttr.in base URL (advanced)",value:e.wttr.url,onChange:r=>t({...e,wttr:{...e.wttr,url:r}}),placeholder:"https://wttr.in",helper:"Override the wttr.in endpoint (leave default unless self-hosting)"})]})}function MCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.meshmonitor}),d.jsx(qt,{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&&d.jsxs(d.Fragment,{children:[d.jsx(gt,{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."}),d.jsx(qt,{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."}),d.jsx(Ne,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:r=>t({...e,refresh_interval:r}),min:10,helper:"How often to fetch patterns"}),d.jsx(qt,{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 ACe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.knowledge}),d.jsx(qt,{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&&d.jsxs(d.Fragment,{children:[d.jsx(jn,{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")&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{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."}),d.jsx(Ne,{label:"Qdrant Port",value:e.qdrant_port,onChange:r=>t({...e,qdrant_port:r}),helper:"Default 6333"})]}),d.jsx(gt,{label:"Collection",value:e.qdrant_collection,onChange:r=>t({...e,qdrant_collection:r}),helper:"Qdrant collection name"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{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."}),d.jsx(Ne,{label:"TEI Port",value:e.tei_port,onChange:r=>t({...e,tei_port:r}),helper:"Default 8090"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{label:"Sparse Host",value:e.sparse_host,onChange:r=>t({...e,sparse_host:r}),placeholder:"localhost",helper:"SPLADE sparse-embedding service host",info:"Host of the SPLADE service that generates sparse (keyword-weighted) embeddings for hybrid search."}),d.jsx(Ne,{label:"Sparse Port",value:e.sparse_port,onChange:r=>t({...e,sparse_port:r}),helper:"Default 8091"})]}),d.jsx(qt,{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."})]}),d.jsx(gt,{label:"SQLite DB Path",value:e.db_path,onChange:r=>t({...e,db_path:r}),helper:"Local knowledge database file"}),d.jsx(Ne,{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 NCe({source:e,onChange:t,onDelete:r}){const[n,a]=E.useState(!1),i={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 d.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>a(!n),children:[d.jsxs("div",{className:"flex items-center gap-3",children:[n?d.jsx(Em,{size:16}):d.jsx(Ah,{size:16}),d.jsx("div",{className:`w-2 h-2 rounded-full ${e.enabled?"bg-green-500":"bg-slate-500"}`}),d.jsx("span",{className:"font-mono text-sm text-slate-200",children:e.name||"Unnamed Source"}),d.jsx("span",{className:"text-xs text-slate-500 bg-[#1e2a3a] px-2 py-0.5 rounded",children:e.type})]}),d.jsx("button",{onClick:o=>{o.stopPropagation(),r()},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:d.jsx(ui,{size:14})})]}),n&&d.jsxs("div",{className:"p-4 space-y-4 border-t border-[#1e2a3a]",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{label:"Name",value:e.name,onChange:o=>t({...e,name:o}),helper:"Friendly name for this source"}),d.jsx(jn,{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:i[e.type]||""})]}),e.type!=="mqtt"&&d.jsx(gt,{label:"URL",value:e.url,onChange:o=>t({...e,url:o}),helper:"Full URL including protocol"}),e.type==="meshmonitor"&&d.jsx(gt,{label:"API Token",value:e.api_token,onChange:o=>t({...e,api_token:o}),type:"password",helper:"Bearer token for authentication"}),e.type==="mqtt"&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{label:"Host",value:e.host||"",onChange:o=>t({...e,host:o}),helper:"MQTT broker hostname"}),d.jsx(Ne,{label:"Port",value:e.port||1883,onChange:o=>t({...e,port:o}),min:1,max:65535,helper:"1883 plain, 8883 TLS"})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{label:"Username",value:e.username||"",onChange:o=>t({...e,username:o})}),d.jsx(gt,{label:"Password",value:e.password||"",onChange:o=>t({...e,password:o}),type:"password"})]}),d.jsx(gt,{label:"Topic Root",value:e.topic_root||"msh/US",onChange:o=>t({...e,topic_root:o}),helper:"Base topic to subscribe to"}),d.jsx(qt,{label:"Use TLS",checked:e.use_tls||!1,onChange:o=>t({...e,use_tls:o}),helper:"Encrypt MQTT connection"})]}),d.jsx(Ne,{label:"Refresh Interval (sec)",value:e.refresh_interval,onChange:o=>t({...e,refresh_interval:o}),min:10,helper:"Polling frequency"}),d.jsx(qt,{label:"Enabled",checked:e.enabled,onChange:o=>t({...e,enabled:o})}),d.jsx(qt,{label:"Polite Mode",checked:e.polite_mode,onChange:o=>t({...e,polite_mode:o}),helper:"Reduce polling for shared instances"})]})]})}function kCe({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 d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.mesh_sources}),e.map((n,a)=>d.jsx(NCe,{source:n,onChange:i=>{const o=[...e];o[a]=i,t(o)},onDelete:()=>{confirm(`Delete source "${n.name}"?`)&&t(e.filter((i,o)=>o!==a))}},a)),d.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:[d.jsx(li,{size:16})," Add Source"]})]})}function kZ({data:e,onChange:t}){const[r,n]=E.useState(null);return d.jsxs("div",{className:"space-y-6",children:[d.jsx(wa,{text:ba.mesh_intelligence}),d.jsx(qt,{label:"Enable Mesh Intelligence",checked:e.enabled,onChange:a=>t({...e,enabled:a}),helper:"Activate health scoring and alerting"}),e.enabled&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Locality Radius (miles)",value:e.locality_radius_miles,onChange:a=>t({...e,locality_radius_miles:a}),min:1,step:.5,helper:"Region assignment radius",info:"Nodes within this distance of a region anchor point are assigned to that region."}),d.jsx(Ne,{label:"Offline Threshold (hours)",value:e.offline_threshold_hours,onChange:a=>t({...e,offline_threshold_hours:a}),min:1,helper:"Time until node marked offline",info:"A node is considered offline after not being heard for this many hours."})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Packet Threshold",value:e.packet_threshold,onChange:a=>t({...e,packet_threshold:a}),min:0,helper:"Min packets per 24h to flag",info:"Minimum packets per 24 hours. Nodes below this are flagged as low activity."}),d.jsx(Ne,{label:"Battery Warning %",value:e.battery_warning_percent,onChange:a=>t({...e,battery_warning_percent:a}),min:1,max:100,helper:"Global battery warning level"})]}),d.jsx(DP,{label:"Critical Nodes",value:e.critical_nodes,onChange:a=>t({...e,critical_nodes:a}),helper:"Critical infrastructure nodes",info:"Nodes that get priority alerting when they go offline.",roleFilter:"infrastructure"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(jP,{label:"Alert Channel",value:e.alert_channel,onChange:a=>t({...e,alert_channel:a}),helper:"Channel for broadcast alerts",info:"Meshtastic channel for broadcast alerts. Select Disabled to turn off channel broadcasting.",mode:"single",includeDisabled:!0}),d.jsx(Ne,{label:"Alert Cooldown (min)",value:e.alert_cooldown_minutes,onChange:a=>t({...e,alert_cooldown_minutes:a}),min:1,helper:"Min time between repeat alerts",info:"Minimum minutes between repeated alerts for the same condition. Uses scaling cooldown (12h, 24h, 48h)."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Regions",d.jsx(Wi,{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((a,i)=>d.jsxs("div",{className:"border border-[#1e2a3a] overflow-hidden",children:[d.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#0a0e17] cursor-pointer",onClick:()=>n(r===i?null:i),children:[d.jsxs("div",{className:"flex items-center gap-3",children:[r===i?d.jsx(Em,{size:16}):d.jsx(Ah,{size:16}),d.jsx("span",{className:"font-medium text-slate-200",children:a.name||"Unnamed Region"}),d.jsx("span",{className:"text-xs text-slate-500",children:a.local_name})]}),d.jsx("button",{onClick:o=>{if(o.stopPropagation(),confirm(`Delete region "${a.name||"Unnamed Region"}"?`)){const s=e.regions.filter((l,u)=>u!==i);t({...e,regions:s})}},className:"p-1 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded",children:d.jsx(ui,{size:14})})]}),r===i&&d.jsxs("div",{className:"p-4 space-y-3 border-t border-[#1e2a3a]",children:[d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{label:"Name",value:a.name,onChange:o=>{const s=[...e.regions];s[i]={...a,name:o},t({...e,regions:s})}}),d.jsx(gt,{label:"Local Name",value:a.local_name,onChange:o=>{const s=[...e.regions];s[i]={...a,local_name:o},t({...e,regions:s})}})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Latitude",value:a.lat,onChange:o=>{const s=[...e.regions];s[i]={...a,lat:o},t({...e,regions:s})},step:1e-4}),d.jsx(Ne,{label:"Longitude",value:a.lon,onChange:o=>{const s=[...e.regions];s[i]={...a,lon:o},t({...e,regions:s})},step:1e-4})]}),d.jsx(gt,{label:"Description",value:a.description,onChange:o=>{const s=[...e.regions];s[i]={...a,description:o},t({...e,regions:s})}}),d.jsx(Dn,{label:"Aliases",value:a.aliases,onChange:o=>{const s=[...e.regions];s[i]={...a,aliases:o},t({...e,regions:s})}}),d.jsx(Dn,{label:"Cities",value:a.cities,onChange:o=>{const s=[...e.regions];s[i]={...a,cities:o},t({...e,regions:s})}})]})]},i)),d.jsxs("button",{onClick:()=>{const a={name:"",local_name:"",lat:0,lon:0,description:"",aliases:[],cities:[]};t({...e,regions:[...e.regions,a]}),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:[d.jsx(li,{size:16})," Add Region"]})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Alert Rules",d.jsx(Wi,{info:"Configure which conditions trigger alerts. Each rule can have an optional threshold value."})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Infrastructure"}),d.jsx(Pn,{label:"Infra Offline",description:"Alert when an infrastructure node (router/repeater) goes offline",checked:e.alert_rules.infra_offline,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_offline:a}})}),d.jsx(Pn,{label:"Infra Recovery",description:"Alert when an offline infrastructure node comes back online",checked:e.alert_rules.infra_recovery,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_recovery:a}})}),d.jsx(Pn,{label:"New Router",description:"Alert when a new router/repeater appears on the mesh",checked:e.alert_rules.new_router,onChange:a=>t({...e,alert_rules:{...e.alert_rules,new_router:a}})}),d.jsx(Pn,{label:"Feeder Offline",description:"Alert when a data source (MeshView/MeshMonitor) stops responding",checked:e.alert_rules.feeder_offline,onChange:a=>t({...e,alert_rules:{...e.alert_rules,feeder_offline:a}})}),d.jsx(Pn,{label:"Single Gateway",description:"Alert when an infrastructure node has only one connection path",checked:e.alert_rules.infra_single_gateway,onChange:a=>t({...e,alert_rules:{...e.alert_rules,infra_single_gateway:a}})}),d.jsx(Pn,{label:"Region Blackout",description:"Alert when all infrastructure in a region goes offline",checked:e.alert_rules.region_total_blackout,onChange:a=>t({...e,alert_rules:{...e.alert_rules,region_total_blackout:a}})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Power"}),d.jsx(Pn,{label:"Battery Warning",description:"Alert when infra node battery drops below warning threshold",checked:e.alert_rules.battery_warning,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_warning:a}}),threshold:e.alert_rules.battery_warning_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_warning_threshold:a}}),thresholdLabel:"Below",thresholdMin:10,thresholdMax:90,thresholdSuffix:"%"}),d.jsx(Pn,{label:"Battery Critical",description:"Alert at critical battery level",checked:e.alert_rules.battery_critical,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_critical:a}}),threshold:e.alert_rules.battery_critical_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_critical_threshold:a}}),thresholdLabel:"Below",thresholdMin:5,thresholdMax:50,thresholdSuffix:"%"}),d.jsx(Pn,{label:"Battery Emergency",description:"Alert at emergency battery level",checked:e.alert_rules.battery_emergency,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_emergency:a}}),threshold:e.alert_rules.battery_emergency_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_emergency_threshold:a}}),thresholdLabel:"Below",thresholdMin:1,thresholdMax:25,thresholdSuffix:"%"}),d.jsx(Pn,{label:"Battery Trend Declining",description:"Alert when battery shows a declining trend over 7 days",checked:e.alert_rules.battery_trend_declining,onChange:a=>t({...e,alert_rules:{...e.alert_rules,battery_trend_declining:a}})}),d.jsx(Pn,{label:"Power Source Change",description:"Alert when a node switches between battery and USB power",checked:e.alert_rules.power_source_change,onChange:a=>t({...e,alert_rules:{...e.alert_rules,power_source_change:a}})}),d.jsx(Pn,{label:"Solar Not Charging",description:"Alert when a solar-powered node isn't charging during daylight",checked:e.alert_rules.solar_not_charging,onChange:a=>t({...e,alert_rules:{...e.alert_rules,solar_not_charging:a}})})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Utilization"}),d.jsx(Pn,{label:"High Utilization",description:"Alert when channel utilization stays high for extended periods",checked:e.alert_rules.sustained_high_util,onChange:a=>t({...e,alert_rules:{...e.alert_rules,sustained_high_util:a}}),threshold:e.alert_rules.high_util_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,high_util_threshold:a}}),thresholdLabel:"Above",thresholdMin:5,thresholdMax:50,thresholdSuffix:`% for ${e.alert_rules.high_util_hours}h`}),e.alert_rules.sustained_high_util&&d.jsx("div",{className:"pl-3",children:d.jsx(Ne,{label:"High-Util Window (hours)",value:e.alert_rules.high_util_hours,onChange:a=>t({...e,alert_rules:{...e.alert_rules,high_util_hours:a}}),min:1,helper:"Sustained duration above the utilization threshold before alerting"})}),d.jsx(Pn,{label:"Packet Flood",description:"Alert when a single node sends excessive packets",checked:e.alert_rules.packet_flood,onChange:a=>t({...e,alert_rules:{...e.alert_rules,packet_flood:a}}),threshold:e.alert_rules.packet_flood_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,packet_flood_threshold:a}}),thresholdLabel:"Over",thresholdMin:100,thresholdMax:2e3,thresholdSuffix:"pkts/24h"})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h4",{className:"text-xs text-slate-400 font-medium",children:"Health Scores"}),d.jsx(Pn,{label:"Mesh Score Alert",description:"Alert when overall mesh health score drops below threshold",checked:e.alert_rules.mesh_score_alert,onChange:a=>t({...e,alert_rules:{...e.alert_rules,mesh_score_alert:a}}),threshold:e.alert_rules.mesh_score_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,mesh_score_threshold:a}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"}),d.jsx(Pn,{label:"Region Score Alert",description:"Alert when a region's health score drops below threshold",checked:e.alert_rules.region_score_alert,onChange:a=>t({...e,alert_rules:{...e.alert_rules,region_score_alert:a}}),threshold:e.alert_rules.region_score_threshold,onThresholdChange:a=>t({...e,alert_rules:{...e.alert_rules,region_score_threshold:a}}),thresholdLabel:"Below",thresholdMin:30,thresholdMax:90,thresholdSuffix:"/100"})]})]})]})]})}function LCe({data:e,onChange:t}){return d.jsxs("div",{className:"space-y-4",children:[d.jsx(wa,{text:ba.dashboard}),d.jsx(qt,{label:"Enable Dashboard",checked:e.enabled,onChange:r=>t({...e,enabled:r}),helper:"Run the web dashboard"}),e.enabled&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{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."}),d.jsx(Ne,{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 ICe({timezone:e,onSave:t}){const[r,n]=E.useState(e);return E.useEffect(()=>{n(e)},[e]),d.jsxs("div",{className:"space-y-4 mb-6 pb-6 border-b border-[#1e2a3a]",children:[d.jsx("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:"General"}),d.jsx(gt,{label:"Timezone",value:r,onChange:a=>{n(a),t(a)},placeholder:"America/Boise",helper:"Global IANA timezone, e.g. America/Boise",info:"Global IANA timezone used for local time display across MeshAI. Saved immediately."})]})}function PCe(){var z;const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState("bot"),[s]=hJ();E.useEffect(()=>{const D=s.get("section");D&&Y2.some(B=>B.key===D)&&o(D)},[s]);const[l,u]=E.useState(!0),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(null),[y,x]=E.useState(!1),[_,w]=E.useState(!1),S=E.useCallback(async()=>{try{const D=await fetch("/api/config");if(!D.ok)throw new Error("Failed to fetch config");const B=await D.json();r(B),a(JSON.parse(JSON.stringify(B))),w(!1),v(null)}catch(D){v(D instanceof Error?D.message:"Unknown error")}finally{u(!1)}},[]);E.useEffect(()=>{document.title="Config — MeshAI",S()},[S]),E.useEffect(()=>{t&&n&&w(JSON.stringify(t)!==JSON.stringify(n))},[t,n]),E.useEffect(()=>(e(_),()=>e(!1)),[_,e]);const C=async()=>{if(t){h(!0),v(null),m(null);try{const D=t[i],B=await fetch(`/api/config/${i}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)}),H=await B.json();if(!B.ok)throw new Error(H.detail||"Save failed");m(`${i} saved successfully`),a(JSON.parse(JSON.stringify(t))),w(!1),e(!1),H.restart_required&&(x(!0),bu(Array.isArray(H.changed_keys)?H.changed_keys:[])),setTimeout(()=>m(null),3e3)}catch(D){v(D instanceof Error?D.message:"Save failed")}finally{h(!1)}}},M=()=>{n&&(r(JSON.parse(JSON.stringify(n))),w(!1))},A=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{v("Restart failed")}},k=(D,B)=>{t&&r({...t,[D]:B})},I=async D=>{try{const B=await fetch("/api/config/timezone",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)}),H=await B.json();if(!B.ok)throw new Error(H.detail||"Save failed");r(V=>V&&{...V,timezone:D}),a(V=>V&&{...V,timezone:D})}catch(B){v(B instanceof Error?B.message:"Timezone save failed")}};if(l)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading configuration..."})});if(!t)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load configuration"})});const P=()=>{switch(i){case"bot":return d.jsxs(d.Fragment,{children:[d.jsx(ICe,{timezone:t.timezone,onSave:I}),d.jsx(mCe,{data:t.bot,onChange:D=>k("bot",D)})]});case"response":return d.jsx(xCe,{data:t.response,onChange:D=>k("response",D)});case"history":return d.jsx(_Ce,{data:t.history,onChange:D=>k("history",D)});case"memory":return d.jsx(bCe,{data:t.memory,onChange:D=>k("memory",D)});case"context":return d.jsx(wCe,{data:t.context,onChange:D=>k("context",D)});case"commands":return d.jsx(SCe,{data:t.commands,onChange:D=>k("commands",D)});case"llm":return d.jsx(CCe,{data:t.llm,onChange:D=>k("llm",D)});case"weather":return d.jsx(TCe,{data:t.weather,onChange:D=>k("weather",D)});case"knowledge":return d.jsx(ACe,{data:t.knowledge,onChange:D=>k("knowledge",D)});case"mesh_intelligence":return d.jsx(kZ,{data:t.mesh_intelligence,onChange:D=>k("mesh_intelligence",D)});case"dashboard":return d.jsx(LCe,{data:t.dashboard,onChange:D=>k("dashboard",D)});default:return null}},j=((z=Y2.find(D=>D.key===i))==null?void 0:z.label)||i;return d.jsxs("div",{className:"flex gap-6 h-[calc(100vh-8rem)]",children:[d.jsx("div",{className:"w-48 flex-shrink-0 space-y-1",children:Y2.map(({key:D,label:B,icon:H})=>d.jsxs("button",{onClick:()=>o(D),className:`w-full flex items-center gap-2 px-3 py-2 rounded text-sm transition-colors ${i===D?"bg-accent text-white":"text-slate-400 hover:text-slate-200 hover:bg-bg-hover"}`,children:[d.jsx(H,{size:16}),d.jsx("span",{children:B}),_&&i===D&&d.jsx("span",{className:"ml-auto w-2 h-2 bg-amber-500 rounded-full"})]},D))}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[d.jsxs("div",{className:"flex items-center justify-between mb-6",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(VV,{size:20,className:"text-slate-500"}),d.jsx("h2",{className:"text-lg font-semibold text-slate-200",children:j})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[_&&d.jsxs("button",{onClick:M,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:[d.jsx(xa,{size:14}),"Discard"]}),d.jsxs("button",{onClick:C,disabled:c||!_,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:[c?d.jsx(Zi,{size:14,className:"animate-spin"}):d.jsx(_a,{size:14}),"Save"]})]})]}),y&&d.jsxs("div",{className:"flex items-center justify-between p-3 mb-4 bg-amber-500/10 border border-amber-500/30",children:[d.jsxs("div",{className:"flex items-center gap-2 text-amber-400",children:[d.jsx(pi,{size:16}),d.jsx("span",{className:"text-sm",children:"Restart required for changes to take effect"})]}),d.jsx("button",{onClick:A,className:"px-3 py-1 text-sm bg-amber-500 text-white rounded hover:bg-amber-600 transition-colors",children:"Restart Now"})]}),f&&d.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:[d.jsx(_u,{size:16}),d.jsx("span",{className:"text-sm",children:f})]}),g&&d.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:[d.jsx(Yr,{size:16}),d.jsx("span",{className:"text-sm",children:g})]}),d.jsx("div",{className:"flex-1 overflow-y-auto pr-2",children:d.jsx("div",{className:"bg-bg-card border border-border p-6",children:P()})})]})]})}const DCe=["mesh_broadcast","mesh_dm"],jCe=["meshcore_broadcast","meshcore_dm"],ECe=["routine","priority","immediate"];function Yo({info:e}){const[t,r]=E.useState(!1);return d.jsxs("div",{className:"relative inline-block",children:[d.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&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),d.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 RCe({label:e,value:t,onChange:r,type:n="text",placeholder:a="",helper:i="",info:o=""}){const[s,l]=E.useState(!1),u=n==="password";return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,o&&d.jsx(Yo,{info:o})]}),d.jsxs("div",{className:"relative",children:[d.jsx("input",{type:u&&!s?"password":"text",value:t,onChange:c=>r(c.target.value),placeholder: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 placeholder-slate-600"}),u&&d.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?d.jsx(h1,{size:16}):d.jsx(rv,{size:16})})]}),i&&d.jsx("p",{className:"text-xs text-slate-600",children:i})]})}function qf({label:e,value:t,onChange:r,min:n,max:a,step:i=1,helper:o="",info:s=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,s&&d.jsx(Yo,{info:s})]}),d.jsx("input",{type:"number",value:t,onChange:l=>r(Number(l.target.value)),min:n,max:a,step: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"}),o&&d.jsx("p",{className:"text-xs text-slate-600",children:o})]})}function Ch({label:e,checked:t,onChange:r,helper:n="",info:a=""}){return d.jsxs("div",{className:"flex items-center justify-between py-2",children:[d.jsxs("div",{children:[d.jsxs("span",{className:"flex items-center text-sm text-slate-300",children:[e,a&&d.jsx(Yo,{info:a})]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]}),d.jsx("button",{type:"button",onClick:()=>r(!t),className:`relative w-11 h-6 rounded-full transition-colors ${t?"bg-accent":"bg-[#1e2a3a]"}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t?"translate-x-5":""}`})})]})}function q2({label:e,value:t,onChange:r,helper:n="",info:a=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Yo,{info:a})]}),d.jsx("input",{type:"time",value:t,onChange:i=>r(i.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&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}function LZ({label:e,value:t,onChange:r,placeholder:n="Add item...",helper:a="",info:i=""}){const[o,s]=E.useState(""),l=()=>{o.trim()&&!t.includes(o.trim())&&(r([...t,o.trim()]),s(""))},u=c=>{r(t.filter((h,f)=>f!==c))};return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,i&&d.jsx(Yo,{info:i})]}),d.jsxs("div",{className:"flex gap-2",children:[d.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}),d.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:d.jsx(li,{size:16})})]}),t.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:t.map((c,h)=>d.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-[#1e2a3a] rounded text-sm text-slate-300",children:[c,d.jsx("button",{type:"button",onClick:()=>u(h),className:"text-slate-500 hover:text-red-400",children:d.jsx(_u,{size:14})})]},h))}),a&&d.jsx("p",{className:"text-xs text-slate-600",children:a})]})}function IZ({channels:e,severityChannels:t,onChange:r}){const n=a=>a.replace("meshcore_","mc_").replace("mesh_","").replace(/_/g," ");return d.jsxs("table",{className:"text-xs w-full",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{className:"text-left text-slate-600 font-normal w-20",children:"severity"}),e.map(a=>d.jsx("th",{className:"text-slate-500 font-normal px-1 whitespace-nowrap",children:n(a)},a))]})}),d.jsx("tbody",{children:ECe.map(a=>d.jsxs("tr",{children:[d.jsx("td",{className:"text-slate-400 pr-2 whitespace-nowrap",children:a}),e.map(i=>{const o=(t[a]||[]).includes(i);return d.jsx("td",{className:"text-center",children:d.jsx("input",{type:"checkbox",checked:o,onChange:s=>{const l={...t},u=new Set(l[a]||[]);s.target.checked?u.add(i):u.delete(i),l[a]=Array.from(u),r(l)}})},i)})]},a))})]})}const fu=[{key:"mesh_health",label:"Mesh Health",Icon:Oo},{key:"weather",label:"Weather",Icon:kh},{key:"fire",label:"Fire",Icon:Rm},{key:"emergency",label:"Emergency",Icon:Ck},{key:"rf_propagation",label:"RF Propagation",Icon:bi},{key:"roads",label:"Roads",Icon:u1},{key:"avalanche",label:"Avalanche",Icon:GV},{key:"satpass",label:"Satellite Passes",Icon:f1},{key:"seismic",label:"Seismic",Icon:kf},{key:"tracking",label:"Tracking",Icon:av}];function OCe(e){const t=new Set(fu.map(n=>n.key)),r=[];for(const n of e)!n||!n.key||t.has(n.key)||(t.add(n.key),r.push({key:n.key,label:n.label||n.key,Icon:OV}));return[...fu,...r]}let lx=null,K2=null;function PZ(){const[e,t]=E.useState(lx??fu);return E.useEffect(()=>{let r=!1;if(lx){t(lx);return}return K2||(K2=fetch("/api/notifications/families").then(n=>n.ok?n.json():[]).then(n=>{const a=OCe(Array.isArray(n)?n:[]);return lx=a,a}).catch(()=>fu)),K2.then(n=>{r||t(n)}),()=>{r=!0}},[]),e}function zCe(e,t,r){const n=e?{...e}:{...t,name:r};n.name=t.name||n.name||r;const a=(e==null?void 0:e.severity_channels)||{},i=t.severity_channels||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};return o.forEach(l=>{const u=(a[l]||[]).filter(h=>h.startsWith("meshcore_")),c=(i[l]||[]).filter(h=>!h.startsWith("meshcore_"));s[l]=[...u,...c]}),n.severity_channels=s,n.broadcast_channel=t.broadcast_channel,n.node_ids=t.node_ids,n}function BCe(e,t){const r=(t==null?void 0:t.mt_enabled)??(t==null?void 0:t.enabled)??!1,n=(e==null?void 0:e.mc_enabled)??!1,a=(e==null?void 0:e.cells)||{},i=(t==null?void 0:t.cells)||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};for(const l of o){const u=a[l]||{},c=i[l]||{},h=new Set([...Object.keys(u),...Object.keys(c)]),f={};for(const v of h){const g=u[v],m=c[v],y={mt:m!==void 0?m.mt:(g==null?void 0:g.mt)??null,mc:(g==null?void 0:g.mc)??null,min_severity:(m==null?void 0:m.min_severity)??(g==null?void 0:g.min_severity)??"routine",enabled:(m==null?void 0:m.enabled)??(g==null?void 0:g.enabled)??!0},x=y.mc;(y.mt!==null||x!==null&&x.trim()!=="")&&(f[v]=y)}Object.keys(f).length>0&&(s[l]=f)}return{mt_enabled:r,mc_enabled:n,cells:s}}function FCe({toggles:e,onChange:t,regions:r,regionRoutes:n,onRegionRoutesChange:a}){const i=PZ(),o=(h,f)=>t({...e,[h]:{...e[h]||{},...f}}),[s,l]=E.useState({}),u=(h,f,v)=>{var y,x,_;const g=((x=(y=n==null?void 0:n.cells)==null?void 0:y[h])==null?void 0:x[f])??{mt:null,mc:null,min_severity:"routine",enabled:!0},m={...(n==null?void 0:n.cells)||{},[h]:{...((_=n==null?void 0:n.cells)==null?void 0:_[h])||{},[f]:{...g,mt:v}}};a({mt_enabled:(n==null?void 0:n.mt_enabled)??(n==null?void 0:n.enabled)??!1,mc_enabled:(n==null?void 0:n.mc_enabled)??!1,cells:m})},c=h=>{var m;const f=((m=n==null?void 0:n.cells)==null?void 0:m[h])||{},v={};for(const[y,x]of Object.entries(f))v[y]={...x,mt:null};const g={...(n==null?void 0:n.cells)||{},[h]:v};a({mt_enabled:(n==null?void 0:n.mt_enabled)??(n==null?void 0:n.enabled)??!1,mc_enabled:(n==null?void 0:n.mc_enabled)??!1,cells:g})};return d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Meshtastic Delivery",d.jsx(Yo,{info:"Per-family Meshtastic delivery matrix. Choose which channels fire at each severity, the broadcast channel index, and DM node IDs. Family on/off and severity threshold are configured on the Data Feeds page."})]}),d.jsx("div",{className:"border border-[#1e2a3a] p-3",children:d.jsx(Ch,{label:"Enable Meshtastic region routing",checked:(n==null?void 0:n.mt_enabled)??(n==null?void 0:n.enabled)??!1,onChange:h=>a({mt_enabled:h,mc_enabled:(n==null?void 0:n.mc_enabled)??!1,cells:(n==null?void 0:n.cells)||{}}),helper:"Master switch for per-region Meshtastic channel routing. When off, families deliver only to their default Meshtastic channels."})}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:i.map(({key:h,label:f,Icon:v})=>{var w;const g=e[h]||{},m=((w=n==null?void 0:n.cells)==null?void 0:w[h])||{},y=r.some(S=>{var C;return((C=m[S])==null?void 0:C.mt)!=null}),x=s[h],_=x!==void 0?x:y;return d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-200",children:[d.jsx(v,{size:15})," ",f]}),d.jsxs("div",{className:"space-y-3 p-3 bg-[#0a0e17] border border-[#1e2a3a]",children:[d.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-300",children:[d.jsx(bi,{size:13}),"Meshtastic"]}),d.jsx(IZ,{channels:DCe,severityChannels:g.severity_channels||{},onChange:S=>o(h,{severity_channels:S})}),d.jsx(qf,{label:"Broadcast channel",value:g.broadcast_channel??0,onChange:S=>o(h,{broadcast_channel:S}),min:0,helper:"Meshtastic channel index (0 = LongFast primary)",info:"The Meshtastic channel index used for mesh_broadcast delivery. 0 = primary channel."}),d.jsx(LZ,{label:"DM node IDs",value:g.node_ids||[],onChange:S=>o(h,{node_ids:S}),placeholder:"!hex_id",helper:"Meshtastic DM recipients (hex node IDs)",info:"Hex node IDs for mesh_dm delivery (e.g. !a1b2c3d4). Used when mesh_dm is enabled for a severity."})]}),d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[d.jsx(Ch,{label:"Region-based routing",checked:_,onChange:S=>{l(C=>({...C,[h]:S})),S||c(h)},helper:"Route this family to different MT channels per region"}),_&&(r.length===0?d.jsxs("p",{className:"text-xs text-slate-500 italic",children:["No regions yet — add them on the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage"})," page."]}):d.jsx("div",{className:"space-y-1.5 pt-1",children:r.map(S=>{const C=m[S]??{mt:null};return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-xs text-slate-400 flex-1 min-w-0 truncate",children:S}),d.jsx("input",{type:"number",value:C.mt!==null?C.mt:"",onChange:M=>{const A=M.target.value;u(h,S,A===""?null:parseInt(A,10))},min:0,max:7,placeholder:"ch",className:"w-16 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono focus:outline-none focus:border-accent"})]},S)})}))]})]},h)})})]})}function VCe(){const{setDirty:e}=$i(),t=PZ(),[r,n]=E.useState(null),[a,i]=E.useState(null),[o,s]=E.useState([]),[l,u]=E.useState(!0),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(null),[y,x]=E.useState(!1),_=E.useCallback(async()=>{try{const[C,M]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/regions")]);if(!C.ok)throw new Error("Failed to fetch notifications config");const A=await C.json(),k=M.ok?await M.json():[];n(A),i(JSON.parse(JSON.stringify(A))),s(Array.isArray(k)?k:[]),x(!1),v(null)}catch(C){v(C instanceof Error?C.message:"Unknown error")}finally{u(!1)}},[]);E.useEffect(()=>{document.title="Meshtastic Routing - MeshAI",_()},[_]),E.useEffect(()=>{r&&a&&x(JSON.stringify(r)!==JSON.stringify(a))},[r,a]),E.useEffect(()=>(e(y),()=>e(!1)),[y,e]);const w=async()=>{if(r){h(!0),v(null),m(null);try{const C=await fetch("/api/config/notifications");if(!C.ok)throw new Error("Failed to re-fetch notifications config");const M=await C.json(),A={...M,toggles:{...M.toggles||{}},region_routes:BCe(M.region_routes,r.region_routes)},k=r.toggles||{};for(const{key:j}of t){const z=k[j];z&&(A.toggles[j]=zCe((M.toggles||{})[j],z,j))}const I=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),P=await I.json();if(!I.ok)throw new Error(P.detail||"Save failed");n(A),i(JSON.parse(JSON.stringify(A))),x(!1),e(!1),m("Meshtastic routing saved successfully"),setTimeout(()=>m(null),3e3)}catch(C){v(C instanceof Error?C.message:"Save failed")}finally{h(!1)}}},S=()=>{a&&(n(JSON.parse(JSON.stringify(a))),x(!1))};return l?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading notifications config..."})}):r?d.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsxs("p",{className:"text-sm text-slate-500",children:["Per-family Meshtastic delivery. Family gating (enable, severity threshold, freshness/cooldown) is on"," ",d.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"}),". MeshCore delivery is on the"," ",d.jsx("a",{href:"/meshcore/routing",className:"text-accent hover:underline",children:"MeshCore Routing"})," page."]})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:_,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:S,disabled:!y,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:w,disabled:c||!y,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:[d.jsx(_a,{size:16}),c?"Saving...":"Save"]})]})]}),f&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:f}),g&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),g]}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:r.toggles?d.jsx(FCe,{toggles:r.toggles,onChange:C=>n({...r,toggles:C}),regions:o,regionRoutes:r.region_routes,onRegionRoutesChange:C=>n({...r,region_routes:C})}):d.jsx("p",{className:"text-sm text-slate-500",children:"No family configuration found."})})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})})}const GCe={wfigs:["allowed_incident_types","freshness_seconds","cooldown_seconds","broadcast_on_acres","broadcast_on_contained"],tomtom_incidents:["min_magnitude","drop_non_present","drop_zero_magnitude"],itd_511:["min_severity","enabled_categories","enabled_sub_types"],wzdx:["broadcast","min_severity","sub_types"],nws:["broadcast_severities","duplicate_allowed_after_seconds"],avalanche:["min_danger_level"],swpc:["geomag_kp_floor","flare_class_floor","proton_pfu_floor"],satpass:["enabled","observers","min_elevation","norad_ids","max_broadcasts_per_hour","dry_run"]},HCe=1500;function DZ({excludeKeys:e,hideLlmToggle:t}={}){const[r,n]=E.useState({}),[a,i]=E.useState({}),[o,s]=E.useState(!0),[l,u]=E.useState(null),[c,h]=E.useState({}),[f,v]=E.useState({}),[g,m]=E.useState({}),y=E.useCallback(async()=>{s(!0),u(null);try{const[M,A]=await Promise.all([fetch("/api/adapter-config"),fetch("/api/adapter-meta")]);if(!M.ok)throw new Error(`GET /adapter-config: ${M.status}`);if(!A.ok)throw new Error(`GET /adapter-meta: ${A.status}`);n(await M.json()),i(await A.json())}catch(M){u(String(M))}finally{s(!1)}},[]);E.useEffect(()=>{y()},[y]);const x=E.useCallback((M,A,k)=>{v(I=>({...I,[M]:A})),k&&m(I=>({...I,[M]:k})),A==="saved"&&setTimeout(()=>{v(I=>I[M]==="saved"?{...I,[M]:"idle"}:I)},HCe)},[]),_=E.useCallback(async(M,A,k)=>{const I=`${M}.${A}`;x(I,"saving");try{const P=await fetch(`/api/adapter-config/${M}/${A}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:k})});if(!P.ok){const D=(await P.json().catch(()=>({}))).detail||P.statusText;x(I,"error",String(D));return}const j=await P.json();n(z=>({...z,[M]:(z[M]||[]).map(D=>D.key===A?j:D)})),x(I,"saved")}catch(P){x(I,"error",String(P))}},[x]),w=E.useCallback(async(M,A)=>{const k=`${M}.${A}`;x(k,"saving");try{const I=await fetch(`/api/adapter-config/${M}/${A}/reset`,{method:"POST"});if(!I.ok){x(k,"error",`reset failed (${I.status})`);return}const P=await I.json();n(j=>({...j,[M]:(j[M]||[]).map(z=>z.key===A?P:z)})),x(k,"saved")}catch(I){x(k,"error",String(I))}},[x]),S=E.useCallback(async(M,A)=>{const k=`meta:${M}`;x(k,"saving");try{const I=await fetch(`/api/adapter-meta/${M}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!I.ok){const j=await I.json().catch(()=>({}));x(k,"error",String(j.detail||I.statusText));return}const P=await I.json();i(j=>({...j,[M]:P})),x(k,"saved")}catch(I){x(k,"error",String(I))}},[x]);if(o)return d.jsxs("div",{className:"p-6 flex items-center gap-2 text-[#777]",children:[d.jsx(nv,{className:"w-5 h-5 animate-spin"})," Loading adapter config…"]});if(l)return d.jsxs("div",{className:"p-6 text-red-400",children:[d.jsx(Nh,{className:"w-5 h-5 inline mr-2"}),"Failed to load: ",l]});const C=Array.from(new Set([...Object.keys(a),...Object.keys(r)])).sort();return d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2 text-white",children:[d.jsx(Bg,{className:"w-5 h-5"}),d.jsx("h1",{className:"text-xl font-semibold",children:"Adapter Config"}),d.jsxs("span",{className:"text-xs text-[#666] ml-2",children:[Object.entries(r).reduce((M,[A,k])=>M+(e!=null&&e[A]?k.filter(I=>!e[A].includes(I.key)).length:k.length),0)," settings across ",C.length," adapters"]})]}),d.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 ",d.jsx("a",{href:"/reference#adapter-config",className:"text-accent hover:underline",children:"Adapter Config & the CODE Rule"})," in Reference. The ",d.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."]}),C.map(M=>{var D;const A=a[M]||{display_name:M,include_in_llm_context:!0,description:""},k=r[M]||[],I=e!=null&&e[M]?k.filter(B=>!e[M].includes(B.key)):k,P=c[M]??!1,j=`meta:${M}`,z=f[j]||"idle";return d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"p-4 flex items-start gap-4",children:[d.jsx("button",{onClick:()=>h(B=>({...B,[M]:!B[M]})),className:"text-[#777] hover:text-white","aria-label":"toggle expand",children:P?d.jsx(Em,{className:"w-5 h-5"}):d.jsx(Ah,{className:"w-5 h-5"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("h2",{className:"text-base font-semibold text-white",children:A.display_name}),d.jsx("code",{className:"text-xs text-[#666]",children:M}),I.length>0&&d.jsxs("span",{className:"text-xs text-[#777] ml-1",children:["(",I.length," settings",(D=e==null?void 0:e[M])!=null&&D.length?`, ${e[M].length} curated`:"",")"]}),I.length===0&&d.jsx("span",{className:"text-xs text-[#666] ml-1 italic",children:k.length>0?"(all curated)":"(meta only)"})]}),A.description&&d.jsx("p",{className:"text-xs text-[#777] mt-1",children:A.description})]}),!t&&d.jsxs("label",{className:"flex items-center gap-2 text-xs text-[#e0e0e0] select-none",children:[d.jsx("input",{type:"checkbox",checked:A.include_in_llm_context,onChange:B=>S(M,{include_in_llm_context:B.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"}),"LLM context",d.jsx(jZ,{status:z,error:g[j]})]})]}),P&&I.length>0&&d.jsx("div",{className:"border-t border-border divide-y divide-border",children:I.map(B=>d.jsx(UCe,{row:B,status:f[`${M}.${B.key}`]||"idle",error:g[`${M}.${B.key}`],onCommit:H=>_(M,B.key,H),onReset:()=>w(M,B.key)},B.key))})]},M)})]})}function UCe({row:e,status:t,error:r,onCommit:n,onReset:a}){const[i,o]=E.useState(J2(e));E.useEffect(()=>{o(J2(e))},[e.value,e.type]);const s=i!==J2(e),l=JSON.stringify(e.value)===JSON.stringify(e.default),u=()=>{const c=WCe(i,e.type);c.error||c.changed(e.value)&&n(c.value)};return d.jsxs("div",{className:"px-6 py-3 flex items-start gap-4",children:[d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("code",{className:"text-sm font-mono text-accent",children:e.key}),d.jsxs("span",{className:"text-xs text-[#666]",children:["[",e.type,"]"]}),!l&&d.jsx("span",{className:"text-xs text-accent",children:"edited"})]}),e.description&&d.jsx("p",{className:"text-xs text-[#777] mt-1",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 min-w-[280px] justify-end",children:[e.type==="bool"?d.jsx("input",{type:"checkbox",checked:e.value===!0,onChange:c=>n(c.target.checked),className:"w-5 h-5 accent-[#f59e0b]"}):e.type==="json"?d.jsx("textarea",{className:"w-72 h-20 bg-[#0d0d0d] border border-border px-2 py-1 text-xs font-mono text-white",value:i,onChange:c=>o(c.target.value),onBlur:u}):d.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:i,onChange:c=>o(c.target.value),onBlur:u,onKeyDown:c=>{c.key==="Enter"&&c.target.blur()}}),d.jsx(jZ,{status:t,error:r,dirty:s}),d.jsx("button",{onClick:a,disabled:l,className:"text-[#777] hover:text-white disabled:opacity-30 disabled:cursor-not-allowed",title:"Reset to default",children:d.jsx(xa,{className:"w-4 h-4"})})]})]})}function jZ({status:e,error:t,dirty:r}){return e==="saving"?d.jsx(nv,{className:"w-4 h-4 text-accent animate-spin"}):e==="saved"?d.jsx(Yr,{className:"w-4 h-4 text-green-500"}):e==="error"?d.jsx("span",{title:t,className:"text-red-400 cursor-help",children:d.jsx(Nh,{className:"w-4 h-4"})}):r?d.jsx("span",{className:"w-2 h-2 bg-accent rounded-full",title:"unsaved"}):d.jsx("span",{className:"w-4 h-4"})}function J2(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 WCe(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 $Ce=["routine","priority","immediate"];function XB(e){return{name:`source_${e}`,enabled:!0,url:"",items_path:"features",id_path:"",lat_path:"",lon_path:"",geometry_path:"geometry",title_path:"",time_path:"",category:"generic_alert",poll_seconds:300,severity:"routine",field_mappings:[],summary_template:"",emoji:"",headers:{}}}function Xa({label:e,value:t,onChange:r,placeholder:n,type:a="text",mono:i=!1}){return d.jsxs("div",{className:"min-w-0",children:[d.jsx("label",{className:"text-xs text-[#777] mb-1 block",children:e}),d.jsx("input",{type:a,value:t,placeholder:n,onChange:o=>r(o.target.value),className:`w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs ${i?"font-mono":""} text-[#e0e0e0] placeholder:text-[#555]`})]})}function ux({children:e}){return d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] pt-1",children:e})}function ZCe(){const[e,t]=E.useState(null),[r,n]=E.useState(""),[a,i]=E.useState(!0),[o,s]=E.useState(!1),[l,u]=E.useState(null),[c,h]=E.useState(null),{setDirty:f}=$i(),[v,g]=E.useState({}),[m,y]=E.useState({});E.useEffect(()=>{jJ().then(U=>{const W=(Array.isArray(U)?U:[]).map(($,Z)=>({...XB(Z+1),...$}));t(W),n(JSON.stringify(W))}).catch(U=>u(U instanceof Error?U.message:String(U))).finally(()=>i(!1))},[]);const x=e!==null&&JSON.stringify(e)!==r;E.useEffect(()=>(f(x),()=>f(!1)),[x,f]);const _=(U,F)=>{t(W=>W&&W.map(($,Z)=>Z===U?{...$,...F}:$))},w=()=>{t(U=>[...U??[],XB(((U==null?void 0:U.length)??0)+1)])},S=U=>{t(F=>F&&F.filter((W,$)=>$!==U)),g(F=>{const W={...F};return delete W[U],W})},C=U=>{t(F=>F&&F.map((W,$)=>$===U?{...W,field_mappings:[...W.field_mappings,{source_path:"",dest_key:""}]}:W))},M=(U,F,W)=>{t($=>$&&$.map((Z,J)=>J===U?{...Z,field_mappings:Z.field_mappings.map((re,Q)=>Q===F?{...re,...W}:re)}:Z))},A=(U,F)=>{t(W=>W&&W.map(($,Z)=>Z===U?{...$,field_mappings:$.field_mappings.filter((J,re)=>re!==F)}:$))},k=U=>Object.entries(U.headers??{}),I=(U,F)=>{const W={};for(const[$,Z]of F)W[$]=Z;_(U,{headers:W})},P=U=>{e&&I(U,[...k(e[U]),["",""]])},j=(U,F,W,$)=>{if(!e)return;const Z=k(e[U]);Z[F]=[W,$],I(U,Z)},z=(U,F)=>{if(!e)return;const W=k(e[U]);W.splice(F,1),I(U,W)},D=async U=>{if(!e)return;const F=e[U];y(W=>({...W,[U]:!0}));try{const W=await RJ(F.url,F.items_path,F.headers);g($=>({...$,[U]:W}))}catch(W){g($=>({...$,[U]:{ok:!1,error:W instanceof Error?W.message:String(W)}}))}finally{y(W=>({...W,[U]:!1}))}},B=()=>{r&&(t(JSON.parse(r)),g({}))},H=async()=>{if(e){s(!0),u(null),h(null);try{const U=await EJ(e);n(JSON.stringify(e)),h("Custom sources saved"),setTimeout(()=>h(null),3e3),U.restart_required&&bu(Array.isArray(U.changed_keys)?U.changed_keys:[])}catch(U){u(U instanceof Error?U.message:"Save failed")}finally{s(!1)}}};if(a)return d.jsx("div",{className:"flex items-center justify-center h-32 text-[#777]",children:"Loading custom sources…"});if(!e)return d.jsx("div",{className:"flex items-center justify-center h-32 text-red-400",children:l||"No config"});const V=d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{onClick:B,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:H,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",o?"Saving…":"Save"]})]});return d.jsxs("div",{className:"space-y-6 max-w-4xl",children:[d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("p",{className:"text-sm text-[#777]",children:["Point MeshAI at any public REST or GeoJSON feed — no code. Each source polls a URL, maps its JSON fields to an event via dotted paths, and broadcasts through the normal coverage-gated pipeline. Use ",d.jsx("span",{className:"text-accent",children:"Preview"})," to fetch a URL and read its structure before filling in the paths. Once saved, a custom source becomes a routable family —"," ",d.jsx("a",{href:"/meshtastic/routing",className:"text-accent hover:underline",children:"enable its family in Notifications"})," ","to route it to a channel."]}),x&&V]}),l&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:l}),c&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:c}),e.length===0&&d.jsx("div",{className:"border border-border p-6 text-center text-sm text-[#666]",children:"No custom sources yet. Click “Add source” to wire up a public feed."}),d.jsx("div",{className:"space-y-4",children:e.map((U,F)=>{const W=v[F],$=m[F];return d.jsxs("div",{className:"border border-border p-4 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("input",{type:"text",value:U.name,onChange:Z=>_(F,{name:Z.target.value}),placeholder:"source name (unique id)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-sm font-medium text-[#e0e0e0]"}),d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[d.jsx("span",{className:"text-xs text-[#666]",children:"Enabled"}),d.jsx("button",{type:"button",onClick:()=>_(F,{enabled:!U.enabled}),className:`relative w-9 h-4 rounded-full transition-colors ${U.enabled?"bg-accent":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${U.enabled?"translate-x-5":""}`})})]}),d.jsx("button",{onClick:()=>S(F),title:"Delete source",className:"flex items-center gap-1 px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(ui,{size:12})})]}),d.jsx(ux,{children:"Basics"}),d.jsxs("div",{className:"grid grid-cols-12 gap-2",children:[d.jsx("div",{className:"col-span-12",children:d.jsx(Xa,{label:"URL",value:U.url,onChange:Z=>_(F,{url:Z}),placeholder:"https://example.com/api/feed.geojson",mono:!0})}),d.jsx("div",{className:"col-span-3",children:d.jsx(Xa,{label:"Poll seconds",type:"number",value:U.poll_seconds,onChange:Z=>_(F,{poll_seconds:parseInt(Z,10)||0})})}),d.jsx("div",{className:"col-span-3",children:d.jsx(Xa,{label:"Category",value:U.category,onChange:Z=>_(F,{category:Z}),placeholder:"generic_alert"})}),d.jsxs("div",{className:"col-span-3",children:[d.jsx("label",{className:"text-xs text-[#777] mb-1 block",children:"Severity"}),d.jsx("select",{value:U.severity,onChange:Z=>_(F,{severity:Z.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs text-[#e0e0e0]",children:$Ce.map(Z=>d.jsx("option",{value:Z,children:Z},Z))})]}),d.jsx("div",{className:"col-span-3",children:d.jsx(Xa,{label:"Emoji",value:U.emoji??"",onChange:Z=>_(F,{emoji:Z}),placeholder:"⚡"})})]}),d.jsx(ux,{children:"Extraction"}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx(Xa,{label:"items_path (array of items)",value:U.items_path,onChange:Z=>_(F,{items_path:Z}),placeholder:"features · object.outages",mono:!0}),d.jsx(Xa,{label:"id_path (unique id, for dedup)",value:U.id_path,onChange:Z=>_(F,{id_path:Z}),placeholder:"id · omsOutageId · properties.id",mono:!0})]}),d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Headers (optional)"}),d.jsxs("button",{onClick:()=>P(F),className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[d.jsx(li,{size:12})," Add header"]})]}),d.jsxs("p",{className:"text-xs text-[#555]",children:["Custom request headers, e.g. ",d.jsx("code",{children:"User-Agent"})," or"," ",d.jsx("code",{children:"Authorization"}),". Leave empty for the default browser UA."]}),Object.entries(U.headers??{}).length>0&&d.jsx("div",{className:"space-y-2",children:Object.entries(U.headers??{}).map(([Z,J],re)=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"text",value:Z,onChange:Q=>j(F,re,Q.target.value,J),placeholder:"header name (e.g. Authorization)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("span",{className:"text-[#555] text-xs",children:":"}),d.jsx("input",{type:"text",value:J,onChange:Q=>j(F,re,Z,Q.target.value),placeholder:"value (e.g. Bearer …)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("button",{onClick:()=>z(F,re),title:"Remove header",className:"flex items-center px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(ui,{size:12})})]},re))})]}),d.jsx(ux,{children:"Location — GeoJSON geometry OR lat + lon paths"}),d.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[d.jsx(Xa,{label:"geometry_path",value:U.geometry_path??"",onChange:Z=>_(F,{geometry_path:Z}),placeholder:"geometry",mono:!0}),d.jsx(Xa,{label:"lat_path",value:U.lat_path??"",onChange:Z=>_(F,{lat_path:Z}),placeholder:"properties.lat",mono:!0}),d.jsx(Xa,{label:"lon_path",value:U.lon_path??"",onChange:Z=>_(F,{lon_path:Z}),placeholder:"properties.lon",mono:!0})]}),d.jsx(ux,{children:"Display"}),d.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[d.jsx(Xa,{label:"title_path",value:U.title_path??"",onChange:Z=>_(F,{title_path:Z}),placeholder:"properties.headline",mono:!0}),d.jsx(Xa,{label:"time_path",value:U.time_path??"",onChange:Z=>_(F,{time_path:Z}),placeholder:"properties.updated",mono:!0}),d.jsx("div",{className:"col-span-2",children:d.jsx(Xa,{label:"summary_template — use {dest_key} tokens from your field mappings",value:U.summary_template??"",onChange:Z=>_(F,{summary_template:Z}),placeholder:"⚡ Power out — {customers} affected, ETA {eta}",mono:!0})})]}),d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Field Mappings"}),d.jsxs("button",{onClick:()=>C(F),className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[d.jsx(li,{size:12})," Add mapping"]})]}),U.field_mappings.length===0?d.jsxs("p",{className:"text-xs text-[#555]",children:["No mappings. Each mapping pulls a dotted ",d.jsx("code",{children:"source_path"})," from an item into a ",d.jsx("code",{children:"dest_key"})," you can reference in the summary template."]}):d.jsx("div",{className:"space-y-2",children:U.field_mappings.map((Z,J)=>d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"text",value:Z.source_path,onChange:re=>M(F,J,{source_path:re.target.value}),placeholder:"source_path (e.g. properties.customers)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("span",{className:"text-[#555] text-xs",children:"→"}),d.jsx("input",{type:"text",value:Z.dest_key,onChange:re=>M(F,J,{dest_key:re.target.value}),placeholder:"dest_key (e.g. customers)",className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono text-[#e0e0e0] placeholder:text-[#555]"}),d.jsx("button",{onClick:()=>A(F,J),title:"Remove mapping",className:"flex items-center px-2 py-1.5 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(ui,{size:12})})]},J))})]}),d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Preview"}),d.jsxs("button",{onClick:()=>D(F),disabled:!U.url||$,className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[$?d.jsx(nv,{size:12,className:"animate-spin"}):d.jsx(rv,{size:12}),$?"Fetching…":"Preview"]})]}),W&&d.jsxs("div",{className:"space-y-2",children:[W.ok?d.jsxs("div",{className:"text-xs text-green-400",children:["HTTP ",W.status??"200",typeof W.item_count=="number"&&d.jsxs("span",{className:"text-[#999]",children:[" ","— items_path resolved ",W.item_count," item",W.item_count===1?"":"s"]})]}):d.jsx("div",{className:"text-xs text-red-400 break-words",children:W.error}),W.items_path_note&&d.jsx("div",{className:"text-xs text-amber-400 break-words",children:W.items_path_note}),W.first_item&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] uppercase tracking-widest text-[#555] mb-1",children:"First item"}),d.jsx("pre",{className:"bg-[#0d0d0d] border border-border p-2 text-[11px] font-mono text-[#bbb] overflow-auto max-h-48 whitespace-pre",children:W.first_item})]}),W.sample&&d.jsxs("details",{open:!W.first_item,children:[d.jsx("summary",{className:"text-[10px] uppercase tracking-widest text-[#555] cursor-pointer",children:"Raw response"}),d.jsx("pre",{className:"mt-1 bg-[#0d0d0d] border border-border p-2 text-[11px] font-mono text-[#bbb] overflow-auto max-h-72 whitespace-pre",children:W.sample})]})]})]})]},F)})}),d.jsxs("div",{className:"flex items-center justify-between gap-2 pb-2",children:[d.jsxs("button",{onClick:w,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30",children:[d.jsx(li,{size:14})," Add source"]}),x&&V]})]})}const YCe={enabled:!1,observers:[],tle_groups:["weather","stations"],norad_ids:[],min_elevation_deg:10,window_hours:24,tle_refresh_seconds:21600,broadcast_lead_seconds:3600,feed_source:"central"},XCe={enabled:!1,tick_seconds:60,base_url:"https://apps.fema.gov/IPAWSOPEN_EAS_SERVICE/rest",user_agent:"",state_fips:["16","53","41","32","49","56","30"],same_codes:[],exclude_weather:!0,drop_senders:["noaa.gov","nws","weather.gov"],status_actual_only:!0,feed_source:"native"};function qCe({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 d.jsxs("div",{className:"bg-bg-hover p-4",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:`w-2 h-2 rounded-full ${t}`}),d.jsx("span",{className:"text-sm font-medium text-white uppercase",children:e.source})]}),d.jsx("span",{className:"text-xs text-[#777]",children:r})]}),d.jsxs("div",{className:"text-xs font-mono text-[#666] space-y-1",children:[d.jsxs("div",{children:["Events: ",e.event_count]}),d.jsxs("div",{children:["Last fetch: ",n]}),e.last_error&&d.jsx("div",{className:"text-accent truncate",children:e.last_error})]})]})}function KCe({event:e}){const t=e.severity.toLowerCase(),r=t==="extreme"||t==="severe"||t==="immediate"?{bg:"bg-red-500/10",border:"border-red-500",Icon:Nh,color:"text-red-500"}:t==="moderate"||t==="warning"||t==="priority"?{bg:"bg-accent/10",border:"border-amber-500",Icon:pi,color:"text-accent"}:{bg:"bg-sky-400/10",border:"border-sky-400",Icon:d1,color:"text-sky-400"},n=r.Icon;return d.jsx("div",{className:`p-3 ${r.bg} border-l-2 ${r.border}`,children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(n,{size:16,className:r.color}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-medium text-white",children:e.event_type}),d.jsx("span",{className:`text-xs px-1.5 py-0.5 ${r.bg} ${r.color}`,children:e.severity})]}),d.jsx("div",{className:"text-sm font-sans text-[#e0e0e0]",children:e.headline})]})]})})}function EZ({value:e,onChange:t,disabled:r,centralDisabled:n}){const a="px-2 py-1 text-xs transition-colors";return d.jsxs("div",{className:`flex border border-border overflow-hidden ${r?"opacity-40":""}`,children:[d.jsx("button",{type:"button",disabled:r,onClick:()=>t("native"),className:`${a} ${e==="native"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"native"}),d.jsx("button",{type:"button",disabled:r||n,title:n?"Central not available for this adapter":"",onClick:()=>{n||t("central")},className:`${a} ${n?"text-[#666] cursor-not-allowed":e==="central"?"bg-accent text-white":"text-[#777] hover:text-white"}`,children:"central"})]})}function JCe({title:e,subtitle:t,enabled:r,onEnabled:n,feedSource:a,onFeedSource:i,hasCentral:o,nativeOnly:s,hasKey:l,health:u,events:c,children:h,llmContext:f,onLlmContext:v}){const g=s||!o;return d.jsxs("div",{className:"border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:e}),t&&d.jsx("p",{className:"text-xs text-[#666]",children:t})]}),d.jsxs("div",{className:"flex items-center gap-4",children:[v!==void 0&&d.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",title:"Include this adapter's data in LLM (bot) context",children:[d.jsx("input",{type:"checkbox",checked:f??!0,onChange:m=>v(m.target.checked),className:"w-3.5 h-3.5 accent-[#f59e0b]"}),d.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"LLM"})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),d.jsx(EZ,{value:a,onChange:i,disabled:!r,centralDisabled:g})]}),d.jsx(qt,{label:"",checked:r,onChange:n})]})]}),!l&&d.jsx("div",{className:"text-xs text-accent bg-accent/10 p-2",children:"API key required — set it in the field below"}),s&&d.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available for this adapter — native only"}),d.jsx("div",{className:r?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:h}),(u||c&&c.length>0)&&d.jsxs("div",{className:"pt-2 border-t border-border space-y-3",children:[d.jsx("div",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"Live status"}),u?d.jsx(qCe,{feed:u}):d.jsx("div",{className:"text-xs text-[#666]",children:"No status reported."}),c&&c.length>0&&d.jsx("div",{className:"space-y-2",children:c.slice(0,5).map((m,y)=>d.jsx(KCe,{event:m},y))})]})]})}const dc={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},ipaws:{label:"FEMA IPAWS civil alerts",subtitle:"Evacuations, AMBER, HazMat, 911 outages (non-weather)",health:"ipaws",hasCentral:!1,nativeOnly:!0,hasKey:!1}},QCe={firms:"FIRMS_MAP_KEY",roads511:"ROADS511_API_KEY",traffic:"TOMTOM_API_KEY"},Q2=[{key:"central",label:"Central",icon:AJ,adapters:[]},{key:"weather",label:"Weather",icon:kh,adapters:["nws"]},{key:"fire",label:"Fire",icon:Rm,adapters:["fires","firms"]},{key:"rf",label:"RF Propagation",icon:bi,adapters:["swpc","ducting"]},{key:"roads",label:"Roads",icon:u1,adapters:["traffic","roads511","wzdx"]},{key:"geohazards",label:"Geohazards",icon:kf,adapters:["usgs_quake","usgs","avalanche"]},{key:"emergency",label:"Emergency",icon:Ck,adapters:["ipaws"]},{key:"tracking",label:"Tracking",icon:f1,adapters:["satpass"]},{key:"mesh",label:"Mesh Health",icon:Oo,adapters:[]},{key:"family_settings",label:"Family Settings",icon:kV,adapters:[]}];function e2e(){var cy,hy,dy,Xh,nl,Iv;const[e,t]=E.useState(null),[r,n]=E.useState(""),[a,i]=E.useState(null),[o,s]=E.useState([]),[l,u]=E.useState(!0),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(null),[y,x]=E.useState(!1),[_,w]=E.useState("weather"),[S,C]=E.useState("nws"),[M,A]=E.useState("curated"),[k,I]=E.useState({}),[P,j]=E.useState({}),[z,D]=E.useState({allowed_incident_types:["WF"],freshness_seconds:0,cooldown_seconds:28800,broadcast_on_acres:!0,broadcast_on_contained:!0}),[B,H]=E.useState(""),[V,U]=E.useState({min_magnitude:4,drop_non_present:!0,drop_zero_magnitude:!0}),[F,W]=E.useState(""),[$,Z]=E.useState({min_severity:"None",enabled_categories:["incident","closure"],enabled_sub_types:["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]}),[J,re]=E.useState(""),[Q,le]=E.useState({broadcast:!1,min_severity:"Minor",sub_types:["road_works","lane_closed","road_closed"]}),[de,He]=E.useState(""),[ye,ne]=E.useState({broadcast_severities:["Extreme","Severe"],duplicate_allowed_after_seconds:3600}),[xe,he]=E.useState(""),[ge,tt]=E.useState({min_danger_level:3}),[Ue,qe]=E.useState(""),[Fe,_t]=E.useState({geomag_kp_floor:7,flare_class_floor:"X1",proton_pfu_floor:10}),[bt,et]=E.useState(""),[Ke,St]=E.useState({enabled:!1,observers:[],min_elevation:30,norad_ids:[],max_broadcasts_per_hour:4,dry_run:!0}),[ce,st]=E.useState(""),[Bt,Ft]=E.useState(null),[jt,Lr]=E.useState(null),[Qo,tl]=E.useState(!1),[Ki,Uh]=E.useState([]),[Hn,es]=E.useState(null),[ts,Au]=E.useState(""),[Wh,Ga]=E.useState(!1),[$h,Nu]=E.useState(null),[ku,rl]=E.useState(null);E.useEffect(()=>{document.title="Environment — MeshAI",(async()=>{var se,ut,Ze,yt,rr,oa,cn,An,Y,Ae,ct,ot,dt,os,Ji,Qi,gr,eo,al,il,qh,ol,Kh,Jh,Du,Qh;try{const Sa=await(await fetch("/api/config/environmental")).json();Sa.satpass={...YCe,...Sa.satpass??{}},Sa.wzdx={states:["ID"],registry_url:"",...Sa.wzdx??{}},Sa.ipaws={...XCe,...Sa.ipaws??{}},t(Sa),n(JSON.stringify(Sa));const to=Vt=>{const Ot={};if(Array.isArray(Vt))for(const Ie of Vt)Ot[Ie.key]={value:Ie.value};return Ot};try{const Vt=await fetch("/api/adapter-config/wfigs");if(Vt.ok){const Ot=to(await Vt.json()),Ie={allowed_incident_types:((se=Ot.allowed_incident_types)==null?void 0:se.value)??["WF"],freshness_seconds:((ut=Ot.freshness_seconds)==null?void 0:ut.value)??0,cooldown_seconds:((Ze=Ot.cooldown_seconds)==null?void 0:Ze.value)??28800,broadcast_on_acres:((yt=Ot.broadcast_on_acres)==null?void 0:yt.value)??!0,broadcast_on_contained:((rr=Ot.broadcast_on_contained)==null?void 0:rr.value)??!0};D(Ie),H(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/tomtom_incidents");if(Vt.ok){const Ot=to(await Vt.json()),Ie={min_magnitude:((oa=Ot.min_magnitude)==null?void 0:oa.value)??4,drop_non_present:((cn=Ot.drop_non_present)==null?void 0:cn.value)??!0,drop_zero_magnitude:((An=Ot.drop_zero_magnitude)==null?void 0:An.value)??!0};U(Ie),W(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/itd_511");if(Vt.ok){const Ot=to(await Vt.json()),Ie={min_severity:((Y=Ot.min_severity)==null?void 0:Y.value)??"None",enabled_categories:((Ae=Ot.enabled_categories)==null?void 0:Ae.value)??["incident","closure"],enabled_sub_types:((ct=Ot.enabled_sub_types)==null?void 0:ct.value)??["accident","road_closed","closure","lane_closed","vehicle_on_fire","flooding","debris"]};Z(Ie),re(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/wzdx");if(Vt.ok){const Ot=to(await Vt.json()),Ie={broadcast:((ot=Ot.broadcast)==null?void 0:ot.value)??!1,min_severity:((dt=Ot.min_severity)==null?void 0:dt.value)??"Minor",sub_types:((os=Ot.sub_types)==null?void 0:os.value)??["road_works","lane_closed","road_closed"]};le(Ie),He(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/nws");if(Vt.ok){const Ot=to(await Vt.json()),Ie={broadcast_severities:((Ji=Ot.broadcast_severities)==null?void 0:Ji.value)??["Extreme","Severe"],duplicate_allowed_after_seconds:((Qi=Ot.duplicate_allowed_after_seconds)==null?void 0:Qi.value)??3600};ne(Ie),he(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/avalanche");if(Vt.ok){const Ie={min_danger_level:((gr=to(await Vt.json()).min_danger_level)==null?void 0:gr.value)??3};tt(Ie),qe(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-config/swpc");if(Vt.ok){const Ot=to(await Vt.json()),Ie={geomag_kp_floor:((eo=Ot.geomag_kp_floor)==null?void 0:eo.value)??7,flare_class_floor:((al=Ot.flare_class_floor)==null?void 0:al.value)??"X1",proton_pfu_floor:((il=Ot.proton_pfu_floor)==null?void 0:il.value)??10};_t(Ie),et(JSON.stringify(Ie))}}catch{}try{const Vt=await fetch("/api/adapter-meta");if(Vt.ok){const Ot=await Vt.json(),Ie={};for(const[Wn,Wt]of Object.entries(Ot))Ie[Wn]=Wt.include_in_llm_context??!0;I(Ie)}}catch{}try{const Vt=await fetch("/api/adapter-config/satpass");if(Vt.ok){const Ot=await Vt.json(),Ie={};for(const Wt of Ot)Ie[Wt.key]=Wt;const Wn={enabled:((qh=Ie.enabled)==null?void 0:qh.value)??!1,observers:((ol=Ie.observers)==null?void 0:ol.value)??[],min_elevation:((Kh=Ie.min_elevation)==null?void 0:Kh.value)??30,norad_ids:((Jh=Ie.norad_ids)==null?void 0:Jh.value)??[],max_broadcasts_per_hour:((Du=Ie.max_broadcasts_per_hour)==null?void 0:Du.value)??4,dry_run:((Qh=Ie.dry_run)==null?void 0:Qh.value)??!0};St(Wn),st(JSON.stringify(Wn))}}catch{}}catch(ju){v(ju instanceof Error?ju.message:"Failed to load config")}finally{u(!1)}})()},[]),E.useEffect(()=>{(async()=>{try{const se=await fetch("/api/config/notifications");if(se.ok){const ut=await se.json();es(ut),Au(JSON.stringify(ut))}}catch{}})()},[]),E.useEffect(()=>{(async()=>{try{const se=await fetch("/api/config/coverage");if(se.ok){const ut=await se.json();tl(!!ut.enabled),Uh(Array.isArray(ut.excluded_adapters)?ut.excluded_adapters:[])}}catch{}})()},[]),E.useEffect(()=>{(async()=>{try{const se=await fetch("/api/secrets");if(se.ok){const ut=await se.json(),Ze={};for(const yt of ut)Ze[yt.env_var]=yt.is_set;j(Ze)}}catch{}})()},[]),E.useEffect(()=>{const se=async()=>{try{i(await $V()),s(await ZV())}catch{}};se();const ut=setInterval(se,3e4);return()=>clearInterval(ut)},[]);const Lu=e!==null&&JSON.stringify(e)!==r,Iu=JSON.stringify(z)!==B,rs=JSON.stringify(V)!==F,ns=JSON.stringify($)!==J,ue=JSON.stringify(Q)!==de,Xe=JSON.stringify(ye)!==xe,lt=JSON.stringify(ge)!==Ue,Pt=JSON.stringify(Fe)!==bt,fr=JSON.stringify(Ke)!==ce,Tn=Lu||Iu||rs||ns||ue||Xe||lt||Pt||fr,Ct=async(se,ut,Ze)=>{const yt=await fetch(`/api/adapter-config/${se}/${ut}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:Ze})});if(!yt.ok){const rr=await yt.json().catch(()=>({}));throw new Error(rr.detail||`Failed to save ${se}.${ut}`)}},as=async(se,ut)=>{I(Ze=>({...Ze,[se]:ut}));try{await fetch(`/api/adapter-meta/${se}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({include_in_llm_context:ut})})}catch{}},Mn=async()=>{if(e){h(!0),v(null),m(null);try{if(Lu){const se=await fetch("/api/config/environmental",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),ut=await se.json();if(!se.ok)throw new Error(ut.detail||"Save failed");n(JSON.stringify(e)),ut.restart_required&&x(!0)}if(Iu){const se=JSON.parse(B);z.freshness_seconds!==se.freshness_seconds&&await Ct("wfigs","freshness_seconds",z.freshness_seconds),JSON.stringify(z.allowed_incident_types)!==JSON.stringify(se.allowed_incident_types)&&await Ct("wfigs","allowed_incident_types",z.allowed_incident_types),z.cooldown_seconds!==se.cooldown_seconds&&await Ct("wfigs","cooldown_seconds",z.cooldown_seconds),z.broadcast_on_acres!==se.broadcast_on_acres&&await Ct("wfigs","broadcast_on_acres",z.broadcast_on_acres),z.broadcast_on_contained!==se.broadcast_on_contained&&await Ct("wfigs","broadcast_on_contained",z.broadcast_on_contained),H(JSON.stringify(z))}if(rs){const se=JSON.parse(F);V.min_magnitude!==se.min_magnitude&&await Ct("tomtom_incidents","min_magnitude",V.min_magnitude),V.drop_non_present!==se.drop_non_present&&await Ct("tomtom_incidents","drop_non_present",V.drop_non_present),V.drop_zero_magnitude!==se.drop_zero_magnitude&&await Ct("tomtom_incidents","drop_zero_magnitude",V.drop_zero_magnitude),W(JSON.stringify(V))}if(ns){const se=JSON.parse(J);$.min_severity!==se.min_severity&&await Ct("itd_511","min_severity",$.min_severity),JSON.stringify($.enabled_categories)!==JSON.stringify(se.enabled_categories)&&await Ct("itd_511","enabled_categories",$.enabled_categories),JSON.stringify($.enabled_sub_types)!==JSON.stringify(se.enabled_sub_types)&&await Ct("itd_511","enabled_sub_types",$.enabled_sub_types),re(JSON.stringify($))}if(ue){const se=JSON.parse(de);Q.broadcast!==se.broadcast&&await Ct("wzdx","broadcast",Q.broadcast),Q.min_severity!==se.min_severity&&await Ct("wzdx","min_severity",Q.min_severity),JSON.stringify(Q.sub_types)!==JSON.stringify(se.sub_types)&&await Ct("wzdx","sub_types",Q.sub_types),He(JSON.stringify(Q))}if(Xe){const se=JSON.parse(xe);JSON.stringify(ye.broadcast_severities)!==JSON.stringify(se.broadcast_severities)&&await Ct("nws","broadcast_severities",ye.broadcast_severities),ye.duplicate_allowed_after_seconds!==se.duplicate_allowed_after_seconds&&await Ct("nws","duplicate_allowed_after_seconds",ye.duplicate_allowed_after_seconds),he(JSON.stringify(ye))}if(lt){const se=JSON.parse(Ue);ge.min_danger_level!==se.min_danger_level&&await Ct("avalanche","min_danger_level",ge.min_danger_level),qe(JSON.stringify(ge))}if(Pt){const se=JSON.parse(bt);Fe.geomag_kp_floor!==se.geomag_kp_floor&&await Ct("swpc","geomag_kp_floor",Fe.geomag_kp_floor),Fe.flare_class_floor!==se.flare_class_floor&&await Ct("swpc","flare_class_floor",Fe.flare_class_floor),Fe.proton_pfu_floor!==se.proton_pfu_floor&&await Ct("swpc","proton_pfu_floor",Fe.proton_pfu_floor),et(JSON.stringify(Fe))}if(fr){const se=JSON.parse(ce);Ke.enabled!==se.enabled&&await Ct("satpass","enabled",Ke.enabled),JSON.stringify(Ke.observers)!==JSON.stringify(se.observers)&&await Ct("satpass","observers",Ke.observers),Ke.min_elevation!==se.min_elevation&&await Ct("satpass","min_elevation",Ke.min_elevation),JSON.stringify(Ke.norad_ids)!==JSON.stringify(se.norad_ids)&&await Ct("satpass","norad_ids",Ke.norad_ids),Ke.max_broadcasts_per_hour!==se.max_broadcasts_per_hour&&await Ct("satpass","max_broadcasts_per_hour",Ke.max_broadcasts_per_hour),Ke.dry_run!==se.dry_run&&await Ct("satpass","dry_run",Ke.dry_run),st(JSON.stringify(Ke))}m("Config saved"),setTimeout(()=>m(null),3e3)}catch(se){v(se instanceof Error?se.message:"Save failed")}finally{h(!1)}}},$e=()=>{e&&t(JSON.parse(r)),D(JSON.parse(B||JSON.stringify(z))),U(JSON.parse(F||JSON.stringify(V))),Z(JSON.parse(J||JSON.stringify($))),le(JSON.parse(de||JSON.stringify(Q))),ne(JSON.parse(xe||JSON.stringify(ye))),tt(JSON.parse(Ue||JSON.stringify(ge))),_t(JSON.parse(bt||JSON.stringify(Fe))),St(JSON.parse(ce||JSON.stringify(Ke))),Ft(null),Lr(null)},Zh=async()=>{try{await fetch("/api/restart",{method:"POST"}),x(!1),m("Restart initiated")}catch{v("Restart failed")}},Me=se=>e&&t({...e,...se}),Un=se=>Qo&&!Ki.includes(se),Pu={nws:"nws",fires:"wfigs",firms:"firms",swpc:"swpc",ducting:"ducting",traffic:"tomtom_incidents",roads511:"itd_511",wzdx:"wzdx",usgs:"usgs",usgs_quake:"usgs_quake",avalanche:"avalanche",satpass:"satpass",ipaws:"ipaws"},Lv=(Hn==null?void 0:Hn.toggles)||{},oy=Hn!==null&&JSON.stringify(Hn)!==ts,Ha=(se,ut)=>{if(!Hn)return;const Ze=Hn.toggles||{};es({...Hn,toggles:{...Ze,[se]:{...Ze[se]||{},name:se,...ut}}})},sy=async()=>{if(Hn){Ga(!0),Nu(null),rl(null);try{const se=await fetch("/api/config/notifications");if(!se.ok)throw new Error("Failed to re-fetch notifications config");const ut=await se.json(),Ze={...ut,toggles:{...ut.toggles||{}}},yt=Hn.toggles||{};for(const{key:cn}of fu){const An=yt[cn];if(!An)continue;const Y=(ut.toggles||{})[cn]||{};Ze.toggles[cn]={...Y,name:Y.name||cn,enabled:An.enabled,min_severity:An.min_severity,freshness_seconds:An.freshness_seconds??Y.freshness_seconds??600,cooldown_seconds:An.cooldown_seconds??Y.cooldown_seconds??0,regions:An.regions??Y.regions??[]}}const rr=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ze)}),oa=await rr.json();if(!rr.ok)throw new Error(oa.detail||"Save failed");es(Ze),Au(JSON.stringify(Ze)),rl("Family settings saved"),setTimeout(()=>rl(null),3e3)}catch(se){Nu(se instanceof Error?se.message:"Save failed")}finally{Ga(!1)}}},xw=()=>{ts&&es(JSON.parse(ts))};if(l)return d.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading environmental config…"});if(!e)return d.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:f||"No config"});const _w=se=>a==null?void 0:a.feeds.find(ut=>ut.source===dc[se].health),bw=se=>o.filter(ut=>ut.source===dc[se].health),ww=se=>{const ut=QCe[se];if(!ut)return!0;const Ze=P[ut];return Ze===void 0?!0:Ze},is=Q2.find(se=>se.key===_),Rr=is.adapters.length===0?null:S&&is.adapters.includes(S)?S:is.adapters[0],Yh=se=>{var ut,Ze,yt,rr,oa,cn,An;switch(se){case"nws":return d.jsxs(d.Fragment,{children:[Un("nws")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Geographic scope (zones, areas) is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),'. Enable "Use own config" for NWS on that page to edit zones here.']}):d.jsxs(d.Fragment,{children:[d.jsx(Dn,{label:"NWS Zones",value:e.nws_zones,onChange:Y=>Me({nws_zones:Y}),helper:"Zone IDs like IDZ016, IDZ030",infoLink:"https://www.weather.gov/pimar/PubZone"}),d.jsx(Dn,{label:"NWS Areas",value:e.nws.areas??[],onChange:Y=>Me({nws:{...e.nws,areas:Y}}),helper:"State codes NWS pulls, e.g. ID"})]}),e.nws.feed_source!=="central"&&d.jsxs(d.Fragment,{children:[d.jsx(gt,{label:"User Agent",value:e.nws.user_agent,onChange:Y=>Me({nws:{...e.nws,user_agent:Y}}),placeholder:"(MeshAI, you@email.com)",helper:"Format: (app_name, contact_email)"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Tick Seconds",value:e.nws.tick_seconds,onChange:Y=>Me({nws:{...e.nws,tick_seconds:Y}}),min:30}),d.jsx(jn,{label:"Min Severity",value:e.nws.severity_min,onChange:Y=>Me({nws:{...e.nws,severity_min:Y}}),options:[{value:"minor",label:"Minor"},{value:"moderate",label:"Moderate"},{value:"severe",label:"Severe"},{value:"extreme",label:"Extreme"}]})]})]}),e.nws.feed_source==="central"&&d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsxs("div",{className:"mb-3",children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Severities to broadcast"}),d.jsx("div",{className:"flex gap-6",children:["Extreme","Severe","Moderate","Minor"].map(Y=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:ye.broadcast_severities.includes(Y),onChange:Ae=>{const ct=ye.broadcast_severities;ne({...ye,broadcast_severities:Ae.target.checked?[...ct,Y]:ct.filter(ot=>ot!==Y)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Y})]},Y))})]}),d.jsx(Ne,{label:"Re-broadcast Cooldown (seconds)",value:ye.duplicate_allowed_after_seconds,onChange:Y=>ne({...ye,duplicate_allowed_after_seconds:Y}),min:0,helper:"Minimum seconds before the same alert ID can be re-broadcast"})]})]});case"swpc":return d.jsx("div",{className:"space-y-6",children:d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Thresholds"}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(jn,{label:"Geomag Kp Floor",value:String(Fe.geomag_kp_floor),onChange:Y=>_t({...Fe,geomag_kp_floor:Number(Y)}),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"}),d.jsx(jn,{label:"Flare Class Floor",value:Fe.flare_class_floor,onChange:Y=>_t({...Fe,flare_class_floor:Y}),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"}),d.jsx(jn,{label:"Proton pfu Floor",value:String(Fe.proton_pfu_floor),onChange:Y=>_t({...Fe,proton_pfu_floor:Number(Y)}),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 d.jsxs("div",{className:"space-y-3",children:[d.jsx(Ne,{label:"Tick Seconds",value:e.ducting.tick_seconds,onChange:Y=>Me({ducting:{...e.ducting,tick_seconds:Y}}),min:60}),Un("ducting")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Lat/lon is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Latitude",value:e.ducting.latitude,onChange:Y=>Me({ducting:{...e.ducting,latitude:Y}}),step:.01}),d.jsx(Ne,{label:"Longitude",value:e.ducting.longitude,onChange:Y=>Me({ducting:{...e.ducting,longitude:Y}}),step:.01})]})]});case"fires":return d.jsxs("div",{className:"space-y-6",children:[e.fires.feed_source!=="central"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Tick Seconds",value:e.fires.tick_seconds,onChange:Y=>Me({fires:{...e.fires,tick_seconds:Y}}),min:60}),Un("fires")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50 self-end",children:["State scoped by"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(jn,{label:"State",value:e.fires.state,onChange:Y=>Me({fires:{...e.fires,state:Y}}),options:pCe})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Incident Types"}),d.jsx("div",{className:"flex gap-6",children:[["WF","Wildfire"],["RX","Prescribed Burn"],["OTHER","Other"]].map(([Y,Ae])=>{var ct;return d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:((ct=z.allowed_incident_types)==null?void 0:ct.includes(Y))??Y==="WF",onChange:ot=>{const dt=z.allowed_incident_types??["WF"];D({...z,allowed_incident_types:ot.target.checked?[...dt,Y]:dt.filter(os=>os!==Y)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Ae})]},Y)})})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Triggers"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on acres increase"}),d.jsx("input",{type:"checkbox",checked:z.broadcast_on_acres,onChange:Y=>D({...z,broadcast_on_acres:Y.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast on containment increase"}),d.jsx("input",{type:"checkbox",checked:z.broadcast_on_contained,onChange:Y=>D({...z,broadcast_on_contained:Y.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Update Cooldown (hours)",value:Math.round(z.cooldown_seconds/3600),onChange:Y=>D({...z,cooldown_seconds:Y*3600}),min:0,helper:"Minimum hours between updates for the same fire"}),d.jsx(Ne,{label:"Freshness Window (hours)",value:Math.round(z.freshness_seconds/3600),onChange:Y=>D({...z,freshness_seconds:Y*3600}),min:0,helper:"0 = always broadcast regardless of event age"})]})]});case"avalanche":return d.jsxs("div",{className:"space-y-6",children:[e.avalanche.feed_source!=="central"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Tick Seconds",value:e.avalanche.tick_seconds,onChange:Y=>Me({avalanche:{...e.avalanche,tick_seconds:Y}}),min:60}),d.jsx(X2,{label:"Season Months",value:e.avalanche.season_months,onChange:Y=>Me({avalanche:{...e.avalanche,season_months:Y}}),helper:"e.g., 12, 1, 2, 3, 4"})]}),Un("avalanche")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Avalanche center IDs are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(Dn,{label:"Center IDs",value:e.avalanche.center_ids,onChange:Y=>Me({avalanche:{...e.avalanche,center_ids:Y}}),helper:"e.g., SNFAC",infoLink:"https://avalanche.org/avalanche-centers/"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsx(jn,{label:"Min Danger Level",value:String(ge.min_danger_level),onChange:Y=>tt({...ge,min_danger_level:Number(Y)}),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 d.jsxs(d.Fragment,{children:[d.jsx(Ne,{label:"Tick Seconds",value:e.usgs.tick_seconds,onChange:Y=>Me({usgs:{...e.usgs,tick_seconds:Y}}),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."}),Un("usgs")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Gauge site IDs are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(Dn,{label:"Site IDs",value:e.usgs.sites,onChange:Y=>Me({usgs:{...e.usgs,sites:Y}}),helper:"USGS gauge site numbers",infoLink:"https://waterdata.usgs.gov/nwis"}),d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Flood Thresholds (advanced JSON)"}),d.jsx("textarea",{value:Bt??JSON.stringify(e.usgs.flood_thresholds??{},null,2),onChange:Y=>{const Ae=Y.target.value;Ft(Ae);try{const ct=JSON.parse(Ae);Lr(null),Me({usgs:{...e.usgs,flood_thresholds:ct}})}catch(ct){Lr(ct instanceof Error?ct.message:"Invalid JSON")}},rows:6,spellCheck:!1,className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm font-mono"}),jt&&d.jsxs("p",{className:"text-xs text-red-400 mt-1",children:["Invalid JSON — not saved: ",jt]}),d.jsxs("p",{className:"text-xs text-[#666] mt-1",children:["Per-site flood levels, shape ","{",'"site_id": ',"{",' "flow": X, "height": Y ',"}","}"]})]})]});case"usgs_quake":return d.jsxs("div",{className:"space-y-6",children:[e.usgs_quake.feed_source!=="central"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Tick Seconds",value:e.usgs_quake.tick_seconds,onChange:Y=>Me({usgs_quake:{...e.usgs_quake,tick_seconds:Y}}),min:60}),d.jsx(gt,{label:"Region Tag",value:e.usgs_quake.region,onChange:Y=>Me({usgs_quake:{...e.usgs_quake,region:Y}})})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Native Feed"}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(gt,{label:"Quake Feed URL",value:e.usgs_quake.feed_url,onChange:Y=>Me({usgs_quake:{...e.usgs_quake,feed_url:Y}})}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsx(Ne,{label:"Min Magnitude",value:e.usgs_quake.min_magnitude??2.5,onChange:Y=>Me({usgs_quake:{...e.usgs_quake,min_magnitude:Y}}),step:.1,min:0,helper:"Native quake magnitude floor"})}),Un("usgs_quake")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx(X2,{label:"Bounding Box [W, S, E, N]",value:e.usgs_quake.bbox??[],onChange:Y=>Me({usgs_quake:{...e.usgs_quake,bbox:Y}}),helper:"Four values: west, south, east, north"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Magnitude Thresholds"}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(Ne,{label:"Global Floor",value:e.usgs_quake.global_mag_floor,onChange:Y=>Me({usgs_quake:{...e.usgs_quake,global_mag_floor:Y}}),step:.1,min:0,helper:"Broadcast anywhere at or above this magnitude"}),d.jsx(Ne,{label:"Regional Floor",value:e.usgs_quake.regional_mag_floor,onChange:Y=>Me({usgs_quake:{...e.usgs_quake,regional_mag_floor:Y}}),step:.1,min:0,helper:"Reduced floor within regional radius"}),d.jsx(Ne,{label:"Regional Radius (mi)",value:e.usgs_quake.regional_radius_mi,onChange:Y=>Me({usgs_quake:{...e.usgs_quake,regional_radius_mi:Y}}),min:50,helper:"Radius around region centroid for reduced floor"}),d.jsx(Ne,{label:"Escalation Floor",value:e.usgs_quake.escalate_mag_floor,onChange:Y=>Me({usgs_quake:{...e.usgs_quake,escalate_mag_floor:Y}}),step:.1,min:0,helper:"Magnitude at which broadcast uses warning emoji"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"PAGER Alert Levels"}),d.jsx("div",{className:"text-xs text-[#666] mb-2",children:"Broadcast at any magnitude when USGS PAGER alert reaches these levels"}),d.jsx("div",{className:"flex gap-6",children:["green","yellow","orange","red"].map(Y=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:(e.usgs_quake.broadcast_pager_alerts??[]).includes(Y),onChange:Ae=>{const ct=e.usgs_quake.broadcast_pager_alerts??[];Me({usgs_quake:{...e.usgs_quake,broadcast_pager_alerts:Ae.target.checked?[...ct,Y]:ct.filter(ot=>ot!==Y)}})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0] capitalize",children:Y})]},Y))})]})]});case"traffic":return d.jsxs(d.Fragment,{children:[d.jsx($p,{envVar:"TOMTOM_API_KEY",label:"API Key",helper:"developer.tomtom.com"}),d.jsx(Ne,{label:"Tick Seconds",value:e.traffic.tick_seconds,onChange:Y=>Me({traffic:{...e.traffic,tick_seconds:Y}}),min:60}),Un("traffic")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Traffic corridors are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"text-xs text-[#666] mt-2",children:"Corridors:"}),(e.traffic.corridors||[]).map((Y,Ae)=>d.jsxs("div",{className:"grid grid-cols-4 gap-2 items-end",children:[d.jsx(gt,{label:"Name",value:Y.name,onChange:ct=>{const ot=[...e.traffic.corridors];ot[Ae]={...Y,name:ct},Me({traffic:{...e.traffic,corridors:ot}})}}),d.jsx(Ne,{label:"Lat",value:Y.lat,onChange:ct=>{const ot=[...e.traffic.corridors];ot[Ae]={...Y,lat:ct},Me({traffic:{...e.traffic,corridors:ot}})},step:.01}),d.jsx(Ne,{label:"Lon",value:Y.lon,onChange:ct=>{const ot=[...e.traffic.corridors];ot[Ae]={...Y,lon:ct},Me({traffic:{...e.traffic,corridors:ot}})},step:.01}),d.jsx("button",{onClick:()=>Me({traffic:{...e.traffic,corridors:e.traffic.corridors.filter((ct,ot)=>ot!==Ae)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},Ae)),d.jsx("button",{onClick:()=>Me({traffic:{...e.traffic,corridors:[...e.traffic.corridors||[],{name:"",lat:0,lon:0}]}}),className:"text-xs text-accent hover:underline",children:"+ Add Corridor"})]}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Magnitude"}),d.jsxs("select",{value:V.min_magnitude,onChange:Y=>U({...V,min_magnitude:parseInt(Y.target.value)}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[d.jsx("option",{value:1,children:"1 — Minor (all)"}),d.jsx("option",{value:2,children:"2 — Moderate (yellow+)"}),d.jsx("option",{value:3,children:"3 — Major (orange+)"}),d.jsx("option",{value:4,children:"4 — Severe (red only)"})]}),d.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop TomTom incidents below this severity level"})]})}),d.jsxs("div",{className:"mt-3 space-y-2",children:[d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop non-present time validity"}),d.jsx("input",{type:"checkbox",checked:V.drop_non_present,onChange:Y=>U({...V,drop_non_present:Y.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Drop zero-magnitude events"}),d.jsx("input",{type:"checkbox",checked:V.drop_zero_magnitude,onChange:Y=>U({...V,drop_zero_magnitude:Y.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]})]})]})]});case"roads511":return d.jsxs(d.Fragment,{children:[d.jsx(gt,{label:"Base URL",value:e.roads511.base_url,onChange:Y=>Me({roads511:{...e.roads511,base_url:Y}}),placeholder:"https://511.yourstate.gov/api/v2"}),d.jsx($p,{envVar:"ROADS511_API_KEY",label:"API Key",helper:"Leave unset if 511 needs no key"}),d.jsx(Ne,{label:"Tick Seconds",value:e.roads511.tick_seconds,onChange:Y=>Me({roads511:{...e.roads511,tick_seconds:Y}}),min:60}),d.jsx(Dn,{label:"Endpoints",value:e.roads511.endpoints,onChange:Y=>Me({roads511:{...e.roads511,endpoints:Y}}),helper:"e.g., /get/event"}),Un("roads511")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((Y,Ae)=>{var ct;return d.jsx(Ne,{label:Y,value:((ct=e.roads511.bbox)==null?void 0:ct[Ae])??0,onChange:ot=>{const dt=[...e.roads511.bbox||[0,0,0,0]];dt[Ae]=ot,Me({roads511:{...e.roads511,bbox:dt}})},step:.01},Y)})}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Minimum Severity"}),d.jsxs("select",{value:$.min_severity,onChange:Y=>Z({...$,min_severity:Y.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[d.jsx("option",{value:"None",children:"None (all)"}),d.jsx("option",{value:"Minor",children:"Minor+"}),d.jsx("option",{value:"Major",children:"Major only"})]}),d.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Drop ITD 511 events below this severity"})]})}),d.jsxs("div",{className:"mt-4",children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Categories"}),d.jsx("div",{className:"flex gap-6",children:[["incident","Incident"],["closure","Closure"],["special_event","Special Event"]].map(([Y,Ae])=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:$.enabled_categories.includes(Y),onChange:ct=>{const ot=$.enabled_categories;Z({...$,enabled_categories:ct.target.checked?[...ot,Y]:ot.filter(dt=>dt!==Y)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Ae})]},Y))})]}),d.jsxs("div",{className:"mt-4",children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),d.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(([Y,Ae])=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:$.enabled_sub_types.includes(Y),onChange:ct=>{const ot=$.enabled_sub_types;Z({...$,enabled_sub_types:ct.target.checked?[...ot,Y]:ot.filter(dt=>dt!==Y)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Ae})]},Y))})]})]})]});case"wzdx":return d.jsxs(d.Fragment,{children:[((ut=e.wzdx)==null?void 0:ut.feed_source)!=="central"&&d.jsxs(d.Fragment,{children:[d.jsx(gt,{label:"Base URL",value:((Ze=e.wzdx)==null?void 0:Ze.base_url)??"",onChange:Y=>Me({wzdx:{...e.wzdx,base_url:Y}}),placeholder:"https://511.yourstate.gov/api/v2"}),d.jsx($p,{envVar:"WZDX_API_KEY",label:"API Key",helper:"Leave unset if not required"}),d.jsx(Ne,{label:"Tick Seconds",value:((yt=e.wzdx)==null?void 0:yt.tick_seconds)??300,onChange:Y=>Me({wzdx:{...e.wzdx,tick_seconds:Y}}),min:60}),d.jsx(Dn,{label:"Endpoints",value:((rr=e.wzdx)==null?void 0:rr.endpoints)??["/get/event"],onChange:Y=>Me({wzdx:{...e.wzdx,endpoints:Y}}),helper:"e.g., /get/event"}),Un("wzdx")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box and states are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((Y,Ae)=>{var ct,ot;return d.jsx(Ne,{label:Y,value:((ot=(ct=e.wzdx)==null?void 0:ct.bbox)==null?void 0:ot[Ae])??0,onChange:dt=>{var Ji;const os=[...((Ji=e.wzdx)==null?void 0:Ji.bbox)||[0,0,0,0]];os[Ae]=dt,Me({wzdx:{...e.wzdx,bbox:os}})},step:.01},Y)})}),d.jsx("div",{className:"text-xs text-[#666]",children:"Bounding box [W,S,E,N] geographic filter"}),d.jsx(Dn,{label:"States",value:((oa=e.wzdx)==null?void 0:oa.states)??[],onChange:Y=>Me({wzdx:{...e.wzdx,states:Y}}),helper:"2-letter state codes to include from the WZDx Feed Registry, e.g. ID, OR"})]}),d.jsx(gt,{label:"Registry URL",value:((cn=e.wzdx)==null?void 0:cn.registry_url)??"",onChange:Y=>Me({wzdx:{...e.wzdx,registry_url:Y}}),placeholder:"https://datahub.transportation.gov/resource/69qe-yiui.json?$limit=200",helper:"FHWA WZDx Feed Registry (Socrata) URL — lists every state DOT feed"}),d.jsx(Ne,{label:"Registry TTL (sec)",value:((An=e.wzdx)==null?void 0:An.registry_ttl)??21600,onChange:Y=>Me({wzdx:{...e.wzdx,registry_ttl:Y}}),min:0,helper:"How often to re-fetch the WZDx registry (default 21600 = 6h)"})]}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Settings"}),d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Broadcast work zone events"}),d.jsx("input",{type:"checkbox",checked:Q.broadcast,onChange:Y=>le({...Q,broadcast:Y.target.checked}),className:"w-4 h-4 accent-[#f59e0b]"})]}),Q.broadcast?d.jsxs("div",{className:"space-y-3 mt-3",children:[d.jsxs("div",{children:[d.jsx("label",{className:"text-xs font-sans text-[#777] mb-1 block",children:"Min Severity"}),d.jsxs("select",{value:Q.min_severity,onChange:Y=>le({...Q,min_severity:Y.target.value}),className:"w-full bg-[#0d0d0d] border border-border px-3 py-2 text-sm",children:[d.jsx("option",{value:"None",children:"None (all)"}),d.jsx("option",{value:"Minor",children:"Minor+"}),d.jsx("option",{value:"Major",children:"Major only"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-sans text-[#777] mb-2",children:"Sub-types"}),d.jsx("div",{className:"flex gap-6",children:[["road_works","Road Works"],["lane_closed","Lane Closure"],["road_closed","Road Closed"]].map(([Y,Ae])=>d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[d.jsx("input",{type:"checkbox",checked:Q.sub_types.includes(Y),onChange:ct=>{const ot=Q.sub_types;le({...Q,sub_types:ct.target.checked?[...ot,Y]:ot.filter(dt=>dt!==Y)})},className:"w-4 h-4 accent-[#f59e0b]"}),d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:Ae})]},Y))})]})]}):d.jsxs("p",{className:"text-xs text-[#666] mt-2",children:["Work zone events stored for LLM context only ","—"," no mesh broadcasts."]})]})]});case"firms":return d.jsxs(d.Fragment,{children:[d.jsx($p,{envVar:"FIRMS_MAP_KEY",label:"MAP Key",helper:"NASA FIRMS MAP_KEY"}),d.jsx(Ne,{label:"Tick Seconds",value:e.firms.tick_seconds,onChange:Y=>Me({firms:{...e.firms,tick_seconds:Y}}),min:300}),d.jsx(jn,{label:"Satellite Source",value:e.firms.source,onChange:Y=>Me({firms:{...e.firms,source:Y}}),options:[{value:"VIIRS_SNPP_NRT",label:"VIIRS SNPP (NRT)"},{value:"VIIRS_NOAA20_NRT",label:"VIIRS NOAA-20 (NRT)"},{value:"MODIS_NRT",label:"MODIS (NRT)"}]}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(Ne,{label:"Day Range",value:e.firms.day_range,onChange:Y=>Me({firms:{...e.firms,day_range:Y}}),min:1,max:10}),d.jsx(jn,{label:"Min Confidence",value:e.firms.confidence_min,onChange:Y=>Me({firms:{...e.firms,confidence_min:Y}}),options:[{value:"low",label:"Low"},{value:"nominal",label:"Nominal"},{value:"high",label:"High"}]}),d.jsx(Ne,{label:"Proximity (km)",value:e.firms.proximity_km,onChange:Y=>Me({firms:{...e.firms,proximity_km:Y}}),step:.5})]}),Un("firms")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Bounding box is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["West","South","East","North"].map((Y,Ae)=>{var ct;return d.jsx(Ne,{label:Y,value:((ct=e.firms.bbox)==null?void 0:ct[Ae])??0,onChange:ot=>{const dt=[...e.firms.bbox||[0,0,0,0]];dt[Ae]=ot,Me({firms:{...e.firms,bbox:dt}})},step:.01},Y)})})]});case"ipaws":return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"text-[11px] text-[#666]",children:"Keyless FEMA IPAWS-OPEN EAS feed. Broadcasts NON-weather civil emergencies (evacuation orders, AMBER, HazMat, 911 outages, law-enforcement/shelter-in-place). Weather CAP is dropped so it never double-broadcasts the NWS adapter."}),d.jsx(gt,{label:"Base URL",value:e.ipaws.base_url,onChange:Y=>Me({ipaws:{...e.ipaws,base_url:Y}}),placeholder:"https://apps.fema.gov/IPAWSOPEN_EAS_SERVICE/rest",helper:"IPAWS-OPEN EAS REST root — Atom index at /feed, per-alert CAP at /eas/. Point at the Conduit proxy in prod."}),d.jsx(gt,{label:"User Agent",value:e.ipaws.user_agent,onChange:Y=>Me({ipaws:{...e.ipaws,user_agent:Y}}),placeholder:"meshai-ipaws/1.0 (you@email.com)",helper:"Sent on every FEMA request. Blank uses the built-in default."}),d.jsx(Ne,{label:"Tick Seconds",value:e.ipaws.tick_seconds,onChange:Y=>Me({ipaws:{...e.ipaws,tick_seconds:Y}}),min:30}),Un("ipaws")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Region scope (state FIPS / SAME codes) is set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx(Dn,{label:"State FIPS",value:e.ipaws.state_fips,onChange:Y=>Me({ipaws:{...e.ipaws,state_fips:Y}}),helper:"Coarse pre-fetch gate — 2-digit state FIPS to keep, e.g. 16 (ID), 41 (OR), 53 (WA)"}),d.jsx(Dn,{label:"SAME Codes",value:e.ipaws.same_codes,onChange:Y=>Me({ipaws:{...e.ipaws,same_codes:Y}}),helper:"Optional fine gate — 6-digit SAME county codes, e.g. 016001. Empty = all counties in the FIPS states."})]}),d.jsxs("div",{className:"border-t border-border pt-4 mt-4",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Broadcast Filters"}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Exclude weather-sourced alerts"}),d.jsx("input",{type:"checkbox",checked:e.ipaws.exclude_weather,onChange:Y=>Me({ipaws:{...e.ipaws,exclude_weather:Y.target.checked}}),className:"w-4 h-4 accent-[#f59e0b]"})]}),d.jsx("p",{className:"text-xs text-[#666]",children:"Drop NWS/NOAA-originated CAP so weather stays on the NWS adapter (no double-broadcast)."}),d.jsxs("label",{className:"flex items-center justify-between pt-2",children:[d.jsx("span",{className:"text-sm font-sans text-[#e0e0e0]",children:"Actual status only"}),d.jsx("input",{type:"checkbox",checked:e.ipaws.status_actual_only,onChange:Y=>Me({ipaws:{...e.ipaws,status_actual_only:Y.target.checked}}),className:"w-4 h-4 accent-[#f59e0b]"})]}),d.jsx("p",{className:"text-xs text-[#666]",children:"Skip Test / Exercise / System messages — broadcast only status=Actual alerts."})]})]})]});case"satpass":{const Y=e.satpass.enabled?Ke.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 d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:`px-4 py-2.5 text-sm rounded ${Y.color}`,children:[d.jsx("span",{className:"font-semibold",children:Y.label}),Y.desc&&d.jsx("span",{className:"font-normal",children:Y.desc})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Safety Controls"}),d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm text-[#e0e0e0]",children:"Dry run — log instead of transmit"}),d.jsx("p",{className:"text-xs text-[#666]",children:"When enabled, passes are logged but never broadcast to mesh"})]}),d.jsx("button",{onClick:()=>St({...Ke,dry_run:!Ke.dry_run}),className:`relative w-10 h-5 rounded-full transition-colors ${Ke.dry_run?"bg-sky-500":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${Ke.dry_run?"translate-x-5":""}`})})]}),d.jsx(Ne,{label:"Max broadcasts / hour",value:Ke.max_broadcasts_per_hour,onChange:Ae=>St({...Ke,max_broadcasts_per_hour:Ae}),min:1,max:60,helper:"Rate cap — broadcasts exceeding this limit are dropped"})]})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666] mb-3",children:"Pass Filters"}),d.jsx("div",{className:"grid grid-cols-2 gap-4",children:d.jsx(Ne,{label:"Min Elevation (deg)",value:Ke.min_elevation,onChange:Ae=>St({...Ke,min_elevation:Ae}),min:0,max:90,helper:"Minimum max elevation for a pass to be broadcast"})})]}),d.jsx(Dn,{label:"Observer Locations",value:Ke.observers,onChange:Ae=>St({...Ke,observers:Ae}),helper:"Observer names to include (empty = all)"}),d.jsx(Dn,{label:"NORAD IDs",value:Ke.norad_ids,onChange:Ae=>St({...Ke,norad_ids:Ae}),helper:"NORAD catalog IDs to broadcast (empty = broadcast nothing, opt-in only)"}),d.jsxs("div",{className:"border-t border-border pt-4 mt-2 space-y-6",children:[d.jsx("div",{className:"text-[10px] font-sans font-medium uppercase tracking-widest text-[#666]",children:"Native satpass (SGP4) — no Central required"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-xs text-[#777] mb-2",children:"Observers (ground stations the predictor computes passes for)"}),Un("satpass")?d.jsxs("div",{className:"text-xs text-[#666] bg-bg-hover px-3 py-2 border border-border/50",children:["Observer locations are set by the"," ",d.jsx("a",{href:"/coverage",className:"text-accent hover:underline",children:"Coverage map"}),"."]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"space-y-2",children:(e.satpass.observers||[]).map((Ae,ct)=>d.jsxs("div",{className:"grid grid-cols-6 gap-2 items-end",children:[d.jsx(gt,{label:"Slug",value:Ae.slug,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Ae,slug:ot},Me({satpass:{...e.satpass,observers:dt}})},placeholder:"tvly"}),d.jsx(gt,{label:"Name",value:Ae.name,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Ae,name:ot},Me({satpass:{...e.satpass,observers:dt}})},placeholder:"Treasure Valley"}),d.jsx(Ne,{label:"Lat",value:Ae.lat,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Ae,lat:ot},Me({satpass:{...e.satpass,observers:dt}})},step:1e-4}),d.jsx(Ne,{label:"Lon",value:Ae.lon,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Ae,lon:ot},Me({satpass:{...e.satpass,observers:dt}})},step:1e-4}),d.jsx(Ne,{label:"Alt (m)",value:Ae.alt_m,onChange:ot=>{const dt=[...e.satpass.observers];dt[ct]={...Ae,alt_m:ot},Me({satpass:{...e.satpass,observers:dt}})},step:1}),d.jsx("button",{onClick:()=>Me({satpass:{...e.satpass,observers:e.satpass.observers.filter((ot,dt)=>dt!==ct)}}),className:"px-2 py-2 text-xs text-red-400 hover:text-red-300 border border-red-400/30",children:"Remove"})]},ct))}),d.jsx("button",{onClick:()=>Me({satpass:{...e.satpass,observers:[...e.satpass.observers||[],{slug:"",name:"",lat:0,lon:0,alt_m:0}]}}),className:"text-xs text-accent hover:underline mt-2",children:"+ Add Observer"})]})]}),d.jsx(Dn,{label:"TLE Groups",value:e.satpass.tle_groups,onChange:Ae=>Me({satpass:{...e.satpass,tle_groups:Ae}}),helper:"Celestrak GP group selectors, e.g. weather, stations, amateur",infoLink:"https://celestrak.org/NORAD/elements/"}),d.jsx(X2,{label:"NORAD IDs (native)",value:e.satpass.norad_ids,onChange:Ae=>Me({satpass:{...e.satpass,norad_ids:Ae}}),helper:"Specific NORAD catalog IDs to also fetch/predict, e.g. 25544, 33591"}),d.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[d.jsx(Ne,{label:"Min Elevation (deg)",value:e.satpass.min_elevation_deg,onChange:Ae=>Me({satpass:{...e.satpass,min_elevation_deg:Ae}}),min:0,max:90,helper:"Native SGP4 pass filter (separate from Central min elevation above)"}),d.jsx(Ne,{label:"Window (hours)",value:e.satpass.window_hours,onChange:Ae=>Me({satpass:{...e.satpass,window_hours:Ae}}),min:1,max:168,helper:"Hours ahead to predict passes"}),d.jsx(Ne,{label:"TLE Refresh (sec)",value:e.satpass.tle_refresh_seconds,onChange:Ae=>Me({satpass:{...e.satpass,tle_refresh_seconds:Ae}}),min:3600,helper:"How often to re-fetch TLEs (default 21600 = 6h)"}),d.jsx(Ne,{label:"Broadcast Lead (sec)",value:e.satpass.broadcast_lead_seconds??3600,onChange:Ae=>Me({satpass:{...e.satpass,broadcast_lead_seconds:Ae}}),min:0,helper:"How far ahead of a pass to announce"})]})]})]})}}},ly=e,uy=(se,ut)=>{const Ze=e[se]||{};Me({[se]:{...Ze,...ut}})};return d.jsxs("div",{className:"space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("h1",{className:"text-xl font-semibold text-white",children:"Data Feeds"}),d.jsx("div",{className:"flex items-center gap-3",children:M==="curated"&&d.jsxs(d.Fragment,{children:[d.jsx(qt,{label:"Feeds Enabled",checked:e.enabled,onChange:se=>Me({enabled:se})}),Tn&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:$e,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:Mn,disabled:c,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",c?"Saving…":"Save"]})]})]})})]}),f&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:f}),g&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:g}),y&&d.jsxs("div",{className:"flex items-center justify-between text-sm text-accent bg-accent/10 border border-accent/30 p-3",children:[d.jsxs("span",{className:"flex items-center gap-2",children:[d.jsx(Zi,{size:14})," A restart is required for some changes to take effect."]}),d.jsx("button",{onClick:Zh,className:"px-3 py-1 bg-accent/20 hover:bg-amber-500/30",children:"Restart now"})]}),d.jsxs("div",{className:"flex gap-1 border-b border-border",children:[d.jsxs("button",{onClick:()=>A("curated"),className:`flex items-center gap-2 px-4 py-2 text-sm border-b-2 -mb-px transition-colors ${M==="curated"?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[d.jsx(kh,{size:15})," Data Feeds"]}),d.jsxs("button",{onClick:()=>A("advanced"),className:`flex items-center gap-2 px-4 py-2 text-sm border-b-2 -mb-px transition-colors ${M==="advanced"?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[d.jsx(Bg,{size:15})," Advanced (raw)"]})]}),M==="advanced"&&d.jsxs("div",{className:"-mx-6",children:[d.jsx("div",{className:"px-6 pb-2 text-xs text-[#777]",children:"Curated keys (owned by the Data Feeds panels above) are hidden here. Future or unknown keys from adapters will appear in this view."}),d.jsx(DZ,{excludeKeys:GCe,hideLlmToggle:!0})]}),M==="curated"&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"flex gap-1 border-b border-border overflow-x-auto",children:Q2.map(({key:se,label:ut,icon:Ze})=>d.jsxs("button",{onClick:()=>{w(se);const yt=Q2.find(rr=>rr.key===se);C(yt.adapters[0]??null)},className:`flex items-center gap-2 px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${_===se?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:[d.jsx(Ze,{size:15})," ",ut]},se))}),_==="central"&&e.central&&d.jsxs("div",{className:"border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Central Connection"}),d.jsx("p",{className:"text-xs text-[#666]",children:'NATS JetStream source for any adapter set to "central"'})]}),d.jsx(qt,{label:"",checked:!!e.central.enabled,onChange:se=>Me({central:{...e.central,enabled:se}})})]}),d.jsxs("div",{className:e.central.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[d.jsx(gt,{label:"URL",value:e.central.url||"",onChange:se=>Me({central:{...e.central,url:se}}),placeholder:"nats://central.echo6.mesh:4222"}),d.jsx(gt,{label:"Durable",value:e.central.durable||"",onChange:se=>Me({central:{...e.central,durable:se}}),placeholder:"meshai-v04"}),d.jsx(Ne,{label:"Connect Timeout (sec)",value:e.central.connect_timeout??10,onChange:se=>Me({central:{...e.central,connect_timeout:se}}),step:.5,min:0,helper:"NATS connect timeout for the Central consumer"}),d.jsx(gt,{label:"Region",value:e.central.region||"",onChange:se=>Me({central:{...e.central,region:se}}),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."})]})]}),_==="mesh"&&d.jsxs("div",{className:"border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Mesh Health"}),d.jsx("p",{className:"text-xs text-[#666]",children:"Node/infra telemetry — sourced from the mesh, not an environmental feed."})]}),d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("span",{className:"text-[10px] uppercase tracking-wide text-[#666]",children:"source"}),d.jsx(EZ,{value:"native",onChange:()=>{},disabled:!1,centralDisabled:!0})]})]}),d.jsx("div",{className:"text-[11px] text-[#666]",children:"Central not available — reserved for a future migration."})]}),_==="family_settings"&&d.jsxs("div",{className:"space-y-4",children:[d.jsxs("p",{className:"text-xs text-[#777]",children:["Per-family gating: enable/disable each notification family, set its minimum severity threshold, freshness window, and cooldown. Delivery routing (which mesh channels, email, webhook) is configured on the ",d.jsx("a",{href:"/meshtastic/routing",className:"text-accent hover:underline",children:"Meshtastic Routing"})," and"," ",d.jsx("a",{href:"/meshcore/routing",className:"text-accent hover:underline",children:"MeshCore Routing"})," pages."]}),$h&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:$h}),ku&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:ku}),Hn===null?d.jsx("div",{className:"text-xs text-[#666] italic",children:"Loading family settings…"}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:fu.map(({key:se,label:ut,Icon:Ze})=>{const yt=Lv[se]||{};return d.jsxs("div",{className:"border border-border p-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#e0e0e0]",children:[d.jsx(Ze,{size:15})," ",ut]}),d.jsx(qt,{label:"",checked:!!yt.enabled,onChange:rr=>Ha(se,{enabled:rr})})]}),d.jsxs("div",{className:yt.enabled?"space-y-3":"space-y-3 opacity-40 pointer-events-none select-none",children:[d.jsx(jn,{label:"Min Severity",value:yt.min_severity||"priority",onChange:rr=>Ha(se,{min_severity:rr}),options:[{value:"routine",label:"Routine — informational"},{value:"priority",label:"Priority — needs attention"},{value:"immediate",label:"Immediate — act now"}]}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsx(Ne,{label:"Freshness (sec)",value:yt.freshness_seconds??600,onChange:rr=>Ha(se,{freshness_seconds:rr}),min:0,helper:"Drop events older than this"}),d.jsx(Ne,{label:"Cooldown (sec)",value:yt.cooldown_seconds??0,onChange:rr=>Ha(se,{cooldown_seconds:rr}),min:0,helper:"0 = no throttle"})]}),d.jsx(Dn,{label:"Regions",value:yt.regions??[],onChange:rr=>Ha(se,{regions:rr}),helper:"Empty = all regions; otherwise only these region names"})]})]},se)})}),oy&&d.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[d.jsxs("button",{onClick:xw,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:sy,disabled:Wh,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",Wh?"Saving…":"Save"]})]})]})]}),is.adapters.length>0&&Rr&&d.jsxs(d.Fragment,{children:[is.adapters.length>1&&d.jsx("div",{className:"flex gap-1",children:is.adapters.map(se=>d.jsx("button",{onClick:()=>C(se),className:`px-3 py-1.5 text-sm ${Rr===se?"bg-bg-hover text-white":"text-[#777] hover:text-white"}`,children:dc[se].label},se))}),d.jsx(JCe,{title:dc[Rr].label,subtitle:dc[Rr].subtitle,enabled:((cy=ly[Rr])==null?void 0:cy.enabled)??!1,onEnabled:se=>uy(Rr,{enabled:se}),feedSource:((hy=ly[Rr])==null?void 0:hy.feed_source)??"native",onFeedSource:se=>uy(Rr,{feed_source:se}),hasCentral:dc[Rr].hasCentral,nativeOnly:dc[Rr].nativeOnly,hasKey:ww(Rr),health:_w(Rr),events:bw(Rr),llmContext:Pu[Rr]!==void 0?k[Pu[Rr]]??!0:void 0,onLlmContext:Pu[Rr]!==void 0?se=>as(Pu[Rr],se):void 0,children:Yh(Rr)})]}),d.jsxs("div",{className:"pt-4 mt-2 border-t border-border space-y-4",children:[d.jsxs("div",{children:[d.jsxs("h2",{className:"text-base font-semibold text-white flex items-center gap-2",children:[d.jsx(Bg,{size:16})," Custom Sources"]}),d.jsx("p",{className:"text-xs text-[#666] mt-1",children:"Point MeshAI at any public REST/GeoJSON feed; it becomes a routable family in Notifications — sitting alongside the built-in feeds above."})]}),d.jsx(ZCe,{})]}),d.jsxs("details",{className:"group border border-border p-4",children:[d.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm font-medium text-[#e0e0e0] hover:text-white",children:[d.jsx(Ah,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced: Geocoder"]}),d.jsx("p",{className:"mt-2 text-xs text-[#666]",children:"Configures the Photon reverse-geocoder used to resolve place names."}),d.jsxs("div",{className:"mt-4 space-y-3 pl-6 border-l border-border",children:[d.jsx(gt,{label:"Geocoder URL",value:((dy=e.geocoder)==null?void 0:dy.url)??"https://photon.komoot.io",onChange:se=>Me({geocoder:{...e.geocoder,url:se}}),placeholder:"https://photon.komoot.io",helper:"Photon geocoding endpoint"}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsx(Ne,{label:"Timeout (s)",value:((Xh=e.geocoder)==null?void 0:Xh.timeout_seconds)??2,onChange:se=>Me({geocoder:{...e.geocoder,timeout_seconds:se}}),min:0,step:.5,helper:"HTTP timeout per geocode request"}),d.jsx(Ne,{label:"Search Radius (km)",value:((nl=e.geocoder)==null?void 0:nl.radius_km)??80,onChange:se=>Me({geocoder:{...e.geocoder,radius_km:se}}),min:0,helper:"Bias radius around the configured center for results"}),d.jsx(Ne,{label:"Result Limit",value:((Iv=e.geocoder)==null?void 0:Iv.limit)??10,onChange:se=>Me({geocoder:{...e.geocoder,limit:se}}),min:1,helper:"Max candidate results to consider"})]})]})]})]})]})}function t2e(e){if(e==null||e==="")return"—";let t;if(typeof e=="number")t=new Date(e<1e12?e*1e3:e);else{const r=Number(e);t=Number.isFinite(r)&&e.trim()!==""?new Date(r<1e12?r*1e3:r):new Date(e)}return isNaN(t.getTime())?"—":t.toLocaleString()}function r2e(e){switch(e){case"meshtastic":return{label:"Meshtastic",cls:"bg-blue-500/15 text-blue-400 border border-blue-500/30"};case"meshcore":return{label:"MeshCore",cls:"bg-green-500/15 text-green-400 border border-green-500/30"};default:return{label:"Legacy",cls:"bg-slate-500/15 text-slate-400 border border-slate-600/40"}}}function n2e(e){return e==null||e===""?"—":typeof e=="number"?`ch ${e}`:e.startsWith("#")?e:`#${e}`}const a2e={nws_alerts:"Weather",fires:"Fire",fire_digest_broadcasts:"Fire digest",satpass_events:"Satellite",band_conditions_broadcasts:"Band",traffic_events:"Traffic",quake_events:"Quake",swpc_events:"Space Wx",gauge_readings:"Hydro",event_log:"Avalanche",ipaws_alerts:"Emergency"},i2e=[["🚨","Emergency"],["🔥","Fire"],["🚧","Traffic"],["⚠️ Road Incident","Traffic"],["🚫","Traffic"],["⛷","Avalanche"],["🌊","Hydro"],["🧲","Space Wx"],["☀️","Space Wx"],["🌐","Quake"],["⏳","Weather"],["🌡️","Weather"],["🌬️","Weather"],["⛈️","Weather"],["🌩️","Weather"]];function o2e(e,t){if(e)return a2e[e]??e.replace(/_/g," ").replace(/s$/,"");if(t){for(const[r,n]of i2e)if(t.startsWith(r))return n}return"broadcast"}const s2e=[{value:"all",label:"All meshes"},{value:"meshtastic",label:"Meshtastic"},{value:"meshcore",label:"MeshCore"}],l2e=[{value:"all",label:"All types"},{value:"nws_alerts",label:"Weather"},{value:"fires",label:"Fires"},{value:"satpass_events",label:"Satellite"},{value:"band_conditions_broadcasts",label:"Band"},{value:"traffic_events",label:"Traffic"},{value:"ipaws_alerts",label:"Emergency"}],cx=100;function qB(){const[e,t]=E.useState([]),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState("all"),[l,u]=E.useState("all"),[c,h]=E.useState(cx);return E.useEffect(()=>{document.title="Activity Log — MeshAI"},[]),E.useEffect(()=>{let f=!0;const v=()=>{zJ(c,o,l).then(m=>{f&&(t(m),i(null),n(!1))}).catch(m=>{f&&(i(m.message),n(!1))})};v();const g=setInterval(v,5e3);return()=>{f=!1,clearInterval(g)}},[c,o,l]),r?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading activity…"})}):a?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsxs("div",{className:"text-red-400",children:["Error: ",a]})}):d.jsx("div",{className:"space-y-4",children:d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"p-4 border-b border-border flex items-center flex-wrap gap-2",children:[d.jsx(Oo,{size:14,className:"text-[#f59e0b]"}),d.jsx("h2",{className:"text-sm font-medium text-slate-300",children:"Activity Log"}),d.jsx("select",{value:o,onChange:f=>{s(f.target.value),h(cx)},className:"text-xs bg-bg-hover text-slate-300 border border-border rounded px-2 py-1",children:s2e.map(f=>d.jsx("option",{value:f.value,children:f.label},f.value))}),d.jsx("select",{value:l,onChange:f=>{u(f.target.value),h(cx)},className:"text-xs bg-bg-hover text-slate-300 border border-border rounded px-2 py-1",children:l2e.map(f=>d.jsx("option",{value:f.value,children:f.label},f.value))}),d.jsxs("span",{className:"text-xs text-slate-500 ml-auto",children:[e.length," broadcast",e.length===1?"":"s"," · newest first"]})]}),e.length===0?d.jsxs("div",{className:"flex items-center gap-2 text-slate-500 p-8",children:[d.jsx(bi,{size:18}),d.jsx("span",{children:"No outbound broadcasts recorded yet."})]}):d.jsx("ul",{className:"divide-y divide-border",children:e.map(f=>{const v=r2e(f.transport);return d.jsx("li",{className:"p-4 hover:bg-bg-hover transition-colors",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx("div",{className:"pt-0.5",children:f.success===1?d.jsx(bk,{size:16,className:"text-green-500"}):f.success===0?d.jsx(Vj,{size:16,className:"text-amber-500"}):d.jsx(Vj,{size:16,className:"text-slate-600"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsxs("div",{className:"flex items-center flex-wrap gap-2 mb-1",children:[d.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${v.cls}`,children:v.label}),d.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-bg-hover text-slate-400 border border-border",children:n2e(f.channel)}),d.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-[#f59e0b]/10 text-[#f59e0b]",children:o2e(f.source_event_table,f.text)}),f.success===1&&d.jsx("span",{className:"text-xs text-green-500",children:"Sent"}),f.success===0&&d.jsx("span",{className:"text-xs text-amber-500",children:"Skip"}),(f.success===null||f.success===void 0)&&d.jsx("span",{className:"text-xs text-slate-500",children:"—"})]}),d.jsx("div",{className:"text-sm text-slate-200 break-words whitespace-pre-wrap",children:f.text||d.jsx("span",{className:"text-slate-500 italic",children:"(no text)"})}),d.jsxs("div",{className:"flex items-center gap-1 mt-1.5 text-xs text-slate-500 font-mono",children:[d.jsx(IV,{size:12}),t2e(f.sent_at)]})]})]})},f.id)})}),e.length>=c&&d.jsx("div",{className:"p-3 border-t border-border flex justify-center",children:d.jsx("button",{onClick:()=>h(f=>f+cx),className:"text-xs px-3 py-1 rounded bg-bg-hover text-slate-300 border border-border hover:bg-bg-card transition-colors",children:"Load more"})})]})})}const KB=[{id:"stream-gauges",label:"Stream Gauges",icon:c1},{id:"wildfire",label:"Wildfire",icon:Rm},{id:"firms",label:"Satellite Fire Detection (FIRMS)",icon:f1},{id:"fire-tracker",label:"Fire Tracker (Fusion)",icon:_J},{id:"weather-alerts",label:"Weather Alerts",icon:yJ},{id:"solar",label:"Solar & Geomagnetic",icon:HV},{id:"ducting",label:"Tropospheric Ducting",icon:bi},{id:"avalanche",label:"Avalanche Danger",icon:kf},{id:"traffic",label:"Traffic Flow",icon:u1},{id:"roads-511",label:"Road Conditions (511)",icon:PV},{id:"mesh-health",label:"Mesh Health",icon:Oo},{id:"broadcast-types",label:"Broadcast Types",icon:FV},{id:"reminders",label:"Reminder System",icon:IV},{id:"notifications",label:"Notifications",icon:kV},{id:"commands",label:"Commands",icon:UV},{id:"llm-dm",label:"LLM DM Queries",icon:wk},{id:"or-not-and",label:"OR-not-AND Architecture",icon:Sk},{id:"adapter-config",label:"Adapter Config & CODE Rule",icon:Bg},{id:"curation",label:"Curation: Gauges & Towns",icon:EV},{id:"schema",label:"Schema Migrations",icon:SJ},{id:"api",label:"API Reference",icon:xJ}];function mr({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 d.jsx("span",{className:`inline-block w-3 h-3 rounded-full ${t[e]}`})}function Gt({headers:e,rows:t}){return d.jsx("div",{className:"overflow-x-auto my-4",children:d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsx("tr",{className:"bg-[#1a2332] border-b border-[#2a3a4a]",children:e.map((r,n)=>d.jsx("th",{className:"px-4 py-2 text-left text-slate-400 font-medium",children:r},n))})}),d.jsx("tbody",{children:t.map((r,n)=>d.jsx("tr",{className:`border-b border-[#1e2a3a] ${n%2===0?"bg-[#0d1219]":"bg-[#0a0e17]"}`,children:r.map((a,i)=>d.jsx("td",{className:"px-4 py-2 text-slate-300",children:a},i))},n))})]})})}function er({href:e,children:t}){return d.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-1",children:[t," ",d.jsx(Jc,{size:12})]})}function _e({children:e}){return d.jsx("h3",{className:"text-lg font-semibold text-slate-200 mt-6 mb-3",children:e})}function yl({children:e}){return d.jsx("h4",{className:"text-base font-medium text-slate-300 mt-4 mb-2",children:e})}function fe({children:e}){return d.jsx("code",{className:"font-mono text-accent bg-[#1a2332] px-1 rounded",children:e})}function Ir({id:e,title:t,children:r}){return d.jsxs("section",{id:e,className:"mb-12 scroll-mt-6",children:[d.jsx("h2",{className:"text-2xl font-bold text-slate-100 mb-4 pb-2 border-b border-[#2a3a4a]",children:t}),d.jsx("div",{className:"text-slate-300 leading-relaxed space-y-4",children:r})]})}function u2e(){const e=xu(),[t,r]=E.useState(""),[n,a]=E.useState("stream-gauges"),i=E.useRef(null);E.useEffect(()=>{const l=e.hash.replace("#","");if(l&&KB.find(u=>u.id===l)){a(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"})}},[e.hash]);const o=KB.filter(l=>l.label.toLowerCase().includes(t.toLowerCase())),s=l=>{a(l);const u=document.getElementById(l);u&&u.scrollIntoView({behavior:"smooth"}),window.history.replaceState(null,"",`#${l}`)};return d.jsxs("div",{className:"flex h-full -m-6",children:[d.jsxs("aside",{className:"w-64 flex-shrink-0 bg-bg-card border-r border-border overflow-y-auto",children:[d.jsx("div",{className:"p-4 border-b border-border",children:d.jsxs("div",{className:"relative",children:[d.jsx(v1,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-500"}),d.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"})]})}),d.jsx("nav",{className:"py-2",children:o.map(l=>{const u=l.icon,c=n===l.id;return d.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:[d.jsx(u,{size:16}),l.label]},l.id)})})]}),d.jsx("div",{ref:i,className:"flex-1 overflow-y-auto p-6",children:d.jsxs("div",{className:"max-w-4xl",children:[d.jsx("p",{className:"text-slate-400 mb-8",children:"Everything you need to understand and configure MeshAI's monitoring and alerting systems."}),d.jsxs(Ir,{id:"stream-gauges",title:"Stream Gauges",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI watches river and stream levels at gauges you configure. Each gauge reports two things:"}),d.jsxs("p",{children:[d.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.`]}),d.jsxs("p",{children:[d.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:`]}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"A small creek: 50-200 CFS"}),d.jsx("li",{children:"A mid-size river: 1,000-5,000 CFS"}),d.jsx("li",{children:"A big river in spring runoff: 10,000+ CFS"})]}),d.jsx(_e,{children:"When Does It Flood?"}),d.jsxs("p",{children:["Flood levels are set by the ",d.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.']}),d.jsxs("p",{children:[d.jsx("strong",{children:"Action Stage"})," — water is rising, time to start paying attention. Usually still inside the riverbanks."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Minor Flood"})," — low-lying roads start getting water on them. NWS issues a Flood Advisory."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Moderate Flood"})," — water in buildings near the river. Some people need to evacuate. NWS issues a Flood Warning."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Major Flood"})," — widespread flooding. Many people evacuating. Serious property damage."]}),d.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."}),d.jsx(_e,{children:"Low Water / Drought"}),d.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.`}),d.jsx(_e,{children:"Setting It Up"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Find your gauge at ",d.jsx(er,{href:"https://waterdata.usgs.gov/nwis",children:"waterdata.usgs.gov/nwis"})]}),d.jsxs("li",{children:["Copy the site number (like ",d.jsx(fe,{children:"13090500"}),")"]}),d.jsx("li",{children:"Add it in Config → Environmental → USGS"}),d.jsx("li",{children:"MeshAI auto-fills the gauge name and flood levels from NWS"})]}),d.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."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://waterdata.usgs.gov/nwis",children:"USGS Water Data"})," — find gauges near you"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://water.noaa.gov",children:"NWS Water Prediction Service"})," — flood forecasts and thresholds"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.usgs.gov/special-topics/water-science-school/science/how-streamflow-measured",children:"Understanding Streamflow"})," — USGS explainer"]})]})]}),d.jsxs(Ir,{id:"wildfire",title:"Wildfire",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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."}),d.jsx(_e,{children:"Fire Size — How Big Is It?"}),d.jsx(Gt,{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."]]}),d.jsx("p",{children:"For reference, 1,000 acres is about 1.5 square miles."}),d.jsx(_e,{children:"Containment — Is It Under Control?"}),d.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."}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"0-30%"})," — Essentially uncontrolled. The fire goes where it wants."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"50%"})," — Good progress, but half the edge can still grow."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"80%+"})," — Well controlled. Major growth unlikely."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"100%"}),' — The edge is fully controlled. But the fire may STILL be actively burning inside. "100% contained" does NOT mean "out."']})]}),d.jsx(_e,{children:"How Far Away Should I Worry?"}),d.jsx(Gt,{headers:["Distance","What To Do"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Under 5 km (3 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Immediate threat."})," This is evacuation-order range. Embers can fly this far in wind."]})],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," 5-15 km (3-10 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Prepare."})," The fire could reach you in hours under bad conditions. Have a plan."]})],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," 15-30 km (10-20 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Watch."})," Smoke is likely. Wind shifts could change things fast."]})],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Over 30 km (20 miles)"]}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Awareness."})," Keep an eye on it, but no immediate threat."]})]]}),d.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."}),d.jsx(_e,{children:"Which Matters More — Size or Distance?"}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Setting It Up"}),d.jsxs("p",{children:["Just configure your state code (like ",d.jsx(fe,{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."]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://inciweb.nwcg.gov",children:"InciWeb"})," — detailed incident information"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://data-nifc.opendata.arcgis.com",children:"NIFC Fire Map"})," — raw perimeter data"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.ready.gov/wildfires",children:"Ready.gov Wildfires"})," — preparedness guide"]})]})]}),d.jsxs(Ir,{id:"firms",title:"Satellite Fire Detection (FIRMS)",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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.`}),d.jsxs("p",{children:[d.jsx("strong",{children:"Why this matters"}),": satellite hotspots show up ",d.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."]}),d.jsx(_e,{children:"Confidence — Is It Really a Fire?"}),d.jsx("p",{children:"Each detection gets a confidence rating:"}),d.jsx(Gt,{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."]]}),d.jsxs("p",{children:[d.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.`]}),d.jsx(_e,{children:"FRP — How Intense Is It?"}),d.jsx("p",{children:'FRP (Fire Radiative Power) measures the heat output in megawatts. Think of it as "how hot is this thing":'}),d.jsx(Gt,{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"]]}),d.jsx("p",{children:"Setting the minimum FRP to 5 MW filters out most industrial and agricultural false alarms."}),d.jsx(_e,{children:"New Ignition Detection"}),d.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 ",d.jsx("strong",{children:"potential new ignition"})," — maybe a new fire just started. These get elevated priority regardless of confidence level."]}),d.jsx(_e,{children:"Timing"}),d.jsxs("p",{children:["Satellite data arrives ",d.jsx("strong",{children:"1-3 hours"})," after the satellite passes overhead. Each location gets observed about ",d.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."`]}),d.jsx(_e,{children:"Getting an API Key"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Go to ",d.jsx(er,{href:"https://firms.modaps.eosdis.nasa.gov/api/area/",children:"FIRMS API page"})]}),d.jsx("li",{children:'Click "Get MAP_KEY"'}),d.jsx("li",{children:"Register for a free Earthdata account"}),d.jsx("li",{children:"Your key arrives by email"}),d.jsx("li",{children:"Enter it in Config → Environmental → FIRMS"})]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://firms.modaps.eosdis.nasa.gov",children:"FIRMS Fire Map"})," — see hotspots on a map"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://earthdata.nasa.gov/data/tools/firms/faq",children:"FIRMS FAQ"})," — how it works"]})]})]}),d.jsxs(Ir,{id:"fire-tracker",title:"Fire Tracker (Fusion)",children:[d.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."}),d.jsx(_e,{children:"What you'll see on the mesh"}),d.jsx("p",{children:"Six fire-family alert categories, in order of when they fire during an incident's lifecycle:"}),d.jsx(Gt,{headers:["Category","Severity","Trigger","Example broadcast"],rows:[[d.jsx(fe,{children:"unattributed_hotspot_cluster"}),"Priority","3+ FIRMS pixels within 1 mi over 60 min, no WFIGS match — possible new ignition before NIFC declares it",d.jsx("span",{className:"text-amber-300",children:"🔥 Possible new fire: 3 hotspots within 1 mi @ 42.93,-114.45 (combined 78 MW)"})],[d.jsx(fe,{children:"wildfire_declared"}),"Priority","WFIGS first-sight of a new IRWIN incident — the official 'this is a fire and here is its name' record",d.jsx("span",{className:"text-amber-300",children:"🔥 New: Cache Peak Fire (WF), 3 mi N of Almo: 250 ac, 0% contained"})],[d.jsx(fe,{children:"wildfire_growth"}),"Priority","Per-pass centroid drift >= 0.5 mi (configurable) between consecutive satellite passes — the fire's footprint moved",d.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire moving NE 1.2 mi/h, ~3 mi from Almo"})],[d.jsx(fe,{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",d.jsx("span",{className:"text-amber-300",children:"🔥 Possible spotting 2.1 mi NE of Cache Peak Fire perimeter"})],[d.jsx(fe,{children:"wildfire_incident"}),"Priority","WFIGS acreage or containment increased on a fire already broadcast once (the Update path; the New path uses wildfire_declared)",d.jsx("span",{className:"text-amber-300",children:"🔥 Update: Cache Peak Fire: 1,847 ac, 23% contained"})],[d.jsx(fe,{children:"wildfire_halted"}),"Routine","No FIRMS pixels attributed for 12+ hours (configurable) — fire stalled or out",d.jsx("span",{className:"text-amber-300",children:"🔥 Cache Peak Fire no growth in 14h"})]]}),d.jsx(_e,{children:"How attribution works"}),d.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 ",d.jsx(fe,{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."]}),d.jsxs("p",{children:["Pixels that match no fire feed the cluster detector instead: if at least"," ",d.jsx(fe,{children:"cluster_min_pixels"})," (default 3) lie within"," ",d.jsx(fe,{children:"cluster_max_radius_mi"})," (default 1.0) over"," ",d.jsx(fe,{children:"cluster_time_window_minutes"})," (default 60), the bot fires a single ",d.jsx(fe,{children:"unattributed_hotspot_cluster"})," broadcast and marks the member pixels so a fourth arrival doesn't re-fire the same cluster."]}),d.jsx(_e,{children:"How movement is computed"}),d.jsxs("p",{children:["Each VIIRS pass groups pixels into a ",d.jsx(fe,{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 ≥ ",d.jsx(fe,{children:"growth_drift_threshold_mi"})," the"," ",d.jsx(fe,{children:"wildfire_growth"})," broadcast fires."]}),d.jsx(_e,{children:"How spotting is detected"}),d.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 ≥"," ",d.jsx(fe,{children:"spotting_distance_threshold_mi"})," (default 1.5) fire the"," ",d.jsx(fe,{children:"wildfire_spotting"})," broadcast at ",d.jsx("em",{children:"immediate"})," severity — spread beyond the existing perimeter is the most actionable fire signal we emit. A per-fire cooldown (",d.jsx(fe,{children:"spotting_cooldown_seconds"}),", default 1 h) prevents an ember burst in the same area from spamming the mesh."]}),d.jsx(_e,{children:"Tunable knobs (Adapter Config → fires)"}),d.jsx(Gt,{headers:["Key","Default","What it does"],rows:[[d.jsx(fe,{children:"spread_radius_mi_default"}),"5.0 mi","Attribution radius for FIRMS → fire matching. Per-fire override in the fires.spread_radius_mi column."],[d.jsx(fe,{children:"growth_drift_threshold_mi"}),"0.5 mi","Per-pass centroid drift at or above this fires wildfire_growth."],[d.jsx(fe,{children:"halt_passes_threshold"}),"2","Consecutive empty satellite passes before wildfire_halted (documented; the time gate below is the operational rule)."],[d.jsx(fe,{children:"halt_minimum_seconds"}),"43,200 (12 h)","Minimum elapsed seconds since the most recent attributed pixel before wildfire_halted can fire."],[d.jsx(fe,{children:"spotting_distance_threshold_mi"}),"1.5 mi","Distance from prior-pass perimeter that fires wildfire_spotting."],[d.jsx(fe,{children:"spotting_cooldown_seconds"}),"3,600 (1 h)","Minimum seconds between consecutive spotting broadcasts per fire."]]})]}),d.jsxs(Ir,{id:"weather-alerts",title:"Weather Alerts",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI watches for NWS (National Weather Service) alerts affecting your area — warnings, watches, and advisories."}),d.jsx(_e,{children:"Alert Severity — How Serious Is It?"}),d.jsx(Gt,{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"]]}),d.jsx(_e,{children:"When Should I Act? (Urgency)"}),d.jsx(Gt,{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"]]}),d.jsx(_e,{children:"How Sure Are They? (Certainty)"}),d.jsx(Gt,{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"]]}),d.jsx(_e,{children:"These Are Separate Scales"}),d.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."'}),d.jsx(_e,{children:"What Minimum Severity Should I Set?"}),d.jsx(Gt,{headers:["Setting","What You Get","What You Miss"],rows:[["Minor","Everything — high volume","Nothing"],[d.jsxs(d.Fragment,{children:[d.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"]]}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Finding Your NWS Zone"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Go to ",d.jsx(er,{href:"https://www.weather.gov",children:"weather.gov"})]}),d.jsx("li",{children:"Enter your location"}),d.jsxs("li",{children:["Find your zone code at ",d.jsx(er,{href:"https://www.weather.gov/pimar/PubZone",children:"NWS Zone Map"})]}),d.jsxs("li",{children:["Zone codes look like: ",d.jsx(fe,{children:"IDZ016"}),", ",d.jsx(fe,{children:"UTZ040"}),", etc."]})]}),d.jsx(_e,{children:"The User-Agent Field"}),d.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:"}),d.jsx("p",{children:d.jsx(fe,{children:"(meshai, you@email.com)"})}),d.jsx("p",{children:"No registration. No waiting. Just type it in."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://alerts.weather.gov",children:"NWS Active Alerts"})," — see current alerts"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.weather.gov/documentation/services-web-api",children:"NWS API Docs"})," — technical details"]})]})]}),d.jsxs(Ir,{id:"solar",title:"Solar & Geomagnetic Conditions",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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."}),d.jsx(_e,{children:"Solar Flux Index (SFI)"}),d.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.'}),d.jsx(Gt,{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."]]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Quick rule"}),": SFI above 90 and Kp below 4 = good day for HF radio."]}),d.jsx(_e,{children:"Kp Index"}),d.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."}),d.jsx(Gt,{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."],[d.jsx("strong",{children:"5"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Minor storm (G1)."})," HF noticeably degraded. Aurora visible at high latitudes (~60°N)."]})],[d.jsx("strong",{children:"6"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Moderate storm (G2)."})," HF getting rough. Aurora moving south (~55°N)."]})],[d.jsx("strong",{children:"7"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Strong storm (G3)."})," HF unreliable for 1-2 days. Aurora at mid-latitudes."]})],[d.jsx("strong",{children:"8-9"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Severe/Extreme storm."})," HF may black out completely. Aurora visible at very low latitudes. Power grid stress possible."]})]]}),d.jsx(_e,{children:"R / S / G Scales"}),d.jsx("p",{children:"NOAA's shorthand for three types of space weather events:"}),d.jsx(yl,{children:"R (Radio Blackouts) — from solar flares:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"R1-R2: Brief HF disruption. You might not notice."}),d.jsx("li",{children:"R3: HF goes out for about an hour on the sunlit side of Earth."}),d.jsx("li",{children:"R4-R5: HF dead for hours. Serious."})]}),d.jsx(yl,{children:"S (Solar Radiation Storms) — from energetic particles:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Mostly affects polar regions and satellites"}),d.jsx("li",{children:"S3+: Polar HF goes out entirely"})]}),d.jsx(yl,{children:"G (Geomagnetic Storms) — from solar wind disturbances:"}),d.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:d.jsx("li",{children:"Same as the Kp scale: G1 = Kp 5, up to G5 = Kp 9"})}),d.jsx(_e,{children:"Bz — The Storm Predictor"}),d.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."}),d.jsx(Gt,{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."]]}),d.jsx("p",{children:"Bz can change fast — minute to minute. What matters is whether it stays negative for hours, not brief dips."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://www.swpc.noaa.gov",children:"SWPC Space Weather Dashboard"})," — live data"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.swpc.noaa.gov/noaa-scales-explanation",children:"NOAA Space Weather Scales"})," — what R/S/G mean"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.hamqsl.com/solar.html",children:"HamQSL Solar Page"})," — ham-friendly display"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.swpc.noaa.gov/products/planetary-k-index",children:"Planetary K-Index"})," — live Kp"]})]})]}),d.jsxs(Ir,{id:"ducting",title:"Tropospheric Ducting",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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.'}),d.jsx("p",{children:"MeshAI watches for these conditions by analyzing weather data (temperature and humidity at different altitudes) over your mesh area."}),d.jsx(_e,{children:"How Do I Know If Ducting Is Happening?"}),d.jsx("p",{children:'MeshAI reports a "condition" based on the atmospheric profile:'}),d.jsx(Gt,{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.']]}),d.jsx(_e,{children:"What You'll Actually Notice"}),d.jsx("p",{children:"When ducting happens on your mesh:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Distant repeaters you've never heard suddenly come in"}),d.jsx("li",{children:"Nodes appear from far outside your normal range"}),d.jsx("li",{children:"You hear FM radio stations from other cities"}),d.jsx("li",{children:"ADS-B flight tracking range gets much longer"}),d.jsx("li",{children:"There might be interference from distant stations on your frequency"})]}),d.jsx(_e,{children:"The dM/dz Number"}),d.jsx("p",{children:`The dashboard shows a "dM/dz" value in "M-units/km." You don't need to understand the math — just know:`}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Around 118"})," = normal atmosphere"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Below 79"})," = enhanced propagation starting"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Below 0 (negative)"})," = ducting is happening"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Below -50"})," = strong ducting — classic VHF/UHF DX event"]})]}),d.jsx(_e,{children:"When Does Ducting Happen?"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Under high-pressure weather systems (clear, stable air)"}),d.jsx("li",{children:"When warm air sits on top of cool air (temperature inversion)"}),d.jsx("li",{children:"Most common in late summer and early fall"}),d.jsx("li",{children:"Strongest along coastlines and over water"}),d.jsx("li",{children:"In mountain valleys: cold air pooling in fall/winter can create surface ducts"})]}),d.jsx(_e,{children:"Setting It Up"}),d.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."}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://dxinfocentre.com/tropo.html",children:"Tropo Forecast Maps (Hepburn)"})," — 6-day tropo prediction"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://dxmaps.com",children:"DX Maps"})," — real-time VHF/UHF propagation reports"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://en.wikipedia.org/wiki/Tropospheric_propagation",children:"Wikipedia: Tropospheric Propagation"})," — background"]})]})]}),d.jsxs(Ir,{id:"avalanche",title:"Avalanche Danger",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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."}),d.jsx(_e,{children:"The Danger Scale"}),d.jsx(Gt,{headers:["Level","Name","Color","What To Do"],rows:[["1","Low",d.jsx(mr,{color:"green"}),"Generally safe. Normal caution in steep terrain."],["2","Moderate",d.jsx(mr,{color:"yellow"}),"Be careful on specific terrain features. Evaluate conditions."],["3","Considerable",d.jsx(mr,{color:"orange"}),d.jsxs(d.Fragment,{children:[d.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",d.jsx(mr,{color:"red"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Very dangerous."})," Stay off anything steep."]})],["5","Extreme",d.jsx(mr,{color:"black"}),d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Don't go out."})," Avalanches are happening on their own."]})]]}),d.jsx(_e,{children:"The Most Important Thing to Know"}),d.jsxs("p",{children:[d.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.']}),d.jsx(_e,{children:"Seasonal"}),d.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.'}),d.jsx(_e,{children:"Finding Your Avalanche Center"}),d.jsxs("p",{children:["Go to ",d.jsx(er,{href:"https://avalanche.org/avalanche-centers/",children:"avalanche.org/avalanche-centers/"})," for a map. Common center codes:"]}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"SNFAC"})," — Sawtooth (central Idaho)"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"UAC"})," — Utah"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"NWAC"})," — Cascades/Olympics (WA/OR)"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"CAIC"})," — Colorado"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"SAC"})," — Sierra Nevada (CA)"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GNFAC"})," — Gallatin (SW Montana)"]})]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://avalanche.org",children:"Avalanche.org"})," — US forecasts"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://avalanche.org/avalanche-encyclopedia/human/resources/north-american-public-avalanche-danger-scale/",children:"Avalanche Danger Scale"})," — full scale explanation"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://kbyg.org",children:"Know Before You Go"})," — avalanche awareness"]})]})]}),d.jsxs(Ir,{id:"traffic",title:"Traffic Flow",children:[d.jsx(_e,{children:"What You're Looking At"}),d.jsx("p",{children:"MeshAI monitors traffic speed on road segments you configure, using data from TomTom (real vehicles with navigation apps reporting their speed)."}),d.jsx(_e,{children:"Speed Ratio — The Key Number"}),d.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:'}),d.jsx(Gt,{headers:["Ratio","What It Means"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Above 85%"]}),"Normal. Traffic flowing fine."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," 65-85%"]}),"Slow. Heavier than usual but moving."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," 40-65%"]}),"Congested. Significant delays."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Below 40%"]}),"Gridlock. Barely moving."]]}),d.jsxs("p",{children:[d.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.`]}),d.jsx(_e,{children:"Confidence — Can You Trust the Data?"}),d.jsx("p",{children:"TomTom's confidence score tells you how much of the reading comes from real vehicles right now vs historical averages:"}),d.jsx(Gt,{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",d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Unreliable"})," — mostly guessing from historical patterns. Don't alert on this."]})]]}),d.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."}),d.jsx(_e,{children:"Setting Up Corridors"}),d.jsx("p",{children:'Each "corridor" is a point on a road you want to monitor. To add one:'}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsx("li",{children:"Go to Google Maps, find the road"}),d.jsx("li",{children:`Right-click the road → "What's here?" → copy the coordinates`}),d.jsx("li",{children:"Add the corridor in Config with a name and those coordinates"}),d.jsx("li",{children:"TomTom finds the nearest road segment automatically"})]}),d.jsx(_e,{children:"Getting an API Key"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Sign up at ",d.jsx(er,{href:"https://developer.tomtom.com",children:"developer.tomtom.com"})," (free)"]}),d.jsx("li",{children:"Create an app → get your API key"}),d.jsx("li",{children:"Free tier: 2,500 requests/day (plenty for 5-10 corridors)"})]}),d.jsx(_e,{children:"Learn More"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(er,{href:"https://developer.tomtom.com",children:"TomTom Developer Portal"})," — API docs and key signup"]}),d.jsxs("li",{children:[d.jsx(er,{href:"https://www.tomtom.com/traffic-index/",children:"TomTom Traffic Index"})," — city congestion rankings"]})]})]}),d.jsxs(Ir,{id:"roads-511",title:"Road Conditions (511)",children:[d.jsx(_e,{children:"What You're Looking At"}),d.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."}),d.jsx(_e,{children:"Setting It Up"}),d.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."}),d.jsx("p",{children:"Configure in Config → Environmental → 511:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Base URL"})," — your state's API endpoint"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"API Key"})," — if required by your state"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Endpoints"})," — which data feeds to poll (varies by state)"]})]}),d.jsx(_e,{children:"Learn More"}),d.jsx("p",{children:"Check your state's 511 or DOT website for developer information."})]}),d.jsxs(Ir,{id:"mesh-health",title:"Mesh Health",children:[d.jsx(_e,{children:"Health Score"}),d.jsx("p",{children:"MeshAI computes a 0-100 health score for your mesh network by looking at five areas, each weighted differently:"}),d.jsx(Gt,{headers:["Pillar","Weight","What It Measures"],rows:[[d.jsx("strong",{children:"Infrastructure"}),"30%","Are your routers online?"],[d.jsx("strong",{children:"Utilization"}),"25%","Is the radio channel congested?"],[d.jsx("strong",{children:"Coverage"}),"20%","Do nodes have redundant paths to gateways?"],[d.jsx("strong",{children:"Behavior"}),"15%","Are any nodes flooding the channel?"],[d.jsx("strong",{children:"Power"}),"10%","Are battery-powered nodes running low?"]]}),d.jsx("p",{children:"The overall score is the weighted sum:"}),d.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%)"}),d.jsx(_e,{children:"How Each Pillar Is Calculated"}),d.jsx(yl,{children:"Infrastructure (30%)"}),d.jsx("p",{children:"This is the simplest pillar — what percentage of your infrastructure nodes are currently online?"}),d.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"(routers online ÷ total routers) × 100"}),d.jsxs("p",{children:["Only nodes with the ",d.jsx(fe,{children:"ROUTER"}),", ",d.jsx(fe,{children:"ROUTER_LATE"}),", or ",d.jsx(fe,{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."]}),d.jsxs("p",{children:[d.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."]}),d.jsx(yl,{children:"Utilization (25%)"}),d.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 ",d.jsx("strong",{children:"highest"})," value from any infrastructure node because the busiest router is the bottleneck for the whole mesh."]}),d.jsx("p",{children:d.jsx("strong",{children:"How it works:"})}),d.jsxs("ol",{className:"list-decimal list-inside space-y-1 ml-4",children:[d.jsxs("li",{children:["Collect ",d.jsx(fe,{children:"channel_utilization"})," from all infrastructure nodes that report it"]}),d.jsx("li",{children:"If no infra nodes have telemetry, try all nodes"}),d.jsxs("li",{children:["Use the ",d.jsx("strong",{children:"maximum"})," value for scoring (busiest node = bottleneck)"]}),d.jsx("li",{children:"If no nodes report utilization (older firmware), fall back to packet count estimate"})]}),d.jsxs("p",{className:"mt-4",children:[d.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."]}),d.jsx(Gt,{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"]]}),d.jsxs("p",{children:[d.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."]}),d.jsx(yl,{children:"Coverage (20%)"}),d.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.'}),d.jsxs("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:["coverage_ratio = average_gateways_per_node ÷ total_sources",d.jsx("br",{}),"single_gw_penalty = (single_gateway_nodes ÷ total_nodes) × 40"]}),d.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."}),d.jsx(Gt,{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"]]}),d.jsxs("p",{children:[d.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.)."]}),d.jsx(yl,{children:"Behavior (15%)"}),d.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."}),d.jsxs("p",{children:[d.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."]}),d.jsx(Gt,{headers:["Flagged Nodes","Score"],rows:[["0","100"],["1","80"],["2-3","60"],["4-5","40"],["6+","20"]]}),d.jsx("p",{children:"A single misbehaving node only drops the score to 80. It takes multiple problem nodes to seriously hurt the behavior pillar."}),d.jsx(yl,{children:"Power (10%)"}),d.jsx("p",{children:"Measures what fraction of battery-powered nodes are below the warning threshold (default 20%)."}),d.jsx("p",{className:"p-3 bg-slate-800 rounded font-mono text-sm",children:"100 × (1 − low_battery_nodes ÷ total_battery_nodes)"}),d.jsx("p",{children:"If 2 out of 10 battery nodes are below 20%, power scores 80."}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Health Tiers"}),d.jsx(Gt,{headers:["Score","Tier","What It Means"],rows:[["90-100",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Healthy"]}),"Everything's working well."],["75-89",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," Slight degradation"]}),"Some issues but the mesh is functional."],["50-74",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," Unhealthy"]}),"Multiple problems. Reliability is affected."],["25-49",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Warning"]}),"Significant issues. The mesh is struggling."],["0-24",d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"black"})," Critical"]}),"Major failures. Barely functional."]]}),d.jsx(_e,{children:"Channel Utilization — Is the Radio Channel Full?"}),d.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."}),d.jsx(Gt,{headers:["Utilization","What's Happening"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"green"})," Under 25%"]}),"Healthy. The firmware itself starts throttling above 25% to protect the channel — so under 25% is the target."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"yellow"})," 25-40%"]}),"Getting busy. Common on larger meshes. Worth watching."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"orange"})," 40-50%"]}),"Congested. The firmware throttles GPS updates above 40%. Messages are colliding and retrying."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"red"})," Over 50%"]}),"Serious problem. More time is spent retrying than communicating. Mesh reliability drops fast."],[d.jsxs(d.Fragment,{children:[d.jsx(mr,{color:"black"})," Over 65%"]}),"Documented failure point on busy LONG_FAST meshes. The mesh becomes unusable."]]}),d.jsx(_e,{children:"Packet Flooding"}),d.jsx("p",{className:"p-3 bg-yellow-500/10 border border-yellow-500/30 rounded text-yellow-200",children:d.jsx("strong",{children:'⚠️ "Packet flooding" means a node sending too many RADIO PACKETS. This has nothing to do with water flooding.'})}),d.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."}),d.jsx(Gt,{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."]]}),d.jsx(_e,{children:"Battery Levels"}),d.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:"}),d.jsx(Gt,{headers:["Voltage","Charge","What To Do"],rows:[["4.20V","100%","Full"],["3.80V","~60%","Fine"],[d.jsx("strong",{children:"3.60V"}),d.jsx("strong",{children:"~30%"}),d.jsx(d.Fragment,{children:d.jsx("strong",{children:"⚠️ Warning — charge it soon"})})],[d.jsx("strong",{children:"3.50V"}),d.jsx("strong",{children:"~15%"}),d.jsx(d.Fragment,{children:d.jsx("strong",{children:"🔴 Low — charge it now"})})],[d.jsx("strong",{children:"3.40V"}),d.jsx("strong",{children:"~7%"}),d.jsx(d.Fragment,{children:d.jsx("strong",{children:"⚫ About to die"})})],["3.30V","~3%","Device shutting down"]]}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Node Offline Detection"}),d.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:`}),d.jsx(Gt,{headers:["Node Type","Recommended Threshold","Why"],rows:[["Fixed infrastructure (wall power)",d.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."]]}),d.jsxs("p",{children:[d.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.`]})]}),d.jsxs(Ir,{id:"broadcast-types",title:"Broadcast Types",children:[d.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:"}),d.jsx(Gt,{headers:["Prefix","What it means","When you see it"],rows:[[d.jsx(fe,{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"],[d.jsx(fe,{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"],[d.jsx(fe,{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"]]}),d.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."})]}),d.jsxs(Ir,{id:"reminders",title:"Reminder System",children:[d.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"," ",d.jsx(fe,{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."]}),d.jsx(_e,{children:"Cadences"}),d.jsx(Gt,{headers:["Adapter","Reminder cadence","Termination"],rows:[[d.jsxs(d.Fragment,{children:[d.jsx(fe,{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"],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{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"],[d.jsx(fe,{children:"itd_511_work_zone"}),"Per-zone, configurable in the rule UI","WZDx publishes the zone with end_date in the past"]]}),d.jsx(_e,{children:"The tombstone"}),d.jsxs("p",{children:["When a WFIGS update declares an incident closed, the bot stamps"," ",d.jsx(fe,{children:"fires.tombstoned_at"})," with the close time. The reminder scheduler treats ",d.jsx(fe,{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.`]}),d.jsx(_e,{children:"Turning reminders off"}),d.jsxs("p",{children:["Per-adapter on/off lives in ",d.jsx(fe,{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."]})]}),d.jsxs(Ir,{id:"notifications",title:"Notifications",children:[d.jsx(_e,{children:"How It Works"}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Something happens"})," — a fire is detected, weather warning issued, node goes offline, etc."]}),d.jsxs("li",{children:[d.jsx("strong",{children:"MeshAI checks your rules"})," — does this event match any of your notification rules? Is it severe enough?"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"If a rule matches"})," — MeshAI sends the notification through whatever delivery method that rule is configured for."]})]}),d.jsx(_e,{children:"Building Rules"}),d.jsx("p",{children:"Each rule answers three questions:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"WHEN"})," does it trigger? (which categories, what severity)"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"WHERE"})," does it send? (mesh broadcast, email, webhook, etc.)"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"HOW OFTEN"})," at most? (cooldown period)"]})]}),d.jsx("p",{children:'Use "Add from Template" to start with a pre-built rule and customize it, or build from scratch with "Add Rule."'}),d.jsx(_e,{children:"Severity Levels — What Should I Set?"}),d.jsx(Gt,{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"],[d.jsxs(d.Fragment,{children:[d.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"]]}),d.jsxs("p",{children:[d.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."]}),d.jsx(_e,{children:"Webhook — The Swiss Army Knife"}),d.jsx("p",{children:"A webhook sends your alert as an HTTP POST to any URL. This one delivery method works with:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx("strong",{children:"Discord"})," — use a Discord webhook URL"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Slack"})," — use a Slack incoming webhook URL"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"ntfy.sh"})," — POST to ",d.jsx(fe,{children:"https://ntfy.sh/your-topic"})]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Pushover"})," — POST to the Pushover API"]}),d.jsxs("li",{children:[d.jsx("strong",{children:"Home Assistant"})," — POST to an automation webhook URL"]}),d.jsx("li",{children:"Anything else that accepts HTTP POST"})]}),d.jsx("p",{children:"MeshAI doesn't need to know what's on the other end. Give it the URL and it works."})]}),d.jsxs(Ir,{id:"commands",title:"Commands",children:[d.jsxs("p",{children:["All commands use the ",d.jsx(fe,{children:"!"})," prefix (configurable). Send these as a direct message to MeshAI on your mesh."]}),d.jsx(_e,{children:"Basic Commands"}),d.jsx(Gt,{headers:["Command","What It Does"],rows:[[d.jsx(fe,{children:"!help"}),"Shows all available commands"],[d.jsx(fe,{children:"!ping"}),"Tests if the bot is alive"],[d.jsx(fe,{children:"!status"}),"Quick mesh summary (nodes online, health score)"],[d.jsx(fe,{children:"!health"}),"Detailed health report with pillar scores"],[d.jsx(fe,{children:"!weather"}),"Current weather for your area"]]}),d.jsx(_e,{children:"Environmental Commands"}),d.jsx(Gt,{headers:["Command","What It Does"],rows:[[d.jsx(fe,{children:"!alerts"}),"Active NWS weather alerts for your area"],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"!solar"})," (or ",d.jsx(fe,{children:"!hf"}),")"]}),"Current solar indices and RF conditions"],[d.jsx(fe,{children:"!fire"}),"Active wildfires near your mesh"],[d.jsx(fe,{children:"!avy"}),'Avalanche advisory (seasonal — shows "off season" in summer)'],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"!streams"})," (or ",d.jsx(fe,{children:"!gauges"}),")"]}),"Stream gauge readings"],[d.jsxs(d.Fragment,{children:[d.jsx(fe,{children:"!roads"})," (or ",d.jsx(fe,{children:"!traffic"}),")"]}),"Road conditions and traffic flow"],[d.jsx(fe,{children:"!hotspots"}),"Satellite fire detections"]]}),d.jsx(_e,{children:"Conversational"}),d.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`," ",d.jsx("a",{href:"#llm-dm",className:"text-accent hover:underline",children:"LLM DM Queries"}),"."]})]}),d.jsxs(Ir,{id:"llm-dm",title:"LLM DM (Natural-Language Queries)",children:[d.jsxs("p",{children:["Bang commands like ",d.jsx(fe,{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."]}),d.jsx(_e,{children:"What it can answer"}),d.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:"}),d.jsx(Gt,{headers:["Adapter block","Example question that hits it","What you get back"],rows:[[d.jsx(fe,{children:"build_fires_detail"}),'"are there any fires near me?"',"Active WFIGS-declared fires, acreage, containment, declared_at, county/state"],[d.jsx(fe,{children:"build_alerts_detail"}),'"any weather alerts?"',"Active NWS CAP alerts: type, severity, area, expiry"],[d.jsx(fe,{children:"build_quakes_detail"}),'"any earthquakes nearby?"',"USGS quakes in the last 24h: magnitude, depth, place"],[d.jsx(fe,{children:"build_traffic_detail"}),'"how is traffic on I-84?" / "any road closures?"',"TomTom + ITD 511 active incidents"],[d.jsx(fe,{children:"build_gauges_detail"}),'"what is the snake river level?"',"USGS NWIS latest readings + flood stages"],[d.jsx(fe,{children:"build_swpc_detail"}),'"what are the band conditions?" / "any space weather?"',"Recent SWPC events + band-conditions ratings"],[d.jsx(fe,{children:"build_drop_audit"}),`"why didn't I hear about anything today?"`,"Event log: what envelopes the dispatcher filtered, by adapter + category"]]}),d.jsx(_e,{children:"The grounding rule"}),d.jsxs("p",{children:["The bot is told to answer ",d.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.']}),d.jsx(_e,{children:"Excluding an adapter from LLM context"}),d.jsxs("p",{children:["The ",d.jsx(fe,{children:"include_in_llm_context"})," toggle on each adapter's row in Adapter Config decides whether that adapter's ",d.jsx(fe,{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."]}),d.jsx(_e,{children:"What it can't answer"}),d.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.`})]}),d.jsxs(Ir,{id:"or-not-and",title:"OR-not-AND Architecture",children:[d.jsx("p",{children:"Every environmental adapter pulls its data from one of two places:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.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."]}),d.jsxs("li",{children:[d.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."]})]}),d.jsx(_e,{children:"Why mutually exclusive"}),d.jsxs("p",{children:["An adapter is set to ",d.jsx("strong",{children:"either"})," Central ",d.jsx("strong",{children:"or"})," ","native, never both. Running both at the same time is what the codebase calls the ",d.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."]}),d.jsx(_e,{children:"The per-adapter source toggle"}),d.jsxs("p",{children:["Set ",d.jsx(fe,{children:"feed_source"})," on each adapter's row in Environment:"]}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"central"})," — disable the native poll loop, subscribe to the matching Central subject pattern."]}),d.jsxs("li",{children:[d.jsx(fe,{children:"native"})," — disable the Central subscription for this adapter, run the native poller."]})]}),d.jsxs("p",{children:["On the GUI, adapters with ",d.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.`]}),d.jsx(_e,{children:"Where this surfaces in tooltips"}),d.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`," ",d.jsxs(fe,{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."]})]}),d.jsxs(Ir,{id:"adapter-config",title:"Adapter Config & the CODE Rule",children:[d.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."}),d.jsx(_e,{children:"The CONFIG-vs-CODE rule"}),d.jsx("p",{children:"Not everything tunable becomes a GUI row. The codebase splits along one rule:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.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)."]}),d.jsxs("li",{children:[d.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)."]})]}),d.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."}),d.jsx(_e,{children:"Restart-required vs live"}),d.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:"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:["Anything under the ",d.jsx(fe,{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."]}),d.jsx("li",{children:"The LLM backend swap (Google → Anthropic → OpenAI)."}),d.jsx("li",{children:"The dispatcher cold-start grace window."})]}),d.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.`}),d.jsxs(_e,{children:["The ",d.jsx(fe,{children:"include_in_llm_context"})," toggle"]}),d.jsxs("p",{children:[`Each adapter's card on Adapter Config carries a per-adapter "LLM context" switch. When off, that adapter's `,d.jsx(fe,{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."]})]}),d.jsxs(Ir,{id:"curation",title:"Curation: Gauge Sites & Town Anchors",children:[d.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."}),d.jsx(_e,{children:"Gauge Sites"}),d.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."}),d.jsxs("p",{children:[d.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."]}),d.jsxs("p",{children:[d.jsx("strong",{children:"Disabled rows"})," are ignored at dispatch time. The corresponding gauge still ingests into ",d.jsx(fe,{children:"gauge_readings"})," ","(so historical queries still work), it just doesn't broadcast."]}),d.jsx(_e,{children:"Town Anchors"}),d.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:']}),d.jsxs("ol",{className:"list-decimal list-inside ml-4 space-y-1",children:[d.jsx("li",{children:'Photon nearest-town lookup (the WFIGS path uses this — produces "near Long Creek Summit Home" style anchors)'}),d.jsx("li",{children:"Town Anchors table (your curated list)"}),d.jsx("li",{children:"Landclass label (county / federal-land identifier)"}),d.jsx("li",{children:"County + state fallback"}),d.jsx("li",{children:"Bare lat/lon coords"})]}),d.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.'}),d.jsxs("p",{children:["Example broadcast text rendered from a Town Anchors row:"," ",d.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"'})]})]}),d.jsxs(Ir,{id:"schema",title:"Schema Migrations",children:[d.jsxs("p",{children:["MeshAI persists state in a single SQLite database (",d.jsx(fe,{children:"/data/meshai.sqlite"}),") with WAL journaling. Schema migrations live in ",d.jsx(fe,{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 ",d.jsx(fe,{children:"schema_meta.version"})," in order. Idempotent re-runs are no-ops."]}),d.jsx(_e,{children:"v0.6 + v0.7 additions"}),d.jsx(Gt,{headers:["Migration","What it added"],rows:[[d.jsx(fe,{children:"v11"}),"first_broadcast_at + last_broadcast_at split + reminder_enabled per adapter (the schema basis for New / Update / Active)"],[d.jsx(fe,{children:"v12"}),"fires.tombstoned_at (WFIGS closure stamp; terminates the reminder loop)"],[d.jsx(fe,{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"],[d.jsx(fe,{children:"v14"}),"Fire Tracker Phase 2 — fire_passes table (per-satellite-pass centroid + drift) + last_pass_id + halt_broadcast_at on fires"],[d.jsx(fe,{children:"v15"}),"Fire Tracker Phase 3 — fire_passes.perimeter_geojson (convex hull) + fires.last_spotting_broadcast_at"],[d.jsx(fe,{children:"v16"}),"Fire Tracker Phase 4 — fire_digest_broadcasts table (idempotent twice-daily LLM digest)"]]}),d.jsx(_e,{children:"When migrations fail"}),d.jsxs("p",{children:["A migration failure leaves the database at the prior version and raises in the runner. Container logs surface the SQL error;"," ",d.jsx(fe,{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."]})]}),d.jsxs(Ir,{id:"api",title:"API Reference",children:[d.jsxs("p",{children:["MeshAI's REST API is available at ",d.jsx(fe,{children:"http://your-host:8080"}),". All endpoints return JSON."]}),d.jsx(_e,{children:"System"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/status"})," — version, uptime, node count"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/channels"})," — radio channel list"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"POST /api/restart"})," — restart the bot"]})]}),d.jsx(_e,{children:"Mesh Data"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/health"})," — health score and pillars"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/nodes"})," — all nodes with positions and telemetry"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/edges"})," — neighbor links with signal quality"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/regions"})," — region summaries"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/sources"})," — data source health"]})]}),d.jsx(_e,{children:"Configuration"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/config"})," — full config"]}),d.jsxs("li",{children:[d.jsxs(fe,{children:["GET /api/config/","{section}"]})," — one section"]}),d.jsxs("li",{children:[d.jsxs(fe,{children:["PUT /api/config/","{section}"]})," — update a section"]})]}),d.jsx(_e,{children:"Environmental"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/status"})," — per-feed health"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/active"})," — all active events"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/swpc"})," — solar/geomagnetic data"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/ducting"})," — atmospheric profile"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/fires"})," — wildfire perimeters"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/env/hotspots"})," — satellite fire detections"]})]}),d.jsx(_e,{children:"Alerts"}),d.jsxs("ul",{className:"list-disc list-inside ml-4 space-y-1",children:[d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/alerts/active"})," — current alerts"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/alerts/history"})," — past alerts"]}),d.jsxs("li",{children:[d.jsx(fe,{children:"GET /api/notifications/categories"})," — available alert categories"]})]}),d.jsx(_e,{children:"Real-time"}),d.jsx("ul",{className:"list-disc list-inside ml-4 space-y-1",children:d.jsxs("li",{children:[d.jsx(fe,{children:"ws://your-host:8080/ws/live"})," — WebSocket for live updates"]})})]})]})})]})}const eT={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 RZ(){const[e,t]=E.useState([]),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState(null),[l,u]=E.useState(eT),[c,h]=E.useState(!1),[f,v]=E.useState("unknown"),g=E.useCallback(async()=>{n(!0),i(null);try{const S=await fetch("/api/gauge-sites");if(!S.ok)throw new Error(`GET: ${S.status}`);t(await S.json())}catch(S){i(String(S))}finally{n(!1)}},[]);E.useEffect(()=>{g()},[g]),E.useEffect(()=>{fetch("/api/config/environmental").then(S=>S.json()).then(S=>{var C;return v(((C=S==null?void 0:S.usgs)==null?void 0:C.feed_source)||"unknown")}).catch(()=>v("unknown"))},[]);const m=S=>{s(S.site_id),u({...S}),h(!1)},y=()=>{h(!0),s(null),u({...eT})},x=()=>{s(null),h(!1),u(eT)},_=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}x(),g()}catch(S){alert(String(S))}},w=async S=>{if(!confirm(`Delete ${S}?`))return;const C=await fetch(`/api/gauge-sites/${S}`,{method:"DELETE"});if(!C.ok){alert(`delete failed: ${C.status}`);return}g()};return r?d.jsxs("div",{className:"p-6 text-slate-400",children:[d.jsx(nv,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):a?d.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",a]}):d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(c1,{className:"w-5 h-5 text-accent"}),d.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Gauge Sites"}),d.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," sites"]}),d.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:[d.jsx(li,{className:"w-4 h-4"})," Add site"]})]}),d.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&&d.jsx(JB,{draft:l,setDraft:u,onSave:_,onCancel:x,adding:!0,feedSource:f}),d.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm text-slate-200",children:[d.jsx("thead",{className:"bg-[#161616] border-b border-border",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Site ID"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat,Lon"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Action"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Minor"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Moderate"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Major"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:e.map(S=>o===S.site_id?d.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:d.jsx("td",{colSpan:9,className:"px-3 py-2",children:d.jsx(JB,{draft:l,setDraft:u,onSave:_,onCancel:x,feedSource:f})})},S.site_id):d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:S.site_id}),d.jsx("td",{className:"px-3 py-2",children:S.gauge_name}),d.jsxs("td",{className:"px-3 py-2 text-right text-xs",children:[S.lat.toFixed(3),",",S.lon.toFixed(3)]}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.action_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_minor_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_moderate_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-right",children:S.flood_major_ft??"-"}),d.jsx("td",{className:"px-3 py-2 text-center",children:S.enabled?d.jsx(Yr,{className:"w-4 h-4 text-emerald-400 inline"}):d.jsx(_u,{className:"w-4 h-4 text-slate-500 inline"})}),d.jsxs("td",{className:"px-3 py-2 text-right",children:[d.jsx("button",{onClick:()=>m(S),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),d.jsx("button",{onClick:()=>w(S.site_id),className:"text-red-400 hover:text-red-300",children:d.jsx(ui,{className:"w-4 h-4 inline"})})]})]},S.site_id))})]})})]})}function JB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:a,feedSource:i}){const o=(g,m)=>t({...e,[g]:m}),[s,l]=E.useState(!1),[u,c]=E.useState(null),h=i!=="native"||!e.site_id.trim(),f=i!=="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",v=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 _=await m.json().catch(()=>({}));c(_.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(),x={...e};y.name&&!x.gauge_name&&(x.gauge_name=y.name),typeof y.lat=="number"&&(x.lat=y.lat),typeof y.lon=="number"&&(x.lon=y.lon),typeof y.action_ft=="number"&&(x.action_ft=y.action_ft),typeof y.flood_minor_ft=="number"&&(x.flood_minor_ft=y.flood_minor_ft),typeof y.flood_moderate_ft=="number"&&(x.flood_moderate_ft=y.flood_moderate_ft),typeof y.flood_major_ft=="number"&&(x.flood_major_ft=y.flood_major_ft),t(x)}catch(g){c(String(g))}finally{l(!1)}}};return d.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[d.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Site ID",d.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[d.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:!a}),d.jsxs("button",{type:"button",onClick:v,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?d.jsx(nv,{className:"w-3 h-3 animate-spin"}):d.jsx(v1,{className:"w-3 h-3"}),"USGS lookup"]})]}),u&&d.jsx("span",{className:"text-amber-400 text-xs mt-1 block",children:u})]}),d.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Gauge name",d.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)})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Action ft",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Minor flood ft",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Moderate flood ft",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Major flood ft",d.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))})]}),d.jsxs("label",{className:"text-xs text-slate-300 col-span-2 flex items-center gap-2 mt-2",children:[d.jsx("input",{type:"checkbox",checked:e.enabled,onChange:g=>o("enabled",g.target.checked),className:"accent-[#f59e0b]"}),"Enabled"]}),d.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[d.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),d.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 tT={anchor_id:0,name:"",lat:0,lon:0,state:"ID",enabled:!0,updated_at:0};function OZ(){const[e,t]=E.useState([]),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState(null),[l,u]=E.useState(!1),[c,h]=E.useState(tT),f=E.useCallback(async()=>{n(!0),i(null);try{const _=await fetch("/api/town-anchors");if(!_.ok)throw new Error(`GET: ${_.status}`);t(await _.json())}catch(_){i(String(_))}finally{n(!1)}},[]);E.useEffect(()=>{f()},[f]);const v=_=>{s(_.anchor_id),h({..._}),u(!1)},g=()=>{u(!0),s(null),h({...tT})},m=()=>{s(null),u(!1),h(tT)},y=async()=>{const _=l?"/api/town-anchors":`/api/town-anchors/${o}`,S=await fetch(_,{method:l?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!S.ok){const C=await S.json().catch(()=>({}));alert(`save failed: ${C.detail||S.statusText}`);return}m(),f()},x=async _=>{if(!confirm(`Delete anchor ${_}?`))return;const w=await fetch(`/api/town-anchors/${_}`,{method:"DELETE"});if(!w.ok){alert(`delete failed: ${w.status}`);return}f()};return r?d.jsxs("div",{className:"p-6 text-slate-400",children:[d.jsx(nv,{className:"w-5 h-5 animate-spin inline mr-2"}),"Loading…"]}):a?d.jsxs("div",{className:"p-6 text-red-400",children:["Load failed: ",a]}):d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(av,{className:"w-5 h-5 text-accent"}),d.jsx("h1",{className:"text-xl font-semibold text-slate-100",children:"Town Anchors"}),d.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[e.length," towns"]}),d.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:[d.jsx(li,{className:"w-4 h-4"})," Add town"]})]}),d.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&&d.jsx(QB,{draft:c,setDraft:h,onSave:y,onCancel:m,adding:!0}),d.jsx("div",{className:"bg-bg-card border border-border overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm text-slate-200",children:[d.jsx("thead",{className:"bg-[#161616] border-b border-border",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lat"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-right",children:"Lon"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"State"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-center",children:"On"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666]"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:e.map(_=>o===_.anchor_id?d.jsx("tr",{className:"bg-bg-card border-b border-border hover:bg-bg-hover",children:d.jsx("td",{colSpan:6,className:"px-3 py-2",children:d.jsx(QB,{draft:c,setDraft:h,onSave:y,onCancel:m})})},_.anchor_id):d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-3 py-2 capitalize",children:_.name}),d.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lat.toFixed(4)}),d.jsx("td",{className:"px-3 py-2 text-right text-xs",children:_.lon.toFixed(4)}),d.jsx("td",{className:"px-3 py-2 text-center text-xs",children:_.state||"-"}),d.jsx("td",{className:"px-3 py-2 text-center",children:_.enabled?d.jsx(Yr,{className:"w-4 h-4 text-emerald-400 inline"}):d.jsx(_u,{className:"w-4 h-4 text-slate-500 inline"})}),d.jsxs("td",{className:"px-3 py-2 text-right",children:[d.jsx("button",{onClick:()=>v(_),className:"text-accent hover:text-accent text-xs mr-3",children:"Edit"}),d.jsx("button",{onClick:()=>x(_.anchor_id),className:"text-red-400 hover:text-red-300",children:d.jsx(ui,{className:"w-4 h-4 inline"})})]})]},_.anchor_id))})]})})]})}function QB({draft:e,setDraft:t,onSave:r,onCancel:n,adding:a}){const i=(o,s)=>t({...e,[o]:s});return d.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 p-3 bg-[#1a1a1a]",children:[d.jsxs("label",{className:"text-xs text-slate-400 col-span-2",children:["Name (lowercased on save)",d.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=>i("name",o.target.value),disabled:!a})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["State",d.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=>i("state",o.target.value)})]}),d.jsxs("label",{className:"text-xs text-slate-400 flex items-center gap-2",children:[d.jsx("input",{type:"checkbox",checked:e.enabled,onChange:o=>i("enabled",o.target.checked),className:"accent-[#f59e0b] mt-4"}),"Enabled"]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lat",d.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=>i("lat",parseFloat(o.target.value))})]}),d.jsxs("label",{className:"text-xs text-slate-400",children:["Lon",d.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=>i("lon",parseFloat(o.target.value))})]}),d.jsxs("div",{className:"col-span-2 flex items-center justify-end gap-2 mt-2",children:[d.jsx("button",{onClick:n,className:"px-3 py-1 text-slate-300 hover:bg-bg-hover text-sm",children:"Cancel"}),d.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 c2e(e,t,r){const n=e?{...e}:{...t,name:r};n.name=n.name||r;const a=(e==null?void 0:e.severity_channels)||{},i=t.severity_channels||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};return o.forEach(l=>{const u=(a[l]||[]).filter(h=>!h.startsWith("meshcore_")),c=(i[l]||[]).filter(h=>h.startsWith("meshcore_"));s[l]=[...u,...c]}),n.severity_channels=s,n.meshcore_channel=t.meshcore_channel??null,n.meshcore_dm_contacts=t.meshcore_dm_contacts||[],n}function h2e(e,t){const r=(t==null?void 0:t.mc_enabled)??!1,n=(e==null?void 0:e.mt_enabled)??(e==null?void 0:e.enabled)??!1,a=(e==null?void 0:e.cells)||{},i=(t==null?void 0:t.cells)||{},o=new Set([...Object.keys(a),...Object.keys(i)]),s={};for(const l of o){const u=a[l]||{},c=i[l]||{},h=new Set([...Object.keys(u),...Object.keys(c)]),f={};for(const v of h){const g=u[v],m=c[v],y=m!==void 0?m.mc||null:(g==null?void 0:g.mc)??null,x={mt:(g==null?void 0:g.mt)??null,mc:y,min_severity:(m==null?void 0:m.min_severity)??(g==null?void 0:g.min_severity)??"routine",enabled:(m==null?void 0:m.enabled)??(g==null?void 0:g.enabled)??!0},_=x.mc;(x.mt!==null||_!==null&&_.trim()!=="")&&(f[v]=x)}Object.keys(f).length>0&&(s[l]=f)}return{mt_enabled:n,mc_enabled:r,cells:s}}function d2e(){var ye;const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState([]),[s,l]=E.useState(!0),[u,c]=E.useState(!1),[h,f]=E.useState(null),[v,g]=E.useState(null),[m,y]=E.useState(!1),[x,_]=E.useState([]),[w,S]=E.useState(!1),[C,M]=E.useState(null),[A,k]=E.useState(""),[I,P]=E.useState(null),[j,z]=E.useState({}),[D,B]=E.useState({}),H=(ne,xe)=>`${ne}|${xe}`,V=E.useCallback(async()=>{try{const[ne,xe]=await Promise.all([fetch("/api/config/notifications"),fetch("/api/notifications/regions")]);if(!ne.ok)throw new Error("Failed to fetch notifications config");const he=await ne.json(),ge=xe.ok?await xe.json():[];r(he),a(JSON.parse(JSON.stringify(he))),o(Array.isArray(ge)?ge:[]),y(!1),f(null)}catch(ne){f(ne instanceof Error?ne.message:"Unknown error")}finally{l(!1)}},[]);E.useEffect(()=>{document.title="MeshCore Routing - MeshAI",V()},[V]);const U=E.useCallback(async()=>{try{const ne=await UJ();_(ne.active?ne.rooms:[]),S(ne.active)}catch{_([]),S(!1)}},[]);E.useEffect(()=>{U()},[U]),E.useEffect(()=>{t&&n&&y(JSON.stringify(t)!==JSON.stringify(n))},[t,n]),E.useEffect(()=>(e(m),()=>e(!1)),[m,e]);const F=(ne,xe)=>{if(!t)return;const he=t.toggles||{};r({...t,toggles:{...he,[ne]:{...he[ne]||{},name:ne,...xe}}})},W="room:",$=ne=>typeof ne=="string"&&ne.startsWith(W),Z=ne=>ne.slice(W.length),J=ne=>x.find(xe=>xe.pubkey===ne),re=(ne,xe,he)=>{var Ue,qe,Fe,_t,bt,et,Ke,St,ce;if(!t)return;const ge=((Fe=(qe=(Ue=t.region_routes)==null?void 0:Ue.cells)==null?void 0:qe[ne])==null?void 0:Fe[xe])??{mt:null,mc:null,min_severity:"routine",enabled:!0},tt={...((_t=t.region_routes)==null?void 0:_t.cells)||{},[ne]:{...((et=(bt=t.region_routes)==null?void 0:bt.cells)==null?void 0:et[ne])||{},[xe]:{...ge,mc:he}}};r({...t,region_routes:{mt_enabled:((Ke=t.region_routes)==null?void 0:Ke.mt_enabled)??((St=t.region_routes)==null?void 0:St.enabled)??!1,mc_enabled:((ce=t.region_routes)==null?void 0:ce.mc_enabled)??!1,cells:tt}})},Q=ne=>{var tt,Ue,qe,Fe,_t,bt;if(!t)return;const xe=((Ue=(tt=t.region_routes)==null?void 0:tt.cells)==null?void 0:Ue[ne])||{},he={};for(const[et,Ke]of Object.entries(xe))he[et]={...Ke,mc:null};const ge={...((qe=t.region_routes)==null?void 0:qe.cells)||{},[ne]:he};r({...t,region_routes:{mt_enabled:((Fe=t.region_routes)==null?void 0:Fe.mt_enabled)??((_t=t.region_routes)==null?void 0:_t.enabled)??!1,mc_enabled:((bt=t.region_routes)==null?void 0:bt.mc_enabled)??!1,cells:ge}})},le=async()=>{if(t){c(!0),f(null),g(null);try{const ne=await fetch("/api/config/notifications");if(!ne.ok)throw new Error("Failed to re-fetch notifications config");const xe=await ne.json(),he={...xe,toggles:{...xe.toggles||{}},region_routes:h2e(xe.region_routes,t.region_routes)},ge=t.toggles||{};for(const{key:qe}of fu){const Fe=ge[qe];Fe&&(he.toggles[qe]=c2e((xe.toggles||{})[qe],Fe,qe))}const tt=await fetch("/api/config/notifications",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(he)}),Ue=await tt.json();if(!tt.ok)throw new Error(Ue.detail||"Save failed");r(he),a(JSON.parse(JSON.stringify(he))),y(!1),e(!1),g("MeshCore routing saved successfully"),setTimeout(()=>g(null),3e3)}catch(ne){f(ne instanceof Error?ne.message:"Save failed")}finally{c(!1)}}},de=()=>{n&&(r(JSON.parse(JSON.stringify(n))),y(!1))};if(s)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading MeshCore routing..."})});if(!t)return d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load notifications config"})});const He=t.toggles||{};return d.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"Per-family MeshCore delivery. Choose which channels fire at each severity, the MeshCore channel name, and DM contacts."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:V,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:de,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:le,disabled:u||!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:[d.jsx(_a,{size:16}),u?"Saving...":"Save"]})]})]}),d.jsxs("div",{className:"flex items-start gap-2 p-3 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-400",children:[d.jsx(Jc,{size:16,className:"text-accent mt-0.5 flex-shrink-0"}),d.jsxs("div",{children:["Family gating (enable, severity threshold, freshness/cooldown) is on"," ",d.jsx(uf,{to:"/environment",className:"text-accent hover:underline",children:"Data Feeds"}),". Meshtastic delivery is on"," ",d.jsx(uf,{to:"/meshtastic/routing",className:"text-accent hover:underline",children:"Meshtastic Routing"}),". This page edits only the MeshCore delivery for each family."]})]}),h&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:h}),v&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),v]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsxs("div",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["MeshCore Delivery",d.jsx(Yo,{info:"For each notification family, choose which MeshCore channels fire at each severity, the MeshCore channel name to broadcast on, and the DM contacts to unicast to. Enabling a family and its severity threshold are configured on the Data Feeds page."})]}),d.jsx("div",{className:"border border-[#1e2a3a] p-3",children:d.jsx(Ch,{label:"Enable MeshCore region routing",checked:((ye=t.region_routes)==null?void 0:ye.mc_enabled)??!1,onChange:ne=>{var xe,he,ge;return r({...t,region_routes:{mt_enabled:((xe=t.region_routes)==null?void 0:xe.mt_enabled)??((he=t.region_routes)==null?void 0:he.enabled)??!1,mc_enabled:ne,cells:((ge=t.region_routes)==null?void 0:ge.cells)||{}}})},helper:"Master switch for per-region MeshCore channel routing. When off, families deliver only to their default MeshCore channels."})}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:fu.map(({key:ne,label:xe,Icon:he})=>{var _t,bt;const ge=He[ne]||{},tt=((bt=(_t=t.region_routes)==null?void 0:_t.cells)==null?void 0:bt[ne])||{},Ue=i.some(et=>{var St;const Ke=(St=tt[et])==null?void 0:St.mc;return Ke!=null&&Ke.trim()!==""}),qe=j[ne],Fe=qe!==void 0?qe:Ue;return d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-200",children:[d.jsx(he,{size:15})," ",xe]}),d.jsxs("div",{className:"space-y-3 p-3 bg-[#0a0e17] border border-[#1e2a3a]",children:[d.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-slate-300",children:[d.jsx(wk,{size:13}),"MeshCore"]}),d.jsx(IZ,{channels:jCe,severityChannels:ge.severity_channels||{},onChange:et=>F(ne,{severity_channels:et})}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"MeshCore channel name"}),d.jsx("input",{type:"text",value:ge.meshcore_channel!=null?ge.meshcore_channel:"",onChange:et=>F(ne,{meshcore_channel:et.target.value===""?null:et.target.value}),placeholder:"AIDA",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"}),d.jsx("p",{className:"text-xs text-slate-600",children:"Channel name on your MeshCore companion (e.g. AIDA). Blank = not broadcast on MeshCore."})]}),d.jsx(LZ,{label:"MeshCore DM contacts",value:ge.meshcore_dm_contacts||[],onChange:et=>F(ne,{meshcore_dm_contacts:et}),placeholder:"contact name or pubkey",helper:"MeshCore DM recipients (names or pubkeys)",info:"Contact names or pubkeys on the MeshCore companion. Used when meshcore_dm is enabled for a severity."})]}),d.jsxs("div",{className:"border border-[#1e2a3a] p-3 space-y-2",children:[d.jsx(Ch,{label:"Region-based routing",checked:Fe,onChange:et=>{z(Ke=>({...Ke,[ne]:et})),et||Q(ne)},helper:"Route this family to different MC channels per region"}),Fe&&(i.length===0?d.jsxs("p",{className:"text-xs text-slate-500 italic",children:["No regions yet — add them on the"," ",d.jsx(uf,{to:"/coverage",className:"text-accent hover:underline",children:"Coverage"})," page."]}):d.jsx("div",{className:"space-y-1.5 pt-1",children:i.map(et=>{const St=(tt[et]??{mc:null}).mc??"",ce=H(ne,et),Bt=(D[ce]??($(St)?"room":"channel"))==="room",Ft=$(St)?J(Z(St)):void 0;return d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-xs text-slate-400 flex-1 min-w-0 truncate",children:et}),d.jsxs("div",{className:"flex border border-[#1e2a3a] rounded overflow-hidden",children:[d.jsx("button",{type:"button",title:"Target a channel",onClick:()=>{B(jt=>({...jt,[ce]:"channel"})),$(St)&&re(ne,et,null)},className:`px-1.5 py-1 flex items-center ${Bt?"text-slate-500 hover:text-slate-300":"bg-accent text-white"}`,children:d.jsx(wJ,{size:12})}),d.jsx("button",{type:"button",title:w?"Target a room server":"MeshCore not connected",disabled:!w&&!$(St),onClick:()=>{B(jt=>({...jt,[ce]:"room"})),$(St)||re(ne,et,null)},className:`px-1.5 py-1 flex items-center ${Bt?"bg-accent text-white":"text-slate-500 hover:text-slate-300"} disabled:opacity-40 disabled:cursor-not-allowed`,children:d.jsx(CJ,{size:12})})]}),Bt?d.jsxs(d.Fragment,{children:[w||Ft?d.jsxs("div",{className:"flex items-center gap-1 w-40",children:[d.jsxs("select",{value:Ft?Ft.pubkey:"",onChange:jt=>{const Lr=jt.target.value;re(ne,et,Lr===""?null:W+Lr)},className:"flex-1 min-w-0 px-1.5 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 focus:outline-none focus:border-accent",children:[d.jsx("option",{value:"",children:"room…"}),!Ft&&$(St)&&d.jsxs("option",{value:Z(St),children:[Z(St).slice(0,10),"…"]}),x.map(jt=>d.jsx("option",{value:jt.pubkey,children:jt.name||jt.pubkey.slice(0,10)+"…"},jt.pubkey))]}),Ft&&d.jsx("span",{title:Ft.path_established?"Path established":"No path yet — first send discovers it",className:`text-[10px] ${Ft.path_established?"text-green-500":"text-slate-600"}`,children:"●"})]}):d.jsx("span",{className:"w-40 text-xs text-slate-600 italic truncate",children:"MeshCore not connected"}),Z(St)&&(()=>{var tl;const jt=Z(St),Lr=((tl=x.find(Ki=>Ki.pubkey===jt))==null?void 0:tl.password_set)??!1,Qo=C===jt;return d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("button",{type:"button",title:Lr?"Room password: set":"Room password: not set","aria-label":Lr?"Room password: set":"Room password: not set",onClick:()=>{P(null),Qo?M(null):(M(jt),k(""))},className:`px-1 py-1 text-xs ${Lr?"text-accent":"text-slate-600 hover:text-slate-400"}`,children:Lr?"🔒":"🔓"}),Qo&&d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx("input",{type:"password",value:A,onChange:Ki=>k(Ki.target.value),placeholder:"room password",className:"w-28 px-1.5 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 focus:outline-none focus:border-accent"}),d.jsx("button",{type:"button",title:"Save room password",onClick:async()=>{try{P(null),await WJ(jt,A),await U(),M(null),k("")}catch{P("save failed")}},className:"px-1.5 py-1 bg-accent hover:bg-accent/80 rounded text-xs text-white",children:"Save"}),d.jsx("button",{type:"button",title:"Clear room password",onClick:async()=>{try{P(null),await $J(jt),await U(),M(null),k("")}catch{P("clear failed")}},className:"px-1.5 py-1 border border-[#1e2a3a] rounded text-xs text-slate-400 hover:text-slate-200",children:"Clear"}),d.jsx("button",{type:"button",title:"Cancel",onClick:()=>{M(null),P(null)},className:"px-1.5 py-1 border border-[#1e2a3a] rounded text-xs text-slate-500 hover:text-slate-300",children:"Cancel"}),I&&d.jsx("span",{className:"text-[10px] text-red-400",children:I})]})]})})()]}):d.jsx("input",{type:"text",value:St,onChange:jt=>{const Lr=jt.target.value;re(ne,et,Lr===""?null:Lr)},placeholder:"channel",className:"w-40 px-2 py-1 bg-[#0a0e17] border border-[#1e2a3a] rounded text-xs text-slate-200 font-mono focus:outline-none focus:border-accent"})]},et)})}))]})]},ne)})})]})]})}function f2e(){const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(null),[u,c]=E.useState(!0),[h,f]=E.useState(!1),[v,g]=E.useState(null),[m,y]=E.useState(null),[x,_]=E.useState(!1),[w,S]=E.useState(!1),[C,M]=E.useState([]),[A,k]=E.useState({}),[I,P]=E.useState(new Set),[j,z]=E.useState(null),[D,B]=E.useState(""),[H,V]=E.useState(""),[U,F]=E.useState(!1),[W,$]=E.useState(null),[Z,J]=E.useState(""),[re,Q]=E.useState(""),[le,de]=E.useState(!1),[He,ye]=E.useState(null),[ne,xe]=E.useState(null),he=E.useCallback(async()=>{c(!0);try{const[ce,st]=await Promise.all([Ao("connection"),Ao("meshcore_context")]);r(ce),a(JSON.parse(JSON.stringify(ce))),o(st),l(JSON.parse(JSON.stringify(st))),_(!1),g(null)}catch(ce){g(ce instanceof Error?ce.message:"Unknown error")}finally{c(!1)}},[]);E.useEffect(()=>{document.title="MeshCore Connection - MeshAI",he()},[he]);const ge=E.useCallback(async()=>{try{const ce=await YV(),st=ce.channels.map(Ft=>Ft.name),Bt={};for(const Ft of ce.channels)Bt[Ft.name]=Ft.key;S(ce.active),M(st),k(Bt),B(Ft=>Ft&&st.includes(Ft)?Ft:st[0]??"")}catch{try{const ce=await VJ();S(ce.active),M(ce.channels),k({}),B(st=>st&&ce.channels.includes(st)?st:ce.channels[0]??"")}catch{S(!1)}}},[]);E.useEffect(()=>{ge()},[ge]);const tt=ce=>{P(st=>{const Bt=new Set(st);return Bt.has(ce)?Bt.delete(ce):Bt.add(ce),Bt})},Ue=async(ce,st)=>{try{await navigator.clipboard.writeText(st),z(ce),setTimeout(()=>z(Bt=>Bt===ce?null:Bt),1500)}catch{P(Bt=>new Set(Bt).add(ce))}},qe=async()=>{const ce=Z.trim();if(ce){de(!0),xe(null);try{await GJ(ce,re.trim()),J(""),Q(""),await ge()}catch(st){xe(st instanceof Error?st.message:"Failed to add channel")}finally{de(!1)}}},Fe=async ce=>{ye(ce),xe(null);try{await HJ(ce),o(st=>!st||!(st.observe_channels??[]).includes(ce)?st:{...st,observe_channels:(st.observe_channels??[]).filter(Bt=>Bt!==ce)}),await ge()}catch(st){xe(st instanceof Error?st.message:"Failed to remove channel")}finally{ye(null)}},_t=async()=>{F(!0),$(null);try{const ce=await XV({transport:"meshcore",channel:D,text:H.trim()||void 0});$(ce)}catch(ce){$({sent:!1,detail:ce instanceof Error?ce.message:"Send failed"})}finally{F(!1)}};E.useEffect(()=>{if(t&&n&&i&&s){const ce=JSON.stringify(t)!==JSON.stringify(n)||JSON.stringify(i)!==JSON.stringify(s);_(ce)}},[t,n,i,s]),E.useEffect(()=>(e(x),()=>e(!1)),[x,e]);const bt=ce=>r(st=>st&&{...st,...ce}),et=async()=>{if(!(!t||!i)){f(!0),g(null),y(null);try{const ce=await Promise.all([ja("connection",t),ja("meshcore_context",i)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),_(!1),e(!1),y("MeshCore connection saved successfully"),ce.some(st=>st.restart_required)&&bu([]),setTimeout(()=>y(null),3e3)}catch(ce){g(ce instanceof Error?ce.message:"Save failed")}finally{f(!1)}}},Ke=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),_(!1)},St=ce=>{o(st=>{if(!st)return st;const Bt=st.observe_channels??[],Ft=Bt.includes(ce)?Bt.filter(jt=>jt!==ce):[...Bt,ce];return{...st,observe_channels:Ft}})};return u?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading MeshCore connection..."})}):t?d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"MeshCore node connection."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:he,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:Ke,disabled:!x,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:et,disabled:h||!x,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:[d.jsx(_a,{size:16}),h?"Saving...":"Save"]})]})]}),v&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:v}),m&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),m]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"MeshCore Connection"}),d.jsx("p",{className:"text-xs text-slate-500",children:"Choose how MeshAI reaches your MeshCore node. TCP talks to a companion frame server; Serial connects to a USB-attached node; BLE pairs over Bluetooth. Meshtastic is always active."}),d.jsx(jn,{label:"Connection Type",value:t.meshcore_conn_type??"tcp",onChange:ce=>bt({meshcore_conn_type:ce}),options:[{value:"tcp",label:"TCP (companion)"},{value:"serial",label:"Serial (USB)"},{value:"ble",label:"BLE"}],helper:"TCP for a companion frame server, Serial for a USB node, BLE for Bluetooth"}),(t.meshcore_conn_type??"tcp")==="tcp"&&d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(gt,{label:"MeshCore Host",value:t.meshcore_host??"",onChange:ce=>bt({meshcore_host:ce}),placeholder:"192.168.1.100",helper:"IP or hostname of the companion frame server",info:"The MeshCore companion (frame server) host. Active when non-empty in TCP mode."}),d.jsx(Ne,{label:"MeshCore Port",value:t.meshcore_port??5525,onChange:ce=>bt({meshcore_port:ce}),min:1,max:65535,helper:"MeshCore TCP port (default 5525)"})]}),(t.meshcore_conn_type??"tcp")==="serial"&&d.jsxs(d.Fragment,{children:[d.jsx(NZ,{label:"MeshCore Serial Port",value:t.meshcore_serial_port??"",onChange:ce=>bt({meshcore_serial_port:ce}),helper:"USB-attached MeshCore node — Detect fills a stable by-id path"}),d.jsx(Ne,{label:"Baud Rate",value:t.meshcore_baud??115200,onChange:ce=>bt({meshcore_baud:ce}),min:1200,helper:"Serial baud rate (default 115200)"})]}),(t.meshcore_conn_type??"tcp")==="ble"&&d.jsx(gt,{label:"BLE Address",value:t.meshcore_ble_address??"",onChange:ce=>bt({meshcore_ble_address:ce}),placeholder:"AA:BB:CC:DD:EE:FF",helper:"Leave blank to scan/pair the first available device"}),d.jsx("div",{className:"pt-2",children:d.jsx(uf,{to:"/meshtastic/connection",className:"inline-flex items-center gap-1 text-xs text-slate-500 hover:text-accent transition-colors",children:"→ Meshtastic connection"})}),d.jsx(qt,{label:"Auto-add contacts (AIDA adds any node it hears — required to DM anyone)",checked:t.meshcore_auto_add_contacts??!0,onChange:ce=>bt({meshcore_auto_add_contacts:ce}),helper:"Enables firmware CMD 58 (set_autoadd_config) at connect so AIDA automatically adds every node it hears an advert from as a contact, enabling DM send/decrypt without manual contact exchange"}),d.jsxs("details",{className:"group",children:[d.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[d.jsx(Ah,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced — MeshCore Reconnect"]}),d.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[d.jsx(qt,{label:"Auto-reconnect (MeshCore)",checked:t.meshcore_auto_reconnect??!0,onChange:ce=>bt({meshcore_auto_reconnect:ce}),helper:"Automatically reconnect to the MeshCore companion if the link drops"}),d.jsx(Ne,{label:"Max Reconnect Attempts",value:t.meshcore_max_reconnect_attempts??5,onChange:ce=>bt({meshcore_max_reconnect_attempts:ce}),min:0,helper:"Maximum reconnect attempts before giving up (0 = unlimited)"})]})]})]}),i&&d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Bot behavior"}),d.jsx(qt,{label:"Enable Passive Context",checked:!!i.enable_passive_context,onChange:ce=>o({...i,enable_passive_context:ce}),helper:"Listen to MeshCore channel traffic for context",info:"When enabled, the bot monitors MeshCore channels and includes recent messages in its context so it can reference what others said."}),d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Observe MeshCore Channels"}),d.jsxs("div",{className:"border border-[#1e2a3a] p-2 space-y-1",children:[C.map(ce=>{const st=(i.observe_channels??[]).includes(ce),Bt=A[ce]??null,Ft=I.has(ce);return d.jsxs("div",{className:"flex items-center gap-2 p-2 rounded hover:bg-[#0a0e17]",children:[d.jsxs("label",{onClick:()=>St(ce),className:"flex items-center gap-2 cursor-pointer shrink-0",children:[d.jsx("div",{className:`w-4 h-4 rounded border flex items-center justify-center ${st?"bg-accent border-accent":"border-slate-600"}`,children:st&&d.jsx(Yr,{size:12,className:"text-white"})}),d.jsx("span",{className:"text-sm text-slate-200",children:ce})]}),d.jsx("div",{className:"flex items-center gap-1 flex-1 min-w-0 justify-end",children:Bt?d.jsxs(d.Fragment,{children:[d.jsx("code",{title:Ft?Bt:"Key hidden — click the eye to reveal",className:"text-xs font-mono text-slate-400 truncate max-w-[16rem]",children:Ft?Bt:"••••••••••••••••"}),d.jsx("button",{type:"button",title:Ft?"Hide key":"Reveal key","aria-label":Ft?`Hide key for ${ce}`:`Reveal key for ${ce}`,onClick:()=>tt(ce),className:"p-1 text-slate-600 hover:text-slate-300",children:Ft?d.jsx(h1,{size:14}):d.jsx(rv,{size:14})}),d.jsx("button",{type:"button",title:"Copy key to clipboard","aria-label":`Copy key for ${ce}`,onClick:()=>Ue(ce,Bt),className:"p-1 text-slate-600 hover:text-accent",children:j===ce?d.jsx(Yr,{size:14,className:"text-green-400"}):d.jsx(DV,{size:14})})]}):d.jsx("span",{className:"text-xs font-mono text-slate-600",title:"No retrievable key for this channel",children:"—"})}),d.jsx("button",{type:"button",title:`Remove channel '${ce}' from the companion`,"aria-label":`Remove channel ${ce}`,disabled:He===ce,onClick:()=>Fe(ce),className:"p-1 text-slate-600 hover:text-red-400 disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:d.jsx(ui,{size:14})})]},ce)}),C.length===0&&d.jsxs("div",{className:"text-sm text-slate-500 p-2",children:["No channels available",w?"":" (MeshCore not connected)"]})]}),d.jsx("p",{className:"text-xs text-slate-600",children:"Choose which MeshCore channels feed MeshAI's context. Empty = none are watched — pick channels to include their chatter in what the bot knows about the mesh. Leave busy/public channels out to keep them out of context. Each channel's key (PSK) is shown on the right — reveal and copy it to share with people who want to join."}),d.jsxs("div",{className:"flex items-end gap-2 pt-2",children:[d.jsxs("div",{className:"flex-1 space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Name"}),d.jsx("input",{type:"text",value:Z,onChange:ce=>J(ce.target.value),placeholder:"#channel-name",disabled:!w,className:"w-full px-2 py-1.5 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent disabled:opacity-50"})]}),d.jsxs("div",{className:"flex-1 space-y-1",children:[d.jsx("label",{className:"block text-xs text-slate-500 uppercase tracking-wide",children:"Key"}),d.jsx("input",{type:"text",value:re,onChange:ce=>Q(ce.target.value),placeholder:"PSK hex (32 chars) — leave blank for public #channel",disabled:!w,className:"w-full px-2 py-1.5 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent disabled:opacity-50"})]}),d.jsx("button",{type:"button",onClick:qe,disabled:!w||le||!Z.trim(),className:"px-3 py-1.5 bg-accent hover:bg-accent/80 disabled:opacity-50 disabled:cursor-not-allowed rounded text-sm text-white whitespace-nowrap",children:le?"Saving…":"Save"})]}),ne&&d.jsx("p",{className:"text-xs text-red-400",children:ne})]}),d.jsx(Dn,{label:"Ignore MeshCore Contacts",value:i.ignore_contacts??[],onChange:ce=>o({...i,ignore_contacts:ce}),helper:"Contact names or pubkey prefixes to exclude from context (comma-separated)",info:"Messages from these MeshCore contacts won't be included in passive context. Enter contact names or public-key prefixes."}),d.jsx(qt,{label:"Answer direct messages",checked:!!i.respond_to_dms,onChange:ce=>o({...i,respond_to_dms:ce}),helper:"When on, MeshAI replies to MeshCore direct messages using the LLM. Applies to MeshCore only."})]}),d.jsxs("div",{className:`bg-bg-card border border-border p-6 space-y-4${w?"":" opacity-60"}`,children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Send Test Message"}),w?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Channel"}),d.jsx("select",{value:D,onChange:ce=>B(ce.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:C.map(ce=>d.jsx("option",{value:ce,children:ce},ce))})]}),d.jsx(gt,{label:"Message (optional)",value:H,onChange:V,placeholder:`🧪 MeshAI test — ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}),d.jsx("button",{onClick:_t,disabled:U,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 text-sm transition-colors",children:U?"Sending...":"Send test"}),W&&(W.sent?d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),W.detail]}):d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:W.detail}))]}):d.jsx("p",{className:"text-sm text-slate-500",children:"MeshCore not connected"})]})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load connection config"})})}const v2e={serial:"bg-emerald-500/15 text-emerald-400",tcp:"bg-sky-500/15 text-sky-400",ble:"bg-violet-500/15 text-violet-400"};function p2e(e){return e?e.target?e.target:e.conn_type==="serial"?e.serial_port?`${e.serial_port}@${e.baud??115200}`:"serial":e.conn_type==="ble"?e.ble_address||"ble":e.host?`${e.host}${e.port!=null?`:${e.port}`:""}`:"—":"—"}function g2e(e){const t=Math.floor(Date.now()/1e3-e);if(t<5)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function zZ(){const[e,t]=E.useState(null),[r,n]=E.useState(null),[a,i]=E.useState(!0),[o,s]=E.useState(null),[l,u]=E.useState(null),[c,h]=E.useState(!1),[f,v]=E.useState(null),[g,m]=E.useState(24),[y,x]=E.useState(!1),[_,w]=E.useState(!1),[S,C]=E.useState(null),[M,A]=E.useState(null);E.useEffect(()=>{document.title="Companion & Channels - MeshAI"},[]),E.useEffect(()=>{let D=!1;return(async()=>{i(!0),s(null);try{const[B,H]=await Promise.all([Uj(),YV()]);if(D)return;t(B),n(H)}catch(B){if(D)return;s(B instanceof Error?B.message:"Failed to load companion status")}finally{D||i(!1)}})(),()=>{D=!0}},[]),E.useEffect(()=>{(async()=>{try{const D=await fetch("/api/config/connection");if(D.ok){const B=await D.json();A(B);const H=B.meshcore_advert_interval_seconds;typeof H=="number"&&m(H>0?H/3600:0)}}catch{}})()},[]);const k=E.useCallback(async()=>{h(!0),v(null);try{const D=await KJ();if(v(D),D.sent)try{const B=await Uj();t(B)}catch{}}catch(D){v({sent:!1,detail:D instanceof Error?D.message:"Request failed"})}finally{h(!1)}},[]),I=E.useCallback(async()=>{x(!0),w(!1),C(null);try{const D=Math.round(g*3600),B=M??{};await ja("connection",{...B,meshcore_advert_interval_seconds:D}),A({...B,meshcore_advert_interval_seconds:D}),w(!0),setTimeout(()=>w(!1),2e3)}catch(D){C(D instanceof Error?D.message:"Save failed")}finally{x(!1)}},[g,M]),P=E.useCallback(async D=>{try{await navigator.clipboard.writeText(D),u(D),setTimeout(()=>u(B=>B===D?null:B),1500)}catch{}},[]),j=(e==null?void 0:e.connected)===!0,z=r!=null&&r.active?r.channels:[];return d.jsxs("div",{className:"max-w-3xl mx-auto space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:d.jsx(_k,{size:24,className:"text-accent"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"Companion & Channels"}),d.jsx("p",{className:"text-sm text-[#777]",children:"Live status for the AIDA MeshCore companion and its joined channels."})]})]}),a?d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-slate-400",children:"Loading..."})}):o?d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:o}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"bg-bg-card border border-border p-6",children:j?d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-green-500"}),d.jsx("span",{className:"text-sm font-medium text-green-400",children:"Connected"})]}),d.jsxs("dl",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-4 text-sm",children:[d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Node name"}),d.jsx("dd",{className:"text-slate-100",children:(e==null?void 0:e.name)??"unnamed"})]}),d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Connection"}),d.jsxs("dd",{className:"flex items-center gap-2",children:[d.jsx("span",{className:`px-1.5 py-0.5 text-[10px] uppercase tracking-wide rounded ${v2e[(e==null?void 0:e.conn_type)??""]??"bg-slate-600/30 text-slate-400"}`,children:(e==null?void 0:e.conn_type)??"unknown"}),d.jsx("span",{className:"text-slate-100 font-mono text-xs break-all",children:p2e(e)})]})]}),d.jsxs("div",{className:"sm:col-span-2",children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Public key"}),d.jsx("dd",{className:"text-slate-100 font-mono text-xs break-all",children:(e==null?void 0:e.pubkey)??"—"})]}),d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Channels joined"}),d.jsx("dd",{className:"text-slate-100",children:(e==null?void 0:e.channel_count)??0})]}),(e==null?void 0:e.last_advert_sent)!=null&&d.jsxs("div",{children:[d.jsx("dt",{className:"text-[#777] mb-1",children:"Last advertised"}),d.jsx("dd",{className:"text-slate-100",children:g2e(e.last_advert_sent)})]})]}),d.jsxs("div",{className:"pt-2 border-t border-border space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("button",{onClick:k,disabled:c,className:"flex items-center gap-2 px-3 py-1.5 text-sm bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[d.jsx(bi,{size:14}),c?"Sending…":"Send Advert"]}),f!=null&&d.jsx("span",{className:`text-sm ${f.sent?"text-green-400":"text-red-400"}`,children:f.sent?"Advert sent":f.detail})]}),d.jsx("p",{className:"text-xs text-[#555]",children:"Announce this node to the mesh so others can discover and DM it."})]})]}):d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-slate-600"}),d.jsx("span",{className:"text-sm font-medium text-slate-400",children:"Not connected"})]}),d.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"The MeshCore companion is offline or inactive. No node identity or channel membership is available while the companion is disconnected."})]})}),d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"px-4 py-3 border-b border-border",children:[d.jsx("h3",{className:"text-sm font-medium text-slate-200",children:"Channels"}),d.jsx("p",{className:"text-xs text-[#555] mt-1",children:"Key = the channel PSK; enter it (or the # name) on a companion radio to join."})]}),z.length>0?d.jsx("div",{className:"overflow-x-auto",children:d.jsxs("table",{className:"w-full text-sm text-slate-200",children:[d.jsx("thead",{className:"bg-[#161616] border-b border-border",children:d.jsxs("tr",{children:[d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Name"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"On-air hash"}),d.jsx("th",{className:"px-3 py-2 font-sans text-[9px] uppercase tracking-widest text-[#666] text-left",children:"Key"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:z.map(D=>d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-3 py-2 font-mono",children:D.name}),d.jsx("td",{className:"px-3 py-2 font-mono text-xs text-[#999]",children:D.hash!=null?`0x${D.hash}`:"—"}),d.jsx("td",{className:"px-3 py-2",children:D.key!=null?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-mono text-xs text-[#999] break-all",children:D.key}),d.jsx("button",{onClick:()=>P(D.key),className:"flex-shrink-0 px-2 py-0.5 text-[10px] bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded transition-colors",title:"Copy key to clipboard",children:l===D.key?"Copied":"Copy"})]}):d.jsx("span",{className:"text-xs text-[#777]",children:"—"})})]},D.name))})]})}):d.jsx("div",{className:"px-4 py-3 text-sm text-[#777]",children:"No channels"})]}),d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsx("div",{className:"px-4 py-3 border-b border-border",children:d.jsx("h3",{className:"text-sm font-medium text-slate-200",children:"Advertising"})}),d.jsx("div",{className:"px-4 py-4 space-y-4",children:d.jsxs("div",{className:"space-y-1",children:[d.jsx("label",{className:"text-xs font-medium text-[#777] uppercase tracking-wide",children:"Auto-advert interval"}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs("select",{value:g,onChange:D=>m(Number(D.target.value)),className:"bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 text-sm rounded px-2 py-1.5 focus:outline-none focus:border-accent",children:[d.jsx("option",{value:0,children:"Disabled"}),d.jsx("option",{value:1,children:"Every 1 hour"}),d.jsx("option",{value:3,children:"Every 3 hours"}),d.jsx("option",{value:6,children:"Every 6 hours"}),d.jsx("option",{value:12,children:"Every 12 hours"}),d.jsx("option",{value:24,children:"Every 24 hours (default)"})]}),d.jsx("button",{onClick:I,disabled:y,className:"px-3 py-1.5 text-sm bg-accent/10 hover:bg-accent/20 text-accent border border-accent/30 rounded disabled:opacity-50 transition-colors",children:y?"Saving…":_?"Saved":"Save"})]}),S&&d.jsxs("p",{className:"text-xs text-red-400",role:"alert",children:["Save failed — ",S]}),d.jsxs("p",{className:"text-xs text-[#555]",children:["AIDA sends a flood advertisement at this interval so it stays discoverable. Stored in ",d.jsx("code",{className:"text-accent/80",children:"connection.meshcore_advert_interval_seconds"}),"."]})]})})]})]})]})}function m2e(){const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(null),[u,c]=E.useState(null),[h,f]=E.useState(null),[v,g]=E.useState(!0),[m,y]=E.useState(!1),[x,_]=E.useState(null),[w,S]=E.useState(null),[C,M]=E.useState(!1),[A,k]=E.useState(0),[I,P]=E.useState(""),[j,z]=E.useState(!1),[D,B]=E.useState(null),H=async()=>{z(!0),B(null);try{const W=await XV({transport:"meshtastic",channel:A,text:I.trim()||void 0});B(W)}catch(W){B({sent:!1,detail:W instanceof Error?W.message:"Send failed"})}finally{z(!1)}},V=E.useCallback(async()=>{g(!0);try{const[W,$,Z]=await Promise.all([Ao("connection"),Ao("context"),Ao("bot")]);r(W),a(JSON.parse(JSON.stringify(W))),o($),l(JSON.parse(JSON.stringify($))),c(Z),f(JSON.parse(JSON.stringify(Z))),M(!1),_(null)}catch(W){_(W instanceof Error?W.message:"Unknown error")}finally{g(!1)}},[]);E.useEffect(()=>{document.title="Meshtastic Connection - MeshAI",V()},[V]),E.useEffect(()=>{if(t&&n&&i&&s&&u&&h){const W=JSON.stringify(t)!==JSON.stringify(n)||JSON.stringify(i)!==JSON.stringify(s)||JSON.stringify(u)!==JSON.stringify(h);M(W)}},[t,n,i,s,u,h]),E.useEffect(()=>(e(C),()=>e(!1)),[C,e]);const U=async()=>{if(!(!t||!i||!u)){y(!0),_(null),S(null);try{const W=await Promise.all([ja("connection",t),ja("context",i),ja("bot",u)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),f(JSON.parse(JSON.stringify(u))),M(!1),e(!1),S("Meshtastic connection saved successfully"),W.some($=>$.restart_required)&&bu([]),setTimeout(()=>S(null),3e3)}catch(W){_(W instanceof Error?W.message:"Save failed")}finally{y(!1)}}},F=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),h&&c(JSON.parse(JSON.stringify(h))),M(!1)};return v?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading Meshtastic connection..."})}):t?d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"Connection to your Meshtastic radio (serial or TCP)."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:V,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:F,disabled:!C,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:U,disabled:m||!C,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:[d.jsx(_a,{size:16}),m?"Saving...":"Save"]})]})]}),x&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:x}),w&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),w]}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(yCe,{data:t,onChange:r})}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsxs("details",{className:"group",children:[d.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer text-sm text-slate-400 hover:text-slate-200",children:[d.jsx(Ah,{size:14,className:"group-open:rotate-90 transition-transform"}),"Advanced — Reconnect & Packet Tuning"]}),d.jsxs("div",{className:"mt-4 space-y-4 pl-6 border-l border-[#1e2a3a]",children:[d.jsx(qt,{label:"Auto-reconnect",checked:t.reconnect??!0,onChange:W=>r({...t,reconnect:W}),helper:"Automatically reconnect if the mesh link drops"}),d.jsx(Ne,{label:"Reconnect Initial Delay (s)",value:t.reconnect_initial_delay??2,onChange:W=>r({...t,reconnect_initial_delay:W}),min:0,step:.5,helper:"Backoff delay before the first reconnect attempt"}),d.jsx(Ne,{label:"Reconnect Max Delay (s)",value:t.reconnect_max_delay??60,onChange:W=>r({...t,reconnect_max_delay:W}),min:0,helper:"Ceiling for exponential reconnect backoff"}),d.jsx(Ne,{label:"Reconnect Health Interval (s)",value:t.reconnect_health_interval??30,onChange:W=>r({...t,reconnect_health_interval:W}),min:1,helper:"How often the socket-probe watchdog checks link health"}),d.jsx(Ne,{label:"Mesh Max Chars",value:t.mesh_max_chars??140,onChange:W=>r({...t,mesh_max_chars:W}),min:1,helper:"Per-packet character budget for the transport"})]})]})}),i&&u&&d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Bot behavior"}),d.jsx(qt,{label:"Enable Passive Context",checked:!!i.enabled,onChange:W=>o({...i,enabled:W}),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."}),d.jsx(jP,{label:"Observe Channels",value:i.observe_channels??[],onChange:W=>o({...i,observe_channels:W}),helper:"Channels to monitor (empty = all)",info:"Meshtastic channels to listen on. Leave empty to monitor all channels.",mode:"multi"}),d.jsx(DP,{label:"Ignore Nodes",value:i.ignore_nodes??[],onChange:W=>o({...i,ignore_nodes:W}),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."}),d.jsx(qt,{label:"Answer direct messages",checked:!!u.respond_to_dms,onChange:W=>c({...u,respond_to_dms:W}),helper:"When on, MeshAI replies to Meshtastic direct messages using the LLM. Applies to Meshtastic only."})]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Send Test Message"}),d.jsx(Ne,{label:"Channel Index",value:A,onChange:k,min:0,max:7,helper:"Meshtastic channel number (0 = primary)"}),d.jsx(gt,{label:"Message (optional)",value:I,onChange:P,placeholder:`🧪 MeshAI test — ${new Date().toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})}`}),d.jsx("button",{onClick:H,disabled:j,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 text-sm transition-colors",children:j?"Sending...":"Send test"}),D&&(D.sent?d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),D.detail]}):d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:D.detail}))]})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load connection config"})})}function BZ(){const{setDirty:e}=$i(),[t,r]=E.useState(null),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(null),[u,c]=E.useState(!0),[h,f]=E.useState(!1),[v,g]=E.useState(null),[m,y]=E.useState(null),[x,_]=E.useState(!1),w=E.useCallback(async()=>{c(!0);try{const[M,A]=await Promise.all([Ao("meshmonitor"),Ao("mesh_sources")]);r(M),a(JSON.parse(JSON.stringify(M))),o(A),l(JSON.parse(JSON.stringify(A))),_(!1),g(null)}catch(M){g(M instanceof Error?M.message:"Unknown error")}finally{c(!1)}},[]);E.useEffect(()=>{document.title="Meshtastic Sources - MeshAI",w()},[w]),E.useEffect(()=>{if(t&&n&&i&&s){const M=JSON.stringify(t)!==JSON.stringify(n),A=JSON.stringify(i)!==JSON.stringify(s);_(M||A)}},[t,n,i,s]),E.useEffect(()=>(e(x),()=>e(!1)),[x,e]);const S=async()=>{if(!(!t||!i)){f(!0),g(null),y(null);try{const[M,A]=await Promise.all([ja("meshmonitor",t),ja("mesh_sources",i)]);a(JSON.parse(JSON.stringify(t))),l(JSON.parse(JSON.stringify(i))),_(!1),e(!1),y("Meshtastic sources saved successfully"),(M.restart_required||A.restart_required)&&bu([]),setTimeout(()=>y(null),3e3)}catch(M){g(M instanceof Error?M.message:"Save failed")}finally{f(!1)}}},C=()=>{n&&r(JSON.parse(JSON.stringify(n))),s&&o(JSON.parse(JSON.stringify(s))),_(!1)};return u?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading Meshtastic sources..."})}):!t||!i?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load sources config"})}):d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"MeshMonitor integration and mesh awareness data sources."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:w,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:C,disabled:!x,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:S,disabled:h||!x,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:[d.jsx(_a,{size:16}),h?"Saving...":"Save"]})]})]}),v&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:v}),m&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),m]}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(MCe,{data:t,onChange:r})}),d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(kCe,{data:i,onChange:o})})]})}const y2e=[{key:"gauge-sites",label:"Gauge Sites"},{key:"town-anchors",label:"Town Anchors"}];function x2e(){const[e,t]=E.useState("gauge-sites");return E.useEffect(()=>{document.title="Places - MeshAI"},[]),d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-1 border-b border-border",children:y2e.map(({key:r,label:n})=>d.jsx("button",{onClick:()=>t(r),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===r?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:n},r))}),e==="gauge-sites"&&d.jsx(RZ,{}),e==="town-anchors"&&d.jsx(OZ,{})]})}const _2e=[{key:"nodes",label:"Nodes"},{key:"sources",label:"Sources"},{key:"health",label:"Health"}];function b2e(){const[e,t]=E.useState("nodes"),{setDirty:r}=$i(),[n,a]=E.useState(null),[i,o]=E.useState(null),[s,l]=E.useState(!1),[u,c]=E.useState(!1),[h,f]=E.useState(null),[v,g]=E.useState(null),[m,y]=E.useState(!1);E.useEffect(()=>{document.title="Nodes & Health - MeshAI"},[]);const x=E.useCallback(async()=>{l(!0),f(null);try{const S=await Ao("mesh_intelligence");a(S),o(JSON.parse(JSON.stringify(S))),y(!1)}catch(S){f(S instanceof Error?S.message:"Failed to load mesh intelligence config")}finally{l(!1)}},[]);E.useEffect(()=>{e==="health"&&n===null&&!s&&x()},[e,n,s,x]),E.useEffect(()=>{n&&i&&y(JSON.stringify(n)!==JSON.stringify(i))},[n,i]),E.useEffect(()=>(r(m),()=>r(!1)),[m,r]);const _=async()=>{if(n){c(!0),f(null),g(null);try{const S=await ja("mesh_intelligence",n);o(JSON.parse(JSON.stringify(n))),y(!1),r(!1),g("Mesh intelligence saved successfully"),S.restart_required&&bu([]),setTimeout(()=>g(null),3e3)}catch(S){f(S instanceof Error?S.message:"Save failed")}finally{c(!1)}}},w=()=>{i&&a(JSON.parse(JSON.stringify(i))),y(!1)};return d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-1 border-b border-border",children:_2e.map(({key:S,label:C})=>d.jsx("button",{onClick:()=>t(S),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===S?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:C},S))}),e==="nodes"&&d.jsx(AZ,{}),e==="sources"&&d.jsx(BZ,{}),e==="health"&&d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:"Mesh health scoring, region management, and automated alerting."})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:x,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:w,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:_,disabled:u||!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:[d.jsx(_a,{size:16}),u?"Saving...":"Save"]})]})]}),h&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:h}),v&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),v]}),s?d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-slate-400",children:"Loading..."})}):n?d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx(kZ,{data:n,onChange:a})}):d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-red-400",children:"Failed to load config"})})]})]})}const w2e=15e3,Np=5,FZ=14,S2e=FZ*86400;function rT(e){return e.last_advert==null||e.last_advert<=0?!1:Math.floor(Date.now()/1e3)-e.last_advert>S2e}const C2e={room_not_found:"no room server with this key is on the companion",channel_not_found:"this channel is not on the companion",not_a_room:"this key belongs to a contact that is not a room server"};function eF(e){if(e==null)return"—";const t=Math.floor(Date.now()/1e3-e);if(t<0)return"just now";if(t<60)return`${t}s ago`;const r=Math.floor(t/60);if(r<60)return`${r}m ago`;const n=Math.floor(r/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function T2e(e){if(!e)return"—";const t=Date.parse(e);if(Number.isNaN(t))return"—";const r=Math.floor((Date.now()-t)/1e3);if(r<5)return"just now";if(r<60)return`${r}s ago`;const n=Math.floor(r/60);if(n<60)return`${n}m ago`;const a=Math.floor(n/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}const M2e={1:{label:"Chat",className:"bg-sky-500/15 text-sky-400"},2:{label:"Repeater",className:"bg-amber-500/15 text-amber-400"},3:{label:"Room",className:"bg-violet-500/15 text-violet-400"},4:{label:"Sensor",className:"bg-emerald-500/15 text-emerald-400"}};function A2e({type:e}){const t=e!=null&&M2e[e]||{label:"Unknown",className:"bg-slate-600/30 text-slate-400"};return d.jsx("span",{className:`px-2 py-0.5 text-[10px] uppercase tracking-wide rounded ${t.className}`,children:t.label})}function tF(e){return e.name?e.name:e.pubkey?`${e.pubkey.slice(0,12)}…`:"unnamed"}function nT(e){return e.pubkey||e.name||""}function aT(e){return e.length>12?`${e.slice(0,12)}…`:e}function N2e(e){return e.lat!=null&&e.lon!=null?`${e.lat.toFixed(4)}, ${e.lon.toFixed(4)}`:"—"}const k2e=[{key:"battery_pct",label:"Battery",unit:"%",digits:0},{key:"voltage",label:"Voltage",unit:"V",digits:2},{key:"temperature",label:"Temp",unit:"°C",digits:1},{key:"humidity",label:"Humidity",unit:"%",digits:0},{key:"current",label:"Current",unit:"A",digits:2},{key:"illuminance",label:"Light",unit:"lx",digits:0},{key:"barometer",label:"Pressure",unit:"hPa",digits:1},{key:"power",label:"Power",unit:"W",digits:1},{key:"altitude",label:"Alt",unit:"m",digits:0},{key:"distance",label:"Dist",unit:"m",digits:0}];function L2e({data:e,polledLabel:t}){const r=k2e.flatMap(n=>{const a=e[n.key];return typeof a!="number"||Number.isNaN(a)?[]:[d.jsxs("span",{className:"px-2 py-0.5 text-xs rounded bg-[#0a0e17] border border-[#1e2a3a] text-slate-200",children:[d.jsx("span",{className:"text-[#777]",children:n.label})," ",a.toFixed(n.digits),n.unit]},n.key)]});return d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.length>0?r:d.jsx("span",{className:"text-xs text-[#777]",children:"Telemetry received (no standard sensor fields)"}),d.jsxs("span",{className:"text-[11px] text-[#777] ml-1",children:["polled ",t]})]})}function I2e(){const[e,t]=E.useState(null),[r,n]=E.useState(!0),[a,i]=E.useState(null),[o,s]=E.useState(null),[l,u]=E.useState(null),[c,h]=E.useState(null),[f,v]=E.useState(!1),[g,m]=E.useState(null),[y,x]=E.useState(null),[_,w]=E.useState(null),[S,C]=E.useState(!1),[M,A]=E.useState(""),[k,I]=E.useState(""),[P,j]=E.useState(1),[z,D]=E.useState(!1),[B,H]=E.useState(null),[V,U]=E.useState(null),[F,W]=E.useState(null),[$,Z]=E.useState(null),[J,re]=E.useState(""),[Q,le]=E.useState("all"),[de,He]=E.useState("name"),[ye,ne]=E.useState(!0),[xe,he]=E.useState(null),[ge,tt]=E.useState(null),[Ue,qe]=E.useState(null),[Fe,_t]=E.useState({}),[bt,et]=E.useState(null),[Ke,St]=E.useState(30),[ce,st]=E.useState(!1),[Bt,Ft]=E.useState(!1);E.useEffect(()=>{document.title="MeshCore Contacts - MeshAI"},[]),E.useEffect(()=>{let ue=!1;return(async()=>{n(!0),i(null);try{const Xe=await Hj();ue||(t(Xe),w(Xe.last_synced_at??null))}catch(Xe){ue||i(Xe instanceof Error?Xe.message:"Failed to load contacts")}finally{ue||n(!1)}})(),()=>{ue=!0}},[]);const jt=E.useCallback(async()=>{try{const ue=await qJ();h(ue)}catch{}},[]);E.useEffect(()=>{jt()},[jt]),E.useEffect(()=>{let ue=!1;return(async()=>{try{const Xe=await JJ();if(ue)return;s(Xe);const lt=Xe.meshcore_telemetry_interval_seconds;typeof lt=="number"&<>0&&St(Math.max(Np,Math.round(lt/60)))}catch{}})(),()=>{ue=!0}},[]),E.useEffect(()=>{let ue=!1;const Xe=async()=>{try{const Pt=await QJ();ue||u(Pt)}catch{}};Xe();const lt=setInterval(Xe,w2e);return()=>{ue=!0,clearInterval(lt)}},[]);const Lr=(o==null?void 0:o.meshcore_telemetry_contacts)??[],Qo=E.useCallback(ue=>((l==null?void 0:l.entries)??[]).find(lt=>lt.contact===ue.pubkey||ue.name!=null&<.contact===ue.name),[l]),tl=E.useCallback(ue=>Lr.includes(ue.pubkey)||ue.name!=null&&Lr.includes(ue.name),[Lr]),Ki=E.useCallback(async(ue,Xe)=>{if(!o)return;const lt=nT(ue);if(!lt)return;et(null),he(lt);const Pt=o.meshcore_telemetry_contacts??[];let fr;Xe?fr=Pt.includes(lt)?Pt:[...Pt,lt]:fr=Pt.filter(Ct=>Ct!==ue.pubkey&&Ct!==ue.name);const Tn={...o,meshcore_telemetry_contacts:fr};try{await ja("connection",Tn),s(Tn),tt(lt),setTimeout(()=>tt(Ct=>Ct===lt?null:Ct),1500)}catch(Ct){et(Ct instanceof Error?Ct.message:"Failed to save")}finally{he(Ct=>Ct===lt?null:Ct)}},[o]),Uh=E.useCallback(async ue=>{const Xe=nT(ue);if(Xe){qe(Xe);try{const lt=await eQ(Xe);_t(Pt=>({...Pt,[Xe]:lt}))}catch(lt){_t(Pt=>({...Pt,[Xe]:{available:!1,contact:Xe,detail:lt instanceof Error?lt.message:"Poll failed"}}))}finally{qe(lt=>lt===Xe?null:lt)}}},[]),Hn=E.useCallback(async()=>{v(!0),m(null),x(null),et(null);try{const ue=await ZJ();t({active:ue.active,contacts:ue.contacts}),w(ue.last_synced_at),m(ue.stats),x(ue.channel_stats),jt()}catch(ue){et(ue instanceof Error?ue.message:"Resync failed")}finally{v(!1)}},[jt]),es=E.useCallback(async()=>{var lt;const ue=k.trim().toLowerCase(),Xe=M.trim();if(!/^[0-9a-f]{64}$/.test(ue)){H("Pubkey must be exactly 64 hex characters (the full key, not a prefix)");return}if(!Xe){H("A name is required");return}D(!0),H(null);try{const Pt=await YJ([{pubkey:ue,name:Xe,type:P,flags:0,out_path_len:-1,out_path:"",last_advert:0}]);if(Pt.failed>0){H(((lt=Pt.errors[0])==null?void 0:lt.detail)||"Add failed");return}C(!1),A(""),I("");const fr=await Hj();t(fr),w(fr.last_synced_at??null),jt()}catch(Pt){H(Pt instanceof Error?Pt.message:"Add failed")}finally{D(!1)}},[k,M,P,jt]),ts=E.useCallback(()=>{window.location.href="/api/meshcore/contacts/export"},[]),Au=E.useCallback(async ue=>{W(ue.pubkey),et(null);try{const Xe=await XJ(ue.pubkey);t(lt=>({active:!0,contacts:Xe.contacts,last_synced_at:(lt==null?void 0:lt.last_synced_at)??null})),U(null),jt()}catch(Xe){et(Xe instanceof Error?Xe.message:"Delete failed")}finally{W(Xe=>Xe===ue.pubkey?null:Xe)}},[jt]),Wh=E.useCallback(async ue=>{try{await navigator.clipboard.writeText(ue)}catch{}},[]),Ga=E.useCallback(ue=>{He(Xe=>Xe===ue?(ne(lt=>!lt),Xe):(ne(!0),ue))},[]),$h=E.useMemo(()=>{const ue=new Set;for(const Xe of(c==null?void 0:c.collisions)??[])ue.add(Xe.name);return ue},[c]),Nu=E.useMemo(()=>{let ue=(e==null?void 0:e.contacts)??[];const Xe=J.trim().toLowerCase();return Xe&&(ue=ue.filter(Pt=>(Pt.name??"").toLowerCase().includes(Xe)||Pt.pubkey.toLowerCase().includes(Xe))),Q==="rooms"?ue=ue.filter(Pt=>Pt.type===3):Q==="stale"&&(ue=ue.filter(rT)),[...ue].sort((Pt,fr)=>{let Tn=0;return de==="name"?Tn=(Pt.name??"").localeCompare(fr.name??""):de==="type"?Tn=(Pt.type??0)-(fr.type??0):Tn=(Pt.last_advert??0)-(fr.last_advert??0),ye?Tn:-Tn})},[e,J,Q,de,ye]),ku=E.useMemo(()=>((e==null?void 0:e.contacts)??[]).filter(rT).length,[e]),rl=E.useMemo(()=>((e==null?void 0:e.contacts)??[]).filter(ue=>ue.type===3).length,[e]),Lu=E.useCallback(async()=>{if(!o)return;const ue=Math.max(Np,Math.round(Ke)||Np),Xe={...o,meshcore_telemetry_interval_seconds:ue*60};st(!0),Ft(!1),et(null);try{await ja("connection",Xe),s(Xe),St(ue),Ft(!0),setTimeout(()=>Ft(!1),2e3)}catch(lt){et(lt instanceof Error?lt.message:"Failed to save interval")}finally{st(!1)}},[o,Ke]),Iu=(e==null?void 0:e.active)!==!1,rs=(c==null?void 0:c.dangling)??[],ns=(c==null?void 0:c.collisions)??[];return d.jsxs("div",{className:"max-w-5xl mx-auto space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:d.jsx(WV,{size:24,className:"text-accent"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"MeshCore Contacts"}),d.jsx("p",{className:"text-sm text-[#777]",children:"The companion's known contact roster — names, types, last-heard times, and telemetry auto-poll."})]})]}),rs.length>0&&d.jsx("div",{className:"border border-red-500/40 bg-red-500/10 p-4 space-y-2",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(pi,{size:18,className:"text-red-400 flex-shrink-0 mt-0.5"}),d.jsxs("div",{className:"space-y-2 min-w-0",children:[d.jsxs("h3",{className:"text-sm font-semibold text-red-300",children:[rs.length," routing ",rs.length===1?"cell points":"cells point"," at a destination that no longer exists"]}),d.jsx("p",{className:"text-xs text-red-300/70 max-w-prose",children:"These cells cannot be delivered — a send to a missing room or channel fails silently. Fix the target on the Routing page, or resync if the roster is stale."}),d.jsx("ul",{className:"space-y-1",children:rs.map(ue=>d.jsxs("li",{className:"text-xs text-slate-200 flex flex-wrap items-center gap-x-2 gap-y-1",children:[d.jsx("span",{className:"px-1.5 py-0.5 rounded bg-red-500/20 text-red-300 uppercase tracking-wide text-[10px]",children:ue.family}),d.jsx("span",{className:"text-slate-300",children:ue.region}),d.jsx("span",{className:"text-[#777]",children:"→"}),d.jsx("span",{className:"font-mono text-[11px] text-red-300 break-all",children:ue.target}),d.jsxs("span",{className:"text-[#777]",children:["— ",C2e[ue.reason]??ue.reason]}),!ue.enabled&&d.jsx("span",{className:"px-1.5 py-0.5 rounded bg-slate-600/30 text-slate-400 text-[10px] uppercase tracking-wide",children:"disabled"})]},`${ue.family}-${ue.region}-${ue.target}`))})]})]})}),ns.length>0&&d.jsx("div",{className:"border border-amber-500/40 bg-amber-500/10 p-4",children:d.jsxs("div",{className:"flex items-start gap-3",children:[d.jsx(pi,{size:18,className:"text-amber-400 flex-shrink-0 mt-0.5"}),d.jsxs("div",{className:"space-y-2 min-w-0",children:[d.jsxs("h3",{className:"text-sm font-semibold text-amber-300",children:[ns.length," duplicated ",ns.length===1?"name":"names"," on the roster"]}),d.jsx("p",{className:"text-xs text-amber-300/70 max-w-prose",children:"These names each map to more than one public key. A name alone cannot identify them — always confirm the key before routing to or deleting one."}),d.jsx("ul",{className:"space-y-1",children:ns.map(ue=>d.jsxs("li",{className:"text-xs text-slate-200",children:[d.jsx("span",{className:"text-slate-100",children:ue.name})," ",d.jsxs("span",{className:"text-[#777]",children:["×",ue.count]}),d.jsx("span",{className:"ml-2 font-mono text-[11px] text-amber-300/80",children:ue.contacts.map(Xe=>aT(Xe.pubkey)).join(" · ")})]},ue.name))})]})]})}),Iu&&d.jsxs("div",{className:"bg-bg-card border border-border p-4 space-y-3",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsxs("button",{onClick:Hn,disabled:f,className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",title:"Refetch the full roster from the companion and drop entries it no longer has",children:[d.jsx(Zi,{size:14,className:f?"animate-spin":void 0}),f?"Resyncing…":"Resync from node"]}),d.jsxs("button",{onClick:ts,className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 hover:border-accent/40",title:"Download the roster as JSON",children:[d.jsx(bJ,{size:14}),"Export JSON"]}),d.jsxs("button",{onClick:()=>{C(ue=>!ue),H(null)},className:"flex items-center gap-2 px-3 py-1.5 text-sm rounded bg-[#0a0e17] border border-[#1e2a3a] text-slate-200 hover:border-accent/40",title:"Add a contact by public key",children:[d.jsx(li,{size:14}),"Add contact"]}),d.jsxs("span",{className:"text-xs text-[#777]",children:["Last synced ",_!=null?eF(_):"unknown"]}),g&&d.jsxs("span",{className:"text-xs text-slate-300",children:[d.jsxs("span",{className:"text-emerald-400",children:["+",g.added," added"]})," · ",d.jsxs("span",{className:"text-red-400",children:["−",g.removed," removed"]})," · ",d.jsxs("span",{className:"text-[#777]",children:[g.updated," updated"]})," · ",d.jsxs("span",{className:"text-[#777]",children:[g.after," total"]}),y&&d.jsxs("span",{className:"text-[#777]",children:[" · ","channels ",y.after,y.added.length>0&&d.jsxs("span",{className:"text-emerald-400",children:[" +",y.added.length]}),y.removed.length>0&&d.jsxs("span",{className:"text-red-400",children:[" −",y.removed.length]})]})]})]}),S&&d.jsxs("div",{className:"border border-[#1e2a3a] bg-[#0a0e17] p-3 space-y-2",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsx("input",{value:M,onChange:ue=>A(ue.target.value),placeholder:"Name",className:"w-40 px-2 py-1 text-sm bg-bg-card border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]"}),d.jsx("input",{value:k,onChange:ue=>I(ue.target.value),placeholder:"Full 64-character hex public key",className:"flex-1 min-w-[280px] px-2 py-1 text-sm font-mono bg-bg-card border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]"}),d.jsxs("select",{value:P,onChange:ue=>j(Number(ue.target.value)),className:"px-2 py-1 text-sm bg-bg-card border border-[#1e2a3a] rounded text-slate-200",children:[d.jsx("option",{value:1,children:"Chat"}),d.jsx("option",{value:2,children:"Repeater"}),d.jsx("option",{value:3,children:"Room"}),d.jsx("option",{value:4,children:"Sensor"})]}),d.jsx("button",{onClick:es,disabled:z,className:"px-3 py-1 text-sm rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",children:z?"Adding…":"Add"}),d.jsx("button",{onClick:()=>C(!1),className:"px-2 py-1 text-sm text-[#777] hover:text-slate-200",children:"Cancel"})]}),B&&d.jsx("p",{className:"text-xs text-red-400",children:B}),d.jsx("p",{className:"text-xs text-[#777] max-w-prose",children:"Writes the contact straight to the companion — nothing is transmitted. Use this when a node has been rebuilt with a new keypair, or is not yet in range to advert."})]}),d.jsx("p",{className:"text-xs text-[#777] max-w-prose",children:"The roster and channel list are a snapshot cached from the companion at connect. Resync re-reads both from the node and reconciles them — the only action that removes entries the companion has dropped, or picks up a channel added on the radio."})]}),Iu&&o&&d.jsxs("div",{className:"bg-bg-card border border-border p-4 space-y-2",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[d.jsx("label",{className:"text-sm text-slate-200",children:"Auto-poll every"}),d.jsx("input",{type:"number",min:Np,value:Ke,onChange:ue=>St(Number(ue.target.value)),className:"w-20 px-2 py-1 text-sm bg-[#0a0e17] border border-[#1e2a3a] rounded text-slate-100"}),d.jsx("span",{className:"text-sm text-slate-300",children:"minutes"}),d.jsx("button",{onClick:Lu,disabled:ce,className:"px-3 py-1 text-sm rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",children:ce?"Saving…":Bt?"Saved":"Save"})]}),d.jsxs("p",{className:"text-xs text-[#777] max-w-prose",children:["Polls only the nodes you select below. Keep this list small — telemetry uses mesh airtime. Minimum ",Np," minutes."]})]}),bt&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:bt}),r?d.jsx("div",{className:"flex items-center justify-center h-32",children:d.jsx("div",{className:"text-slate-400",children:"Loading..."})}):a?d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:a}):e&&e.active===!1?d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"The MeshCore companion is not connected. The contact roster is unavailable until the companion comes online."})}):e&&e.contacts.length===0?d.jsx("div",{className:"bg-bg-card border border-border p-6",children:d.jsx("p",{className:"text-sm text-[#777] leading-relaxed max-w-prose",children:"No contacts yet. The companion is connected but has not discovered any nodes so far."})}):d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-4 py-3 border-b border-border",children:[d.jsx("input",{type:"search",value:J,onChange:ue=>re(ue.target.value),placeholder:"Search name or pubkey…",className:"flex-1 min-w-[180px] px-2 py-1 text-sm bg-[#0a0e17] border border-[#1e2a3a] rounded text-slate-100 placeholder:text-[#555]"}),d.jsx("div",{className:"flex gap-1",children:[{key:"all",label:`All ${(e==null?void 0:e.contacts.length)??0}`},{key:"rooms",label:`Rooms ${rl}`},{key:"stale",label:`Stale ${ku}`}].map(({key:ue,label:Xe})=>d.jsx("button",{onClick:()=>le(ue),className:`px-2.5 py-1 text-xs rounded border transition-colors ${Q===ue?"border-accent/40 bg-accent/15 text-accent":"border-[#1e2a3a] bg-[#0a0e17] text-[#777] hover:text-slate-200"}`,children:Xe},ue))})]}),d.jsxs("div",{className:"overflow-x-auto",children:[d.jsxs("table",{className:"w-full text-sm",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"border-b border-border text-left text-[11px] uppercase tracking-wide text-[#777]",children:[d.jsx("th",{className:"px-4 py-2.5 font-medium",children:d.jsxs("button",{onClick:()=>Ga("name"),className:"hover:text-slate-200 uppercase",children:["Name",de==="name"?ye?" ▲":" ▼":""]})}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:d.jsxs("button",{onClick:()=>Ga("type"),className:"hover:text-slate-200 uppercase",children:["Type",de==="type"?ye?" ▲":" ▼":""]})}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:d.jsxs("button",{onClick:()=>Ga("last_advert"),className:"hover:text-slate-200 uppercase",children:["Last heard",de==="last_advert"?ye?" ▲":" ▼":""]})}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Position"}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Pubkey"}),d.jsx("th",{className:"px-4 py-2.5 font-medium",children:"Auto-poll"}),d.jsx("th",{className:"px-4 py-2.5 font-medium"})]})}),d.jsx("tbody",{className:"divide-y divide-border",children:Nu.map(ue=>{const Xe=nT(ue),lt=Qo(ue),Pt=tl(ue),fr=Fe[Xe],Tn=lt!=null&<.available===!1,Ct=xe===Xe||Tn&&!Pt;let as=null,Mn="",$e=!1;fr?fr.available&&fr.data?(as=fr.data,Mn="just now"):$e=!0:lt&&(lt.available&<.data?(as=lt.data,Mn=T2e(lt.polled_at)):$e=!0);const Zh=as!=null||$e;return d.jsxs(E.Fragment,{children:[d.jsxs("tr",{className:"hover:bg-bg-hover",children:[d.jsx("td",{className:"px-4 py-2.5 text-slate-100",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{children:tF(ue)}),ue.name!=null&&$h.has(ue.name)&&d.jsx("span",{className:"px-1.5 py-0.5 text-[10px] uppercase tracking-wide rounded bg-amber-500/15 text-amber-400",title:"Another contact advertises this same name with a different key — check the pubkey",children:"dup name"})]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsx(A2e,{type:ue.type})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"text-slate-300",children:eF(ue.last_advert)}),rT(ue)&&d.jsx("span",{className:"px-1.5 py-0.5 text-[10px] uppercase tracking-wide rounded bg-orange-500/15 text-orange-400",title:`Not heard from in over ${FZ} days`,children:"stale"})]})}),d.jsx("td",{className:"px-4 py-2.5 text-slate-300 font-mono text-xs",children:N2e(ue)}),d.jsx("td",{className:"px-4 py-2.5 text-slate-400 font-mono text-xs",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("button",{onClick:()=>Z(Me=>Me===ue.pubkey?null:ue.pubkey),className:"hover:text-accent",title:ue.pubkey,children:$===ue.pubkey?ue.pubkey:aT(ue.pubkey)}),d.jsx("button",{onClick:()=>Wh(ue.pubkey),className:"text-[#555] hover:text-accent flex-shrink-0",title:"Copy full pubkey",children:d.jsx(DV,{size:11})})]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsxs("label",{className:`inline-flex items-center gap-2 ${Ct?"opacity-50":"cursor-pointer"}`,title:Tn&&!Pt?"no telemetry available":void 0,children:[d.jsx("input",{type:"checkbox",checked:Pt,disabled:Ct,onChange:Me=>Ki(ue,Me.target.checked),className:"accent-accent"}),d.jsx("span",{className:"text-xs text-slate-300",children:xe===Xe?"saving…":ge===Xe?"saved":Tn&&!Pt?"no telemetry":"auto-poll"})]})}),d.jsx("td",{className:"px-4 py-2.5",children:d.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[d.jsx("button",{onClick:()=>Uh(ue),disabled:Ue===Xe,className:"px-2 py-1 text-xs rounded bg-accent/15 text-accent hover:bg-accent/25 disabled:opacity-50",children:Ue===Xe?"Polling…":"Poll now"}),V===ue.pubkey?d.jsxs(d.Fragment,{children:[d.jsx("button",{onClick:()=>Au(ue),disabled:F===ue.pubkey,className:"px-2 py-1 text-xs rounded bg-red-500/20 text-red-300 hover:bg-red-500/30 disabled:opacity-50",children:F===ue.pubkey?"Deleting…":"Confirm"}),d.jsx("button",{onClick:()=>U(null),className:"px-2 py-1 text-xs rounded text-[#777] hover:text-slate-200",children:"Cancel"})]}):d.jsx("button",{onClick:()=>U(ue.pubkey),className:"p-1 rounded text-[#555] hover:text-red-400 hover:bg-red-500/10",title:"Remove this contact from the companion",children:d.jsx(ui,{size:13})})]})})]}),V===ue.pubkey&&d.jsx("tr",{className:"bg-red-500/5",children:d.jsx("td",{colSpan:7,className:"px-4 py-2 border-t border-red-500/20",children:d.jsxs("span",{className:"text-xs text-red-300",children:["Remove ",d.jsx("span",{className:"text-slate-100",children:tF(ue)})," ",d.jsx("span",{className:"font-mono text-[11px]",children:aT(ue.pubkey)})," ","from the companion? It will only return if the node advertises again."]})})}),Zh&&d.jsx("tr",{className:"bg-[#0a0e17]/40",children:d.jsx("td",{colSpan:7,className:"px-4 py-2 border-t border-border/50",children:as?d.jsx(L2e,{data:as,polledLabel:Mn}):d.jsxs("span",{className:"text-xs text-[#777]",children:["no telemetry",fr!=null&&fr.detail?` — ${fr.detail}`:""]})})})]},ue.pubkey)})})]}),Nu.length===0&&d.jsx("div",{className:"px-4 py-6 text-sm text-[#777]",children:"No contacts match this filter."})]})]})]})}const P2e=[{key:"contacts",label:"Contacts"},{key:"companion",label:"Companion"}];function D2e(){const[e,t]=E.useState("contacts");return E.useEffect(()=>{document.title="Contacts & Companion - MeshAI"},[]),d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-1 border-b border-border",children:P2e.map(({key:r,label:n})=>d.jsx("button",{onClick:()=>t(r),className:`px-4 py-2 text-sm whitespace-nowrap border-b-2 -mb-px transition-colors ${e===r?"border-accent text-accent":"border-transparent text-[#777] hover:text-white"}`,children:n},r))}),e==="contacts"&&d.jsx(I2e,{}),e==="companion"&&d.jsx(zZ,{})]})}function rF({family:e="meshtastic"}){const{setDirty:t}=$i(),[r,n]=E.useState(null),[a,i]=E.useState(null),[o,s]=E.useState(!0),[l,u]=E.useState(!1),[c,h]=E.useState(null),[f,v]=E.useState(null),[g,m]=E.useState(!1),y=E.useCallback(async()=>{s(!0),h(null);try{const S=await Ao("notifications");n(S),i(JSON.parse(JSON.stringify(S))),m(!1)}catch(S){h(S instanceof Error?S.message:"Failed to load config")}finally{s(!1)}},[]);E.useEffect(()=>{document.title="Scheduled Broadcasts - MeshAI",y()},[y]),E.useEffect(()=>{if(r&&a){const S=JSON.stringify(r)!==JSON.stringify(a);m(S)}},[r,a]),E.useEffect(()=>(t(g),()=>t(!1)),[g,t]);const x=async()=>{if(r){u(!0),h(null),v(null);try{const S=await ja("notifications",r);i(JSON.parse(JSON.stringify(r))),S.restart_required&&bu([]),m(!1),t(!1),v("Scheduled broadcasts saved successfully"),setTimeout(()=>v(null),3e3)}catch(S){h(S instanceof Error?S.message:"Save failed")}finally{u(!1)}}},_=()=>{a&&n(JSON.parse(JSON.stringify(a))),m(!1)},w=e==="meshcore"?"MeshCore scheduled broadcasts and band condition reports.":"Meshtastic scheduled broadcasts and band condition reports.";return o?d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-slate-400",children:"Loading scheduled broadcasts..."})}):r?d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{children:d.jsx("p",{className:"text-sm text-slate-500",children:w})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:y,className:"p-2 text-slate-400 hover:text-slate-200 hover:bg-bg-hover rounded transition-colors",title:"Refresh",children:d.jsx(Zi,{size:18})}),d.jsxs("button",{onClick:_,disabled:!g,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:[d.jsx(xa,{size:16}),"Discard"]}),d.jsxs("button",{onClick:x,disabled:l||!g,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:[d.jsx(_a,{size:16}),l?"Saving...":"Save"]})]})]}),c&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:c}),f&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),f]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Cold-start grace"})}),d.jsx(qf,{label:"Grace period (seconds)",value:r.cold_start_grace_seconds??60,onChange:S=>n({...r,cold_start_grace_seconds:S}),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."})]}),d.jsxs("div",{className:"bg-bg-card border border-border p-6 space-y-4",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx("label",{className:"text-xs text-slate-500 uppercase tracking-wide",children:"Band Conditions (HF propagation)"})}),d.jsx(Ch,{label:"Enable scheduled band-conditions broadcasts",checked:r.band_conditions_enabled??!0,onChange:S=>n({...r,band_conditions_enabled:S}),helper:"3x/day HF propagation summary (Day/Night ratings per band group). 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."}),(r.band_conditions_enabled??!0)&&d.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[d.jsx(q2,{label:"Slot 1",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[0]||"06:00",onChange:S=>{const C=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];C[0]=S,n({...r,band_conditions_schedule:C})},helper:"Morning (default 06:00 MT)"}),d.jsx(q2,{label:"Slot 2",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[1]||"14:00",onChange:S=>{const C=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];C[1]=S,n({...r,band_conditions_schedule:C})},helper:"Afternoon (default 14:00 MT)"}),d.jsx(q2,{label:"Slot 3",value:(r.band_conditions_schedule??["06:00","14:00","22:00"])[2]||"22:00",onChange:S=>{const C=[...r.band_conditions_schedule??["06:00","14:00","22:00"]];C[2]=S,n({...r,band_conditions_schedule:C})},helper:"Night (default 22:00 MT)"})]}),d.jsx("p",{className:"text-xs text-slate-600",children:"All times are Mountain Time (America/Boise). DST handled automatically."})]})]}):d.jsx("div",{className:"flex items-center justify-center h-64",children:d.jsx("div",{className:"text-red-400",children:"Failed to load config"})})}function j2e({info:e}){const[t,r]=E.useState(!1);return d.jsxs("div",{className:"relative inline-block",children:[d.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&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>r(!1)}),d.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 E2e({label:e,value:t,onChange:r,helper:n,info:a,keyPlaceholder:i="Key",valuePlaceholder:o="Value"}){const[s,l]=E.useState(()=>Object.entries(t||{}));E.useEffect(()=>{const c={};for(const[h,f]of s)h.trim()&&(c[h.trim()]=f);JSON.stringify(c)!==JSON.stringify(t||{})&&l(Object.entries(t||{}))},[t]);const u=c=>{l(c),r(Object.fromEntries(c.filter(([h])=>h.trim())))};return d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(j2e,{info:a})]}),s.map(([c,h],f)=>d.jsxs("div",{className:"flex items-start gap-2",children:[d.jsx("input",{type:"text",value:c,onChange:v=>u(s.map((g,m)=>m===f?[v.target.value,g[1]]:g)),placeholder:i,className:"w-40 flex-shrink-0 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"}),d.jsx("input",{type:"text",value:h,onChange:v=>u(s.map((g,m)=>m===f?[g[0],v.target.value]:g)),placeholder:o,className:"flex-1 px-3 py-2 bg-[#0a0e17] border border-[#1e2a3a] rounded text-sm text-slate-200 focus:outline-none focus:border-accent placeholder-slate-600"}),d.jsx("button",{type:"button",onClick:()=>u(s.filter((v,g)=>g!==f)),className:"p-2 text-red-400 hover:text-red-300 hover:bg-red-500/10 rounded flex-shrink-0","aria-label":"Remove header",children:d.jsx(ui,{size:14})})]},f)),d.jsxs("button",{type:"button",onClick:()=>u([...s,["",""]]),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:[d.jsx(li,{size:16})," Add Header"]}),n&&d.jsx("p",{className:"text-xs text-slate-600",children:n})]})}const R2e=["CLIENT_BASE","ROUTER","ROUTER_LATE"],O2e=[{value:"mesh_dm",label:"Mesh DM (unicast to nodes)"},{value:"mesh_broadcast",label:"Mesh Broadcast (channel)"},{value:"email",label:"Email"},{value:"webhook",label:"Webhook"},{value:"none",label:"(None / log only)"}],z2e=[{key:"fire",label:"Fire",description:"Active wildfires (radius from fire perimeter).",Icon:Rm,showAcres:!0},{key:"weather",label:"Weather",description:"Severe weather warnings near a node.",Icon:kh},{key:"snow",label:"Snow (sub-gate of Weather)",description:"Snow-category weather events.",Icon:GV},{key:"flood",label:"Flood (sub-gate of Seismic)",description:"Stream/flood gauge events.",Icon:Oo},{key:"avalanche",label:"Avalanche",description:"Avalanche advisories near a node.",Icon:kf},{key:"seismic",label:"Seismic",description:"Earthquakes and seismic events near a node.",Icon:kf}];function Pd(){return{enabled:!1,buffer_mi:5,min_acres:0}}function nF(){return{enabled:!1,dry_run:!0,monitor_roles:["ROUTER","ROUTER_LATE","CLIENT_BASE"],default_buffer_mi:5,cooldown_minutes:360,fire:Pd(),weather:Pd(),snow:Pd(),flood:Pd(),avalanche:Pd(),seismic:Pd(),delivery_type:"mesh_dm",node_ids:[],broadcast_channel:null,webhook_url:"",webhook_headers:{}}}function B2e({label:e,value:t,onChange:r,options:n,info:a=""}){return d.jsxs("div",{className:"space-y-1",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:[e,a&&d.jsx(Yo,{info:a})]}),d.jsx("select",{value:t,onChange:i=>r(i.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(i=>d.jsx("option",{value:i.value,children:i.label},i.value))})]})}function F2e({meta:e,cfg:t,onChange:r}){const{Icon:n}=e;return d.jsxs("div",{className:`border border-[#1e2a3a] p-3 space-y-2 ${e.tabled?"opacity-50":""}`,children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-start gap-2 flex-1",children:[d.jsx(n,{size:15,className:"text-slate-400 mt-0.5 flex-shrink-0"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("span",{className:"text-sm text-slate-300",children:e.label}),d.jsx("p",{className:"text-xs text-slate-600",children:e.description}),e.tabled&&d.jsx("span",{className:"inline-block mt-1 px-2 py-0.5 text-[10px] uppercase tracking-wide rounded bg-slate-700 text-slate-300",children:"Tabled — needs snowfall + elevation pipeline"})]})]}),d.jsx("button",{type:"button",disabled:e.tabled,onClick:()=>{e.tabled||r({...t,enabled:!t.enabled})},className:`relative w-11 h-6 rounded-full transition-colors flex-shrink-0 ml-3 ${t.enabled?"bg-accent":"bg-[#1e2a3a]"} ${e.tabled?"cursor-not-allowed":""}`,children:d.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform ${t.enabled?"translate-x-5":""}`})})]}),t.enabled&&!e.tabled&&d.jsxs("div",{className:`grid gap-3 pt-2 border-t border-[#1e2a3a] ${e.showAcres?"grid-cols-2":"grid-cols-1"}`,children:[d.jsx(qf,{label:"Buffer (mi)",value:t.buffer_mi??0,onChange:a=>r({...t,buffer_mi:a}),min:0,step:.5}),e.showAcres&&d.jsx(qf,{label:"Min Acres",value:t.min_acres??0,onChange:a=>r({...t,min_acres:a}),min:0,step:1})]})]})}function V2e(){const[e,t]=E.useState(!1),[r,n]=E.useState(null),[a,i]=E.useState(!0),[o,s]=E.useState(!1),[l,u]=E.useState(null),[c,h]=E.useState(null),f=E.useCallback(async()=>{i(!0),u(null);try{const y=await Ao("danger_zones"),x=nF();n({...x,...y,fire:{...x.fire,...y.fire||{}},weather:{...x.weather,...y.weather||{}},snow:{...x.snow,...y.snow||{}},flood:{...x.flood,...y.flood||{}},avalanche:{...x.avalanche,...y.avalanche||{}},seismic:{...x.seismic,...y.seismic||{}},monitor_roles:y.monitor_roles??x.monitor_roles,node_ids:y.node_ids??x.node_ids,webhook_headers:y.webhook_headers??x.webhook_headers})}catch(y){u(y instanceof Error?y.message:"Failed to load danger zones config"),n(nF())}finally{i(!1)}},[]);E.useEffect(()=>{f()},[f]);const v=async()=>{if(r){s(!0),u(null),h(null);try{await ja("danger_zones",r),h("Danger Zones config saved"),setTimeout(()=>h(null),3e3)}catch(y){u(y instanceof Error?y.message:"Save failed")}finally{s(!1)}}},g=y=>n(x=>x&&{...x,...y}),m=y=>{if(!r)return;const x=r.monitor_roles||[];g({monitor_roles:x.includes(y)?x.filter(_=>_!==y):[...x,y]})};return d.jsxs("div",{className:"bg-bg-card border border-border",children:[d.jsxs("button",{type:"button",onClick:()=>t(y=>!y),className:"w-full flex items-center justify-between p-4 text-left",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(pi,{size:18,className:"text-amber-400"}),d.jsxs("div",{children:[d.jsx("div",{className:"text-sm font-medium text-slate-200",children:"Danger Zones"}),d.jsx("div",{className:"text-xs text-slate-500",children:"Alert when monitored infrastructure nodes are in/near a hazard"})]})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[r&&d.jsx("span",{className:`text-xs px-2 py-0.5 rounded ${r.enabled?r.dry_run?"bg-yellow-500/10 text-yellow-400":"bg-green-500/10 text-green-400":"bg-slate-800 text-slate-500"}`,children:r.enabled?r.dry_run?"Dry-run":"Live":"Disabled"}),e?d.jsx(Em,{size:18,className:"text-slate-500"}):d.jsx(Ah,{size:18,className:"text-slate-500"})]})]}),e&&d.jsxs("div",{className:"p-6 pt-0 space-y-6",children:[d.jsxs("div",{className:"flex items-start gap-2 p-3 bg-amber-500/10 border border-amber-500/20",children:[d.jsx(Nh,{size:16,className:"text-amber-400 mt-0.5 flex-shrink-0"}),d.jsxs("div",{className:"text-xs text-amber-200/90 leading-relaxed",children:["Ships disabled; when enabled, defaults to dry-run / log-only — no mesh traffic until you turn dry-run off. Requires ",d.jsx("span",{className:"font-medium",children:"Enable Notifications"})," (above) and environmental feeds to be on, since hazard events only flow when those are active."]})]}),l&&d.jsx("div",{className:"p-3 text-sm bg-red-500/10 text-red-400 border border-red-500/20",children:l}),c&&d.jsxs("div",{className:"p-3 text-sm bg-green-500/10 text-green-400 border border-green-500/20",children:[d.jsx(Yr,{size:14,className:"inline mr-2"}),c]}),a||!r?d.jsx("div",{className:"text-sm text-slate-500",children:"Loading danger zones config..."}):d.jsxs(d.Fragment,{children:[d.jsx(Ch,{label:"Enable Danger Zones",checked:r.enabled,onChange:y=>g({enabled:y}),helper:"Master switch for the infrastructure danger-zone correlator"}),d.jsx(Ch,{label:"Dry-run (log only)",checked:r.dry_run,onChange:y=>g({dry_run:y}),helper:"When on, matches are logged but nothing is sent to the mesh. Turn off only after verifying dry-run output."}),d.jsxs("div",{className:"space-y-2",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Monitored Roles",d.jsx(Yo,{info:"Which Meshtastic node roles to correlate against hazards. Only nodes that have a GPS position are scanned."})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:R2e.map(y=>{const x=(r.monitor_roles||[]).includes(y);return d.jsx("button",{type:"button",onClick:()=>m(y),className:`px-3 py-1.5 rounded text-sm transition-colors ${x?"bg-accent text-white":"bg-[#1e2a3a] text-slate-400 hover:text-slate-200"}`,children:y},y)})})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[d.jsx(qf,{label:"Default Buffer (mi)",value:r.default_buffer_mi,onChange:y=>g({default_buffer_mi:y}),min:0,step:.5,helper:"Buffer used when a family has none set"}),d.jsx(qf,{label:"Cooldown (min)",value:r.cooldown_minutes,onChange:y=>g({cooldown_minutes:y}),min:0,helper:"Min time between repeat alerts per node+family"})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("label",{className:"flex items-center text-xs text-slate-500 uppercase tracking-wide",children:["Hazard Families",d.jsx(Yo,{info:"Enable each hazard family to monitor, with its own buffer distance and severity threshold. Snow is a sub-gate of Weather; Flood a sub-gate of Seismic."})]}),z2e.map(y=>d.jsx(F2e,{meta:y,cfg:r[y.key],onChange:x=>g({[y.key]:x})},y.key))]}),d.jsxs("div",{className:"space-y-4 p-4 bg-[#0a0e17] border border-[#1e2a3a]",children:[d.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-slate-300",children:[d.jsx(FV,{size:14}),"DELIVERY"]}),d.jsx(B2e,{label:"Delivery Method",value:r.delivery_type||"mesh_dm",onChange:y=>g({delivery_type:y}),options:O2e,info:"Where danger-zone alerts get delivered. Mesh DM unicasts to specific nodes; broadcast sends to a channel. Has no effect while dry-run is on."}),r.delivery_type==="mesh_dm"&&d.jsx(DP,{label:"Recipient Nodes",value:r.node_ids||[],onChange:y=>g({node_ids:y}),helper:"Nodes that receive direct messages",valueType:"node_id_hex"}),r.delivery_type==="mesh_broadcast"&&d.jsx(jP,{label:"Broadcast Channel",value:r.broadcast_channel??0,onChange:y=>g({broadcast_channel:y}),helper:"Select the mesh radio channel",mode:"single"}),r.delivery_type==="webhook"&&d.jsxs(d.Fragment,{children:[d.jsx(RCe,{label:"Webhook URL",value:r.webhook_url||"",onChange:y=>g({webhook_url:y}),placeholder:"https://discord.com/api/webhooks/...",helper:"POST alert as JSON"}),d.jsx(E2e,{label:"Webhook Headers",value:r.webhook_headers||{},onChange:y=>g({webhook_headers:y}),helper:"Custom HTTP headers sent with the danger-zone webhook",keyPlaceholder:"Header",valuePlaceholder:"Value"})]}),r.delivery_type==="email"&&d.jsx("p",{className:"text-xs text-slate-600",children:"Email delivery uses the SMTP settings configured for notification rules."})]}),d.jsx("div",{className:"flex justify-end",children:d.jsxs("button",{type:"button",onClick:v,disabled:o,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:[d.jsx(_a,{size:16}),o?"Saving...":"Save Danger Zones"]})})]})]})]})}function G2e(){return E.useEffect(()=>{document.title="Danger Zones - MeshAI"},[]),d.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[d.jsx("p",{className:"text-sm text-slate-500",children:"Alert infrastructure nodes when they are within a configurable buffer distance of an active hazard."}),d.jsx(V2e,{})]})}function H2e(){return E.useEffect(()=>{document.title="Danger Zones - MeshAI"},[]),d.jsx("div",{className:"max-w-3xl mx-auto",children:d.jsx("div",{className:"bg-bg-card border border-border p-8",children:d.jsxs("div",{className:"flex items-start gap-4",children:[d.jsx("div",{className:"flex-shrink-0 w-12 h-12 rounded-lg bg-[#0a0e17] border border-[#1e2a3a] flex items-center justify-center",children:d.jsx(pi,{size:24,className:"text-accent"})}),d.jsxs("div",{className:"space-y-3",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("h2",{className:"text-xl font-semibold text-slate-100",children:"MeshCore Danger Zones"}),d.jsx("span",{className:"px-2 py-0.5 text-[10px] uppercase tracking-wide rounded bg-slate-700 text-slate-300",children:"Coming soon"})]}),d.jsx("p",{className:"text-sm text-slate-400 leading-relaxed max-w-prose",children:"MeshCore danger zone alerting will correlate infrastructure node positions with active hazards and deliver targeted DMs via the MeshCore companion. This becomes available once the MeshCore delivery pipeline supports infrastructure-targeted messaging."})]})]})})})}delete yw.Icon.Default.prototype._getIconUrl;yw.Icon.Default.mergeOptions({iconUrl:CZ,iconRetinaUrl:TZ,shadowUrl:MZ});const hx=e=>Math.round(e*1e6)/1e6,dx=["#f59e0b","#60a5fa","#34d399","#a78bfa","#f87171","#fb923c"],U2e=[{key:"fires",label:"NIFC Fire Perimeters"},{key:"nws",label:"NWS Weather Alerts"},{key:"wzdx",label:"WZDx Work Zones"},{key:"usgs_quake",label:"USGS Earthquakes"},{key:"firms",label:"NASA FIRMS Hotspots"},{key:"roads511",label:"511 Road Conditions"},{key:"usgs",label:"USGS Stream Gauges"},{key:"avalanche",label:"Avalanche Advisories"},{key:"traffic",label:"TomTom Traffic"},{key:"satpass",label:"Satellite Passes"},{key:"ducting",label:"Tropospheric Ducting"}];function W2e({bounds:e}){const t=PP(),r=E.useRef(!1);return E.useEffect(()=>{!r.current&&e&&(t.fitBounds(e,{padding:[40,40]}),r.current=!0)},[t,e]),null}function $2e({mode:e,firstCorner:t,onFirstClick:r,onSecondClick:n}){return USe({click(a){const i=[a.latlng.lat,a.latlng.lng];e==="awaiting-first"?r(i):e==="awaiting-second"&&n(i)}}),t?d.jsx(bZ,{center:t,radius:6,pathOptions:{color:"#f59e0b",fillColor:"#f59e0b",fillOpacity:1}}):null}function Z2e(){const[e,t]=E.useState(null),[r,n]=E.useState(""),[a,i]=E.useState(!0),[o,s]=E.useState(!1),[l,u]=E.useState(null),[c,h]=E.useState(null),{setDirty:f}=$i(),[v,g]=E.useState("idle"),[m,y]=E.useState(null);E.useEffect(()=>{document.title="Coverage — MeshAI",fetch("/api/config").then(D=>{if(!D.ok)throw new Error("Failed to fetch config");return D.json()}).then(D=>{const B=D.coverage??{bbox:[],enabled:!0,excluded_adapters:[],areas:[]};let H=Array.isArray(B.areas)?B.areas:[];if(H.length===0&&Array.isArray(B.bbox)&&B.bbox.length===4){const[U,F,W,$]=B.bbox;H=[{name:"Area 1",west:U,south:F,east:W,north:$}]}const V={bbox:Array.isArray(B.bbox)?B.bbox:[],enabled:B.enabled??!0,excluded_adapters:Array.isArray(B.excluded_adapters)?B.excluded_adapters:[],areas:H};t(V),n(JSON.stringify(V))}).catch(D=>u(D instanceof Error?D.message:String(D))).finally(()=>i(!1))},[]);const x=e!==null&&JSON.stringify(e)!==r;E.useEffect(()=>(f(x),()=>f(!1)),[x,f]);const _=(e==null?void 0:e.areas)??[],w=_.length>0?[[Math.min(..._.map(D=>D.south)),Math.min(..._.map(D=>D.west))],[Math.max(..._.map(D=>D.north)),Math.max(..._.map(D=>D.east))]]:null,S=[39.5,-98.35],C=E.useCallback(D=>{y(D),g("awaiting-second")},[]),M=E.useCallback(D=>{if(!m)return;const[B,H]=m,[V,U]=D;t(F=>{if(!F)return F;const W={name:`Area ${F.areas.length+1}`,west:hx(Math.min(H,U)),south:hx(Math.min(B,V)),east:hx(Math.max(H,U)),north:hx(Math.max(B,V))};return{...F,areas:[...F.areas,W]}}),y(null),g("idle")},[m]),A=(D,B,H)=>{t(V=>{if(!V)return V;const U=V.areas.map((F,W)=>{if(W!==D)return F;if(B==="name")return{...F,name:H};const $=parseFloat(H);return isNaN($)?F:{...F,[B]:$}});return{...V,areas:U}})},k=D=>{t(B=>B&&{...B,areas:B.areas.filter((H,V)=>V!==D)})},I=D=>{if(!e)return;const B=e.excluded_adapters??[];t({...e,excluded_adapters:B.includes(D)?B.filter(H=>H!==D):[...B,D]})},P=()=>{r&&(t(JSON.parse(r)),g("idle"),y(null))},j=async()=>{if(e){s(!0),u(null),h(null);try{const D=await fetch("/api/config/coverage",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({areas:e.areas,bbox:[],enabled:e.enabled,excluded_adapters:e.excluded_adapters})}),B=await D.json();if(!D.ok)throw new Error(B.detail||"Save failed");n(JSON.stringify(e)),h("Coverage saved"),setTimeout(()=>h(null),3e3),B.restart_required&&bu(Array.isArray(B.changed_keys)?B.changed_keys:[])}catch(D){u(D instanceof Error?D.message:"Save failed")}finally{s(!1)}}};if(a)return d.jsx("div",{className:"flex items-center justify-center h-64 text-[#777]",children:"Loading coverage config…"});if(!e)return d.jsx("div",{className:"flex items-center justify-center h-64 text-red-400",children:l||"No config"});const z=v==="awaiting-first"?"Click the first corner of the new area on the map…":v==="awaiting-second"?"Click the opposite corner to complete the area…":_.length>0?`${_.length} area${_.length!==1?"s":""} defined`:"No areas defined — draw one on the map or enter coordinates below.";return d.jsxs("div",{className:"space-y-6 max-w-4xl",children:[d.jsxs("div",{className:"flex items-start justify-between gap-4",children:[d.jsxs("p",{className:"text-sm text-[#777]",children:[`Define one or more bounding boxes that scope every native adapter's geographic focus (set-union of all areas). Adapters with "Use own config" on ignore these areas and use the geographic settings on the`," ",d.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"})," ","page."]}),x&&d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{onClick:P,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:j,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",o?"Saving…":"Save"]})]})]}),l&&d.jsx("div",{className:"text-sm text-red-400 bg-red-500/10 p-3",children:l}),c&&d.jsx("div",{className:"text-sm text-green-400 bg-green-500/10 p-3",children:c}),d.jsxs("div",{className:"border border-border p-4 flex items-center justify-between",children:[d.jsxs("div",{children:[d.jsx("span",{className:"text-sm font-medium text-[#e0e0e0]",children:"Use coverage areas to scope all adapters"}),d.jsx("p",{className:"text-xs text-[#666] mt-0.5",children:"When disabled, every adapter uses its own geographic config regardless of the areas below."})]}),d.jsx("button",{type:"button",onClick:()=>t({...e,enabled:!e.enabled}),className:`relative w-10 h-5 rounded-full transition-colors ${e.enabled?"bg-accent":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${e.enabled?"translate-x-5":""}`})})]}),d.jsxs("div",{className:"border border-border overflow-hidden",children:[d.jsxs("div",{className:"bg-bg-card border-b border-border px-4 py-2 flex items-center justify-between gap-4",children:[d.jsx("span",{className:"text-xs text-[#777] min-w-0 truncate font-mono",children:z}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[v!=="idle"&&d.jsx("button",{onClick:()=>{g("idle"),y(null)},className:"px-2 py-1 text-xs text-[#777] hover:text-white border border-border",children:"Cancel"}),d.jsxs("button",{onClick:()=>g("awaiting-first"),disabled:v!=="idle",className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[d.jsx(TJ,{size:12}),"Add area"]})]})]}),d.jsxs(wZ,{center:S,zoom:4,style:{width:"100%",height:"400px"},className:"z-0",children:[d.jsx(SZ,{url:"https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png",attribution:'© OpenStreetMap, © CARTO'}),d.jsx(W2e,{bounds:w}),_.map((D,B)=>{const H=dx[B%dx.length],V=[[D.south,D.west],[D.north,D.east]];return d.jsx(YSe,{bounds:V,pathOptions:{color:H,fillColor:H,fillOpacity:.08,weight:2}},B)}),d.jsx($2e,{mode:v,firstCorner:m,onFirstClick:C,onSecondClick:M})]})]}),d.jsxs("div",{className:"border border-border p-4 space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("div",{className:"text-xs font-sans font-medium uppercase tracking-widest text-[#666]",children:"Coverage Areas"}),d.jsxs("button",{onClick:()=>g("awaiting-first"),disabled:v!=="idle",className:"flex items-center gap-1 px-2 py-1 text-xs bg-accent/20 hover:bg-accent/30 text-accent border border-accent/30 disabled:opacity-40",children:[d.jsx(li,{size:12})," Add area"]})]}),_.length===0?d.jsx("p",{className:"text-xs text-[#555]",children:'No areas defined. Draw one on the map or click "Add area" to start.'}):d.jsx("div",{className:"space-y-3",children:_.map((D,B)=>{const H=dx[B%dx.length];return d.jsxs("div",{className:"border border-border p-3 space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"w-3 h-3 rounded-sm flex-shrink-0",style:{backgroundColor:H}}),d.jsx("input",{type:"text",value:D.name,onChange:V=>A(B,"name",V.target.value),className:"flex-1 bg-[#0d0d0d] border border-border px-2 py-1 text-sm font-medium text-[#e0e0e0]",placeholder:"Area name"}),d.jsx("button",{onClick:()=>k(B),title:"Delete area",className:"flex items-center gap-1 px-2 py-1 text-xs text-[#777] hover:text-red-400 border border-border",children:d.jsx(ui,{size:12})})]}),d.jsx("div",{className:"grid grid-cols-4 gap-2",children:["west","south","east","north"].map(V=>d.jsxs("div",{children:[d.jsx("label",{className:"text-xs text-[#777] mb-1 block capitalize",children:V}),d.jsx("input",{type:"number",step:"0.000001",value:D[V],onChange:U=>A(B,V,U.target.value),className:"w-full bg-[#0d0d0d] border border-border px-2 py-1.5 text-xs font-mono"})]},V))})]},B)})}),d.jsx("p",{className:"text-xs text-[#666]",children:"Decimal degrees. W/E = longitude; S/N = latitude. Each area is a bounding box; the coverage filter uses the set-union of all areas. Drawn coordinates are rounded to 6 decimal places."})]}),d.jsxs("div",{className:"border border-border p-4 space-y-4",children:[d.jsxs("div",{children:[d.jsx("div",{className:"text-xs font-sans font-medium uppercase tracking-widest text-[#666] mb-1",children:"Adapter Overrides"}),d.jsxs("p",{className:"text-xs text-[#777]",children:['Toggle "Use own config" to have that adapter ignore the coverage areas. Its geographic settings (state, bbox, corridors, observers…) then become active on the'," ",d.jsx("a",{href:"/environment",className:"text-accent hover:underline",children:"Data Feeds"})," ","page."]})]}),d.jsx("div",{className:"divide-y divide-border",children:U2e.map(({key:D,label:B})=>{var V;const H=((V=e.excluded_adapters)==null?void 0:V.includes(D))??!1;return d.jsxs("div",{className:"flex items-center justify-between py-2.5",children:[d.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[d.jsx("span",{className:"text-sm text-[#e0e0e0]",children:B}),H?d.jsx("span",{className:"text-[10px] text-accent/70 uppercase tracking-wide",children:"own config"}):d.jsx("span",{className:"text-[10px] text-[#555] uppercase tracking-wide",children:"coverage areas"})]}),d.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[H&&d.jsx("a",{href:"/environment",className:"text-xs text-accent hover:underline",children:"Configure"}),d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[d.jsx("span",{className:"text-xs text-[#666] whitespace-nowrap",children:"Use own config"}),d.jsx("button",{type:"button",onClick:()=>I(D),className:`relative w-8 h-4 rounded-full transition-colors ${H?"bg-accent":"bg-[#333]"}`,children:d.jsx("span",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform ${H?"translate-x-4":""}`})})]})]})]},D)})})]}),x&&d.jsxs("div",{className:"flex justify-end gap-2 pb-2",children:[d.jsxs("button",{onClick:P,className:"flex items-center gap-1 px-3 py-1.5 text-sm text-[#777] hover:text-white border border-border",children:[d.jsx(xa,{size:14})," Discard"]}),d.jsxs("button",{onClick:j,disabled:o,className:"flex items-center gap-1 px-3 py-1.5 text-sm bg-accent text-white disabled:opacity-50",children:[d.jsx(_a,{size:14})," ",o?"Saving…":"Save"]})]})]})}function Y2e(){return d.jsx(dJ,{children:d.jsx(aQ,{children:d.jsx(cQ,{children:d.jsxs(QK,{children:[d.jsx(nr,{path:"/",element:d.jsx(xQ,{})}),d.jsx(nr,{path:"/environment",element:d.jsx(e2e,{})}),d.jsx(nr,{path:"/config",element:d.jsx(PCe,{})}),d.jsx(nr,{path:"/alerts",element:d.jsx(qB,{})}),d.jsx(nr,{path:"/activity",element:d.jsx(qB,{})}),d.jsx(nr,{path:"/meshtastic/routing",element:d.jsx(VCe,{})}),d.jsx(nr,{path:"/notifications",element:d.jsx(Ej,{to:"/meshtastic/routing",replace:!0})}),d.jsx(nr,{path:"/reference",element:d.jsx(u2e,{})}),d.jsx(nr,{path:"/adapter-config",element:d.jsx(DZ,{})}),d.jsx(nr,{path:"/places",element:d.jsx(x2e,{})}),d.jsx(nr,{path:"/coverage",element:d.jsx(Z2e,{})}),d.jsx(nr,{path:"/data-sources",element:d.jsx(Ej,{to:"/environment",replace:!0})}),d.jsx(nr,{path:"/gauge-sites",element:d.jsx(RZ,{})}),d.jsx(nr,{path:"/town-anchors",element:d.jsx(OZ,{})}),d.jsx(nr,{path:"/mesh",element:d.jsx(AZ,{})}),d.jsx(nr,{path:"/meshtastic/connection",element:d.jsx(m2e,{})}),d.jsx(nr,{path:"/meshtastic/sources",element:d.jsx(BZ,{})}),d.jsx(nr,{path:"/meshtastic/scheduled",element:d.jsx(rF,{family:"meshtastic"})}),d.jsx(nr,{path:"/meshtastic/nodes",element:d.jsx(b2e,{})}),d.jsx(nr,{path:"/meshtastic/danger-zones",element:d.jsx(G2e,{})}),d.jsx(nr,{path:"/meshcore/connection",element:d.jsx(f2e,{})}),d.jsx(nr,{path:"/meshcore/routing",element:d.jsx(d2e,{})}),d.jsx(nr,{path:"/meshcore/scheduled",element:d.jsx(rF,{family:"meshcore"})}),d.jsx(nr,{path:"/meshcore/contacts",element:d.jsx(D2e,{})}),d.jsx(nr,{path:"/meshcore/companion",element:d.jsx(zZ,{})}),d.jsx(nr,{path:"/meshcore/danger-zones",element:d.jsx(H2e,{})})]})})})})}iT.createRoot(document.getElementById("root")).render(d.jsx(bf.StrictMode,{children:d.jsx(sJ,{children:d.jsx(Y2e,{})})})); diff --git a/work/meshai/dashboard/static/index.html b/work/meshai/dashboard/static/index.html index 6b9cc4d..60b9d5d 100644 --- a/work/meshai/dashboard/static/index.html +++ b/work/meshai/dashboard/static/index.html @@ -8,7 +8,7 @@ - + diff --git a/work/meshai/notifications/pipeline/dispatcher.py b/work/meshai/notifications/pipeline/dispatcher.py index 0d63adc..aafc5f6 100644 --- a/work/meshai/notifications/pipeline/dispatcher.py +++ b/work/meshai/notifications/pipeline/dispatcher.py @@ -1354,6 +1354,10 @@ class Dispatcher: "wzdx": "traffic_events", "traffic": "traffic_events", "511": "traffic_events", + # IPAWS civil alerts (env/ipaws.py, source="ipaws"). Own dedup table + # ipaws_alerts — so region-routed emergency sends land in the audit + # feed labeled "Emergency" instead of NULL/unlabeled. + "ipaws": "ipaws_alerts", } def _post_broadcast_commit(self, event, payload, rule, ch_type: str, diff --git a/work/tests/test_dispatcher_persistence.py b/work/tests/test_dispatcher_persistence.py index e78a431..f9fd26f 100644 --- a/work/tests/test_dispatcher_persistence.py +++ b/work/tests/test_dispatcher_persistence.py @@ -554,8 +554,50 @@ def test_source_to_table_fallback_stamps_audit_row(db_path): assert row["source_event_pk"] is None, "pk should be NULL for fallback path" +def test_source_to_table_fallback_stamps_ipaws_audit_row(db_path): + """Parity guard for the IPAWS civil-alert adapter: a native ipaws event + with no _broadcast_audit must stamp source_event_table='ipaws_alerts' so + emergency sends show labeled (not NULL/unlabeled) in the Activity Log. + """ + from unittest.mock import MagicMock + from meshai.notifications.events import make_event + from meshai.notifications.pipeline.dispatcher import Dispatcher + from meshai.persistence import get_db + + cfg = _build_config(cold_start_grace=0) + factory, _ = _mk_channel_factory() + d = Dispatcher(cfg, factory) + + ev = make_event( + source="ipaws", + category="emergency_evacuation", + severity="immediate", + region="US-ID", + title="🚨 Evacuation Immediate", + lat=43.6, lon=-116.2, + ) + + rule = MagicMock() + rule.broadcast_channel = 1 + rule.delivery_types = ["mesh_broadcast"] + + payload = MagicMock() + payload.message = "🚨 Evacuation Immediate — test" + + d._post_broadcast_commit(ev, payload, rule, "mesh_broadcast", success=True) + + conn = get_db() + row = conn.execute( + "SELECT source_event_table FROM mesh_broadcasts_out ORDER BY id DESC LIMIT 1" + ).fetchone() + assert row is not None, "No audit row was written" + assert row["source_event_table"] == "ipaws_alerts", ( + f"Expected 'ipaws_alerts', got {row['source_event_table']!r}" + ) + + def test_source_to_table_fallback_all_native_sources(db_path): - """Verify _SOURCE_TO_TABLE covers all five native adapter sources.""" + """Verify _SOURCE_TO_TABLE covers all native adapter sources.""" from meshai.notifications.pipeline.dispatcher import Dispatcher expected = { "nws": "nws_alerts", @@ -563,6 +605,7 @@ def test_source_to_table_fallback_all_native_sources(db_path): "wzdx": "traffic_events", "traffic": "traffic_events", "511": "traffic_events", + "ipaws": "ipaws_alerts", } cfg = _build_config() factory, _ = _mk_channel_factory()