diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..888f946dd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "monthly" + commit-message: + prefix: "[deps] " diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 505b277d3..604df8656 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,12 +6,10 @@ on: branches: - master - dev - - gsoc22-iperf pull_request: branches: - master - dev - - gsoc22-iperf jobs: build: @@ -23,28 +21,18 @@ jobs: image: redis ports: - 6379:6379 - influxdb: - image: influxdb:1.8.4-alpine - options: >- - --name "influxdb" - ports: - - 8086:8086 strategy: fail-fast: false matrix: python-version: - - 3.7 - - 3.8 - - 3.9 + - "3.8" + - "3.9" + - "3.10" django-version: - - django~=3.0.0 - - django~=3.1.0 - - django~=3.2.8 - include: - - django-version: django~=4.0.0 - python-version: 3.9 - experimental: true + - django~=3.2.0 + - django~=4.1.0 + - django~=4.2.0 steps: - name: Install system packages @@ -71,11 +59,14 @@ jobs: - name: Install python system packages run: | - pip install -U "pip==20.2.4" wheel setuptools + pip install -U pip wheel setuptools - name: Install npm dependencies run: sudo npm install -g install jshint stylelint + - name: Start InfluxDB container + run: docker-compose up -d influxdb + - name: Install test dependencies run: | pip install -r requirements-test.txt @@ -83,6 +74,7 @@ jobs: - name: Install openwisp-monitoring run: | pip install -U -I -e . + pip uninstall -y django pip install ${{ matrix.django-version }} - name: QA checks @@ -93,14 +85,16 @@ jobs: run: | SAMPLE_APP=1 coverage run --source=openwisp_monitoring runtests.py coverage run -a --source=openwisp_monitoring runtests.py + TIMESERIES_UDP=1 coverage run -a --source=openwisp_monitoring runtests.py + coverage xml - name: Upload Coverage - run: coveralls --service=github - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COVERALLS_FLAG_NAME: | - python-${{ matrix.python-version }}-${{ matrix.django-version }} - COVERALLS_PARALLEL: true + uses: coverallsapp/github-action@v2 + with: + parallel: true + format: cobertura + flag-name: python-${{ matrix.python-version }}-${{ matrix.django-version }} + github-token: ${{ secrets.GITHUB_TOKEN }} deploy: name: Deploy Docker Image @@ -112,21 +106,24 @@ jobs: steps: - uses: actions/checkout@master + # the following action is equivalent to + # echo "$DOCKER_HUB_SECRET" | docker login --username "$DOCKER_HUB_USERNAME" --password-stdin + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_SECRET }} + - name: Push to Docker run: | - echo "${{ secrets.DOCKER_TOKEN }}" | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin docker build . -t openwisp/openwisp-monitoring:develop docker push openwisp/openwisp-monitoring:develop coveralls: - name: Finish Coveralls needs: build runs-on: ubuntu-latest - container: python:3-slim steps: - - name: Finished - run: | - pip3 install --upgrade coveralls - coveralls --finish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Coveralls Finished + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true diff --git a/.jshintrc b/.jshintrc index d7027ed45..60d738294 100644 --- a/.jshintrc +++ b/.jshintrc @@ -13,7 +13,8 @@ "JSONEditor": true, "ReconnectingWebSocket": true, "createChart": true, - "triggerChartLoading": true + "triggerChartLoading": true, + "moment": true }, "browser": true } diff --git a/.stylelintrc.json b/.stylelintrc.json index afa192752..45ff7011e 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -8,14 +8,6 @@ "ignore": ["stylelint-commands", "after-comment"] } ], - "declaration-colon-space-after": "always", - "indentation": [ - 2, - { - "except": ["value"] - } - ], - "max-empty-lines": 4, "rule-empty-line-before": [ "never-multi-line", { diff --git a/CHANGES.rst b/CHANGES.rst index acfeb5149..e10123e13 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,42 @@ Version 1.1.0 [unreleased] WIP +Version 1.0.3 [2022-12-29] +-------------------------- + +Bugfixes +~~~~~~~~ + +- Fixed data collection for missing mobile signal: + Skip writing mobile signal metric if mobile signal + info is missing. +- Fixed device health status changing to ``problem`` + when the configuration status changes to ``modified``. + +Version 1.0.2 [2022-08-04] +-------------------------- + +Bugfixes +~~~~~~~~ + +- Fixed migrations which create checks for existing devices; + this problem was happening to OpenWISP instances which were + deployed without OpenWISP Monitoring and then enabled + the monitoring features + +Version 1.0.1 [2022-07-01] +-------------------------- + +Bugfixes +~~~~~~~~ + +- Removed hardcoded static URLs which created + issues when static files are served using an + external service (e.g. S3 storage buckets) +- Fixed `"migrate_timeseries" command stalling + when measurements exceeds retention policy + `_ + Version 1.0.0 [2022-05-05] -------------------------- diff --git a/Dockerfile b/Dockerfile index 44e0b890a..436180c3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7.5-slim-buster +FROM python:3.9.19-slim-bullseye RUN apt update && \ apt install --yes zlib1g-dev libjpeg-dev gdal-bin libproj-dev \ @@ -6,6 +6,8 @@ RUN apt update && \ sqlite3 libsqlite3-dev openssl libssl-dev fping && \ rm -rf /var/lib/apt/lists/* /root/.cache/pip/* /tmp/* +RUN pip install -U pip setuptools wheel + COPY requirements-test.txt requirements.txt /opt/openwisp/ RUN pip install -r /opt/openwisp/requirements.txt && \ pip install -r /opt/openwisp/requirements-test.txt && \ diff --git a/README.rst b/README.rst index 5c162920f..223c4b980 100644 --- a/README.rst +++ b/README.rst @@ -35,6 +35,8 @@ openwisp-monitoring ------------ +**Need a quick overview?** `Try the OpenWISP Demo `_. + OpenWISP Monitoring is a network monitoring system written in Python and Django, designed to be **extensible**, **programmable**, **scalable** and easy to use by end users: once the system is configured, monitoring checks, alerts and metric collection @@ -87,11 +89,13 @@ Available Features `RAM usage <#memory-usage>`_, `CPU load <#cpu-load>`_, `flash/disk usage <#disk-usage>`_, mobile signal (LTE/UMTS/GSM `signal strength <#mobile-signal-strength>`_, `signal quality <#mobile-signal-quality>`_, - `access technology in use <#mobile-access-technology-in-use>`_) + `access technology in use <#mobile-access-technology-in-use>`_), `bandwidth <#iperf3>`_, + `transferred data <#iperf3>`_, `restransmits <#iperf3>`_, `jitter <#iperf3>`_, + `datagram <#iperf3>`_, `datagram loss <#iperf3>`_ * Maintains a record of `WiFi sessions <#monitoring-wifi-sessions>`_ with clients' MAC address and vendor, session start and stop time and connected device along with other information -* Charts can be viewed at resolutions of 1 day, 3 days, a week, a month and a year +* Charts can be viewed at resolutions of the last 1 day, 3 days, 7 days, 30 days, and 365 days * Configurable alerts * CSV Export of monitoring data * An overview of the status of the network is shown in the admin dashboard, @@ -105,6 +109,8 @@ Available Features * Extensible metrics and charts: it's possible to define new metrics and new charts * API to retrieve the chart metrics and status information of each device based on `NetJSON DeviceMonitoring `_ +* `Iperf3 check <#iperf3-1>`_ that provides network performance measurements such as maximum + achievable bandwidth, jitter, datagram loss etc of the openwrt device using `iperf3 utility `_ ------------ @@ -251,7 +257,7 @@ Run tests with: .. code-block:: shell - ./runtests.py --parallel + ./runtests.py # using --parallel is not supported in this module Run quality assurance tests with: @@ -310,6 +316,7 @@ Follow the setup instructions of `openwisp-controller 'openwisp_notifications', # openwisp2 admin theme (must be loaded here) 'openwisp_utils.admin_theme', + 'admin_auto_filters', # admin 'django.contrib.admin', 'django.forms', @@ -326,6 +333,13 @@ Follow the setup instructions of `openwisp-controller 'NAME': 'openwisp2', 'HOST': 'localhost', 'PORT': '8086', + 'OPTIONS': { + # Specify additional options to be used while initializing + # database connection. + # Note: These options may differ based on the backend used. + 'udp_writes': True, + 'udp_port': 8089, + } } ``urls.py``: @@ -375,7 +389,15 @@ Configure celery (you may use a different broker if you want): CELERY_BEAT_SCHEDULE = { 'run_checks': { 'task': 'openwisp_monitoring.check.tasks.run_checks', + # Executes only ping & config check every 5 min 'schedule': timedelta(minutes=5), + 'args': ( + [ # Checks path + 'openwisp_monitoring.check.classes.Ping', + 'openwisp_monitoring.check.classes.ConfigApplied', + ], + ), + 'relative': True, }, # Delete old WifiSession 'delete_wifi_clients_and_sessions': { @@ -802,10 +824,63 @@ Mobile Access Technology in use .. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/access-technology.png :align: center +Iperf3 +~~~~~~ + ++--------------------+---------------------------------------------------------------------------------------------------------------------------+ +| **measurement**: | ``iperf3`` | ++--------------------+---------------------------------------------------------------------------------------------------------------------------+ +| **types**: | | ``int`` (iperf3_result, sent_bytes_tcp, received_bytes_tcp, retransmits, sent_bytes_udp, total_packets, lost_packets), | +| | | ``float`` (sent_bps_tcp, received_bps_tcp, sent_bps_udp, jitter, lost_percent) | ++--------------------+---------------------------------------------------------------------------------------------------------------------------+ +| **fields**: | | ``iperf3_result``, ``sent_bps_tcp``, ``received_bps_tcp``, ``sent_bytes_tcp``, ``received_bytes_tcp``, ``retransmits``, | +| | | ``sent_bps_udp``, ``sent_bytes_udp``, ``jitter``, ``total_packets``, ``lost_packets``, ``lost_percent`` | ++--------------------+---------------------------------------------------------------------------------------------------------------------------+ +| **configuration**: | ``iperf3`` | ++--------------------+---------------------------------------------------------------------------------------------------------------------------+ +| **charts**: | ``bandwidth``, ``transfer``, ``retransmits``, ``jitter``, ``datagram``, ``datagram_loss`` | ++--------------------+---------------------------------------------------------------------------------------------------------------------------+ + +**Bandwidth**: + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/bandwidth.png + :align: center + +**Transferred Data**: + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/transferred-data.png + :align: center + +**Retransmits**: + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/retransmits.png + :align: center + +**Jitter**: + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/jitter.png + :align: center + +**Datagram**: + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/datagram.png + :align: center + +**Datagram loss**: + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/datagram-loss.png + :align: center + +For more info on how to configure and use Iperf3, please refer to +`iperf3 check usage instructions <#iperf3-check-usage-instructions>`_. + +**Note:** Iperf3 charts uses ``connect_points=True`` in +`default chart configuration <#openwisp_monitoring_charts>`_ that joins it's individual chart data points. + Dashboard Monitoring Charts --------------------------- -.. figure:: https://raw.githubusercontent.com/openwisp/openwisp-controller/docs/docs/1.1/dashboard-charts.png +.. figure:: https://github.com/openwisp/openwisp-monitoring/blob/docs/docs/1.1/dashboard-charts.png :align: center OpenWISP Monitoring adds two timeseries charts to the admin dashboard: @@ -818,6 +893,36 @@ You can configure the interfaces included in the **General traffic chart** using the `"OPENWISP_MONITORING_DASHBOARD_TRAFFIC_CHART" <#openwisp_monitoring_dashboard_traffic_chart>`_ setting. +Adaptive size charts +-------------------- + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/adaptive-chart.png + :align: center + +When configuring charts, it is possible to flag their unit +as ``adaptive_prefix``, this allows to make the charts more readable because +the units are shown in either `K`, `M`, `G` and `T` depending on +the size of each point, the summary values and Y axis are also resized. + +Example taken from the default configuration of the traffic chart: + +.. code-block:: python + + 'traffic': { + # other configurations for this chart + + # traffic measured in 'B' (bytes) + # unit B, KB, MB, GB, TB + 'unit': 'adaptive_prefix+B', + }, + + 'bandwidth': { + # adaptive unit for bandwidth related charts + # bandwidth measured in 'bps'(bits/sec) + # unit bps, Kbps, Mbps, Gbps, Tbps + 'unit': 'adaptive_prefix+bps', + }, + Monitoring WiFi Sessions ------------------------ @@ -918,9 +1023,479 @@ configuration status of a device changes, this ensures the check reacts quickly to events happening in the network and informs the user promptly if there's anything that is not working as intended. +Iperf3 +~~~~~~ + +This check provides network performance measurements such as maximum achievable bandwidth, +jitter, datagram loss etc of the device using `iperf3 utility `_. + +This check is **disabled by default**. You can enable auto creation of this check by setting the +`OPENWISP_MONITORING_AUTO_IPERF3 <#OPENWISP_MONITORING_AUTO_IPERF3>`_ to ``True``. + +You can also `add the iperf3 check +<#add-checks-and-alert-settings-from-the-device-page>`_ directly from the device page. + +It also supports tuning of various parameters. + +You can also change the parameters used for iperf3 checks (e.g. timing, port, username, +password, rsa_publc_key etc) using the `OPENWISP_MONITORING_IPERF3_CHECK_CONFIG +<#OPENWISP_MONITORING_IPERF3_CHECK_CONFIG>`_ setting. + +**Note:** When setting `OPENWISP_MONITORING_AUTO_IPERF3 <#OPENWISP_MONITORING_AUTO_IPERF3>`_ to ``True``, +you may need to update the `metric configuration <#add-checks-and-alert-settings-from-the-device-page>`_ +to enable alerts for the iperf3 check. + +Iperf3 Check Usage Instructions +------------------------------- + +1. Make sure iperf3 is installed on the device +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Register your device to OpenWISP and make sure the `iperf3 openwrt package +`_ is installed on the device, +eg: + +.. code-block:: shell + + opkg install iperf3 # if using without authentication + opkg install iperf3-ssl # if using with authentication (read below for more info) + +2. Ensure SSH access from OpenWISP is enabled on your devices +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Follow the steps in `"How to configure push updates" section of the +OpenWISP documentation +`_ +to allow SSH access to you device from OpenWISP. + +**Note:** Make sure device connection is enabled +& working with right update strategy i.e. ``OpenWRT SSH``. + +.. image:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/enable-openwrt-ssh.png + :alt: Enable ssh access from openwisp to device + :align: center + +3. Set up and configure Iperf3 server settings +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +After having deployed your Iperf3 servers, you need to +configure the iperf3 settings on the django side of OpenWISP, +see the `test project settings for reference +`_. + +The host can be specified by hostname, IPv4 literal, or IPv6 literal. +Example: + +.. code-block:: python + + OPENWISP_MONITORING_IPERF3_CHECK_CONFIG = { + # 'org_pk' : {'host' : [], 'client_options' : {}} + 'a9734710-db30-46b0-a2fc-01f01046fe4f': { + # Some public iperf3 servers + # https://iperf.fr/iperf-servers.php#public-servers + 'host': ['iperf3.openwisp.io', '2001:db8::1', '192.168.5.2'], + 'client_options': { + 'port': 5209, + 'udp': {'bitrate': '30M'}, + 'tcp': {'bitrate': '0'}, + }, + }, + # another org + 'b9734710-db30-46b0-a2fc-01f01046fe4f': { + # available iperf3 servers + 'host': ['iperf3.openwisp2.io', '192.168.5.3'], + 'client_options': { + 'port': 5207, + 'udp': {'bitrate': '50M'}, + 'tcp': {'bitrate': '20M'}, + }, + }, + } + +**Note:** If an organization has more than one iperf3 server configured, then it enables +the iperf3 checks to run concurrently on different devices. If all of the available servers +are busy, then it will add the check back in the queue. + +The celery-beat configuration for the iperf3 check needs to be added too: + +.. code-block:: python + + from celery.schedules import crontab + + # Celery TIME_ZONE should be equal to django TIME_ZONE + # In order to schedule run_iperf3_checks on the correct time intervals + CELERY_TIMEZONE = TIME_ZONE + CELERY_BEAT_SCHEDULE = { + # Other celery beat configurations + # Celery beat configuration for iperf3 check + 'run_iperf3_checks': { + 'task': 'openwisp_monitoring.check.tasks.run_checks', + # https://docs.celeryq.dev/en/latest/userguide/periodic-tasks.html#crontab-schedules + # Executes check every 5 mins from 00:00 AM to 6:00 AM (night) + 'schedule': crontab(minute='*/5', hour='0-6'), + # Iperf3 check path + 'args': (['openwisp_monitoring.check.classes.Iperf3'],), + 'relative': True, + } + } + +Once the changes are saved, you will need to restart all the processes. + +**Note:** We recommended to configure this check to run in non peak +traffic times to not interfere with standard traffic. + +4. Run the check +~~~~~~~~~~~~~~~~ + +This should happen automatically if you have celery-beat correctly +configured and running in the background. +For testing purposes, you can run this check manually using the +`run_checks <#run_checks>`_ command. + +After that, you should see the iperf3 network measurements charts. + +.. image:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/iperf3-charts.png + :alt: Iperf3 network measurement charts + +Iperf3 check parameters +~~~~~~~~~~~~~~~~~~~~~~~ + +Currently, iperf3 check supports the following parameters: + ++-----------------------+----------+--------------------------------------------------------------------+ +| **Parameter** | **Type** | **Default Value** | ++-----------------------+----------+--------------------------------------------------------------------+ +|``host`` | ``list`` | ``[]`` | ++-----------------------+----------+--------------------------------------------------------------------+ +|``username`` | ``str`` | ``''`` | ++-----------------------+----------+--------------------------------------------------------------------+ +|``password`` | ``str`` | ``''`` | ++-----------------------+----------+--------------------------------------------------------------------+ +|``rsa_public_key`` | ``str`` | ``''`` | ++-----------------------+----------+--------------------------------------------------------------------+ +|``client_options`` | +---------------------+----------+------------------------------------------+ | +| | | **Parameters** | **Type** | **Default Value** | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``port`` | ``int`` | ``5201`` | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``time`` | ``int`` | ``10`` | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``bytes`` | ``str`` | ``''`` | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``blockcount`` | ``str`` | ``''`` | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``window`` | ``str`` | ``0`` | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``parallel`` | ``int`` | ``1`` | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``reverse`` | ``bool`` | ``False`` | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``bidirectional`` | ``bool`` | ``False`` | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``connect_timeout`` | ``int`` | ``1000`` | | +| | +---------------------+----------+------------------------------------------+ | +| | | ``tcp`` | +----------------+----------+---------------------+ | | +| | | | | **Parameters** | **Type** | **Default Value** | | | +| | | | +----------------+----------+---------------------+ | | +| | | | |``bitrate`` | ``str`` | ``0`` | | | +| | | | +----------------+----------+---------------------+ | | +| | | | |``length`` | ``str`` | ``128K`` | | | +| | | | +----------------+----------+---------------------+ | | +| | +---------------------+-----------------------------------------------------+ | +| | | ``udp`` | +----------------+----------+---------------------+ | | +| | | | | **Parameters** | **Type** | **Default Value** | | | +| | | | +----------------+----------+---------------------+ | | +| | | | |``bitrate`` | ``str`` | ``30M`` | | | +| | | | +----------------+----------+---------------------+ | | +| | | | |``length`` | ``str`` | ``0`` | | | +| | | | +----------------+----------+---------------------+ | | +| | +---------------------+-----------------------------------------------------+ | ++-----------------------+-------------------------------------------------------------------------------+ + +To learn how to use these parameters, please see the +`iperf3 check configuration example <#OPENWISP_MONITORING_IPERF3_CHECK_CONFIG>`_. + +Visit the `official documentation `_ +to learn more about the iperf3 parameters. + +Iperf3 authentication +~~~~~~~~~~~~~~~~~~~~~ + +By default iperf3 check runs without any kind of **authentication**, +in this section we will explain how to configure **RSA authentication** +between the **client** and the **server** to restrict connections +to authenticated clients. + +Server side +########### + +1. Generate RSA keypair +^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: shell + + openssl genrsa -des3 -out private.pem 2048 + openssl rsa -in private.pem -outform PEM -pubout -out public_key.pem + openssl rsa -in private.pem -out private_key.pem -outform PEM + +After running the commands mentioned above, the public key will be stored in +``public_key.pem`` which will be used in **rsa_public_key** parameter +in `OPENWISP_MONITORING_IPERF3_CHECK_CONFIG +<#OPENWISP_MONITORING_IPERF3_CHECK_CONFIG>`_ +and the private key will be contained in the file ``private_key.pem`` +which will be used with **--rsa-private-key-path** command option when +starting the iperf3 server. + +2. Create user credentials +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: shell + + USER=iperfuser PASSWD=iperfpass + echo -n "{$USER}$PASSWD" | sha256sum | awk '{ print $1 }' + ---- + ee17a7f98cc87a6424fb52682396b2b6c058e9ab70e946188faa0714905771d7 #This is the hash of "iperfuser" + +Add the above hash with username in ``credentials.csv`` + +.. code-block:: shell + + # file format: username,sha256 + iperfuser,ee17a7f98cc87a6424fb52682396b2b6c058e9ab70e946188faa0714905771d7 + +3. Now start the iperf3 server with auth options +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: shell + + iperf3 -s --rsa-private-key-path ./private_key.pem --authorized-users-path ./credentials.csv + +Client side (OpenWrt device) +############################ + +1. Install iperf3-ssl +^^^^^^^^^^^^^^^^^^^^^ + +Install the `iperf3-ssl openwrt package +`_ +instead of the normal +`iperf3 openwrt package `_ +because the latter comes without support for authentication. + +You may also check your installed **iperf3 openwrt package** features: + +.. code-block:: shell + + root@vm-openwrt:~ iperf3 -v + iperf 3.7 (cJSON 1.5.2) + Linux vm-openwrt 4.14.171 #0 SMP Thu Feb 27 21:05:12 2020 x86_64 + Optional features available: CPU affinity setting, IPv6 flow label, TCP congestion algorithm setting, + sendfile / zerocopy, socket pacing, authentication # contains 'authentication' + +2. Configure iperf3 check auth parameters +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Now, add the following iperf3 authentication parameters +to `OPENWISP_MONITORING_IPERF3_CHECK_CONFIG +<#OPENWISP_MONITORING_IPERF3_CHECK_CONFIG>`_ +in the settings: + +.. code-block:: python + + OPENWISP_MONITORING_IPERF3_CHECK_CONFIG = { + 'a9734710-db30-46b0-a2fc-01f01046fe4f': { + 'host': ['iperf1.openwisp.io', 'iperf2.openwisp.io', '192.168.5.2'], + # All three parameters (username, password, rsa_publc_key) + # are required for iperf3 authentication + 'username': 'iperfuser', + 'password': 'iperfpass', + # Add RSA public key without any headers + # ie. -----BEGIN PUBLIC KEY-----, -----BEGIN END KEY----- + 'rsa_public_key': ( + """ + MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwuEm+iYrfSWJOupy6X3N + dxZvUCxvmoL3uoGAs0O0Y32unUQrwcTIxudy38JSuCccD+k2Rf8S4WuZSiTxaoea + 6Du99YQGVZeY67uJ21SWFqWU+w6ONUj3TrNNWoICN7BXGLE2BbSBz9YaXefE3aqw + GhEjQz364Itwm425vHn2MntSp0weWb4hUCjQUyyooRXPrFUGBOuY+VvAvMyAG4Uk + msapnWnBSxXt7Tbb++A5XbOMdM2mwNYDEtkD5ksC/x3EVBrI9FvENsH9+u/8J9Mf + 2oPl4MnlCMY86MQypkeUn7eVWfDnseNky7TyC0/IgCXve/iaydCCFdkjyo1MTAA4 + BQIDAQAB + """ + ), + 'client_options': { + 'port': 5209, + 'udp': {'bitrate': '20M'}, + 'tcp': {'bitrate': '0'}, + }, + } + } + +Adding Checks and Alert settings from the device page +----------------------------------------------------- + +We can add checks and define alert settings directly from the **device page**. + +To add a check, you just need to select an available **check type** as shown below: + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/device-inline-check.png + :align: center + +The following example shows how to use the +`OPENWISP_MONITORING_METRICS setting <#openwisp_monitoring_metrics>`_ +to reconfigure the system for `iperf3 check <#iperf3-1>`_ to send an alert if +the measured **TCP bandwidth** has been less than **10 Mbit/s** for more than **2 days**. + +1. By default, `Iperf3 checks <#iperf3-1>`_ come with default alert settings, +but it is easy to customize alert settings through the device page as shown below: + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/device-inline-alertsettings.png + :align: center + +2. Now, add the following notification configuration to send an alert for **TCP bandwidth**: + +.. code-block:: python + + # Main project settings.py + from django.utils.translation import gettext_lazy as _ + + OPENWISP_MONITORING_METRICS = { + 'iperf3': { + 'notification': { + 'problem': { + 'verbose_name': 'Iperf3 PROBLEM', + 'verb': _('Iperf3 bandwidth is less than normal value'), + 'level': 'warning', + 'email_subject': _( + '[{site.name}] PROBLEM: {notification.target} {notification.verb}' + ), + 'message': _( + 'The device [{notification.target}]({notification.target_link}) ' + '{notification.verb}.' + ), + }, + 'recovery': { + 'verbose_name': 'Iperf3 RECOVERY', + 'verb': _('Iperf3 bandwidth now back to normal'), + 'level': 'info', + 'email_subject': _( + '[{site.name}] RECOVERY: {notification.target} {notification.verb}' + ), + 'message': _( + 'The device [{notification.target}]({notification.target_link}) ' + '{notification.verb}.' + ), + }, + }, + }, + } + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/alert_field_warn.png + :align: center + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/alert_field_info.png + :align: center + +**Note:** To access the features described above, the user must have permissions for ``Check`` and ``AlertSetting`` inlines, +these permissions are included by default in the "Administrator" and "Operator" groups and are shown in the screenshot below. + +.. figure:: https://github.com/openwisp/openwisp-monitoring/raw/docs/docs/1.1/inline-permissions.png + :align: center + Settings -------- +``TIMESERIES_DATABASE`` +~~~~~~~~~~~~~~~~~~~~~~~ + ++--------------+-----------+ +| **type**: | ``str`` | ++--------------+-----------+ +| **default**: | see below | ++--------------+-----------+ + +.. code-block:: python + + TIMESERIES_DATABASE = { + 'BACKEND': 'openwisp_monitoring.db.backends.influxdb', + 'USER': 'openwisp', + 'PASSWORD': 'openwisp', + 'NAME': 'openwisp2', + 'HOST': 'localhost', + 'PORT': '8086', + 'OPTIONS': { + 'udp_writes': False, + 'udp_port': 8089, + } + } + +The following table describes all keys available in ``TIMESERIES_DATABASE`` +setting: + ++---------------+--------------------------------------------------------------------------------------+ +| **Key** | ``Description`` | ++---------------+--------------------------------------------------------------------------------------+ +| ``BACKEND`` | The timeseries database backend to use. You can select one of the backends | +| | located in ``openwisp_monitoring.db.backends`` | ++---------------+--------------------------------------------------------------------------------------+ +| ``USER`` | User for logging into the timeseries database | ++---------------+--------------------------------------------------------------------------------------+ +| ``PASSWORD`` | Password of the timeseries database user | ++---------------+--------------------------------------------------------------------------------------+ +| ``NAME`` | Name of the timeseries database | ++---------------+--------------------------------------------------------------------------------------+ +| ``HOST`` | IP address/hostname of machine where the timeseries database is running | ++---------------+--------------------------------------------------------------------------------------+ +| ``PORT`` | Port for connecting to the timeseries database | ++---------------+--------------------------------------------------------------------------------------+ +| ``OPTIONS`` | These settings depends on the timeseries backend: | +| | | +| | +-----------------+----------------------------------------------------------------+ | +| | | ``udp_writes`` | Whether to use UDP for writing data to the timeseries database | | +| | +-----------------+----------------------------------------------------------------+ | +| | | ``udp_port`` | Timeseries database port for writing data using UDP | | +| | +-----------------+----------------------------------------------------------------+ | ++---------------+--------------------------------------------------------------------------------------+ + +**Note:** UDP packets can have a maximum size of 64KB. When using UDP for writing timeseries +data, if the size of the data exceeds 64KB, TCP mode will be used instead. + +**Note:** If you want to use the ``openwisp_monitoring.db.backends.influxdb`` backend +with UDP writes enabled, then you need to enable two different ports for UDP +(each for different retention policy) in your InfluxDB configuration. The UDP configuration +section of your InfluxDB should look similar to the following: + +.. code-block:: text + + # For writing data with the "default" retention policy + [[udp]] + enabled = true + bind-address = "127.0.0.1:8089" + database = "openwisp2" + + # For writing data with the "short" retention policy + [[udp]] + enabled = true + bind-address = "127.0.0.1:8090" + database = "openwisp2" + retention-policy = 'short' + +If you are using `ansible-openwisp2 `_ +for deploying OpenWISP, you can set the ``influxdb_udp_mode`` ansible variable to ``true`` +in your playbook, this will make the ansible role automatically configure the InfluxDB UDP listeners. +You can refer to the `ansible-ow-influxdb's `_ +(a dependency of ansible-openwisp2) documentation to learn more. + +``OPENWISP_MONITORING_DEFAULT_RETENTION_POLICY`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ++--------------+--------------------------+ +| **type**: | ``str`` | ++--------------+--------------------------+ +| **default**: | ``26280h0m0s`` (3 years) | ++--------------+--------------------------+ + +The default retention policy that applies to the timeseries data. + ``OPENWISP_MONITORING_SHORT_RETENTION_POLICY`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1001,6 +1576,103 @@ validating custom parameters of a ``Check`` object. This setting allows you to choose whether `config_applied <#configuration-applied>`_ checks should be created automatically for newly registered devices. It's enabled by default. +``OPENWISP_MONITORING_CONFIG_CHECK_INTERVAL`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ++--------------+-------------+ +| **type**: | ``int`` | ++--------------+-------------+ +| **default**: | ``5`` | ++--------------+-------------+ + +This setting allows you to configure the config check interval used by +`config_applied <#configuration-applied>`_. By default it is set to 5 minutes. + +``OPENWISP_MONITORING_AUTO_IPERF3`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ++--------------+-------------+ +| **type**: | ``bool`` | ++--------------+-------------+ +| **default**: | ``False`` | ++--------------+-------------+ + +This setting allows you to choose whether `iperf3 <#iperf3-1>`_ checks should be +created automatically for newly registered devices. It's disabled by default. + +``OPENWISP_MONITORING_IPERF3_CHECK_CONFIG`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ++--------------+-------------+ +| **type**: | ``dict`` | ++--------------+-------------+ +| **default**: | ``{}`` | ++--------------+-------------+ + +This setting allows to override the default iperf3 check configuration defined in +``openwisp_monitoring.check.classes.iperf3.DEFAULT_IPERF3_CHECK_CONFIG``. + +For example, you can change the values of `supported iperf3 check parameters <#iperf3-check-parameters>`_. + +.. code-block:: python + + OPENWISP_MONITORING_IPERF3_CHECK_CONFIG = { + # 'org_pk' : {'host' : [], 'client_options' : {}} + 'a9734710-db30-46b0-a2fc-01f01046fe4f': { + # Some public iperf3 servers + # https://iperf.fr/iperf-servers.php#public-servers + 'host': ['iperf3.openwisp.io', '2001:db8::1', '192.168.5.2'], + 'client_options': { + 'port': 6209, + # Number of parallel client streams to run + # note that iperf3 is single threaded + # so if you are CPU bound this will not + # yield higher throughput + 'parallel': 5, + # Set the connect_timeout (in milliseconds) for establishing + # the initial control connection to the server, the lower the value + # the faster the down iperf3 server will be detected (ex. 1000 ms (1 sec)) + 'connect_timeout': 1000, + # Window size / socket buffer size + 'window': '300K', + # Only one reverse condition can be chosen, + # reverse or bidirectional + 'reverse': True, + # Only one test end condition can be chosen, + # time, bytes or blockcount + 'blockcount': '1K', + 'udp': {'bitrate': '50M', 'length': '1460K'}, + 'tcp': {'bitrate': '20M', 'length': '256K'}, + }, + } + } + +``OPENWISP_MONITORING_IPERF3_CHECK_DELETE_RSA_KEY`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ++--------------+-------------------------------+ +| **type**: | ``bool`` | ++--------------+-------------------------------+ +| **default**: | ``True`` | ++--------------+-------------------------------+ + +This setting allows you to set whether +`iperf3 check RSA public key <#configure-iperf3-check-for-authentication>`_ +will be deleted after successful completion of the check or not. + +``OPENWISP_MONITORING_IPERF3_CHECK_LOCK_EXPIRE`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ++--------------+-------------------------------+ +| **type**: | ``int`` | ++--------------+-------------------------------+ +| **default**: | ``600`` | ++--------------+-------------------------------+ + +This setting allows you to set a cache lock expiration time for the iperf3 check when +running on multiple servers. Make sure it is always greater than the total iperf3 check +time, i.e. greater than the TCP + UDP test time. By default, it is set to **600 seconds (10 mins)**. + ``OPENWISP_MONITORING_AUTO_CHARTS`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1078,6 +1750,12 @@ If the devices are connecting to your OpenWISP instance using a shared layer2 network, hence the OpenWSP server can reach the devices using the ``last_ip`` field, you can set this to ``False``. +**Note:** If this setting is not configured, it will fallback to the value of +`OPENWISP_CONTROLLER_MANAGEMENT_IP_ONLY setting +`_. +If ``OPENWISP_CONTROLLER_MANAGEMENT_IP_ONLY`` also not configured, +then it will fallback to ``True``. + ``OPENWISP_MONITORING_DEVICE_RECOVERY_DETECTION`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1146,6 +1824,10 @@ For more information regarding these settings, consult the `celery documentation regarding automatic retries for known errors `_. +**Note:** The retry mechanism does not work when using ``UDP`` for writing +data to the timeseries database. It is due to the nature of ``UDP`` protocol +which does not acknowledge receipt of data packets. + ``OPENWISP_MONITORING_TIMESERIES_RETRY_OPTIONS`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1358,26 +2040,16 @@ This setting allows to define additional charts or to override the default chart configuration defined in ``openwisp_monitoring.monitoring.configuration.DEFAULT_CHARTS``. -For example, if you want to change the traffic chart to show -MB (megabytes) instead of GB (Gigabytes) you can use: +In the following example, we modify the description of the traffic chart: .. code-block:: python OPENWISP_MONITORING_CHARTS = { 'traffic': { - 'unit': ' MB', 'description': ( 'Network traffic, download and upload, measured on ' - 'the interface "{metric.key}", measured in MB.' + 'the interface "{metric.key}", custom message here.' ), - 'query': { - 'influxdb': ( - "SELECT SUM(tx_bytes) / 1000000 AS upload, " - "SUM(rx_bytes) / 1000000 AS download FROM {key} " - "WHERE time >= '{time}' AND content_type = '{content_type}' " - "AND object_id = '{object_id}' GROUP BY time(1d)" - ) - }, } } @@ -1412,10 +2084,23 @@ In case you just want to change the colors used in a chart here's how to do it: OPENWISP_MONITORING_CHARTS = { 'traffic': { - 'colors': ['#000000', '#cccccc'] + 'colors': ['#000000', '#cccccc', '#111111'] } } +``OPENWISP_MONITORING_DEFAULT_CHART_TIME`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ++---------------------+---------------------------------------------+ +| **type**: | ``str`` | ++---------------------+---------------------------------------------+ +| **default**: | ``7d`` | ++---------------------+---------------------------------------------+ +| **possible values** | ``1d``, ``3d``, ``7d``, ``30d`` or ``365d`` | ++---------------------+---------------------------------------------+ + +Allows to set the default time period of the time series charts. + ``OPENWISP_MONITORING_AUTO_CLEAR_MANAGEMENT_IP`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1455,6 +2140,17 @@ domain, you can use this option to change the base of the url, this will enable you to point all the API urls to your openwisp-monitoring API server's domain, example: ``https://mymonitoring.myapp.com``. +``OPENWISP_MONITORING_CACHE_TIMEOUT`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ++--------------+----------------------------------+ +| **type**: | ``int`` | ++--------------+----------------------------------+ +| **default**: | ``86400`` (24 hours in seconds) | ++--------------+----------------------------------+ + +This setting allows to configure timeout (in seconds) for monitoring data cache. + Registering / Unregistering Metric Configuration ------------------------------------------------ @@ -1592,6 +2288,10 @@ The ``AlertSettings`` of ``ping`` metric will by default use ``threshold`` and ` defined in the ``alert_settings`` key. You can always override them and define your own custom values via the *admin*. +You can also use the ``alert_field`` key in metric configuration +which allows ``AlertSettings`` to check the ``threshold`` on +``alert_field`` instead of the default ``field_name`` key. + **Note**: It will raise ``ImproperlyConfigured`` exception if a metric configuration is already registered with same name (not to be confused with verbose_name). @@ -1771,46 +2471,231 @@ Retrieve general monitoring charts GET /api/v1/monitoring/dashboard/ This API endpoint is used to show dashboard monitoring charts. It supports -multi-tenancy and allows filtering monitoring data with ``organization_slug``, +multi-tenancy and allows filtering monitoring data by ``organization_slug``, ``location_id`` and ``floorplan_id`` e.g.: .. code-block:: text GET /api/v1/monitoring/dashboard/?organization_slug=,&location_id=,&floorplan_id=, +- When retrieving chart data, the ``time`` parameter allows to specify + the time frame, eg: + + - ``1d``: returns data of the last day + - ``3d``: returns data of the last 3 days + - ``7d``: returns data of the last 7 days + - ``30d``: returns data of the last 30 days + - ``365d``: returns data of the last 365 days + +- In alternative to ``time`` it is possible to request chart data for a custom + date range by using the ``start`` and ``end`` parameters, eg: + +.. code-block:: text + + GET /api/v1/monitoring/dashboard/?start={start_datetime}&end={end_datetime} + +**Note**: ``start`` and ``end`` parameters should be in the format +``YYYY-MM-DD H:M:S``, otherwise 400 Bad Response will be returned. + Retrieve device charts and device status data ############################################# .. code-block:: text - GET /api/v1/monitoring/device/{pk}/?key={key}&status=true + GET /api/v1/monitoring/device/{pk}/?key={key}&status=true&time={timeframe} + +The format used for Device Status is inspired by +`NetJSON DeviceMonitoring `_. -The format used for Device Status is inspired by `NetJSON DeviceMonitoring `_. +**Notes**: -**Note**: If the request is made without ``?status=true`` then only device charts -data would be returned. +- If the request is made without ``?status=true`` the response will + contain only charts data and will not include any device status information + (current load average, ARP table, DCHP leases, etc.). + +- When retrieving chart data, the ``time`` parameter allows to specify + the time frame, eg: + + - ``1d``: returns data of the last day + - ``3d``: returns data of the last 3 days + - ``7d``: returns data of the last 7 days + - ``30d``: returns data of the last 30 days + - ``365d``: returns data of the last 365 days + +- In alternative to ``time`` it is possible to request chart data for a custom + date range by using the ``start`` and ``end`` parameters, eg: + +- The response contains device information, monitoring status (health status), + a list of metrics with their respective statuses, chart data and + device status information (only if ``?status=true``). + +- This endpoint can be accessed with session authentication, token authentication, + or alternatively with the device key passed as query string parameter + as shown below (`?key={key}`); + note: this method is meant to be used by the devices. + +.. code-block:: text + + GET /api/v1/monitoring/device/{pk}/?key={key}&status=true&start={start_datetime}&end={end_datetime} + +**Note**: ``start`` and ``end`` parameters must be in the format +``YYYY-MM-DD H:M:S``, otherwise 400 Bad Response will be returned. + +List device monitoring information +################################## + +.. code-block:: text + + GET /api/v1/monitoring/device/ + +**Notes**: + +- The response contains device information and monitoring status (health status), + but it does not include the information and + health status of the specific metrics, this information + can be retrieved in the detail endpoint of each device. + +- This endpoint can be accessed with session authentication and token authentication. + +**Available filters** + +Data can be filtered by health status (e.g. critical, ok, problem, and unknown) +to obtain the list of devices in the corresponding status, for example, +to retrieve the list of devices which are in critical conditions +(eg: unreachable), the following will work: + +.. code-block:: text + + GET /api/v1/monitoring/device/?monitoring__status=critical + +To filter a list of device monitoring data based +on their organization, you can use the ``organization_id``. + +.. code-block:: text + + GET /api/v1/monitoring/device/?organization={organization_id} + +To filter a list of device monitoring data based +on their organization slug, you can use the ``organization_slug``. + +.. code-block:: text + + GET /api/v1/monitoring/device/?organization_slug={organization_slug} Collect device metrics and status ################################# .. code-block:: text - POST /api/v1/monitoring/device/{pk}/?key={key}&time={time} + POST /api/v1/monitoring/device/{pk}/?key={key}&time={datetime} If data is latest then an additional parameter current can also be passed. For e.g.: .. code-block:: text - POST /api/v1/monitoring/device/{pk}/?key={key}&time={time}¤t=true + POST /api/v1/monitoring/device/{pk}/?key={key}&time={datetime}¤t=true + +The format used for Device Status is inspired by +`NetJSON DeviceMonitoring `_. + +**Note**: the device data will be saved in the timeseries database using +the date time specified ``time``, this should be in the format +``%d-%m-%Y_%H:%M:%S.%f``, otherwise 400 Bad Response will be returned. + +If the request is made without passing the ``time`` argument, +the server local time will be used. + +The ``time`` parameter was added to support `resilient collection +and sending of data by the OpenWISP Monitoring Agent +`_, +this feature allows sending data collected while the device is offline. + +List nearby devices +################### + +.. code-block:: text + + GET /api/v1/monitoring/device/{pk}/nearby-devices/ + +Returns list of nearby devices along with respective distance (in metres) and +monitoring status. + +**Available filters** + +The list of nearby devices provides the following filters: + +- ``organization`` (Organization ID of the device) +- ``organization__slug`` (Organization slug of the device) +- ``monitoring__status`` (Monitoring status (``unknown``, ``ok``, ``problem``, or ``critical``)) +- ``model`` (Pipe `|` separated list of device models) +- ``distance__lte`` (Distance in metres) + +Here's a few examples: + +.. code-block:: text + + GET /api/v1/monitoring/device/{pk}/nearby-devices/?organization={organization_id} + GET /api/v1/monitoring/device/{pk}/nearby-devices/?organization__slug={organization_slug} + GET /api/v1/monitoring/device/{pk}/nearby-devices/?monitoring__status={monitoring_status} + GET /api/v1/monitoring/device/{pk}/nearby-devices/?model={model1,model2} + GET /api/v1/monitoring/device/{pk}/nearby-devices/?distance__lte={distance} + +List wifi session +################# + +.. code-block:: text + + GET /api/v1/monitoring/wifi-session/ -The format used for Device Status is inspired by `NetJSON DeviceMonitoring `_. +**Available filters** -**Note**: Device data will be saved with in timeseries database with the specified ``time``, -this should be in the format ``%d-%m-%Y_%H:%M:%S.%f``, otherwise 400 Bad Response will be returned. +The list of wifi session provides the following filters: -If the request is made without passing the ``time`` argument, the server local time will be used. +- ``device__organization`` (Organization ID of the device) +- ``device`` (Device ID) +- ``device__group`` (Device group ID) +- ``start_time`` (Start time of the wifi session) +- ``stop_time`` (Stop time of the wifi session) + +Here's a few examples: + +.. code-block:: text + + GET /api/v1/monitoring/wifi-session/?device__organization={organization_id} + GET /api/v1/monitoring/wifi-session/?device={device_id} + GET /api/v1/monitoring/wifi-session/?device__group={group_id} + GET /api/v1/monitoring/wifi-session/?start_time={stop_time} + GET /api/v1/monitoring/wifi-session/?stop_time={stop_time} + +**Note:** Both `start_time` and `stop_time` support +greater than or equal to, as well as less than or equal to, filter lookups. + +For example: + +.. code-block:: text + + GET /api/v1/monitoring/wifi-session/?start_time__gt={start_time} + GET /api/v1/monitoring/wifi-session/?start_time__gte={start_time} + GET /api/v1/monitoring/wifi-session/?stop_time__lt={stop_time} + GET /api/v1/monitoring/wifi-session/?stop_time__lte={stop_time} + +Get wifi session +################ + +.. code-block:: text + + GET /api/v1/monitoring/wifi-session/{id}/ + +Pagination +########## + +Wifi session endpoint support the ``page_size`` parameter +that allows paginating the results in conjunction with the page parameter. + +.. code-block:: text -The ``time`` parameter was added to support `resilient collection and sending of data by the OpenWISP Monitoring Agent `_. + GET /api/v1/monitoring/wifi-session/?page_size=10 + GET /api/v1/monitoring/wifi-session/?page_size=10&page=1 Signals ------- diff --git a/docker-compose.yml b/docker-compose.yml index 6386355ed..a84213ddd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,8 +16,13 @@ services: image: influxdb:1.8-alpine volumes: - influxdb-data:/var/lib/influxdb + - ./tests/influxdb.conf:/etc/influxdb/influxdb.conf ports: - "8086:8086" + - "8089:8089/udp" + - "8090:8090/udp" + - "8091:8091/udp" + - "8092:8092/udp" environment: INFLUXDB_DB: openwisp2 INFLUXDB_USER: openwisp diff --git a/openwisp_monitoring/check/__init__.py b/openwisp_monitoring/check/__init__.py index 6fd0aeb07..e69de29bb 100644 --- a/openwisp_monitoring/check/__init__.py +++ b/openwisp_monitoring/check/__init__.py @@ -1 +0,0 @@ -default_app_config = 'openwisp_monitoring.check.apps.CheckConfig' diff --git a/openwisp_monitoring/check/apps.py b/openwisp_monitoring/check/apps.py index 15c9832f0..e0a45998a 100644 --- a/openwisp_monitoring/check/apps.py +++ b/openwisp_monitoring/check/apps.py @@ -32,3 +32,11 @@ def _connect_signals(self): sender=load_model('config', 'Device'), dispatch_uid='auto_config_check', ) + if app_settings.AUTO_IPERF3: + from .base.models import auto_iperf3_check_receiver + + post_save.connect( + auto_iperf3_check_receiver, + sender=load_model('config', 'Device'), + dispatch_uid='auto_iperf3_check', + ) diff --git a/openwisp_monitoring/check/base/models.py b/openwisp_monitoring/check/base/models.py index a0bab9e66..2f2e05b2a 100644 --- a/openwisp_monitoring/check/base/models.py +++ b/openwisp_monitoring/check/base/models.py @@ -9,7 +9,11 @@ from jsonfield import JSONField from openwisp_monitoring.check import settings as app_settings -from openwisp_monitoring.check.tasks import auto_create_config_check, auto_create_ping +from openwisp_monitoring.check.tasks import ( + auto_create_config_check, + auto_create_iperf3_check, + auto_create_ping, +) from openwisp_utils.base import TimeStampedEditableModel from ...utils import transaction_on_commit @@ -50,6 +54,13 @@ class Meta: abstract = True unique_together = ('name', 'object_id', 'content_type') + permissions = ( + ('add_check_inline', 'Can add check inline'), + ('change_check_inline', 'Can change check inline'), + ('delete_check_inline', 'Can delete check inline'), + ('view_check_inline', 'Can view check inline'), + ) + def __str__(self): if not self.object_id or not self.content_type: return self.name @@ -60,6 +71,14 @@ def __str__(self): def clean(self): self.check_instance.validate() + def full_clean(self, *args, **kwargs): + # The name of the check will be the same as the + # 'check_type' chosen by the user when the + # name field is empty (useful for CheckInline) + if not self.name: + self.name = self.get_check_type_display() + return super().full_clean(*args, **kwargs) + @cached_property def check_class(self): """ @@ -79,8 +98,18 @@ def perform_check(self, store=True): """ initiates check instance and calls its check method """ + if ( + hasattr(self.content_object, 'organization_id') + and self.content_object.organization.is_active is False + ): + return return self.check_instance.check(store=True) + def perform_check_delayed(self, duration=0): + from ..tasks import perform_check + + perform_check.apply_async(args=[self.id], countdown=duration) + def auto_ping_receiver(sender, instance, created, **kwargs): """ @@ -116,3 +145,21 @@ def auto_config_check_receiver(sender, instance, created, **kwargs): object_id=str(instance.pk), ) ) + + +def auto_iperf3_check_receiver(sender, instance, created, **kwargs): + """ + Implements OPENWISP_MONITORING_AUTO_IPERF3 + The creation step is executed in the background + """ + # we need to skip this otherwise this task will be executed + # every time the configuration is requested via checksum + if not created: + return + transaction_on_commit( + lambda: auto_create_iperf3_check.delay( + model=sender.__name__.lower(), + app_label=sender._meta.app_label, + object_id=str(instance.pk), + ) + ) diff --git a/openwisp_monitoring/check/classes/__init__.py b/openwisp_monitoring/check/classes/__init__.py index 33bf8293c..a7d9fde29 100644 --- a/openwisp_monitoring/check/classes/__init__.py +++ b/openwisp_monitoring/check/classes/__init__.py @@ -1,2 +1,3 @@ from .config_applied import ConfigApplied # noqa +from .iperf3 import Iperf3 # noqa from .ping import Ping # noqa diff --git a/openwisp_monitoring/check/classes/base.py b/openwisp_monitoring/check/classes/base.py index 71ef7582d..1c16f5201 100644 --- a/openwisp_monitoring/check/classes/base.py +++ b/openwisp_monitoring/check/classes/base.py @@ -35,15 +35,15 @@ def _get_or_create_metric(self, configuration=None): Gets or creates metric """ check = self.check_instance - if check.object_id and check.content_type: + if check.object_id and check.content_type_id: obj_id = check.object_id - ct = check.content_type + ct = ContentType.objects.get_for_id(check.content_type_id) else: obj_id = str(check.id) ct = ContentType.objects.get_for_model(Check) options = dict( object_id=obj_id, - content_type=ct, + content_type_id=ct.id, configuration=configuration or self.__class__.__name__.lower(), ) metric, created = Metric._get_or_create(**options) diff --git a/openwisp_monitoring/check/classes/config_applied.py b/openwisp_monitoring/check/classes/config_applied.py index 50d7956b0..b30b2c352 100644 --- a/openwisp_monitoring/check/classes/config_applied.py +++ b/openwisp_monitoring/check/classes/config_applied.py @@ -1,6 +1,10 @@ +from datetime import timedelta + +from django.utils import timezone from swapper import load_model from ...device.utils import SHORT_RP +from ..settings import CONFIG_CHECK_INTERVAL from .base import BaseCheck AlertSettings = load_model('monitoring', 'AlertSettings') @@ -15,7 +19,11 @@ def check(self, store=True): 'unknown', ] or not hasattr(self.related_object, 'config'): return - result = int(self.related_object.config.status == 'applied') + result = int( + self.related_object.config.status == 'applied' + or self.related_object.modified + > timezone.now() - timedelta(minutes=CONFIG_CHECK_INTERVAL) + ) # If the device config is in error status we don't need to notify # the user (because that's already done by openwisp-controller) # but we need to ensure health status will be changed diff --git a/openwisp_monitoring/check/classes/iperf3.py b/openwisp_monitoring/check/classes/iperf3.py new file mode 100644 index 000000000..4af2c5b7d --- /dev/null +++ b/openwisp_monitoring/check/classes/iperf3.py @@ -0,0 +1,545 @@ +import logging +from functools import reduce +from json import loads +from json.decoder import JSONDecodeError + +from django.core.cache import cache +from django.core.exceptions import ValidationError +from jsonschema import draft7_format_checker, validate +from jsonschema.exceptions import ValidationError as SchemaError +from swapper import load_model + +from openwisp_controller.connection.exceptions import NoWorkingDeviceConnectionError + +from .. import settings as app_settings +from .base import BaseCheck + +logger = logging.getLogger(__name__) + +Chart = load_model('monitoring', 'Chart') +Metric = load_model('monitoring', 'Metric') +AlertSettings = load_model('monitoring', 'AlertSettings') +DeviceConnection = load_model('connection', 'DeviceConnection') + +DEFAULT_IPERF3_CHECK_CONFIG = { + 'host': { + 'type': 'array', + 'items': { + 'type': 'string', + }, + 'default': [], + }, + # username, password max_length chosen from iperf3 docs to avoid iperf3 param errors + 'username': {'type': 'string', 'default': '', 'minLength': 1, 'maxLength': 20}, + 'password': {'type': 'string', 'default': '', 'minLength': 1, 'maxLength': 20}, + 'rsa_public_key': { + 'type': 'string', + 'default': '', + }, + 'client_options': { + 'type': 'object', + 'properties': { + 'port': { + 'type': 'integer', + 'default': 5201, + # max, min port chosen from iperf3 docs + 'minimum': 1, + 'maximum': 65535, + }, + 'time': { + # sets the interval time in seconds + # between periodic bandwidth, jitter, and loss reports + 'type': 'integer', + 'default': 10, + 'minimum': 1, + # arbitrary chosen to avoid slowing down the queue (30min) + 'maximum': 1800, + }, + 'bytes': { + # number of bytes to transmit (instead of 'time') + 'type': 'string', + # default to '' since we're using time for + # the test end condition instead of bytes + 'default': '', + }, + 'blockcount': { + # number of blocks (packets) to transmit + # instead of 'time' or 'bytes' + 'type': 'string', + # default to '' since we're using time for + # the test end condition instead of blockcount + 'default': '', + }, + 'window': { + # window size / socket buffer size + # this gets sent to the server and used on that side too + 'type': 'string', + 'default': '0', + }, + 'parallel': { + # number of parallel client streams to run + # note that iperf3 is single threaded + # so if you are CPU bound this will not yield higher throughput + 'type': 'integer', + 'default': 1, + # max, min parallel streams chosen from iperf3 docs + 'minimum': 1, + 'maximum': 128, + }, + 'reverse': { + # reverse the direction of a test + # the server sends data to the client + 'type': 'boolean', + 'default': False, + }, + 'bidirectional': { + # test in both directions (normal and reverse) + # with both the client and server sending + # and receiving data simultaneously + 'type': 'boolean', + 'default': False, + }, + 'connect_timeout': { + # set timeout for establishing the initial + # control connection to the server, in milliseconds (ms) + # providing a shorter value (ex. 1000 ms (1 sec)) may + # speed up detection of a down iperf3 server + 'type': 'integer', + 'default': 1000, + 'minimum': 1, + # arbitrary chosen to avoid slowing down the queue (1000 sec) + 'maximum': 1000000, + }, + 'tcp': { + 'type': 'object', + 'properties': { + 'bitrate': { + # set target bitrate to n bits/sec + 'type': 'string', + 'default': '0', + }, + 'length': { + # length of buffer to read or write + 'type': 'string', + # for TCP tests, the default value is 128KB + 'default': '128K', + }, + }, + }, + 'udp': { + 'type': 'object', + 'properties': { + 'bitrate': { + 'type': 'string', + # set target bitrate to n bits/sec + # 30 Mbps + 'default': '30M', + }, + 'length': { + # iperf3 tries to dynamically determine a + # reasonable sending size based on the path MTU + # if that cannot be determined it uses 1460 bytes + 'type': 'string', + 'default': '0', + }, + }, + }, + }, + }, +} + + +def get_iperf3_schema(): + schema = { + '$schema': 'http://json-schema.org/draft-07/schema#', + 'type': 'object', + 'additionalProperties': True, + 'dependencies': { + 'username': ['password', 'rsa_public_key'], + 'password': ['username', 'rsa_public_key'], + 'rsa_public_key': ['username', 'password'], + }, + } + schema['properties'] = DEFAULT_IPERF3_CHECK_CONFIG + return schema + + +class Iperf3(BaseCheck): + + schema = get_iperf3_schema() + + def validate_params(self, params=None): + try: + if not params: + params = self.params + validate(params, self.schema, format_checker=draft7_format_checker) + except SchemaError as e: + message = 'Invalid param' + path = '/'.join(e.path) + if path: + message = '{0} in "{1}"'.format(message, path) + message = '{0}: {1}'.format(message, e.message) + raise ValidationError({'params': message}) from e + + def _validate_iperf3_config(self, org): + # if iperf3 config is present and validate it's params + if app_settings.IPERF3_CHECK_CONFIG: + self.validate_params( + params=app_settings.IPERF3_CHECK_CONFIG.get(str(org.id)) + ) + + def check(self, store=True): + lock_acquired = False + org = self.related_object.organization + self._validate_iperf3_config(org) + available_iperf3_servers = self._get_param('host', 'host.default') + if not available_iperf3_servers: + logger.warning( + ( + f'Iperf3 servers for organization "{org}" ' + f'is not configured properly, iperf3 check skipped!' + ) + ) + return + # Avoid running the iperf3 check when the device monitoring status is "critical" + if ( + self.related_object.monitoring + and self.related_object.monitoring.status == 'critical' + ): + logger.info( + ( + f'"{self.related_object}" DeviceMonitoring ' + 'health status is "critical", iperf3 check skipped!' + ) + ) + return + time = self._get_param( + 'client_options.time', 'client_options.properties.time.default' + ) + # Try to acquire a lock, or put task back on queue + for server in available_iperf3_servers: + server_lock_key = f'ow_monitoring_{org}_iperf3_check_{server}' + # Set available_iperf3_server to the org device + lock_acquired = cache.add( + server_lock_key, + str(self.related_object), + timeout=app_settings.IPERF3_CHECK_LOCK_EXPIRE, + ) + if lock_acquired: + break + else: + logger.info( + ( + f'At the moment, all available iperf3 servers of organization "{org}" ' + f'are busy running checks, putting "{self.check_instance}" back in the queue..' + ) + ) + # Return the iperf3_check task to the queue, + # it will executed after 2 * iperf3_check_time (TCP+UDP) + self.check_instance.perform_check_delayed(duration=2 * time) + return + try: + # Execute the iperf3 check with current available server + result = self._run_iperf3_check(store, server, time) + finally: + # Release the lock after completion of the check + cache.delete(server_lock_key) + return result + + def _run_iperf3_check(self, store, server, time): + try: + device_connection = DeviceConnection.get_working_connection( + self.related_object + ) + except NoWorkingDeviceConnectionError: + logger.warning( + f'Failed to get a working DeviceConnection for "{self.related_object}", iperf3 check skipped!' + ) + return + command_tcp, command_udp = self._get_check_commands(server) + + # TCP mode + result, exit_code = device_connection.connector_instance.exec_command( + command_tcp, raise_unexpected_exit=False + ) + # Exit code 127 : command doesn't exist + if exit_code == 127: + logger.warning( + f'Iperf3 is not installed on the "{self.related_object}", error - {result.strip()}' + ) + return + + result_tcp = self._get_iperf3_result(result, exit_code, mode='TCP') + # UDP mode + result, exit_code = device_connection.connector_instance.exec_command( + command_udp, raise_unexpected_exit=False + ) + result_udp = self._get_iperf3_result(result, exit_code, mode='UDP') + result = {} + if store and result_tcp and result_udp: + # Store iperf3_result field 1 if any mode passes, store 0 when both fails + iperf3_result = result_tcp['iperf3_result'] | result_udp['iperf3_result'] + result.update({**result_tcp, **result_udp, 'iperf3_result': iperf3_result}) + self.store_result(result) + device_connection.disconnect() + return result + + def _get_check_commands(self, server): + """ + Returns tcp & udp commands for iperf3 check + """ + username = self._get_param('username', 'username.default') + port = self._get_param( + 'client_options.port', 'client_options.properties.port.default' + ) + window = self._get_param( + 'client_options.window', 'client_options.properties.window.default' + ) + parallel = self._get_param( + 'client_options.parallel', 'client_options.properties.parallel.default' + ) + ct = self._get_param( + 'client_options.connect_timeout', + 'client_options.properties.connect_timeout.default', + ) + tcp_bitrate = self._get_param( + 'client_options.tcp.bitrate', + 'client_options.properties.tcp.properties.bitrate.default', + ) + tcp_length = self._get_param( + 'client_options.tcp.length', + 'client_options.properties.tcp.properties.length.default', + ) + udp_bitrate = self._get_param( + 'client_options.udp.bitrate', + 'client_options.properties.udp.properties.bitrate.default', + ) + udp_length = self._get_param( + 'client_options.udp.length', + 'client_options.properties.udp.properties.length.default', + ) + + rev_or_bidir, test_end_condition = self._get_iperf3_test_conditions() + logger.info(f'«« Iperf3 server : {server}, Device : {self.related_object} »»') + command_tcp = ( + f'iperf3 -c {server} -p {port} {test_end_condition} --connect-timeout {ct} ' + f'-b {tcp_bitrate} -l {tcp_length} -w {window} -P {parallel} {rev_or_bidir} -J' + ) + command_udp = ( + f'iperf3 -c {server} -p {port} {test_end_condition} --connect-timeout {ct} ' + f'-b {udp_bitrate} -l {udp_length} -w {window} -P {parallel} {rev_or_bidir} -u -J' + ) + + # All three parameters ie. username, password and rsa_public_key is required + # for authentication to work, checking only username here + if username: + password = self._get_param('password', 'password.default') + key = self._get_param('rsa_public_key', 'rsa_public_key.default') + rsa_public_key = self._get_compelete_rsa_key(key) + rsa_public_key_path = '/tmp/iperf3-public-key.pem' + + command_tcp = ( + f'echo "{rsa_public_key}" > {rsa_public_key_path} && ' + f'IPERF3_PASSWORD="{password}" iperf3 -c {server} -p {port} {test_end_condition} ' + f'--username "{username}" --rsa-public-key-path {rsa_public_key_path} --connect-timeout {ct} ' + f'-b {tcp_bitrate} -l {tcp_length} -w {window} -P {parallel} {rev_or_bidir} -J' + ) + + command_udp = ( + f'IPERF3_PASSWORD="{password}" iperf3 -c {server} -p {port} {test_end_condition} ' + f'--username "{username}" --rsa-public-key-path {rsa_public_key_path} --connect-timeout {ct} ' + f'-b {udp_bitrate} -l {udp_length} -w {window} -P {parallel} {rev_or_bidir} -u -J' + ) + + # If IPERF3_CHECK_DELETE_RSA_KEY, remove rsa_public_key from the device + if app_settings.IPERF3_CHECK_DELETE_RSA_KEY: + command_udp = f'{command_udp} && rm -f {rsa_public_key_path}' + return command_tcp, command_udp + + def _get_iperf3_test_conditions(self): + """ + Returns iperf3 check test conditions (rev_or_bidir, end_condition) + """ + time = self._get_param( + 'client_options.time', 'client_options.properties.time.default' + ) + bytes = self._get_param( + 'client_options.bytes', 'client_options.properties.bytes.default' + ) + blockcount = self._get_param( + 'client_options.blockcount', 'client_options.properties.blockcount.default' + ) + reverse = self._get_param( + 'client_options.reverse', 'client_options.properties.reverse.default' + ) + bidirectional = self._get_param( + 'client_options.bidirectional', + 'client_options.properties.bidirectional.default', + ) + # by default we use 'time' param + # for the iperf3 test end condition + test_end_condition = f'-t {time}' + # if 'bytes' present in config + # use it instead of 'time' + if bytes: + test_end_condition = f'-n {bytes}' + # if 'blockcount' present in config + # use it instead of 'time' or 'bytes' + if blockcount: + test_end_condition = f'-k {blockcount}' + # only one reverse condition can be use + # reverse or bidirectional not both + rev_or_bidir = '' + if reverse: + rev_or_bidir = '--reverse' + if bidirectional: + rev_or_bidir = '--bidir' + return rev_or_bidir, test_end_condition + + def _get_compelete_rsa_key(self, key): + """ + Returns RSA key with proper format + """ + pem_prefix = '-----BEGIN PUBLIC KEY-----\n' + pem_suffix = '\n-----END PUBLIC KEY-----' + key = key.strip() + return f'{pem_prefix}{key}{pem_suffix}' + + def _deep_get(self, dictionary, keys, default=None): + """ + Returns dict key value using dict & + it's dot_key string ie. key1.key2_nested.key3_nested + if found otherwise returns default + """ + return reduce( + lambda d, key: d.get(key, default) if isinstance(d, dict) else default, + keys.split("."), + dictionary, + ) + + def _get_param(self, conf_key, default_conf_key): + """ + Returns specified param or its default value according to the schema + """ + org_id = str(self.related_object.organization.id) + iperf3_config = app_settings.IPERF3_CHECK_CONFIG + + if self.params: + check_params = self._deep_get(self.params, conf_key) + if check_params: + return check_params + + if iperf3_config: + iperf3_config = iperf3_config.get(org_id) + iperf3_config_param = self._deep_get(iperf3_config, conf_key) + if iperf3_config_param: + return iperf3_config_param + + return self._deep_get(DEFAULT_IPERF3_CHECK_CONFIG, default_conf_key) + + def _get_iperf3_result(self, result, exit_code, mode): + """ + Returns iperf3 test result + """ + try: + result = loads(result) + except JSONDecodeError: + # Errors other than iperf3 test errors + logger.warning( + f'Iperf3 check failed for "{self.related_object}", error - {result.strip()}' + ) + return + + if mode == 'TCP': + if exit_code != 0: + logger.warning( + f'Iperf3 check failed for "{self.related_object}", {result["error"]}' + ) + return { + 'iperf3_result': 0, + 'sent_bps_tcp': 0.0, + 'received_bps_tcp': 0.0, + 'sent_bytes_tcp': 0, + 'received_bytes_tcp': 0, + 'retransmits': 0, + } + else: + sent = result['end']['sum_sent'] + received = result['end']['sum_received'] + return { + 'iperf3_result': 1, + 'sent_bps_tcp': float(sent['bits_per_second']), + 'received_bps_tcp': float(received['bits_per_second']), + 'sent_bytes_tcp': sent['bytes'], + 'received_bytes_tcp': received['bytes'], + 'retransmits': sent['retransmits'], + } + + elif mode == 'UDP': + if exit_code != 0: + logger.warning( + f'Iperf3 check failed for "{self.related_object}", {result["error"]}' + ) + return { + 'iperf3_result': 0, + 'sent_bps_udp': 0.0, + 'sent_bytes_udp': 0, + 'jitter': 0.0, + 'total_packets': 0, + 'lost_packets': 0, + 'lost_percent': 0.0, + } + else: + return { + 'iperf3_result': 1, + 'sent_bps_udp': float(result['end']['sum']['bits_per_second']), + 'sent_bytes_udp': result['end']['sum']['bytes'], + 'jitter': float(result['end']['sum']['jitter_ms']), + 'total_packets': result['end']['sum']['packets'], + 'lost_packets': result['end']['sum']['lost_packets'], + 'lost_percent': float(result['end']['sum']['lost_percent']), + } + + def store_result(self, result): + """ + Store result in the DB + """ + metric = self._get_metric() + copied = result.copy() + iperf3_result = copied.pop('iperf3_result') + metric.write(iperf3_result, extra_values=copied) + + def _get_metric(self): + """ + Gets or creates metric + """ + metric, created = self._get_or_create_metric() + if created: + self._create_alert_settings(metric) + self._create_charts(metric) + return metric + + def _create_alert_settings(self, metric): + """ + Creates default iperf3 alert settings with is_active=False + """ + alert_settings = AlertSettings(metric=metric, is_active=False) + alert_settings.full_clean() + alert_settings.save() + + def _create_charts(self, metric): + """ + Creates iperf3 related charts + """ + charts = [ + 'bandwidth', + 'transfer', + 'retransmits', + 'jitter', + 'datagram', + 'datagram_loss', + ] + for chart in charts: + chart = Chart(metric=metric, configuration=chart) + chart.full_clean() + chart.save() diff --git a/openwisp_monitoring/check/classes/ping.py b/openwisp_monitoring/check/classes/ping.py index 2e4b2dab9..22b316abd 100644 --- a/openwisp_monitoring/check/classes/ping.py +++ b/openwisp_monitoring/check/classes/ping.py @@ -89,7 +89,7 @@ def check(self, store=True): 'fping', '-e', # show elapsed (round-trip) time of packets '-c %s' % count, # count of pings to send to each target, - '-i %s' % interval, # interval between sending pings(in ms) + '-p %s' % interval, # interval between sending pings(in ms) '-b %s' % bytes_, # amount of ping data to send '-t %s' % timeout, # individual target initial timeout (in ms) '-q', diff --git a/openwisp_monitoring/check/migrations/0003_create_ping.py b/openwisp_monitoring/check/migrations/0003_create_ping.py index b1a2ef4a6..76e5d417b 100644 --- a/openwisp_monitoring/check/migrations/0003_create_ping.py +++ b/openwisp_monitoring/check/migrations/0003_create_ping.py @@ -1,32 +1,10 @@ -import swapper from django.db import migrations -from openwisp_monitoring.check.settings import AUTO_PING -from openwisp_monitoring.check.tasks import auto_create_ping - - -def create_device_ping(apps, schema_editor): - if AUTO_PING: - ContentType = apps.get_model('contenttypes', 'ContentType') - Check = apps.get_model('check', 'Check') - Device = apps.get_model('config', 'Device') - for device in Device.objects.all(): - auto_create_ping( - model=Device.__name__.lower(), - app_label=Device._meta.app_label, - object_id=str(device.pk), - check_model=Check, - content_type_model=ContentType, - ) - class Migration(migrations.Migration): dependencies = [ ('check', '0001_initial_squashed_0002_check_unique_together'), - swapper.dependency('monitoring', 'Metric'), ] - operations = [ - migrations.RunPython(create_device_ping, reverse_code=migrations.RunPython.noop) - ] + operations = [] diff --git a/openwisp_monitoring/check/migrations/0005_create_config_applied.py b/openwisp_monitoring/check/migrations/0005_create_config_applied.py index 2c64c40fa..8f6486c45 100644 --- a/openwisp_monitoring/check/migrations/0005_create_config_applied.py +++ b/openwisp_monitoring/check/migrations/0005_create_config_applied.py @@ -1,33 +1,5 @@ from django.db import migrations -from openwisp_monitoring.check.settings import AUTO_CONFIG_CHECK -from openwisp_monitoring.check.tasks import auto_create_config_check - - -def add_config_applied_checks(apps, schema_editor): - if not AUTO_CONFIG_CHECK: - return - ContentType = apps.get_model('contenttypes', 'ContentType') - Check = apps.get_model('check', 'Check') - Device = apps.get_model('config', 'Device') - for device in Device.objects.all(): - auto_create_config_check( - model=Device.__name__.lower(), - app_label=Device._meta.app_label, - object_id=str(device.pk), - check_model=Check, - content_type_model=ContentType, - ) - - -def remove_config_applied_checks(apps, schema_editor): - Check = apps.get_model('check', 'Check') - Metric = apps.get_model('monitoring', 'Metric') - Check.objects.filter( - check='openwisp_monitoring.check.classes.ConfigApplied' - ).delete() - Metric.objects.filter(configuration='config_applied').delete() - class Migration(migrations.Migration): @@ -35,8 +7,4 @@ class Migration(migrations.Migration): ('check', '0004_rename_active_to_is_active'), ] - operations = [ - migrations.RunPython( - add_config_applied_checks, reverse_code=remove_config_applied_checks - ) - ] + operations = [] diff --git a/openwisp_monitoring/check/migrations/0007_create_checks.py b/openwisp_monitoring/check/migrations/0007_create_checks.py new file mode 100644 index 000000000..b9cde2631 --- /dev/null +++ b/openwisp_monitoring/check/migrations/0007_create_checks.py @@ -0,0 +1,62 @@ +import swapper +from django.db import migrations + +from openwisp_monitoring.check.settings import AUTO_CONFIG_CHECK, AUTO_PING +from openwisp_monitoring.check.tasks import auto_create_config_check, auto_create_ping + + +def create_ping_checks(apps, schema_editor): + if AUTO_PING: + ContentType = apps.get_model('contenttypes', 'ContentType') + Check = apps.get_model('check', 'Check') + Device = apps.get_model('config', 'Device') + for device in Device.objects.all(): + auto_create_ping( + model=Device.__name__.lower(), + app_label=Device._meta.app_label, + object_id=str(device.pk), + check_model=Check, + content_type_model=ContentType, + ) + + +def create_config_applied_checks(apps, schema_editor): + if not AUTO_CONFIG_CHECK: + return + ContentType = apps.get_model('contenttypes', 'ContentType') + Check = apps.get_model('check', 'Check') + Device = apps.get_model('config', 'Device') + for device in Device.objects.all(): + auto_create_config_check( + model=Device.__name__.lower(), + app_label=Device._meta.app_label, + object_id=str(device.pk), + check_model=Check, + content_type_model=ContentType, + ) + + +def remove_config_applied_checks(apps, schema_editor): + Check = apps.get_model('check', 'Check') + Metric = apps.get_model('monitoring', 'Metric') + Check.objects.filter( + check='openwisp_monitoring.check.classes.ConfigApplied' + ).delete() + Metric.objects.filter(configuration='config_applied').delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ('check', '0006_rename_check_check_check_type'), + swapper.dependency('monitoring', 'Metric'), + ] + + operations = [ + migrations.RunPython( + create_ping_checks, reverse_code=migrations.RunPython.noop + ), + migrations.RunPython( + create_config_applied_checks, reverse_code=remove_config_applied_checks + ), + ] diff --git a/openwisp_monitoring/check/migrations/0008_alter_check_options.py b/openwisp_monitoring/check/migrations/0008_alter_check_options.py new file mode 100644 index 000000000..021ea044c --- /dev/null +++ b/openwisp_monitoring/check/migrations/0008_alter_check_options.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.14 on 2022-08-12 07:50 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('check', '0007_create_checks'), + ] + + operations = [ + migrations.AlterModelOptions( + name='check', + options={ + 'permissions': ( + ('add_check_inline', 'Can add check inline'), + ('change_check_inline', 'Can change check inline'), + ('delete_check_inline', 'Can delete check inline'), + ('view_check_inline', 'Can view check inline'), + ) + }, + ), + ] diff --git a/openwisp_monitoring/check/migrations/0009_add_check_inline_permissions.py b/openwisp_monitoring/check/migrations/0009_add_check_inline_permissions.py new file mode 100644 index 000000000..3dfdfe345 --- /dev/null +++ b/openwisp_monitoring/check/migrations/0009_add_check_inline_permissions.py @@ -0,0 +1,19 @@ +# Generated by Django 4.0.4 on 2022-08-19 11:28 + +from django.db import migrations + +from . import assign_check_inline_permissions_to_groups + + +class Migration(migrations.Migration): + + dependencies = [ + ('check', '0008_alter_check_options'), + ] + + operations = [ + migrations.RunPython( + assign_check_inline_permissions_to_groups, + reverse_code=migrations.RunPython.noop, + ), + ] diff --git a/openwisp_monitoring/check/migrations/__init__.py b/openwisp_monitoring/check/migrations/__init__.py index e69de29bb..afe4dbbc8 100644 --- a/openwisp_monitoring/check/migrations/__init__.py +++ b/openwisp_monitoring/check/migrations/__init__.py @@ -0,0 +1,34 @@ +from django.contrib.auth.models import Permission + +from openwisp_controller.migrations import create_default_permissions, get_swapped_model + + +def assign_check_inline_permissions_to_groups(apps, schema_editor): + create_default_permissions(apps, schema_editor) + operators_read_only_admins_manage = [ + 'check', + ] + manage_operations = ['add', 'view', 'change', 'delete'] + Group = get_swapped_model(apps, 'openwisp_users', 'Group') + + try: + admin = Group.objects.get(name='Administrator') + operator = Group.objects.get(name='Operator') + # consider failures custom cases + # that do not have to be dealt with + except Group.DoesNotExist: + return + + for model_name in operators_read_only_admins_manage: + try: + permission = Permission.objects.get( + codename='view_{}_inline'.format(model_name) + ) + operator.permissions.add(permission.pk) + except Permission.DoesNotExist: + pass + for operation in manage_operations: + permission = Permission.objects.get( + codename='{}_{}_inline'.format(operation, model_name) + ) + admin.permissions.add(permission.pk) diff --git a/openwisp_monitoring/check/settings.py b/openwisp_monitoring/check/settings.py index 4575c8eca..8f9db6143 100644 --- a/openwisp_monitoring/check/settings.py +++ b/openwisp_monitoring/check/settings.py @@ -1,3 +1,5 @@ +from django.conf import settings + from ..settings import get_settings_value CHECK_CLASSES = get_settings_value( @@ -5,9 +7,25 @@ ( ('openwisp_monitoring.check.classes.Ping', 'Ping'), ('openwisp_monitoring.check.classes.ConfigApplied', 'Configuration Applied'), + ('openwisp_monitoring.check.classes.Iperf3', 'Iperf3'), ), ) AUTO_PING = get_settings_value('AUTO_PING', True) AUTO_CONFIG_CHECK = get_settings_value('AUTO_DEVICE_CONFIG_CHECK', True) -MANAGEMENT_IP_ONLY = get_settings_value('MANAGEMENT_IP_ONLY', True) +# If OPENWISP_MONITORING_MANAGEMENT_IP_ONLY is not configured, use +# OPENWISP_CONTROLLER_MANAGEMENT_IP_ONLY. +MANAGEMENT_IP_ONLY = get_settings_value( + 'MANAGEMENT_IP_ONLY', + getattr(settings, 'OPENWISP_CONTROLLER_MANAGEMENT_IP_ONLY', True), +) PING_CHECK_CONFIG = get_settings_value('PING_CHECK_CONFIG', {}) +AUTO_IPERF3 = get_settings_value('AUTO_IPERF3', False) +IPERF3_CHECK_CONFIG = get_settings_value('IPERF3_CHECK_CONFIG', {}) +IPERF3_CHECK_LOCK_EXPIRE = get_settings_value( + 'IPERF3_CHECK_LOCK_EXPIRE', 10 * 60 +) # 10 minutes arbitrarily chosen (must be longer than TCP + UDP test time) +IPERF3_CHECK_DELETE_RSA_KEY = get_settings_value('IPERF3_CHECK_DELETE_RSA_KEY', True) +CHECKS_LIST = get_settings_value('CHECK_LIST', list(dict(CHECK_CLASSES).keys())) +CONFIG_CHECK_INTERVAL = int( + get_settings_value('CONFIG_CHECK_INTERVAL', 5) +) # in minutes diff --git a/openwisp_monitoring/check/tasks.py b/openwisp_monitoring/check/tasks.py index 2ae62bc0d..3f56878ae 100644 --- a/openwisp_monitoring/check/tasks.py +++ b/openwisp_monitoring/check/tasks.py @@ -4,9 +4,13 @@ from celery import shared_task from django.conf import settings from django.contrib.contenttypes.models import ContentType -from django.core.exceptions import ObjectDoesNotExist +from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist from swapper import load_model +from openwisp_utils.tasks import OpenwispCeleryTask + +from .settings import CHECKS_LIST + logger = logging.getLogger(__name__) @@ -14,8 +18,8 @@ def get_check_model(): return load_model('check', 'Check') -@shared_task -def run_checks(): +@shared_task(time_limit=2 * 60 * 60) +def run_checks(checks=None): """ Retrieves the id of all active checks in chunks of 2000 items and calls the ``perform_check`` task (defined below) for each of them. @@ -23,9 +27,22 @@ def run_checks(): This allows to enqueue all the checks that need to be performed and execute them in parallel with multiple workers if needed. """ + # If checks is None, We should execute all the checks + if checks is None: + checks = CHECKS_LIST + + if not isinstance(checks, list): + raise ImproperlyConfigured( + f'Check path {checks} should be of type "list"' + ) # pragma: no cover + if not all(check_path in CHECKS_LIST for check_path in checks): + raise ImproperlyConfigured( + f'Check path {checks} should be in {CHECKS_LIST}' + ) # pragma: no cover + iterator = ( get_check_model() - .objects.filter(is_active=True) + .objects.filter(is_active=True, check_type__in=checks) .only('id') .values('id') .iterator() @@ -34,7 +51,7 @@ def run_checks(): perform_check.delay(check['id']) -@shared_task +@shared_task(time_limit=30 * 60) def perform_check(uuid): """ Retrieves check according to the passed UUID @@ -50,7 +67,7 @@ def perform_check(uuid): print(json.dumps(result, indent=4, sort_keys=True)) -@shared_task +@shared_task(base=OpenwispCeleryTask) def auto_create_ping( model, app_label, object_id, check_model=None, content_type_model=None ): @@ -67,7 +84,7 @@ def auto_create_ping( if has_check: return content_type_model = content_type_model or ContentType - ct = content_type_model.objects.get(app_label=app_label, model=model) + ct = content_type_model.objects.get_by_natural_key(app_label=app_label, model=model) check = Check( name='Ping', check_type=ping_path, content_type=ct, object_id=object_id ) @@ -75,7 +92,7 @@ def auto_create_ping( check.save() -@shared_task +@shared_task(base=OpenwispCeleryTask) def auto_create_config_check( model, app_label, object_id, check_model=None, content_type_model=None ): @@ -91,7 +108,7 @@ def auto_create_config_check( if has_check: return content_type_model = content_type_model or ContentType - ct = content_type_model.objects.get(app_label=app_label, model=model) + ct = content_type_model.objects.get_by_natural_key(app_label=app_label, model=model) check = Check( name='Configuration Applied', check_type=config_check_path, @@ -100,3 +117,30 @@ def auto_create_config_check( ) check.full_clean() check.save() + + +@shared_task(base=OpenwispCeleryTask) +def auto_create_iperf3_check( + model, app_label, object_id, check_model=None, content_type_model=None +): + """ + Called by openwisp_monitoring.check.models.auto_iperf3_check_receiver + """ + Check = check_model or get_check_model() + iperf3_check_path = 'openwisp_monitoring.check.classes.Iperf3' + has_check = Check.objects.filter( + object_id=object_id, content_type__model='device', check_type=iperf3_check_path + ).exists() + # create new check only if necessary + if has_check: + return + content_type_model = content_type_model or ContentType + ct = content_type_model.objects.get_by_natural_key(app_label=app_label, model=model) + check = Check( + name='Iperf3', + check_type=iperf3_check_path, + content_type=ct, + object_id=object_id, + ) + check.full_clean() + check.save() diff --git a/openwisp_monitoring/check/tests/iperf3_test_utils.py b/openwisp_monitoring/check/tests/iperf3_test_utils.py new file mode 100644 index 000000000..37ce9b164 --- /dev/null +++ b/openwisp_monitoring/check/tests/iperf3_test_utils.py @@ -0,0 +1,1078 @@ +# flake8: noqa + +RESULT_TCP = """ +{ + "start": { + "connected": [ + { + "socket": 5, + "local_host": "127.0.0.1", + "local_port": 54966, + "remote_host": "127.0.0.1", + "remote_port": 5201 + } + ], + "version": "iperf 3.9", + "system_info": "Linux openwisp-desktop 5.11.2-51-generic #58~20.04.1-Ubuntu SMP Tue Jun 14 11:29:12 UTC 2022 x86_64", + "timestamp": { + "time": "Thu, 30 Jun 2022 21:39:55 GMT", + "timesecs": 1656625195 + }, + "connecting_to": { + "host": "localhost", + "port": 5201 + }, + "cookie": "npx4ad65t3j4wginxr4a7mqedmkhhspx3sob", + "tcp_mss_default": 32768, + "sock_bufsize": 0, + "sndbuf_actual": 16384, + "rcvbuf_actual": 131072, + "test_start": { + "protocol": "TCP", + "num_streams": 1, + "blksize": 131072, + "omit": 0, + "duration": 10, + "bytes": 0, + "blocks": 0, + "reverse": 0, + "tos": 0 + } + }, + "intervals": [ + { + "streams": [ + { + "socket": 5, + "start": 0, + "end": 1.000048, + "seconds": 1.000048041343689, + "bytes": 5790760960, + "bits_per_second": 46323862219.414116, + "retransmits": 0, + "snd_cwnd": 1506109, + "rtt": 22, + "rttvar": 3, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 0, + "end": 1.000048, + "seconds": 1.000048041343689, + "bytes": 5790760960, + "bits_per_second": 46323862219.414116, + "retransmits": 0, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 1.000048, + "end": 2.000185, + "seconds": 1.0001369714736938, + "bytes": 5463080960, + "bits_per_second": 43698662209.83867, + "retransmits": 0, + "snd_cwnd": 2160939, + "rtt": 22, + "rttvar": 3, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 1.000048, + "end": 2.000185, + "seconds": 1.0001369714736938, + "bytes": 5463080960, + "bits_per_second": 43698662209.83867, + "retransmits": 0, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 2.000185, + "end": 3.00019, + "seconds": 1.0000050067901611, + "bytes": 5679349760, + "bits_per_second": 45434570598.638954, + "retransmits": 0, + "snd_cwnd": 2553837, + "rtt": 21, + "rttvar": 1, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 2.000185, + "end": 3.00019, + "seconds": 1.0000050067901611, + "bytes": 5679349760, + "bits_per_second": 45434570598.638954, + "retransmits": 0, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 3.00019, + "end": 4.000232, + "seconds": 1.0000419616699219, + "bytes": 5710807040, + "bits_per_second": 45684539320.4405, + "retransmits": 0, + "snd_cwnd": 2553837, + "rtt": 24, + "rttvar": 5, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 3.00019, + "end": 4.000232, + "seconds": 1.0000419616699219, + "bytes": 5710807040, + "bits_per_second": 45684539320.4405, + "retransmits": 0, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 4.000232, + "end": 5.000158, + "seconds": 0.999925971031189, + "bytes": 5307105280, + "bits_per_second": 42459985508.942955, + "retransmits": 0, + "snd_cwnd": 3208667, + "rtt": 27, + "rttvar": 4, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 4.000232, + "end": 5.000158, + "seconds": 0.999925971031189, + "bytes": 5307105280, + "bits_per_second": 42459985508.942955, + "retransmits": 0, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 5.000158, + "end": 6.000229, + "seconds": 1.0000710487365723, + "bytes": 5308416000, + "bits_per_second": 42464310964.35657, + "retransmits": 0, + "snd_cwnd": 3208667, + "rtt": 28, + "rttvar": 1, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 5.000158, + "end": 6.000229, + "seconds": 1.0000710487365723, + "bytes": 5308416000, + "bits_per_second": 42464310964.35657, + "retransmits": 0, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 6.000229, + "end": 7.000056, + "seconds": 0.9998270273208618, + "bytes": 5241569280, + "bits_per_second": 41939808681.0701, + "retransmits": 0, + "snd_cwnd": 3208667, + "rtt": 23, + "rttvar": 4, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 6.000229, + "end": 7.000056, + "seconds": 0.9998270273208618, + "bytes": 5241569280, + "bits_per_second": 41939808681.0701, + "retransmits": 0, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 7.000056, + "end": 8.000202, + "seconds": 1.0001460313797, + "bytes": 5734400000, + "bits_per_second": 45868501759.40331, + "retransmits": 0, + "snd_cwnd": 3208667, + "rtt": 22, + "rttvar": 1, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 7.000056, + "end": 8.000202, + "seconds": 1.0001460313797, + "bytes": 5734400000, + "bits_per_second": 45868501759.40331, + "retransmits": 0, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 8.000202, + "end": 9.0003, + "seconds": 1.0000979900360107, + "bytes": 5415895040, + "bits_per_second": 43322915105.98867, + "retransmits": 0, + "snd_cwnd": 3208667, + "rtt": 35, + "rttvar": 12, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 8.000202, + "end": 9.0003, + "seconds": 1.0000979900360107, + "bytes": 5415895040, + "bits_per_second": 43322915105.98867, + "retransmits": 0, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 9.0003, + "end": 10.000218, + "seconds": 0.999917984008789, + "bytes": 5402787840, + "bits_per_second": 43225847930.76398, + "retransmits": 0, + "snd_cwnd": 3208667, + "rtt": 26, + "rttvar": 17, + "pmtu": 65535, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 9.0003, + "end": 10.000218, + "seconds": 0.999917984008789, + "bytes": 5402787840, + "bits_per_second": 43225847930.76398, + "retransmits": 0, + "omitted": false, + "sender": true + } + } + ], + "end": { + "streams": [ + { + "sender": { + "socket": 5, + "start": 0, + "end": 10.000218, + "seconds": 10.000218, + "bytes": 55054172160, + "bits_per_second": 44042377604.16823, + "retransmits": 0, + "max_snd_cwnd": 3208667, + "max_rtt": 35, + "min_rtt": 21, + "mean_rtt": 25, + "sender": true + }, + "receiver": { + "socket": 5, + "start": 0, + "end": 10.000272, + "seconds": 10.000218, + "bytes": 55054172160, + "bits_per_second": 44042139781.797935, + "sender": true + } + } + ], + "sum_sent": { + "start": 0, + "end": 10.000218, + "seconds": 10.000218, + "bytes": 55054172160, + "bits_per_second": 44042377604.16823, + "retransmits": 0, + "sender": true + }, + "sum_received": { + "start": 0, + "end": 10.000272, + "seconds": 10.000272, + "bytes": 55054172160, + "bits_per_second": 44042139781.797935, + "sender": true + }, + "cpu_utilization_percent": { + "host_total": 99.49882081069975, + "host_user": 0.6620490539150914, + "host_system": 98.83676176238454, + "remote_total": 0.377797593572381, + "remote_user": 0.02174276147834767, + "remote_system": 0.35605477540538377 + }, + "sender_tcp_congestion": "cubic", + "receiver_tcp_congestion": "cubic" + } +} +""" + +RESULT_UDP = """ +{ + "start": { + "connected": [ + { + "socket": 5, + "local_host": "127.0.0.1", + "local_port": 54477, + "remote_host": "127.0.0.1", + "remote_port": 5201 + } + ], + "version": "iperf 3.9", + "system_info": "openwisp-desktop 5.11.2-51-generic #58~20.04.1-Ubuntu SMP Tue Jun 14 11:29:12 UTC 2022 x86_64", + "timestamp": { + "time": "Thu, 30 Jun 2022 21:10:31 GMT", + "timesecs": 1656623431 + }, + "connecting_to": { + "host": "localhost", + "port": 5201 + }, + "cookie": "kvuxkz3ncutquvpl2evufmdkn726molzocot", + "sock_bufsize": 0, + "sndbuf_actual": 212992, + "rcvbuf_actual": 212992, + "test_start": { + "protocol": "UDP", + "num_streams": 1, + "blksize": 32768, + "omit": 0, + "duration": 10, + "bytes": 0, + "blocks": 0, + "reverse": 0, + "tos": 0 + } + }, + "intervals": [ + { + "streams": [ + { + "socket": 5, + "start": 0, + "end": 1.000057, + "seconds": 1.0000569820404053, + "bytes": 131072, + "bits_per_second": 1048516.253404483, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 0, + "end": 1.000057, + "seconds": 1.0000569820404053, + "bytes": 131072, + "bits_per_second": 1048516.253404483, + "packets": 4, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 1.000057, + "end": 2.000079, + "seconds": 1.000022053718567, + "bytes": 131072, + "bits_per_second": 1048552.875509981, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 1.000057, + "end": 2.000079, + "seconds": 1.000022053718567, + "bytes": 131072, + "bits_per_second": 1048552.875509981, + "packets": 4, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 2.000079, + "end": 3.000079, + "seconds": 1, + "bytes": 131072, + "bits_per_second": 1048576, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 2.000079, + "end": 3.000079, + "seconds": 1, + "bytes": 131072, + "bits_per_second": 1048576, + "packets": 4, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 3.000079, + "end": 4.000079, + "seconds": 1, + "bytes": 131072, + "bits_per_second": 1048576, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 3.000079, + "end": 4.000079, + "seconds": 1, + "bytes": 131072, + "bits_per_second": 1048576, + "packets": 4, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 4.000079, + "end": 5.000182, + "seconds": 1.0001029968261719, + "bytes": 131072, + "bits_per_second": 1048468.0111225117, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 4.000079, + "end": 5.000182, + "seconds": 1.0001029968261719, + "bytes": 131072, + "bits_per_second": 1048468.0111225117, + "packets": 4, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 5.000182, + "end": 6.000056, + "seconds": 0.9998739957809448, + "bytes": 131072, + "bits_per_second": 1048708.1416504055, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 5.000182, + "end": 6.000056, + "seconds": 0.9998739957809448, + "bytes": 131072, + "bits_per_second": 1048708.1416504055, + "packets": 4, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 6.000056, + "end": 7.000056, + "seconds": 1, + "bytes": 131072, + "bits_per_second": 1048576, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 6.000056, + "end": 7.000056, + "seconds": 1, + "bytes": 131072, + "bits_per_second": 1048576, + "packets": 4, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 7.000056, + "end": 8.000056, + "seconds": 1, + "bytes": 131072, + "bits_per_second": 1048576, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 7.000056, + "end": 8.000056, + "seconds": 1, + "bytes": 131072, + "bits_per_second": 1048576, + "packets": 4, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 8.000056, + "end": 9.000057, + "seconds": 1.0000009536743164, + "bytes": 131072, + "bits_per_second": 1048575.0000009537, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 8.000056, + "end": 9.000057, + "seconds": 1.0000009536743164, + "bytes": 131072, + "bits_per_second": 1048575.0000009537, + "packets": 4, + "omitted": false, + "sender": true + } + }, + { + "streams": [ + { + "socket": 5, + "start": 9.000057, + "end": 10.00006, + "seconds": 1.0000029802322388, + "bytes": 131072, + "bits_per_second": 1048572.8750093132, + "packets": 4, + "omitted": false, + "sender": true + } + ], + "sum": { + "start": 9.000057, + "end": 10.00006, + "seconds": 1.0000029802322388, + "bytes": 131072, + "bits_per_second": 1048572.8750093132, + "packets": 4, + "omitted": false, + "sender": true + } + } + ], + "end": { + "streams": [ + { + "udp": { + "socket": 5, + "start": 0, + "end": 10.00006, + "seconds": 10.00006, + "bytes": 1310720, + "bits_per_second": 1048569.7085817485, + "jitter_ms": 0.011259258240784126, + "lost_packets": 0, + "packets": 40, + "lost_percent": 0, + "out_of_order": 0, + "sender": true + } + } + ], + "sum": { + "start": 0, + "end": 10.000115, + "seconds": 10.000115, + "bytes": 1310720, + "bits_per_second": 1048569.7085817485, + "jitter_ms": 0.011259258240784126, + "lost_packets": 0, + "packets": 40, + "lost_percent": 0, + "sender": true + }, + "cpu_utilization_percent": { + "host_total": 0.6057128493969417, + "host_user": 0, + "host_system": 0.6057128493969417, + "remote_total": 0.016163250220207454, + "remote_user": 0.01616789349806445, + "remote_system": 0 + } + } +} +""" + +RESULT_FAIL = """ +{ + "start": { + "connected": [], + "version": "iperf 3.7", + "system_info": "Linux vm-openwrt 4.14.171 #0 SMP Thu Feb 27 21:05:12 2020 x86_64" + }, + "intervals": [], + "end": {}, + "error": "error - unable to connect to server: Connection refused" +} +""" +RESULT_AUTH_FAIL = """ +{ + "start": { + "connected": [], + "version": "iperf 3.7", + "system_info": "Linux vm-openwrt 4.14.171 #0 SMP Thu Feb 27 21:05:12 2020 x86_64", + "timestamp": { + "time": "Tue, 19 Jul 2022 12:23:38 UTC", + "timesecs": 1658233418 + }, + "connecting_to": { + "host": "192.168.5.109", + "port": 5201 + }, + "cookie": "llz5f6akwyonbtcj3fx4phvfaflohdlvxr4z", + "tcp_mss_default": 1460 + }, + "intervals": [], + "end": {}, + "error": "error - test authorization failed" +} +""" +PARAM_ERROR = """Usage: iperf3 [-s|-c host] [options] + iperf3 [-h|--help] [-v|--version] + +Server or Client: + -p, --port # server port to listen on/connect to + -f, --format [kmgtKMGT] format to report: Kbits, Mbits, Gbits, Tbits + -i, --interval # seconds between periodic throughput reports + -F, --file name xmit/recv the specified file + -A, --affinity n/n,m set CPU affinity + -B, --bind bind to the interface associated with the address + -V, --verbose more detailed output + -J, --json output in JSON format + --logfile f send output to a log file + --forceflush force flushing output at every interval + -d, --debug emit debugging output + -v, --version show version information and quit + -h, --help show this message and quit +Server specific: + -s, --server run in server mode + -D, --daemon run the server as a daemon + -I, --pidfile file write PID file + -1, --one-off handle one client connection then exit + --rsa-private-key-path path to the RSA private key used to decrypt + authentication credentials + --authorized-users-path path to the configuration file containing user + credentials +Client specific: + -c, --client run in client mode, connecting to + -u, --udp use UDP rather than TCP + --connect-timeout # timeout for control connection setup (ms) + -b, --bitrate #[KMG][/#] target bitrate in bits/sec (0 for unlimited) + (default 1 Mbit/sec for UDP, unlimited for TCP) + (optional slash and packet count for burst mode) + --pacing-timer #[KMG] set the timing for pacing, in microseconds (default 1000) + --fq-rate #[KMG] enable fair-queuing based socket pacing in + bits/sec (Linux only) + -t, --time # time in seconds to transmit for (default 10 secs) + -n, --bytes #[KMG] number of bytes to transmit (instead of -t) + -k, --blockcount #[KMG] number of blocks (packets) to transmit (instead of -t or -n) + -l, --length #[KMG] length of buffer to read or write + (default 128 KB for TCP, dynamic or 1460 for UDP) + --cport bind to a specific client port (TCP and UDP, default: ephemeral port) + -P, --parallel # number of parallel client streams to run + -R, --reverse run in reverse mode (server sends, client receives) + --bidir run in bidirectional mode. + Client and server send and receive data. + -w, --window #[KMG] set window size / socket buffer size + -C, --congestion set TCP congestion control algorithm (Linux and FreeBSD only) + -M, --set-mss # set TCP/SCTP maximum segment size (MTU - 40 bytes) + -N, --no-delay set TCP/SCTP no delay, disabling Nagle's Algorithm + -4, --version4 only use IPv4 + -6, --version6 only use IPv6 + -S, --tos N set the IP type of service, 0-255. + The usual prefixes for octal and hex can be used, + i.e. 52, 064 and 0x34 all specify the same value. + --dscp N or --dscp val set the IP dscp value, either 0-63 or symbolic. + Numeric values can be specified in decimal, + octal and hex (see --tos above). + -L, --flowlabel N set the IPv6 flow label (only supported on Linux) + -Z, --zerocopy use a 'zero copy' method of sending data + -O, --omit N omit the first n seconds + -T, --title str prefix every output line with this string + --extra-data str data string to include in client and server JSON + --get-server-output get results from server + --udp-counters-64bit use 64-bit counters in UDP test packets + --repeating-payload use repeating pattern in payload, instead of + randomized payload (like in iperf2) + --username username for authentication + --rsa-public-key-path path to the RSA public key used to encrypt + authentication credentials + +[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga- + +iperf3 homepage at: https://software.es.net/iperf/ +Report bugs to: https://github.com/esnet/iperf +iperf3: parameter error - you must specify username (max 20 chars), password (max 20 chars) and a path to a valid public rsa client to be used""" + +TEST_RSA_KEY = """MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwuEm+iYrfSWJOupy6X3N +dxZvUCxvmoL3uoGAs0O0Y32unUQrwcTIxudy38JSuCccD+k2Rf8S4WuZSiTxaoea +6Du99YQGVZeY67uJ21SWFqWU+w6ONUj3TrNNWoICN7BXGLE2BbSBz9YaXefE3aqw +GhEjQz364Itwm425vHn2MntSp0weWb4hUCjQUyyooRXPrFUGBOuY+VvAvMyAG4Uk +msapnWnBSxXt7Tbb++A5XbOMdM2mwNYDEtkD5ksC/x3EVBrI9FvENsH9+u/8J9Mf +2oPl4MnlCMY86MQypkeUn7eVWfDnseNky7TyC0/IgCXve/iaydCCFdkjyo1MTAA4 +BQIDAQAB""" + +INVALID_PARAMS = [ + {'host': ''}, + {'host': 12}, + {'host': 'test.openwisp.io'}, + {'username': 121}, + {'password': -323}, + {'rsa_public_key': 1334}, + {'username': ''}, + {'password': 0}, + {'rsa_public_key': 0}, + { + 'username': 'openwisp-test-user', + 'password': 'open-pass', + 'rsa_public_key': -1, + }, + { + 'username': 1123, + 'password': 'rossi', + 'rsa_public_key': '', + }, + { + 'username': 'openwisp-test-user', + 'password': -214, + }, + { + 'client_options': { + 'port': 'testport', + 'time': 120, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': '50M'}, + } + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 'testport', + 'time': 120, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': '50M'}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 70000, + 'time': 120, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': '50M'}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': -21, + 'time': 120, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': '50M'}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'time': 1200000, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': '50M'}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'time': 20, + 'tcp': {'bitrate': 10}, + 'udp': {'bitrate': '50M'}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'time': 120, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'bytes': 20, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'bytes': '', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'bytes': -1, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'connect_timeout': -1, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'connect_timeout': '11000', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'blockcount': -13, + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'blockcount': '', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'tcp': {'bitrate': '10M', 'length': 112}, + 'udp': {'bitrate': 50}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'connect_timeout': 2000000, + 'blockcount': '100K', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50, 'length': 9595}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'parallel': '12', + 'connect_timeout': 2000000, + 'blockcount': '100K', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50, 'length': 9595}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'parallel': 0, + 'connect_timeout': 2000000, + 'blockcount': '100K', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50, 'length': 9595}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'parallel': 250, + 'connect_timeout': 2000000, + 'blockcount': '100K', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50, 'length': 9595}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'bidirectional': True, + 'connect_timeout': 2000000, + 'blockcount': '100K', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50, 'length': 9595}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'reverse': False, + 'connect_timeout': 2000000, + 'blockcount': '100K', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50, 'length': 9595}, + }, + }, + { + 'host': ['test.openwisp.io'], + 'client_options': { + 'port': 5201, + 'window': 0, + 'connect_timeout': 2000000, + 'blockcount': '100K', + 'tcp': {'bitrate': '10M'}, + 'udp': {'bitrate': 50, 'length': 9595}, + }, + }, +] diff --git a/openwisp_monitoring/check/tests/test_iperf3.py b/openwisp_monitoring/check/tests/test_iperf3.py new file mode 100644 index 000000000..80eb7b2f6 --- /dev/null +++ b/openwisp_monitoring/check/tests/test_iperf3.py @@ -0,0 +1,816 @@ +from json import loads +from unittest.mock import call, patch + +from django.core.cache import cache +from django.core.exceptions import ValidationError +from django.test import TransactionTestCase +from swapper import load_model + +from openwisp_controller.connection.connectors.ssh import Ssh +from openwisp_controller.connection.models import DeviceConnection +from openwisp_controller.connection.settings import CONNECTORS, UPDATE_STRATEGIES +from openwisp_controller.connection.tests.utils import CreateConnectionsMixin, SshServer +from openwisp_monitoring.check.classes.iperf3 import get_iperf3_schema +from openwisp_monitoring.check.classes.iperf3 import logger as iperf3_logger + +from ...device.tests import TestDeviceMonitoringMixin +from .. import settings as app_settings +from ..classes import Iperf3 +from .iperf3_test_utils import ( + INVALID_PARAMS, + PARAM_ERROR, + RESULT_AUTH_FAIL, + RESULT_FAIL, + RESULT_TCP, + RESULT_UDP, + TEST_RSA_KEY, +) + +Check = load_model('check', 'Check') +Chart = load_model('monitoring', 'Chart') +Metric = load_model('monitoring', 'Metric') +AlertSettings = load_model('monitoring', 'AlertSettings') + + +class TestIperf3( + CreateConnectionsMixin, TestDeviceMonitoringMixin, TransactionTestCase +): + + _IPERF3 = app_settings.CHECK_CLASSES[2][0] + _RESULT_KEYS = [ + 'iperf3_result', + 'sent_bps_tcp', + 'received_bps_tcp', + 'sent_bytes_tcp', + 'received_bytes_tcp', + 'retransmits', + 'sent_bps_udp', + 'sent_bytes_udp', + 'jitter', + 'total_packets', + 'lost_packets', + 'lost_percent', + ] + _IPERF3_TEST_SERVER = ['iperf3.openwisptestserver.com'] + _IPERF3_TEST_MULTIPLE_SERVERS = [ + 'iperf3.openwisptestserver1.com', + 'iperf3.openwisptestserver2.com', + ] + + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.mock_ssh_server = SshServer( + {'root': cls._TEST_RSA_PRIVATE_KEY_PATH} + ).__enter__() + cls.ssh_server.port = cls.mock_ssh_server.port + + @classmethod + def tearDownClass(cls): + super().tearDownClass() + cls.mock_ssh_server.__exit__() + app_settings.IPERF3_CHECK_CONFIG = {} + + def setUp(self): + ckey = self._create_credentials_with_key(port=self.ssh_server.port) + self.dc = self._create_device_connection(credentials=ckey) + self.device = self.dc.device + self.org_id = str(self.device.organization.id) + self.dc.connect() + app_settings.IPERF3_CHECK_CONFIG = { + self.org_id: {'host': self._IPERF3_TEST_SERVER} + } + self._EXPECTED_COMMAND_CALLS = [ + call( + ( + 'iperf3 -c iperf3.openwisptestserver.com -p 5201 -t 10 --connect-timeout 1000 ' + '-b 0 -l 128K -w 0 -P 1 -J' + ), + raise_unexpected_exit=False, + ), + call( + ( + 'iperf3 -c iperf3.openwisptestserver.com -p 5201 -t 10 --connect-timeout 1000 ' + '-b 30M -l 0 -w 0 -P 1 -u -J' + ), + raise_unexpected_exit=False, + ), + ] + self._EXPECTED_WARN_CALLS = [ + call( + ( + f'Iperf3 check failed for "{self.device}", ' + 'error - unable to connect to server: Connection refused' + ) + ), + call( + ( + f'Iperf3 check failed for "{self.device}", ' + 'error - unable to connect to server: Connection refused' + ) + ), + ] + + def _perform_iperf3_check(self, object_id=None): + if not object_id: + object_id = self.device.id + check = Check.objects.get(check_type=self._IPERF3, object_id=object_id) + return check.perform_check(store=False) + + def _set_auth_expected_calls(self, config): + password = config[self.org_id]['password'] + username = config[self.org_id]['username'] + server = 'iperf3.openwisptestserver.com' + test_prefix = '-----BEGIN PUBLIC KEY-----\n' + test_suffix = '\n-----END PUBLIC KEY-----' + key = config[self.org_id]['rsa_public_key'] + rsa_key_path = '/tmp/iperf3-public-key.pem' + + self._EXPECTED_COMMAND_CALLS = [ + call( + ( + f'echo "{test_prefix}{key}{test_suffix}" > {rsa_key_path} && ' + f'IPERF3_PASSWORD="{password}" iperf3 -c {server} -p 5201 -t 10 ' + f'--username "{username}" --rsa-public-key-path {rsa_key_path} --connect-timeout 1000 ' + f'-b 0 -l 128K -w 0 -P 1 -J' + ), + raise_unexpected_exit=False, + ), + call( + ( + f'IPERF3_PASSWORD="{password}" iperf3 -c {server} -p 5201 -t 10 ' + f'--username "{username}" --rsa-public-key-path {rsa_key_path} --connect-timeout 1000 ' + f'-b 30M -l 0 -w 0 -P 1 -u -J ' + f'&& rm -f {rsa_key_path}' + ), + raise_unexpected_exit=False, + ), + ] + + def _assert_iperf3_fail_result(self, result): + for key in self._RESULT_KEYS: + self.assertIn(key, result) + self.assertEqual(result['iperf3_result'], 0) + self.assertEqual(result['sent_bps_tcp'], 0.0) + self.assertEqual(result['received_bps_tcp'], 0.0) + self.assertEqual(result['sent_bytes_tcp'], 0) + self.assertEqual(result['received_bytes_tcp'], 0) + self.assertEqual(result['retransmits'], 0) + self.assertEqual(result['sent_bps_udp'], 0.0) + self.assertEqual(result['sent_bytes_udp'], 0) + self.assertEqual(result['jitter'], 0.0) + self.assertEqual(result['total_packets'], 0) + self.assertEqual(result['lost_percent'], 0.0) + + @patch.object(Ssh, 'exec_command') + @patch.object(iperf3_logger, 'warning') + def test_iperf3_check_no_params(self, mock_warn, mock_exec_command): + mock_exec_command.side_effect = [(RESULT_TCP, 0), (RESULT_UDP, 0)] + # By default check params {} + tcp_result = loads(RESULT_TCP)['end'] + udp_result = loads(RESULT_UDP)['end']['sum'] + result = self._perform_iperf3_check() + for key in self._RESULT_KEYS: + self.assertIn(key, result) + self.assertEqual(result['iperf3_result'], 1) + self.assertEqual( + result['sent_bps_tcp'], tcp_result['sum_sent']['bits_per_second'] + ) + self.assertEqual( + result['received_bytes_tcp'], tcp_result['sum_received']['bytes'] + ) + self.assertEqual(result['jitter'], udp_result['jitter_ms']) + self.assertEqual(result['total_packets'], udp_result['packets']) + self.assertEqual(mock_warn.call_count, 0) + self.assertEqual(mock_exec_command.call_count, 2) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + + @patch.object(Ssh, 'exec_command') + @patch.object(iperf3_logger, 'warning') + def test_iperf3_check_params(self, mock_warn, mock_exec_command): + mock_exec_command.side_effect = [(RESULT_TCP, 0), (RESULT_UDP, 0)] + check = Check.objects.get(check_type=self._IPERF3) + tcp_result = loads(RESULT_TCP)['end'] + udp_result = loads(RESULT_UDP)['end']['sum'] + server = self._IPERF3_TEST_SERVER[0] + test_prefix = '-----BEGIN PUBLIC KEY-----\n' + test_suffix = '\n-----END PUBLIC KEY-----' + rsa_key_path = '/tmp/test-rsa.pem' + test_params = { + 'username': 'openwisp-test-user', + 'password': 'openwisp_pass', + 'rsa_public_key': TEST_RSA_KEY, + 'client_options': { + 'port': 6201, + 'time': 20, + 'window': '300K', + 'parallel': 5, + 'reverse': True, + 'connect_timeout': 1000, + 'tcp': {'bitrate': '10M', 'length': '128K'}, + 'udp': {'bitrate': '50M', 'length': '400K'}, + }, + } + time = test_params['client_options']['time'] + port = test_params['client_options']['port'] + window = test_params['client_options']['window'] + parallel = test_params['client_options']['parallel'] + tcp_bitrate = test_params['client_options']['tcp']['bitrate'] + tcp_len = test_params['client_options']['tcp']['length'] + udp_bitrate = test_params['client_options']['udp']['bitrate'] + udp_len = test_params['client_options']['udp']['length'] + username = test_params['username'] + password = test_params['password'] + key = test_params['rsa_public_key'] + rsa_key_path = '/tmp/iperf3-public-key.pem' + check.params = test_params + check.save() + self._EXPECTED_COMMAND_CALLS = [ + call( + ( + f'echo "{test_prefix}{key}{test_suffix}" > {rsa_key_path} && ' + f'IPERF3_PASSWORD="{password}" iperf3 -c {server} -p {port} -t {time} ' + f'--username "{username}" --rsa-public-key-path {rsa_key_path} --connect-timeout 1000 ' + f'-b {tcp_bitrate} -l {tcp_len} -w {window} -P {parallel} --reverse -J' + ), + raise_unexpected_exit=False, + ), + call( + ( + f'IPERF3_PASSWORD="{password}" iperf3 -c {server} -p {port} -t {time} ' + f'--username "{username}" --rsa-public-key-path {rsa_key_path} --connect-timeout 1000 ' + f'-b {udp_bitrate} -l {udp_len} -w {window} -P {parallel} --reverse -u -J ' + f'&& rm -f {rsa_key_path}' + ), + raise_unexpected_exit=False, + ), + ] + result = self._perform_iperf3_check() + for key in self._RESULT_KEYS: + self.assertIn(key, result) + self.assertEqual(result['iperf3_result'], 1) + self.assertEqual( + result['sent_bps_tcp'], tcp_result['sum_sent']['bits_per_second'] + ) + self.assertEqual( + result['received_bytes_tcp'], tcp_result['sum_received']['bytes'] + ) + self.assertEqual(result['jitter'], udp_result['jitter_ms']) + self.assertEqual(result['total_packets'], udp_result['packets']) + self.assertEqual(mock_warn.call_count, 0) + self.assertEqual(mock_exec_command.call_count, 2) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + + @patch.object(Ssh, 'exec_command') + @patch.object(iperf3_logger, 'warning') + def test_iperf3_check_config(self, mock_warn, mock_exec_command): + mock_exec_command.side_effect = [(RESULT_TCP, 0), (RESULT_UDP, 0)] + tcp_result = loads(RESULT_TCP)['end'] + udp_result = loads(RESULT_UDP)['end']['sum'] + self._EXPECTED_COMMAND_CALLS = [ + call( + ( + 'iperf3 -c iperf3.openwisptestserver.com -p 9201 -k 1M --connect-timeout 2000 ' + '-b 10M -l 512K -w 0 -P 1 --bidir -J' + ), + raise_unexpected_exit=False, + ), + call( + ( + 'iperf3 -c iperf3.openwisptestserver.com -p 9201 -k 1M --connect-timeout 2000 ' + '-b 50M -l 256K -w 0 -P 1 --bidir -u -J' + ), + raise_unexpected_exit=False, + ), + ] + iperf3_config = { + self.org_id: { + 'host': ['iperf3.openwisptestserver.com'], + 'client_options': { + 'port': 9201, + 'time': 120, + 'connect_timeout': 2000, + 'bytes': '20M', + 'blockcount': '1M', + 'bidirectional': True, + 'tcp': {'bitrate': '10M', 'length': '512K'}, + 'udp': {'bitrate': '50M', 'length': '256K'}, + }, + } + } + with patch.object(app_settings, 'IPERF3_CHECK_CONFIG', iperf3_config): + with patch.object(Iperf3, 'schema', get_iperf3_schema()): + result = self._perform_iperf3_check() + for key in self._RESULT_KEYS: + self.assertIn(key, result) + self.assertEqual(result['iperf3_result'], 1) + self.assertEqual( + result['sent_bps_tcp'], tcp_result['sum_sent']['bits_per_second'] + ) + self.assertEqual( + result['received_bytes_tcp'], tcp_result['sum_received']['bytes'] + ) + self.assertEqual(result['jitter'], udp_result['jitter_ms']) + self.assertEqual(result['total_packets'], udp_result['packets']) + self.assertEqual(mock_warn.call_count, 0) + self.assertEqual(mock_exec_command.call_count, 2) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + + @patch.object(iperf3_logger, 'warning') + def test_iperf3_device_connection(self, mock_warn): + dc = self.dc + + with self.subTest( + 'Test iperf3 check active device connection when the management tunnel is down' + ): + with patch.object( + DeviceConnection, 'connect', return_value=False + ) as mocked_connect: + self._perform_iperf3_check() + mock_warn.assert_called_once_with( + f'Failed to get a working DeviceConnection for "{self.device}", iperf3 check skipped!' + ) + self.assertEqual(mocked_connect.call_count, 1) + mock_warn.reset_mock() + + with self.subTest('Test iperf3 check when device connection is not enabled'): + dc.enabled = False + dc.save() + self._perform_iperf3_check() + mock_warn.assert_called_once_with( + f'Failed to get a working DeviceConnection for "{self.device}", iperf3 check skipped!' + ) + mock_warn.reset_mock() + + with self.subTest( + 'Test iperf3 check with different credential connector type ie. snmp' + ): + device2 = self._create_device( + name='test-device-2', mac_address='00:11:22:33:44:66' + ) + params = {'community': 'public', 'agent': 'snmp-agent', 'port': 161} + snmp_credentials = self._create_credentials( + params=params, connector=CONNECTORS[1][0], auto_add=True + ) + dc2 = self._create_device_connection( + device=device2, + credentials=snmp_credentials, + update_strategy=UPDATE_STRATEGIES[0][0], + ) + dc2.is_working = True + dc2.enabled = True + dc2.save() + self._perform_iperf3_check(object_id=device2.id) + mock_warn.assert_called_once_with( + f'Failed to get a working DeviceConnection for "{device2}", iperf3 check skipped!' + ) + + @patch.object(iperf3_logger, 'info') + def test_iperf3_check_device_monitoring_critical(self, mock_info): + self.device.monitoring.update_status('critical') + self._perform_iperf3_check() + mock_info.assert_called_once_with( + ( + f'"{self.device}" DeviceMonitoring ' + 'health status is "critical", iperf3 check skipped!' + ) + ) + + def test_iperf3_check_content_object_none(self): + check = Check(name='Iperf3 check', check_type=self._IPERF3, params={}) + try: + check.check_instance.validate() + except ValidationError as e: + self.assertIn('device', str(e)) + else: + self.fail('ValidationError not raised') + + def test_iperf3_check_content_object_not_device(self): + check = Check( + name='Iperf3 check', + check_type=self._IPERF3, + content_object=self._create_user(), + params={}, + ) + try: + check.check_instance.validate() + except ValidationError as e: + self.assertIn('device', str(e)) + else: + self.fail('ValidationError not raised') + + def test_iperf3_check_schema_violation(self): + for invalid_param in INVALID_PARAMS: + check = Check( + name='Iperf3 check', + check_type=self._IPERF3, + content_object=self.device, + params=invalid_param, + ) + try: + check.check_instance.validate() + except ValidationError as e: + self.assertIn('Invalid param', str(e)) + else: + self.fail('ValidationError not raised') + + @patch.object(Ssh, 'exec_command') + @patch.object(iperf3_logger, 'warning') + def test_iperf3_check(self, mock_warn, mock_exec_command): + error = "ash: iperf3: not found" + tcp_result = loads(RESULT_TCP)['end'] + udp_result = loads(RESULT_UDP)['end']['sum'] + iperf3_json_error_config = { + self.org_id: { + 'host': ['iperf3.openwisptestserver.com'], + 'username': 'test', + 'password': 'testpass', + 'rsa_public_key': 'INVALID_RSA_KEY', + } + } + with patch.object( + app_settings, 'IPERF3_CHECK_CONFIG', iperf3_json_error_config + ): + with self.subTest('Test iperf3 errors not in json format'): + mock_exec_command.side_effect = [(PARAM_ERROR, 1), (PARAM_ERROR, 1)] + EXPECTED_WARN_CALLS = [ + call( + f'Iperf3 check failed for "{self.device}", error - {PARAM_ERROR}' + ), + call( + f'Iperf3 check failed for "{self.device}", error - {PARAM_ERROR}' + ), + ] + self._perform_iperf3_check() + self.assertEqual(mock_warn.call_count, 2) + self.assertEqual(mock_exec_command.call_count, 2) + mock_warn.assert_has_calls(EXPECTED_WARN_CALLS) + mock_warn.reset_mock() + mock_exec_command.reset_mock() + + with self.subTest('Test iperf3 is not installed on the device'): + mock_exec_command.side_effect = [(error, 127)] + self._perform_iperf3_check() + mock_warn.assert_called_with( + f'Iperf3 is not installed on the "{self.device}", error - {error}' + ) + self.assertEqual(mock_warn.call_count, 1) + self.assertEqual(mock_exec_command.call_count, 1) + mock_warn.reset_mock() + mock_exec_command.reset_mock() + + with self.subTest('Test iperf3 check passes in both TCP & UDP'): + mock_exec_command.side_effect = [(RESULT_TCP, 0), (RESULT_UDP, 0)] + self.assertEqual(Chart.objects.count(), 2) + self.assertEqual(Metric.objects.count(), 2) + result = self._perform_iperf3_check() + for key in self._RESULT_KEYS: + self.assertIn(key, result) + self.assertEqual(result['iperf3_result'], 1) + self.assertEqual( + result['sent_bps_tcp'], tcp_result['sum_sent']['bits_per_second'] + ) + self.assertEqual( + result['received_bps_tcp'], + tcp_result['sum_received']['bits_per_second'], + ) + self.assertEqual(result['sent_bytes_tcp'], tcp_result['sum_sent']['bytes']) + self.assertEqual( + result['received_bytes_tcp'], tcp_result['sum_received']['bytes'] + ) + self.assertEqual( + result['retransmits'], tcp_result['sum_sent']['retransmits'] + ) + self.assertEqual(result['sent_bps_udp'], udp_result['bits_per_second']) + self.assertEqual(result['sent_bytes_udp'], udp_result['bytes']) + self.assertEqual(result['jitter'], udp_result['jitter_ms']) + self.assertEqual(result['total_packets'], udp_result['packets']) + self.assertEqual(result['lost_percent'], udp_result['lost_percent']) + self.assertEqual(Chart.objects.count(), 8) + self.assertEqual(Check.objects.count(), 3) + iperf3_metric = Metric.objects.get(key='iperf3') + self.assertEqual(Metric.objects.count(), 3) + self.assertEqual(iperf3_metric.content_object, self.device) + points = self._read_metric( + iperf3_metric, limit=None, extra_fields=list(result.keys()) + ) + self.assertEqual(len(points), 1) + self.assertEqual(points[0]['iperf3_result'], result['iperf3_result']) + self.assertEqual(points[0]['sent_bps_tcp'], result['sent_bps_tcp']) + self.assertEqual( + points[0]['received_bytes_tcp'], result['received_bytes_tcp'] + ) + self.assertEqual(points[0]['retransmits'], result['retransmits']) + self.assertEqual(points[0]['sent_bps_udp'], result['sent_bps_udp']) + self.assertEqual(points[0]['sent_bytes_udp'], result['sent_bytes_udp']) + self.assertEqual(points[0]['jitter'], result['jitter']) + self.assertEqual(points[0]['total_packets'], result['total_packets']) + self.assertEqual(points[0]['lost_packets'], result['lost_packets']) + self.assertEqual(points[0]['lost_percent'], result['lost_percent']) + self.assertEqual(mock_warn.call_count, 0) + self.assertEqual(mock_exec_command.call_count, 2) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + mock_warn.reset_mock() + mock_exec_command.reset_mock() + + with self.subTest('Test iperf3 check fails in both TCP & UDP'): + mock_exec_command.side_effect = [(RESULT_FAIL, 1), (RESULT_FAIL, 1)] + result = self._perform_iperf3_check() + self._assert_iperf3_fail_result(result) + self.assertEqual(Chart.objects.count(), 8) + self.assertEqual(Metric.objects.count(), 3) + self.assertEqual(mock_warn.call_count, 2) + self.assertEqual(mock_exec_command.call_count, 2) + mock_warn.assert_has_calls(self._EXPECTED_WARN_CALLS) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + mock_warn.reset_mock() + mock_exec_command.reset_mock() + + with self.subTest('Test iperf3 check TCP pass UDP fail'): + mock_exec_command.side_effect = [(RESULT_TCP, 0), (RESULT_FAIL, 1)] + result = self._perform_iperf3_check() + for key in self._RESULT_KEYS: + self.assertIn(key, result) + self.assertEqual(result['iperf3_result'], 1) + self.assertEqual( + result['sent_bps_tcp'], tcp_result['sum_sent']['bits_per_second'] + ) + self.assertEqual( + result['received_bps_tcp'], + tcp_result['sum_received']['bits_per_second'], + ) + self.assertEqual(result['sent_bytes_tcp'], tcp_result['sum_sent']['bytes']) + self.assertEqual( + result['received_bytes_tcp'], tcp_result['sum_received']['bytes'] + ) + self.assertEqual( + result['retransmits'], tcp_result['sum_sent']['retransmits'] + ) + self.assertEqual(result['sent_bps_udp'], 0.0) + self.assertEqual(result['sent_bytes_udp'], 0) + self.assertEqual(result['jitter'], 0.0) + self.assertEqual(result['total_packets'], 0) + self.assertEqual(result['lost_percent'], 0.0) + self.assertEqual(Chart.objects.count(), 8) + self.assertEqual(Metric.objects.count(), 3) + self.assertEqual(mock_warn.call_count, 1) + self.assertEqual(mock_exec_command.call_count, 2) + mock_warn.assert_has_calls(self._EXPECTED_WARN_CALLS[1:]) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + mock_warn.reset_mock() + mock_exec_command.reset_mock() + + with self.subTest('Test iperf3 check TCP fail UDP pass'): + mock_exec_command.side_effect = [(RESULT_FAIL, 1), (RESULT_UDP, 0)] + result = self._perform_iperf3_check() + for key in self._RESULT_KEYS: + self.assertIn(key, result) + self.assertEqual(result['iperf3_result'], 1) + self.assertEqual(result['sent_bps_tcp'], 0.0) + self.assertEqual(result['received_bps_tcp'], 0.0) + self.assertEqual(result['sent_bytes_tcp'], 0) + self.assertEqual(result['received_bytes_tcp'], 0) + self.assertEqual(result['retransmits'], 0) + self.assertEqual(result['sent_bps_udp'], udp_result['bits_per_second']) + self.assertEqual(result['sent_bytes_udp'], udp_result['bytes']) + self.assertEqual(result['jitter'], udp_result['jitter_ms']) + self.assertEqual(result['total_packets'], udp_result['packets']) + self.assertEqual(result['lost_percent'], udp_result['lost_percent']) + self.assertEqual(Chart.objects.count(), 8) + self.assertEqual(Metric.objects.count(), 3) + self.assertEqual(mock_warn.call_count, 1) + self.assertEqual(mock_exec_command.call_count, 2) + mock_warn.assert_has_calls(self._EXPECTED_WARN_CALLS[1:]) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + + @patch.object(Ssh, 'exec_command') + @patch.object(iperf3_logger, 'warning') + def test_iperf3_check_auth_config(self, mock_warn, mock_exec_command): + iperf3_config = { + self.org_id: { + 'host': self._IPERF3_TEST_SERVER, + 'username': 'test', + 'password': 'testpass', + 'rsa_public_key': TEST_RSA_KEY, + } + } + iperf3_conf_wrong_pass = { + self.org_id: { + 'host': self._IPERF3_TEST_SERVER, + 'username': 'test', + 'password': 'wrongpass', + 'rsa_public_key': TEST_RSA_KEY, + } + } + iperf3_conf_wrong_user = { + self.org_id: { + 'host': self._IPERF3_TEST_SERVER, + 'username': 'wronguser', + 'password': 'testpass', + 'rsa_public_key': TEST_RSA_KEY, + } + } + auth_error = "test authorization failed" + tcp_result = loads(RESULT_TCP)['end'] + udp_result = loads(RESULT_UDP)['end']['sum'] + + self._EXPECTED_WARN_CALLS = [ + call(f'Iperf3 check failed for "{self.device}", error - {auth_error}'), + call(f'Iperf3 check failed for "{self.device}", error - {auth_error}'), + ] + with self.subTest('Test iperf3 check with right config'): + with patch.object( + app_settings, + 'IPERF3_CHECK_CONFIG', + iperf3_config + # It is required to mock "Iperf3.schema" here so that it + # uses the updated configuration from "IPERF3_CHECK_CONFIG" setting. + ), patch.object(Iperf3, 'schema', get_iperf3_schema()): + self._set_auth_expected_calls(iperf3_config) + mock_exec_command.side_effect = [(RESULT_TCP, 0), (RESULT_UDP, 0)] + result = self._perform_iperf3_check() + for key in self._RESULT_KEYS: + self.assertIn(key, result) + self.assertEqual(result['iperf3_result'], 1) + self.assertEqual( + result['sent_bps_tcp'], tcp_result['sum_sent']['bits_per_second'] + ) + self.assertEqual( + result['received_bytes_tcp'], tcp_result['sum_received']['bytes'] + ) + self.assertEqual(result['jitter'], udp_result['jitter_ms']) + self.assertEqual(result['total_packets'], udp_result['packets']) + self.assertEqual(mock_warn.call_count, 0) + self.assertEqual(mock_exec_command.call_count, 2) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + mock_warn.reset_mock() + mock_exec_command.reset_mock() + + with self.subTest('Test iperf3 check with wrong password'): + with patch.object( + app_settings, 'IPERF3_CHECK_CONFIG', iperf3_conf_wrong_pass + ), patch.object(Iperf3, 'schema', get_iperf3_schema()): + self._set_auth_expected_calls(iperf3_conf_wrong_pass) + mock_exec_command.side_effect = [ + (RESULT_AUTH_FAIL, 1), + (RESULT_AUTH_FAIL, 1), + ] + + result = self._perform_iperf3_check() + self._assert_iperf3_fail_result(result) + self.assertEqual(mock_warn.call_count, 2) + self.assertEqual(mock_exec_command.call_count, 2) + mock_warn.assert_has_calls(self._EXPECTED_WARN_CALLS) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + mock_warn.reset_mock() + mock_exec_command.reset_mock() + + with self.subTest('Test iperf3 check with wrong username'): + with patch.object( + app_settings, 'IPERF3_CHECK_CONFIG', iperf3_conf_wrong_user + ), patch.object(Iperf3, 'schema', get_iperf3_schema()): + self._set_auth_expected_calls(iperf3_conf_wrong_user) + mock_exec_command.side_effect = [ + (RESULT_AUTH_FAIL, 1), + (RESULT_AUTH_FAIL, 1), + ] + + result = self._perform_iperf3_check() + self._assert_iperf3_fail_result(result) + self.assertEqual(mock_warn.call_count, 2) + self.assertEqual(mock_exec_command.call_count, 2) + mock_warn.assert_has_calls(self._EXPECTED_WARN_CALLS) + mock_exec_command.assert_has_calls(self._EXPECTED_COMMAND_CALLS) + + @patch.object(Ssh, 'exec_command') + @patch.object(iperf3_logger, 'warning') + @patch.object(iperf3_logger, 'info') + @patch.object(cache, 'add') + def test_iperf3_check_task_with_multiple_server_config(self, *args): + mock_add = args[0] + mock_info = args[1] + mock_warn = args[2] + mock_exec_command = args[3] + org = self.device.organization + iperf3_multiple_server_config = { + self.org_id: {'host': self._IPERF3_TEST_MULTIPLE_SERVERS} + } + check = Check.objects.get(check_type=self._IPERF3) + + self._EXPECTED_COMMAND_CALLS_SERVER_1 = [ + call( + ( + f'iperf3 -c {self._IPERF3_TEST_MULTIPLE_SERVERS[0]} -p 5201 -t 10 --connect-timeout 1000 ' + '-b 0 -l 128K -w 0 -P 1 -J' + ), + raise_unexpected_exit=False, + ), + call( + ( + f'iperf3 -c {self._IPERF3_TEST_MULTIPLE_SERVERS[0]} -p 5201 -t 10 --connect-timeout 1000 ' + '-b 30M -l 0 -w 0 -P 1 -u -J' + ), + raise_unexpected_exit=False, + ), + ] + self._EXPECTED_COMMAND_CALLS_SERVER_2 = [ + call( + ( + f'iperf3 -c {self._IPERF3_TEST_MULTIPLE_SERVERS[1]} -p 5201 -t 10 --connect-timeout 1000 ' + '-b 0 -l 128K -w 0 -P 1 -J' + ), + raise_unexpected_exit=False, + ), + call( + ( + f'iperf3 -c {self._IPERF3_TEST_MULTIPLE_SERVERS[1]} -p 5201 -t 10 --connect-timeout 1000 ' + '-b 30M -l 0 -w 0 -P 1 -u -J' + ), + raise_unexpected_exit=False, + ), + ] + + with patch.object(app_settings, 'IPERF3_CHECK_CONFIG', {}): + with self.subTest('Test iperf3 check without config'): + self._perform_iperf3_check() + mock_warn.assert_called_with( + ( + f'Iperf3 servers for organization "{org}" ' + f'is not configured properly, iperf3 check skipped!' + ) + ) + self.assertEqual(mock_warn.call_count, 1) + mock_warn.reset_mock() + + with patch.object( + app_settings, + 'IPERF3_CHECK_CONFIG', + {'invalid_org_uuid': {'host': self._IPERF3_TEST_SERVER, 'time': 10}}, + ): + with self.subTest('Test iperf3 check with invalid config'): + self._perform_iperf3_check() + mock_warn.assert_called_with( + ( + f'Iperf3 servers for organization "{org}" ' + f'is not configured properly, iperf3 check skipped!' + ) + ) + self.assertEqual(mock_warn.call_count, 1) + mock_warn.reset_mock() + + with patch.object( + app_settings, 'IPERF3_CHECK_CONFIG', iperf3_multiple_server_config + ): + with self.subTest( + 'Test iperf3 check when all iperf3 servers are available' + ): + mock_add.return_value = True + mock_exec_command.side_effect = [(RESULT_TCP, 0), (RESULT_UDP, 0)] + self._perform_iperf3_check() + self.assertEqual(mock_warn.call_count, 0) + self.assertEqual(mock_add.call_count, 1) + self.assertEqual(mock_exec_command.call_count, 2) + mock_exec_command.assert_has_calls( + self._EXPECTED_COMMAND_CALLS_SERVER_1 + ) + mock_add.reset_mock() + mock_warn.reset_mock() + mock_exec_command.reset_mock() + + with self.subTest( + 'Test iperf3 check when single iperf3 server are available' + ): + mock_add.side_effect = [False, True] + mock_exec_command.side_effect = [(RESULT_TCP, 0), (RESULT_UDP, 0)] + self._perform_iperf3_check() + self.assertEqual(mock_warn.call_count, 0) + self.assertEqual(mock_add.call_count, 2) + self.assertEqual(mock_exec_command.call_count, 2) + mock_exec_command.assert_has_calls( + self._EXPECTED_COMMAND_CALLS_SERVER_2 + ) + mock_add.reset_mock() + mock_warn.reset_mock() + mock_exec_command.reset_mock() + + with self.subTest( + 'Test iperf3 check when all iperf3 servers are occupied initially' + ): + # If all available iperf3 servers are occupied initially, + # then push the task back in the queue and acquire the iperf3 + # server only after completion of previous running checks + mock_add.side_effect = [False, False, True] + mock_exec_command.side_effect = [(RESULT_TCP, 0), (RESULT_UDP, 0)] + self._perform_iperf3_check() + mock_info.has_called_with( + ( + f'At the moment, all available iperf3 servers of organization "{org}" ' + f'are busy running checks, putting "{check}" back in the queue..' + ) + ) + self.assertEqual(mock_info.call_count, 4) + self.assertEqual(mock_add.call_count, 3) + self.assertEqual(mock_exec_command.call_count, 2) + mock_exec_command.assert_has_calls( + self._EXPECTED_COMMAND_CALLS_SERVER_1 + ) diff --git a/openwisp_monitoring/check/tests/test_models.py b/openwisp_monitoring/check/tests/test_models.py index abbf8ed13..c0e5aef8c 100644 --- a/openwisp_monitoring/check/tests/test_models.py +++ b/openwisp_monitoring/check/tests/test_models.py @@ -9,8 +9,8 @@ from ...device.tests import TestDeviceMonitoringMixin from .. import settings as app_settings -from ..classes import ConfigApplied, Ping -from ..tasks import auto_create_config_check, auto_create_ping +from ..classes import ConfigApplied, Iperf3, Ping +from ..tasks import auto_create_config_check, auto_create_iperf3_check, auto_create_ping Check = load_model('check', 'Check') Metric = load_model('monitoring', 'Metric') @@ -22,6 +22,7 @@ class TestModels(TestDeviceMonitoringMixin, TransactionTestCase): _PING = app_settings.CHECK_CLASSES[0][0] _CONFIG_APPLIED = app_settings.CHECK_CLASSES[1][0] + _IPERF3 = app_settings.CHECK_CLASSES[2][0] def test_check_str(self): c = Check(name='Test check') @@ -48,6 +49,12 @@ def test_check_class(self): check_type=self._CONFIG_APPLIED, ) self.assertEqual(c.check_class, ConfigApplied) + with self.subTest('Test Iperf3 check Class'): + c = Check( + name='Iperf3 class check', + check_type=self._IPERF3, + ) + self.assertEqual(c.check_class, Iperf3) def test_base_check_class(self): path = 'openwisp_monitoring.check.classes.base.BaseCheck' @@ -82,6 +89,18 @@ def test_check_instance(self): self.assertEqual(i.related_object, obj) self.assertEqual(i.params, c.params) + with self.subTest('Test Iperf3 check instance'): + c = Check( + name='Iperf3 class check', + check_type=self._IPERF3, + content_object=obj, + params={}, + ) + i = c.check_instance + self.assertIsInstance(i, Iperf3) + self.assertEqual(i.related_object, obj) + self.assertEqual(i.params, c.params) + def test_validation(self): with self.subTest('Test Ping check validation'): check = Check(name='Ping check', check_type=self._PING, params={}) @@ -105,7 +124,7 @@ def test_validation(self): def test_auto_check_creation(self): self.assertEqual(Check.objects.count(), 0) d = self._create_device(organization=self._create_org()) - self.assertEqual(Check.objects.count(), 2) + self.assertEqual(Check.objects.count(), 3) with self.subTest('Test AUTO_PING'): c1 = Check.objects.filter(check_type=self._PING).first() self.assertEqual(c1.content_object, d) @@ -114,61 +133,70 @@ def test_auto_check_creation(self): c2 = Check.objects.filter(check_type=self._CONFIG_APPLIED).first() self.assertEqual(c2.content_object, d) self.assertEqual(self._CONFIG_APPLIED, c2.check_type) + with self.subTest('Test AUTO_IPERF3'): + c3 = Check.objects.filter(check_type=self._IPERF3).first() + self.assertEqual(c3.content_object, d) + self.assertEqual(self._IPERF3, c3.check_type) def test_device_deleted(self): self.assertEqual(Check.objects.count(), 0) d = self._create_device(organization=self._create_org()) - self.assertEqual(Check.objects.count(), 2) + self.assertEqual(Check.objects.count(), 3) d.delete() self.assertEqual(Check.objects.count(), 0) - @patch('openwisp_monitoring.check.settings.AUTO_PING', False) def test_config_modified_device_problem(self): self._create_admin() self.assertEqual(Check.objects.count(), 0) - self._create_config(status='modified', organization=self._create_org()) + with freeze_time( + now() - timedelta(minutes=app_settings.CONFIG_CHECK_INTERVAL + 10) + ): + self._create_config(status='modified', organization=self._create_org()) d = Device.objects.first() d.monitoring.update_status('ok') - self.assertEqual(Check.objects.count(), 2) - self.assertEqual(Metric.objects.count(), 0) + self.assertEqual(Check.objects.count(), 3) + self.assertEqual(Metric.objects.filter(object_id=d.id).count(), 0) self.assertEqual(AlertSettings.objects.count(), 0) check = Check.objects.filter(check_type=self._CONFIG_APPLIED).first() with freeze_time(now() - timedelta(minutes=10)): check.perform_check() - self.assertEqual(Metric.objects.count(), 1) + self.assertEqual(Metric.objects.filter(object_id=d.id).count(), 1) self.assertEqual(AlertSettings.objects.count(), 1) # Check needs to be run again without mocking time for threshold crossed check.perform_check() - m = Metric.objects.first() + m = Metric.objects.filter(configuration='config_applied').first() self.assertEqual(m.content_object, d) self.assertEqual(m.key, 'config_applied') dm = d.monitoring dm.refresh_from_db() + m.refresh_from_db(fields=['is_healthy', 'is_healthy_tolerant']) self.assertEqual(m.is_healthy, False) self.assertEqual(m.is_healthy_tolerant, False) self.assertEqual(dm.status, 'problem') self.assertEqual(Notification.objects.count(), 1) - @patch('openwisp_monitoring.check.settings.AUTO_PING', False) def test_config_error(self): """ Test that ConfigApplied checks are skipped when device config status is errored """ self._create_admin() self.assertEqual(Check.objects.count(), 0) - self._create_config(status='error', organization=self._create_org()) + with freeze_time( + now() - timedelta(minutes=app_settings.CONFIG_CHECK_INTERVAL + 10) + ): + self._create_config(status='error', organization=self._create_org()) dm = Device.objects.first().monitoring dm.update_status('ok') - self.assertEqual(Check.objects.count(), 2) - self.assertEqual(Metric.objects.count(), 0) + self.assertEqual(Check.objects.count(), 3) + self.assertEqual(Metric.objects.filter(object_id=dm.id).count(), 0) self.assertEqual(AlertSettings.objects.count(), 0) check = Check.objects.filter(check_type=self._CONFIG_APPLIED).first() with freeze_time(now() - timedelta(minutes=10)): check.perform_check() # Check needs to be run again without mocking time for threshold crossed self.assertEqual(check.perform_check(), 0) - self.assertEqual(Metric.objects.count(), 1) - m = Metric.objects.first() + self.assertEqual(Metric.objects.filter(object_id=dm.device_id).count(), 1) + m = Metric.objects.filter(object_id=dm.device_id).first() self.assertEqual(AlertSettings.objects.count(), 1) dm.refresh_from_db() self.assertEqual(dm.status, 'problem') @@ -189,10 +217,12 @@ def test_config_error(self): 'openwisp_monitoring.device.base.models.app_settings.CRITICAL_DEVICE_METRICS', [{'key': 'config_applied', 'field_name': 'config_applied'}], ) - @patch('openwisp_monitoring.check.settings.AUTO_PING', False) def test_config_check_critical_metric(self): - self._create_config(status='modified', organization=self._create_org()) - self.assertEqual(Check.objects.count(), 2) + with freeze_time( + now() - timedelta(minutes=app_settings.CONFIG_CHECK_INTERVAL + 6) + ): + self._create_config(status='modified', organization=self._create_org()) + self.assertEqual(Check.objects.count(), 3) d = Device.objects.first() dm = d.monitoring dm.update_status('ok') @@ -211,7 +241,7 @@ def test_config_check_critical_metric(self): def test_no_duplicate_check_created(self): self._create_config(organization=self._create_org()) - self.assertEqual(Check.objects.count(), 2) + self.assertEqual(Check.objects.count(), 3) d = Device.objects.first() auto_create_config_check.delay( model=Device.__name__.lower(), @@ -223,13 +253,18 @@ def test_no_duplicate_check_created(self): app_label=Device._meta.app_label, object_id=str(d.pk), ) - self.assertEqual(Check.objects.count(), 2) + auto_create_iperf3_check.delay( + model=Device.__name__.lower(), + app_label=Device._meta.app_label, + object_id=str(d.pk), + ) + self.assertEqual(Check.objects.count(), 3) def test_device_unreachable_no_config_check(self): self._create_config(status='modified', organization=self._create_org()) d = self.device_model.objects.first() d.monitoring.update_status('critical') - self.assertEqual(Check.objects.count(), 2) + self.assertEqual(Check.objects.count(), 3) c2 = Check.objects.filter(check_type=self._CONFIG_APPLIED).first() c2.perform_check() self.assertEqual(Metric.objects.count(), 0) @@ -240,9 +275,50 @@ def test_device_unknown_no_config_check(self): self._create_config(status='modified', organization=self._create_org()) d = self.device_model.objects.first() d.monitoring.update_status('unknown') - self.assertEqual(Check.objects.count(), 2) + self.assertEqual(Check.objects.count(), 3) c2 = Check.objects.filter(check_type=self._CONFIG_APPLIED).first() c2.perform_check() self.assertEqual(Metric.objects.count(), 0) self.assertEqual(Notification.objects.count(), 0) self.assertIsNone(c2.perform_check()) + + def test_device_organization_disabled_check_not_performed(self): + self._create_config( + status='modified', organization=self._create_org(is_active=False) + ) + self.assertEqual(Check.objects.count(), 3) + check = Check.objects.filter(check_type=self._CONFIG_APPLIED).first() + with patch(f'{self._CONFIG_APPLIED}.check') as mocked_check: + check.perform_check() + mocked_check.assert_not_called() + + def test_config_check_problem_with_interval(self): + self._create_admin() + d = self._create_device(organization=self._create_org()) + self._create_config(device=d) + check = Check.objects.filter(check_type=self._CONFIG_APPLIED).first() + self.assertEqual(Check.objects.count(), 3) + self.assertEqual(AlertSettings.objects.count(), 0) + self.assertFalse(Metric.objects.filter(configuration='config_applied').exists()) + d.monitoring.update_status('ok') + # Running check just after config modified + check.perform_check() + d.monitoring.refresh_from_db() + self.assertTrue(Metric.objects.filter(configuration='config_applied').exists()) + metric = Metric.objects.get(configuration='config_applied', object_id=str(d.pk)) + # metric health should not change because the config + # hasn't been changed for more than the interval + self.assertTrue(metric.is_healthy) + # Device monitoring status should be remain unchanged + self.assertEqual(d.monitoring.status, 'ok') + self.assertEqual(AlertSettings.objects.count(), 1) + # Running check just when config was modified more than CONFIG_CHECK_INTERVAL ago + with freeze_time( + now() + timedelta(minutes=app_settings.CONFIG_CHECK_INTERVAL + 1) + ): + result = check.perform_check() + d.monitoring.refresh_from_db() + metric.refresh_from_db() + self.assertEqual(result, 0) + self.assertFalse(metric.is_healthy) + self.assertEqual(d.monitoring.status, 'problem') diff --git a/openwisp_monitoring/check/tests/test_ping.py b/openwisp_monitoring/check/tests/test_ping.py index 11b9ee47b..e519c9a33 100644 --- a/openwisp_monitoring/check/tests/test_ping.py +++ b/openwisp_monitoring/check/tests/test_ping.py @@ -90,7 +90,7 @@ def test_ping_check_config(self, *args): 'fping', '-e', '-c 22', - '-i 25', + '-p 25', '-b 1024', '-t 10000', '-q', @@ -239,7 +239,7 @@ def test_store_result(self, mocked_method): device.management_ip = '10.40.0.1' device.save() # check created automatically by autoping - self.assertEqual(Check.objects.count(), 2) + self.assertEqual(Check.objects.count(), 3) self.assertEqual(Metric.objects.count(), 0) self.assertEqual(Chart.objects.count(), 0) self.assertEqual(AlertSettings.objects.count(), 0) @@ -251,7 +251,7 @@ def test_store_result(self, mocked_method): m = Metric.objects.first() self.assertEqual(m.content_object, device) self.assertEqual(m.key, 'ping') - points = m.read(limit=None, extra_fields=list(result.keys())) + points = self._read_metric(m, limit=None, extra_fields=list(result.keys())) self.assertEqual(len(points), 1) self.assertEqual(points[0]['reachable'], result['reachable']) self.assertEqual(points[0]['loss'], result['loss']) diff --git a/openwisp_monitoring/db/backends/influxdb/client.py b/openwisp_monitoring/db/backends/influxdb/client.py index 0e7c7a8e1..906769a00 100644 --- a/openwisp_monitoring/db/backends/influxdb/client.py +++ b/openwisp_monitoring/db/backends/influxdb/client.py @@ -1,6 +1,7 @@ import logging import operator import re +import sys from collections import OrderedDict from datetime import datetime @@ -11,6 +12,7 @@ from django.utils.translation import gettext_lazy as _ from influxdb import InfluxDBClient from influxdb.exceptions import InfluxDBClientError +from influxdb.line_protocol import make_lines from openwisp_monitoring.utils import retry @@ -75,13 +77,49 @@ def drop_database(self): @cached_property def db(self): """Returns an ``InfluxDBClient`` instance""" - return InfluxDBClient( - TIMESERIES_DB['HOST'], - TIMESERIES_DB['PORT'], - TIMESERIES_DB['USER'], - TIMESERIES_DB['PASSWORD'], - self.db_name, - ) + return self.dbs['default'] + + @cached_property + def dbs(self): + dbs = { + 'default': InfluxDBClient( + TIMESERIES_DB['HOST'], + TIMESERIES_DB['PORT'], + TIMESERIES_DB['USER'], + TIMESERIES_DB['PASSWORD'], + self.db_name, + use_udp=TIMESERIES_DB.get('OPTIONS', {}).get('udp_writes', False), + udp_port=TIMESERIES_DB.get('OPTIONS', {}).get('udp_port', 8089), + ), + } + if TIMESERIES_DB.get('OPTIONS', {}).get('udp_writes', False): + # When using UDP, InfluxDB allows only using one retention policy + # per port. Therefore, we need to have different instances of + # InfluxDBClient. + dbs['short'] = InfluxDBClient( + TIMESERIES_DB['HOST'], + TIMESERIES_DB['PORT'], + TIMESERIES_DB['USER'], + TIMESERIES_DB['PASSWORD'], + self.db_name, + use_udp=TIMESERIES_DB.get('OPTIONS', {}).get('udp_writes', False), + udp_port=TIMESERIES_DB.get('OPTIONS', {}).get('udp_port', 8089) + 1, + ) + dbs['__all__'] = InfluxDBClient( + TIMESERIES_DB['HOST'], + TIMESERIES_DB['PORT'], + TIMESERIES_DB['USER'], + TIMESERIES_DB['PASSWORD'], + self.db_name, + ) + else: + dbs['short'] = dbs['default'] + dbs['__all__'] = dbs['default'] + return dbs + + @cached_property + def use_udp(self): + return TIMESERIES_DB.get('OPTIONS', {}).get('udp_writes', False) @retry def create_or_alter_retention_policy(self, name, duration): @@ -110,32 +148,75 @@ def query(self, query, precision=None, **kwargs): database=database, ) - def write(self, name, values, **kwargs): - point = {'measurement': name, 'tags': kwargs.get('tags'), 'fields': values} - timestamp = kwargs.get('timestamp') or now() - if isinstance(timestamp, datetime): - timestamp = timestamp.isoformat(sep='T', timespec='microseconds') - point['time'] = timestamp + def _write(self, points, database, retention_policy): + db = self.dbs['short'] if retention_policy else self.dbs['default'] + # If the size of data exceeds the limit of the UDP packet, then + # fallback to use TCP connection for writing data. + lines = make_lines({'points': points}) + if sys.getsizeof(lines) > 65000: + db = self.dbs['__all__'] try: - self.db.write( - {'points': [point]}, - { - 'db': kwargs.get('database') or self.db_name, - 'rp': kwargs.get('retention_policy'), - }, + db.write_points( + points=lines.split('\n')[:-1], + database=database, + retention_policy=retention_policy, + protocol='line', ) except Exception as exception: logger.warning(f'got exception while writing to tsdb: {exception}') if isinstance(exception, self.client_error): exception_code = getattr(exception, 'code', None) - exception_message = getattr(exception, 'content') - if ( - exception_code == 400 - and 'points beyond retention policy dropped' in exception_message - ): + # do not retry any request which returns 400 + if exception_code == 400: return raise TimeseriesWriteException + def _get_timestamp(self, timestamp=None): + timestamp = timestamp or now() + if isinstance(timestamp, datetime): + return timestamp.isoformat(sep='T', timespec='microseconds') + return timestamp + + def write(self, name, values, **kwargs): + timestamp = self._get_timestamp(timestamp=kwargs.get('timestamp')) + point = { + 'measurement': name, + 'tags': kwargs.get('tags'), + 'fields': values, + 'time': timestamp, + } + self._write( + points=[point], + database=kwargs.get('database') or self.db_name, + retention_policy=kwargs.get('retention_policy'), + ) + + def batch_write(self, metric_data): + data_points = {} + for data in metric_data: + org = data.get('database') or self.db_name + retention_policy = data.get('retention_policy') + if org not in data_points: + data_points[org] = {} + if retention_policy not in data_points[org]: + data_points[org][retention_policy] = [] + timestamp = self._get_timestamp(timestamp=data.get('timestamp')) + data_points[org][retention_policy].append( + { + 'measurement': data.get('name'), + 'tags': data.get('tags'), + 'fields': data.get('values'), + 'time': timestamp, + } + ) + for database in data_points.keys(): + for rp in data_points[database].keys(): + self._write( + points=data_points[database][rp], + database=database, + retention_policy=rp, + ) + def read(self, key, fields, tags, **kwargs): extra_fields = kwargs.get('extra_fields') since = kwargs.get('since') @@ -175,7 +256,24 @@ def read(self, key, fields, tags, **kwargs): return list(self.query(q, precision='s').get_points()) def get_list_query(self, query, precision='s'): - return list(self.query(query, precision=precision).get_points()) + result = self.query(query, precision=precision) + if not len(result.keys()) or result.keys()[0][1] is None: + return list(result.get_points()) + # Handles query which contains "GROUP BY TAG" clause + result_points = {} + for (measurement, tag), group_points in result.items(): + tag_suffix = '_'.join(tag.values()) + for point in group_points: + values = {} + for key, value in point.items(): + if key != 'time': + values[tag_suffix] = value + values['time'] = point['time'] + try: + result_points[values['time']].update(values) + except KeyError: + result_points[values['time']] = values + return list(result_points.values()) @retry def get_list_retention_policies(self): @@ -212,6 +310,10 @@ def _is_aggregate(self, q): return False def _clean_params(self, params): + if params.get('end_date'): + params['end_date'] = f'AND time <= \'{params["end_date"]}\'' + else: + params['end_date'] = '' for key, value in params.items(): if isinstance(value, list) or isinstance(value, tuple): params[key] = self._get_where_query(key, value) @@ -244,7 +346,12 @@ def get_query( query = f'{query} LIMIT 1' return f"{query} tz('{timezone}')" - _group_by_regex = re.compile(r'GROUP BY time\(\w+\)', flags=re.IGNORECASE) + _group_by_time_tag_regex = re.compile( + r'GROUP BY ((time\(\w+\))(?:,\s+\w+)?)', flags=re.IGNORECASE + ) + _group_by_time_regex = re.compile(r'GROUP BY time\(\w+\)\s?', flags=re.IGNORECASE) + _time_regex = re.compile(r'time\(\w+\)\s?', flags=re.IGNORECASE) + _time_comma_regex = re.compile(r'time\(\w+\),\s?', flags=re.IGNORECASE) def _group_by(self, query, time, chart_type, group_map, strip=False): if not self.validate_query(query): @@ -258,7 +365,27 @@ def _group_by(self, query, time, chart_type, group_map, strip=False): if 'GROUP BY' not in query.upper(): query = f'{query} {group_by}' else: - query = re.sub(self._group_by_regex, group_by, query) + # The query could have GROUP BY clause for a TAG + if group_by: + # The query already contains "GROUP BY", therefore + # we remove it from the "group_by" to avoid duplicating + # "GROUP BY" + group_by = group_by.replace('GROUP BY ', '') + # We only need to substitute the time function. + # The resulting query would be "GROUP BY time(), " + query = re.sub(self._time_regex, group_by, query) + else: + # The query should not include the "GROUP by time()" + matches = re.search(self._group_by_time_tag_regex, query) + group_by_fields = matches.group(1) + if len(group_by_fields.split(',')) > 1: + # If the query has "GROUP BY time(), tag", + # then return "GROUP BY tag" + query = re.sub(self._time_comma_regex, '', query) + else: + # If the query has only has "GROUP BY time()", + # then remove the "GROUP BY" clause + query = re.sub(self._group_by_time_regex, '', query) return query _fields_regex = re.compile( diff --git a/openwisp_monitoring/db/backends/influxdb/queries.py b/openwisp_monitoring/db/backends/influxdb/queries.py index 11f048096..f3f64aa2e 100644 --- a/openwisp_monitoring/db/backends/influxdb/queries.py +++ b/openwisp_monitoring/db/backends/influxdb/queries.py @@ -2,14 +2,14 @@ 'uptime': { 'influxdb': ( "SELECT MEAN({field_name})*100 AS uptime FROM {key} WHERE " - "time >= '{time}' AND content_type = '{content_type}' AND " + "time >= '{time}' {end_date} AND content_type = '{content_type}' AND " "object_id = '{object_id}' GROUP BY time(1d)" ) }, 'packet_loss': { 'influxdb': ( "SELECT MEAN(loss) AS packet_loss FROM {key} WHERE " - "time >= '{time}' AND content_type = '{content_type}' AND " + "time >= '{time}' {end_date} AND content_type = '{content_type}' AND " "object_id = '{object_id}' GROUP BY time(1d)" ) }, @@ -17,14 +17,14 @@ 'influxdb': ( "SELECT MEAN(rtt_avg) AS RTT_average, MEAN(rtt_max) AS " "RTT_max, MEAN(rtt_min) AS RTT_min FROM {key} WHERE " - "time >= '{time}' AND content_type = '{content_type}' AND " + "time >= '{time}' {end_date} AND content_type = '{content_type}' AND " "object_id = '{object_id}' GROUP BY time(1d)" ) }, 'wifi_clients': { 'influxdb': ( "SELECT COUNT(DISTINCT({field_name})) AS wifi_clients FROM {key} " - "WHERE time >= '{time}' AND content_type = '{content_type}' " + "WHERE time >= '{time}' {end_date} AND content_type = '{content_type}' " "AND object_id = '{object_id}' AND ifname = '{ifname}' " "GROUP BY time(1d)" ) @@ -32,16 +32,15 @@ 'general_wifi_clients': { 'influxdb': ( "SELECT COUNT(DISTINCT({field_name})) AS wifi_clients FROM {key} " - "WHERE time >= '{time}' {organization_id} {location_id} {floorplan_id} " + "WHERE time >= '{time}' {end_date} {organization_id} {location_id} {floorplan_id} " "GROUP BY time(1d)" ) }, 'traffic': { 'influxdb': ( "SELECT SUM(tx_bytes) / 1000000000 AS upload, " - "SUM(rx_bytes) / 1000000000 AS download, " - "((SUM(tx_bytes) + SUM(rx_bytes)) / 1000000000) AS total FROM {key} " - "WHERE time >= '{time}' AND content_type = '{content_type}' " + "SUM(rx_bytes) / 1000000000 AS download FROM {key} " + "WHERE time >= '{time}' {end_date} AND content_type = '{content_type}' " "AND object_id = '{object_id}' AND ifname = '{ifname}' " "GROUP BY time(1d)" ) @@ -49,9 +48,8 @@ 'general_traffic': { 'influxdb': ( "SELECT SUM(tx_bytes) / 1000000000 AS upload, " - "SUM(rx_bytes) / 1000000000 AS download, " - "((SUM(tx_bytes) + SUM(rx_bytes)) / 1000000000) AS total FROM {key} " - "WHERE time >= '{time}' {organization_id} {location_id} " + "SUM(rx_bytes) / 1000000000 AS download FROM {key} " + "WHERE time >= '{time}' {end_date} {organization_id} {location_id} " "{floorplan_id} {ifname} " "GROUP BY time(1d)" ) @@ -59,21 +57,21 @@ 'memory': { 'influxdb': ( "SELECT MEAN(percent_used) AS memory_usage " - "FROM {key} WHERE time >= '{time}' AND content_type = '{content_type}' " + "FROM {key} WHERE time >= '{time}' {end_date} AND content_type = '{content_type}' " "AND object_id = '{object_id}' GROUP BY time(1d)" ) }, 'cpu': { 'influxdb': ( "SELECT MEAN(cpu_usage) AS CPU_load FROM {key} WHERE " - "time >= '{time}' AND content_type = '{content_type}' AND " + "time >= '{time}' {end_date} AND content_type = '{content_type}' AND " "object_id = '{object_id}' GROUP BY time(1d)" ) }, 'disk': { 'influxdb': ( "SELECT MEAN(used_disk) AS disk_usage FROM {key} WHERE " - "time >= '{time}' AND content_type = '{content_type}' AND " + "time >= '{time}' {end_date} AND content_type = '{content_type}' AND " "object_id = '{object_id}' GROUP BY time(1d)" ) }, @@ -81,7 +79,7 @@ 'influxdb': ( "SELECT ROUND(MEAN(signal_strength)) AS signal_strength, " "ROUND(MEAN(signal_power)) AS signal_power FROM {key} WHERE " - "time >= '{time}' AND content_type = '{content_type}' AND " + "time >= '{time}' {end_date} AND content_type = '{content_type}' AND " "object_id = '{object_id}' GROUP BY time(1d)" ) }, @@ -89,21 +87,66 @@ 'influxdb': ( "SELECT ROUND(MEAN(signal_quality)) AS signal_quality, " "ROUND(MEAN(snr)) AS signal_to_noise_ratio FROM {key} WHERE " - "time >= '{time}' AND content_type = '{content_type}' AND " + "time >= '{time}' {end_date} AND content_type = '{content_type}' AND " "object_id = '{object_id}' GROUP BY time(1d)" ) }, 'access_tech': { 'influxdb': ( "SELECT MODE(access_tech) AS access_tech FROM {key} WHERE " + "time >= '{time}' {end_date} AND content_type = '{content_type}' AND " + "object_id = '{object_id}' GROUP BY time(1d)" + ) + }, + 'bandwidth': { + 'influxdb': ( + "SELECT MEAN(sent_bps_tcp) / 1000000000 AS TCP, " + "MEAN(sent_bps_udp) / 1000000000 AS UDP FROM {key} WHERE " "time >= '{time}' AND content_type = '{content_type}' AND " "object_id = '{object_id}' GROUP BY time(1d)" ) }, + 'transfer': { + 'influxdb': ( + "SELECT SUM(sent_bytes_tcp) / 1000000000 AS TCP," + "SUM(sent_bytes_udp) / 1000000000 AS UDP FROM {key} WHERE " + "time >= '{time}' AND content_type = '{content_type}' AND " + "object_id = '{object_id}' GROUP BY time(1d)" + ) + }, + 'retransmits': { + 'influxdb': ( + "SELECT MEAN(retransmits) AS retransmits FROM {key} " + "WHERE time >= '{time}' AND content_type = '{content_type}' " + "AND object_id = '{object_id}' GROUP BY time(1d)" + ) + }, + 'jitter': { + 'influxdb': ( + "SELECT MEAN(jitter) AS jitter FROM {key} " + "WHERE time >= '{time}' AND content_type = '{content_type}' " + "AND object_id = '{object_id}' GROUP BY time(1d)" + ) + }, + 'datagram': { + 'influxdb': ( + "SELECT MEAN(lost_packets) AS lost_datagram," + "MEAN(total_packets) AS total_datagram FROM {key} WHERE " + "time >= '{time}' AND content_type = '{content_type}' " + "AND object_id = '{object_id}' GROUP BY time(1d)" + ) + }, + 'datagram_loss': { + 'influxdb': ( + "SELECT MEAN(lost_percent) AS datagram_loss FROM {key} " + "WHERE time >= '{time}' AND content_type = '{content_type}' " + "AND object_id = '{object_id}' GROUP BY time(1d)" + ) + }, } default_chart_query = [ - "SELECT {field_name} FROM {key} WHERE time >= '{time}'", + "SELECT {field_name} FROM {key} WHERE time >= '{time}' {end_date}", " AND content_type = '{content_type}' AND object_id = '{object_id}'", ] diff --git a/openwisp_monitoring/db/backends/influxdb/tests.py b/openwisp_monitoring/db/backends/influxdb/tests.py index 847cc39e1..508bd3bc8 100644 --- a/openwisp_monitoring/db/backends/influxdb/tests.py +++ b/openwisp_monitoring/db/backends/influxdb/tests.py @@ -3,7 +3,7 @@ from celery.exceptions import Retry from django.core.exceptions import ValidationError -from django.test import TestCase +from django.test import TestCase, tag from django.utils.timezone import now from freezegun import freeze_time from influxdb import InfluxDBClient @@ -11,8 +11,16 @@ from pytz import timezone as tz from swapper import load_model -from openwisp_monitoring.device.settings import SHORT_RETENTION_POLICY -from openwisp_monitoring.device.utils import SHORT_RP, manage_short_retention_policy +from openwisp_monitoring.device.settings import ( + DEFAULT_RETENTION_POLICY, + SHORT_RETENTION_POLICY, +) +from openwisp_monitoring.device.utils import ( + DEFAULT_RP, + SHORT_RP, + manage_default_retention_policy, + manage_short_retention_policy, +) from openwisp_monitoring.monitoring.tests import TestMonitoringMixin from openwisp_monitoring.settings import MONITORING_TIMESERIES_RETRY_OPTIONS from openwisp_utils.tests import capture_stderr @@ -24,6 +32,7 @@ Notification = load_model('openwisp_notifications', 'Notification') +@tag('timeseries_client') class TestDatabaseClient(TestMonitoringMixin, TestCase): def test_forbidden_queries(self): queries = [ @@ -71,7 +80,7 @@ def test_get_query_fields_function(self): def test_default_query(self): c = self._create_chart(test_data=False) q = ( - "SELECT {field_name} FROM {key} WHERE time >= '{time}' AND " + "SELECT {field_name} FROM {key} WHERE time >= '{time}' {end_date} AND " "content_type = '{content_type}' AND object_id = '{object_id}'" ) self.assertEqual(c.query, q) @@ -181,14 +190,59 @@ def test_get_query_30d(self): self.assertIn(str(last30d)[0:10], q) self.assertIn('group by time(24h)', q.lower()) + def test_group_by_tags(self): + self.assertEqual( + timeseries_db._group_by( + 'SELECT COUNT(item) FROM measurement GROUP BY time(1d)', + time='30d', + chart_type='stackedbar+lines', + group_map={'30d': '30d'}, + strip=False, + ), + 'SELECT COUNT(item) FROM measurement GROUP BY time(30d)', + ) + self.assertEqual( + timeseries_db._group_by( + 'SELECT COUNT(item) FROM measurement GROUP BY time(1d)', + time='30d', + chart_type='stackedbar+lines', + group_map={'30d': '30d'}, + strip=True, + ), + 'SELECT COUNT(item) FROM measurement ', + ) + self.assertEqual( + timeseries_db._group_by( + 'SELECT COUNT(item) FROM measurement GROUP BY time(1d), tag', + time='30d', + chart_type='stackedbar+lines', + group_map={'30d': '30d'}, + strip=False, + ), + 'SELECT COUNT(item) FROM measurement GROUP BY time(30d), tag', + ) + self.assertEqual( + timeseries_db._group_by( + 'SELECT COUNT(item) FROM measurement GROUP BY time(1d), tag', + time='30d', + chart_type='stackedbar+lines', + group_map={'30d': '30d'}, + strip=True, + ), + 'SELECT COUNT(item) FROM measurement GROUP BY tag', + ) + def test_retention_policy(self): manage_short_retention_policy() + manage_default_retention_policy() rp = timeseries_db.get_list_retention_policies() self.assertEqual(len(rp), 2) + self.assertEqual(rp[0]['name'], DEFAULT_RP) + self.assertEqual(rp[0]['default'], True) + self.assertEqual(rp[0]['duration'], DEFAULT_RETENTION_POLICY) self.assertEqual(rp[1]['name'], SHORT_RP) self.assertEqual(rp[1]['default'], False) - duration = SHORT_RETENTION_POLICY - self.assertEqual(rp[1]['duration'], duration) + self.assertEqual(rp[1]['duration'], SHORT_RETENTION_POLICY) def test_query_set(self): c = self._create_chart(configuration='histogram') @@ -319,7 +373,7 @@ def test_timeseries_write_params(self, mock_write): retention_policy=None, tags={}, # this should be the original time at the moment of first failure - timestamp='2020-01-14T00:00:00Z', + timestamp=datetime(2020, 1, 14, tzinfo=tz('UTC')).isoformat(), current=False, ) @@ -342,3 +396,20 @@ def test_retry_mechanism(self, mock_query): 'Error while executing method "query":\nServer error\nAttempt ' f'{max_retries} out of {max_retries}.\n' ) + + +class TestDatabaseClientUdp(TestMonitoringMixin, TestCase): + def test_exceed_udp_packet_limit(self): + # When using UDP to write data to InfluxDB, writing + # huge data that exceeds UDP packet limit should not raise + # an error. Instead, the client should fallback to the + # TCP connection. + timeseries_db.write( + 'test_udp_write', dict(value='O' * 66000), database=self.TEST_DB + ) + measurement = list( + timeseries_db.query( + 'select * from test_udp_write', database=self.TEST_DB + ).get_points() + ) + self.assertEqual(len(measurement), 1) diff --git a/openwisp_monitoring/device/__init__.py b/openwisp_monitoring/device/__init__.py index 6a7a5bae9..e69de29bb 100644 --- a/openwisp_monitoring/device/__init__.py +++ b/openwisp_monitoring/device/__init__.py @@ -1 +0,0 @@ -default_app_config = 'openwisp_monitoring.device.apps.DeviceMonitoringConfig' diff --git a/openwisp_monitoring/device/admin.py b/openwisp_monitoring/device/admin.py index 493f0ce1c..f24e0d05f 100644 --- a/openwisp_monitoring/device/admin.py +++ b/openwisp_monitoring/device/admin.py @@ -5,10 +5,10 @@ from django.contrib.contenttypes.admin import GenericStackedInline from django.contrib.contenttypes.forms import BaseGenericInlineFormSet from django.contrib.contenttypes.models import ContentType -from django.db.models import Q from django.forms import ModelForm from django.templatetags.static import static from django.urls import resolve, reverse +from django.utils.formats import localize from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ @@ -21,14 +21,14 @@ from swapper import load_model from openwisp_controller.config.admin import DeviceAdmin as BaseDeviceAdmin -from openwisp_controller.config.admin import DeviceResource as BaseDeviceResource -from openwisp_users.multitenancy import MultitenantAdminMixin, MultitenantOrgFilter +from openwisp_users.multitenancy import MultitenantAdminMixin from openwisp_utils.admin import ReadOnlyAdmin -from openwisp_utils.admin_theme.filters import SimpleInputFilter from ..monitoring.admin import MetricAdmin from ..settings import MONITORING_API_BASEURL, MONITORING_API_URLCONF from . import settings as app_settings +from .exportable import DeviceMonitoringResource +from .filters import DeviceFilter, DeviceGroupFilter, DeviceOrganizationFilter DeviceData = load_model('device_monitoring', 'DeviceData') WifiSession = load_model('device_monitoring', 'WifiSession') @@ -48,26 +48,61 @@ def full_clean(self): obj = form.instance if not obj.content_type or not obj.object_id: setattr( - form.instance, + obj, self.ct_field.get_attname(), ContentType.objects.get_for_model(self.instance).pk, ) - setattr(form.instance, self.ct_fk_field.get_attname(), self.instance.pk) + setattr(obj, self.ct_fk_field.get_attname(), self.instance.pk) super().full_clean() -class CheckInline(GenericStackedInline): +class InlinePermissionMixin: + def has_add_permission(self, request, obj=None): + # User will be able to add objects from inline even + # if it only has permission to add a model object + return super().has_add_permission(request, obj) or request.user.has_perm( + f'{self.model._meta.app_label}.add_{self.inline_permission_suffix}' + ) + + def has_change_permission(self, request, obj=None): + return super().has_change_permission(request, obj) or request.user.has_perm( + f'{self.model._meta.app_label}.change_{self.inline_permission_suffix}' + ) + + def has_view_permission(self, request, obj=None): + return super().has_view_permission(request, obj) or request.user.has_perm( + f'{self.model._meta.app_label}.view_{self.inline_permission_suffix}' + ) + + def has_delete_permission(self, request, obj=None): + return super().has_delete_permission(request, obj) or request.user.has_perm( + f'{self.model._meta.app_label}.delete_{self.inline_permission_suffix}' + ) + + +class CheckInline(InlinePermissionMixin, GenericStackedInline): model = Check extra = 0 formset = CheckInlineFormSet - fields = ['check_type', 'is_active'] - readonly_fields = ['check_type'] + fields = [ + 'is_active', + 'check_type', + ] + inline_permission_suffix = 'check_inline' - def has_add_permission(self, request, obj=None): - return False + def get_fields(self, request, obj=None): + if not self.has_change_permission(request, obj) or not self.has_view_permission( + request, obj + ): + return ['check_type', 'is_active'] + return super().get_fields(request, obj) - def has_delete_permission(self, request, obj=None): - return False + def get_readonly_fields(self, request, obj=None): + if not self.has_change_permission(request, obj) or not self.has_view_permission( + request, obj + ): + return ['check_type'] + return super().get_readonly_fields(request, obj) class AlertSettingsForm(ModelForm): @@ -81,43 +116,92 @@ def __init__(self, *args, **kwargs): } super().__init__(*args, **kwargs) - -class AlertSettingsInline(NestedStackedInline): + def _post_clean(self): + self.instance._delete_instance = False + if all( + self.cleaned_data[field] is None + for field in [ + 'custom_operator', + 'custom_threshold', + 'custom_tolerance', + ] + ): + # "_delete_instance" flag signifies that + # the fields have been set to None by the + # user. Hence, the object should be deleted. + self.instance._delete_instance = True + super()._post_clean() + + def save(self, commit=True): + if self.instance._delete_instance: + self.instance.delete() + return self.instance + return super().save(commit) + + +class AlertSettingsInline(InlinePermissionMixin, NestedStackedInline): model = AlertSettings - extra = 0 - max_num = 0 + extra = 1 + max_num = 1 exclude = ['created', 'modified'] form = AlertSettingsForm + inline_permission_suffix = 'alertsettings_inline' def get_queryset(self, request): return super().get_queryset(request).order_by('created') - def has_add_permission(self, request, obj=None): - return False - - def has_delete_permission(self, request, obj=None): - return False - -class MetricInline(NestedGenericStackedInline): +class MetricInline(InlinePermissionMixin, NestedGenericStackedInline): model = Metric extra = 0 inlines = [AlertSettingsInline] + fieldsets = [ + ( + None, + { + 'fields': ( + 'name', + 'is_healthy', + ) + }, + ), + ( + _('Advanced options'), + {'classes': ('collapse',), 'fields': ('field_name',)}, + ), + ] + readonly_fields = ['name', 'is_healthy'] - fields = ['name', 'is_healthy'] # Explicitly changed name from Metrics to Alert Settings verbose_name = _('Alert Settings') verbose_name_plural = verbose_name + inline_permission_suffix = 'alertsettings_inline' + # Ordering queryset by metric name + ordering = ('name',) + + def get_fieldsets(self, request, obj=None): + if not self.has_change_permission(request, obj) or not self.has_view_permission( + request, obj + ): + return [ + (None, {'fields': ('is_healthy',)}), + ] + return super().get_fieldsets(request, obj) + + def get_queryset(self, request): + # Only show 'Metrics' that have 'AlertSettings' objects + return super().get_queryset(request).filter(alertsettings__isnull=False) def has_add_permission(self, request, obj=None): + # We need to restrict the users from adding the 'metrics' since + # they're created by the system automatically with default 'alertsettings' return False def has_delete_permission(self, request, obj=None): + # We need to restrict the users from deleting the 'metrics' since + # they're created by the system automatically with default 'alertsettings' return False - def get_queryset(self, request): - return super().get_queryset(request).filter(alertsettings__isnull=False) - class DeviceAdmin(BaseDeviceAdmin, NestedModelAdmin): change_form_template = 'admin/config/device/change_form.html' @@ -131,14 +215,20 @@ class Media: js = ( tuple(BaseDeviceAdmin.Media.js) + ( - 'monitoring/js/percircle.min.js', + 'monitoring/js/lib/percircle.min.js', 'monitoring/js/alert-settings.js', ) + MetricAdmin.Media.js + ('monitoring/js/chart-utils.js',) + + ('monitoring/js/lib/moment.min.js',) + + ('monitoring/js/lib/daterangepicker.min.js',) ) css = { - 'all': ('monitoring/css/percircle.min.css',) + MetricAdmin.Media.css['all'] + 'all': ( + 'monitoring/css/percircle.min.css', + 'monitoring/css/daterangepicker.css', + ) + + MetricAdmin.Media.css['all'] } def get_extra_context(self, pk=None): @@ -166,9 +256,9 @@ def health_checks(self, obj): metric_rows = [] for metric in DeviceData(pk=obj.pk).metrics.filter(alertsettings__isnull=False): health = 'yes' if metric.is_healthy else 'no' + icon_url = static(f'admin/img/icon-{health}.svg') metric_rows.append( - f'
  • {metric.name}
  • ' + f'
  • {metric.name}
  • ' ) return format_html( mark_safe(f'
      {"".join(metric_rows)}
    ') @@ -185,6 +275,20 @@ def health_status(self, obj): health_status.short_description = _('health status') + def get_object(self, request, object_id, from_field=None): + obj = super().get_object(request, object_id, from_field=from_field) + if obj and obj.wifisession_set.exists(): + # We need to provide default formset values + # to avoid management formset errors when wifi sessions + # are created while editing the DeviceAdmin change page + wifisession_formset_data = { + 'wifisession_set-TOTAL_FORMS': '1', + 'wifisession_set-INITIAL_FORMS': '1', + } + request.POST = request.POST.copy() + request.POST.update(wifisession_formset_data) + return obj + def get_form(self, request, obj=None, **kwargs): """ Adds the help_text of DeviceMonitoring.status field @@ -219,62 +323,42 @@ def get_inlines(self, request, obj=None): for inline in inlines: if not hasattr(inline, 'sortable_options'): inline.sortable_options = {'disabled': True} - if not obj or obj._state.adding: + if not obj or obj._state.adding or obj.organization.is_active is False: + inlines.remove(CheckInline) inlines.remove(MetricInline) return inlines -_exportable_fields = BaseDeviceResource.Meta.fields[:] # copy -_exportable_fields.insert( - _exportable_fields.index('config__status'), 'monitoring__status' -) - - -class DeviceResource(BaseDeviceResource): - class Meta: - model = Device - fields = _exportable_fields - export_order = fields - - class DeviceAdminExportable(ImportExportMixin, DeviceAdmin): - resource_class = DeviceResource - - -class DeviceFilter(SimpleInputFilter): - """ - Filters WifiSession queryset for input device name - or primary key - """ - - parameter_name = 'device' - title = _('device name or ID') - - def queryset(self, request, queryset): - if self.value() is not None: - try: - uuid.UUID(self.value()) - except ValueError: - lookup = Q(device__name=self.value()) - else: - lookup = Q(device_id=self.value()) - return queryset.filter(lookup) + resource_class = DeviceMonitoringResource + # Added to support both reversion and import-export + change_list_template = 'admin/config/change_list_device.html' class WifiSessionAdminHelperMixin: def _get_boolean_html(self, value): - icon = static('admin/img/icon-{}.svg'.format('yes' if value is True else 'no')) + icon_type = 'unknown' + if value is True: + icon_type = 'yes' + elif value is False: + icon_type = 'no' + icon = static(f'admin/img/icon-{icon_type}.svg') return mark_safe(f'') - def ht(self, obj): - return self._get_boolean_html(obj.wifi_client.ht) + def he(self, obj): + return self._get_boolean_html(obj.wifi_client.he) - ht.short_description = 'HT' + he.short_description = 'WiFi 6 (802.11ax)' def vht(self, obj): return self._get_boolean_html(obj.wifi_client.vht) - vht.short_description = 'VHT' + vht.short_description = 'WiFi 5 (802.11ac)' + + def ht(self, obj): + return self._get_boolean_html(obj.wifi_client.ht) + + ht.short_description = 'WiFi 4 (802.11n)' def wmm(self, obj): return self._get_boolean_html(obj.wifi_client.wmm) @@ -294,7 +378,7 @@ def wps(self, obj): def get_stop_time(self, obj): if obj.stop_time is None: return mark_safe('online') - return obj.stop_time + return localize(obj.stop_time) get_stop_time.short_description = _('stop time') @@ -323,8 +407,9 @@ class WiFiSessionInline(WifiSessionAdminHelperMixin, admin.TabularInline): 'vendor', 'ssid', 'interface_name', - 'ht', + 'he', 'vht', + 'ht', 'start_time', 'get_stop_time', ] @@ -377,8 +462,9 @@ class WifiSessionAdmin( 'related_organization', 'related_device', 'ssid', - 'ht', + 'he', 'vht', + 'ht', 'start_time', 'get_stop_time', ] @@ -389,8 +475,9 @@ class WifiSessionAdmin( 'related_device', 'ssid', 'interface_name', - 'ht', + 'he', 'vht', + 'ht', 'wmm', 'wds', 'wps', @@ -400,11 +487,11 @@ class WifiSessionAdmin( ] search_fields = ['wifi_client__mac_address', 'device__name', 'device__mac_address'] list_filter = [ - ('device__organization', MultitenantOrgFilter), + DeviceOrganizationFilter, + DeviceFilter, + DeviceGroupFilter, 'start_time', 'stop_time', - 'device__group', - DeviceFilter, ] def get_readonly_fields(self, request, obj=None): @@ -413,8 +500,9 @@ def get_readonly_fields(self, request, obj=None): 'related_organization', 'mac_address', 'vendor', - 'ht', + 'he', 'vht', + 'ht', 'wmm', 'wds', 'wps', diff --git a/openwisp_monitoring/device/api/filters.py b/openwisp_monitoring/device/api/filters.py new file mode 100644 index 000000000..f73ab28fc --- /dev/null +++ b/openwisp_monitoring/device/api/filters.py @@ -0,0 +1,49 @@ +from django.utils.translation import gettext_lazy as _ +from django_filters import rest_framework as filters +from swapper import load_model + +from openwisp_users.api.filters import ( + FilterDjangoByOrgManaged, + OrganizationManagedFilter, +) + +Device = load_model('config', 'Device') +WifiSession = load_model('device_monitoring', 'WifiSession') + + +class WifiSessionFilter(FilterDjangoByOrgManaged): + class Meta: + model = WifiSession + fields = { + 'device__organization': ['exact'], + 'device': ['exact'], + 'device__group': ['exact'], + 'start_time': ['exact', 'gt', 'gte', 'lt', 'lte'], + 'stop_time': ['exact', 'gt', 'gte', 'lt', 'lte'], + } + + +class MonitoringDeviceFilter(OrganizationManagedFilter): + class Meta(OrganizationManagedFilter.Meta): + model = Device + fields = OrganizationManagedFilter.Meta.fields + ['monitoring__status'] + + +class MonitoringNearbyDeviceFilter(OrganizationManagedFilter): + distance__lte = filters.NumberFilter( + label=_('Distance is less than or equal to'), + field_name='distance', + lookup_expr='lte', + ) + model = filters.CharFilter(method='filter_model') + + class Meta(OrganizationManagedFilter.Meta): + model = Device + fields = OrganizationManagedFilter.Meta.fields + [ + 'monitoring__status', + 'model', + ] + + def filter_model(self, queryset, name, value): + values = value.split('|') + return queryset.filter(**{f"{name}__in": values}) diff --git a/openwisp_monitoring/device/api/serializers.py b/openwisp_monitoring/device/api/serializers.py index be9c141f4..548815786 100644 --- a/openwisp_monitoring/device/api/serializers.py +++ b/openwisp_monitoring/device/api/serializers.py @@ -1,27 +1,113 @@ from rest_framework import serializers from swapper import load_model +from openwisp_controller.config.api.serializers import DeviceListSerializer from openwisp_controller.geo.api.serializers import ( GeoJsonLocationSerializer, LocationDeviceSerializer, ) +from openwisp_users.api.mixins import FilterSerializerByOrgManaged +Device = load_model('config', 'Device') DeviceMonitoring = load_model('device_monitoring', 'DeviceMonitoring') +DeviceData = load_model('device_monitoring', 'DeviceData') +Device = load_model('config', 'Device') +WifiSession = load_model('device_monitoring', 'WifiSession') +WifiClient = load_model('device_monitoring', 'WifiClient') -class DeviceMonitoringSerializer(serializers.ModelSerializer): +class BaseDeviceMonitoringSerializer(serializers.ModelSerializer): + class Meta: + model = DeviceMonitoring + fields = ('status',) + + +class DeviceMonitoringLocationSerializer(BaseDeviceMonitoringSerializer): status_label = serializers.SerializerMethodField() def get_status_label(self, obj): return obj.get_status_display() + class Meta(BaseDeviceMonitoringSerializer.Meta): + fields = BaseDeviceMonitoringSerializer.Meta.fields + ('status_label',) + + +class DeviceMonitoringSerializer(BaseDeviceMonitoringSerializer): + related_metrics = serializers.SerializerMethodField() + + def get_related_metrics(self, obj): + return obj.related_metrics.values('name', 'is_healthy').order_by('name') + + class Meta(BaseDeviceMonitoringSerializer.Meta): + fields = BaseDeviceMonitoringSerializer.Meta.fields + ('related_metrics',) + + +class MonitoringLocationDeviceSerializer(LocationDeviceSerializer): + monitoring = DeviceMonitoringLocationSerializer() + + +class MonitoringNearbyDeviceSerializer( + FilterSerializerByOrgManaged, serializers.ModelSerializer +): + monitoring_status = serializers.CharField(source='monitoring.status') + distance = serializers.SerializerMethodField('get_distance') + monitoring_data = serializers.SerializerMethodField('get_monitoring_data') + + class Meta(DeviceListSerializer.Meta): + model = Device + fields = [ + 'id', + 'name', + 'organization', + 'group', + 'mac_address', + 'management_ip', + 'model', + 'os', + 'system', + 'notes', + 'distance', + 'monitoring_status', + 'monitoring_data', + ] + + def get_distance(self, obj): + return obj.distance.m + + def get_monitoring_data(self, obj): + return DeviceData.objects.only('id').get(id=obj.id).data + + +class MonitoringDeviceListSerializer(DeviceListSerializer): + monitoring = BaseDeviceMonitoringSerializer(read_only=True) + + def get_status(self, obj): + return obj.get_status_display() + class Meta: - fields = ('status', 'status_label') - model = DeviceMonitoring + model = Device + fields = [ + 'id', + 'name', + 'organization', + 'group', + 'mac_address', + 'key', + 'last_ip', + 'management_ip', + 'model', + 'os', + 'system', + 'notes', + 'config', + 'monitoring', + 'created', + 'modified', + ] -class MonitoringDeviceSerializer(LocationDeviceSerializer): - monitoring = DeviceMonitoringSerializer() +class MonitoringDeviceDetailSerializer(MonitoringDeviceListSerializer): + monitoring = DeviceMonitoringSerializer(read_only=True) class MonitoringGeoJsonLocationSerializer(GeoJsonLocationSerializer): @@ -29,3 +115,42 @@ class MonitoringGeoJsonLocationSerializer(GeoJsonLocationSerializer): problem_count = serializers.IntegerField() critical_count = serializers.IntegerField() unknown_count = serializers.IntegerField() + + +class WifiClientSerializer(serializers.ModelSerializer): + wifi6 = serializers.CharField(source='he', read_only=True) + wifi5 = serializers.CharField(source='vht', read_only=True) + wifi4 = serializers.CharField(source='ht', read_only=True) + + class Meta: + model = WifiClient + fields = [ + 'mac_address', + 'vendor', + 'wifi6', + 'wifi5', + 'wifi4', + 'wmm', + 'wds', + 'wps', + ] + + +class WifiSessionSerializer(serializers.ModelSerializer): + client = WifiClientSerializer(source='wifi_client') + organization = serializers.CharField(source='device.organization', read_only=True) + device = serializers.CharField(source='device.name', read_only=True) + + class Meta: + model = WifiSession + fields = [ + 'id', + 'organization', + 'device', + 'ssid', + 'interface_name', + 'client', + 'start_time', + 'stop_time', + 'modified', + ] diff --git a/openwisp_monitoring/device/api/urls.py b/openwisp_monitoring/device/api/urls.py index 827aba007..25de5cd9b 100644 --- a/openwisp_monitoring/device/api/urls.py +++ b/openwisp_monitoring/device/api/urls.py @@ -5,11 +5,21 @@ app_name = 'monitoring' urlpatterns = [ + path( + 'api/v1/monitoring/device/', + views.monitoring_device_list, + name='api_monitoring_device_list', + ), re_path( r'^api/v1/monitoring/device/(?P[^/]+)/$', views.device_metric, name='api_device_metric', ), + re_path( + r'^api/v1/monitoring/device/(?P[^/]+)/nearby-devices/$', + views.monitoring_nearby_device_list, + name='api_monitoring_nearby_device_list', + ), path( 'api/v1/monitoring/geojson/', views.monitoring_geojson_location_list, @@ -20,4 +30,14 @@ views.monitoring_location_device_list, name='api_location_device_list', ), + path( + 'api/v1/monitoring/wifi-session/', + views.wifi_session_list, + name='api_wifi_session_list', + ), + re_path( + r'^api/v1/monitoring/wifi-session/(?P[^/]+)/$', + views.wifi_session_detail, + name='api_wifi_session_detail', + ), ] diff --git a/openwisp_monitoring/device/api/views.py b/openwisp_monitoring/device/api/views.py index 04bac7890..697318dc6 100644 --- a/openwisp_monitoring/device/api/views.py +++ b/openwisp_monitoring/device/api/views.py @@ -1,31 +1,55 @@ import logging import uuid -from copy import deepcopy -from datetime import datetime, timedelta +from datetime import datetime +from cache_memoize import cache_memoize from django.contrib.contenttypes.models import ContentType -from django.core.exceptions import ObjectDoesNotExist, ValidationError +from django.contrib.gis.db.models.functions import Distance +from django.core.exceptions import ValidationError from django.db.models import Count, Q +from django.db.models.functions import Round from django.utils.timezone import now from django.utils.translation import gettext_lazy as _ +from django_filters.rest_framework import DjangoFilterBackend from pytz import UTC -from rest_framework import serializers, status -from rest_framework.generics import GenericAPIView +from rest_framework import pagination, serializers, status +from rest_framework.generics import ( + GenericAPIView, + ListAPIView, + RetrieveAPIView, + get_object_or_404, +) +from rest_framework.permissions import SAFE_METHODS from rest_framework.response import Response from swapper import load_model +from openwisp_controller.config.api.views import DeviceListCreateView from openwisp_controller.geo.api.views import ( DevicePermission, GeoJsonLocationList, LocationDeviceList, + ProtectedAPIMixin, ) +from openwisp_users.api.mixins import FilterByOrganizationManaged -from ... import settings as monitoring_settings -from ...monitoring.configuration import ACCESS_TECHNOLOGIES +from ...settings import CACHE_TIMEOUT from ...views import MonitoringApiViewMixin from ..schema import schema from ..signals import device_metrics_received -from .serializers import MonitoringDeviceSerializer, MonitoringGeoJsonLocationSerializer +from ..tasks import write_device_metrics +from .filters import ( + MonitoringDeviceFilter, + MonitoringNearbyDeviceFilter, + WifiSessionFilter, +) +from .serializers import ( + MonitoringDeviceDetailSerializer, + MonitoringDeviceListSerializer, + MonitoringGeoJsonLocationSerializer, + MonitoringLocationDeviceSerializer, + MonitoringNearbyDeviceSerializer, + WifiSessionSerializer, +) logger = logging.getLogger(__name__) Chart = load_model('monitoring', 'Chart') @@ -35,28 +59,110 @@ DeviceMonitoring = load_model('device_monitoring', 'DeviceMonitoring') DeviceData = load_model('device_monitoring', 'DeviceData') Location = load_model('geo', 'Location') +WifiSession = load_model('device_monitoring', 'WifiSession') + + +class ListViewPagination(pagination.PageNumberPagination): + page_size = 10 + page_size_query_param = 'page_size' + max_page_size = 100 + + +def get_device_args_rewrite(view, pk): + """ + Use only the PK parameter for calculating the cache key + """ + try: + pk = uuid.UUID(pk) + except ValueError: + return pk + return pk.hex + + +def get_charts_args_rewrite(view, request, pk): + return (pk,) + + +class DeviceKeyAuthenticationMixin(object): + def get_permissions(self): + if self.request.method in SAFE_METHODS and not self.request.query_params.get( + 'key' + ): + self.permission_classes = ProtectedAPIMixin.permission_classes + return super().get_permissions() + def get_authenticators(self): + if self.request.method in SAFE_METHODS and not self.request.GET.get('key'): + self.authentication_classes = ProtectedAPIMixin.authentication_classes + return super().get_authenticators() + + +class DeviceMetricView( + DeviceKeyAuthenticationMixin, MonitoringApiViewMixin, GenericAPIView +): + """ + Retrieve device information, monitoring status (health status), + a list of metrics, chart data and + optionally device status information (if ``?status=true``). + + Suports session authentication, token authentication, + or alternatively device key authentication passed as query + string parameter (this method is meant to be used by network devices). + """ -class DeviceMetricView(MonitoringApiViewMixin, GenericAPIView): model = DeviceData - queryset = DeviceData.objects.select_related('devicelocation').all() + queryset = ( + DeviceData.objects.filter(organization__is_active=True) + .only( + 'id', + 'key', + ) + .all() + ) serializer_class = serializers.Serializer permission_classes = [DevicePermission] schema = schema + @classmethod + def invalidate_get_device_cache(cls, instance, **kwargs): + """ + Called from signal receiver which performs cache invalidation + """ + view = cls() + view.get_object.invalidate(view, str(instance.pk)) + logger.debug(f'invalidated view cache for device ID {instance.pk}') + + @classmethod + def invalidate_get_charts_cache(cls, instance, *args, **kwargs): + if isinstance(instance, Device): + pk = instance.id + elif isinstance(instance, Metric): + pk = instance.object_id + elif isinstance(instance, Chart): + pk = instance.metric.object_id + cls._get_charts.invalidate(None, None, pk) + def get(self, request, pk): # ensure valid UUID try: pk = str(uuid.UUID(pk)) except ValueError: return Response({'detail': 'not found'}, status=404) - self.instance = self.get_object() - return super().get(request, pk) + self.instance = self.get_object(pk) + response = super().get(request, pk) + if not request.query_params.get('csv'): + charts_data = dict(response.data) + device_metrics_data = MonitoringDeviceDetailSerializer(self.instance).data + return Response( + {**device_metrics_data, **charts_data}, status=status.HTTP_200_OK + ) + return response + @cache_memoize(CACHE_TIMEOUT, args_rewrite=get_charts_args_rewrite) def _get_charts(self, request, *args, **kwargs): ct = ContentType.objects.get_for_model(Device) return Chart.objects.filter( - metric__object_id=args[0], metric__content_type=ct + metric__object_id=args[0], metric__content_type_id=ct.id ).select_related('metric') def _get_additional_data(self, request, *args, **kwargs): @@ -64,9 +170,12 @@ def _get_additional_data(self, request, *args, **kwargs): return {'data': self.instance.data} return {} + @cache_memoize(CACHE_TIMEOUT, args_rewrite=get_device_args_rewrite) + def get_object(self, pk): + return super().get_object() + def post(self, request, pk): - self.instance = self.get_object() - self._init_previous_data() + self.instance = self.get_object(pk) self.instance.data = request.data # validate incoming data try: @@ -84,12 +193,10 @@ def post(self, request, pk): ) except ValueError: return Response({'detail': _('Incorrect time format')}, status=400) - try: - # write data - self._write(request, self.instance.pk, time=time) - except ValidationError as e: - logger.info(e.message_dict) - return Response(e.message_dict, status=status.HTTP_400_BAD_REQUEST) + # writing data is intensive, let's pass that to the background workers + write_device_metrics.delay( + str(self.instance.pk), self.instance.data, time=time_obj, current=current + ) device_metrics_received.send( sender=self.model, instance=self.instance, @@ -99,326 +206,6 @@ def post(self, request, pk): ) return Response(None) - def _init_previous_data(self): - """ - makes NetJSON interfaces of previous - snapshots more easy to access - """ - data = self.instance.data or {} - if data: - data = deepcopy(data) - data['interfaces_dict'] = {} - for interface in data.get('interfaces', []): - data['interfaces_dict'][interface['name']] = interface - self._previous_data = data - - def _write(self, request, pk, time=None, current=False): - """ - write metrics to database - """ - # saves raw device data - self.instance.save_data() - data = self.instance.data - ct = ContentType.objects.get_for_model(Device) - device_extra_tags = self._get_extra_tags(self.instance) - for interface in data.get('interfaces', []): - ifname = interface['name'] - extra_tags = Metric._sort_dict(device_extra_tags) - if 'mobile' in interface: - self._write_mobile_signal(interface, ifname, ct, pk, current, time=time) - ifstats = interface.get('statistics', {}) - # Explicitly stated None to avoid skipping in case the stats are zero - if ( - ifstats.get('rx_bytes') is not None - and ifstats.get('rx_bytes') is not None - ): - field_value = self._calculate_increment( - ifname, 'rx_bytes', ifstats['rx_bytes'] - ) - extra_values = { - 'tx_bytes': self._calculate_increment( - ifname, 'tx_bytes', ifstats['tx_bytes'] - ) - } - name = f'{ifname} traffic' - metric, created = Metric._get_or_create( - object_id=pk, - content_type=ct, - configuration='traffic', - name=name, - key='traffic', - main_tags={'ifname': Metric._makekey(ifname)}, - extra_tags=extra_tags, - ) - metric.write(field_value, current, time=time, extra_values=extra_values) - if created: - self._create_traffic_chart(metric) - try: - clients = interface['wireless']['clients'] - except KeyError: - continue - if not isinstance(clients, list): - continue - name = '{0} wifi clients'.format(ifname) - metric, created = Metric._get_or_create( - object_id=pk, - content_type=ct, - configuration='clients', - name=name, - key='wifi_clients', - main_tags={'ifname': Metric._makekey(ifname)}, - extra_tags=extra_tags, - ) - # avoid tsdb overwrite clients - client_time = time - for client in clients: - if 'mac' not in client: - continue - metric.write(client['mac'], current, time=client_time) - client_time += timedelta(microseconds=1) - if created: - self._create_clients_chart(metric) - if 'resources' not in data: - return - if 'load' in data['resources'] and 'cpus' in data['resources']: - self._write_cpu( - data['resources']['load'], - data['resources']['cpus'], - pk, - ct, - current, - time=time, - ) - if 'disk' in data['resources']: - self._write_disk(data['resources']['disk'], pk, ct, time=time) - if 'memory' in data['resources']: - self._write_memory(data['resources']['memory'], pk, ct, current, time=time) - - def _get_extra_tags(self, device): - tags = {'organization_id': str(device.organization_id)} - try: - device_location = device.devicelocation - except ObjectDoesNotExist: - pass - else: - tags['location_id'] = str(device_location.location_id) - if device_location.floorplan_id: - tags['floorplan_id'] = str(device_location.floorplan_id) - return tags - - def _get_mobile_signal_type(self, signal): - # if only one access technology in use, return that - sections = list(signal.keys()) - if len(sections) == 1: - return sections[0] - # if multiple access technologies are in use, - # return the most advanced one - access_technologies = list(ACCESS_TECHNOLOGIES.keys()) - access_technologies.reverse() - for tech in access_technologies: - if tech in signal: - return tech - - def _write_mobile_signal(self, interface, ifname, ct, pk, current=False, time=None): - access_type = self._get_mobile_signal_type(interface['mobile']['signal']) - data = interface['mobile']['signal'][access_type] - signal_power = signal_strength = None - extra_values = {} - if 'rssi' in data: - signal_strength = data['rssi'] - if 'rsrp' in data: - signal_power = data['rsrp'] - elif 'rscp' in data: - signal_power = data['rscp'] - if signal_power is not None: - extra_values = {'signal_power': float(signal_power)} - if signal_strength is not None: - signal_strength = float(signal_strength) - if signal_strength is not None or signal_power is not None: - metric, created = Metric._get_or_create( - object_id=pk, - content_type=ct, - configuration='signal_strength', - name='signal strength', - key=ifname, - ) - metric.write(signal_strength, current, time=time, extra_values=extra_values) - if created: - self._create_signal_strength_chart(metric) - - snr = signal_quality = None - extra_values = {} - if 'snr' in data: - snr = data['snr'] - if 'rsrq' in data: - signal_quality = data['rsrq'] - if 'ecio' in data: - snr = data['ecio'] - if 'sinr' in data: - snr = data['sinr'] - if snr is not None: - extra_values = {'snr': float(snr)} - if signal_quality is not None: - signal_quality = float(signal_quality) - if snr is not None or signal_quality is not None: - metric, created = Metric._get_or_create( - object_id=pk, - content_type=ct, - configuration='signal_quality', - name='signal quality', - key=ifname, - ) - metric.write(signal_quality, current, time=time, extra_values=extra_values) - if created: - self._create_signal_quality_chart(metric) - # create access technology chart - metric, created = Metric._get_or_create( - object_id=pk, - content_type=ct, - configuration='access_tech', - name='access technology', - key=ifname, - ) - metric.write( - list(ACCESS_TECHNOLOGIES.keys()).index(access_type), current, time=time - ) - if created: - self._create_access_tech_chart(metric) - - def _write_cpu( - self, load, cpus, primary_key, content_type, current=False, time=None - ): - extra_values = { - 'load_1': float(load[0]), - 'load_5': float(load[1]), - 'load_15': float(load[2]), - } - metric, created = Metric._get_or_create( - object_id=primary_key, content_type=content_type, configuration='cpu' - ) - if created: - self._create_resources_chart(metric, resource='cpu') - self._create_resources_alert_settings(metric, resource='cpu') - metric.write( - 100 * float(load[0] / cpus), current, time=time, extra_values=extra_values - ) - - def _write_disk( - self, disk_list, primary_key, content_type, current=False, time=None - ): - used_bytes, size_bytes, available_bytes = 0, 0, 0 - for disk in disk_list: - used_bytes += disk['used_bytes'] - size_bytes += disk['size_bytes'] - available_bytes += disk['available_bytes'] - metric, created = Metric._get_or_create( - object_id=primary_key, content_type=content_type, configuration='disk' - ) - if created: - self._create_resources_chart(metric, resource='disk') - self._create_resources_alert_settings(metric, resource='disk') - metric.write(100 * used_bytes / size_bytes, current, time=time) - - def _write_memory( - self, memory, primary_key, content_type, current=False, time=None - ): - extra_values = { - 'total_memory': memory['total'], - 'free_memory': memory['free'], - 'buffered_memory': memory['buffered'], - 'shared_memory': memory['shared'], - } - if 'cached' in memory: - extra_values['cached_memory'] = memory.get('cached') - percent_used = 100 * ( - 1 - (memory['free'] + memory['buffered']) / memory['total'] - ) - # Available Memory is not shown in some systems (older openwrt versions) - if 'available' in memory: - extra_values.update({'available_memory': memory['available']}) - if memory['available'] > memory['free']: - percent_used = 100 * ( - 1 - (memory['available'] + memory['buffered']) / memory['total'] - ) - metric, created = Metric._get_or_create( - object_id=primary_key, content_type=content_type, configuration='memory' - ) - if created: - self._create_resources_chart(metric, resource='memory') - self._create_resources_alert_settings(metric, resource='memory') - metric.write(percent_used, current, time=time, extra_values=extra_values) - - def _calculate_increment(self, ifname, stat, value): - """ - compares value with previously stored counter and - calculates the increment of the value (which is returned) - """ - # get previous counters - data = self._previous_data - try: - previous_counter = data['interfaces_dict'][ifname]['statistics'][stat] - except KeyError: - # if no previous measurements present, counter will start from zero - previous_counter = 0 - # if current value is higher than previous value, - # it means the interface traffic counter is increasing - # and to calculate the traffic performed since the last - # measurement we have to calculate the difference - if value >= previous_counter: - return value - previous_counter - # on the other side, if the current value is less than - # the previous value, it means that the counter was restarted - # (eg: reboot, configuration reload), so we keep the whole amount - else: - return value - - def _create_traffic_chart(self, metric): - """ - create "traffic (GB)" chart - """ - if 'traffic' not in monitoring_settings.AUTO_CHARTS: - return - chart = Chart(metric=metric, configuration='traffic') - chart.full_clean() - chart.save() - - def _create_clients_chart(self, metric): - """ - creates "WiFi associations" chart - """ - if 'wifi_clients' not in monitoring_settings.AUTO_CHARTS: - return - chart = Chart(metric=metric, configuration='wifi_clients') - chart.full_clean() - chart.save() - - def _create_resources_chart(self, metric, resource): - if resource not in monitoring_settings.AUTO_CHARTS: - return - chart = Chart(metric=metric, configuration=resource) - chart.full_clean() - chart.save() - - def _create_resources_alert_settings(self, metric, resource): - alert_settings = AlertSettings(metric=metric) - alert_settings.full_clean() - alert_settings.save() - - def _create_signal_strength_chart(self, metric): - chart = Chart(metric=metric, configuration='signal_strength') - chart.full_clean() - chart.save() - - def _create_signal_quality_chart(self, metric): - chart = Chart(metric=metric, configuration='signal_quality') - chart.full_clean() - chart.save() - - def _create_access_tech_chart(self, metric): - chart = Chart(metric=metric, configuration='access_tech') - chart.full_clean() - chart.save() - device_metric = DeviceMetricView.as_view() @@ -454,10 +241,95 @@ class MonitoringGeoJsonLocationList(GeoJsonLocationList): class MonitoringLocationDeviceList(LocationDeviceList): - serializer_class = MonitoringDeviceSerializer + serializer_class = MonitoringLocationDeviceSerializer def get_queryset(self): return super().get_queryset().select_related('monitoring').order_by('name') monitoring_location_device_list = MonitoringLocationDeviceList.as_view() + + +class MonitoringNearbyDeviceList( + DeviceKeyAuthenticationMixin, FilterByOrganizationManaged, ListAPIView +): + serializer_class = MonitoringNearbyDeviceSerializer + pagination_class = ListViewPagination + filter_backends = [DjangoFilterBackend] + filterset_class = MonitoringNearbyDeviceFilter + permission_classes = [] + + def get_queryset(self): + qs = Device.objects.select_related('monitoring') + location_lookup = Q(devicelocation__content_object_id=self.kwargs['pk']) + device_key = self.request.query_params.get('key') + if device_key: + location_lookup &= Q(devicelocation__content_object__key=device_key) + if not self.request.user.is_superuser and not device_key: + qs = self.get_organization_queryset(qs) + location = get_object_or_404(Location.objects, location_lookup) + return ( + qs.exclude(id=self.kwargs['pk']) + .filter( + devicelocation__isnull=False, + ) + .annotate( + distance=Round( + Distance('devicelocation__location__geometry', location.geometry) + ) + ) + .order_by('distance') + ) + + +monitoring_nearby_device_list = MonitoringNearbyDeviceList.as_view() + + +class MonitoringDeviceList(DeviceListCreateView): + """ + Lists devices and their monitoring status (health status). + + Supports session authentication and token authentication. + + `NOTE:` The response does not include the information and + health status of the specific metrics, this information + can be retrieved in the detail endpoint of each device. + """ + + serializer_class = MonitoringDeviceListSerializer + http_method_names = ['get', 'head', 'options'] + filter_backends = [DjangoFilterBackend] + filterset_class = MonitoringDeviceFilter + + def get_queryset(self): + return super().get_queryset().select_related('monitoring').order_by('name') + + +monitoring_device_list = MonitoringDeviceList.as_view() + + +class WifiSessionListView(ProtectedAPIMixin, FilterByOrganizationManaged, ListAPIView): + queryset = WifiSession.objects.select_related( + 'device', 'wifi_client', 'device__organization', 'device__group' + ) + organization_field = 'device__organization' + filter_backends = [DjangoFilterBackend] + pagination_class = ListViewPagination + filterset_class = WifiSessionFilter + serializer_class = WifiSessionSerializer + + +wifi_session_list = WifiSessionListView.as_view() + + +class WifiSessionDetailView( + ProtectedAPIMixin, FilterByOrganizationManaged, RetrieveAPIView +): + queryset = WifiSession.objects.select_related( + 'device', 'wifi_client', 'device__organization' + ) + organization_field = 'device__organization' + serializer_class = WifiSessionSerializer + + +wifi_session_detail = WifiSessionDetailView.as_view() diff --git a/openwisp_monitoring/device/apps.py b/openwisp_monitoring/device/apps.py index 510629de1..00696427c 100644 --- a/openwisp_monitoring/device/apps.py +++ b/openwisp_monitoring/device/apps.py @@ -3,7 +3,7 @@ from django.apps import AppConfig from django.conf import settings from django.core.cache import cache -from django.db.models import Case, Count, Sum, When +from django.db.models import Count from django.db.models.signals import post_delete, post_save from django.urls import reverse_lazy from django.utils.translation import gettext_lazy as _ @@ -11,7 +11,6 @@ from openwisp_controller.config.signals import checksum_requested, config_status_changed from openwisp_controller.connection import settings as connection_settings -from openwisp_controller.connection.apps import ConnectionConfig from openwisp_controller.connection.signals import is_working_changed from openwisp_utils.admin_theme import ( register_dashboard_chart, @@ -20,11 +19,16 @@ from openwisp_utils.admin_theme.menu import register_menu_subitem from ..check import settings as check_settings +from ..monitoring.signals import threshold_crossed from ..settings import MONITORING_API_BASEURL, MONITORING_API_URLCONF from ..utils import transaction_on_commit from . import settings as app_settings from .signals import device_metrics_received, health_status_changed -from .utils import get_device_cache_key, manage_short_retention_policy +from .utils import ( + get_device_cache_key, + manage_default_retention_policy, + manage_short_retention_policy, +) class DeviceMonitoringConfig(AppConfig): @@ -33,31 +37,114 @@ class DeviceMonitoringConfig(AppConfig): verbose_name = _('Device Monitoring') def ready(self): + manage_default_retention_policy() manage_short_retention_policy() self.connect_is_working_changed() self.connect_device_signals() self.connect_config_status_changed() + self.connect_wifi_client_signals() self.connect_offline_device_close_wifisession() + self.connect_check_signals() self.device_recovery_detection() self.set_update_config_model() self.register_dashboard_items() self.register_menu_groups() self.add_connection_ignore_notification_reasons() + def connect_check_signals(self): + from django.db.models.signals import post_delete, post_save + from swapper import load_model + + Check = load_model('check', 'Check') + DeviceMonitoring = load_model('device_monitoring', 'DeviceMonitoring') + + post_save.connect( + DeviceMonitoring.handle_critical_metric, + sender=Check, + dispatch_uid='check_post_save_receiver', + ) + post_delete.connect( + DeviceMonitoring.handle_critical_metric, + sender=Check, + dispatch_uid='check_post_delete_receiver', + ) + def connect_device_signals(self): + from .api.views import DeviceMetricView + Device = load_model('config', 'Device') + DeviceData = load_model('device_monitoring', 'DeviceData') + DeviceLocation = load_model('geo', 'DeviceLocation') + Metric = load_model('monitoring', 'Metric') + Chart = load_model('monitoring', 'Chart') + Organization = load_model('openwisp_users', 'Organization') post_save.connect( self.device_post_save_receiver, sender=Device, dispatch_uid='device_post_save_receiver', ) + post_save.connect( + DeviceData.invalidate_cache, + sender=Device, + dispatch_uid='post_save_device_invalidate_devicedata_cache', + ) + post_save.connect( + DeviceData.invalidate_cache, + sender=DeviceLocation, + dispatch_uid='post_save_devicelocation_invalidate_devicedata_cache', + ) + post_save.connect( + DeviceMetricView.invalidate_get_charts_cache, + sender=Metric, + dispatch_uid=('metric_post_save_invalidate_view_charts_cache'), + ) + post_save.connect( + DeviceMetricView.invalidate_get_charts_cache, + sender=Chart, + dispatch_uid=('chart_post_save_invalidate_view_charts_cache'), + ) post_delete.connect( self.device_post_delete_receiver, sender=Device, dispatch_uid='device_post_delete_receiver', ) + post_delete.connect( + DeviceMetricView.invalidate_get_device_cache, + sender=Device, + dispatch_uid=('device_post_delete_invalidate_view_device_cache'), + ) + post_delete.connect( + DeviceMetricView.invalidate_get_charts_cache, + sender=Device, + dispatch_uid=('device_post_delete_invalidate_view_charts_cache'), + ) + post_delete.connect( + DeviceMetricView.invalidate_get_charts_cache, + sender=Metric, + dispatch_uid=('metric_post_delete_invalidate_view_charts_cache'), + ) + post_delete.connect( + DeviceMetricView.invalidate_get_charts_cache, + sender=Chart, + dispatch_uid=('chart_post_delete_invalidate_view_charts_cache'), + ) + post_delete.connect( + DeviceData.invalidate_cache, + sender=Device, + dispatch_uid='post_delete_device_invalidate_devicedata_cache', + ) + post_delete.connect( + DeviceData.invalidate_cache, + sender=DeviceLocation, + dispatch_uid='post_delete_devicelocation_invalidate_devicedata_cache', + ) + post_save.connect( + self.organization_post_save_receiver, + sender=Organization, + dispatch_uid='post_save_organization_disabled_monitoring', + ) @classmethod def device_post_save_receiver(cls, instance, created, **kwargs): @@ -72,6 +159,13 @@ def device_post_delete_receiver(cls, instance, **kwargs): instance.checks.all().delete() instance.metrics.all().delete() + @classmethod + def organization_post_save_receiver(cls, instance, *args, **kwargs): + if instance.is_active is False: + from .tasks import handle_disabled_organization + + handle_disabled_organization.delay(str(instance.id)) + def device_recovery_detection(self): if not app_settings.DEVICE_RECOVERY_DETECTION: return @@ -170,16 +264,32 @@ def connect_config_status_changed(cls): dispatch_uid='monitoring.config_status_changed_receiver', ) + @classmethod + def connect_wifi_client_signals(cls): + if not app_settings.WIFI_SESSIONS_ENABLED: + return + WifiClient = load_model('device_monitoring', 'WifiClient') + post_save.connect( + WifiClient.invalidate_cache, + sender=WifiClient, + dispatch_uid='post_save_invalidate_wificlient_cache', + ) + post_delete.connect( + WifiClient.invalidate_cache, + sender=WifiClient, + dispatch_uid='post_delete_invalidate_wificlient_cache', + ) + @classmethod def connect_offline_device_close_wifisession(cls): if not app_settings.WIFI_SESSIONS_ENABLED: return - DeviceMonitoring = load_model('device_monitoring', 'DeviceMonitoring') + Metric = load_model('monitoring', 'Metric') WifiSession = load_model('device_monitoring', 'WifiSession') - health_status_changed.connect( + threshold_crossed.connect( WifiSession.offline_device_close_session, - sender=DeviceMonitoring, + sender=Metric, dispatch_uid='offline_device_close_session', ) @@ -249,12 +359,12 @@ def register_dashboard_items(self): 'monitoring/css/device-map.css', 'leaflet/leaflet.css', 'monitoring/css/leaflet.fullscreen.css', + 'monitoring/css/netjsongraph.css', ), 'js': ( + 'monitoring/js/lib/netjsongraph.min.js', + 'monitoring/js/lib/leaflet.fullscreen.min.js', 'monitoring/js/device-map.js', - 'leaflet/leaflet.js', - 'leaflet/leaflet.extras.js', - 'monitoring/js/leaflet.fullscreen.min.js', ), }, extra_config={ @@ -263,41 +373,7 @@ def register_dashboard_items(self): }, ) - register_dashboard_template( - position=55, - config={ - 'template': 'monitoring/paritals/chart.html', - 'css': ( - 'monitoring/css/percircle.min.css', - 'monitoring/css/chart.css', - 'monitoring/css/dashboard-chart.css', - ), - 'js': ( - 'monitoring/js/percircle.min.js', - 'monitoring/js/chart.js', - 'monitoring/js/chart-utils.js', - 'monitoring/js/dashboard-chart.js', - ), - }, - extra_config={ - 'api_url': reverse_lazy('monitoring_general:api_dashboard_timeseries'), - 'default_time': Chart.DEFAULT_TIME, - 'chart_quick_links': { - 'General WiFi Clients': { - 'url': reverse_lazy( - 'admin:{app_label}_{model_name}_changelist'.format( - app_label=WifiSession._meta.app_label, - model_name=WifiSession._meta.model_name, - ) - ), - 'label': _('Open WiFi session list'), - 'title': _('View full history of WiFi Sessions'), - } - }, - }, - after_charts=True, - ) - + general_wifi_client_quick_links = {} if app_settings.WIFI_SESSIONS_ENABLED: register_dashboard_chart( position=13, @@ -306,29 +382,21 @@ def register_dashboard_items(self): 'query_params': { 'app_label': WifiSession._meta.app_label, 'model': WifiSession._meta.model_name, - 'annotate': { - 'active': Count( - Case( - When( - stop_time__isnull=True, - then=1, - ) - ) - ), - }, + 'filter': {'stop_time__isnull': True}, 'aggregate': { - 'active__sum': Sum('active'), + 'active__count': Count('id'), }, + 'organization_field': 'device__organization_id', }, 'filters': { 'key': 'stop_time__isnull', - 'active__sum': 'true', + 'active__count': 'true', }, 'colors': { - 'active__sum': '#267126', + 'active__count': '#267126', }, 'labels': { - 'active__sum': _('Currently Active WiFi Sessions'), + 'active__count': _('Currently Active WiFi Sessions'), }, 'quick_link': { 'url': reverse_lazy( @@ -344,6 +412,49 @@ def register_dashboard_items(self): }, ) + general_wifi_client_quick_links = { + 'General WiFi Clients': { + 'url': reverse_lazy( + 'admin:{app_label}_{model_name}_changelist'.format( + app_label=WifiSession._meta.app_label, + model_name=WifiSession._meta.model_name, + ) + ), + 'label': _('Open WiFi session list'), + 'title': _('View full history of WiFi Sessions'), + } + } + + register_dashboard_template( + position=55, + config={ + 'template': 'monitoring/paritals/chart.html', + 'css': ( + 'monitoring/css/daterangepicker.css', + 'monitoring/css/percircle.min.css', + 'monitoring/css/chart.css', + 'monitoring/css/dashboard-chart.css', + 'admin/css/vendor/select2/select2.min.css', + 'admin/css/autocomplete.css', + ), + 'js': ( + 'admin/js/vendor/select2/select2.full.min.js', + 'monitoring/js/lib/moment.min.js', + 'monitoring/js/lib/daterangepicker.min.js', + 'monitoring/js/lib/percircle.min.js', + 'monitoring/js/chart.js', + 'monitoring/js/chart-utils.js', + 'monitoring/js/dashboard-chart.js', + ), + }, + extra_config={ + 'api_url': reverse_lazy('monitoring_general:api_dashboard_timeseries'), + 'default_time': Chart.DEFAULT_TIME, + 'chart_quick_links': general_wifi_client_quick_links, + }, + after_charts=True, + ) + def register_menu_groups(self): if app_settings.WIFI_SESSIONS_ENABLED: register_menu_subitem( @@ -358,6 +469,8 @@ def register_menu_groups(self): ) def add_connection_ignore_notification_reasons(self): + from openwisp_controller.connection.apps import ConnectionConfig + ConnectionConfig._ignore_connection_notification_reasons.extend( ['timed out', 'Unable to connect'] ) diff --git a/openwisp_monitoring/device/base/models.py b/openwisp_monitoring/device/base/models.py index 87c0850cf..4c7803175 100644 --- a/openwisp_monitoring/device/base/models.py +++ b/openwisp_monitoring/device/base/models.py @@ -9,6 +9,7 @@ from django.core.cache import cache from django.core.exceptions import ValidationError from django.db import models +from django.db.models.signals import post_delete from django.dispatch import receiver from django.utils.timezone import now from django.utils.translation import gettext_lazy as _ @@ -21,11 +22,13 @@ from swapper import load_model from openwisp_controller.config.validators import mac_address_validator +from openwisp_monitoring.device.settings import get_critical_device_metrics from openwisp_utils.base import TimeStampedEditableModel from ...db import device_data_query, timeseries_db from ...monitoring.signals import threshold_crossed -from ...monitoring.tasks import timeseries_write +from ...monitoring.tasks import _timeseries_write +from ...settings import CACHE_TIMEOUT from .. import settings as app_settings from .. import tasks from ..schema import schema @@ -48,9 +51,37 @@ class AbstractDeviceData(object): __data_timestamp = None def __init__(self, *args, **kwargs): + from ..writer import DeviceDataWriter + self.data = kwargs.pop('data', None) + self.writer = DeviceDataWriter(self) super().__init__(*args, **kwargs) + @classmethod + @cache_memoize(CACHE_TIMEOUT) + def get_devicedata(cls, pk): + obj = ( + cls.objects.select_related('devicelocation') + .only( + 'id', + 'organization_id', + 'devicelocation__location_id', + 'devicelocation__floorplan_id', + ) + .get(id=pk) + ) + return obj + + @classmethod + def invalidate_cache(cls, instance, *args, **kwargs): + if isinstance(instance, load_model('geo', 'DeviceLocation')): + pk = instance.content_object_id + else: + if kwargs.get('created'): + return + pk = instance.pk + cls.get_devicedata.invalidate(cls, str(pk)) + def can_be_updated(self): """ Do not attempt at pushing the conf if the device is not reachable @@ -58,6 +89,18 @@ def can_be_updated(self): can_be_updated = super().can_be_updated() return can_be_updated and self.monitoring.status not in ['critical', 'unknown'] + def _get_wifi_version(self, htmode): + wifi_version_htmode = f'{_("Other")}: {htmode}' + if 'NOHT' in htmode: + wifi_version_htmode = f'{_("Legacy Mode")}: {htmode}' + elif 'HE' in htmode: + wifi_version_htmode = f'WiFi 6 (802.11ax): {htmode}' + elif 'VHT' in htmode: + wifi_version_htmode = f'WiFi 5 (802.11ac): {htmode}' + elif 'HT' in htmode: + wifi_version_htmode = f'WiFi 4 (802.11n): {htmode}' + return wifi_version_htmode + @property def data_user_friendly(self): if not self.data: @@ -90,6 +133,12 @@ def data_user_friendly(self): # convert to GHz if 'wireless' in interface and 'frequency' in interface['wireless']: interface['wireless']['frequency'] /= 1000 + # add wifi version + if 'wireless' in interface and 'htmode' in interface['wireless']: + interface['wireless']['htmode'] = self._get_wifi_version( + interface['wireless']['htmode'] + ) + interface_dict[interface['name']] = interface # reorder interfaces in alphabetical order interface_dict = OrderedDict(sorted(interface_dict.items())) @@ -162,6 +211,35 @@ def _transform_data(self): for signal_key, signal_values in interface['mobile']['signal'].items(): for key, value in signal_values.items(): signal_values[key] = float(value) + # If HT/VHT/HE is not being used ie. htmode = 'NOHT', + # set the HT/VHT/HE field of WiFi clients to None. + # This is necessary because some clients may be + # VHT capable but VHT is not enabled at the radio level, + # which can mislead into thinking the client is not HT/VHT/HE capable. + wireless = interface.get('wireless') + if wireless and all(key in wireless for key in ('htmode', 'clients')): + for client in wireless['clients']: + htmode = wireless['htmode'] + ht_enabled = htmode.startswith('HT') + vht_enabled = htmode.startswith('VHT') + noht_enabled = htmode == 'NOHT' + if noht_enabled: + client['ht'] = client['vht'] = None + # since 'he' field is optional + if 'he' in client: + client['he'] = None + elif ht_enabled: + if client['vht'] is False: + client['vht'] = None + if client.get('he') is False: + client['he'] = None + elif vht_enabled and client.get('he') is False: + client['he'] = None + # Convert bitrate from KBits/s to MBits/s + if wireless and 'bitrate' in wireless: + interface['wireless']['bitrate'] = round( + interface['wireless']['bitrate'] / 1000.0, 1 + ) # add mac vendor to wireless clients if present if ( not mac_detection @@ -199,7 +277,7 @@ def save_data(self, time=None): self._transform_data() time = time or now() options = dict(tags={'pk': self.pk}, timestamp=time, retention_policy=SHORT_RP) - timeseries_write.delay(name=self.__key, values={'data': self.json()}, **options) + _timeseries_write(name=self.__key, values={'data': self.json()}, **options) cache_key = get_device_cache_key(device=self, context='current-data') # cache current data to allow getting it without querying the timeseries DB cache.set( @@ -210,16 +288,57 @@ def save_data(self, time=None): 'time': time.astimezone(tz=tz('UTC')).isoformat(timespec='seconds'), } ], - timeout=86400, # 24 hours + timeout=CACHE_TIMEOUT, ) if app_settings.WIFI_SESSIONS_ENABLED: - tasks.save_wifi_clients_and_sessions.delay( - device_data=self.data, device_pk=self.pk - ) + self.save_wifi_clients_and_sessions() def json(self, *args, **kwargs): return json.dumps(self.data, *args, **kwargs) + def save_wifi_clients_and_sessions(self): + _WIFICLIENT_FIELDS = ['vendor', 'ht', 'vht', 'he', 'wmm', 'wds', 'wps'] + WifiClient = load_model('device_monitoring', 'WifiClient') + WifiSession = load_model('device_monitoring', 'WifiSession') + + active_sessions = [] + interfaces = self.data.get('interfaces', []) + for interface in interfaces: + if interface.get('type') != 'wireless': + continue + interface_name = interface.get('name') + wireless = interface.get('wireless', {}) + if not wireless or wireless['mode'] != 'access_point': + continue + ssid = wireless.get('ssid') + clients = wireless.get('clients', []) + for client in clients: + # Save WifiClient + client_obj = WifiClient.get_wifi_client(client.get('mac')) + update_fields = [] + for field in _WIFICLIENT_FIELDS: + if getattr(client_obj, field) != client.get(field): + setattr(client_obj, field, client.get(field)) + update_fields.append(field) + if update_fields: + client_obj.full_clean() + client_obj.save(update_fields=update_fields) + + # Save WifiSession + session_obj, _ = WifiSession.objects.get_or_create( + device_id=self.id, + interface_name=interface_name, + ssid=ssid, + wifi_client=client_obj, + stop_time=None, + ) + active_sessions.append(session_obj.pk) + + # Close open WifiSession + WifiSession.objects.filter(device_id=self.id, stop_time=None,).exclude( + pk__in=active_sessions + ).update(stop_time=now()) + class AbstractDeviceMonitoring(TimeStampedEditableModel): device = models.OneToOneField( @@ -318,6 +437,40 @@ def is_metric_critical(metric): return True return False + @classmethod + def handle_disabled_organization(cls, organization_id): + """ + Clears the management IP of all devices belonging to a + disabled organization and set their monitoring status to 'unknown'. + + Parameters: + organization_id (int): The ID of the disabled organization. + + Returns: + None + """ + load_model('config', 'Device').objects.filter( + organization_id=organization_id + ).update(management_ip='') + cls.objects.filter(device__organization_id=organization_id).update( + status='unknown' + ) + + @classmethod + def _get_critical_metric_keys(cls): + return [metric['key'] for metric in get_critical_device_metrics()] + + @classmethod + def handle_critical_metric(cls, instance, **kwargs): + critical_metrics = cls._get_critical_metric_keys() + if instance.check_type in critical_metrics: + try: + device_monitoring = cls.objects.get(device=instance.content_object) + if not instance.is_active or kwargs.get('signal') == post_delete: + device_monitoring.update_status('unknown') + except cls.DoesNotExist: + pass + class AbstractWifiClient(TimeStampedEditableModel): id = None @@ -329,8 +482,9 @@ class AbstractWifiClient(TimeStampedEditableModel): help_text=_('MAC address'), ) vendor = models.CharField(max_length=200, blank=True, null=True) - ht = models.BooleanField(default=False, verbose_name='HT') - vht = models.BooleanField(default=False, verbose_name='VHT') + he = models.BooleanField(null=True, blank=True, default=None, verbose_name='HE') + vht = models.BooleanField(null=True, blank=True, default=None, verbose_name='VHT') + ht = models.BooleanField(null=True, blank=True, default=None, verbose_name='HT') wmm = models.BooleanField(default=False, verbose_name='WMM') wds = models.BooleanField(default=False, verbose_name='WDS') wps = models.BooleanField(default=False, verbose_name='WPS') @@ -338,6 +492,19 @@ class AbstractWifiClient(TimeStampedEditableModel): class Meta: abstract = True verbose_name = _('WiFi Client') + ordering = ('-created',) + + @classmethod + @cache_memoize(CACHE_TIMEOUT) + def get_wifi_client(cls, mac_address): + wifi_client, _ = cls.objects.get_or_create(mac_address=mac_address) + return wifi_client + + @classmethod + def invalidate_cache(cls, instance, *args, **kwargs): + if kwargs.get('created'): + return + cls.get_wifi_client.invalidate(cls, instance.mac_address) class AbstractWifiSession(TimeStampedEditableModel): @@ -386,6 +553,13 @@ def vendor(self): return self.wifi_client.vendor @classmethod - def offline_device_close_session(cls, instance, *args, **kwargs): - if kwargs['status'] == 'critical': - tasks.offline_device_close_session.delay(device_id=instance.device_id) + def offline_device_close_session( + cls, metric, tolerance_crossed, first_time, target, **kwargs + ): + if ( + not first_time + and tolerance_crossed + and not metric.is_healthy_tolerant + and AbstractDeviceMonitoring.is_metric_critical(metric) + ): + tasks.offline_device_close_session.delay(device_id=target.pk) diff --git a/openwisp_monitoring/device/exportable.py b/openwisp_monitoring/device/exportable.py new file mode 100644 index 000000000..7e4c8fb5f --- /dev/null +++ b/openwisp_monitoring/device/exportable.py @@ -0,0 +1,20 @@ +from import_export.fields import Field + +from openwisp_controller.geo.exportable import GeoDeviceResource as BaseDeviceResource + + +class DeviceMonitoringResource(BaseDeviceResource): + monitoring_status = Field( + attribute='monitoring__status', column_name='monitoring_status', readonly=True + ) + + class Meta(BaseDeviceResource.Meta): + fields = BaseDeviceResource.Meta.fields[:] # copy + # add monitoring status to the exportable fields of DeviceAdmin + fields.insert(fields.index('config_status'), 'monitoring_status') + export_order = fields + + +# this list of field is defined here to facilitate integartion testing +# with other modules which may need to mock this before the admin is loaded +_exportable_fields = DeviceMonitoringResource.Meta.fields diff --git a/openwisp_monitoring/device/filters.py b/openwisp_monitoring/device/filters.py new file mode 100644 index 000000000..8c503e5e4 --- /dev/null +++ b/openwisp_monitoring/device/filters.py @@ -0,0 +1,25 @@ +from django.utils.translation import gettext_lazy as _ +from swapper import load_model + +from openwisp_users.multitenancy import MultitenantOrgFilter +from openwisp_utils.admin_theme.filters import AutocompleteFilter + +Device = load_model('config', 'Device') + + +class DeviceOrganizationFilter(MultitenantOrgFilter): + rel_model = Device + parameter_name = 'device__organization' + + +class DeviceGroupFilter(AutocompleteFilter): + field_name = 'group' + parameter_name = 'device__group' + title = _('group') + rel_model = Device + + +class DeviceFilter(AutocompleteFilter): + field_name = 'device' + parameter_name = 'device' + title = _('device') diff --git a/openwisp_monitoring/device/migrations/0006_alter_wificlient_field_ht_vht.py b/openwisp_monitoring/device/migrations/0006_alter_wificlient_field_ht_vht.py new file mode 100644 index 000000000..1ee976ff8 --- /dev/null +++ b/openwisp_monitoring/device/migrations/0006_alter_wificlient_field_ht_vht.py @@ -0,0 +1,27 @@ +# Generated by Django 3.2.18 on 2023-04-04 10:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('device_monitoring', '0005_add_group_permissions'), + ] + + operations = [ + migrations.AlterField( + model_name='wificlient', + name='ht', + field=models.BooleanField( + blank=True, default=None, null=True, verbose_name='HT' + ), + ), + migrations.AlterField( + model_name='wificlient', + name='vht', + field=models.BooleanField( + blank=True, default=None, null=True, verbose_name='VHT' + ), + ), + ] diff --git a/openwisp_monitoring/device/migrations/0007_add_wificlient_field_he.py b/openwisp_monitoring/device/migrations/0007_add_wificlient_field_he.py new file mode 100644 index 000000000..3ed461f5d --- /dev/null +++ b/openwisp_monitoring/device/migrations/0007_add_wificlient_field_he.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.18 on 2023-04-20 11:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('device_monitoring', '0006_alter_wificlient_field_ht_vht'), + ] + + operations = [ + migrations.AddField( + model_name='wificlient', + name='he', + field=models.BooleanField( + blank=True, default=None, null=True, verbose_name='HE' + ), + ), + ] diff --git a/openwisp_monitoring/device/migrations/0008_alter_wificlient_options.py b/openwisp_monitoring/device/migrations/0008_alter_wificlient_options.py new file mode 100644 index 000000000..a3d74f69e --- /dev/null +++ b/openwisp_monitoring/device/migrations/0008_alter_wificlient_options.py @@ -0,0 +1,17 @@ +# Generated by Django 4.0.4 on 2022-06-03 11:36 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('device_monitoring', '0007_add_wificlient_field_he'), + ] + + operations = [ + migrations.AlterModelOptions( + name='wificlient', + options={'ordering': ('-created',), 'verbose_name': 'WiFi Client'}, + ), + ] diff --git a/openwisp_monitoring/device/migrations/0009_update_device_status_for_disabled_critical_checks.py b/openwisp_monitoring/device/migrations/0009_update_device_status_for_disabled_critical_checks.py new file mode 100644 index 000000000..be92c32a1 --- /dev/null +++ b/openwisp_monitoring/device/migrations/0009_update_device_status_for_disabled_critical_checks.py @@ -0,0 +1,27 @@ +from django.db import migrations +from swapper import load_model + + +def update_critical_device_metric_status(apps, schema_editor): + Check = apps.get_model('check', 'Check') + # We need to load the real concrete model here, because we + # will be calling one of its class methods below + DeviceMonitoring = load_model('device_monitoring', 'DeviceMonitoring') + critical_metrics_keys = DeviceMonitoring._get_critical_metric_keys() + + for check in Check.objects.filter( + is_active=False, check_type__in=critical_metrics_keys + ).iterator(): + DeviceMonitoring.handle_critical_metric(check) + + +class Migration(migrations.Migration): + dependencies = [ + ('device_monitoring', '0008_alter_wificlient_options'), + ] + + operations = [ + migrations.RunPython( + update_critical_device_metric_status, reverse_code=migrations.RunPython.noop + ), + ] diff --git a/openwisp_monitoring/device/schema.py b/openwisp_monitoring/device/schema.py index 1da415fbe..e58b2a72b 100644 --- a/openwisp_monitoring/device/schema.py +++ b/openwisp_monitoring/device/schema.py @@ -190,7 +190,7 @@ }, "wireless": { "type": "object", - "additionalProperties": False, + "additionalProperties": True, "required": [ "channel", "country", @@ -209,6 +209,7 @@ "signal": {"type": "integer"}, "ssid": {"type": "string"}, "tx_power": {"type": "integer"}, + "htmode": {"type": "string"}, "clients": { "type": "array", "title": "Wireless Clients", @@ -228,17 +229,21 @@ ], "properties": { "aid": {"type": "integer"}, - "singal": {"type": "integer"}, + "signal": {"type": "integer"}, "noise": {"type": "integer"}, "assoc": {"type": "boolean"}, "auth": {"type": "boolean"}, "authorized": {"type": "boolean"}, "ht": {"type": "boolean"}, "vht": {"type": "boolean"}, + "he": {"type": "boolean"}, "wds": {"type": "boolean"}, "wmm": {"type": "boolean"}, "wps": {"type": "boolean"}, "mac": {"type": "string"}, + "bitrate": {"type": "integer"}, + "quality": {"type": "integer"}, + "quality_max": {"type": "integer"}, "vendor": {"type": "string"}, "mfp": {"type": "boolean"}, "preauth": {"type": "boolean"}, @@ -256,7 +261,7 @@ }, "mobile": { "type": "object", - "additionalProperties": False, + "additionalProperties": True, "required": [ "imei", "operator_code", @@ -286,17 +291,17 @@ "model": {"type": "string"}, "signal": { "type": "object", - "additionalProperties": False, + "additionalProperties": True, "properties": { "gsm": { "type": "object", - "additionalProperties": False, + "additionalProperties": True, "required": ["rssi"], "properties": {"rssi": {"type": "number"}}, }, "cdma1x": { "type": "object", - "additionalProperties": False, + "additionalProperties": True, "required": ["rssi", "ecio"], "properties": { "rssi": {"type": "number"}, @@ -305,7 +310,7 @@ }, "evdo": { "type": "object", - "additionalProperties": False, + "additionalProperties": True, "required": ["rssi", "ecio", "io", "sinr"], "properties": { "rssi": {"type": "number"}, @@ -316,7 +321,7 @@ }, "umts": { "type": "object", - "additionalProperties": False, + "additionalProperties": True, "required": ["ecio"], "properties": { "rssi": {"type": "number"}, @@ -326,7 +331,7 @@ }, "lte": { "type": "object", - "additionalProperties": False, + "additionalProperties": True, "required": ["rssi", "rsrp", "rsrq", "snr"], "properties": { "rssi": {"type": "number"}, @@ -337,7 +342,7 @@ }, "5g": { "type": "object", - "additionalProperties": False, + "additionalProperties": True, "required": ["rsrp", "rsrq", "snr"], "properties": { "rsrp": {"type": "number"}, diff --git a/openwisp_monitoring/device/settings.py b/openwisp_monitoring/device/settings.py index 8a8250552..d239e3eac 100644 --- a/openwisp_monitoring/device/settings.py +++ b/openwisp_monitoring/device/settings.py @@ -43,6 +43,7 @@ def get_health_status_labels(): SHORT_RETENTION_POLICY = get_settings_value('SHORT_RETENTION_POLICY', '24h0m0s') +DEFAULT_RETENTION_POLICY = get_settings_value('DEFAULT_RETENTION_POLICY', '26280h0m0s') CRITICAL_DEVICE_METRICS = get_critical_device_metrics() HEALTH_STATUS_LABELS = get_health_status_labels() AUTO_CLEAR_MANAGEMENT_IP = get_settings_value('AUTO_CLEAR_MANAGEMENT_IP', True) diff --git a/openwisp_monitoring/device/static/monitoring/css/daterangepicker.css b/openwisp_monitoring/device/static/monitoring/css/daterangepicker.css new file mode 100644 index 000000000..7135bf290 --- /dev/null +++ b/openwisp_monitoring/device/static/monitoring/css/daterangepicker.css @@ -0,0 +1,435 @@ +.daterangepicker { + position: absolute; + color: inherit; + background-color: #fff; + border-radius: 4px; + border: 1px solid #ddd; + width: 278px; + max-width: none; + padding: 0; + margin-top: 7px; + top: 100px; + left: 20px; + z-index: 3001; + display: none; + font-family: arial; + font-size: 15px; + line-height: 1em; +} +.daterangepicker:before, +.daterangepicker:after { + position: absolute; + display: inline-block; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ""; +} +.daterangepicker:before { + top: -7px; + border-right: 7px solid transparent; + border-left: 7px solid transparent; + border-bottom: 7px solid #ccc; +} +.daterangepicker:after { + top: -6px; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + border-left: 6px solid transparent; +} +.daterangepicker.opensleft:before { + right: 9px; +} +.daterangepicker.opensleft:after { + right: 10px; +} +.daterangepicker.openscenter:before { + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; +} +.daterangepicker.openscenter:after { + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; +} +.daterangepicker.opensright:before { + left: 9px; +} +.daterangepicker.opensright:after { + left: 10px; +} +.daterangepicker.drop-up { + margin-top: -7px; +} +.daterangepicker.drop-up:before { + top: initial; + bottom: -7px; + border-bottom: initial; + border-top: 7px solid #ccc; +} +.daterangepicker.drop-up:after { + top: initial; + bottom: -6px; + border-bottom: initial; + border-top: 6px solid #fff; +} +.daterangepicker.single .daterangepicker .ranges, +.daterangepicker.single .drp-calendar { + float: none; +} +.daterangepicker.single .drp-selected { + display: none; +} +.daterangepicker.show-calendar .drp-calendar { + display: block; +} +.daterangepicker.show-calendar .drp-buttons { + display: block; +} +.daterangepicker.auto-apply .drp-buttons { + display: none; +} +.daterangepicker .drp-calendar { + display: none; + max-width: 270px; +} +.daterangepicker .drp-calendar.left { + padding: 8px 0 8px 8px; +} +.daterangepicker .drp-calendar.right { + padding: 8px; +} +.daterangepicker .drp-calendar.single .calendar-table { + border: none; +} +.daterangepicker .calendar-table .next span, +.daterangepicker .calendar-table .prev span { + color: #fff; + border: solid black; + border-width: 0 2px 2px 0; + border-radius: 0; + display: inline-block; + padding: 3px; +} +.daterangepicker .calendar-table .next span { + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); +} +.daterangepicker .calendar-table .prev span { + transform: rotate(135deg); + -webkit-transform: rotate(135deg); +} +.daterangepicker .calendar-table th, +.daterangepicker .calendar-table td { + white-space: nowrap; + text-align: center; + vertical-align: middle; + min-width: 32px; + width: 32px; + height: 24px; + line-height: 24px; + font-size: 12px; + border-radius: 4px; + border: 1px solid transparent; + white-space: nowrap; + cursor: pointer; +} +.daterangepicker .calendar-table { + border: 1px solid #fff; + border-radius: 4px; + background-color: #fff; +} +.daterangepicker .calendar-table table { + width: 100%; + margin: 0; + border-spacing: 0; + border-collapse: collapse; +} +.daterangepicker td.available:hover, +.daterangepicker th.available:hover { + background-color: #eee; + border-color: transparent; + color: inherit; +} +.daterangepicker td.week, +.daterangepicker th.week { + font-size: 80%; + color: #ccc; +} +.daterangepicker td.off, +.daterangepicker td.off.in-range, +.daterangepicker td.off.start-date, +.daterangepicker td.off.end-date { + background-color: #fff; + border-color: transparent; + color: #999; +} +.daterangepicker td.in-range { + background-color: #ebf4f8; + border-color: transparent; + color: #000; + border-radius: 0; +} +.daterangepicker td.start-date { + border-radius: 4px 0 0 4px; +} +.daterangepicker td.end-date { + border-radius: 0 4px 4px 0; +} +.daterangepicker td.start-date.end-date { + border-radius: 4px; +} +.daterangepicker td.active, +.daterangepicker td.active:hover { + background-color: #357ebd; + border-color: transparent; + color: #fff; +} +.daterangepicker th.month { + width: auto; +} +.daterangepicker td.disabled, +.daterangepicker option.disabled { + color: #999; + cursor: not-allowed; + text-decoration: line-through; +} +.daterangepicker select.monthselect, +.daterangepicker select.yearselect { + font-size: 12px; + padding: 1px; + height: auto; + margin: 0; + cursor: default; +} +.daterangepicker select.monthselect { + margin-right: 2%; + width: 56%; +} +.daterangepicker select.yearselect { + width: 40%; +} +.daterangepicker select.hourselect, +.daterangepicker select.minuteselect, +.daterangepicker select.secondselect, +.daterangepicker select.ampmselect { + width: 50px; + margin: 0 auto; + background: #eee; + border: 1px solid #eee; + padding: 2px; + outline: 0; + font-size: 12px; +} +.daterangepicker .calendar-time { + text-align: center; + margin: 4px auto 0 auto; + line-height: 30px; + position: relative; +} +.daterangepicker .calendar-time select.disabled { + color: #ccc; + cursor: not-allowed; +} +.daterangepicker .drp-buttons { + clear: both; + text-align: right; + padding: 8px; + border-top: 1px solid #ddd; + display: none; + line-height: 12px; + vertical-align: middle; +} +.daterangepicker .drp-selected { + display: inline-block; + font-size: 12px; + padding-right: 8px; +} +.daterangepicker .drp-buttons .btn { + margin-left: 8px; + font-size: 12px; + font-weight: bold; + padding: 4px 8px; +} +.daterangepicker.show-ranges.single.rtl .drp-calendar.left { + border-right: 1px solid #ddd; +} +.daterangepicker.show-ranges.single.ltr .drp-calendar.left { + border-left: 1px solid #ddd; +} +.daterangepicker.show-ranges.rtl .drp-calendar.right { + border-right: 1px solid #ddd; +} +.daterangepicker.show-ranges.ltr .drp-calendar.left { + border-left: 1px solid #ddd; +} +.daterangepicker .ranges { + float: none; + text-align: left; + margin: 0; +} +.daterangepicker.show-calendar .ranges { + margin-top: 8px; +} +.daterangepicker .ranges ul { + list-style: none; + margin: 0 auto; + padding: 0; + width: 100%; +} +.daterangepicker .ranges li { + font-size: 12px; + padding: 8px 12px; + cursor: pointer; +} +.daterangepicker .ranges li:hover { + background-color: #eee; +} +.daterangepicker .ranges li.active { + background-color: #08c; + color: #fff; +} +.daterangepicker { + width: auto; +} +.daterangepicker .ranges ul { + width: 140px; +} +.daterangepicker.single .ranges ul { + width: 100%; +} +.daterangepicker.single .ranges, +.daterangepicker.single .drp-calendar { + float: left; +} +.daterangepicker { + direction: ltr; + text-align: left; +} +.daterangepicker .drp-calendar.left { + clear: left; + margin-right: 0; +} +.daterangepicker .drp-calendar.left .calendar-table { + border-right: none; + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} +.daterangepicker .drp-calendar.right { + margin-left: 0; +} +.daterangepicker .drp-calendar.right .calendar-table { + border-left: none; + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +.daterangepicker .drp-calendar.left .calendar-table { + padding-right: 8px; +} +.daterangepicker .ranges, +.daterangepicker .drp-calendar { + float: left; +} +.daterangepicker .drp-calendar.left { + clear: none; +} +.daterangepicker .ranges li { + list-style: none; +} +.daterangepicker .ranges ul li.active { + background-color: #fce5e5; + color: #df5d43; +} +.daterangepicker .ranges ul li:hover { + background-color: #fce5e5; + color: #e4715a; +} +.daterangepicker .drp-buttons button.btn { + margin: 0 2px; + color: #fff; + background-color: #666; + padding: 5px 15px; + text-decoration: none; + border-radius: 3px; + cursor: pointer; + border: 0; + padding: 0.5rem 1rem; +} +.daterangepicker td.active, +.daterangepicker td.active:hover { + border-radius: 1.25px; + color: #fff; + background-color: #df5d43; + border-color: transparent; +} +.daterangepicker td.in-range { + background-color: #df5d43; + border-color: transparent; + + color: white; + border-radius: 0; +} +.daterangepicker td.in-range:hover { + color: white; + border-radius: 1, 25px; + background-color: #df5d43; +} +.daterangepicker .drp-buttons button.btn { + background-color: #333; + border-radius: 3.75px; +} +.daterangepicker .drp-buttons button.btn:hover { + background-color: #777; +} +.daterangepicker td.off, +.daterangepicker td.off.in-range, +.daterangepicker td.off.start-date, +.daterangepicker td.off.end-date :hover { + background-color: #fff; + color: rgba(119, 119, 119, 0.56); +} +.daterangepicker .drp-selected { + color: #df5d43; +} +.daterangepicker .drp-calendar { + max-width: 370px; +} +#daterangepicker-widget span { + color: white; + background-color: #333; + padding: 5px 10px; + border-radius: 3px; + cursor: pointer; +} +#daterangepicker-widget span:hover { + background-color: #777; +} + +/* DATERANGEPICKERS STYLING FOR NARROW SCREENS */ +@media screen and (max-width: 975px) { + .daterangepicker .ranges ul { + width: 364px; + text-align: center; + } + .daterangepicker .ranges li { + font-size: 13px; + padding: 12px; + } + .daterangepicker.show-ranges.ltr .drp-calendar.left { + margin-right: 12px; + } + .daterangepicker .drp-selected { + font-size: 14px; + padding-right: 20px; + } + .daterangepicker .drp-buttons { + text-align: center; + } + .daterangepicker .ranges, + .daterangepicker .drp-calendar { + float: none; + } +} diff --git a/openwisp_monitoring/device/static/monitoring/css/device-map.css b/openwisp_monitoring/device/static/monitoring/css/device-map.css index 9f9672de3..af7ced507 100644 --- a/openwisp_monitoring/device/static/monitoring/css/device-map.css +++ b/openwisp_monitoring/device/static/monitoring/css/device-map.css @@ -1,10 +1,18 @@ -.health-unknown{ color: grey } -.health-ok{ color: green } -.health-problem{ color: orange } -.health-critical{ color: red } -.health-status{ +.health-unknown { + color: grey; +} +.health-ok { + color: green; +} +.health-problem { + color: orange; +} +.health-critical { + color: red; +} +.health-status { font-weight: bold; - text-transform: uppercase + text-transform: uppercase; } .map-detail .paginator a { padding: 3px 7px; @@ -19,12 +27,10 @@ color: #fff; } #device-map-container { - margin: 50px 0 0; - padding: 0 40px; + margin: 50px auto; position: relative; -} -#device-map { - min-height: 300px; + height: 300px; + width: 90%; border: 1px solid rgba(0, 0, 0, 0.3); } #device-map-container .ow-loading-spinner { @@ -33,12 +39,19 @@ top: 41%; left: 49%; } +#device-map-container .leaflet-interactive:focus { + outline: none; +} +#leaflet-config { + display: none; +} .no-data { display: none; position: absolute; z-index: 99; top: 0; - left: 0; width: 100%; + left: 0; + width: 100%; text-align: center; padding-top: 115px; } diff --git a/openwisp_monitoring/device/static/monitoring/css/leaflet.fullscreen.css b/openwisp_monitoring/device/static/monitoring/css/leaflet.fullscreen.css index 604b8153b..086e3e6e7 100644 --- a/openwisp_monitoring/device/static/monitoring/css/leaflet.fullscreen.css +++ b/openwisp_monitoring/device/static/monitoring/css/leaflet.fullscreen.css @@ -14,25 +14,23 @@ /* Do not combine these two rules; IE will break. */ .leaflet-container:-webkit-full-screen { - width: 100%!important; - height: 100%!important; + width: 100% !important; + height: 100% !important; } .leaflet-container.leaflet-fullscreen-on { - width: 100%!important; - height: 100%!important; + width: 100% !important; + height: 100% !important; } .leaflet-pseudo-fullscreen { - position: fixed!important; - width: 100%!important; - height: 100%!important; - top: 0!important; - left: 0!important; + position: fixed !important; + width: 100% !important; + height: 100% !important; + top: 0 !important; + left: 0 !important; z-index: 99999; } -@media - (-webkit-min-device-pixel-ratio:2), - (min-resolution:192dpi) { +@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { .leaflet-control-fullscreen a { background-image: url(fullscreen@2x.png); } diff --git a/openwisp_monitoring/device/static/monitoring/css/monitoring.css b/openwisp_monitoring/device/static/monitoring/css/monitoring.css index 71eb012b8..fb58363d8 100644 --- a/openwisp_monitoring/device/static/monitoring/css/monitoring.css +++ b/openwisp_monitoring/device/static/monitoring/css/monitoring.css @@ -1,7 +1,7 @@ #ow-device-status > fieldset > .inline-related { padding: 0 1px; } -#ow-device-status h2{ +#ow-device-status h2 { color: #333; background-color: rgba(0, 0, 0, 0.05); outline: 1px solid rgba(0, 0, 0, 0.3); @@ -9,7 +9,7 @@ } #ow-device-status .form-row, #ow-device-status table th, -#ow-device-status table td{ +#ow-device-status table td { padding: 15px 20px !important; } #ow-device-status .form-row label, @@ -21,11 +21,11 @@ #ow-device-status .form-row label { padding-top: 2px; } -#ow-device-status .inline-group{ +#ow-device-status .inline-group { margin-bottom: 0; padding-top: 1px; } -#ow-device-status table{ +#ow-device-status table { width: 100%; margin: 0; } @@ -34,32 +34,57 @@ background: #f9f9f9 !important; } td.field-health_status, -.field-health_status .readonly{ +.field-health_status .readonly { font-weight: bold; text-transform: uppercase; } -.health-unknown{ color: grey } -.health-ok{ color: green } -.health-problem{ color: orange } -.health-critical{ color: red } -#ow-device-status table.addresses td{ width: 50% } +.health-unknown { + color: grey; +} +.health-ok { + color: green; +} +.health-problem { + color: orange; +} +.health-critical { + color: red; +} +#ow-device-status table.addresses td { + width: 50%; +} .wifi-clients th.ht, .wifi-clients th.vht, .wifi-clients th.wmm, .wifi-clients th.wds, -.wifi-clients th.wps{ +.wifi-clients th.wps { cursor: default; } #monitoring-metric-content_type-object_id-group .inline-related h3 { padding: 10px 20px; } -#monitoring-metric-content_type-object_id-group .djn-group-nested fieldset.djn-fieldset.module > h2, -#monitoring-metric-content_type-object_id-group .djn-group-nested fieldset.djn-fieldset.module .djn-inline-form > h3{ +#monitoring-metric-content_type-object_id-group + .djn-group-nested + fieldset.djn-fieldset.module + > h2, +#monitoring-metric-content_type-object_id-group + .djn-group-nested + fieldset.djn-fieldset.module + .djn-inline-form + > h3 { display: none; } -#monitoring-metric-content_type-object_id-group{ +#monitoring-metric-content_type-object_id-group { padding-top: 0 !important; } .form-row.field-health_checks div.readonly { margin-left: 0px !important; } +.form-row.field-health_checks + div + div.flex-container + div.readonly + ul.health_checks { + margin-left: 0px !important; + padding-left: 0px !important; +} diff --git a/openwisp_monitoring/device/static/monitoring/css/netjsongraph.css b/openwisp_monitoring/device/static/monitoring/css/netjsongraph.css new file mode 100755 index 000000000..05cd64351 --- /dev/null +++ b/openwisp_monitoring/device/static/monitoring/css/netjsongraph.css @@ -0,0 +1,98 @@ +.njg-relativePosition { + position: relative; + left: 0; + right: 0; +} +.njg-container { + background: #fbfbfb; + border-radius: 2px; + border: 1px solid #ccc; + color: #6d6357; + line-height: 20px; + max-width: 400px; + min-width: 200px; + padding: 10px 15px; +} +#graphChartContainer { + width: 100%; + height: 100%; + overflow: hidden; + z-index: 0; +} +.leaflet-control-zoom { + top: 5px; +} +.leaflet-control-zoom-in { + border-top-left-radius: 5px !important; + border-top-right-radius: 5px !important; +} +.leaflet-control-zoom-out { + border-bottom-left-radius: 5px !important; + border-bottom-right-radius: 5px !important; +} +.leaflet-control-fullscreen { + top: 5px; +} +.leaflet-control-fullscreen-button { + border-radius: 5px !important; +} +.leaflet-control-layers-toggle { + height: 35px !important; + width: 35px !important; + background-size: 20px 20px !important; +} +.marker-cluster div { + color: #fff; + background-color: rgba(53, 60, 68, 0.8) !important; +} +.ok div { + background-color: rgba(38, 113, 38, 0.8) !important; +} +.problem div { + background-color: rgba(255, 180, 66, 0.8) !important; +} +.critical div { + background-color: rgba(167, 45, 29, 0.8) !important; +} +.unknown div { + background-color: rgba(53, 60, 68, 0.8) !important; +} +.njg-controls { + display: flex; + justify-content: space-between; + align-items: center; + position: absolute; + right: 10px; + top: 20px; + z-index: 999; + background-color: inherit; +} +.njg-sideBar { + display: none; +} +.njg-tooltip { + background: #fff !important; + border: none !important; +} +.njg-tooltip-item { + display: flex; + align-items: center; + width: 100%; + padding: 1px 0; + flex-wrap: wrap; +} +.njg-tooltip-key { + display: inline-flex; + flex-basis: 40%; + flex-wrap: wrap; + text-transform: capitalize; + font-weight: 600; + color: #000; +} +.njg-tooltip-value { + display: inline-flex; + align-items: center; + flex-wrap: wrap; + flex-basis: 60%; + color: #000; +} diff --git a/openwisp_monitoring/device/static/monitoring/css/wifi-sessions.css b/openwisp_monitoring/device/static/monitoring/css/wifi-sessions.css index 19095e3e1..d0c57ebae 100644 --- a/openwisp_monitoring/device/static/monitoring/css/wifi-sessions.css +++ b/openwisp_monitoring/device/static/monitoring/css/wifi-sessions.css @@ -1,10 +1,9 @@ td.original p { display: none; } -#inline-wifisession-quick-link-container { - text-align: center; - margin: 20px 0 40px; -} #wifisession_set-group { margin-bottom: 0px; } +#wifisession_set-group th { + border-top: 0 none; +} diff --git a/openwisp_monitoring/device/static/monitoring/js/device-map.js b/openwisp_monitoring/device/static/monitoring/js/device-map.js index 37c821953..fcc9d258d 100644 --- a/openwisp_monitoring/device/static/monitoring/js/device-map.js +++ b/openwisp_monitoring/device/static/monitoring/js/device-map.js @@ -1,138 +1,140 @@ "use strict"; -/* jshint -W098 */ -function owGeoMapInit(map, _) { - /* jshint +W098 */ - var $ = django.jQuery, - loadingOverlay = $('#device-map-container .ow-loading-spinner'), - localStorageKey = 'ow-map-shown', - mapContainer = $('#device-map-container'), - colors = { - ok: '#267126', - problem: '#ffb442', - critical: '#a72d1d', - unknown: '#353c44', - }, - getLocationDeviceUrl = function (pk) { - return window._owGeoMapConfig.locationDeviceUrl.replace('000', pk); - }, - getColor = function (data) { - var statuses = ['critical', 'problem', 'ok', 'unknown'], - deviceCount = data.device_count, - findResult = function (func) { - for (let i in statuses) { - var status = statuses[i], - statusCount = data[status + '_count']; - if (statusCount === 0) { - continue; - } - return func(status, statusCount); +/*jshint esversion: 8 */ +(function ($) { + const loadingOverlay = $('#device-map-container .ow-loading-spinner'); + const localStorageKey = 'ow-map-shown'; + const mapContainer = $('#device-map-container'); + const statuses = ['critical', 'problem', 'ok', 'unknown']; + const colors = { + ok: '#267126', + problem: '#ffb442', + critical: '#a72d1d', + unknown: '#353c44', + }; + const getLocationDeviceUrl = function (pk) { + return window._owGeoMapConfig.locationDeviceUrl.replace('000', pk); + }; + const getColor = function (data) { + let deviceCount = data.device_count, + findResult = function (func) { + for (let i in statuses) { + let status = statuses[i], + statusCount = data[status + '_count']; + if (statusCount === 0) { + continue; } - }; - // if one status has absolute majority, it's the winner - var majoriy = findResult(function (status, statusCount) { - if (statusCount > deviceCount / 2) { - return colors[status]; + return func(status, statusCount); } - }); - if (majoriy) { - return majoriy; + }; + // if one status has absolute majority, it's the winner + let majority = findResult(function (status, statusCount) { + if (statusCount > deviceCount / 2) { + return colors[status]; } - // otherwise simply return the color based on the priority - return findResult(function (status, statusCount) { - // if one status has absolute majority, it's the winner - if (statusCount) { - return colors[status]; - } - }); - }, - loadPopUpContent = function (layer, url) { - // allows reopening the last page which was opened before popup close - // defaults to the passed URL or the default URL (first page) - if (!url) { - url = layer.url || getLocationDeviceUrl(layer.feature.id); + }); + if (majority) { + return majority; + } + // otherwise simply return the color based on the priority + return findResult(function (status, statusCount) { + // if one status has absolute majority, it's the winner + if (statusCount) { + return colors[status]; } - layer.url = url; + }); + }; + const loadPopUpContent = function (layer, url) { + // allows reopening the last page which was opened before popup close + // defaults to the passed URL or the default URL (first page) + if (!url) { + url = layer.url || getLocationDeviceUrl(layer.feature.id); + } + layer.url = url; - loadingOverlay.show(); + loadingOverlay.show(); - $.getJSON(url, function (data) { - var html = '', - device; - for (var i = 0; i < data.results.length; i++) { - device = data.results[i]; - html += ` - - -${device.name} - - - -${device.monitoring.status_label} - - - -`; + $.getJSON(url, function (data) { + let html = '', + device; + for (let i = 0; i < data.results.length; i++) { + device = data.results[i]; + html += ` + + ${device.name} + + + ${device.monitoring.status_label} + + + `; + } + let pagination = '', + parts = []; + if (data.previous || data.next) { + if (data.previous) { + parts.push(``); } - var pagination = '', parts = []; - if (data.previous || data.next) { - if (data.previous) { - parts.push(``); - } - if (data.next) { - parts.push(``); - } - pagination = ` -

    -${parts.join(' ')} - -`; + if (data.next) { + parts.push(``); } - layer.bindPopup(` -

    -

    ${layer.feature.properties.name} (${data.count})

    - - - - - - - - -${html} - -
    ${gettext('name')}${gettext('status')}
    -${pagination} -
    -`); - layer.openPopup(); + pagination = `

    ${parts.join(' ')}`; + } + layer.bindPopup(` +

    +

    ${layer.feature.properties.name} (${data.count})

    + + + + + + + + + ${html} + +
    ${gettext('name')}${gettext('status')}
    + ${pagination} +
    `); + layer.openPopup(); - // bind next/prev buttons - var el = $(layer.getPopup().getElement()); - el.find('.next').click(function () { - loadPopUpContent(layer, $(this).data('url')); - }); - el.find('.prev').click(function () { - loadPopUpContent(layer, $(this).data('url')); - }); + // bind next/prev buttons + let el = $(layer.getPopup().getElement()); + el.find('.next').click(function () { + loadPopUpContent(layer, $(this).data('url')); + }); + el.find('.prev').click(function () { + loadPopUpContent(layer, $(this).data('url')); + }); - loadingOverlay.hide(); + loadingOverlay.hide(); - }).fail(function () { - loadingOverlay.hide(); - alert(gettext('Error while retrieving data')); - }); + }).fail(function () { + loadingOverlay.hide(); + alert(gettext('Error while retrieving data')); + }); + }; + const leafletConfig = JSON.parse($('#leaflet-config').text()); + const tiles = leafletConfig.TILES.map((tile) => { + let tileLayer = tile[1]; + if (tileLayer.includes('https:')) { + tileLayer = tileLayer.split('https:')[1]; + } + let options = {}; + if (typeof tile[2] === 'object') { + options = tile[2]; + } else { + options.attribution = tile[2]; + } + return { + label: tile[0], + urlTemplate: `https:${tileLayer}`, + options, }; - - if (localStorage.getItem(localStorageKey) === 'false') { - mapContainer.slideUp(50); - } + }); function onAjaxSuccess(data) { - // show map only if there's anything to show if (!data.count) { - map.off(); - map.remove(); mapContainer.find('.no-data').fadeIn(500); loadingOverlay.hide(); mapContainer.find('.no-data').click(function (e) { @@ -145,54 +147,155 @@ ${pagination} localStorage.removeItem(localStorageKey); mapContainer.slideDown(); } + /* Workaround for https://github.com/openwisp/openwisp-monitoring/issues/462 + Leaflet does not support looping (wrapping) the map. Therefore, to work around + abrupt automatic map panning due to bounds, we plot markers on three worlds. + This allow users to view devices around the International Date Line without + any weird affects. + */ - var geojsonLayer = window.L.geoJSON(data, { - pointToLayer: function (feature, latlng) { - return window.L.circleMarker(latlng, { - radius: 9, - fillColor: getColor(feature.properties), - color: "rgba(0, 0, 0, 0.3)", - weight: 3, - opacity: 1, - fillOpacity: 0.7 - }); + /* global NetJSONGraph */ + const map = new NetJSONGraph(data, { + el: '#device-map-container', + render: 'map', + clustering: false, + // set map initial state. + mapOptions: { + center: leafletConfig.DEFAULT_CENTER, + zoom: leafletConfig.DEFAULT_ZOOM, + minZoom: leafletConfig.MIN_ZOOM || 1, + maxZoom: leafletConfig.MAX_ZOOM || 24, + fullscreenControl: true, }, - onEachFeature: function (feature, layer) { - layer.on('mouseover', function () { - this.unbindTooltip(); - if (!this.isPopupOpen()) { - this.bindTooltip(feature.properties.name).openTooltip(); - } - }); - layer.on('click', function () { - this.unbindTooltip(); - this.unbindPopup(); - loadPopUpContent(layer); - }); - } - }).addTo(map); + mapTileConfig: tiles, + geoOptions: { + style: function (feature) { + return { + radius: 9, + fillColor: getColor(feature.properties), + color: 'rgba(0, 0, 0, 0.3)', + weight: 3, + opacity: 1, + fillOpacity: 0.7, + }; + }, + onEachFeature: function (feature, layer) { + const color = getColor(feature.properties); + feature.properties.status = Object.keys(colors).filter( + (key) => colors[key] === color + )[0]; - //move points to top of polygons - geojsonLayer.eachLayer(function (layer) { - layer[layer.feature.geometry.type == 'Point' ? 'bringToFront' : 'bringToBack'](); - }); + layer.on('mouseover', function () { + layer.unbindTooltip(); + if (!layer.isPopupOpen()) { + layer.bindTooltip(feature.properties.name).openTooltip(); + } + }); + layer.on('click', function () { + layer.unbindTooltip(); + layer.unbindPopup(); + loadPopUpContent(layer); + }); + }, + }, + onReady: function () { + const map = this.leaflet; + let scale = { + imperial: false, + metric: false, + }; + if (leafletConfig.SCALE === 'metric') { + scale.metric = true; + } else if (leafletConfig.SCALE === 'imperial') { + scale.imperial = true; + } else if (leafletConfig.SCALE === 'both') { + scale.metric = true; + scale.imperial = true; + } - map.addControl(new window.L.Control.Fullscreen()); + if (leafletConfig.SCALE) { + /* global L */ + map.addControl(new L.control.scale(scale)); + } - if (geojsonLayer.getLayers().length === 1) { - map.setView(geojsonLayer.getBounds().getCenter(), 10); - } else { - map.fitBounds(geojsonLayer.getBounds()); - map.setZoom(map.getZoom() - 1); - } + if (map.geoJSON.getLayers().length === 1) { + map.setView(map.geoJSON.getBounds().getCenter(), 10); + } else { + map.fitBounds(map.geoJSON.getBounds()); + } + map.geoJSON.eachLayer(function (layer) { + layer[layer.feature.geometry.type == 'Point' ? 'bringToFront' : 'bringToBack'](); + }); - loadingOverlay.fadeOut(250); + // Workaround for https://github.com/openwisp/openwisp-monitoring/issues/462 + map.setMaxBounds( + L.latLngBounds(L.latLng(-90, -540), L.latLng(90, 540)) + ); + map.on('moveend', event => { + let netjsonGraph = this; + let bounds = event.target.getBounds(); + if (bounds._southWest.lng < -180 && !netjsonGraph.westWorldFeaturesAppended) { + let westWorldFeatures = window.structuredClone(netjsonGraph.data); + westWorldFeatures.features.forEach(element => { + if (element.geometry) { + element.geometry.coordinates[0] -= 360; + } + }); + netjsonGraph.utils.appendData(westWorldFeatures, netjsonGraph); + netjsonGraph.westWorldFeaturesAppended = true; + + } + if (bounds._northEast.lng > 180 && !netjsonGraph.eastWorldFeaturesAppended) { + let eastWorldFeatures = window.structuredClone(netjsonGraph.data); + eastWorldFeatures.features.forEach(element => { + if (element.geometry) { + element.geometry.coordinates[0] += 360; + } + }); + netjsonGraph.utils.appendData(eastWorldFeatures, netjsonGraph); + netjsonGraph.eastWorldFeaturesAppended = true; + } + }); + }, + }); + map.setUtils({ + showLoading: function () { + loadingOverlay.show(); + }, + hideLoading: function () { + loadingOverlay.hide(); + }, + paginatedDataParse: async function (JSONParam) { + let res; + let data; + try { + res = await this.utils.JSONParamParse(JSONParam); + data = res; + while (res.next && data.features.length <= this.config.maxPointsFetched) { + res = await this.utils.JSONParamParse(res.next); + res = await res.json(); + data.features = data.features.concat(res.features); + } + } catch (e) { + /* global console */ + console.error(e); + } + return data; + }, + }); + map.render(); } + if (localStorage.getItem(localStorageKey) === 'false') { + mapContainer.slideUp(50); + } $.ajax({ dataType: "json", url: window._owGeoMapConfig.geoJsonUrl, - xhrFields: { withCredentials: true }, - success: onAjaxSuccess + xhrFields: { + withCredentials: true + }, + success: onAjaxSuccess, + context: window, }); -} +})(django.jQuery); diff --git a/openwisp_monitoring/device/static/monitoring/js/lib/daterangepicker.min.js b/openwisp_monitoring/device/static/monitoring/js/lib/daterangepicker.min.js new file mode 100644 index 000000000..dbb759fcb --- /dev/null +++ b/openwisp_monitoring/device/static/monitoring/js/lib/daterangepicker.min.js @@ -0,0 +1,8 @@ +/** + * Minified by jsDelivr using Terser v3.14.1. + * Original file: /npm/daterangepicker@3.1.0/daterangepicker.js + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +'use strict';window.jQuery = django.jQuery;!function(t,e){if("function"==typeof define&&define.amd)define(["moment","jquery"],function(t,a){return a.fn||(a.fn={}),"function"!=typeof t&&t.hasOwnProperty("default")&&(t=t.default),e(t,a)});else if("object"==typeof module&&module.exports){var a="undefined"!=typeof window?window.jQuery:void 0;a||(a=require("jquery")).fn||(a.fn={});var i="undefined"!=typeof window&&void 0!==window.moment?window.moment:require("moment");module.exports=e(i,a)}else t.daterangepicker=e(t.moment,t.jQuery)}(this,function(t,e){var a=function(a,i,s){if(this.parentEl="body",this.element=e(a),this.startDate=t().startOf("day"),this.endDate=t().endOf("day"),this.minDate=!1,this.maxDate=!1,this.maxSpan=!1,this.autoApply=!1,this.singleDatePicker=!1,this.showDropdowns=!1,this.minYear=t().subtract(100,"year").format("YYYY"),this.maxYear=t().add(100,"year").format("YYYY"),this.showWeekNumbers=!1,this.showISOWeekNumbers=!1,this.showCustomRangeLabel=!0,this.timePicker=!1,this.timePicker24Hour=!1,this.timePickerIncrement=1,this.timePickerSeconds=!1,this.linkedCalendars=!0,this.autoUpdateInput=!0,this.alwaysShowCalendars=!1,this.ranges={},this.opens="right",this.element.hasClass("pull-right")&&(this.opens="left"),this.drops="down",this.element.hasClass("dropup")&&(this.drops="up"),this.buttonClasses="btn btn-sm",this.applyButtonClasses="btn-primary",this.cancelButtonClasses="btn-default",this.locale={direction:"ltr",format:t.localeData().longDateFormat("L"),separator:" - ",applyLabel:"Apply",cancelLabel:"Cancel",weekLabel:"W",customRangeLabel:"Custom Range",daysOfWeek:t.weekdaysMin(),monthNames:t.monthsShort(),firstDay:t.localeData().firstDayOfWeek()},this.callback=function(){},this.isShowing=!1,this.leftCalendar={},this.rightCalendar={},"object"==typeof i&&null!==i||(i={}),"string"==typeof(i=e.extend(this.element.data(),i)).template||i.template instanceof e||(i.template='
    '),this.parentEl=i.parentEl&&e(i.parentEl).length?e(i.parentEl):e(this.parentEl),this.container=e(i.template).appendTo(this.parentEl),"object"==typeof i.locale&&("string"==typeof i.locale.direction&&(this.locale.direction=i.locale.direction),"string"==typeof i.locale.format&&(this.locale.format=i.locale.format),"string"==typeof i.locale.separator&&(this.locale.separator=i.locale.separator),"object"==typeof i.locale.daysOfWeek&&(this.locale.daysOfWeek=i.locale.daysOfWeek.slice()),"object"==typeof i.locale.monthNames&&(this.locale.monthNames=i.locale.monthNames.slice()),"number"==typeof i.locale.firstDay&&(this.locale.firstDay=i.locale.firstDay),"string"==typeof i.locale.applyLabel&&(this.locale.applyLabel=i.locale.applyLabel),"string"==typeof i.locale.cancelLabel&&(this.locale.cancelLabel=i.locale.cancelLabel),"string"==typeof i.locale.weekLabel&&(this.locale.weekLabel=i.locale.weekLabel),"string"==typeof i.locale.customRangeLabel)){(p=document.createElement("textarea")).innerHTML=i.locale.customRangeLabel;var n=p.value;this.locale.customRangeLabel=n}if(this.container.addClass(this.locale.direction),"string"==typeof i.startDate&&(this.startDate=t(i.startDate,this.locale.format)),"string"==typeof i.endDate&&(this.endDate=t(i.endDate,this.locale.format)),"string"==typeof i.minDate&&(this.minDate=t(i.minDate,this.locale.format)),"string"==typeof i.maxDate&&(this.maxDate=t(i.maxDate,this.locale.format)),"object"==typeof i.startDate&&(this.startDate=t(i.startDate)),"object"==typeof i.endDate&&(this.endDate=t(i.endDate)),"object"==typeof i.minDate&&(this.minDate=t(i.minDate)),"object"==typeof i.maxDate&&(this.maxDate=t(i.maxDate)),this.minDate&&this.startDate.isBefore(this.minDate)&&(this.startDate=this.minDate.clone()),this.maxDate&&this.endDate.isAfter(this.maxDate)&&(this.endDate=this.maxDate.clone()),"string"==typeof i.applyButtonClasses&&(this.applyButtonClasses=i.applyButtonClasses),"string"==typeof i.applyClass&&(this.applyButtonClasses=i.applyClass),"string"==typeof i.cancelButtonClasses&&(this.cancelButtonClasses=i.cancelButtonClasses),"string"==typeof i.cancelClass&&(this.cancelButtonClasses=i.cancelClass),"object"==typeof i.maxSpan&&(this.maxSpan=i.maxSpan),"object"==typeof i.dateLimit&&(this.maxSpan=i.dateLimit),"string"==typeof i.opens&&(this.opens=i.opens),"string"==typeof i.drops&&(this.drops=i.drops),"boolean"==typeof i.showWeekNumbers&&(this.showWeekNumbers=i.showWeekNumbers),"boolean"==typeof i.showISOWeekNumbers&&(this.showISOWeekNumbers=i.showISOWeekNumbers),"string"==typeof i.buttonClasses&&(this.buttonClasses=i.buttonClasses),"object"==typeof i.buttonClasses&&(this.buttonClasses=i.buttonClasses.join(" ")),"boolean"==typeof i.showDropdowns&&(this.showDropdowns=i.showDropdowns),"number"==typeof i.minYear&&(this.minYear=i.minYear),"number"==typeof i.maxYear&&(this.maxYear=i.maxYear),"boolean"==typeof i.showCustomRangeLabel&&(this.showCustomRangeLabel=i.showCustomRangeLabel),"boolean"==typeof i.singleDatePicker&&(this.singleDatePicker=i.singleDatePicker,this.singleDatePicker&&(this.endDate=this.startDate.clone())),"boolean"==typeof i.timePicker&&(this.timePicker=i.timePicker),"boolean"==typeof i.timePickerSeconds&&(this.timePickerSeconds=i.timePickerSeconds),"number"==typeof i.timePickerIncrement&&(this.timePickerIncrement=i.timePickerIncrement),"boolean"==typeof i.timePicker24Hour&&(this.timePicker24Hour=i.timePicker24Hour),"boolean"==typeof i.autoApply&&(this.autoApply=i.autoApply),"boolean"==typeof i.autoUpdateInput&&(this.autoUpdateInput=i.autoUpdateInput),"boolean"==typeof i.linkedCalendars&&(this.linkedCalendars=i.linkedCalendars),"function"==typeof i.isInvalidDate&&(this.isInvalidDate=i.isInvalidDate),"function"==typeof i.isCustomDate&&(this.isCustomDate=i.isCustomDate),"boolean"==typeof i.alwaysShowCalendars&&(this.alwaysShowCalendars=i.alwaysShowCalendars),0!=this.locale.firstDay)for(var r=this.locale.firstDay;r>0;)this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift()),r--;var o,h,l;if(void 0===i.startDate&&void 0===i.endDate&&e(this.element).is(":text")){var c=e(this.element).val(),d=c.split(this.locale.separator);o=h=null,2==d.length?(o=t(d[0],this.locale.format),h=t(d[1],this.locale.format)):this.singleDatePicker&&""!==c&&(o=t(c,this.locale.format),h=t(c,this.locale.format)),null!==o&&null!==h&&(this.setStartDate(o),this.setEndDate(h))}if("object"==typeof i.ranges){for(l in i.ranges){o="string"==typeof i.ranges[l][0]?t(i.ranges[l][0],this.locale.format):t(i.ranges[l][0]),h="string"==typeof i.ranges[l][1]?t(i.ranges[l][1],this.locale.format):t(i.ranges[l][1]),this.minDate&&o.isBefore(this.minDate)&&(o=this.minDate.clone());var m=this.maxDate;if(this.maxSpan&&m&&o.clone().add(this.maxSpan).isAfter(m)&&(m=o.clone().add(this.maxSpan)),m&&h.isAfter(m)&&(h=m.clone()),!(this.minDate&&h.isBefore(this.minDate,this.timepicker?"minute":"day")||m&&o.isAfter(m,this.timepicker?"minute":"day"))){var p;(p=document.createElement("textarea")).innerHTML=l;n=p.value;this.ranges[n]=[o,h]}}var f="
      ";for(l in this.ranges)f+='
    • '+l+"
    • ";this.showCustomRangeLabel&&(f+='
    • '+this.locale.customRangeLabel+"
    • "),f+="
    ",this.container.find(".ranges").prepend(f)}"function"==typeof s&&(this.callback=s),this.timePicker||(this.startDate=this.startDate.startOf("day"),this.endDate=this.endDate.endOf("day"),this.container.find(".calendar-time").hide()),this.timePicker&&this.autoApply&&(this.autoApply=!1),this.autoApply&&this.container.addClass("auto-apply"),"object"==typeof i.ranges&&this.container.addClass("show-ranges"),this.singleDatePicker&&(this.container.addClass("single"),this.container.find(".drp-calendar.left").addClass("single"),this.container.find(".drp-calendar.left").show(),this.container.find(".drp-calendar.right").hide(),!this.timePicker&&this.autoApply&&this.container.addClass("auto-apply")),(void 0===i.ranges&&!this.singleDatePicker||this.alwaysShowCalendars)&&this.container.addClass("show-calendar"),this.container.addClass("opens"+this.opens),this.container.find(".applyBtn, .cancelBtn").addClass(this.buttonClasses),this.applyButtonClasses.length&&this.container.find(".applyBtn").addClass(this.applyButtonClasses),this.cancelButtonClasses.length&&this.container.find(".cancelBtn").addClass(this.cancelButtonClasses),this.container.find(".applyBtn").html(this.locale.applyLabel),this.container.find(".cancelBtn").html(this.locale.cancelLabel),this.container.find(".drp-calendar").on("click.daterangepicker",".prev",e.proxy(this.clickPrev,this)).on("click.daterangepicker",".next",e.proxy(this.clickNext,this)).on("mousedown.daterangepicker","td.available",e.proxy(this.clickDate,this)).on("mouseenter.daterangepicker","td.available",e.proxy(this.hoverDate,this)).on("change.daterangepicker","select.yearselect",e.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.monthselect",e.proxy(this.monthOrYearChanged,this)).on("change.daterangepicker","select.hourselect,select.minuteselect,select.secondselect,select.ampmselect",e.proxy(this.timeChanged,this)),this.container.find(".ranges").on("click.daterangepicker","li",e.proxy(this.clickRange,this)),this.container.find(".drp-buttons").on("click.daterangepicker","button.applyBtn",e.proxy(this.clickApply,this)).on("click.daterangepicker","button.cancelBtn",e.proxy(this.clickCancel,this)),this.element.is("input")||this.element.is("button")?this.element.on({"click.daterangepicker":e.proxy(this.show,this),"focus.daterangepicker":e.proxy(this.show,this),"keyup.daterangepicker":e.proxy(this.elementChanged,this),"keydown.daterangepicker":e.proxy(this.keydown,this)}):(this.element.on("click.daterangepicker",e.proxy(this.toggle,this)),this.element.on("keydown.daterangepicker",e.proxy(this.toggle,this))),this.updateElement()};return a.prototype={constructor:a,setStartDate:function(e){"string"==typeof e&&(this.startDate=t(e,this.locale.format)),"object"==typeof e&&(this.startDate=t(e)),this.timePicker||(this.startDate=this.startDate.startOf("day")),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.minDate&&this.startDate.isBefore(this.minDate)&&(this.startDate=this.minDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.maxDate&&this.startDate.isAfter(this.maxDate)&&(this.startDate=this.maxDate.clone(),this.timePicker&&this.timePickerIncrement&&this.startDate.minute(Math.floor(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement)),this.isShowing||this.updateElement(),this.updateMonthsInView()},setEndDate:function(e){"string"==typeof e&&(this.endDate=t(e,this.locale.format)),"object"==typeof e&&(this.endDate=t(e)),this.timePicker||(this.endDate=this.endDate.endOf("day")),this.timePicker&&this.timePickerIncrement&&this.endDate.minute(Math.round(this.endDate.minute()/this.timePickerIncrement)*this.timePickerIncrement),this.endDate.isBefore(this.startDate)&&(this.endDate=this.startDate.clone()),this.maxDate&&this.endDate.isAfter(this.maxDate)&&(this.endDate=this.maxDate.clone()),this.maxSpan&&this.startDate.clone().add(this.maxSpan).isBefore(this.endDate)&&(this.endDate=this.startDate.clone().add(this.maxSpan)),this.previousRightTime=this.endDate.clone(),this.container.find(".drp-selected").html(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format)),this.isShowing||this.updateElement(),this.updateMonthsInView()},isInvalidDate:function(){return!1},isCustomDate:function(){return!1},updateView:function(){this.timePicker&&(this.renderTimePicker("left"),this.renderTimePicker("right"),this.endDate?this.container.find(".right .calendar-time select").prop("disabled",!1).removeClass("disabled"):this.container.find(".right .calendar-time select").prop("disabled",!0).addClass("disabled")),this.endDate&&this.container.find(".drp-selected").html(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format)),this.updateMonthsInView(),this.updateCalendars(),this.updateFormInputs()},updateMonthsInView:function(){if(this.endDate){if(!this.singleDatePicker&&this.leftCalendar.month&&this.rightCalendar.month&&(this.startDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.startDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM"))&&(this.endDate.format("YYYY-MM")==this.leftCalendar.month.format("YYYY-MM")||this.endDate.format("YYYY-MM")==this.rightCalendar.month.format("YYYY-MM")))return;this.leftCalendar.month=this.startDate.clone().date(2),this.linkedCalendars||this.endDate.month()==this.startDate.month()&&this.endDate.year()==this.startDate.year()?this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month"):this.rightCalendar.month=this.endDate.clone().date(2)}else this.leftCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&this.rightCalendar.month.format("YYYY-MM")!=this.startDate.format("YYYY-MM")&&(this.leftCalendar.month=this.startDate.clone().date(2),this.rightCalendar.month=this.startDate.clone().date(2).add(1,"month"));this.maxDate&&this.linkedCalendars&&!this.singleDatePicker&&this.rightCalendar.month>this.maxDate&&(this.rightCalendar.month=this.maxDate.clone().date(2),this.leftCalendar.month=this.maxDate.clone().date(2).subtract(1,"month"))},updateCalendars:function(){if(this.timePicker){var t,e,a,i;if(this.endDate){if(t=parseInt(this.container.find(".left .hourselect").val(),10),e=parseInt(this.container.find(".left .minuteselect").val(),10),isNaN(e)&&(e=parseInt(this.container.find(".left .minuteselect option:last").val(),10)),a=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0,!this.timePicker24Hour)"PM"===(i=this.container.find(".left .ampmselect").val())&&t<12&&(t+=12),"AM"===i&&12===t&&(t=0)}else if(t=parseInt(this.container.find(".right .hourselect").val(),10),e=parseInt(this.container.find(".right .minuteselect").val(),10),isNaN(e)&&(e=parseInt(this.container.find(".right .minuteselect option:last").val(),10)),a=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0,!this.timePicker24Hour)"PM"===(i=this.container.find(".right .ampmselect").val())&&t<12&&(t+=12),"AM"===i&&12===t&&(t=0);this.leftCalendar.month.hour(t).minute(e).second(a),this.rightCalendar.month.hour(t).minute(e).second(a)}this.renderCalendar("left"),this.renderCalendar("right"),this.container.find(".ranges li").removeClass("active"),null!=this.endDate&&this.calculateChosenLabel()},renderCalendar:function(a){var i,s=(i="left"==a?this.leftCalendar:this.rightCalendar).month.month(),n=i.month.year(),r=i.month.hour(),o=i.month.minute(),h=i.month.second(),l=t([n,s]).daysInMonth(),c=t([n,s,1]),d=t([n,s,l]),m=t(c).subtract(1,"month").month(),p=t(c).subtract(1,"month").year(),f=t([p,m]).daysInMonth(),u=c.day();(i=[]).firstDay=c,i.lastDay=d;for(var D=0;D<6;D++)i[D]=[];var g=f-u+this.locale.firstDay+1;g>f&&(g-=7),u==this.locale.firstDay&&(g=f-6);for(var y=t([p,m,g,12,o,h]),k=(D=0,0),b=0;D<42;D++,k++,y=t(y).add(24,"hour"))D>0&&k%7==0&&(k=0,b++),i[b][k]=y.clone().hour(r).minute(o).second(h),y.hour(12),this.minDate&&i[b][k].format("YYYY-MM-DD")==this.minDate.format("YYYY-MM-DD")&&i[b][k].isBefore(this.minDate)&&"left"==a&&(i[b][k]=this.minDate.clone()),this.maxDate&&i[b][k].format("YYYY-MM-DD")==this.maxDate.format("YYYY-MM-DD")&&i[b][k].isAfter(this.maxDate)&&"right"==a&&(i[b][k]=this.maxDate.clone());"left"==a?this.leftCalendar.calendar=i:this.rightCalendar.calendar=i;var v="left"==a?this.minDate:this.startDate,C=this.maxDate,Y=("left"==a?this.startDate:this.endDate,this.locale.direction,'');Y+="",Y+="",(this.showWeekNumbers||this.showISOWeekNumbers)&&(Y+=""),v&&!v.isBefore(i.firstDay)||this.linkedCalendars&&"left"!=a?Y+="":Y+='';var w=this.locale.monthNames[i[1][1].month()]+i[1][1].format(" YYYY");if(this.showDropdowns){for(var P=i[1][1].month(),x=i[1][1].year(),M=C&&C.year()||this.maxYear,I=v&&v.year()||this.minYear,S=x==I,B=x==M,A='";for(var N='")}if(Y+='",C&&!C.isAfter(i.lastDay)||this.linkedCalendars&&"right"!=a&&!this.singleDatePicker?Y+="":Y+='',Y+="",Y+="",(this.showWeekNumbers||this.showISOWeekNumbers)&&(Y+='"),e.each(this.locale.daysOfWeek,function(t,e){Y+=""}),Y+="",Y+="",Y+="",null==this.endDate&&this.maxSpan){var O=this.startDate.clone().add(this.maxSpan).endOf("day");C&&!O.isBefore(C)||(C=O)}for(b=0;b<6;b++){Y+="",this.showWeekNumbers?Y+='":this.showISOWeekNumbers&&(Y+='");for(k=0;k<7;k++){var W=[];i[b][k].isSame(new Date,"day")&&W.push("today"),i[b][k].isoWeekday()>5&&W.push("weekend"),i[b][k].month()!=i[1][1].month()&&W.push("off","ends"),this.minDate&&i[b][k].isBefore(this.minDate,"day")&&W.push("off","disabled"),C&&i[b][k].isAfter(C,"day")&&W.push("off","disabled"),this.isInvalidDate(i[b][k])&&W.push("off","disabled"),i[b][k].format("YYYY-MM-DD")==this.startDate.format("YYYY-MM-DD")&&W.push("active","start-date"),null!=this.endDate&&i[b][k].format("YYYY-MM-DD")==this.endDate.format("YYYY-MM-DD")&&W.push("active","end-date"),null!=this.endDate&&i[b][k]>this.startDate&&i[b][k]'+i[b][k].date()+""}Y+=""}Y+="",Y+="
    '+w+"
    '+this.locale.weekLabel+""+e+"
    '+i[b][0].week()+"'+i[b][0].isoWeek()+"
    ",this.container.find(".drp-calendar."+a+" .calendar-table").html(Y)},renderTimePicker:function(t){if("right"!=t||this.endDate){var e,a,i,s=this.maxDate;if(!this.maxSpan||this.maxDate&&!this.startDate.clone().add(this.maxSpan).isBefore(this.maxDate)||(s=this.startDate.clone().add(this.maxSpan)),"left"==t)a=this.startDate.clone(),i=this.minDate;else if("right"==t){a=this.endDate.clone(),i=this.startDate;var n=this.container.find(".drp-calendar.right .calendar-time");if(""!=n.html()&&(a.hour(isNaN(a.hour())?n.find(".hourselect option:selected").val():a.hour()),a.minute(isNaN(a.minute())?n.find(".minuteselect option:selected").val():a.minute()),a.second(isNaN(a.second())?n.find(".secondselect option:selected").val():a.second()),!this.timePicker24Hour)){var r=n.find(".ampmselect option:selected").val();"PM"===r&&a.hour()<12&&a.hour(a.hour()+12),"AM"===r&&12===a.hour()&&a.hour(0)}a.isBefore(this.startDate)&&(a=this.startDate.clone()),s&&a.isAfter(s)&&(a=s.clone())}e=' ",e+=': ",this.timePickerSeconds){e+=': "}if(!this.timePicker24Hour){e+='"}this.container.find(".drp-calendar."+t+" .calendar-time").html(e)}},updateFormInputs:function(){this.singleDatePicker||this.endDate&&(this.startDate.isBefore(this.endDate)||this.startDate.isSame(this.endDate))?this.container.find("button.applyBtn").prop("disabled",!1):this.container.find("button.applyBtn").prop("disabled",!0)},move:function(){var t,a={top:0,left:0},i=this.drops,s=e(window).width();switch(this.parentEl.is("body")||(a={top:this.parentEl.offset().top-this.parentEl.scrollTop(),left:this.parentEl.offset().left-this.parentEl.scrollLeft()},s=this.parentEl[0].clientWidth+this.parentEl.offset().left),i){case"auto":(t=this.element.offset().top+this.element.outerHeight()-a.top)+this.container.outerHeight()>=this.parentEl[0].scrollHeight&&(t=this.element.offset().top-this.container.outerHeight()-a.top,i="up");break;case"up":t=this.element.offset().top-this.container.outerHeight()-a.top;break;default:t=this.element.offset().top+this.element.outerHeight()-a.top}this.container.css({top:0,left:0,right:"auto"});var n=this.container.outerWidth();if(this.container.toggleClass("drop-up","up"==i),"left"==this.opens){var r=s-this.element.offset().left-this.element.outerWidth();n+r>e(window).width()?this.container.css({top:t,right:"auto",left:9}):this.container.css({top:t,right:r,left:"auto"})}else if("center"==this.opens){(o=this.element.offset().left-a.left+this.element.outerWidth()/2-n/2)<0?this.container.css({top:t,right:"auto",left:9}):o+n>e(window).width()?this.container.css({top:t,left:"auto",right:0}):this.container.css({top:t,left:o,right:"auto"})}else{var o;(o=this.element.offset().left-a.left)+n>e(window).width()?this.container.css({top:t,left:"auto",right:0}):this.container.css({top:t,left:o,right:"auto"})}},show:function(t){this.isShowing||(this._outsideClickProxy=e.proxy(function(t){this.outsideClick(t)},this),e(document).on("mousedown.daterangepicker",this._outsideClickProxy).on("touchend.daterangepicker",this._outsideClickProxy).on("click.daterangepicker","[data-toggle=dropdown]",this._outsideClickProxy).on("focusin.daterangepicker",this._outsideClickProxy),e(window).on("resize.daterangepicker",e.proxy(function(t){this.move(t)},this)),this.oldStartDate=this.startDate.clone(),this.oldEndDate=this.endDate.clone(),this.previousRightTime=this.endDate.clone(),this.updateView(),this.container.show(),this.move(),this.element.trigger("show.daterangepicker",this),this.isShowing=!0)},hide:function(t){this.isShowing&&(this.endDate||(this.startDate=this.oldStartDate.clone(),this.endDate=this.oldEndDate.clone()),this.startDate.isSame(this.oldStartDate)&&this.endDate.isSame(this.oldEndDate)||this.callback(this.startDate.clone(),this.endDate.clone(),this.chosenLabel),this.updateElement(),e(document).off(".daterangepicker"),e(window).off(".daterangepicker"),this.container.hide(),this.element.trigger("hide.daterangepicker",this),this.isShowing=!1)},toggle:function(t){this.isShowing?this.hide():this.show()},outsideClick:function(t){var a=e(t.target);"focusin"==t.type||a.closest(this.element).length||a.closest(this.container).length||a.closest(".calendar-table").length||(this.hide(),this.element.trigger("outsideClick.daterangepicker",this))},showCalendars:function(){this.container.addClass("show-calendar"),this.move(),this.element.trigger("showCalendar.daterangepicker",this)},hideCalendars:function(){this.container.removeClass("show-calendar"),this.element.trigger("hideCalendar.daterangepicker",this)},clickRange:function(t){var e=t.target.getAttribute("data-range-key");if(this.chosenLabel=e,e==this.locale.customRangeLabel)this.showCalendars();else{var a=this.ranges[e];this.startDate=a[0],this.endDate=a[1],this.timePicker||(this.startDate.startOf("day"),this.endDate.endOf("day")),this.alwaysShowCalendars||this.hideCalendars(),this.clickApply()}},clickPrev:function(t){e(t.target).parents(".drp-calendar").hasClass("left")?(this.leftCalendar.month.subtract(1,"month"),this.linkedCalendars&&this.rightCalendar.month.subtract(1,"month")):this.rightCalendar.month.subtract(1,"month"),this.updateCalendars()},clickNext:function(t){e(t.target).parents(".drp-calendar").hasClass("left")?this.leftCalendar.month.add(1,"month"):(this.rightCalendar.month.add(1,"month"),this.linkedCalendars&&this.leftCalendar.month.add(1,"month")),this.updateCalendars()},hoverDate:function(t){if(e(t.target).hasClass("available")){var a=e(t.target).attr("data-title"),i=a.substr(1,1),s=a.substr(3,1),n=e(t.target).parents(".drp-calendar").hasClass("left")?this.leftCalendar.calendar[i][s]:this.rightCalendar.calendar[i][s],r=this.leftCalendar,o=this.rightCalendar,h=this.startDate;this.endDate||this.container.find(".drp-calendar tbody td").each(function(t,a){if(!e(a).hasClass("week")){var i=e(a).attr("data-title"),s=i.substr(1,1),l=i.substr(3,1),c=e(a).parents(".drp-calendar").hasClass("left")?r.calendar[s][l]:o.calendar[s][l];c.isAfter(h)&&c.isBefore(n)||c.isSame(n,"day")?e(a).addClass("in-range"):e(a).removeClass("in-range")}})}},clickDate:function(t){if(e(t.target).hasClass("available")){var a=e(t.target).attr("data-title"),i=a.substr(1,1),s=a.substr(3,1),n=e(t.target).parents(".drp-calendar").hasClass("left")?this.leftCalendar.calendar[i][s]:this.rightCalendar.calendar[i][s];if(this.endDate||n.isBefore(this.startDate,"day")){if(this.timePicker){var r=parseInt(this.container.find(".left .hourselect").val(),10);if(!this.timePicker24Hour)"PM"===(l=this.container.find(".left .ampmselect").val())&&r<12&&(r+=12),"AM"===l&&12===r&&(r=0);var o=parseInt(this.container.find(".left .minuteselect").val(),10);isNaN(o)&&(o=parseInt(this.container.find(".left .minuteselect option:last").val(),10));var h=this.timePickerSeconds?parseInt(this.container.find(".left .secondselect").val(),10):0;n=n.clone().hour(r).minute(o).second(h)}this.endDate=null,this.setStartDate(n.clone())}else if(!this.endDate&&n.isBefore(this.startDate))this.setEndDate(this.startDate.clone());else{if(this.timePicker){var l;r=parseInt(this.container.find(".right .hourselect").val(),10);if(!this.timePicker24Hour)"PM"===(l=this.container.find(".right .ampmselect").val())&&r<12&&(r+=12),"AM"===l&&12===r&&(r=0);o=parseInt(this.container.find(".right .minuteselect").val(),10);isNaN(o)&&(o=parseInt(this.container.find(".right .minuteselect option:last").val(),10));h=this.timePickerSeconds?parseInt(this.container.find(".right .secondselect").val(),10):0;n=n.clone().hour(r).minute(o).second(h)}this.setEndDate(n.clone()),this.autoApply&&(this.calculateChosenLabel(),this.clickApply())}this.singleDatePicker&&(this.setEndDate(this.startDate),!this.timePicker&&this.autoApply&&this.clickApply()),this.updateView(),t.stopPropagation()}},calculateChosenLabel:function(){var t=!0,e=0;for(var a in this.ranges){if(this.timePicker){var i=this.timePickerSeconds?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm";if(this.startDate.format(i)==this.ranges[a][0].format(i)&&this.endDate.format(i)==this.ranges[a][1].format(i)){t=!1,this.chosenLabel=this.container.find(".ranges li:eq("+e+")").addClass("active").attr("data-range-key");break}}else if(this.startDate.format("YYYY-MM-DD")==this.ranges[a][0].format("YYYY-MM-DD")&&this.endDate.format("YYYY-MM-DD")==this.ranges[a][1].format("YYYY-MM-DD")){t=!1,this.chosenLabel=this.container.find(".ranges li:eq("+e+")").addClass("active").attr("data-range-key");break}e++}t&&(this.showCustomRangeLabel?this.chosenLabel=this.container.find(".ranges li:last").addClass("active").attr("data-range-key"):this.chosenLabel=null,this.showCalendars())},clickApply:function(t){this.hide(),this.element.trigger("apply.daterangepicker",this)},clickCancel:function(t){this.startDate=this.oldStartDate,this.endDate=this.oldEndDate,this.hide(),this.element.trigger("cancel.daterangepicker",this)},monthOrYearChanged:function(t){var a=e(t.target).closest(".drp-calendar").hasClass("left"),i=a?"left":"right",s=this.container.find(".drp-calendar."+i),n=parseInt(s.find(".monthselect").val(),10),r=s.find(".yearselect").val();a||(rthis.maxDate.year()||r==this.maxDate.year()&&n>this.maxDate.month())&&(n=this.maxDate.month(),r=this.maxDate.year()),a?(this.leftCalendar.month.month(n).year(r),this.linkedCalendars&&(this.rightCalendar.month=this.leftCalendar.month.clone().add(1,"month"))):(this.rightCalendar.month.month(n).year(r),this.linkedCalendars&&(this.leftCalendar.month=this.rightCalendar.month.clone().subtract(1,"month"))),this.updateCalendars()},timeChanged:function(t){var a=e(t.target).closest(".drp-calendar"),i=a.hasClass("left"),s=parseInt(a.find(".hourselect").val(),10),n=parseInt(a.find(".minuteselect").val(),10);isNaN(n)&&(n=parseInt(a.find(".minuteselect option:last").val(),10));var r=this.timePickerSeconds?parseInt(a.find(".secondselect").val(),10):0;if(!this.timePicker24Hour){var o=a.find(".ampmselect").val();"PM"===o&&s<12&&(s+=12),"AM"===o&&12===s&&(s=0)}if(i){var h=this.startDate.clone();h.hour(s),h.minute(n),h.second(r),this.setStartDate(h),this.singleDatePicker?this.endDate=this.startDate.clone():this.endDate&&this.endDate.format("YYYY-MM-DD")==h.format("YYYY-MM-DD")&&this.endDate.isBefore(h)&&this.setEndDate(h.clone())}else if(this.endDate){var l=this.endDate.clone();l.hour(s),l.minute(n),l.second(r),this.setEndDate(l)}this.updateCalendars(),this.updateFormInputs(),this.renderTimePicker("left"),this.renderTimePicker("right")},elementChanged:function(){if(this.element.is("input")&&this.element.val().length){var e=this.element.val().split(this.locale.separator),a=null,i=null;2===e.length&&(a=t(e[0],this.locale.format),i=t(e[1],this.locale.format)),(this.singleDatePicker||null===a||null===i)&&(i=a=t(this.element.val(),this.locale.format)),a.isValid()&&i.isValid()&&(this.setStartDate(a),this.setEndDate(i),this.updateView())}},keydown:function(t){9!==t.keyCode&&13!==t.keyCode||this.hide(),27===t.keyCode&&(t.preventDefault(),t.stopPropagation(),this.hide())},updateElement:function(){if(this.element.is("input")&&this.autoUpdateInput){var t=this.startDate.format(this.locale.format);this.singleDatePicker||(t+=this.locale.separator+this.endDate.format(this.locale.format)),t!==this.element.val()&&this.element.val(t).trigger("change")}},remove:function(){this.container.remove(),this.element.off(".daterangepicker"),this.element.removeData()}},e.fn.daterangepicker=function(t,i){var s=e.extend(!0,{},e.fn.daterangepicker.defaultOptions,t);return this.each(function(){var t=e(this);t.data("daterangepicker")&&t.data("daterangepicker").remove(),t.data("daterangepicker",new a(t,s,i))}),this},a}); + //# sourceMappingURL=/sm/f07d8d7b2652873f485707eab4f3d300bf1f6f3b42912e189c8933b1b9b3dfde.maps diff --git a/openwisp_monitoring/device/static/monitoring/js/leaflet.fullscreen.min.js b/openwisp_monitoring/device/static/monitoring/js/lib/leaflet.fullscreen.min.js similarity index 100% rename from openwisp_monitoring/device/static/monitoring/js/leaflet.fullscreen.min.js rename to openwisp_monitoring/device/static/monitoring/js/lib/leaflet.fullscreen.min.js diff --git a/openwisp_monitoring/device/static/monitoring/js/lib/moment.min.js b/openwisp_monitoring/device/static/monitoring/js/lib/moment.min.js new file mode 100644 index 000000000..25fa625cc --- /dev/null +++ b/openwisp_monitoring/device/static/monitoring/js/lib/moment.min.js @@ -0,0 +1,7 @@ +//! moment.js +//! version : 2.18.1 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com +!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return sd.apply(null,arguments)}function b(a){sd=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){return null!=a&&"[object Object]"===Object.prototype.toString.call(a)}function e(a){var b;for(b in a)return!1;return!0}function f(a){return void 0===a}function g(a){return"number"==typeof a||"[object Number]"===Object.prototype.toString.call(a)}function h(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function i(a,b){var c,d=[];for(c=0;c0)for(c=0;c0?"future":"past"];return z(c)?c(b):c.replace(/%s/i,b)}function J(a,b){var c=a.toLowerCase();Hd[c]=Hd[c+"s"]=Hd[b]=a}function K(a){return"string"==typeof a?Hd[a]||Hd[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)j(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(a,b){Id[a]=b}function N(a){var b=[];for(var c in a)b.push({unit:c,priority:Id[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function O(b,c){return function(d){return null!=d?(Q(this,b,d),a.updateOffset(this,c),this):P(this,b)}}function P(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function Q(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}function R(a){return a=K(a),z(this[a])?this[a]():this}function S(a,b){if("object"==typeof a){a=L(a);for(var c=N(a),d=0;d=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}function U(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Md[a]=e),b&&(Md[b[0]]=function(){return T(e.apply(this,arguments),b[1],b[2])}),c&&(Md[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function V(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function W(a){var b,c,d=a.match(Jd);for(b=0,c=d.length;b=0&&Kd.test(a);)a=a.replace(Kd,c),Kd.lastIndex=0,d-=1;return a}function Z(a,b,c){ce[a]=z(b)?b:function(a,d){return a&&c?c:b}}function $(a,b){return j(ce,a)?ce[a](b._strict,b._locale):new RegExp(_(a))}function _(a){return aa(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function aa(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ba(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),g(b)&&(d=function(a,c){c[b]=u(a)}),c=0;c=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function ta(a){var b=new Date(Date.UTC.apply(null,arguments));return a<100&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}function ua(a,b,c){var d=7+b-c,e=(7+ta(a,0,d).getUTCDay()-b)%7;return-e+d-1}function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return j<=0?(f=a-1,g=pa(f)+j):j>pa(a)?(f=a+1,g=j-pa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return g<1?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(pa(a)-d+e)/7}function ya(a){return wa(a,this._week.dow,this._week.doy).week}function za(){return this._week.dow}function Aa(){return this._week.doy}function Ba(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function Ca(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function Da(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Ea(a,b){return"string"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Fa(a,b){return a?c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]:c(this._weekdays)?this._weekdays:this._weekdays.standalone}function Ga(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ha(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ia(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;d<7;++d)f=l([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=ne.call(this._weekdaysParse,g),e!==-1?e:null):"ddd"===b?(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:null):(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:null):"dddd"===b?(e=ne.call(this._weekdaysParse,g),e!==-1?e:(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:null))):"ddd"===b?(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:(e=ne.call(this._weekdaysParse,g),e!==-1?e:(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:null))):(e=ne.call(this._minWeekdaysParse,g),e!==-1?e:(e=ne.call(this._weekdaysParse,g),e!==-1?e:(e=ne.call(this._shortWeekdaysParse,g),e!==-1?e:null)))}function Ja(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ia.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;d<7;d++){if(e=l([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Da(a,this.localeData()),this.add(a-b,"d")):b}function La(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ma(a){if(!this.isValid())return null!=a?this:NaN;if(null!=a){var b=Ea(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Na(a){return this._weekdaysParseExact?(j(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(j(this,"_weekdaysRegex")||(this._weekdaysRegex=ye),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Oa(a){return this._weekdaysParseExact?(j(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(j(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ze),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Pa(a){return this._weekdaysParseExact?(j(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(j(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ae),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Qa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],j=[];for(b=0;b<7;b++)c=l([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),h.push(e),i.push(f),j.push(d),j.push(e),j.push(f);for(g.sort(a),h.sort(a),i.sort(a),j.sort(a),b=0;b<7;b++)h[b]=aa(h[b]),i[b]=aa(i[b]),j[b]=aa(j[b]);this._weekdaysRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}function Ra(){return this.hours()%12||12}function Sa(){return this.hours()||24}function Ta(a,b){U(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Ua(a,b){return b._meridiemParse}function Va(a){return"p"===(a+"").toLowerCase().charAt(0)}function Wa(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Xa(a){return a?a.toLowerCase().replace("_","-"):a}function Ya(a){for(var b,c,d,e,f=0;f0;){if(d=Za(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&v(e,c,!0)>=b-1)break;b--}f++}return null}function Za(a){var b=null;if(!Fe[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Be._abbr,require("./locale/"+a),$a(b)}catch(a){}return Fe[a]}function $a(a,b){var c;return a&&(c=f(b)?bb(a):_a(a,b),c&&(Be=c)),Be._abbr}function _a(a,b){if(null!==b){var c=Ee;if(b.abbr=a,null!=Fe[a])y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),c=Fe[a]._config;else if(null!=b.parentLocale){if(null==Fe[b.parentLocale])return Ge[b.parentLocale]||(Ge[b.parentLocale]=[]),Ge[b.parentLocale].push({name:a,config:b}),null;c=Fe[b.parentLocale]._config}return Fe[a]=new C(B(c,b)),Ge[a]&&Ge[a].forEach(function(a){_a(a.name,a.config)}),$a(a),Fe[a]}return delete Fe[a],null}function ab(a,b){if(null!=b){var c,d=Ee;null!=Fe[a]&&(d=Fe[a]._config),b=B(d,b),c=new C(b),c.parentLocale=Fe[a],Fe[a]=c,$a(a)}else null!=Fe[a]&&(null!=Fe[a].parentLocale?Fe[a]=Fe[a].parentLocale:null!=Fe[a]&&delete Fe[a]);return Fe[a]}function bb(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Be;if(!c(a)){if(b=Za(a))return b;a=[a]}return Ya(a)}function cb(){return Ad(Fe)}function db(a){var b,c=a._a;return c&&n(a).overflow===-2&&(b=c[fe]<0||c[fe]>11?fe:c[ge]<1||c[ge]>ea(c[ee],c[fe])?ge:c[he]<0||c[he]>24||24===c[he]&&(0!==c[ie]||0!==c[je]||0!==c[ke])?he:c[ie]<0||c[ie]>59?ie:c[je]<0||c[je]>59?je:c[ke]<0||c[ke]>999?ke:-1,n(a)._overflowDayOfYear&&(bge)&&(b=ge),n(a)._overflowWeeks&&b===-1&&(b=le),n(a)._overflowWeekday&&b===-1&&(b=me),n(a).overflow=b),a}function eb(a){var b,c,d,e,f,g,h=a._i,i=He.exec(h)||Ie.exec(h);if(i){for(n(a).iso=!0,b=0,c=Ke.length;b10?"YYYY ":"YY "),f="HH:mm"+(c[4]?":ss":""),c[1]){var l=new Date(c[2]),m=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][l.getDay()];if(c[1].substr(0,3)!==m)return n(a).weekdayMismatch=!0,void(a._isValid=!1)}switch(c[5].length){case 2:0===i?h=" +0000":(i=k.indexOf(c[5][1].toUpperCase())-12,h=(i<0?" -":" +")+(""+i).replace(/^-?/,"0").match(/..$/)[0]+"00");break;case 4:h=j[c[5]];break;default:h=j[" GMT"]}c[5]=h,a._i=c.splice(1).join(""),g=" ZZ",a._f=d+e+f+g,lb(a),n(a).rfc2822=!0}else a._isValid=!1}function gb(b){var c=Me.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(eb(b),void(b._isValid===!1&&(delete b._isValid,fb(b),b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b)))))}function hb(a,b,c){return null!=a?a:null!=b?b:c}function ib(b){var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}function jb(a){var b,c,d,e,f=[];if(!a._d){for(d=ib(a),a._w&&null==a._a[ge]&&null==a._a[fe]&&kb(a),null!=a._dayOfYear&&(e=hb(a._a[ee],d[ee]),(a._dayOfYear>pa(e)||0===a._dayOfYear)&&(n(a)._overflowDayOfYear=!0),c=ta(e,0,a._dayOfYear),a._a[fe]=c.getUTCMonth(),a._a[ge]=c.getUTCDate()),b=0;b<3&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;b<7;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[he]&&0===a._a[ie]&&0===a._a[je]&&0===a._a[ke]&&(a._nextDay=!0,a._a[he]=0),a._d=(a._useUTC?ta:sa).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[he]=24)}}function kb(a){var b,c,d,e,f,g,h,i;if(b=a._w,null!=b.GG||null!=b.W||null!=b.E)f=1,g=4,c=hb(b.GG,a._a[ee],wa(tb(),1,4).year),d=hb(b.W,1),e=hb(b.E,1),(e<1||e>7)&&(i=!0);else{f=a._locale._week.dow,g=a._locale._week.doy;var j=wa(tb(),f,g);c=hb(b.gg,a._a[ee],j.year),d=hb(b.w,j.week),null!=b.d?(e=b.d,(e<0||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f}d<1||d>xa(c,f,g)?n(a)._overflowWeeks=!0:null!=i?n(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[ee]=h.year,a._dayOfYear=h.dayOfYear)}function lb(b){if(b._f===a.ISO_8601)return void eb(b);if(b._f===a.RFC_2822)return void fb(b);b._a=[],n(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Y(b._f,b._locale).match(Jd)||[],c=0;c0&&n(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),Md[f]?(d?n(b).empty=!1:n(b).unusedTokens.push(f),da(f,d,b)):b._strict&&!d&&n(b).unusedTokens.push(f);n(b).charsLeftOver=i-j,h.length>0&&n(b).unusedInput.push(h),b._a[he]<=12&&n(b).bigHour===!0&&b._a[he]>0&&(n(b).bigHour=void 0),n(b).parsedDateParts=b._a.slice(0),n(b).meridiem=b._meridiem,b._a[he]=mb(b._locale,b._a[he],b._meridiem),jb(b),db(b)}function mb(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&b<12&&(b+=12),d||12!==b||(b=0),b):b}function nb(a){var b,c,d,e,f;if(0===a._f.length)return n(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;ethis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ob(){if(!f(this._isDSTShifted))return this._isDSTShifted;var a={};if(q(a,this),a=qb(a),a._a){var b=a._isUTC?l(a._a):tb(a._a);this._isDSTShifted=this.isValid()&&v(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Pb(){return!!this.isValid()&&!this._isUTC}function Qb(){return!!this.isValid()&&this._isUTC}function Rb(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Sb(a,b){var c,d,e,f=a,h=null;return Bb(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:g(a)?(f={},b?f[b]=a:f.milliseconds=a):(h=Te.exec(a))?(c="-"===h[1]?-1:1,f={y:0,d:u(h[ge])*c,h:u(h[he])*c,m:u(h[ie])*c,s:u(h[je])*c,ms:u(Cb(1e3*h[ke]))*c}):(h=Ue.exec(a))?(c="-"===h[1]?-1:1,f={y:Tb(h[2],c),M:Tb(h[3],c),w:Tb(h[4],c),d:Tb(h[5],c),h:Tb(h[6],c),m:Tb(h[7],c),s:Tb(h[8],c)}):null==f?f={}:"object"==typeof f&&("from"in f||"to"in f)&&(e=Vb(tb(f.from),tb(f.to)),f={},f.ms=e.milliseconds,f.M=e.months),d=new Ab(f),Bb(a)&&j(a,"_locale")&&(d._locale=a._locale),d}function Tb(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Ub(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Vb(a,b){var c;return a.isValid()&&b.isValid()?(b=Fb(b,a),a.isBefore(b)?c=Ub(a,b):(c=Ub(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}function Wb(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(y(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Sb(c,d),Xb(this,e,a),this}}function Xb(b,c,d,e){var f=c._milliseconds,g=Cb(c._days),h=Cb(c._months);b.isValid()&&(e=null==e||e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&Q(b,"Date",P(b,"Date")+g*d),h&&ja(b,P(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function Yb(a,b){var c=a.diff(b,"days",!0);return c<-6?"sameElse":c<-1?"lastWeek":c<0?"lastDay":c<1?"sameDay":c<2?"nextDay":c<7?"nextWeek":"sameElse"}function Zb(b,c){var d=b||tb(),e=Fb(d,this).startOf("day"),f=a.calendarFormat(this,e)||"sameElse",g=c&&(z(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,tb(d)))}function $b(){return new r(this)}function _b(a,b){var c=s(a)?a:tb(a);return!(!this.isValid()||!c.isValid())&&(b=K(f(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()9999?X(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):z(Date.prototype.toISOString)?this.toDate().toISOString():X(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function jc(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var a="moment",b="";this.isLocal()||(a=0===this.utcOffset()?"moment.utc":"moment.parseZone",b="Z");var c="["+a+'("]',d=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",e="-MM-DD[T]HH:mm:ss.SSS",f=b+'[")]';return this.format(c+d+e+f)}function kc(b){b||(b=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var c=X(this,b);return this.localeData().postformat(c)}function lc(a,b){return this.isValid()&&(s(a)&&a.isValid()||tb(a).isValid())?Sb({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function mc(a){return this.from(tb(),a)}function nc(a,b){return this.isValid()&&(s(a)&&a.isValid()||tb(a).isValid())?Sb({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function oc(a){return this.to(tb(),a)}function pc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}function qc(){return this._locale}function rc(a){switch(a=K(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function sc(a){return a=K(a),void 0===a||"millisecond"===a?this:("date"===a&&(a="day"),this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms"))}function tc(){return this._d.valueOf()-6e4*(this._offset||0)}function uc(){return Math.floor(this.valueOf()/1e3)}function vc(){return new Date(this.valueOf())}function wc(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function xc(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function yc(){return this.isValid()?this.toISOString():null}function zc(){return o(this)}function Ac(){ +return k({},n(this))}function Bc(){return n(this).overflow}function Cc(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Dc(a,b){U(0,[a,a.length],0,b)}function Ec(a){return Ic.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Fc(a){return Ic.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Gc(){return xa(this.year(),1,4)}function Hc(){var a=this.localeData()._week;return xa(this.year(),a.dow,a.doy)}function Ic(a,b,c,d,e){var f;return null==a?wa(this,d,e).year:(f=xa(a,d,e),b>f&&(b=f),Jc.call(this,a,b,c,d,e))}function Jc(a,b,c,d,e){var f=va(a,b,c,d,e),g=ta(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}function Kc(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Lc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function Mc(a,b){b[ke]=u(1e3*("0."+a))}function Nc(){return this._isUTC?"UTC":""}function Oc(){return this._isUTC?"Coordinated Universal Time":""}function Pc(a){return tb(1e3*a)}function Qc(){return tb.apply(null,arguments).parseZone()}function Rc(a){return a}function Sc(a,b,c,d){var e=bb(),f=l().set(d,b);return e[c](f,a)}function Tc(a,b,c){if(g(a)&&(b=a,a=void 0),a=a||"",null!=b)return Sc(a,b,c,"month");var d,e=[];for(d=0;d<12;d++)e[d]=Sc(a,d,c,"month");return e}function Uc(a,b,c,d){"boolean"==typeof a?(g(b)&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,g(b)&&(c=b,b=void 0),b=b||"");var e=bb(),f=a?e._week.dow:0;if(null!=c)return Sc(b,(c+f)%7,d,"day");var h,i=[];for(h=0;h<7;h++)i[h]=Sc(b,(h+f)%7,d,"day");return i}function Vc(a,b){return Tc(a,b,"months")}function Wc(a,b){return Tc(a,b,"monthsShort")}function Xc(a,b,c){return Uc(a,b,c,"weekdays")}function Yc(a,b,c){return Uc(a,b,c,"weekdaysShort")}function Zc(a,b,c){return Uc(a,b,c,"weekdaysMin")}function $c(){var a=this._data;return this._milliseconds=df(this._milliseconds),this._days=df(this._days),this._months=df(this._months),a.milliseconds=df(a.milliseconds),a.seconds=df(a.seconds),a.minutes=df(a.minutes),a.hours=df(a.hours),a.months=df(a.months),a.years=df(a.years),this}function _c(a,b,c,d){var e=Sb(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function ad(a,b){return _c(this,a,b,1)}function bd(a,b){return _c(this,a,b,-1)}function cd(a){return a<0?Math.floor(a):Math.ceil(a)}function dd(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;return f>=0&&g>=0&&h>=0||f<=0&&g<=0&&h<=0||(f+=864e5*cd(fd(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=t(f/1e3),i.seconds=a%60,b=t(a/60),i.minutes=b%60,c=t(b/60),i.hours=c%24,g+=t(c/24),e=t(ed(g)),h+=e,g-=cd(fd(e)),d=t(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function ed(a){return 4800*a/146097}function fd(a){return 146097*a/4800}function gd(a){if(!this.isValid())return NaN;var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+ed(b),"month"===a?c:c/12;switch(b=this._days+Math.round(fd(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function hd(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*u(this._months/12):NaN}function id(a){return function(){return this.as(a)}}function jd(a){return a=K(a),this.isValid()?this[a+"s"]():NaN}function kd(a){return function(){return this.isValid()?this._data[a]:NaN}}function ld(){return t(this.days()/7)}function md(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function nd(a,b,c){var d=Sb(a).abs(),e=uf(d.as("s")),f=uf(d.as("m")),g=uf(d.as("h")),h=uf(d.as("d")),i=uf(d.as("M")),j=uf(d.as("y")),k=e<=vf.ss&&["s",e]||e0,k[4]=c,md.apply(null,k)}function od(a){return void 0===a?uf:"function"==typeof a&&(uf=a,!0)}function pd(a,b){return void 0!==vf[a]&&(void 0===b?vf[a]:(vf[a]=b,"s"===a&&(vf.ss=b-1),!0))}function qd(a){if(!this.isValid())return this.localeData().invalidDate();var b=this.localeData(),c=nd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function rd(){if(!this.isValid())return this.localeData().invalidDate();var a,b,c,d=wf(this._milliseconds)/1e3,e=wf(this._days),f=wf(this._months);a=t(d/60),b=t(a/60),d%=60,a%=60,c=t(f/12),f%=12;var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(m<0?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var sd,td;td=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;d68?1900:2e3)};var te=O("FullYear",!0);U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),J("week","w"),J("isoWeek","W"),M("week",5),M("isoWeek",5),Z("w",Sd),Z("ww",Sd,Od),Z("W",Sd),Z("WW",Sd,Od),ca(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=u(a)});var ue={dow:0,doy:6};U("d",0,"do","day"),U("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),U("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),U("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),J("day","d"),J("weekday","e"),J("isoWeekday","E"),M("day",11),M("weekday",11),M("isoWeekday",11),Z("d",Sd),Z("e",Sd),Z("E",Sd),Z("dd",function(a,b){return b.weekdaysMinRegex(a)}),Z("ddd",function(a,b){return b.weekdaysShortRegex(a)}),Z("dddd",function(a,b){return b.weekdaysRegex(a)}),ca(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);null!=e?b.d=e:n(c).invalidWeekday=a}),ca(["d","e","E"],function(a,b,c,d){b[d]=u(a)});var ve="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),we="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),xe="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ye=be,ze=be,Ae=be;U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Ra),U("k",["kk",2],0,Sa),U("hmm",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)}),U("hmmss",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ta("a",!0),Ta("A",!1),J("hour","h"),M("hour",13),Z("a",Ua),Z("A",Ua),Z("H",Sd),Z("h",Sd),Z("k",Sd),Z("HH",Sd,Od),Z("hh",Sd,Od),Z("kk",Sd,Od),Z("hmm",Td),Z("hmmss",Ud),Z("Hmm",Td),Z("Hmmss",Ud),ba(["H","HH"],he),ba(["k","kk"],function(a,b,c){var d=u(a);b[he]=24===d?0:d}),ba(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),ba(["h","hh"],function(a,b,c){b[he]=u(a),n(c).bigHour=!0}),ba("hmm",function(a,b,c){var d=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d)),n(c).bigHour=!0}),ba("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d,2)),b[je]=u(a.substr(e)),n(c).bigHour=!0}),ba("Hmm",function(a,b,c){var d=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d))}),ba("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[he]=u(a.substr(0,d)),b[ie]=u(a.substr(d,2)),b[je]=u(a.substr(e))});var Be,Ce=/[ap]\.?m?\.?/i,De=O("Hours",!0),Ee={calendar:Bd,longDateFormat:Cd,invalidDate:Dd,ordinal:Ed,dayOfMonthOrdinalParse:Fd,relativeTime:Gd,months:pe,monthsShort:qe,week:ue,weekdays:ve,weekdaysMin:xe,weekdaysShort:we,meridiemParse:Ce},Fe={},Ge={},He=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ie=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Je=/Z|[+-]\d\d(?::?\d\d)?/,Ke=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Le=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Me=/^\/?Date\((\-?\d+)/i,Ne=/^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;a.createFromInputFallback=x("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),a.ISO_8601=function(){},a.RFC_2822=function(){};var Oe=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=tb.apply(null,arguments);return this.isValid()&&a.isValid()?athis?this:a:p()}),Qe=function(){return Date.now?Date.now():+new Date},Re=["year","quarter","month","week","day","hour","minute","second","millisecond"];Db("Z",":"),Db("ZZ",""),Z("Z",_d),Z("ZZ",_d),ba(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Eb(_d,a)});var Se=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var Te=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Ue=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Sb.fn=Ab.prototype,Sb.invalid=zb;var Ve=Wb(1,"add"),We=Wb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Xe=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Dc("gggg","weekYear"),Dc("ggggg","weekYear"),Dc("GGGG","isoWeekYear"),Dc("GGGGG","isoWeekYear"),J("weekYear","gg"),J("isoWeekYear","GG"),M("weekYear",1),M("isoWeekYear",1),Z("G",Zd),Z("g",Zd),Z("GG",Sd,Od),Z("gg",Sd,Od),Z("GGGG",Wd,Qd),Z("gggg",Wd,Qd),Z("GGGGG",Xd,Rd),Z("ggggg",Xd,Rd),ca(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=u(a)}),ca(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),U("Q",0,"Qo","quarter"),J("quarter","Q"),M("quarter",7),Z("Q",Nd),ba("Q",function(a,b){b[fe]=3*(u(a)-1)}),U("D",["DD",2],"Do","date"),J("date","D"),M("date",9),Z("D",Sd),Z("DD",Sd,Od),Z("Do",function(a,b){return a?b._dayOfMonthOrdinalParse||b._ordinalParse:b._dayOfMonthOrdinalParseLenient}),ba(["D","DD"],ge),ba("Do",function(a,b){b[ge]=u(a.match(Sd)[0],10)});var Ye=O("Date",!0);U("DDD",["DDDD",3],"DDDo","dayOfYear"),J("dayOfYear","DDD"),M("dayOfYear",4),Z("DDD",Vd),Z("DDDD",Pd),ba(["DDD","DDDD"],function(a,b,c){c._dayOfYear=u(a)}),U("m",["mm",2],0,"minute"),J("minute","m"),M("minute",14),Z("m",Sd),Z("mm",Sd,Od),ba(["m","mm"],ie);var Ze=O("Minutes",!1);U("s",["ss",2],0,"second"),J("second","s"),M("second",15),Z("s",Sd),Z("ss",Sd,Od),ba(["s","ss"],je);var $e=O("Seconds",!1);U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return 10*this.millisecond()}),U(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),U(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),U(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),U(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),U(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),J("millisecond","ms"),M("millisecond",16),Z("S",Vd,Nd),Z("SS",Vd,Od),Z("SSS",Vd,Pd);var _e;for(_e="SSSS";_e.length<=9;_e+="S")Z(_e,Yd);for(_e="S";_e.length<=9;_e+="S")ba(_e,Mc);var af=O("Milliseconds",!1);U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var bf=r.prototype;bf.add=Ve,bf.calendar=Zb,bf.clone=$b,bf.diff=fc,bf.endOf=sc,bf.format=kc,bf.from=lc,bf.fromNow=mc,bf.to=nc,bf.toNow=oc,bf.get=R,bf.invalidAt=Bc,bf.isAfter=_b,bf.isBefore=ac,bf.isBetween=bc,bf.isSame=cc,bf.isSameOrAfter=dc,bf.isSameOrBefore=ec,bf.isValid=zc,bf.lang=Xe,bf.locale=pc,bf.localeData=qc,bf.max=Pe,bf.min=Oe,bf.parsingFlags=Ac,bf.set=S,bf.startOf=rc,bf.subtract=We,bf.toArray=wc,bf.toObject=xc,bf.toDate=vc,bf.toISOString=ic,bf.inspect=jc,bf.toJSON=yc,bf.toString=hc,bf.unix=uc,bf.valueOf=tc,bf.creationData=Cc,bf.year=te,bf.isLeapYear=ra,bf.weekYear=Ec,bf.isoWeekYear=Fc,bf.quarter=bf.quarters=Kc,bf.month=ka,bf.daysInMonth=la,bf.week=bf.weeks=Ba,bf.isoWeek=bf.isoWeeks=Ca,bf.weeksInYear=Hc,bf.isoWeeksInYear=Gc,bf.date=Ye,bf.day=bf.days=Ka,bf.weekday=La,bf.isoWeekday=Ma,bf.dayOfYear=Lc,bf.hour=bf.hours=De,bf.minute=bf.minutes=Ze,bf.second=bf.seconds=$e,bf.millisecond=bf.milliseconds=af,bf.utcOffset=Hb,bf.utc=Jb,bf.local=Kb,bf.parseZone=Lb,bf.hasAlignedHourOffset=Mb,bf.isDST=Nb,bf.isLocal=Pb,bf.isUtcOffset=Qb,bf.isUtc=Rb,bf.isUTC=Rb,bf.zoneAbbr=Nc,bf.zoneName=Oc,bf.dates=x("dates accessor is deprecated. Use date instead.",Ye),bf.months=x("months accessor is deprecated. Use month instead",ka),bf.years=x("years accessor is deprecated. Use year instead",te),bf.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Ib),bf.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ob);var cf=C.prototype;cf.calendar=D,cf.longDateFormat=E,cf.invalidDate=F,cf.ordinal=G,cf.preparse=Rc,cf.postformat=Rc,cf.relativeTime=H,cf.pastFuture=I,cf.set=A,cf.months=fa,cf.monthsShort=ga,cf.monthsParse=ia,cf.monthsRegex=na,cf.monthsShortRegex=ma,cf.week=ya,cf.firstDayOfYear=Aa,cf.firstDayOfWeek=za,cf.weekdays=Fa,cf.weekdaysMin=Ha,cf.weekdaysShort=Ga,cf.weekdaysParse=Ja,cf.weekdaysRegex=Na,cf.weekdaysShortRegex=Oa,cf.weekdaysMinRegex=Pa,cf.isPM=Va,cf.meridiem=Wa,$a("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===u(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=x("moment.lang is deprecated. Use moment.locale instead.",$a),a.langData=x("moment.langData is deprecated. Use moment.localeData instead.",bb);var df=Math.abs,ef=id("ms"),ff=id("s"),gf=id("m"),hf=id("h"),jf=id("d"),kf=id("w"),lf=id("M"),mf=id("y"),nf=kd("milliseconds"),of=kd("seconds"),pf=kd("minutes"),qf=kd("hours"),rf=kd("days"),sf=kd("months"),tf=kd("years"),uf=Math.round,vf={ss:44,s:45,m:45,h:22,d:26,M:11},wf=Math.abs,xf=Ab.prototype;return xf.isValid=yb,xf.abs=$c,xf.add=ad,xf.subtract=bd,xf.as=gd,xf.asMilliseconds=ef,xf.asSeconds=ff,xf.asMinutes=gf,xf.asHours=hf,xf.asDays=jf,xf.asWeeks=kf,xf.asMonths=lf,xf.asYears=mf,xf.valueOf=hd,xf._bubble=dd,xf.get=jd,xf.milliseconds=nf,xf.seconds=of,xf.minutes=pf,xf.hours=qf,xf.days=rf,xf.weeks=ld,xf.months=sf,xf.years=tf,xf.humanize=qd,xf.toISOString=rd,xf.toString=rd,xf.toJSON=rd,xf.locale=pc,xf.localeData=qc,xf.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",rd),xf.lang=Xe,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Z("x",Zd),Z("X",ae),ba("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),ba("x",function(a,b,c){c._d=new Date(u(a))}),a.version="2.18.1",b(tb),a.fn=bf,a.min=vb,a.max=wb,a.now=Qe,a.utc=l,a.unix=Pc,a.months=Vc,a.isDate=h,a.locale=$a,a.invalid=p,a.duration=Sb,a.isMoment=s,a.weekdays=Xc,a.parseZone=Qc,a.localeData=bb,a.isDuration=Bb,a.monthsShort=Wc,a.weekdaysMin=Zc,a.defineLocale=_a,a.updateLocale=ab,a.locales=cb,a.weekdaysShort=Yc,a.normalizeUnits=K,a.relativeTimeRounding=od,a.relativeTimeThreshold=pd,a.calendarFormat=Yb,a.prototype=bf,a}); diff --git a/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js b/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js new file mode 100644 index 000000000..bc193c209 --- /dev/null +++ b/openwisp_monitoring/device/static/monitoring/js/lib/netjsongraph.min.js @@ -0,0 +1,31 @@ +(()=>{var t={3721:(t,e,i)=>{var n;self,t.exports=(n=i(481),(()=>{"use strict";var t={468:(t,e,i)=>{i.r(e);var n=i(83);function r(t,e,i){"object"==typeof e&&(i=e,e=null);var n,r=this;if(!(t instanceof Function))for(var s in n=[],t)t.hasOwnProperty(s)&&n.push(s);var l=function(e){if(r.apply(this,arguments),t instanceof Function?o(this,t.call(this,e)):a(this,t,n),this.constructor===l)for(var i=l.__initializers__,s=0;s=400?t.onerror&&t.onerror():t.onload&&t.onload(e.response)},t.onerror&&(e.onerror=t.onerror),e.send(null)}};var z,B={supportWebGL:function(){if(null==z)try{var t=document.createElement("canvas");if(!t.getContext("webgl")&&!t.getContext("experimental-webgl"))throw new Error}catch(t){z=!1}return z}};B.Int8Array="undefined"==typeof Int8Array?Array:Int8Array,B.Uint8Array="undefined"==typeof Uint8Array?Array:Uint8Array,B.Uint16Array="undefined"==typeof Uint16Array?Array:Uint16Array,B.Uint32Array="undefined"==typeof Uint32Array?Array:Uint32Array,B.Int16Array="undefined"==typeof Int16Array?Array:Int16Array,B.Float32Array="undefined"==typeof Float32Array?Array:Float32Array,B.Float64Array="undefined"==typeof Float64Array?Array:Float64Array;var Z={};"undefined"!=typeof window?Z=window:void 0!==i.g&&(Z=i.g),B.requestAnimationFrame=Z.requestAnimationFrame||Z.msRequestAnimationFrame||Z.mozRequestAnimationFrame||Z.webkitRequestAnimationFrame||function(t){setTimeout(t,16)},B.createCanvas=function(){return document.createElement("canvas")},B.createImage=function(){return new Z.Image},B.request={get:R.get},B.addEventListener=function(t,e,i,n){t.addEventListener(e,i,n)},B.removeEventListener=function(t,e,i){t.removeEventListener(e,i)};const F=B;var V=function(){this.head=null,this.tail=null,this._length=0};V.prototype.insert=function(t){var e=new V.Entry(t);return this.insertEntry(e),e},V.prototype.insertAt=function(t,e){if(!(t<0)){for(var i=this.head,n=0;i&&n!=t;)i=i.next,n++;if(i){var r=new V.Entry(e),o=i.prev;o?(o.next=r,r.prev=o):this.head=r,r.next=i,i.prev=r}else this.insert(e)}},V.prototype.insertBeforeEntry=function(t,e){var i=new V.Entry(t),n=e.prev;n?(n.next=i,i.prev=n):this.head=i,i.next=e,e.prev=i,this._length++},V.prototype.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,this.tail=t):this.head=this.tail=t,this._length++},V.prototype.remove=function(t){var e=t.prev,i=t.next;e?e.next=i:this.head=i,i?i.prev=e:this.tail=e,t.next=t.prev=null,this._length--},V.prototype.removeAt=function(t){if(!(t<0)){for(var e=this.head,i=0;e&&i!=t;)e=e.next,i++;return e?(this.remove(e),e.value):void 0}},V.prototype.getHead=function(){if(this.head)return this.head.value},V.prototype.getTail=function(){if(this.tail)return this.tail.value},V.prototype.getAt=function(t){if(!(t<0)){for(var e=this.head,i=0;e&&i!=t;)e=e.next,i++;return e.value}},V.prototype.indexOf=function(t){for(var e=this.head,i=0;e;){if(e.value===t)return i;e=e.next,i++}},V.prototype.length=function(){return this._length},V.prototype.isEmpty=function(){return 0===this._length},V.prototype.forEach=function(t,e){for(var i=this.head,n=0,r=void 0!==e;i;)r?t.call(e,i.value,n):t(i.value,n),i=i.next,n++},V.prototype.clear=function(){this.tail=this.head=null,this._length=0},V.Entry=function(t){this.value=t,this.next=null,this.prev=null};const G=V;var H=function(t){this._list=new G,this._map={},this._maxSize=t||10};H.prototype.setMaxSize=function(t){this._maxSize=t},H.prototype.put=function(t,e){if(!this._map.hasOwnProperty(t)){var i=this._list.length();if(i>=this._maxSize&&i>0){var n=this._list.head;this._list.remove(n),delete this._map[n.key]}var r=this._list.insert(e);r.key=t,this._map[t]=r}},H.prototype.get=function(t){var e=this._map[t];if(this._map.hasOwnProperty(t))return e!==this._list.tail&&(this._list.remove(e),this._list.insertEntry(e)),e.value},H.prototype.remove=function(t){var e=this._map[t];void 0!==e&&(delete this._map[t],this._list.remove(e))},H.prototype.clear=function(){this._list.clear(),this._map={}};const U=H;var W={},j={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 X(t){return(t=Math.round(t))<0?0:t>255?255:t}function Y(t){return t<0?0:t>1?1:t}function q(t){return t.length&&"%"===t.charAt(t.length-1)?X(parseFloat(t)/100*255):X(parseInt(t,10))}function K(t){return t.length&&"%"===t.charAt(t.length-1)?Y(parseFloat(t)/100):Y(parseFloat(t))}function J(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function Q(t,e,i){return t+(e-t)*i}function $(t,e,i,n,r){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t}function tt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var et=new U(20),it=null;function nt(t,e){it&&tt(it,e),it=et.put(t,it||e.slice())}function rt(t,e){var i=(parseFloat(t[0])%360+360)%360/360,n=K(t[1]),r=K(t[2]),o=r<=.5?r*(n+1):r+n-r*n,a=2*r-o;return $(e=e||[],X(255*J(a,o,i+1/3)),X(255*J(a,o,i)),X(255*J(a,o,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}W.parse=function(t,e){if(t){e=e||[];var i=et.get(t);if(i)return tt(e,i);var n,r=(t+="").replace(/ /g,"").toLowerCase();if(r in j)return tt(e,j[r]),nt(t,e),e;if("#"===r.charAt(0))return 4===r.length?(n=parseInt(r.substr(1),16))>=0&&n<=4095?($(e,(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1),nt(t,e),e):void $(e,0,0,0,1):7===r.length?(n=parseInt(r.substr(1),16))>=0&&n<=16777215?($(e,(16711680&n)>>16,(65280&n)>>8,255&n,1),nt(t,e),e):void $(e,0,0,0,1):void 0;var o=r.indexOf("("),a=r.indexOf(")");if(-1!==o&&a+1===r.length){var s=r.substr(0,o),l=r.substr(o+1,a-(o+1)).split(","),u=1;switch(s){case"rgba":if(4!==l.length)return void $(e,0,0,0,1);u=K(l.pop());case"rgb":return 3!==l.length?void $(e,0,0,0,1):($(e,q(l[0]),q(l[1]),q(l[2]),u),nt(t,e),e);case"hsla":return 4!==l.length?void $(e,0,0,0,1):(l[3]=K(l[3]),rt(l,e),nt(t,e),e);case"hsl":return 3!==l.length?void $(e,0,0,0,1):(rt(l,e),nt(t,e),e);default:return}}$(e,0,0,0,1)}},W.parseToFloat=function(t,e){if(e=W.parse(t,e))return e[0]/=255,e[1]/=255,e[2]/=255,e},W.lift=function(t,e){var i=W.parse(t);if(i){for(var n=0;n<3;n++)i[n]=e<0?i[n]*(1-e)|0:(255-i[n])*e+i[n]|0;return W.stringify(i,4===i.length?"rgba":"rgb")}},W.toHex=function(t){var e=W.parse(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)},W.fastLerp=function(t,e,i){if(e&&e.length&&t>=0&&t<=1){i=i||[];var n=t*(e.length-1),r=Math.floor(n),o=Math.ceil(n),a=e[r],s=e[o],l=n-r;return i[0]=X(Q(a[0],s[0],l)),i[1]=X(Q(a[1],s[1],l)),i[2]=X(Q(a[2],s[2],l)),i[3]=Y(Q(a[3],s[3],l)),i}},W.fastMapToColor=W.fastLerp,W.lerp=function(t,e,i){if(e&&e.length&&t>=0&&t<=1){var n=t*(e.length-1),r=Math.floor(n),o=Math.ceil(n),a=W.parse(e[r]),s=W.parse(e[o]),l=n-r,u=W.stringify([X(Q(a[0],s[0],l)),X(Q(a[1],s[1],l)),X(Q(a[2],s[2],l)),Y(Q(a[3],s[3],l))],"rgba");return i?{color:u,leftIndex:r,rightIndex:o,value:n}:u}},W.mapToColor=W.lerp,W.modifyHSL=function(t,e,i,n){if(t=W.parse(t))return t=function(t){if(t){var e,i,n=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(n,r,o),s=Math.max(n,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,i=0;else{i=u<.5?l/(s+a):l/(2-s-a);var h=((s-n)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;n===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var p=[360*e,i,u];return null!=t[3]&&p.push(t[3]),p}}(t),null!=e&&(t[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=i&&(t[1]=K(i)),null!=n&&(t[2]=K(n)),W.stringify(rt(t),"rgba");var r},W.modifyAlpha=function(t,e){if((t=W.parse(t))&&null!=e)return t[3]=Y(e),W.stringify(t,"rgba")},W.stringify=function(t,e){if(t&&t.length){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}};var ot=W.parseToFloat,at={};function st(t){var e=Object.keys(t);e.sort();for(var i=[],n=0;n=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(t,e){if("object"==typeof t)for(var i in t){var n=t[i];this.setUniform(i,n)}else this.setUniform(t,e)},get:function(t){var e=this.uniforms[t];if(e)return e.value},attachShader:function(t,e){var i=this.uniforms;this.uniforms=t.createUniforms(),this.shader=t;var n=this.uniforms;this._enabledUniforms=Object.keys(n),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter((function(t){var e=this.uniforms[t].type;return"t"===e||"tv"===e}),this);var r=this.vertexDefines,o=this.fragmentDefines;if(this.vertexDefines=p.clone(t.vertexDefines),this.fragmentDefines=p.clone(t.fragmentDefines),e){for(var a in i)n[a]&&(n[a].value=i[a].value);p.defaults(this.vertexDefines,r),p.defaults(this.fragmentDefines,o)}var s={};for(var l in t.textures)s[l]={shaderType:t.textures[l].shaderType,type:t.textures[l].type,enabled:!(!e||!this._textureStatus[l])&&this._textureStatus[l].enabled};this._textureStatus=s,this._programKey=""},clone:function(){var t=new this.constructor({name:this.name,shader:this.shader});for(var e in this.uniforms)t.uniforms[e].value=this.uniforms[e].value;return t.depthTest=this.depthTest,t.depthMask=this.depthMask,t.transparent=this.transparent,t.blend=this.blend,t.vertexDefines=p.clone(this.vertexDefines),t.fragmentDefines=p.clone(this.fragmentDefines),t.enableTexture(this.getEnabledTextures()),t.precision=this.precision,t},define:function(t,e,i){var n=this.vertexDefines,r=this.fragmentDefines;"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<3&&(i=e,e=t,t="both"),i=null!=i?i:null,"vertex"!==t&&"both"!==t||n[e]!==i&&(n[e]=i,this._programKey=""),"fragment"!==t&&"both"!==t||r[e]!==i&&(r[e]=i,"both"!==t&&(this._programKey=""))},undefine:function(t,e){"vertex"!==t&&"fragment"!==t&&"both"!==t&&arguments.length<2&&(e=t,t="both"),"vertex"!==t&&"both"!==t||this.isDefined("vertex",e)&&(delete this.vertexDefines[e],this._programKey=""),"fragment"!==t&&"both"!==t||this.isDefined("fragment",e)&&(delete this.fragmentDefines[e],"both"!==t&&(this._programKey=""))},isDefined:function(t,e){switch(t){case"vertex":return void 0!==this.vertexDefines[e];case"fragment":return void 0!==this.fragmentDefines[e]}},getDefine:function(t,e){switch(t){case"vertex":return this.vertexDefines[e];case"fragment":return this.fragmentDefines[e]}},enableTexture:function(t){if(Array.isArray(t))for(var e=0;e0&&(r=1/Math.sqrt(r),t[0]=e[0]*r,t[1]=e[1]*r),t},pt.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},pt.cross=function(t,e,i){var n=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=n,t},pt.lerp=function(t,e,i,n){var r=e[0],o=e[1];return t[0]=r+n*(i[0]-r),t[1]=o+n*(i[1]-o),t},pt.random=function(t,e){e=e||1;var i=2*GLMAT_RANDOM()*Math.PI;return t[0]=Math.cos(i)*e,t[1]=Math.sin(i)*e,t},pt.transformMat2=function(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[2]*r,t[1]=i[1]*n+i[3]*r,t},pt.transformMat2d=function(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[2]*r+i[4],t[1]=i[1]*n+i[3]*r+i[5],t},pt.transformMat3=function(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[3]*r+i[6],t[1]=i[1]*n+i[4]*r+i[7],t},pt.transformMat4=function(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[4]*r+i[12],t[1]=i[1]*n+i[5]*r+i[13],t},pt.forEach=(ut=pt.create(),function(t,e,i,n,r,o){var a,s;for(e||(e=2),i||(i=0),s=n?Math.min(n*e+i,t.length):t.length,a=i;a0&&n.push("#define "+r.toUpperCase()+"_COUNT "+o)}if(i)for(var a=0;al.getMaxJointNumber()&&(d.USE_SKIN_MATRICES_TEXTURE=null),c+="\n"+Mt(d)+"\n"}o&&(c+="\n#define INSTANCING\n");var p=c+Mt(e.vertexDefines,s,h),f=c+Mt(e.fragmentDefines,s,h),g=p+"\n"+e.shader.vertex,m=["OES_standard_derivatives","EXT_shader_texture_lod"].filter((function(t){return null!=l.getGLExtension(t)}));m.indexOf("EXT_shader_texture_lod")>=0&&(f+="\n#define SUPPORT_TEXTURE_LOD"),m.indexOf("OES_standard_derivatives")>=0&&(f+="\n#define SUPPORT_STANDARD_DERIVATIVES");var v,y,_=function(t){for(var e=[],i=0;i=0){if(1!==s&&4!==s){Vt();break}s=2,u=[]}else if(1!==s)if(4!==s)h(c),s=0;else{var d=c;Et.indexOf(d)>=0||Nt.indexOf(d)>=0||Rt.indexOf(d)>=0?l[a].semantic=d:"ignore"===d||"unconfigurable"===d?l[a].ignore=!0:l[a].value="bool"===t?"true"===d:parseFloat(d)}else l[a].value="bool"===t?"true"===c:parseFloat(c),u=null;else{if(2!==s){Vt();break}if(!(u instanceof Array)){Vt();break}u.push(+n[++o])}else l[a].value=new F.Float32Array(u),u=null,s=5;else if(2===s){if(!(u instanceof Array)){Vt();break}u.push(+n[++o])}else s=5;else s=4;else{if(0!==s&&3!==s){Vt();break}s=1}}return l}function Ht(t,e){"object"==typeof t&&(e=t.fragment,t=t.vertex),t=Ft(t),e=Ft(e),this._shaderID=function(t,e){var i="vertex:"+t+"fragment:"+e;if(Bt[i])return Bt[i];var n=p.genGUID();return Bt[i]=n,Zt[n]={vertex:t,fragment:e},n}(t,e),this._vertexCode=Ht.parseImport(t),this._fragmentCode=Ht.parseImport(e),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}Ht.prototype={constructor:Ht,createUniforms:function(){var t={};for(var e in this.uniformTemplates){var i=this.uniformTemplates[e];t[e]={type:i.type,value:i.value()}}return t},_parseImport:function(){this._vertexCode=Ht.parseImport(this.vertex),this._fragmentCode=Ht.parseImport(this.fragment)},_addSemanticUniform:function(t,e,i){if(Et.indexOf(i)>=0)this.attributeSemantics[i]={symbol:t,type:e};else if(Rt.indexOf(i)>=0){var n=!1,r=i;i.match(/TRANSPOSE$/)&&(n=!0,r=i.slice(0,-9)),this.matrixSemantics[i]={symbol:t,type:e,isTranspose:n,semanticNoTranspose:r}}else Nt.indexOf(i)>=0&&(this.uniformSemantics[i]={symbol:t,type:e})},_addMaterialUniform:function(t,e,i,n,r,o){o[t]={type:i,value:r?kt.array:n||kt[e],semantic:null}},_parseUniforms:function(){var t={},e=this;function i(t){return null!=t?function(){return t}:null}function n(n,r,o){var a=Gt(r,o),s=[];for(var l in a){var u=a[l],h=u.semantic,c=l,d=Pt[r],p=i(a[l].value);a[l].isArray&&(c+="["+a[l].arraySize+"]",d+="v"),s.push(c),e._uniformList.push(l),u.ignore||("sampler2D"!==r&&"samplerCube"!==r||(e.textures[l]={shaderType:"fragment",type:r}),h?e._addSemanticUniform(l,d,h):e._addMaterialUniform(l,r,d,p,a[l].isArray,t))}return s.length>0?"uniform "+r+" "+s.join(",")+";\n":""}this._uniformList=[],this._vertexCode=this._vertexCode.replace(Lt,n),this._fragmentCode=this._fragmentCode.replace(Lt,n),e.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=t},_parseAttributes:function(){var t={},e=this;this._vertexCode=this._vertexCode.replace(It,(function(i,n,r){var o=Gt(n,r),a=zt[n]||1,s=[];for(var l in o){var u=o[l].semantic;if(t[l]={type:"float",size:a,semantic:u||null},u){if(Et.indexOf(u)<0)throw new Error('Unkown semantic "'+u+'"');e.attributeSemantics[u]={symbol:l,type:n}}s.push(l)}return"attribute "+n+" "+s.join(",")+";\n"})),this.attributes=t},_parseDefines:function(){var t=this;function e(e,i,n){var r=t.fragmentDefines;return r[i]||(r[i]="false"!==n&&("true"===n||(n?isNaN(parseFloat(n))?n.trim():parseFloat(n):null))),""}this._vertexCode=this._vertexCode.replace(Dt,e),this._fragmentCode=this._fragmentCode.replace(Dt,e)},clone:function(){var t=Zt[this._shaderID];return new Ht(t.vertex,t.fragment)}},Object.defineProperty&&(Object.defineProperty(Ht.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty(Ht.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty(Ht.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty(Ht.prototype,"uniforms",{get:function(){return this._uniformList}}));var Ut=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;Ht.parseImport=function(t){return t.replace(Ut,(function(t,e,i){return(t=Ht.source(i))?Ht.parseImport(t):(console.error('Shader chunk "'+i+'" not existed in library'),"")}))};var Wt=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;Ht.import=function(t){t.replace(Wt,(function(t,e,i,n){if(n=n.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"")){for(var r,o=i.split("."),a=Ht.codes,s=0;s 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n}\n@end";var Yt={create:function(){var t=new ct(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},clone:function(t){var e=new ct(16);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[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},identity:function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},transpose:function(t,e){if(t===e){var i=e[1],n=e[2],r=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=r,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},invert:function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],v=e[15],y=i*s-n*a,_=i*l-r*a,x=i*u-o*a,b=n*l-r*s,w=n*u-o*s,S=r*u-o*l,T=h*g-c*f,M=h*m-d*f,C=h*v-p*f,A=c*m-d*g,L=c*v-p*g,I=d*v-p*m,D=y*I-_*L+x*A+b*C-w*M+S*T;return D?(D=1/D,t[0]=(s*I-l*L+u*A)*D,t[1]=(r*L-n*I-o*A)*D,t[2]=(g*S-m*w+v*b)*D,t[3]=(d*w-c*S-p*b)*D,t[4]=(l*C-a*I-u*M)*D,t[5]=(i*I-r*C+o*M)*D,t[6]=(m*x-f*S-v*_)*D,t[7]=(h*S-d*x+p*_)*D,t[8]=(a*L-s*C+u*T)*D,t[9]=(n*C-i*L-o*T)*D,t[10]=(f*w-g*x+v*y)*D,t[11]=(c*x-h*w-p*y)*D,t[12]=(s*M-a*A-l*T)*D,t[13]=(i*A-n*M+r*T)*D,t[14]=(g*_-f*b-m*y)*D,t[15]=(h*b-c*_+d*y)*D,t):null},adjoint:function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],p=e[11],f=e[12],g=e[13],m=e[14],v=e[15];return t[0]=s*(d*v-p*m)-c*(l*v-u*m)+g*(l*p-u*d),t[1]=-(n*(d*v-p*m)-c*(r*v-o*m)+g*(r*p-o*d)),t[2]=n*(l*v-u*m)-s*(r*v-o*m)+g*(r*u-o*l),t[3]=-(n*(l*p-u*d)-s*(r*p-o*d)+c*(r*u-o*l)),t[4]=-(a*(d*v-p*m)-h*(l*v-u*m)+f*(l*p-u*d)),t[5]=i*(d*v-p*m)-h*(r*v-o*m)+f*(r*p-o*d),t[6]=-(i*(l*v-u*m)-a*(r*v-o*m)+f*(r*u-o*l)),t[7]=i*(l*p-u*d)-a*(r*p-o*d)+h*(r*u-o*l),t[8]=a*(c*v-p*g)-h*(s*v-u*g)+f*(s*p-u*c),t[9]=-(i*(c*v-p*g)-h*(n*v-o*g)+f*(n*p-o*c)),t[10]=i*(s*v-u*g)-a*(n*v-o*g)+f*(n*u-o*s),t[11]=-(i*(s*p-u*c)-a*(n*p-o*c)+h*(n*u-o*s)),t[12]=-(a*(c*m-d*g)-h*(s*m-l*g)+f*(s*d-l*c)),t[13]=i*(c*m-d*g)-h*(n*m-r*g)+f*(n*d-r*c),t[14]=-(i*(s*m-l*g)-a*(n*m-r*g)+f*(n*l-r*s)),t[15]=i*(s*d-l*c)-a*(n*d-r*c)+h*(n*l-r*s),t},determinant:function(t){var e=t[0],i=t[1],n=t[2],r=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],h=t[9],c=t[10],d=t[11],p=t[12],f=t[13],g=t[14],m=t[15];return(e*a-i*o)*(c*m-d*g)-(e*s-n*o)*(h*m-d*f)+(e*l-r*o)*(h*g-c*f)+(i*s-n*a)*(u*m-d*p)-(i*l-r*a)*(u*g-c*p)+(n*l-r*s)*(u*f-h*p)},multiply:function(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],p=e[10],f=e[11],g=e[12],m=e[13],v=e[14],y=e[15],_=i[0],x=i[1],b=i[2],w=i[3];return t[0]=_*n+x*s+b*c+w*g,t[1]=_*r+x*l+b*d+w*m,t[2]=_*o+x*u+b*p+w*v,t[3]=_*a+x*h+b*f+w*y,_=i[4],x=i[5],b=i[6],w=i[7],t[4]=_*n+x*s+b*c+w*g,t[5]=_*r+x*l+b*d+w*m,t[6]=_*o+x*u+b*p+w*v,t[7]=_*a+x*h+b*f+w*y,_=i[8],x=i[9],b=i[10],w=i[11],t[8]=_*n+x*s+b*c+w*g,t[9]=_*r+x*l+b*d+w*m,t[10]=_*o+x*u+b*p+w*v,t[11]=_*a+x*h+b*f+w*y,_=i[12],x=i[13],b=i[14],w=i[15],t[12]=_*n+x*s+b*c+w*g,t[13]=_*r+x*l+b*d+w*m,t[14]=_*o+x*u+b*p+w*v,t[15]=_*a+x*h+b*f+w*y,t},multiplyAffine:function(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[4],s=e[5],l=e[6],u=e[8],h=e[9],c=e[10],d=e[12],p=e[13],f=e[14],g=i[0],m=i[1],v=i[2];return t[0]=g*n+m*a+v*u,t[1]=g*r+m*s+v*h,t[2]=g*o+m*l+v*c,g=i[4],m=i[5],v=i[6],t[4]=g*n+m*a+v*u,t[5]=g*r+m*s+v*h,t[6]=g*o+m*l+v*c,g=i[8],m=i[9],v=i[10],t[8]=g*n+m*a+v*u,t[9]=g*r+m*s+v*h,t[10]=g*o+m*l+v*c,g=i[12],m=i[13],v=i[14],t[12]=g*n+m*a+v*u+d,t[13]=g*r+m*s+v*h+p,t[14]=g*o+m*l+v*c+f,t}};Yt.mul=Yt.multiply,Yt.mulAffine=Yt.multiplyAffine,Yt.translate=function(t,e,i){var n,r,o,a,s,l,u,h,c,d,p,f,g=i[0],m=i[1],v=i[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*v+e[12],t[13]=e[1]*g+e[5]*m+e[9]*v+e[13],t[14]=e[2]*g+e[6]*m+e[10]*v+e[14],t[15]=e[3]*g+e[7]*m+e[11]*v+e[15]):(n=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],h=e[7],c=e[8],d=e[9],p=e[10],f=e[11],t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=h,t[8]=c,t[9]=d,t[10]=p,t[11]=f,t[12]=n*g+s*m+c*v+e[12],t[13]=r*g+l*m+d*v+e[13],t[14]=o*g+u*m+p*v+e[14],t[15]=a*g+h*m+f*v+e[15]),t},Yt.scale=function(t,e,i){var n=i[0],r=i[1],o=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},Yt.rotate=function(t,e,i,n){var r,o,a,s,l,u,h,c,d,p,f,g,m,v,y,_,x,b,w,S,T,M,C,A,L=n[0],I=n[1],D=n[2],P=Math.sqrt(L*L+I*I+D*D);return Math.abs(P)0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},Kt.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},Kt.cross=function(t,e,i){var n=e[0],r=e[1],o=e[2],a=i[0],s=i[1],l=i[2];return t[0]=r*l-o*s,t[1]=o*a-n*l,t[2]=n*s-r*a,t},Kt.lerp=function(t,e,i,n){var r=e[0],o=e[1],a=e[2];return t[0]=r+n*(i[0]-r),t[1]=o+n*(i[1]-o),t[2]=a+n*(i[2]-a),t},Kt.random=function(t,e){e=e||1;var i=2*dt()*Math.PI,n=2*dt()-1,r=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(i)*r,t[1]=Math.sin(i)*r,t[2]=n*e,t},Kt.transformMat4=function(t,e,i){var n=e[0],r=e[1],o=e[2],a=i[3]*n+i[7]*r+i[11]*o+i[15];return a=a||1,t[0]=(i[0]*n+i[4]*r+i[8]*o+i[12])/a,t[1]=(i[1]*n+i[5]*r+i[9]*o+i[13])/a,t[2]=(i[2]*n+i[6]*r+i[10]*o+i[14])/a,t},Kt.transformMat3=function(t,e,i){var n=e[0],r=e[1],o=e[2];return t[0]=n*i[0]+r*i[3]+o*i[6],t[1]=n*i[1]+r*i[4]+o*i[7],t[2]=n*i[2]+r*i[5]+o*i[8],t},Kt.transformQuat=function(t,e,i){var n=e[0],r=e[1],o=e[2],a=i[0],s=i[1],l=i[2],u=i[3],h=u*n+s*o-l*r,c=u*r+l*n-a*o,d=u*o+a*r-s*n,p=-a*n-s*r-l*o;return t[0]=h*u+p*-a+c*-l-d*-s,t[1]=c*u+p*-s+d*-a-h*-l,t[2]=d*u+p*-l+h*-s-c*-a,t},Kt.rotateX=function(t,e,i,n){var r=[],o=[];return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],o[0]=r[0],o[1]=r[1]*Math.cos(n)-r[2]*Math.sin(n),o[2]=r[1]*Math.sin(n)+r[2]*Math.cos(n),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t},Kt.rotateY=function(t,e,i,n){var r=[],o=[];return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],o[0]=r[2]*Math.sin(n)+r[0]*Math.cos(n),o[1]=r[1],o[2]=r[2]*Math.cos(n)-r[0]*Math.sin(n),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t},Kt.rotateZ=function(t,e,i,n){var r=[],o=[];return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],o[0]=r[0]*Math.cos(n)-r[1]*Math.sin(n),o[1]=r[0]*Math.sin(n)+r[1]*Math.cos(n),o[2]=r[2],t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t},Kt.forEach=function(){var t=Kt.create();return function(e,i,n,r,o,a){var s,l;for(i||(i=3),n||(n=0),l=r?Math.min(r*i+n,e.length):e.length,s=n;s1?0:Math.acos(r)};const Jt=Kt;jt.import(Xt);var Qt=qt.create,$t={};function te(t){return t.material}function ee(t,e,i){return e.uniforms[i].value}function ie(t,e,i,n){return i!==n}function ne(t){return!0}function re(){}var oe={float:T,byte:5120,ubyte:S,short:5122,ushort:5123};function ae(t,e,i){this.availableAttributes=t,this.availableAttributeSymbols=e,this.indicesBuffer=i,this.vao=null}function se(t){var e,i;this.bind=function(t){e||((e=F.createCanvas()).width=e.height=1,e.getContext("2d"));var n=t.gl,r=!i;r&&(i=n.createTexture()),n.bindTexture(n.TEXTURE_2D,i),r&&n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e)},this.unbind=function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var le=g.extend((function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},maxJointNumber:20,__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}}),(function(){this.canvas||(this.canvas=F.createCanvas());var t=this.canvas;try{var e={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!this.gl)throw new Error;this._glinfo=new y(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(t){throw"Error creating WebGL Context "+t}this._programMgr=new At(this),this._placeholderTexture=new se(this)}),{resize:function(t,e){var i=this.canvas,n=this.devicePixelRatio;null!=t?(i.style&&(i.style.width=t+"px",i.style.height=e+"px"),i.width=t*n,i.height=e*n,this._width=t,this._height=e):(this._width=i.width/n,this._height=i.height/n),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var t=this.viewport;return t.width/t.height},setDevicePixelRatio:function(t){this.devicePixelRatio=t,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(t){return this._glinfo.getExtension(t)},getGLParameter:function(t){return this._glinfo.getParameter(t)},setViewport:function(t,e,i,n,r){if("object"==typeof t){var o=t;t=o.x,e=o.y,i=o.width,n=o.height,r=o.devicePixelRatio}r=r||this.devicePixelRatio,this.gl.viewport(t*r,e*r,i*r,n*r),this.viewport={x:t,y:e,width:i,height:n,devicePixelRatio:r}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var t=this._clearStack.pop();this.clearColor=t.clearColor,this.clearBit=t.clearBit}},bindSceneRendering:function(t){this._sceneRendering=t},render:function(t,e,i,n){var r=this.gl,o=this.clearColor;if(this.clearBit){r.colorMask(!0,!0,!0,!0),r.depthMask(!0);var a=this.viewport,s=!1,l=a.devicePixelRatio;(a.width!==this._width||a.height!==this._height||l&&l!==this.devicePixelRatio||a.x||a.y)&&(s=!0,r.enable(r.SCISSOR_TEST),r.scissor(a.x*l,a.y*l,a.width*l,a.height*l)),r.clearColor(o[0],o[1],o[2],o[3]),r.clear(this.clearBit),s&&r.disable(r.SCISSOR_TEST)}if(i||t.update(!1),t.updateLights(),e=e||t.getMainCamera()){e.update();var u=t.updateRenderList(e,!0);this._sceneRendering=t;var h=u.opaque,c=u.transparent,d=t.material;t.trigger("beforerender",this,t,e,u),n?(this.renderPreZ(h,t,e),r.depthFunc(r.LEQUAL)):r.depthFunc(r.LESS);for(var p=Qt(),f=Jt.create(),g=0;g0){var s=t[r-1],l=s.joints?s.joints.length:0;if((o.joints?o.joints.length:0)===l&&o.material===s.material&&o.lightGroup===s.lightGroup){o.__program=s.__program;continue}}var u=this._programMgr.getProgram(o,a,e);this.validateProgram(u),o.__program=u}},renderPass:function(t,e,i){this.trigger("beforerenderpass",this,t,e,i),(i=i||{}).getMaterial=i.getMaterial||te,i.getUniform=i.getUniform||ee,i.isMaterialChanged=i.isMaterialChanged||ie,i.beforeRender=i.beforeRender||re,i.afterRender=i.afterRender||re;var n=i.ifRender||ne;this.updatePrograms(t,this._sceneRendering,i),i.sortCompare&&t.sort(i.sortCompare);var r=this.viewport,o=r.devicePixelRatio,a=[r.x*o,r.y*o,r.width*o,r.height*o],s=this.devicePixelRatio,l=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*s,this._height*s],u=[a[2],a[3]],h=Date.now();e?(qt.copy(ue.VIEW,e.viewMatrix.array),qt.copy(ue.PROJECTION,e.projectionMatrix.array),qt.copy(ue.VIEWINVERSE,e.worldTransform.array)):(qt.identity(ue.VIEW),qt.identity(ue.PROJECTION),qt.identity(ue.VIEWINVERSE)),qt.multiply(ue.VIEWPROJECTION,ue.PROJECTION,ue.VIEW),qt.invert(ue.PROJECTIONINVERSE,ue.PROJECTION),qt.invert(ue.VIEWPROJECTIONINVERSE,ue.VIEWPROJECTION);for(var c,d,p,f,g,m,v,y,_,x,b,w,S=this.gl,T=this._sceneRendering,M=0;Mthis.getMaxJointNumber()){var o=r.getSubSkinMatricesTexture(t.__uid__,t.joints);e.useTextureSlot(this,o,i),e.setUniform(n,"1i","skinMatricesTexture",i),e.setUniform(n,"1f","skinMatricesTextureSize",o.width)}else{var a=r.getSubSkinMatrices(t.__uid__,t.joints);e.setUniformOfSemantic(n,"SKIN_MATRIX",a)}},_renderObject:function(t,e,i){var n=this.gl,r=t.geometry,o=t.mode;null==o&&(o=4);var a=null,s=t.isInstancedMesh&&t.isInstancedMesh();if(!s||(a=this.getGLExtension("ANGLE_instanced_arrays"))){var l;if(s&&(l=this._bindInstancedAttributes(t,i,a)),e.indicesBuffer){var u=this.getGLExtension("OES_element_index_uint")&&r.indices instanceof Uint32Array?n.UNSIGNED_INT:n.UNSIGNED_SHORT;s?a.drawElementsInstancedANGLE(o,e.indicesBuffer.count,u,0,t.getInstanceCount()):n.drawElements(o,e.indicesBuffer.count,u,0)}else s?a.drawArraysInstancedANGLE(o,0,r.vertexCount,t.getInstanceCount()):n.drawArrays(o,0,r.vertexCount);if(s)for(var h=0;hi?i:t}ce.add=function(t,e,i){return Jt.add(t.array,e.array,i.array),t._dirty=!0,t},ce.set=function(t,e,i,n){Jt.set(t.array,e,i,n),t._dirty=!0},ce.copy=function(t,e){return Jt.copy(t.array,e.array),t._dirty=!0,t},ce.cross=function(t,e,i){return Jt.cross(t.array,e.array,i.array),t._dirty=!0,t},ce.distance=ce.dist=function(t,e){return Jt.distance(t.array,e.array)},ce.divide=ce.div=function(t,e,i){return Jt.divide(t.array,e.array,i.array),t._dirty=!0,t},ce.dot=function(t,e){return Jt.dot(t.array,e.array)},ce.len=function(t){return Jt.length(t.array)},ce.lerp=function(t,e,i,n){return Jt.lerp(t.array,e.array,i.array,n),t._dirty=!0,t},ce.min=function(t,e,i){return Jt.min(t.array,e.array,i.array),t._dirty=!0,t},ce.max=function(t,e,i){return Jt.max(t.array,e.array,i.array),t._dirty=!0,t},ce.multiply=ce.mul=function(t,e,i){return Jt.multiply(t.array,e.array,i.array),t._dirty=!0,t},ce.negate=function(t,e){return Jt.negate(t.array,e.array),t._dirty=!0,t},ce.normalize=function(t,e){return Jt.normalize(t.array,e.array),t._dirty=!0,t},ce.random=function(t,e){return Jt.random(t.array,e),t._dirty=!0,t},ce.scale=function(t,e,i){return Jt.scale(t.array,e.array,i),t._dirty=!0,t},ce.scaleAndAdd=function(t,e,i,n){return Jt.scaleAndAdd(t.array,e.array,i.array,n),t._dirty=!0,t},ce.squaredDistance=ce.sqrDist=function(t,e){return Jt.sqrDist(t.array,e.array)},ce.squaredLength=ce.sqrLen=function(t){return Jt.sqrLen(t.array)},ce.subtract=ce.sub=function(t,e,i){return Jt.subtract(t.array,e.array,i.array),t._dirty=!0,t},ce.transformMat3=function(t,e,i){return Jt.transformMat3(t.array,e.array,i.array),t._dirty=!0,t},ce.transformMat4=function(t,e,i){return Jt.transformMat4(t.array,e.array,i.array),t._dirty=!0,t},ce.transformQuat=function(t,e,i){return Jt.transformQuat(t.array,e.array,i.array),t._dirty=!0,t};var ge=Math.atan2,me=Math.asin,ve=Math.abs;ce.eulerFromQuat=function(t,e,i){t._dirty=!0,e=e.array;var n=t.array,r=e[0],o=e[1],a=e[2],s=e[3],l=r*r,u=o*o,h=a*a,c=s*s;switch(i=(i||"XYZ").toUpperCase()){case"XYZ":n[0]=ge(2*(r*s-o*a),c-l-u+h),n[1]=me(fe(2*(r*a+o*s),-1,1)),n[2]=ge(2*(a*s-r*o),c+l-u-h);break;case"YXZ":n[0]=me(fe(2*(r*s-o*a),-1,1)),n[1]=ge(2*(r*a+o*s),c-l-u+h),n[2]=ge(2*(r*o+a*s),c-l+u-h);break;case"ZXY":n[0]=me(fe(2*(r*s+o*a),-1,1)),n[1]=ge(2*(o*s-a*r),c-l-u+h),n[2]=ge(2*(a*s-r*o),c-l+u-h);break;case"ZYX":n[0]=ge(2*(r*s+a*o),c-l-u+h),n[1]=me(fe(2*(o*s-r*a),-1,1)),n[2]=ge(2*(r*o+a*s),c+l-u-h);break;case"YZX":n[0]=ge(2*(r*s-a*o),c-l+u-h),n[1]=ge(2*(o*s-r*a),c+l-u-h),n[2]=me(fe(2*(r*o+a*s),-1,1));break;case"XZY":n[0]=ge(2*(r*s+o*a),c-l+u-h),n[1]=ge(2*(r*a+o*s),c+l-u-h),n[2]=me(fe(2*(a*s-r*o),-1,1));break;default:console.warn("Unkown order: "+i)}return t},ce.eulerFromMat3=function(t,e,i){var n=e.array,r=n[0],o=n[3],a=n[6],s=n[1],l=n[4],u=n[7],h=n[2],c=n[5],d=n[8],p=t.array;switch(i=(i||"XYZ").toUpperCase()){case"XYZ":p[1]=me(fe(a,-1,1)),ve(a)<.99999?(p[0]=ge(-u,d),p[2]=ge(-o,r)):(p[0]=ge(c,l),p[2]=0);break;case"YXZ":p[0]=me(-fe(u,-1,1)),ve(u)<.99999?(p[1]=ge(a,d),p[2]=ge(s,l)):(p[1]=ge(-h,r),p[2]=0);break;case"ZXY":p[0]=me(fe(c,-1,1)),ve(c)<.99999?(p[1]=ge(-h,d),p[2]=ge(-o,l)):(p[1]=0,p[2]=ge(s,r));break;case"ZYX":p[1]=me(-fe(h,-1,1)),ve(h)<.99999?(p[0]=ge(c,d),p[2]=ge(s,r)):(p[0]=0,p[2]=ge(-o,l));break;case"YZX":p[2]=me(fe(s,-1,1)),ve(s)<.99999?(p[0]=ge(-u,l),p[1]=ge(-h,r)):(p[0]=0,p[1]=ge(a,d));break;case"XZY":p[2]=me(-fe(o,-1,1)),ve(o)<.99999?(p[0]=ge(c,l),p[1]=ge(a,r)):(p[0]=ge(-u,d),p[1]=0);break;default:console.warn("Unkown order: "+i)}return t._dirty=!0,t},Object.defineProperties(ce,{POSITIVE_X:{get:function(){return new ce(1,0,0)}},NEGATIVE_X:{get:function(){return new ce(-1,0,0)}},POSITIVE_Y:{get:function(){return new ce(0,1,0)}},NEGATIVE_Y:{get:function(){return new ce(0,-1,0)}},POSITIVE_Z:{get:function(){return new ce(0,0,1)}},NEGATIVE_Z:{get:function(){return new ce(0,0,-1)}},UP:{get:function(){return new ce(0,1,0)}},ZERO:{get:function(){return new ce}}});const ye=ce;var _e,xe,be,we,Se,Te=function(t,e){this.origin=t||new ye,this.direction=e||new ye};Te.prototype={constructor:Te,intersectPlane:function(t,e){var i=t.normal.array,n=t.distance,r=this.origin.array,o=this.direction.array,a=Jt.dot(i,o);if(0===a)return null;e||(e=new ye);var s=(Jt.dot(i,r)-n)/a;return Jt.scaleAndAdd(e.array,r,o,-s),e._dirty=!0,e},mirrorAgainstPlane:function(t){var e=Jt.dot(t.normal.array,this.direction.array);Jt.scaleAndAdd(this.direction.array,this.direction.array,t.normal.array,2*-e),this.direction._dirty=!0},distanceToPoint:(Se=Jt.create(),function(t){Jt.sub(Se,t,this.origin.array);var e=Jt.dot(Se,this.direction.array);if(e<0)return Jt.distance(this.origin.array,t);var i=Jt.lenSquared(Se);return Math.sqrt(i-e*e)}),intersectSphere:function(){var t=Jt.create();return function(e,i,n){var r=this.origin.array,o=this.direction.array;e=e.array,Jt.sub(t,e,r);var a=Jt.dot(t,o),s=Jt.squaredLength(t)-a*a,l=i*i;if(!(s>l)){var u=Math.sqrt(l-s),h=a-u,c=a+u;return n||(n=new ye),h<0?c<0?null:(Jt.scaleAndAdd(n.array,r,o,c),n):(Jt.scaleAndAdd(n.array,r,o,h),n)}}}(),intersectBoundingBox:function(t,e){var i,n,r,o,a,s,l=this.direction.array,u=this.origin.array,h=t.min.array,c=t.max.array,d=1/l[0],p=1/l[1],f=1/l[2];if(d>=0?(i=(h[0]-u[0])*d,n=(c[0]-u[0])*d):(n=(h[0]-u[0])*d,i=(c[0]-u[0])*d),p>=0?(r=(h[1]-u[1])*p,o=(c[1]-u[1])*p):(o=(h[1]-u[1])*p,r=(c[1]-u[1])*p),i>o||r>n)return null;if((r>i||i!=i)&&(i=r),(o=0?(a=(h[2]-u[2])*f,s=(c[2]-u[2])*f):(s=(h[2]-u[2])*f,a=(c[2]-u[2])*f),i>s||a>n)return null;if((a>i||i!=i)&&(i=a),(s=0?i:n;return e||(e=new ye),Jt.scaleAndAdd(e.array,u,l,g),e},intersectTriangle:(_e=Jt.create(),xe=Jt.create(),be=Jt.create(),we=Jt.create(),function(t,e,i,n,r,o){var a=this.direction.array,s=this.origin.array;t=t.array,e=e.array,i=i.array,Jt.sub(_e,e,t),Jt.sub(xe,i,t),Jt.cross(we,xe,a);var l=Jt.dot(_e,we);if(n){if(l>-1e-5)return null}else if(l>-1e-5&&l<1e-5)return null;Jt.sub(be,s,t);var u=Jt.dot(we,be)/l;if(u<0||u>1)return null;Jt.cross(we,_e,be);var h=Jt.dot(a,we)/l;if(h<0||h>1||u+h>1)return null;Jt.cross(we,_e,xe);var c=-Jt.dot(be,we)/l;return c<0?null:(r||(r=new ye),o&&ye.set(o,1-u-h,u,h),Jt.scaleAndAdd(r.array,s,a,c),r)}),applyTransform:function(t){ye.add(this.direction,this.direction,this.origin),ye.transformMat4(this.origin,this.origin,t),ye.transformMat4(this.direction,this.direction,t),ye.sub(this.direction,this.direction,this.origin),ye.normalize(this.direction,this.direction)},copy:function(t){ye.copy(this.origin,t.origin),ye.copy(this.direction,t.direction)},clone:function(){var t=new Te;return t.copy(this),t}};const Me=Te;var Ce={create:function(){var t=new ct(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},clone:function(t){var e=new ct(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},fromValues:function(t,e,i,n){var r=new ct(4);return r[0]=t,r[1]=e,r[2]=i,r[3]=n,r},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},set:function(t,e,i,n,r){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t},add:function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},subtract:function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}};Ce.sub=Ce.subtract,Ce.multiply=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t},Ce.mul=Ce.multiply,Ce.divide=function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t[3]=e[3]/i[3],t},Ce.div=Ce.divide,Ce.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t[3]=Math.min(e[3],i[3]),t},Ce.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t[3]=Math.max(e[3],i[3]),t},Ce.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},Ce.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t},Ce.distance=function(t,e){var i=e[0]-t[0],n=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return Math.sqrt(i*i+n*n+r*r+o*o)},Ce.dist=Ce.distance,Ce.squaredDistance=function(t,e){var i=e[0]-t[0],n=e[1]-t[1],r=e[2]-t[2],o=e[3]-t[3];return i*i+n*n+r*r+o*o},Ce.sqrDist=Ce.squaredDistance,Ce.length=function(t){var e=t[0],i=t[1],n=t[2],r=t[3];return Math.sqrt(e*e+i*i+n*n+r*r)},Ce.len=Ce.length,Ce.squaredLength=function(t){var e=t[0],i=t[1],n=t[2],r=t[3];return e*e+i*i+n*n+r*r},Ce.sqrLen=Ce.squaredLength,Ce.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},Ce.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},Ce.normalize=function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],a=i*i+n*n+r*r+o*o;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t[3]=e[3]*a),t},Ce.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},Ce.lerp=function(t,e,i,n){var r=e[0],o=e[1],a=e[2],s=e[3];return t[0]=r+n*(i[0]-r),t[1]=o+n*(i[1]-o),t[2]=a+n*(i[2]-a),t[3]=s+n*(i[3]-s),t},Ce.random=function(t,e){return e=e||1,t[0]=dt(),t[1]=dt(),t[2]=dt(),t[3]=dt(),Ce.normalize(t,t),Ce.scale(t,t,e),t},Ce.transformMat4=function(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3];return t[0]=i[0]*n+i[4]*r+i[8]*o+i[12]*a,t[1]=i[1]*n+i[5]*r+i[9]*o+i[13]*a,t[2]=i[2]*n+i[6]*r+i[10]*o+i[14]*a,t[3]=i[3]*n+i[7]*r+i[11]*o+i[15]*a,t},Ce.transformQuat=function(t,e,i){var n=e[0],r=e[1],o=e[2],a=i[0],s=i[1],l=i[2],u=i[3],h=u*n+s*o-l*r,c=u*r+l*n-a*o,d=u*o+a*r-s*n,p=-a*n-s*r-l*o;return t[0]=h*u+p*-a+c*-l-d*-s,t[1]=c*u+p*-s+d*-a-h*-l,t[2]=d*u+p*-l+h*-s-c*-a,t},Ce.forEach=function(){var t=Ce.create();return function(e,i,n,r,o,a){var s,l;for(i||(i=4),n||(n=0),l=r?Math.min(r*i+n,e.length):e.length,s=n;s.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(Jt.cross(De,e,i),t[0]=De[0],t[1]=De[1],t[2]=De[2],t[3]=1+n,Ee.normalize(t,t))}),Ee.setAxes=(ke=Ie.create(),function(t,e,i,n){return ke[0]=i[0],ke[3]=i[1],ke[6]=i[2],ke[1]=n[0],ke[4]=n[1],ke[7]=n[2],ke[2]=-e[0],ke[5]=-e[1],ke[8]=-e[2],Ee.normalize(t,Ee.fromMat3(t,ke))}),Ee.clone=Ae.clone,Ee.fromValues=Ae.fromValues,Ee.copy=Ae.copy,Ee.set=Ae.set,Ee.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},Ee.setAxisAngle=function(t,e,i){i*=.5;var n=Math.sin(i);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(i),t},Ee.add=Ae.add,Ee.multiply=function(t,e,i){var n=e[0],r=e[1],o=e[2],a=e[3],s=i[0],l=i[1],u=i[2],h=i[3];return t[0]=n*h+a*s+r*u-o*l,t[1]=r*h+a*l+o*s-n*u,t[2]=o*h+a*u+n*l-r*s,t[3]=a*h-n*s-r*l-o*u,t},Ee.mul=Ee.multiply,Ee.scale=Ae.scale,Ee.rotateX=function(t,e,i){i*=.5;var n=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);return t[0]=n*l+a*s,t[1]=r*l+o*s,t[2]=o*l-r*s,t[3]=a*l-n*s,t},Ee.rotateY=function(t,e,i){i*=.5;var n=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);return t[0]=n*l-o*s,t[1]=r*l+a*s,t[2]=o*l+n*s,t[3]=a*l-r*s,t},Ee.rotateZ=function(t,e,i){i*=.5;var n=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(i),l=Math.cos(i);return t[0]=n*l+r*s,t[1]=r*l-n*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t},Ee.calculateW=function(t,e){var i=e[0],n=e[1],r=e[2];return t[0]=i,t[1]=n,t[2]=r,t[3]=Math.sqrt(Math.abs(1-i*i-n*n-r*r)),t},Ee.dot=Ae.dot,Ee.lerp=Ae.lerp,Ee.slerp=function(t,e,i,n){var r,o,a,s,l,u=e[0],h=e[1],c=e[2],d=e[3],p=i[0],f=i[1],g=i[2],m=i[3];return(o=u*p+h*f+c*g+d*m)<0&&(o=-o,p=-p,f=-f,g=-g,m=-m),1-o>1e-6?(r=Math.acos(o),a=Math.sin(r),s=Math.sin((1-n)*r)/a,l=Math.sin(n*r)/a):(s=1-n,l=n),t[0]=s*u+l*p,t[1]=s*h+l*f,t[2]=s*c+l*g,t[3]=s*d+l*m,t},Ee.invert=function(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],a=i*i+n*n+r*r+o*o,s=a?1/a:0;return t[0]=-i*s,t[1]=-n*s,t[2]=-r*s,t[3]=o*s,t},Ee.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},Ee.length=Ae.length,Ee.len=Ee.length,Ee.squaredLength=Ae.squaredLength,Ee.sqrLen=Ee.squaredLength,Ee.normalize=Ae.normalize,Ee.fromMat3=function(t,e){var i,n=e[0]+e[4]+e[8];if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var r=0;e[4]>e[0]&&(r=1),e[8]>e[3*r+r]&&(r=2);var o=(r+1)%3,a=(r+2)%3;i=Math.sqrt(e[3*r+r]-e[3*o+o]-e[3*a+a]+1),t[r]=.5*i,i=.5/i,t[3]=(e[3*o+a]-e[3*a+o])*i,t[o]=(e[3*o+r]+e[3*r+o])*i,t[a]=(e[3*a+r]+e[3*r+a])*i}return t};const Ne=Ee;var Re,ze,Be,Ze,Fe=function(){this._axisX=new ye,this._axisY=new ye,this._axisZ=new ye,this.array=qt.create(),this._dirty=!0};Fe.prototype={constructor:Fe,setArray:function(t){for(var e=0;e0){var e=this.min,i=this.max,n=e.array,r=i.array;ei(n,t[0]),ei(r,t[0]);for(var o=1;or[0]&&(r[0]=a[0]),a[1]>r[1]&&(r[1]=a[1]),a[2]>r[2]&&(r[2]=a[2])}e._dirty=!0,i._dirty=!0}},union:function(t){var e=this.min,i=this.max;return Jt.min(e.array,e.array,t.min.array),Jt.max(i.array,i.array,t.max.array),e._dirty=!0,i._dirty=!0,this},intersection:function(t){var e=this.min,i=this.max;return Jt.max(e.array,e.array,t.min.array),Jt.min(i.array,i.array,t.max.array),e._dirty=!0,i._dirty=!0,this},intersectBoundingBox:function(t){var e=this.min.array,i=this.max.array,n=t.min.array,r=t.max.array;return!(e[0]>r[0]||e[1]>r[1]||e[2]>r[2]||i[0]=r[0]&&i[1]>=r[1]&&i[2]>=r[2]},containPoint:function(t){var e=this.min.array,i=this.max.array,n=t.array;return e[0]<=n[0]&&e[1]<=n[1]&&e[2]<=n[2]&&i[0]>=n[0]&&i[1]>=n[1]&&i[2]>=n[2]},isFinite:function(){var t=this.min.array,e=this.max.array;return isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])&&isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])},applyTransform:function(t){this.transformFrom(this,t)},transformFrom:(Ye=Jt.create(),qe=Jt.create(),Ke=Jt.create(),Je=Jt.create(),Qe=Jt.create(),$e=Jt.create(),function(t,e){var i=t.min.array,n=t.max.array,r=e.array;return Ye[0]=r[0]*i[0],Ye[1]=r[1]*i[0],Ye[2]=r[2]*i[0],qe[0]=r[0]*n[0],qe[1]=r[1]*n[0],qe[2]=r[2]*n[0],Ke[0]=r[4]*i[1],Ke[1]=r[5]*i[1],Ke[2]=r[6]*i[1],Je[0]=r[4]*n[1],Je[1]=r[5]*n[1],Je[2]=r[6]*n[1],Qe[0]=r[8]*i[2],Qe[1]=r[9]*i[2],Qe[2]=r[10]*i[2],$e[0]=r[8]*n[2],$e[1]=r[9]*n[2],$e[2]=r[10]*n[2],i=this.min.array,n=this.max.array,i[0]=Math.min(Ye[0],qe[0])+Math.min(Ke[0],Je[0])+Math.min(Qe[0],$e[0])+r[12],i[1]=Math.min(Ye[1],qe[1])+Math.min(Ke[1],Je[1])+Math.min(Qe[1],$e[1])+r[13],i[2]=Math.min(Ye[2],qe[2])+Math.min(Ke[2],Je[2])+Math.min(Qe[2],$e[2])+r[14],n[0]=Math.max(Ye[0],qe[0])+Math.max(Ke[0],Je[0])+Math.max(Qe[0],$e[0])+r[12],n[1]=Math.max(Ye[1],qe[1])+Math.max(Ke[1],Je[1])+Math.max(Qe[1],$e[1])+r[13],n[2]=Math.max(Ye[2],qe[2])+Math.max(Ke[2],Je[2])+Math.max(Qe[2],$e[2])+r[14],this.min._dirty=!0,this.max._dirty=!0,this}),applyProjection:function(t){var e=this.min.array,i=this.max.array,n=t.array,r=e[0],o=e[1],a=e[2],s=i[0],l=i[1],u=e[2],h=i[0],c=i[1],d=i[2];if(1===n[15])e[0]=n[0]*r+n[12],e[1]=n[5]*o+n[13],i[2]=n[10]*a+n[14],i[0]=n[0]*h+n[12],i[1]=n[5]*c+n[13],e[2]=n[10]*d+n[14];else{var p=-1/a;e[0]=n[0]*r*p,e[1]=n[5]*o*p,i[2]=(n[10]*a+n[14])*p,p=-1/u,i[0]=n[0]*s*p,i[1]=n[5]*l*p,p=-1/d,e[2]=(n[10]*d+n[14])*p}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var t=this.vertices;if(!t){t=[];for(var e=0;e<8;e++)t[e]=Jt.fromValues(0,0,0);this.vertices=t}var i=this.min.array,n=this.max.array;return ti(t[0],i[0],i[1],i[2]),ti(t[1],i[0],n[1],i[2]),ti(t[2],n[0],i[1],i[2]),ti(t[3],n[0],n[1],i[2]),ti(t[4],i[0],i[1],n[2]),ti(t[5],i[0],n[1],n[2]),ti(t[6],n[0],i[1],n[2]),ti(t[7],n[0],n[1],n[2]),this},copy:function(t){var e=this.min,i=this.max;return ei(e.array,t.min.array),ei(i.array,t.max.array),e._dirty=!0,i._dirty=!0,this},clone:function(){var t=new ii;return t.copy(this),t}};const ni=ii;var ri,oi,ai=0;const si=g.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},(function(){this.name||(this.name=(this.type||"NODE")+"_"+ai++),this.position||(this.position=new ye),this.rotation||(this.rotation=new Xe),this.scale||(this.scale=new ye(1,1,1)),this.worldTransform=new He,this.localTransform=new He,this._children=[]}),{target:null,invisible:!1,isSkinnedMesh:function(){return!1},isRenderable:function(){return!1},setName:function(t){var e=this._scene;if(e){var i=e._nodeRepository;delete i[this.name],i[t]=this}this.name=t},add:function(t){var e=t._parent;if(e!==this){e&&e.remove(t),t._parent=this,this._children.push(t);var i=this._scene;i&&i!==t.scene&&t.traverse(this._addSelfToScene,this),t._needsUpdateWorldTransform=!0}},remove:function(t){var e=this._children,i=e.indexOf(t);i<0||(e.splice(i,1),t._parent=null,this._scene&&t.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var t=this._children,e=0;e0},beforeRender:function(t){},afterRender:function(t,e){},getBoundingBox:function(t,e){return e=si.prototype.getBoundingBox.call(this,t,e),this.geometry&&this.geometry.boundingBox&&e.union(this.geometry.boundingBox),e},clone:(li=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"],function(){var t=si.prototype.clone.call(this);t.geometry=this.geometry,t.material=this.material;for(var e=0;e=0&&m[f]>1e-4&&(Jt.transformMat4(S,g,d[v[f]]),Jt.scaleAndAdd(y,y,S,m[f]));T.set(p,y)}}for(p=0;p>e;return t+1},dispose:function(t){var e=this._cache;e.use(t.__uid__);var i=e.get("webgl_texture");i&&t.gl.deleteTexture(i),e.deleteContext(t.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty(bi.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(bi.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}),bi.BYTE=5120,bi.UNSIGNED_BYTE=S,bi.SHORT=5122,bi.UNSIGNED_SHORT=5123,bi.INT=5124,bi.UNSIGNED_INT=5125,bi.FLOAT=T,bi.HALF_FLOAT=36193,bi.UNSIGNED_INT_24_8_WEBGL=34042,bi.DEPTH_COMPONENT=M,bi.DEPTH_STENCIL=34041,bi.ALPHA=6406,bi.RGB=6407,bi.RGBA=C,bi.LUMINANCE=6409,bi.LUMINANCE_ALPHA=6410,bi.SRGB=35904,bi.SRGB_ALPHA=35906,bi.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,bi.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,bi.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,bi.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,bi.NEAREST=A,bi.LINEAR=L,bi.NEAREST_MIPMAP_NEAREST=I,bi.LINEAR_MIPMAP_NEAREST=D,bi.NEAREST_MIPMAP_LINEAR=P,bi.LINEAR_MIPMAP_LINEAR=O,bi.REPEAT=k,bi.CLAMP_TO_EDGE=E,bi.MIRRORED_REPEAT=33648;const wi=bi;var Si=hi.extend({skeleton:null,joints:null},(function(){this.joints||(this.joints=[])}),{offsetMatrix:null,isInstancedMesh:function(){return!1},isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var t=hi.prototype.clone.call(this);return t.skeleton=this.skeleton,this.joints&&(t.joints=this.joints.slice()),t}});Si.POINTS=0,Si.LINES=1,Si.LINE_LOOP=2,Si.LINE_STRIP=3,Si.TRIANGLES=4,Si.TRIANGLE_STRIP=5,Si.TRIANGLE_FAN=6,Si.BACK=x,Si.FRONT=_,Si.FRONT_AND_BACK=1032,Si.CW=b,Si.CCW=w;const Ti=Si,Mi={isPowerOfTwo:function(t){return 0==(t&t-1)},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}};var Ci=Mi.isPowerOfTwo;function Ai(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}var Li=wi.extend((function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}}),{textureType:"texture2D",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(t);var i=this.format,n=this.type,r=!(!this.convertToPOT||this.mipmaps.length||!this.image||this.wrapS!==wi.REPEAT&&this.wrapT!==wi.REPEAT||!this.NPOT);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,r?this.wrapS:this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,r?this.wrapT:this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r?this.magFilter:this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,r?this.minFilter:this.getAvailableMinFilter());var o=t.getGLExtension("EXT_texture_filter_anisotropic");if(o&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_2D,o.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===n&&(t.getGLExtension("OES_texture_half_float")||(n=T)),this.mipmaps.length)for(var a=this.width,s=this.height,l=0;l=wi.COMPRESSED_RGB_S3TC_DXT1_EXT?t.compressedTexImage2D(t.TEXTURE_2D,i,o,n,r,0,e.pixels):t.texImage2D(t.TEXTURE_2D,i,o,n,r,0,o,a,e.pixels)},generateMipmap:function(t){var e=t.gl;this.useMipmap&&!this.NPOT&&(e.bindTexture(e.TEXTURE_2D,this._cache.get("webgl_texture")),e.generateMipmap(e.TEXTURE_2D))},isPowerOfTwo:function(){return Ci(this.width)&&Ci(this.height)},isRenderable:function(){return this.image?this.image.width>0&&this.image.height>0:!(!this.width||!this.height)},bind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,this.getWebGLTexture(t))},unbind:function(t){t.gl.bindTexture(t.gl.TEXTURE_2D,null)},load:function(t,e){var i=F.createImage();e&&(i.crossOrigin=e);var n=this;return i.onload=function(){n.dirty(),n.trigger("success",n)},i.onerror=function(){n.trigger("error",n)},i.src=t,this.image=i,this}});Object.defineProperty(Li.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(t){this.image?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(Li.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(t){this.image?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const Ii=Li;function Di(t){return{byte:F.Int8Array,ubyte:F.Uint8Array,short:F.Int16Array,ushort:F.Uint16Array}[t]||F.Float32Array}function Pi(t){return"attr_"+t}function Oi(t,e,i,n){switch(this.name=t,this.type=e,this.size=i,this.semantic=n||"",this.value=null,i){case 1:this.get=function(t){return this.value[t]},this.set=function(t,e){this.value[t]=e},this.copy=function(t,e){this.value[t]=this.value[t]};break;case 2:this.get=function(t,e){var i=this.value;return e[0]=i[2*t],e[1]=i[2*t+1],e},this.set=function(t,e){var i=this.value;i[2*t]=e[0],i[2*t+1]=e[1]},this.copy=function(t,e){var i=this.value;e*=2,i[t*=2]=i[e],i[t+1]=i[e+1]};break;case 3:this.get=function(t,e){var i=3*t,n=this.value;return e[0]=n[i],e[1]=n[i+1],e[2]=n[i+2],e},this.set=function(t,e){var i=3*t,n=this.value;n[i]=e[0],n[i+1]=e[1],n[i+2]=e[2]},this.copy=function(t,e){var i=this.value;e*=3,i[t*=3]=i[e],i[t+1]=i[e+1],i[t+2]=i[e+2]};break;case 4:this.get=function(t,e){var i=this.value,n=4*t;return e[0]=i[n],e[1]=i[n+1],e[2]=i[n+2],e[3]=i[n+3],e},this.set=function(t,e){var i=this.value,n=4*t;i[n]=e[0],i[n+1]=e[1],i[n+2]=e[2],i[n+3]=e[3]},this.copy=function(t,e){var i=this.value;e*=4,i[t*=4]=i[e],i[t+1]=i[e+1],i[t+2]=i[e+2],i[t+3]=i[e+3]}}}function ki(t,e,i,n,r){this.name=t,this.type=e,this.buffer=i,this.size=n,this.semantic=r,this.symbol="",this.needsRemove=!1}function Ei(t){this.buffer=t,this.count=0}Oi.prototype.init=function(t){if(!this.value||this.value.length!==t*this.size){var e=Di(this.type);this.value=new e(t*this.size)}},Oi.prototype.fromArray=function(t){var e,i=Di(this.type);if(t[0]&&t[0].length){var n=0,r=this.size;e=new i(t.length*r);for(var o=0;o=0){e||(e=[]);var i=this.indices;return e[0]=i[3*t],e[1]=i[3*t+1],e[2]=i[3*t+2],e}},setTriangleIndices:function(t,e){var i=this.indices;i[3*t]=e[0],i[3*t+1]=e[1],i[3*t+2]=e[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(t){var e,i=this.vertexCount>65535?F.Uint32Array:F.Uint16Array;if(t[0]&&t[0].length){var n=0;e=new i(3*t.length);for(var r=0;r=0&&(e.splice(i,1),delete this.attributes[t],!0)},getAttribute:function(t){return this.attributes[t]},getEnabledAttributes:function(){var t=this._enabledAttributes,e=this._attributeList;if(t)return t;for(var i=[],n=this.vertexCount,r=0;ro[0]&&(o[0]=s),l>o[1]&&(o[1]=l),u>o[2]&&(o[2]=u)}i._dirty=!0,n._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var t=this.indices,e=this.attributes,i=e.position.value,n=e.normal.value;if(n&&n.length===i.length)for(var r=0;r65535&&(this.indices=new F.Uint32Array(this.indices));for(var t=this.attributes,e=this.indices,i=this.getEnabledAttributes(),n={},r=0;rthis.distance,r=1;r<8;r++)if(Jt.dot(e[r].array,i)>this.distance!=n)return!0},intersectLine:(Ji=Jt.create(),function(t,e,i){var n=this.distanceToPoint(t),r=this.distanceToPoint(e);if(n>0&&r>0||n<0&&r<0)return null;var o=this.normal.array,a=this.distance,s=t.array;Jt.sub(Ji,e.array,t.array),Jt.normalize(Ji,Ji);var l=Jt.dot(o,Ji);if(0===l)return null;i||(i=new ye);var u=(Jt.dot(o,s)-a)/l;return Jt.scaleAndAdd(i.array,s,Ji,-u),i._dirty=!0,i}),applyTransform:(Yi=qt.create(),qi=Ae.create(),Ki=Ae.create(),Ki[3]=1,function(t){t=t.array,Jt.scale(Ki,this.normal.array,this.distance),Ae.transformMat4(Ki,Ki,t),this.distance=Jt.dot(Ki,this.normal.array),qt.invert(Yi,t),qt.transpose(Yi,Yi),qi[3]=0,Jt.copy(qi,this.normal.array),Ae.transformMat4(qi,qi,Yi),Jt.copy(this.normal.array,qi)}),copy:function(t){Jt.copy(this.normal.array,t.normal.array),this.normal._dirty=!0,this.distance=t.distance},clone:function(){var t=new Qi;return t.copy(this),t}};const $i=Qi;var tn,en=Jt.set,nn=Jt.copy,rn=Jt.transformMat4,on=Math.min,an=Math.max,sn=function(){this.planes=[];for(var t=0;t<6;t++)this.planes.push(new $i);for(this.boundingBox=new ni,this.vertices=[],t=0;t<8;t++)this.vertices[t]=Jt.fromValues(0,0,0)};sn.prototype={setFromProjection:function(t){var e=this.planes,i=t.array,n=i[0],r=i[1],o=i[2],a=i[3],s=i[4],l=i[5],u=i[6],h=i[7],c=i[8],d=i[9],p=i[10],f=i[11],g=i[12],m=i[13],v=i[14],y=i[15];en(e[0].normal.array,a-n,h-s,f-c),e[0].distance=-(y-g),e[0].normalize(),en(e[1].normal.array,a+n,h+s,f+c),e[1].distance=-(y+g),e[1].normalize(),en(e[2].normal.array,a+r,h+l,f+d),e[2].distance=-(y+m),e[2].normalize(),en(e[3].normal.array,a-r,h-l,f-d),e[3].distance=-(y-m),e[3].normalize(),en(e[4].normal.array,a-o,h-u,f-p),e[4].distance=-(y-v),e[4].normalize(),en(e[5].normal.array,a+o,h+u,f+p),e[5].distance=-(y+v),e[5].normalize();var _=this.boundingBox,x=this.vertices;if(0===y){var b=l/n,w=-v/(p-1),S=-v/(p+1),T=-S/l,M=-w/l;_.min.set(-T*b,-T,S),_.max.set(T*b,T,w),en(x[0],-T*b,-T,S),en(x[1],-T*b,T,S),en(x[2],T*b,-T,S),en(x[3],T*b,T,S),en(x[4],-M*b,-M,w),en(x[5],-M*b,M,w),en(x[6],M*b,-M,w),en(x[7],M*b,M,w)}else{var C=(-1-g)/n,A=(1-g)/n,L=(1-m)/l,I=(-1-m)/l,D=(-1-v)/p,P=(1-v)/p;_.min.set(Math.min(C,A),Math.min(I,L),Math.min(P,D)),_.max.set(Math.max(A,C),Math.max(L,I),Math.max(D,P));var O=_.min.array,k=_.max.array;en(x[0],O[0],O[1],O[2]),en(x[1],O[0],k[1],O[2]),en(x[2],k[0],O[1],O[2]),en(x[3],k[0],k[1],O[2]),en(x[4],O[0],O[1],k[2]),en(x[5],O[0],k[1],k[2]),en(x[6],k[0],O[1],k[2]),en(x[7],k[0],k[1],k[2])}},getTransformedBoundingBox:(tn=Jt.create(),function(t,e){var i=this.vertices,n=e.array,r=t.min,o=t.max,a=r.array,s=o.array,l=i[0];rn(tn,l,n),nn(a,tn),nn(s,tn);for(var u=1;u<8;u++)l=i[u],rn(tn,l,n),a[0]=on(tn[0],a[0]),a[1]=on(tn[1],a[1]),a[2]=on(tn[2],a[2]),s[0]=an(tn[0],s[0]),s[1]=an(tn[1],s[1]),s[2]=an(tn[2],s[2]);return r._dirty=!0,o._dirty=!0,t})};const ln=sn;var un;const hn=si.extend((function(){return{projectionMatrix:new He,invProjectionMatrix:new He,viewMatrix:new He,frustum:new ln}}),(function(){this.update(!0)}),{update:function(t){si.prototype.update.call(this,t),He.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),He.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(t){He.copy(this.viewMatrix,t),He.invert(this.worldTransform,t),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(t){He.copy(this.projectionMatrix,t),He.invert(this.invProjectionMatrix,t),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:(un=Ae.create(),function(t,e){var i=void 0!==e?e:new Me,n=t.array[0],r=t.array[1];return Ae.set(un,n,r,-1,1),Ae.transformMat4(un,un,this.invProjectionMatrix.array),Ae.transformMat4(un,un,this.worldTransform.array),Jt.scale(i.origin.array,un,1/un[3]),Ae.set(un,n,r,1,1),Ae.transformMat4(un,un,this.invProjectionMatrix.array),Ae.transformMat4(un,un,this.worldTransform.array),Jt.scale(un,un,1/un[3]),Jt.sub(i.direction.array,un,i.origin.array),Jt.normalize(i.direction.array,i.direction.array),i.direction._dirty=!0,i.origin._dirty=!0,i})});var cn,dn,pn=qt.create(),fn=qt.create(),gn={};function mn(t){var e=[],i=Object.keys(t);i.sort();for(var n=0;n0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(t)):t instanceof Xi&&this.lights.push(t),t.name&&(this._nodeRepository[t.name]=t)},removeFromScene:function(t){var e;t instanceof hn?(e=this._cameraList.indexOf(t))>=0&&this._cameraList.splice(e,1):t instanceof Xi&&(e=this.lights.indexOf(t))>=0&&this.lights.splice(e,1),t.name&&delete this._nodeRepository[t.name]},getNode:function(t){return this._nodeRepository[t]},setMainCamera:function(t){var e=this._cameraList.indexOf(t);e>=0&&this._cameraList.splice(e,1),this._cameraList.unshift(t)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var t=this.lights;this._previousLightNumber=this._lightNumber;for(var e={},i=0;i0&&this._doUpdateRenderList(a,e,i,n,r)}},isFrustumCulled:(cn=new ni,dn=new He,function(t,e,i){var n=t.boundingBox;if(n||(n=t.skeleton&&t.skeleton.boundingBox?t.skeleton.boundingBox:t.geometry.boundingBox),!n)return!1;if(dn.array=i,cn.transformFrom(n,dn),t.castShadow&&this.viewBoundingBoxLastFrame.union(cn),t.frustumCulling){if(!cn.intersectBoundingBox(e.frustum.boundingBox))return!0;dn.array=e.projectionMatrix.array,cn.max.array[2]>0&&cn.min.array[2]<0&&(cn.max.array[2]=-1e-20),cn.applyProjection(dn);var r=cn.min.array,o=cn.max.array;if(o[0]<-1||r[0]>1||o[1]<-1||r[1]>1||o[2]<-1||r[2]>1)return!0}return!1}),_updateLightUniforms:function(){var t=this.lights;t.sort(yn);var e=this._lightUniforms;for(var i in e)for(var n in e[i])e[i][n].value.length=0;for(var r=0;r=this._maxSize&&o>0){var s=i.head;i.remove(s),delete n[s.key],r=s.value,this._lastRemovedEntry=s}a?a.value=e:a=new xn(e),a.key=t,i.insertEntry(a),n[t]=a}return r},t.prototype.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}();var Sn=Mi.isPowerOfTwo,Tn=["px","nx","py","ny","pz","nz"],Mn=wi.extend((function(){return{image:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},pixels:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},mipmaps:[]}}),{textureType:"textureCube",update:function(t){var e=t.gl;e.bindTexture(e.TEXTURE_CUBE_MAP,this._cache.get("webgl_texture")),this.updateCommon(t);var i=this.format,n=this.type;e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,this.getAvailableWrapS()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,this.getAvailableWrapT()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,this.getAvailableMagFilter()),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,this.getAvailableMinFilter());var r=t.getGLExtension("EXT_texture_filter_anisotropic");if(r&&this.anisotropic>1&&e.texParameterf(e.TEXTURE_CUBE_MAP,r.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===n&&(t.getGLExtension("OES_texture_half_float")||(n=T)),this.mipmaps.length)for(var o=this.width,a=this.height,s=0;s0&&t.height>0}Object.defineProperty(Mn.prototype,"width",{get:function(){return this.image&&this.image.px?this.image.px.width:this._width},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set width"):(this._width!==t&&this.dirty(),this._width=t)}}),Object.defineProperty(Mn.prototype,"height",{get:function(){return this.image&&this.image.px?this.image.px.height:this._height},set:function(t){this.image&&this.image.px?console.warn("Texture from image can't set height"):(this._height!==t&&this.dirty(),this._height=t)}});const An=Mn,Ln=hn.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var t=this.fov/180*Math.PI;this.projectionMatrix.perspective(t,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array,e=2*Math.atan(1/t[5]);this.fov=e/Math.PI*180,this.aspect=t[5]/t[0],this.near=t[14]/(t[10]-1),this.far=t[14]/(t[10]+1)},clone:function(){var t=hn.prototype.clone.call(this);return t.fov=this.fov,t.aspect=this.aspect,t.near=this.near,t.far=this.far,t}});var In="framebuffer",Dn="renderbuffer",Pn="renderbuffer_width",On="renderbuffer_height",kn="renderbuffer_attached",En="depthtexture_attached",Nn=36160,Rn=36161,zn=36096,Bn=g.extend({depthBuffer:!0,viewport:null,_width:0,_height:0,_textures:null,_boundRenderer:null},(function(){this._cache=new xi,this._textures={}}),{getTextureWidth:function(){return this._width},getTextureHeight:function(){return this._height},bind:function(t){if(t.__currentFrameBuffer){if(t.__currentFrameBuffer===this)return;console.warn("Renderer already bound with another framebuffer. Unbind it first")}t.__currentFrameBuffer=this;var e=t.gl;e.bindFramebuffer(Nn,this._getFrameBufferGL(t)),this._boundRenderer=t;var i=this._cache;i.put("viewport",t.viewport);var n,r,o=!1;for(var a in this._textures){o=!0;var s=this._textures[a];s&&(n=s.texture.width,r=s.texture.height,this._doAttach(t,s.texture,a,s.target))}this._width=n,this._height=r,!o&&this.depthBuffer&&console.error("Must attach texture before bind, or renderbuffer may have incorrect width and height."),this.viewport?t.setViewport(this.viewport):t.setViewport(0,0,n,r,1);var l=i.get("attached_textures");if(l)for(var a in l)if(!this._textures[a]){var u=l[a];this._doDetach(e,a,u)}if(!i.get(En)&&this.depthBuffer){i.miss(Dn)&&i.put(Dn,e.createRenderbuffer());var h=i.get(Dn);n===i.get(Pn)&&r===i.get(On)||(e.bindRenderbuffer(Rn,h),e.renderbufferStorage(Rn,e.DEPTH_COMPONENT16,n,r),i.put(Pn,n),i.put(On,r),e.bindRenderbuffer(Rn,null)),i.get(kn)||(e.framebufferRenderbuffer(Nn,zn,Rn,h),i.put(kn,!0))}},unbind:function(t){t.__currentFrameBuffer=null,t.gl.bindFramebuffer(Nn,null),this._boundRenderer=null,this._cache.use(t.__uid__);var e=this._cache.get("viewport");e&&t.setViewport(e),this.updateMipmap(t)},updateMipmap:function(t){var e=t.gl;for(var i in this._textures){var n=this._textures[i];if(n){var r=n.texture;if(!r.NPOT&&r.useMipmap&&r.minFilter===wi.LINEAR_MIPMAP_LINEAR){var o="textureCube"===r.textureType?34067:3553;e.bindTexture(o,r.getWebGLTexture(t)),e.generateMipmap(o),e.bindTexture(o,null)}}}},checkStatus:function(t){return t.checkFramebufferStatus(Nn)},_getFrameBufferGL:function(t){var e=this._cache;return e.use(t.__uid__),e.miss(In)&&e.put(In,t.gl.createFramebuffer()),e.get(In)},attach:function(t,e,i){if(!t.width)throw new Error("The texture attached to color buffer is not a valid.");e=e||36064,i=i||3553;var n,r=this._boundRenderer;if(r&&r.gl){var o=this._cache;o.use(r.__uid__),n=o.get("attached_textures")}var a=this._textures[e];if(!a||a.target!==i||a.texture!==t||!n||null==n[e]){var s=!0;r&&(s=this._doAttach(r,t,e,i),this.viewport||r.setViewport(0,0,t.width,t.height,1)),s&&(this._textures[e]=this._textures[e]||{},this._textures[e].texture=t,this._textures[e].target=i)}},_doAttach:function(t,e,i,n){var r=t.gl,o=e.getWebGLTexture(t),a=this._cache.get("attached_textures");if(a&&a[i]){var s=a[i];if(s.texture===e&&s.target===n)return}var l=!0;if(((i=+i)===zn||i===N)&&(t.getGLExtension("WEBGL_depth_texture")||(console.error("Depth texture is not supported by the browser"),l=!1),e.format!==M&&34041!==e.format&&(console.error("The texture attached to depth buffer is not a valid."),l=!1),l)){var u=this._cache.get(Dn);u&&(r.framebufferRenderbuffer(Nn,zn,Rn,null),r.deleteRenderbuffer(u),this._cache.put(Dn,!1)),this._cache.put(kn,!1),this._cache.put(En,!0)}return r.framebufferTexture2D(Nn,i,n,o,0),a||(a={},this._cache.put("attached_textures",a)),a[i]=a[i]||{},a[i].texture=e,a[i].target=n,l},_doDetach:function(t,e,i){t.framebufferTexture2D(Nn,e,i,null,0);var n=this._cache.get("attached_textures");n&&n[e]&&(n[e]=null),e!==zn&&e!==N||this._cache.put(En,!1)},detach:function(t,e){this._textures[t]=null,this._boundRenderer&&(this._cache.use(this._boundRenderer.__uid__),this._doDetach(this._boundRenderer.gl,t,e))},dispose:function(t){var e=t.gl,i=this._cache;i.use(t.__uid__);var n=i.get(Dn);n&&e.deleteRenderbuffer(n);var r=i.get(In);r&&e.deleteFramebuffer(r),i.deleteContext(t.__uid__),this._textures={}}});Bn.DEPTH_ATTACHMENT=zn,Bn.COLOR_ATTACHMENT0=36064,Bn.STENCIL_ATTACHMENT=36128,Bn.DEPTH_STENCIL_ATTACHMENT=N;const Zn=Bn;var Fn=["px","nx","py","ny","pz","nz"];const Vn=g.extend((function(){var t={position:new ye,far:1e3,near:.1,texture:null,shadowMapPass:null},e=t._cameras={px:new Ln({fov:90}),nx:new Ln({fov:90}),py:new Ln({fov:90}),ny:new Ln({fov:90}),pz:new Ln({fov:90}),nz:new Ln({fov:90})};return e.px.lookAt(ye.POSITIVE_X,ye.NEGATIVE_Y),e.nx.lookAt(ye.NEGATIVE_X,ye.NEGATIVE_Y),e.py.lookAt(ye.POSITIVE_Y,ye.POSITIVE_Z),e.ny.lookAt(ye.NEGATIVE_Y,ye.NEGATIVE_Z),e.pz.lookAt(ye.POSITIVE_Z,ye.NEGATIVE_Y),e.nz.lookAt(ye.NEGATIVE_Z,ye.NEGATIVE_Y),t._frameBuffer=new Zn,t}),{getCamera:function(t){return this._cameras[t]},render:function(t,e,i){var n=t.gl;i||e.update();for(var r=this.texture.width,o=2*Math.atan(r/(r-.5))/Math.PI*180,a=0;a<6;a++){var s=Fn[a],l=this._cameras[s];if(ye.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=o,this.shadowMapPass){l.update();var u=e.getBoundingBox();u.applyTransform(l.viewMatrix),e.viewBoundingBoxLastFrame.copy(u),this.shadowMapPass.render(t,e,l,!0)}this._frameBuffer.attach(this.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+a),this._frameBuffer.bind(t),t.render(e,l,!0),this._frameBuffer.unbind(t)}},dispose:function(t){this._frameBuffer.dispose(t)}}),Gn=Gi.extend({dynamic:!1,widthSegments:1,heightSegments:1},(function(){this.build()}),{build:function(){for(var t=this.heightSegments,e=this.widthSegments,i=this.attributes,n=[],r=[],o=[],a=[],s=0;s<=t;s++)for(var l=s/t,u=0;u<=e;u++){var h=u/e;if(n.push([2*h-1,2*l-1,0]),r&&r.push([h,l]),o&&o.push([0,0,1]),u0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),t.renderPass([this],i)}}),Xn=jn;function Yn(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}var qn=Yn("DXT1"),Kn=Yn("DXT3"),Jn=Yn("DXT5");const Qn=function(t,e){var i=new Int32Array(t,0,31);if(542327876!==i[0])return null;if(4&!i(20))return null;var n,r,o=i(21),a=i[4],s=i[3],l=512&i[28],u=131072&i[2];switch(o){case qn:n=8,r=wi.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Kn:n=16,r=wi.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Jn:n=16,r=wi.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}var h=i[1]+4,c=l?6:1,d=1;u&&(d=Math.max(1,i[7]));for(var p=[],f=0;f0){var r=Math.pow(2,t[3]-128-8+n);e[i+0]=t[0]*r,e[i+1]=t[1]*r,e[i+2]=t[2]*r}else e[i+0]=0,e[i+1]=0,e[i+2]=0;return e[i+3]=1,e}function er(t,e,i,n){for(var r,o,a=0,s=0,l=n;l>0;)if(t[s][0]=e[i++],t[s][1]=e[i++],t[s][2]=e[i++],t[s][3]=e[i++],1===t[s][0]&&1===t[s][1]&&1===t[s][2]){for(var u=t[s][3]<>>0;u>0;u--)r=t[s-1],(o=t[s])[0]=r[0],o[1]=r[1],o[2]=r[2],o[3]=r[3],s++,l--;a+=8}else s++,l--,a=0;return i}function ir(t,e,i,n){if(n<8|n>32767)return er(t,e,i,n);if(2!=(r=e[i++]))return er(t,e,i-1,n);if(t[0][1]=e[i++],t[0][2]=e[i++],r=e[i++],(t[0][2]<<8>>>0|r)>>>0!==n)return null;for(var r=0;r<4;r++)for(var o=0;o128){a=(127&a)>>>0;for(var s=e[i++];a--;)t[o++][r]=s}else for(;a--;)t[o++][r]=e[i++]}return i}const nr=function(t,e,i){null==i&&(i=0);var n=new Uint8Array(t),r=n.length;if("#?"===function(t,e,i){for(var n="",r=0;r<2;r++)n+=$n(t[r]);return n}(n)){for(var o=2;o=r)){o+=2;for(var a="";o20)return console.warn("Given image is not a height map"),t}var d,p,f,g;l%(4*n)==0?(d=a.data[l],f=a.data[l+4]):l%(4*n)==4*(n-1)?(d=a.data[l-4],f=a.data[l]):(d=a.data[l-4],f=a.data[l+4]),l<4*n?(p=a.data[l],g=a.data[l+4*n]):l>n*(r-1)*4?(p=a.data[l-4*n],g=a.data[l]):(p=a.data[l-4*n],g=a.data[l+4*n]),s.data[l]=d-f+127,s.data[l+1]=p-g+127,s.data[l+2]=255,s.data[l+3]=255}return o.putImageData(s,0,0),i},isHeightImage:function(t,e,i){if(!t||!t.width||!t.height)return!1;var n=document.createElement("canvas"),r=n.getContext("2d"),o=e||32;i=i||20,n.width=n.height=o,r.drawImage(t,0,0,o,o);for(var a=r.getImageData(0,0,o,o),s=0;si)return!1}return!0},_fetchTexture:function(t,e,i){F.request.get({url:t,responseType:"arraybuffer",onload:e,onerror:i})},createChessboard:function(t,e,i,n){t=t||512,e=e||64,i=i||"black",n=n||"white";var r=Math.ceil(t/e),o=document.createElement("canvas");o.width=t,o.height=t;var a=o.getContext("2d");a.fillStyle=n,a.fillRect(0,0,t,t),a.fillStyle=i;for(var s=0;s=0||(ar.forEach((function(e){t.on(e,this[sr(e)],this)}),this),this._meshes.push(t))},detachFromMesh:function(t){var e=this._meshes.indexOf(t);e>=0&&this._meshes.splice(e,1),ar.forEach((function(e){t.off(e,this[sr(e)])}),this)},dispose:function(){this._meshes.forEach((function(t){this.detachFromMesh(t)}),this)}};const ur=lr,hr=hn.extend({left:-1,right:1,near:-1,far:1,top:1,bottom:-1},{updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},decomposeProjectionMatrix:function(){var t=this.projectionMatrix.array;this.left=(-1-t[12])/t[0],this.right=(1-t[12])/t[0],this.top=(1-t[13])/t[5],this.bottom=(-1-t[13])/t[5],this.near=-(-1-t[14])/t[10],this.far=-(1-t[14])/t[10]},clone:function(){var t=hn.prototype.clone.call(this);return t.left=this.left,t.right=this.right,t.near=this.near,t.far=this.far,t.top=this.top,t.bottom=this.bottom,t}});jt.import("\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end");var cr=new Gn,dr=new Ti({geometry:cr,frustumCulling:!1}),pr=new hr;const fr=g.extend((function(){return{fragment:"",outputs:null,material:null,blendWithPrevious:!1,clearColor:!1,clearDepth:!0}}),(function(){var t=new jt(jt.source("clay.compositor.vertex"),this.fragment),e=new lt({shader:t});e.enableTexturesAll(),this.material=e}),{setUniform:function(t,e){this.material.setUniform(t,e)},getUniform:function(t){var e=this.material.uniforms[t];if(e)return e.value},attachOutput:function(t,e){this.outputs||(this.outputs={}),e=e||36064,this.outputs[e]=t},detachOutput:function(t){for(var e in this.outputs)this.outputs[e]===t&&(this.outputs[e]=null)},bind:function(t,e){if(this.outputs)for(var i in this.outputs){var n=this.outputs[i];n&&e.attach(n,i)}e&&e.bind(t)},unbind:function(t,e){e.unbind(t)},render:function(t,e){var i=t.gl;if(e){this.bind(t,e);var n=t.getGLExtension("EXT_draw_buffers");if(n&&this.outputs){var r=[];for(var o in this.outputs)(o=+o)>=i.COLOR_ATTACHMENT0&&o<=i.COLOR_ATTACHMENT0+8&&r.push(o);n.drawBuffersEXT(r)}}this.trigger("beforerender",this,t);var a=this.clearDepth?i.DEPTH_BUFFER_BIT:0;if(i.depthMask(!0),this.clearColor){a|=i.COLOR_BUFFER_BIT,i.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&i.clearColor(s[0],s[1],s[2],s[3])}i.clear(a),this.blendWithPrevious?(i.enable(i.BLEND),this.material.transparent=!0):(i.disable(i.BLEND),this.material.transparent=!1),this.renderQuad(t),this.trigger("afterrender",this,t),e&&this.unbind(t,e)},renderQuad:function(t){dr.material=this.material,t.renderPass([dr],pr)},dispose:function(t){}});var gr={},mr=["px","nx","py","ny","pz","nz"];gr.prefilterEnvironmentMap=function(t,e,i,n,r){r&&n||(n=gr.generateNormalDistribution(),r=gr.integrateBRDF(t,n));var o=(i=i||{}).width||64,a=i.height||64,s=i.type||e.type,l=new An({width:o,height:a,type:s,flipY:!1,mipmaps:[]});l.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var u=Math.min(o,a),h=Math.log(u)/Math.log(2)+1,c=new lt({shader:new jt({vertex:jt.source("clay.skybox.vertex"),fragment:"#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"})});c.set("normalDistribution",n),i.encodeRGBM&&c.define("fragment","RGBM_ENCODE"),i.decodeRGBM&&c.define("fragment","RGBM_DECODE");var d,p=new _n;if("texture2D"===e.textureType){var f=new An({width:o,height:a,type:s===wi.FLOAT?wi.HALF_FLOAT:s});or.panoramaToCubeMap(t,e,f,{encodeRGBM:i.decodeRGBM}),e=f}(d=new jn({scene:p,material:c})).material.set("environmentMap",e);var g=new Vn({texture:l});i.encodeRGBM&&(s=l.type=wi.UNSIGNED_BYTE);for(var m=new Ii({width:o,height:a,type:s}),v=new Zn({depthBuffer:!1}),y=F[s===wi.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],_=0;_ 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"}),r=new Ii({width:512,height:256,type:wi.HALF_FLOAT,wrapS:wi.CLAMP_TO_EDGE,wrapT:wi.CLAMP_TO_EDGE,minFilter:wi.NEAREST,magFilter:wi.NEAREST,useMipmap:!1});return n.setUniform("normalDistribution",e),n.setUniform("viewportSize",[512,256]),n.attachOutput(r),n.render(t,i),i.dispose(t),r},gr.generateNormalDistribution=function(t,e){for(var i=new Ii({width:t=t||256,height:e=e||1024,type:wi.FLOAT,minFilter:wi.NEAREST,magFilter:wi.NEAREST,wrapS:wi.CLAMP_TO_EDGE,wrapT:wi.CLAMP_TO_EDGE,useMipmap:!1}),n=new Float32Array(e*t*4),r=[],o=0;o>>16)>>>0;u=(((16711935&(u=((252645135&(u=((858993459&(u=((1431655765&u)<<1|(2863311530&u)>>>1)>>>0))<<2|(3435973836&u)>>>2)>>>0))<<4|(4042322160&u)>>>4)>>>0))<<8|(4278255360&u)>>>8)>>>0)/4294967296;var h=Math.sqrt((1-u)/(1+(s*s-1)*u));r[l]=h}for(l=0;l65535?Uint32Array:Uint16Array,y=this.indices=new v(e*t*6),_=this.radius,x=this.phiStart,b=this.phiLength,w=this.thetaStart,S=this.thetaLength,T=[],M=[],C=0,A=1/(_=this.radius);for(d=0;d<=t;d++)for(c=0;c<=e;c++)u=c/e,h=d/t,a=-_*Math.cos(x+u*b)*Math.sin(w+h*S),s=_*Math.cos(w+h*S),l=_*Math.sin(x+u*b)*Math.sin(w+h*S),T[0]=a,T[1]=s,T[2]=l,M[0]=u,M[1]=h,i.set(C,T),n.set(C,M),T[0]*=A,T[1]*=A,T[2]*=A,r.set(C,T),C++;var L=e+1,I=0;for(d=0;d255?255:t}function Jr(t){return t<0?0:t>1?1:t}function Qr(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Kr(parseFloat(e)/100*255):Kr(parseInt(e,10))}function $r(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?Jr(parseFloat(e)/100):Jr(parseFloat(e))}function to(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function eo(t,e,i,n,r){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t}function io(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var no=new wn(20),ro=null;function oo(t,e){ro&&io(ro,e),ro=no.put(t,ro||e.slice())}function ao(t,e){if(t){e=e||[];var i=no.get(t);if(i)return io(e,i);var n=(t+="").replace(/ /g,"").toLowerCase();if(n in qr)return io(e,qr[n]),oo(t,e),e;var r,o=n.length;if("#"===n.charAt(0))return 4===o||5===o?(r=parseInt(n.slice(1,4),16))>=0&&r<=4095?(eo(e,(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,5===o?parseInt(n.slice(4),16)/15:1),oo(t,e),e):void eo(e,0,0,0,1):7===o||9===o?(r=parseInt(n.slice(1,7),16))>=0&&r<=16777215?(eo(e,(16711680&r)>>16,(65280&r)>>8,255&r,9===o?parseInt(n.slice(7),16)/255:1),oo(t,e),e):void eo(e,0,0,0,1):void 0;var a=n.indexOf("("),s=n.indexOf(")");if(-1!==a&&s+1===o){var l=n.substr(0,a),u=n.substr(a+1,s-(a+1)).split(","),h=1;switch(l){case"rgba":if(4!==u.length)return 3===u.length?eo(e,+u[0],+u[1],+u[2],1):eo(e,0,0,0,1);h=$r(u.pop());case"rgb":return 3!==u.length?void eo(e,0,0,0,1):(eo(e,Qr(u[0]),Qr(u[1]),Qr(u[2]),h),oo(t,e),e);case"hsla":return 4!==u.length?void eo(e,0,0,0,1):(u[3]=$r(u[3]),so(u,e),oo(t,e),e);case"hsl":return 3!==u.length?void eo(e,0,0,0,1):(so(u,e),oo(t,e),e);default:return}}eo(e,0,0,0,1)}}function so(t,e){var i=(parseFloat(t[0])%360+360)%360/360,n=$r(t[1]),r=$r(t[2]),o=r<=.5?r*(n+1):r+n-r*n,a=2*r-o;return eo(e=e||[],Kr(255*to(a,o,i+1/3)),Kr(255*to(a,o,i)),Kr(255*to(a,o,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}var lo=Object.prototype.toString,uo=Array.prototype,ho=uo.forEach,co=uo.filter,po=uo.slice,fo=uo.map,go=function(){}.constructor,mo=go?go.prototype:null;function vo(t,e){if(Object.assign)Object.assign(t,e);else for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function yo(t,e,i){if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames)for(var n=Object.getOwnPropertyNames(e),r=0;ra)n.length=a;else for(var s=o;s=2&&this.interpolable},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e){t>=this.maxTime?this.maxTime=t:this._needsSort=!0;var i=this.keyframes,n=i.length;if(this.interpolable)if(_o(e)){var r=function(t){return _o(t&&t[0])?2:1}(e);if(n>0&&this.arrDim!==r)return void(this.interpolable=!1);if(1===r&&"number"!=typeof e[0]||2===r&&"number"!=typeof e[0][0])return void(this.interpolable=!1);if(n>0){var o=i[n-1];this._isAllValueEqual&&(1===r&&Eo(e,o.value)||(this._isAllValueEqual=!1))}this.arrDim=r}else{if(this.arrDim>0)return void(this.interpolable=!1);if("string"==typeof e){var a=ao(e);a?(e=a,this.isValueColor=!0):this.interpolable=!1}else if("number"!=typeof e||isNaN(e))return void(this.interpolable=!1);this._isAllValueEqual&&n>0&&(o=i[n-1],(this.isValueColor&&!Eo(o.value,e)||o.value!==e)&&(this._isAllValueEqual=!1))}var s={time:t,value:e,percent:0};return this.keyframes.push(s),s},t.prototype.prepare=function(t){var e=this.keyframes;this._needsSort&&e.sort((function(t,e){return t.time-e.time}));for(var i=this.arrDim,n=e.length,r=e[n-1],o=0;o0&&o!==n-1&&ko(e[o].value,r.value,i);if(t&&this.needsAnimate()&&t.needsAnimate()&&i===t.arrDim&&this.isValueColor===t.isValueColor&&!t._finished){this._additiveTrack=t;var a=e[0].value;for(o=0;o=0&&!(o[i].percent<=e);i--);i=Math.min(i,a-2)}else{for(i=this._lastFrame;ie);i++);i=Math.min(i-1,a-2)}var h=o[i+1],c=o[i];if(c&&h){this._lastFrame=i,this._lastFramePercent=e;var d=h.percent-c.percent;if(0!==d){var p=(e-c.percent)/d,f=n?this._additiveValue:u?Zo:t[s];if((l>0||u)&&!f&&(f=this._additiveValue=[]),this.useSpline){var g=o[i][r],m=o[0===i?i:i-1][r],v=o[i>a-2?a-1:i+1][r],y=o[i>a-3?a-1:i+2][r];if(l>0)1===l?Ro(f,m,g,v,y,p,p*p,p*p*p):function(t,e,i,n,r,o,a,s){for(var l=e.length,u=e[0].length,h=0;h0?1===l?Do(f,c[r],h[r],p):function(t,e,i,n){for(var r=e.length,o=r&&e[0].length,a=0;a.5?e:t}(c[r],h[r],p),n?this._additiveValue=_:t[s]=_);n&&this._addToTarget(t)}}}},t.prototype._addToTarget=function(t){var e=this.arrDim,i=this.propName,n=this._additiveValue;0===e?this.isValueColor?(ao(t[i],Zo),Po(Zo,Zo,n,1),t[i]=Bo(Zo)):t[i]=t[i]+n:1===e?Po(t[i],t[i],n,1):2===e&&Oo(t[i],t[i],n,1)},t}();const Vo=function(){function t(t,e,i){this._tracks={},this._trackKeys=[],this._delay=0,this._maxTime=0,this._paused=!1,this._started=0,this._clip=null,this._target=t,this._loop=e,e&&i?function(){for(var t=[],e=0;e0)){this._started=1;for(var i=this,n=[],r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[n]),r.prepare(r.getAdditiveTrack())}}}},t}(),Go={_animators:null,getAnimators:function(){return this._animators=this._animators||[],this._animators},animate:function(t,e){var i;if(this._animators=this._animators||[],t){for(var n=t.split("."),r=this,o=0,a=n.length;o=0&&s.splice(t,1)})),s.push(l),this.__zr&&this.__zr.animation.addAnimator(l),l},stopAnimation:function(t){this._animators=this._animators||[];for(var e=this._animators,i=e.length,n=0;n 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.chunk.instancing_header\n#ifdef INSTANCING\nattribute vec4 instanceMat1;\nattribute vec4 instanceMat2;\nattribute vec4 instanceMat3;\n#endif\n@end\n@export clay.chunk.instancing_matrix\nmat4 instanceMat = mat4(\n vec4(instanceMat1.xyz, 0.0),\n vec4(instanceMat2.xyz, 0.0),\n vec4(instanceMat3.xyz, 0.0),\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\n);\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end";function Uo(t){return t instanceof HTMLCanvasElement||t instanceof HTMLImageElement||t instanceof Image}Object.assign(si.prototype,Go),jt.import(Ho),jt.import(Xt),jt.import("\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"),jt.import("@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\nattribute vec3 normal: NORMAL;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nvarying vec3 v_Normal;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\nvarying vec3 v_Normal;\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"),jt.import("/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),jt.import("@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),jt.import("@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"),jt.import("@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end");var Wo=_n.prototype.addToScene,jo=_n.prototype.removeFromScene;_n.prototype.addToScene=function(t){if(Wo.call(this,t),this.__zr){var e=this.__zr;t.traverse((function(t){t.__zr=e,t.addAnimatorsToZr&&t.addAnimatorsToZr(e)}))}},_n.prototype.removeFromScene=function(t){jo.call(this,t),t.traverse((function(t){var e=t.__zr;t.__zr=null,e&&t.removeAnimatorsFromZr&&t.removeAnimatorsFromZr(e)}))},lt.prototype.setTextureImage=function(t,e,i,n){if(this.shader){var r,o=i.getZr(),a=this;return a.autoUpdateTextureStatus=!1,a.disableTexture(t),!(s=e)||"none"===s||(r=Xo.loadTexture(e,i,n,(function(e){a.enableTexture(t),o&&o.refresh()})),a.set(t,r)),r}var s};var Xo={};Xo.Renderer=he,Xo.Node=si,Xo.Mesh=Ti,Xo.Shader=jt,Xo.Material=lt,Xo.Texture=wi,Xo.Texture2D=Ii,Xo.Geometry=Gi,Xo.SphereGeometry=Ar,Xo.PlaneGeometry=Gn,Xo.CubeGeometry=Wn,Xo.AmbientLight=Lr,Xo.DirectionalLight=Ir,Xo.PointLight=Dr,Xo.SpotLight=Pr,Xo.PerspectiveCamera=Ln,Xo.OrthographicCamera=hr,Xo.Vector2=vt,Xo.Vector3=ye,Xo.Vector4=Nr,Xo.Quaternion=Xe,Xo.Matrix2=Zr,Xo.Matrix2d=Hr,Xo.Matrix3=Wr,Xo.Matrix4=He,Xo.Plane=$i,Xo.Ray=Me,Xo.BoundingBox=ni,Xo.Frustum=ln;var Yo=null;function qo(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function Ko(t){if((t.wrapS===wi.REPEAT||t.wrapT===wi.REPEAT)&&t.image){var e=qo(t.width),i=qo(t.height);if(e!==t.width||i!==t.height){var n=document.createElement("canvas");n.width=e,n.height=i,n.getContext("2d").drawImage(t.image,0,0,e,i),t.image=n}}}Xo.loadTexture=function(t,e,i,n){"function"==typeof i&&(n=i,i={}),i=i||{};for(var r=Object.keys(i).sort(),o="",a=0;a3?e[3]=t[3]:e[3]=1,e):((e=n.color.parse(t||"#000",e)||[0,0,0,0])[0]/=255,e[1]/=255,e[2]/=255,e)},Xo.directionFromAlphaBeta=function(t,e){var i=t/180*Math.PI+Math.PI/2,n=-e/180*Math.PI+Math.PI/2,r=[],o=Math.sin(i);return r[0]=o*Math.cos(n),r[1]=-Math.cos(i),r[2]=o*Math.sin(n),r},Xo.getShadowResolution=function(t){var e=1024;switch(t){case"low":e=512;break;case"medium":break;case"high":e=2048;break;case"ultra":e=4096}return e},Xo.COMMON_SHADERS=["lambert","color","realistic","hatching","shadow"],Xo.createShader=function(t){"ecgl.shadow"===t&&(t="ecgl.displayShadow");var e=jt.source(t+".vertex"),i=jt.source(t+".fragment");e||console.error("Vertex shader of '%s' not exits",t),i||console.error("Fragment shader of '%s' not exits",t);var n=new jt(e,i);return n.name=t,n},Xo.createMaterial=function(t,e){e instanceof Array||(e=[e]);var i=Xo.createShader(t),n=new lt({shader:i});return e.forEach((function(t){"string"==typeof t&&n.define(t)})),n},Xo.setMaterialFromModel=function(t,e,i,n){e.autoUpdateTextureStatus=!1;var r=i.getModel(t+"Material"),o=r.get("detailTexture"),a=Mr(r.get("textureTiling"),1),s=Mr(r.get("textureOffset"),0);"number"==typeof a&&(a=[a,a]),"number"==typeof s&&(s=[s,s]);var l=a[0]>1||a[1]>1?Xo.Texture.REPEAT:Xo.Texture.CLAMP_TO_EDGE,u={anisotropic:8,wrapS:l,wrapT:l};if("realistic"===t){var h=r.get("roughness"),c=r.get("metalness");null!=c?isNaN(c)&&(e.setTextureImage("metalnessMap",c,n,u),c=Mr(r.get("metalnessAdjust"),.5)):c=0,null!=h?isNaN(h)&&(e.setTextureImage("roughnessMap",h,n,u),h=Mr(r.get("roughnessAdjust"),.5)):h=.5;var d=r.get("normalTexture");e.setTextureImage("detailMap",o,n,u),e.setTextureImage("normalMap",d,n,u),e.set({roughness:h,metalness:c,detailUvRepeat:a,detailUvOffset:s})}else if("lambert"===t)e.setTextureImage("detailMap",o,n,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("color"===t)e.setTextureImage("detailMap",o,n,u),e.set({detailUvRepeat:a,detailUvOffset:s});else if("hatching"===t){var p=r.get("hatchingTextures")||[];p.length;for(var f=0;f<6;f++)e.setTextureImage("hatch"+(f+1),p[f],n,{anisotropic:8,wrapS:Xo.Texture.REPEAT,wrapT:Xo.Texture.REPEAT});e.set({detailUvRepeat:a,detailUvOffset:s})}},Xo.updateVertexAnimation=function(t,e,i,n){var r=n.get("animation"),o=n.get("animationDurationUpdate"),a=n.get("animationEasingUpdate"),s=i.shadowDepthMaterial;if(r&&e&&o>0&&e.geometry.vertexCount===i.geometry.vertexCount){i.material.define("vertex","VERTEX_ANIMATION"),i.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var l=0;l=0&&this._viewsToDispose.splice(e,1),this.views.push(t),t.layer=this;var i=this.zr;t.scene.traverse((function(t){t.__zr=i,t.addAnimatorsToZr&&t.addAnimatorsToZr(i)}))}},$o.prototype.removeView=function(t){if(t.layer===this){var e=this.views.indexOf(t);e>=0&&(this.views.splice(e,1),t.scene.traverse(ta,this),t.layer=null,this._viewsToDispose.push(t))}},$o.prototype.removeViewsAll=function(){this.views.forEach((function(t){t.scene.traverse(ta,this),t.layer=null,this._viewsToDispose.push(t)}),this),this.views.length=0},$o.prototype.resize=function(t,e){this.renderer.resize(t,e)},$o.prototype.clear=function(){var t=this.renderer.gl,e=this._backgroundColor||[0,0,0,0];t.clearColor(e[0],e[1],e[2],e[3]),t.depthMask(!0),t.colorMask(!0,!0,!0,!0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT)},$o.prototype.clearDepth=function(){var t=this.renderer.gl;t.clear(t.DEPTH_BUFFER_BIT)},$o.prototype.clearColor=function(){var t=this.renderer.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},$o.prototype.needsRefresh=function(){this.zr.refresh()},$o.prototype.refresh=function(t){this._backgroundColor=t?Jo.parseColor(t):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var e=0;e20)){t=t.event;var n=this.pickObject(t.offsetX,t.offsetY);n&&(this._dispatchEvent(t.type,t,n),this._dispatchDataEvent(t.type,t,n));var r=this._clickToSetFocusPoint(t);r&&r.view.setDOFFocusOnPoint(r.distance)&&this.zr.refresh()}}},$o.prototype._clickToSetFocusPoint=function(t){for(var e=this.renderer,i=e.viewport,n=this.views.length-1;n>=0;n--){var r=this.views[n];if(r.hasDOF()&&r.containPoint(t.offsetX,t.offsetY)){this._picking.scene=r.scene,this._picking.camera=r.camera,e.viewport=r.viewport;var o=this._picking.pick(t.offsetX,t.offsetY,!0);if(o)return o.view=r,o}}e.viewport=i},$o.prototype.onglobalout=function(t){var e=this._hovered;e&&this._dispatchEvent("mouseout",t,{target:e.target})},$o.prototype.pickObject=function(t,e){for(var i=[],n=this.renderer,r=n.viewport,o=0;o=0&&(c.dataIndex=this._lastDataIndex,c.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(h,"mouseout",e)),l=!0):null!=s&&s!==this._lastEventData&&(null!=this._lastEventData&&(c.eventData=this._lastEventData,this.zr.handler.dispatchToElement(h,"mouseout",e)),l=!0),this._lastEventData=s,this._lastDataIndex=o,this._lastSeriesIndex=a),c.eventData=s,c.dataIndex=o,c.seriesIndex=a,(null!=s||parseInt(o,10)>=0&&parseInt(a,10)>=0)&&(this.zr.handler.dispatchToElement(h,t,e),l&&this.zr.handler.dispatchToElement(h,"mouseover",e))},$o.prototype._dispatchToView=function(t,e){for(var i=0;it&&a=0&&(function(t){la(t,"itemStyle"),la(t,"lineStyle"),la(t,"areaStyle"),la(t,"label")}(e),"mapbox"===e.coordinateSystem&&(e.coordinateSystem="mapbox3D",t.mapbox3D=t.mapbox))})),ua(t.xAxis3D),ua(t.yAxis3D),ua(t.zAxis3D),ua(t.grid3D),la(t.geo3D)}));const ca={defaultOption:{viewControl:{projection:"perspective",autoRotate:!1,autoRotateDirection:"cw",autoRotateSpeed:10,autoRotateAfterStill:3,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",distance:150,minDistance:40,maxDistance:400,orthographicSize:150,maxOrthographicSize:400,minOrthographicSize:20,center:[0,0,0],alpha:0,beta:0,minAlpha:-90,maxAlpha:90}},setView:function(t){t=t||{},this.option.viewControl=this.option.viewControl||{},null!=t.alpha&&(this.option.viewControl.alpha=t.alpha),null!=t.beta&&(this.option.viewControl.beta=t.beta),null!=t.distance&&(this.option.viewControl.distance=t.distance),null!=t.center&&(this.option.viewControl.center=t.center)}},da={defaultOption:{postEffect:{enable:!1,bloom:{enable:!0,intensity:.1},depthOfField:{enable:!1,focalRange:20,focalDistance:50,blurRadius:10,fstop:2.8,quality:"medium"},screenSpaceAmbientOcclusion:{enable:!1,radius:2,quality:"medium",intensity:1},screenSpaceReflection:{enable:!1,quality:"medium",maxRoughness:.8},colorCorrection:{enable:!0,exposure:0,brightness:0,contrast:1,saturation:1,lookupTexture:""},edge:{enable:!1},FXAA:{enable:!1}},temporalSuperSampling:{enable:"auto"}}},pa={defaultOption:{light:{main:{shadow:!1,shadowQuality:"high",color:"#fff",intensity:1,alpha:0,beta:0},ambient:{color:"#fff",intensity:.2},ambientCubemap:{texture:null,exposure:1,diffuseIntensity:.5,specularIntensity:.5}}}};var fa=n.ComponentModel.extend({type:"grid3D",dependencies:["xAxis3D","yAxis3D","zAxis3D"],defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",boxWidth:100,boxHeight:100,boxDepth:100,axisPointer:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.8)",width:1},label:{show:!0,formatter:null,margin:8,textStyle:{fontSize:14,color:"#fff",backgroundColor:"rgba(0,0,0,0.5)",padding:3,borderRadius:3}}},axisLine:{show:!0,lineStyle:{color:"#333",width:2,type:"solid"}},axisTick:{show:!0,inside:!1,length:3,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}},light:{main:{alpha:30,beta:40},ambient:{intensity:.4}},viewControl:{alpha:20,beta:40,autoRotate:!1,distance:200,minDistance:40,maxDistance:400}}});n.util.merge(fa.prototype,ca),n.util.merge(fa.prototype,da),n.util.merge(fa.prototype,pa);const ga=fa;function ma(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?(i=t,i.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t;var i}function va(){var t="__ec_inner_"+ya++;return function(e){return e[t]||(e[t]={})}}var ya=Math.round(9*Math.random()),_a={};function xa(t,e,i,n,r){var o={};return function(t,e,i,n,r){i=i||_a;var o,a=e.ecModel,s=a&&a.option.textStyle,l=function(t){for(var e;t&&t!==t.ecModel;){var i=(t.option||_a).rich;if(i){e=e||{};for(var n=wo(i),r=0;r0&&this._notFirst?this.animateTo({alpha:u,beta:h,center:c,distance:o,orthographicSize:a,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(o),this.setAlpha(u),this.setBeta(h),this.setCenter(c),this.setOrthographicSize(a)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){},animateTo:function(t){var e=this.zr,i=this,n={},r={};return null!=t.distance&&(n.distance=this.getDistance(),r.distance=t.distance),null!=t.orthographicSize&&(n.orthographicSize=this.getOrthographicSize(),r.orthographicSize=t.orthographicSize),null!=t.alpha&&(n.alpha=this.getAlpha(),r.alpha=t.alpha),null!=t.beta&&(n.beta=this.getBeta(),r.beta=t.beta),null!=t.center&&(n.center=this.getCenter(),r.center=t.center),this._addAnimator(e.animation.animate(n).when(t.duration||1e3,r).during((function(){null!=n.alpha&&i.setAlpha(n.alpha),null!=n.beta&&i.setBeta(n.beta),null!=n.distance&&i.setDistance(n.distance),null!=n.center&&i.setCenter(n.center),null!=n.orthographicSize&&i.setOrthographicSize(n.orthographicSize),i._needsUpdate=!0}))).start(t.easing||"linear")},stopAllAnimation:function(){for(var t=0;t0},_update:function(t){if(this._rotating){var e=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=e*t/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(t=Math.min(t,50),this._updateDistanceOrSize(t),this._updatePan(t),this._updateRotate(t),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(t){var e=this._rotateVelocity;this._phi=e.y*t/20+this._phi,this._theta=e.x*t/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(e,Math.pow(this.damping,t/16))},_updateDistanceOrSize:function(t){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*t/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*t/20),this._zoomSpeed*=Math.pow(this.damping,t/16)},_setDistance:function(t){this._distance=Math.max(Math.min(t,this.maxDistance),this.minDistance)},_setOrthoSize:function(t){this._orthoSize=Math.max(Math.min(t,this.maxOrthographicSize),this.minOrthographicSize);var e=this.getCamera(),i=this._orthoSize,n=i/this.viewGL.viewport.height*this.viewGL.viewport.width;e.left=-n/2,e.right=n/2,e.top=i/2,e.bottom=-i/2},_updatePan:function(t){var e=this._panVelocity,i=this._distance,n=this.getCamera(),r=n.worldTransform.y,o=n.worldTransform.x;this._center.scaleAndAdd(o,-e.x*i/200).scaleAndAdd(r,-e.y*i/200),this._vectorDamping(e,0)},_updateTransform:function(){var t=this.getCamera(),e=new ye,i=this._theta+Math.PI/2,n=this._phi+Math.PI/2,r=Math.sin(i);e.x=r*Math.cos(n),e.y=-Math.cos(i),e.z=r*Math.sin(n),t.position.copy(this._center).scaleAndAdd(e,this._distance),t.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var t=this.autoRotateAfterStill,e=this;!isNaN(t)&&t>0&&(this._stillTimeout=setTimeout((function(){e._rotating=!0}),1e3*t))},_vectorDamping:function(t,e){var i=t.len();(i*=e)<1e-4&&(i=0),t.normalize().scale(i)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var t=this.getCamera().worldTransform.z,e=Math.asin(t.y),i=Math.atan2(t.x,t.z);this._theta=e,this._phi=-i,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(t){if(!t.target&&!this._isAnimating()){var e=t.offsetX,i=t.offsetY;this.viewGL&&!this.viewGL.containPoint(e,i)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),t.event.targetTouches?1===t.event.targetTouches.length&&(this._mode="rotate"):t.event.button===Ca[this.rotateMouseButton]?this._mode="rotate":t.event.button===Ca[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=t.offsetX,this._mouseY=t.offsetY)}},_mouseMoveHandler:function(t){if(!(t.target&&t.target.__isGLToZRProxy||this._isAnimating())){var e=Aa(this.panSensitivity),i=Aa(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(t.offsetX-this._mouseX)/this.zr.getHeight()*2*i[0],this._rotateVelocity.x=(t.offsetY-this._mouseY)/this.zr.getWidth()*2*i[1]):"pan"===this._mode&&(this._panVelocity.x=(t.offsetX-this._mouseX)/this.zr.getWidth()*e[0]*400,this._panVelocity.y=(-t.offsetY+this._mouseY)/this.zr.getHeight()*e[1]*400),this._mouseX=t.offsetX,this._mouseY=t.offsetY,t.event.preventDefault()}},_mouseWheelHandler:function(t){if(!this._isAnimating()){var e=t.event.wheelDelta||-t.event.detail;this._zoomHandler(t,e)}},_pinchHandler:function(t){this._isAnimating()||(this._zoomHandler(t,t.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(t,e){if(0!==e){var i,n=t.offsetX,r=t.offsetY;this.viewGL&&!this.viewGL.containPoint(n,r)||(i="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(e>0?-1:1)*i*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),t.event.preventDefault())}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(t){this._isRightMouseButtonUsed()&&t.preventDefault()},_addAnimator:function(t){var e=this._animators;return e.push(t),t.done((function(){var i=e.indexOf(t);i>=0&&e.splice(i,1)})),t}});Object.defineProperty(La.prototype,"autoRotate",{get:function(t){return this._autoRotate},set:function(t){this._autoRotate=t,this._rotating=t}});const Ia=La,Da={convertToDynamicArray:function(t){t&&this.resetOffset();var e=this.attributes;for(var i in e)t||!e[i].value?e[i].value=[]:e[i].value=Array.prototype.slice.call(e[i].value);t||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var t=this.attributes;for(var e in t)t[e].value&&t[e].value.length>0?t[e].value=new Float32Array(t[e].value):t[e].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}},Pa={vec2:ft,vec3:Jt,vec4:Ae,mat2:zr,mat2d:Vr,mat3:Ie,mat4:qt,quat:Ne};var Oa=Pa.vec3,ka=[[0,0],[1,1]],Ea=Gi.extend((function(){return{segmentScale:1,dynamic:!0,useNativeLine:!0,attributes:{position:new Gi.Attribute("position","float",3,"POSITION"),positionPrev:new Gi.Attribute("positionPrev","float",3),positionNext:new Gi.Attribute("positionNext","float",3),prevPositionPrev:new Gi.Attribute("prevPositionPrev","float",3),prevPosition:new Gi.Attribute("prevPosition","float",3),prevPositionNext:new Gi.Attribute("prevPositionNext","float",3),offset:new Gi.Attribute("offset","float",1),color:new Gi.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(t){var e=this.attributes;this.vertexCount!==t&&(e.position.init(t),e.color.init(t),this.useNativeLine||(e.positionPrev.init(t),e.positionNext.init(t),e.offset.init(t)),t>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,i,n){return 1/(Oa.dist(t,e)+Oa.dist(i,e)+Oa.dist(n,i)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,i,n){var r=this._getCubicCurveApproxStep(t,e,i,n),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,i,n){var r=this._getCubicCurveApproxStep(t,e,i,n),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(ka)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(ka)},getPolylineVertexCount:function(t){var e;return e="number"==typeof t?t:"number"!=typeof t[0]?t.length:t.length/3,this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;return e="number"==typeof t?t:"number"!=typeof t[0]?t.length:t.length/3,this.useNativeLine?0:2*Math.max(e-1,0)},addCubicCurve:function(t,e,i,n,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=t[2],u=e[0],h=e[1],c=e[2],d=i[0],p=i[1],f=i[2],g=n[0],m=n[1],v=n[2],y=this._getCubicCurveApproxStep(t,e,i,n),_=y*y,x=_*y,b=3*y,w=3*_,S=6*_,T=6*x,M=a-2*u+d,C=s-2*h+p,A=l-2*c+f,L=3*(u-d)-a+g,I=3*(h-p)-s+m,D=3*(c-f)-l+v,P=a,O=s,k=l,E=(u-a)*b+M*w+L*x,N=(h-s)*b+C*w+I*x,R=(c-l)*b+A*w+D*x,z=M*S+L*T,B=C*S+I*T,Z=A*S+D*T,F=L*T,V=I*T,G=D*T,H=0,U=0,W=Math.ceil(1/y),j=new Float32Array(3*(W+1)),X=(j=[],0);for(U=0;U1&&(P=E>0?Math.min(P,g):Math.max(P,g),O=N>0?Math.min(O,m):Math.max(O,m),k=R>0?Math.min(k,v):Math.max(k,v));return this.addPolyline(j,r,o)},addLine:function(t,e,i,n){return this.addPolyline([t,e],i,n)},addPolyline:function(t,e,i,n,r){if(t.length){var o="number"!=typeof t[0];if(null==r&&(r=o?t.length:t.length/3),!(r<2)){null==n&&(n=0),null==i&&(i=1),this._itemVertexOffsets.push(this._vertexOffset);var a,s,l=(o="number"!=typeof t[0])?"number"!=typeof e[0]:e.length/4===r,u=this.attributes.position,h=this.attributes.positionPrev,c=this.attributes.positionNext,d=this.attributes.color,p=this.attributes.offset,f=this.indices,g=this._vertexOffset;i=Math.max(i,.01);for(var m=n;m1&&(u.copy(g,g-1),d.copy(g,g-1),g++):(m0&&(c.set(g-2,a),c.set(g-1,a)),u.set(g,a),u.set(g+1,a),d.set(g,s),d.set(g+1,s),p.set(g,i/2),p.set(g+1,-i/2),g+=2),this.useNativeLine)d.set(g,s),u.set(g,a),g++;else if(m>0){var _=3*this._triangleOffset;(f=this.indices)[_]=g-4,f[_+1]=g-3,f[_+2]=g-2,f[_+3]=g-3,f[_+4]=g-1,f[_+5]=g-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,b=this._vertexOffset+2*r;h.copy(x,x+2),h.copy(x+1,x+3),c.copy(b-1,b-3),c.copy(b-2,b-4)}return this._vertexOffset=g,this._vertexOffset}}},setItemColor:function(t,e){for(var i=this._itemVertexOffsets[t],n=ta&&(r=this._x=0,o+=this._rowHeight+l,this._y=o,this._rowHeight=0),this._x+=e+l,this._rowHeight=Math.max(this._rowHeight,i),o+i+l>s)return null;t.x+=this.offsetX*this.dpr+r,t.y+=this.offsetY*this.dpr+o,this._zr.add(t);var u=[this.offsetX/this.width,this.offsetY/this.height];return[[r/a+u[0],o/s+u[1]],[(r+e)/a+u[0],(o+i)/s+u[1]]]},_fitElement:function(t,e,i){var n=t.getBoundingRect(),r=e/n.width,o=i/n.height;t.x=-n.x*r,t.y=-n.y*o,t.scaleX=r,t.scaleY=o,t.update()}},za.prototype={clear:function(){for(var t=0;t=t)){var r=(i+this._nodeWidth)*this._dpr,o=(n+this._nodeHeight)*this._dpr;try{this._zr.resize({width:r,height:o})}catch(t){this._canvas.width=r,this._canvas.height=o}var a=new Ra(this._zr,i,n,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(a),a}},add:function(t,e,i){if(this._coords[t.id])return this._coords[t.id];var n=this._getCurrentNode().add(t,e,i);if(!n){var r=this._expand();if(!r)return;n=r.add(t,e,i)}return this._coords[t.id]=n,n},getCoordsScale:function(){var t=this._dpr;return[this._nodeWidth/this._canvas.width*t,this._nodeHeight/this._canvas.height*t]},getCoords:function(t){return this._coords[t]},dispose:function(){this._zr.dispose()}};const Ba=za;function Za(){}Za.prototype={constructor:Za,setScene:function(t){this._scene=t,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(t){this._lightRoot=t,this.mainLight=new Jo.DirectionalLight({shadowBias:.005}),this.ambientLight=new Jo.AmbientLight,t.add(this.mainLight),t.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(t){var e=this.mainLight,i=this.ambientLight,n=t.getModel("light"),r=n.getModel("main"),o=n.getModel("ambient");e.intensity=r.get("intensity"),i.intensity=o.get("intensity"),e.color=Jo.parseColor(r.get("color")).slice(0,3),i.color=Jo.parseColor(o.get("color")).slice(0,3);var a=r.get("alpha")||0,s=r.get("beta")||0;e.position.setArray(Jo.directionFromAlphaBeta(a,s)),e.lookAt(Jo.Vector3.ZERO),e.castShadow=r.get("shadow"),e.shadowResolution=Jo.getShadowResolution(r.get("shadowQuality"))},updateAmbientCubemap:function(t,e,i){var n=e.getModel("light.ambientCubemap"),r=n.get("texture");if(r){this._cubemapLightsCache=this._cubemapLightsCache||{};var o=this._cubemapLightsCache[r];if(!o){var a=this;o=this._cubemapLightsCache[r]=Jo.createAmbientCubemap(n.option,t,i,(function(){a._isSkyboxFromAmbientCubemap&&a._skybox.setEnvironmentMap(o.specular.cubemap),i.getZr().refresh()}))}this._lightRoot.add(o.diffuse),this._lightRoot.add(o.specular),this._currentCubemapLights=o}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(t,e,i){var r=e.get("environment"),o=this,a=(o._skybox=o._skybox||new jn,o._skybox);if(r&&"none"!==r)if("auto"===r)if(this._isSkyboxFromAmbientCubemap=!0,this._currentCubemapLights){var s=this._currentCubemapLights.specular.cubemap;a.setEnvironmentMap(s),this._scene&&a.attachScene(this._scene),a.material.set("lod",3)}else this._skybox&&this._skybox.detachScene();else if("object"==typeof r&&r.colorStops||"string"==typeof r&&n.color.parse(r)){this._isSkyboxFromAmbientCubemap=!1;var l=new Jo.Texture2D({anisotropic:8,flipY:!1});a.setEnvironmentMap(l);var u=l.image=document.createElement("canvas");u.width=u.height=16;var h=u.getContext("2d"),c=new n.graphic.Rect({shape:{x:0,y:0,width:16,height:16},style:{fill:r}});n.innerDrawElementOnCanvas(h,c),a.attachScene(this._scene)}else this._isSkyboxFromAmbientCubemap=!1,l=Jo.loadTexture(r,i,{anisotropic:8,flipY:!1}),a.setEnvironmentMap(l),a.attachScene(this._scene);else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var d=e.coordinateSystem;if(this._skybox)if(!d||!d.viewGL||"auto"===r||r.match&&r.match(/.hdr$/))this._skybox.material.undefine("fragment","SRGB_DECODE");else{var p=d.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material[p]("fragment","SRGB_DECODE")}}};const Fa=Za;var Va=Pa.vec3,Ga=Gi.extend((function(){return{segmentScale:1,useNativeLine:!0,attributes:{position:new Gi.Attribute("position","float",3,"POSITION"),normal:new Gi.Attribute("normal","float",3,"NORMAL"),color:new Gi.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setQuadCount:function(t){var e=this.attributes,i=this.getQuadVertexCount()*t,n=this.getQuadTriangleCount()*t;this.vertexCount!==i&&(e.position.init(i),e.normal.init(i),e.color.init(i)),this.triangleCount!==n&&(this.indices=i>65535?new Uint32Array(3*n):new Uint16Array(3*n))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var t=Va.create(),e=Va.create(),i=Va.create(),n=[0,3,1,3,2,1];return function(r,o){var a=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;Va.sub(t,r[1],r[0]),Va.sub(e,r[2],r[1]),Va.cross(i,t,e),Va.normalize(i,i);for(var u=0;u<4;u++)a.set(this._vertexOffset+u,r[u]),l.set(this._vertexOffset+u,o),s.set(this._vertexOffset+u,i);var h=3*this._faceOffset;for(u=0;u<6;u++)this.indices[h+u]=n[u]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});n.util.defaults(Ga.prototype,Da);const Ha=Ga;var Ua=Mr,Wa={x:0,y:2,z:1};function ja(t,e,i){this.rootNode=new Jo.Node;var n=new Jo.Mesh({geometry:new Na({useNativeLine:!1}),material:e,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),r=new Jo.Mesh({geometry:new Ha,material:i,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(r),this.rootNode.add(n),this.faceInfo=t,this.plane=new Jo.Plane,this.linesMesh=n,this.quadsMesh=r}ja.prototype.update=function(t,e,i){var n=t.coordinateSystem,r=[n.getAxis(this.faceInfo[0]),n.getAxis(this.faceInfo[1])],o=this.linesMesh.geometry,a=this.quadsMesh.geometry;o.convertToDynamicArray(!0),a.convertToDynamicArray(!0),this._updateSplitLines(o,r,t,i),this._udpateSplitAreas(a,r,t,i),o.convertToTypedArray(),a.convertToTypedArray();var s=n.getAxis(this.faceInfo[2]);!function(t,e,i,n){var r=[0,0,0],o=n<0?i.getExtentMin():i.getExtentMax();r[Wa[i.dim]]=o,t.position.setArray(r),t.rotation.identity(),e.distance=-Math.abs(o),e.normal.set(0,0,0),"x"===i.dim?(t.rotation.rotateY(n*Math.PI/2),e.normal.x=-n):"z"===i.dim?(t.rotation.rotateX(-n*Math.PI/2),e.normal.y=-n):(n>0&&t.rotation.rotateY(Math.PI),e.normal.z=-n)}(this.rootNode,this.plane,s,this.faceInfo[3])},ja.prototype._updateSplitLines=function(t,e,i,r){var o=r.getDevicePixelRatio();e.forEach((function(r,a){var s=r.model,l=e[1-a].getExtent();if(!r.scale.isBlank()){var u=s.getModel("splitLine",i.getModel("splitLine"));if(u.get("show")){var h=u.getModel("lineStyle"),c=h.get("color"),d=Ua(h.get("opacity"),1),p=Ua(h.get("width"),1);c=n.util.isArray(c)?c:[c];for(var f=r.getTicksCoords({tickModel:u}),g=0,m=0;m65535?new Uint32Array(3*i):new Uint16Array(3*i))},setSpriteAlign:function(t,e,i,n,r){var o,a,s,l;switch(null==i&&(i="left"),null==n&&(n="top"),r=r||0,i){case"left":o=r,s=e[0]+r;break;case"center":case"middle":o=-e[0]/2,s=e[0]/2;break;case"right":o=-e[0]-r,s=-r}switch(n){case"bottom":a=r,l=e[1]+r;break;case"middle":a=-e[1]/2,l=e[1]/2;break;case"top":a=-e[1]-r,l=-r}var u=4*t,h=this.attributes.offset;h.set(u,[o,l]),h.set(u+1,[s,l]),h.set(u+2,[s,a]),h.set(u+3,[o,a])},addSprite:function(t,e,i,n,r,o){var a=this._vertexOffset;this.setSprite(this._vertexOffset/4,t,e,i,n,r,o);for(var s=0;s 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end";var rs=Mr;Jo.Shader.import(ns);var os={x:0,y:2,z:1};const as=n.ComponentView.extend({type:"grid3D",__ecgl__:!0,init:function(t,e){var i=new Jo.Material({shader:Jo.createShader("ecgl.color"),depthMask:!1,transparent:!0}),n=new Jo.Material({shader:Jo.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});i.define("fragment","DOUBLE_SIDED"),i.define("both","VERTEX_COLOR"),this.groupGL=new Jo.Node,this._control=new Ia({zr:e.getZr()}),this._control.init(),this._faces=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]].map((function(t){var e=new Xa(t,n,i);return this.groupGL.add(e.rootNode),e}),this),this._axes=["x","y","z"].map((function(t){var e=new is(t,n);return this.groupGL.add(e.rootNode),e}),this);var r=e.getDevicePixelRatio();this._axisLabelSurface=new Ba({width:256,height:256,devicePixelRatio:r}),this._axisLabelSurface.onupdate=function(){e.getZr().refresh()},this._axisPointerLineMesh=new Jo.Mesh({geometry:new Na({useNativeLine:!1}),material:n,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new Ba({width:128,height:128,devicePixelRatio:r}),this._axisPointerLabelsMesh=new Ja({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new Jo.Node,this._sceneHelper=new Fa,this._sceneHelper.initLight(this._lightRoot)},render:function(t,e,i){this._model=t,this._api=i;var n=t.coordinateSystem;n.viewGL.add(this._lightRoot),t.get("show")?n.viewGL.add(this.groupGL):n.viewGL.remove(this.groupGL);var r=this._control;r.setViewGL(n.viewGL);var o=t.getModel("viewControl");r.setFromViewControlModel(o,0),this._axisLabelSurface.clear(),r.off("update"),t.get("show")&&(this._faces.forEach((function(n){n.update(t,e,i)}),this),this._axes.forEach((function(e){e.update(t,this._axisLabelSurface,i)}),this)),r.on("update",this._onCameraChange.bind(this,t,i),this),this._sceneHelper.setScene(n.viewGL.scene),this._sceneHelper.updateLight(t),n.viewGL.setPostEffect(t.getModel("postEffect"),i),n.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._initMouseHandler(t)},afterRender:function(t,e,i,n){var r=n.renderer;this._sceneHelper.updateAmbientCubemap(r,t,i),this._sceneHelper.updateSkybox(r,t,i)},showAxisPointer:function(t,e,i,n){this._doShowAxisPointer(),this._updateAxisPointer(n.value)},hideAxisPointer:function(t,e,i,n){this._doHideAxisPointer()},_initMouseHandler:function(t){var e=t.coordinateSystem.viewGL;t.get("show")&&t.get("axisPointer.show")?e.on("mousemove",this._updateAxisPointerOnMousePosition,this):e.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(t){if(!t.target){for(var e,i=this._model.coordinateSystem,n=i.viewGL,r=n.castRay(t.offsetX,t.offsetY,new Jo.Ray),o=0;on[1]?0:1,a=this._faces[2*i+o],s=this._faces[2*i+1-o];a.rootNode.invisible=!0,s.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var t=this._model.coordinateSystem,e=t.getAxis("x"),i=t.getAxis("y"),n=t.getAxis("z"),r=n.getExtentMax(),o=n.getExtentMin(),a=e.getExtentMin(),s=e.getExtentMax(),l=i.getExtentMax(),u=i.getExtentMin(),h=this._axes[0].rootNode,c=this._axes[1].rootNode,d=this._axes[2].rootNode,p=this._faces,f=p[4].rootNode.invisible?u:l,g=p[2].rootNode.invisible?r:o,m=p[0].rootNode.invisible?a:s,v=p[2].rootNode.invisible?r:o,y=p[0].rootNode.invisible?s:a,_=p[4].rootNode.invisible?u:l;h.rotation.identity(),c.rotation.identity(),d.rotation.identity(),p[4].rootNode.invisible&&(this._axes[0].flipped=!0,h.rotation.rotateX(Math.PI)),p[0].rootNode.invisible&&(this._axes[1].flipped=!0,c.rotation.rotateZ(Math.PI)),p[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),h.position.set(0,g,f),c.position.set(m,v,0),d.position.set(y,0,_),h.update(),c.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var t=this._control.getCamera(),e=[new Jo.Vector4,new Jo.Vector4],i=new Jo.Vector4;this.groupGL.getWorldPosition(i),i.w=1,i.transformMat4(t.viewMatrix).transformMat4(t.projectionMatrix),i.x/=i.w,i.y/=i.w,this._axes.forEach((function(n){for(var r=n.axisLineCoords,o=(n.labelsMesh.geometry,0);oi.y?"bottom":"top"):(s="middle",a=h>i.x?"left":"right"),n.setSpriteAlign(a,s,this._api)}),this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(t){var e=this._model.coordinateSystem,i=e.dataToPoint(t),n=this._axisPointerLineMesh.geometry,r=this._model.getModel("axisPointer"),o=this._api.getDevicePixelRatio();function a(t){return Mr(t.model.get("axisPointer.show"),r.get("show"))}function s(t){var e=t.model.getModel("axisPointer",r).getModel("lineStyle"),i=Jo.parseColor(e.get("color")),n=rs(e.get("width"),1),o=rs(e.get("opacity"),1);return i[3]*=o,{color:i,lineWidth:n}}n.convertToDynamicArray(!0);for(var l=0;lf&&(f=_,gf&&(f=x,v=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,i,n){if(n){if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],o=n[3],a=n[4],s=n[5];return e.x=i.x*r+a,e.y=i.y*o+s,e.width=i.width*r,e.height=i.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}ms.x=ys.x=i.x,ms.y=_s.y=i.y,vs.x=_s.x=i.x+i.width,vs.y=ys.y=i.y+i.height,ms.transform(n),_s.transform(n),vs.transform(n),ys.transform(n),e.x=fs(ms.x,vs.x,ys.x,_s.x),e.y=fs(ms.y,vs.y,ys.y,_s.y);var l=gs(ms.x,vs.x,ys.x,_s.x),u=gs(ms.y,vs.y,ys.y,_s.y);e.width=l-e.x,e.height=u-e.y}else e!==i&&t.copy(e,i)},t}();function Ss(t,e,i,n,r){var o=0,a=0;null==n&&(n=1/0),null==r&&(r=1/0);var s=0;e.eachChild((function(l,u){var h,c,d=l.getBoundingRect(),p=e.childAt(u+1),f=p&&p.getBoundingRect();if("horizontal"===t){var g=d.width+(f?-f.x+d.x:0);(h=o+g)>n||l.newline?(o=0,h=g,a+=s+i,s=d.height):s=Math.max(s,d.height)}else{var m=d.height+(f?-f.y+d.y:0);(c=a+m)>r||l.newline?(o+=s+i,a=0,c=m,s=d.width):s=Math.max(s,d.width)}l.newline||(l.x=o,l.y=a,l.markRedraw(),"horizontal"===t?o=h+i:a=c+i)}))}function Ts(t,e,i){i=function(t){if("number"==typeof t)return[t,t,t,t];var e=t.length;return 2===e?[t[0],t[1],t[0],t[1]]:3===e?[t[0],t[1],t[2],t[1]]:t}(i||0);var n=e.width,r=e.height,o=ma(t.left,n),a=ma(t.top,r),s=ma(t.right,n),l=ma(t.bottom,r),u=ma(t.width,n),h=ma(t.height,r),c=i[2]+i[0],d=i[1]+i[3],p=t.aspect;switch(isNaN(u)&&(u=n-s-d-o),isNaN(h)&&(h=r-l-c-a),null!=p&&(isNaN(u)&&isNaN(h)&&(p>n/r?u=.8*n:h=.8*r),isNaN(u)&&(u=p*h),isNaN(h)&&(h=u/p)),isNaN(o)&&(o=n-s-u-d),isNaN(a)&&(a=r-l-h-c),t.left||t.right){case"center":o=n/2-u/2-i[3];break;case"right":o=n-u-d}switch(t.top||t.bottom){case"middle":case"center":a=r/2-h/2-i[0];break;case"bottom":a=r-h-c}o=o||0,a=a||0,isNaN(u)&&(u=n-d-o-(s||0)),isNaN(h)&&(h=r-c-a-(l||0));var f=new ws(o+i[3],a+i[0],u,h);return f.margin=i,f}So(Ss,"vertical"),So(Ss,"horizontal");var Ms=function(){this._pool={},this._allocatedTextures=[]};Ms.prototype={constructor:Ms,get:function(t){var e=Ls(t);this._pool.hasOwnProperty(e)||(this._pool[e]=[]);var i=this._pool[e];if(!i.length){var n=new Ii(t);return this._allocatedTextures.push(n),n}return i.pop()},put:function(t){var e=Ls(t);this._pool.hasOwnProperty(e)||(this._pool[e]=[]),this._pool[e].push(t)},clear:function(t){for(var e=0;e 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n #endif\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n #else\n depth += bias;\n #endif\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n@export clay.sm.debug_depth\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n@import clay.util.decode_float\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n@end\n@export clay.sm.distance.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\nattribute vec3 position : POSITION;\n@import clay.chunk.skinning_header\nvarying vec3 v_WorldPosition;\nvoid main (){\n vec4 P = vec4(position, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n gl_Position = worldViewProjection * P;\n v_WorldPosition = (world * P).xyz;\n}\n@end\n@export clay.sm.distance.fragment\nuniform vec3 lightPosition;\nuniform float range : 100;\nvarying vec3 v_WorldPosition;\n@import clay.util.encode_float\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n@export clay.plugin.shadow_map_common\n@import clay.util.decode_float\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n return shadowContrib / 9.0;\n#endif\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n@end\n@export clay.plugin.compute_shadow_map\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#endif\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\nuniform bool shadowEnabled : true;\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n@import clay.plugin.shadow_map_common\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n#ifdef SHADOW_CASCADE\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n float shadowContrib;\n shadowContribs[0] = 1.0;\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#else\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n@end");var ks,Es,Ns,Rs,zs,Bs,Zs,Fs=g.extend((function(){return{softShadow:Fs.PCF,shadowBlur:1,lightFrustumBias:"auto",kernelPCF:new Float32Array([1,0,1,1,-1,1,0,1,-1,0,-1,-1,1,-1,0,-1]),precision:"highp",_lastRenderNotCastShadow:!1,_frameBuffer:new Zn,_textures:{},_shadowMapNumber:{POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},_depthMaterials:{},_distanceMaterials:{},_receivers:[],_lightsCastShadow:[],_lightCameras:{},_lightMaterials:{},_texturePool:new Is}}),(function(){this._gaussianPassH=new fr({fragment:jt.source("clay.compositor.gaussian_blur")}),this._gaussianPassV=new fr({fragment:jt.source("clay.compositor.gaussian_blur")}),this._gaussianPassH.setUniform("blurSize",this.shadowBlur),this._gaussianPassH.setUniform("blurDir",0),this._gaussianPassV.setUniform("blurSize",this.shadowBlur),this._gaussianPassV.setUniform("blurDir",1),this._outputDepthPass=new fr({fragment:jt.source("clay.sm.debug_depth")})}),{render:function(t,e,i,n){i||(i=e.getMainCamera()),this.trigger("beforerender",this,t,e,i),this._renderShadowPass(t,e,i,n),this.trigger("afterrender",this,t,e,i)},renderDebug:function(t,e){t.saveClear();var i=t.viewport,n=0,r=e||i.width/4,o=r;for(var a in this.softShadow===Fs.VSM?this._outputDepthPass.material.define("fragment","USE_VSM"):this._outputDepthPass.material.undefine("fragment","USE_VSM"),this._textures){var s=this._textures[a];t.setViewport(n,0,r*s.width/s.height,o),this._outputDepthPass.setUniform("depthMap",s),this._outputDepthPass.render(t),n+=r*s.width/s.height}t.setViewport(i),t.restoreClear()},_updateReceivers:function(t,e){if(e.receiveShadow?(this._receivers.push(e),e.material.set("shadowEnabled",1),e.material.set("pcfKernel",this.kernelPCF)):e.material.set("shadowEnabled",0),this.softShadow===Fs.VSM)e.material.define("fragment","USE_VSM"),e.material.undefine("fragment","PCF_KERNEL_SIZE");else{e.material.undefine("fragment","USE_VSM");var i=this.kernelPCF;i&&i.length?e.material.define("fragment","PCF_KERNEL_SIZE",i.length/2):e.material.undefine("fragment","PCF_KERNEL_SIZE")}},_update:function(t,e){var i=this;e.traverse((function(e){e.isRenderable()&&i._updateReceivers(t,e)}));for(var n=0;n4){console.warn("Support at most 4 cascade");continue}f.shadowCascade>1&&(a=f),this.renderDirectionalLightShadow(t,e,i,f,c,h,u)}else"SPOT_LIGHT"===f.type?this.renderSpotLightShadow(t,e,f,l,s):"POINT_LIGHT"===f.type&&this.renderPointLightShadow(t,e,f,d);this._shadowMapNumber[f.type]++}for(var g in this._shadowMapNumber){var m=this._shadowMapNumber[g],v=g+"_SHADOWMAP_COUNT";for(p=0;p0?y.define("fragment",v,m):y.isDefined("fragment",v)&&y.undefine("fragment",v))}for(p=0;p0){var x=u.map(T);if(_.directionalLightShadowMaps={value:u,type:"tv"},_.directionalLightMatrices={value:h,type:"m4v"},_.directionalLightShadowMapSizes={value:x,type:"1fv"},a){var b=c.slice(),w=c.slice();b.pop(),w.shift(),b.reverse(),w.reverse(),h.reverse(),_.shadowCascadeClipsNear={value:b,type:"1fv"},_.shadowCascadeClipsFar={value:w,type:"1fv"}}}if(s.length>0){var S=s.map(T);(_=e.shadowUniforms).spotLightShadowMaps={value:s,type:"tv"},_.spotLightMatrices={value:l,type:"m4v"},_.spotLightShadowMapSizes={value:S,type:"1fv"}}d.length>0&&(_.pointLightShadowMaps={value:d,type:"tv"})}function T(t){return t.height}},renderDirectionalLightShadow:(ks=new ln,Es=new He,Ns=new ni,Rs=new He,zs=new He,Bs=new He,Zs=new He,function(t,e,i,n,r,o,a){var s=this._getDepthMaterial(n),l={getMaterial:function(t){return t.shadowDepthMaterial||s},isMaterialChanged:Os,getUniform:Ps,ifRender:function(t){return t.castShadow},sortCompare:he.opaqueSortCompare};if(!e.viewBoundingBoxLastFrame.isFinite()){var u=e.getBoundingBox();e.viewBoundingBoxLastFrame.copy(u).applyTransform(i.viewMatrix)}var h=Math.min(-e.viewBoundingBoxLastFrame.min.z,i.far),c=Math.max(-e.viewBoundingBoxLastFrame.max.z,i.near),d=this._getDirectionalLightCamera(n,e,i),p=Bs.array;Zs.copy(d.projectionMatrix),qt.invert(zs.array,d.worldTransform.array),qt.multiply(zs.array,zs.array,i.worldTransform.array),qt.multiply(p,Zs.array,zs.array);for(var f=[],g=i instanceof Ln,m=(i.near+i.far)/(i.near-i.far),v=2*i.near*i.far/(i.near-i.far),y=0;y<=n.shadowCascade;y++){var _=c*Math.pow(h/c,y/n.shadowCascade),x=c+(h-c)*y/n.shadowCascade,b=_*n.cascadeSplitLogFactor+x*(1-n.cascadeSplitLogFactor);f.push(b),r.push(-(-b*m+v)/-b)}var w=this._getTexture(n,n.shadowCascade);a.push(w);var S=t.viewport,T=t.gl;for(this._frameBuffer.attach(w),this._frameBuffer.bind(t),T.clear(T.COLOR_BUFFER_BIT|T.DEPTH_BUFFER_BIT),y=0;yd?s>p?f[r>0?"px":"nx"]=!0:f[a>0?"pz":"nz"]=!0:d>p?f[o>0?"py":"ny"]=!0:f[a>0?"pz":"nz"]=!0}for(i=0;i0&&(this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t]))}}),Hs=g.extend((function(){return{nodes:[]}}),{dirty:function(){this._dirty=!0},addNode:function(t){this.nodes.indexOf(t)>=0||(this.nodes.push(t),this._dirty=!0)},removeNode:function(t){"string"==typeof t&&(t=this.getNodeByName(t));var e=this.nodes.indexOf(t);e>=0&&(this.nodes.splice(e,1),this._dirty=!0)},getNodeByName:function(t){for(var e=0;e=i.COLOR_ATTACHMENT0&&h<=i.COLOR_ATTACHMENT0+8&&u.push(h);l.drawBuffersEXT(u)}t.saveClear(),t.clearBit=16640,e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),t.restoreClear(),n.unbind(t)}else e=t.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",e),this._rendering=!1,this._rendered=!0}}),js=Gs.extend((function(){return{texture:null,outputs:{color:{}}}}),(function(){}),{getOutput:function(t,e){return this.texture},beforeFrame:function(){},afterFrame:function(){}}),Xs=Gs.extend((function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}}),(function(){var t=new fr({fragment:this.shader});this.pass=t}),{render:function(t,e){this.trigger("beforerender",t),this._rendering=!0;var i=t.gl;for(var n in this.inputLinks){var r=(c=this.inputLinks[n]).node.getOutput(t,c.pin);this.pass.setUniform(n,r)}if(this.outputs){this.pass.outputs={};var o={};for(var a in this.outputs){var s=this.updateParameter(a,t);isNaN(s.width)&&this.updateParameter(a,t);var l=this.outputs[a],u=this._compositor.allocateTexture(s);this._outputTextures[a]=u,"string"==typeof(h=l.attachment||i.COLOR_ATTACHMENT0)&&(h=i[h]),o[h]=u}for(var h in this._compositor.getFrameBuffer().bind(t),o)this._compositor.getFrameBuffer().attach(o[h],h);this.pass.render(t),this._compositor.getFrameBuffer().updateMipmap(t)}else this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(t),this.pass.render(t,e);for(var n in this.inputLinks){var c;(c=this.inputLinks[n]).node.removeReference(c.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",t)},updateParameter:function(t,e){var i,n,r=this.outputs[t],o=r.parameters,a=r._parametersCopy;if(a||(a=r._parametersCopy={}),o)for(var s in o)"width"!==s&&"height"!==s&&(a[s]=o[s]);return i="function"==typeof o.width?o.width.call(this,e):o.width,n="function"==typeof o.height?o.height.call(this,e):o.height,i=Math.ceil(i),n=Math.ceil(n),a.width===i&&a.height===n||this._outputTextures[t]&&this._outputTextures[t].dispose(e),a.width=i,a.height=n,a},setParameter:function(t,e){this.pass.setUniform(t,e)},getParameter:function(t){return this.pass.getUniform(t)},setParameters:function(t){for(var e in t)this.setParameter(e,t[e])},define:function(t,e){this.pass.material.define("fragment",t,e)},undefine:function(t){this.pass.material.undefine("fragment",t)},removeReference:function(t){this._outputReferences[t]--,0===this._outputReferences[t]&&(this.outputs[t].keepLastFrame?(this._prevOutputTextures[t]&&this._compositor.releaseTexture(this._prevOutputTextures[t]),this._prevOutputTextures[t]=this._outputTextures[t]):this._compositor.releaseTexture(this._outputTextures[t]))},clear:function(){Gs.prototype.clear.call(this),this.pass.material.disableTexturesAll()}}),Ys="@export clay.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n@export clay.compositor.kernel.gaussian_13\nfloat gaussianKernel[13];\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n@end\n@export clay.compositor.gaussian_blur\n#define SHADER_NAME gaussian_blur\nuniform sampler2D texture;varying vec2 v_Texcoord;\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main (void)\n{\n @import clay.compositor.kernel.gaussian_9\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n@end\n",qs="\n@export clay.compositor.lut\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform sampler2D lookup;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n float blueColor = tex.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n@end",Ks="@export clay.compositor.output\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = tex.rgb;\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n gl_FragColor = encodeHDR(gl_FragColor);\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",Js="@export clay.compositor.bright\nuniform sampler2D texture;\nuniform float threshold : 1;\nuniform float scale : 1.0;\nuniform vec2 textureSize: [512, 512];\nvarying vec2 v_Texcoord;\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n#endif\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n gl_FragColor = encodeHDR(color);\n}\n@end\n",Qs="@export clay.compositor.downsample\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n@import clay.util.clamp_sample\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n gl_FragColor = encodeHDR(color);\n}\n@end",$s="\n@export clay.compositor.upsample\n#define HIGH_QUALITY\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nuniform float sampleScale: 0.5;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main()\n{\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n@end",tl="@export clay.compositor.hdr.composite\n#define TONEMAPPING\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\nvarying vec2 v_Texcoord;\n@import clay.util.srgb\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n texel.a = min(texel.a, 1.0);\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n#ifdef TONEMAPPING\n texel.rgb *= exposureBias;\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n texel = linearTosRGB(texel);\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n gl_FragColor = encodeHDR(texel);\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",el="@export clay.compositor.blend\n#define SHADER_NAME blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n gl_FragColor = encodeHDR(tex);\n}\n@end",il="@export clay.compositor.fxaa\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\nvarying vec2 v_Texcoord;\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n@import clay.util.rgbm\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n float lumaB = dot( rgbB, luma );\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n }\n else {\n gl_FragColor = vec4( rgbB, opacity );\n }\n}\n@end";!function(t){t.import("@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end"),t.import(Ys),t.import("@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end"),t.import(qs),t.import("@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end"),t.import(Ks),t.import(Js),t.import(Qs),t.import($s),t.import(tl),t.import("@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end"),t.import(el),t.import(il)}(jt);var nl=/^#source\((.*?)\)/;function rl(t,e,i){var n,r,o,a,s=t.type||"filter";if("filter"===s){var l=t.shader.trim(),u=nl.exec(l);if(u?n=jt.source(u[1].trim()):"#"===l.charAt(0)&&(n=e.shaders[l.substr(1)]),n||(n=l),!n)return}if(t.inputs)for(var h in r={},t.inputs)"string"==typeof t.inputs[h]?r[h]=t.inputs[h]:r[h]={node:t.inputs[h].node,pin:t.inputs[h].pin};if(t.outputs)for(var h in o={},t.outputs){var c=t.outputs[h];o[h]={},null!=c.attachment&&(o[h].attachment=c.attachment),null!=c.keepLastFrame&&(o[h].keepLastFrame=c.keepLastFrame),null!=c.outputLastFrame&&(o[h].outputLastFrame=c.outputLastFrame),c.parameters&&(o[h].parameters=sl(c.parameters))}if(a="scene"===s?new Ws({name:t.name,scene:i.scene,camera:i.camera,outputs:o}):"texture"===s?new js({name:t.name,outputs:o}):new Xs({name:t.name,shader:n,inputs:r,outputs:o})){if(t.parameters)for(var h in t.parameters)"string"==typeof(d=t.parameters[h])?"#"===(d=d.trim()).charAt(0)?d=e.textures[d.substr(1)]:a.on("beforerender",ll(h,ul(d))):"function"==typeof d&&a.on("beforerender",d),a.setParameter(h,d);if(t.defines&&a.pass)for(var h in t.defines){var d=t.defines[h];a.pass.material.define("fragment",h,d)}}return a}function ol(t,e){return t}function al(t,e){return e}function sl(t){var e={};if(!t)return e;["type","minFilter","magFilter","wrapS","wrapT","flipY","useMipmap"].forEach((function(i){var n=t[i];null!=n&&("string"==typeof n&&(n=wi[n]),e[i]=n)}));var i=t.scale||1;return["width","height"].forEach((function(n){if(null!=t[n]){var r=t[n];"string"==typeof r?(r=r.trim(),e[n]=(o=ul(r),a=(a=i)||1,function(t){var e=t.getDevicePixelRatio(),i=t.getWidth()*a,n=t.getHeight()*a;return o(i,n,e)})):e[n]=r}var o,a})),e.width||(e.width=ol),e.height||(e.height=al),null!=t.useMipmap&&(e.useMipmap=t.useMipmap),e}function ll(t,e){return function(i){var n=i.getDevicePixelRatio(),r=i.getWidth(),o=i.getHeight(),a=e(r,o,n);this.setParameter(t,a)}}function ul(t){var e=/^expr\((.*)\)$/.exec(t);if(e)try{var i=new Function("width","height","dpr","return "+e[1]);return i(1,1),i}catch(t){throw new Error("Invalid expression.")}}const hl=function(t,e){for(var i=0,n=1/e,r=t;r>0;)i+=n*(r%e),r=Math.floor(r/e),n/=e;return i};function cl(t){for(var e=new Uint8Array(t*t*4),i=0,n=new ye,r=0;r 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n#define SHADER_NAME SSAO_BLUR\n\nuniform sampler2D ssaoTexture;\n\n#ifdef NORMALTEX_ENABLED\nuniform sampler2D normalTex;\n#endif\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\nuniform int direction: 0.0;\n\n#ifdef DEPTHTEX_ENABLED\nuniform sampler2D depthTex;\nuniform mat4 projection;\nuniform float depthRange : 0.5;\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n#endif\n\nvoid main()\n{\n float kernel[5];\n kernel[0] = 0.122581;\n kernel[1] = 0.233062;\n kernel[2] = 0.288713;\n kernel[3] = 0.233062;\n kernel[4] = 0.122581;\n\n vec2 off = vec2(0.0);\n if (direction == 0) {\n off[0] = blurSize / textureSize.x;\n }\n else {\n off[1] = blurSize / textureSize.y;\n }\n\n vec2 coord = v_Texcoord;\n\n float sum = 0.0;\n float weightAll = 0.0;\n\n#ifdef NORMALTEX_ENABLED\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\n#endif\n#if defined(DEPTHTEX_ENABLED)\n float centerDepth = getLinearDepth(v_Texcoord);\n#endif\n\n for (int i = 0; i < 5; i++) {\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\n\n float w = kernel[i];\n#ifdef NORMALTEX_ENABLED\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\n#endif\n#ifdef DEPTHTEX_ENABLED\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\n#endif\n\n weightAll += w;\n sum += texture2D(ssaoTexture, coord).r * w;\n }\n\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\n}\n\n@end\n"),fl.prototype.setDepthTexture=function(t){this._depthTex=t},fl.prototype.setNormalTexture=function(t){this._normalTex=t,this._ssaoPass.material[t?"enableTexture":"disableTexture"]("normalTex"),this.setKernelSize(this._kernelSize)},fl.prototype.update=function(t,e,i){var n=t.getWidth(),r=t.getHeight(),o=this._ssaoPass,a=this._blurPass;o.setUniform("kernel",this._kernels[i%this._kernels.length]),o.setUniform("depthTex",this._depthTex),null!=this._normalTex&&o.setUniform("normalTex",this._normalTex),o.setUniform("depthTexSize",[this._depthTex.width,this._depthTex.height]);var s=new He;He.transpose(s,e.worldTransform),o.setUniform("projection",e.projectionMatrix.array),o.setUniform("projectionInv",e.invProjectionMatrix.array),o.setUniform("viewInverseTranspose",s.array);var l=this._ssaoTexture,u=this._blurTexture,h=this._blurTexture2;l.width=n/2,l.height=r/2,u.width=n,u.height=r,h.width=n,h.height=r,this._framebuffer.attach(l),this._framebuffer.bind(t),t.gl.clearColor(1,1,1,1),t.gl.clear(t.gl.COLOR_BUFFER_BIT),o.render(t),a.setUniform("textureSize",[n/2,r/2]),a.setUniform("projection",e.projectionMatrix.array),this._framebuffer.attach(u),a.setUniform("direction",0),a.setUniform("ssaoTexture",l),a.render(t),this._framebuffer.attach(h),a.setUniform("textureSize",[n,r]),a.setUniform("direction",1),a.setUniform("ssaoTexture",u),a.render(t),this._framebuffer.unbind(t);var c=t.clearColor;t.gl.clearColor(c[0],c[1],c[2],c[3])},fl.prototype.getTargetTexture=function(){return this._blurTexture2},fl.prototype.setParameter=function(t,e){"noiseTexSize"===t?this.setNoiseSize(e):"kernelSize"===t?this.setKernelSize(e):"intensity"===t?this._ssaoPass.material.set("intensity",e):this._ssaoPass.setUniform(t,e)},fl.prototype.setKernelSize=function(t){this._kernelSize=t,this._ssaoPass.material.define("fragment","KERNEL_SIZE",t),this._kernels=this._kernels||[];for(var e=0;e<30;e++)this._kernels[e]=pl(t,e*t,!!this._normalTex)},fl.prototype.setNoiseSize=function(t){var e=this._ssaoPass.getUniform("noiseTex");e?(e.data=cl(t),e.width=e.height=t,e.dirty()):(e=dl(t),this._ssaoPass.setUniform("noiseTex",dl(t))),this._ssaoPass.setUniform("noiseTexSize",[t,t])},fl.prototype.dispose=function(t){this._blurTexture.dispose(t),this._ssaoTexture.dispose(t),this._blurTexture2.dispose(t)};const gl=fl;function ml(t){t=t||{},this._ssrPass=new fr({fragment:jt.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new fr({fragment:jt.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new fr({fragment:jt.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blendPass=new fr({fragment:jt.source("clay.compositor.blend")}),this._blendPass.material.disableTexturesAll(),this._blendPass.material.enableTexture(["texture1","texture2"]),this._ssrPass.setUniform("gBufferTexture1",t.normalTexture),this._ssrPass.setUniform("gBufferTexture2",t.depthTexture),this._blurPass1.setUniform("gBufferTexture1",t.normalTexture),this._blurPass1.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.setUniform("gBufferTexture1",t.normalTexture),this._blurPass2.setUniform("gBufferTexture2",t.depthTexture),this._blurPass2.material.define("fragment","VERTICAL"),this._blurPass2.material.define("fragment","BLEND"),this._ssrTexture=new Ii({type:wi.HALF_FLOAT}),this._texture2=new Ii({type:wi.HALF_FLOAT}),this._texture3=new Ii({type:wi.HALF_FLOAT}),this._prevTexture=new Ii({type:wi.HALF_FLOAT}),this._currentTexture=new Ii({type:wi.HALF_FLOAT}),this._frameBuffer=new Zn({depthBuffer:!1}),this._normalDistribution=null,this._totalSamples=256,this._samplePerFrame=4,this._ssrPass.material.define("fragment","SAMPLE_PER_FRAME",this._samplePerFrame),this._ssrPass.material.define("fragment","TOTAL_SAMPLES",this._totalSamples),this._downScale=1}jt.import("@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"),ml.prototype.setAmbientCubemap=function(t,e){this._ssrPass.material.set("specularCubemap",t),this._ssrPass.material.set("specularIntensity",e);var i=t&&e;this._ssrPass.material[i?"enableTexture":"disableTexture"]("specularCubemap")},ml.prototype.update=function(t,e,i,n){var r=t.getWidth(),o=t.getHeight(),a=this._ssrTexture,s=this._texture2,l=this._texture3;a.width=this._prevTexture.width=this._currentTexture.width=r/this._downScale,a.height=this._prevTexture.height=this._currentTexture.height=o/this._downScale,s.width=l.width=r,s.height=l.height=o;var u=this._frameBuffer,h=this._ssrPass,c=this._blurPass1,d=this._blurPass2,p=this._blendPass,f=new He,g=new He;He.transpose(f,e.worldTransform),He.transpose(g,e.viewMatrix),h.setUniform("sourceTexture",i),h.setUniform("projection",e.projectionMatrix.array),h.setUniform("projectionInv",e.invProjectionMatrix.array),h.setUniform("toViewSpace",f.array),h.setUniform("toWorldSpace",g.array),h.setUniform("nearZ",e.near);var m=n/this._totalSamples*this._samplePerFrame;if(h.setUniform("jitterOffset",m),h.setUniform("sampleOffset",n*this._samplePerFrame),c.setUniform("textureSize",[a.width,a.height]),d.setUniform("textureSize",[r,o]),d.setUniform("sourceTexture",i),c.setUniform("projection",e.projectionMatrix.array),d.setUniform("projection",e.projectionMatrix.array),u.attach(a),u.bind(t),h.render(t),this._physicallyCorrect&&(u.attach(this._currentTexture),p.setUniform("texture1",this._prevTexture),p.setUniform("texture2",a),p.material.set({weight1:n>=1?.95:0,weight2:n>=1?.05:1}),p.render(t)),u.attach(s),c.setUniform("texture",this._physicallyCorrect?this._currentTexture:a),c.render(t),u.attach(l),d.setUniform("texture",s),d.render(t),u.unbind(t),this._physicallyCorrect){var v=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=v}},ml.prototype.getTargetTexture=function(){return this._texture3},ml.prototype.setParameter=function(t,e){"maxIteration"===t?this._ssrPass.material.define("fragment","MAX_ITERATION",e):this._ssrPass.setUniform(t,e)},ml.prototype.setPhysicallyCorrect=function(t){t?(this._normalDistribution||(this._normalDistribution=vr.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=t},ml.prototype.setSSAOTexture=function(t){var e=this._blurPass2;t?(e.material.enableTexture("ssaoTex"),e.material.set("ssaoTex",t)):e.material.disableTexture("ssaoTex")},ml.prototype.isFinished=function(t){return!this._physicallyCorrect||t>this._totalSamples/this._samplePerFrame},ml.prototype.dispose=function(t){this._ssrTexture.dispose(t),this._texture2.dispose(t),this._texture3.dispose(t),this._prevTexture.dispose(t),this._currentTexture.dispose(t),this._frameBuffer.dispose(t)};const vl=ml,yl=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925];function _l(t,e,i,n,r){var o=t.gl;e.setUniform(o,"1i",i,r),o.activeTexture(o.TEXTURE0+r),n.isRenderable()?n.bind(t):n.unbind(t)}function xl(t,e,i,n,r){var o,a,s,l,u=t.gl;return function(r,h,c){if(!l||l.material!==r.material){var d=r.material,p=r.__program,f=d.get("roughness");null==f&&(f=1);var g=d.get("normalMap")||e,m=d.get("roughnessMap"),v=d.get("bumpMap"),y=d.get("uvRepeat"),_=d.get("uvOffset"),x=d.get("detailUvRepeat"),b=d.get("detailUvOffset"),w=!!v&&d.isTextureEnabled("bumpMap"),S=!!m&&d.isTextureEnabled("roughnessMap"),T=d.isDefined("fragment","DOUBLE_SIDED");v=v||i,m=m||n,c!==h?(h.set("normalMap",g),h.set("bumpMap",v),h.set("roughnessMap",m),h.set("useBumpMap",w),h.set("useRoughnessMap",S),h.set("doubleSide",T),null!=y&&h.set("uvRepeat",y),null!=_&&h.set("uvOffset",_),null!=x&&h.set("detailUvRepeat",x),null!=b&&h.set("detailUvOffset",b),h.set("roughness",f)):(p.setUniform(u,"1f","roughness",f),o!==g&&_l(t,p,"normalMap",g,0),a!==v&&v&&_l(t,p,"bumpMap",v,1),s!==m&&m&&_l(t,p,"roughnessMap",m,2),null!=y&&p.setUniform(u,"2f","uvRepeat",y),null!=_&&p.setUniform(u,"2f","uvOffset",_),null!=x&&p.setUniform(u,"2f","detailUvRepeat",x),null!=b&&p.setUniform(u,"2f","detailUvOffset",b),p.setUniform(u,"1i","useBumpMap",+w),p.setUniform(u,"1i","useRoughnessMap",+S),p.setUniform(u,"1i","doubleSide",+T)),o=g,a=v,s=m,l=r}}}function bl(t){t=t||{},this._depthTex=new Ii({format:wi.DEPTH_COMPONENT,type:wi.UNSIGNED_INT}),this._normalTex=new Ii({type:wi.HALF_FLOAT}),this._framebuffer=new Zn,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,Zn.DEPTH_ATTACHMENT),this._normalMaterial=new lt({shader:new jt(jt.source("ecgl.normal.vertex"),jt.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=or.createBlank("#000"),this._defaultBumpMap=or.createBlank("#000"),this._defaultRoughessMap=or.createBlank("#000"),this._debugPass=new fr({fragment:jt.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}jt.import("@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"),bl.prototype.getDepthTexture=function(){return this._depthTex},bl.prototype.getNormalTexture=function(){return this._normalTex},bl.prototype.update=function(t,e,i){var n=t.getWidth(),r=t.getHeight(),o=this._depthTex,a=this._normalTex,s=this._normalMaterial;o.width=n,o.height=r,a.width=n,a.height=r;var l=e.getRenderList(i).opaque;this._framebuffer.bind(t),t.gl.clearColor(0,0,0,0),t.gl.clear(t.gl.COLOR_BUFFER_BIT|t.gl.DEPTH_BUFFER_BIT),t.gl.disable(t.gl.BLEND),t.renderPass(l,i,{getMaterial:function(){return s},ifRender:function(t){return t.renderNormal},beforeRender:xl(t,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:t.opaqueSortCompare}),this._framebuffer.unbind(t)},bl.prototype.renderDebug=function(t){this._debugPass.render(t)},bl.prototype.dispose=function(t){this._depthTex.dispose(t),this._normalTex.dispose(t)};const wl=bl;function Sl(t){t=t||{},this._edgePass=new fr({fragment:jt.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",t.normalTexture),this._edgePass.setUniform("depthTexture",t.depthTexture),this._targetTexture=new Ii({type:wi.HALF_FLOAT}),this._frameBuffer=new Zn,this._frameBuffer.attach(this._targetTexture)}Sl.prototype.update=function(t,e,i,n){var r=t.getWidth(),o=t.getHeight(),a=this._targetTexture;a.width=r,a.height=o;var s=this._frameBuffer;s.bind(t),this._edgePass.setUniform("projectionInv",e.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[r,o]),this._edgePass.setUniform("texture",i),this._edgePass.render(t),s.unbind(t)},Sl.prototype.getTargetTexture=function(){return this._targetTexture},Sl.prototype.setParameter=function(t,e){this._edgePass.setUniform(t,e)},Sl.prototype.dispose=function(t){this._targetTexture.dispose(t),this._frameBuffer.dispose(t)};const Tl=Sl,Ml={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]};function Cl(t,e){return{color:{parameters:{width:t,height:e}}}}jt.import(Ys),jt.import(qs),jt.import(Ks),jt.import(Js),jt.import(Qs),jt.import($s),jt.import(tl),jt.import(el),jt.import(il),jt.import("@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end"),jt.import("@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end");var Al=["composite","FXAA"];function Ll(){this._width,this._height,this._dpr,this._sourceTexture=new Ii({type:wi.HALF_FLOAT}),this._depthTexture=new Ii({format:wi.DEPTH_COMPONENT,type:wi.UNSIGNED_INT}),this._framebuffer=new Zn,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,Zn.DEPTH_ATTACHMENT),this._normalPass=new wl,this._compositor=function(t,e){var i=new Us;e=e||{};var n={textures:{},parameters:{}};for(var r in t.parameters){var o=t.parameters[r];n.parameters[r]=sl(o)}return function(t,e,i,n){if(t.textures){var r={},o=0,a=!1,s=i.textureRootPath;p.each(t.textures,(function(t,e){var i,l=t.path,u=sl(t.parameters);if(Array.isArray(l)&&6===l.length)s&&(l=l.map((function(t){return p.relative2absolute(t,s)}))),i=new An(u);else{if("string"!=typeof l)return;s&&(l=p.relative2absolute(l,s)),i=new Ii(u)}i.load(l),o++,i.once("success",(function(){r[e]=i,0==--o&&(n(r),a=!0)}))})),0!==o||a||n(r)}else n({})}(t,0,e,(function(r){n.textures=r,function(r,o){for(var a=0;a=this._haltonSequence.length},render:function(t,e,i){var n=this._blendPass;0===this._frame?(n.setUniform("weight1",0),n.setUniform("weight2",1)):(n.setUniform("weight1",.9),n.setUniform("weight2",.1)),n.setUniform("texture1",this._prevFrameTex),n.setUniform("texture2",e||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(t),n.render(t),this._blendFb.unbind(t),i||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(t));var r=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=r,this._frame++},dispose:function(t){this._sourceFb.dispose(t),this._blendFb.dispose(t),this._prevFrameTex.dispose(t),this._outputTex.dispose(t),this._sourceTex.dispose(t),this._outputPass.dispose(t),this._blendPass.dispose(t)}};const Pl=Dl;function Ol(t){t=t||"perspective",this.layer=null,this.scene=new _n,this.rootNode=this.scene,this.viewport={x:0,y:0,width:0,height:0},this.setProjection(t),this._compositor=new Il,this._temporalSS=new Pl,this._shadowMapPass=new Vs;for(var e=[],i=0,n=0;n<30;n++){for(var r=[],o=0;o<6;o++)r.push(4*hl(i,2)-2),r.push(4*hl(i,3)-2),i++;e.push(r)}this._pcfKernels=e,this.scene.on("beforerender",(function(t,e,i){this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,i)}),this)}Ol.prototype.setProjection=function(t){var e=this.camera;e&&e.update(),"perspective"===t?this.camera instanceof Ln||(this.camera=new Ln,e&&this.camera.setLocalTransform(e.localTransform)):this.camera instanceof hr||(this.camera=new hr,e&&this.camera.setLocalTransform(e.localTransform)),this.camera.near=.1,this.camera.far=2e3},Ol.prototype.setViewport=function(t,e,i,n,r){this.camera instanceof Ln&&(this.camera.aspect=i/n),r=r||1,this.viewport.x=t,this.viewport.y=e,this.viewport.width=i,this.viewport.height=n,this.viewport.devicePixelRatio=r,this._compositor.resize(i*r,n*r),this._temporalSS.resize(i*r,n*r)},Ol.prototype.containPoint=function(t,e){var i=this.viewport;return e=this.layer.renderer.getHeight()-e,t>=i.x&&e>=i.y&&t<=i.x+i.width&&e<=i.y+i.height};var kl=new vt;Ol.prototype.castRay=function(t,e,i){var n=this.layer.renderer,r=n.viewport;return n.viewport=this.viewport,n.screenToNDC(t,e,kl),this.camera.castRay(kl,i),n.viewport=r,i},Ol.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var t=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var e=0;e30},Ol.prototype._doRender=function(t,e,i){var n=this.scene,r=this.camera;i=i||0,this._updateTransparent(t,n,r,i),e||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(t,n,r,!0)),this._updateShadowPCFKernel(i);var o,a=t.clearColor;t.gl.clearColor(a[0],a[1],a[2],a[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(t,r),this._compositor.updateNormal(t,n,r,this._temporalSS.getFrame())),this._updateSSAO(t,n,r,this._temporalSS.getFrame()),this._enablePostEffect?((o=this._compositor.getSourceFrameBuffer()).bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),t.render(n,r,!0,!0),o.unbind(t),this.needsTemporalSS()&&e?(this._compositor.composite(t,n,r,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),this._compositor.composite(t,n,r,null,0))):this.needsTemporalSS()&&e?((o=this._temporalSS.getSourceFrameBuffer()).bind(t),t.saveClear(),t.clearBit=t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT,t.render(n,r,!0,!0),t.restoreClear(),o.unbind(t),t.setViewport(this.viewport),this._temporalSS.render(t)):(t.setViewport(this.viewport),t.render(n,r,!0,!0))},Ol.prototype._updateTransparent=function(t,e,i,n){for(var r=new ye,o=new He,a=i.getWorldPosition(),s=e.getRenderList(i).transparent,l=0;lthis.camera.far||t80*i){n=o=t[0],r=a=t[1];for(var f=i;fo&&(o=s),l>a&&(a=l);u=Math.max(o-n,a-r)}return ru(d,p,i,n,r,u),p}function iu(t,e,i,n,r){var o,a;if(r===Su(t,e,i,n)>0)for(o=e;o=e;o-=n)a=xu(o,t[o],t[o+1],a);return a&&mu(a,a.next)&&(bu(a),a=a.next),a}function nu(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!mu(n,n.next)&&0!==gu(n.prev,n,n.next))n=n.next;else{if(bu(n),(n=e=n.prev)===n.next)return null;i=!0}}while(i||n!==e);return e}function ru(t,e,i,n,r,o,a){if(t){!a&&o&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=cu(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,o,a,s,l,u=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,n=i,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,s--):(r=n,n=n.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=n}o.nextZ=null,u*=2}while(a>1)}(r)}(t,n,r,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?au(t,n,r,o):ou(t))e.push(s.i/i),e.push(t.i/i),e.push(l.i/i),bu(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?ru(t=su(t,e,i),e,i,n,r,o,2):2===a&&lu(t,e,i,n,r,o):ru(nu(t),e,i,n,r,o,1);break}}}function ou(t){var e=t.prev,i=t,n=t.next;if(gu(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(pu(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&gu(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function au(t,e,i,n){var r=t.prev,o=t,a=t.next;if(gu(r,o,a)>=0)return!1;for(var s=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,h=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,c=cu(s,l,e,i,n),d=cu(u,h,e,i,n),p=t.nextZ;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&pu(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&gu(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(p=t.prevZ;p&&p.z>=c;){if(p!==t.prev&&p!==t.next&&pu(r.x,r.y,o.x,o.y,a.x,a.y,p.x,p.y)&&gu(p.prev,p,p.next)>=0)return!1;p=p.prevZ}return!0}function su(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;!mu(r,o)&&vu(r,n,n.next,o)&&yu(r,o)&&yu(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),bu(n),bu(n.next),n=t=o),n=n.next}while(n!==t);return n}function lu(t,e,i,n,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&fu(a,s)){var l=_u(a,s);return a=nu(a,a.next),l=nu(l,l.next),ru(a,e,i,n,r,o),void ru(l,e,i,n,r,o)}s=s.next}a=a.next}while(a!==t)}function uu(t,e){return t.x-e.x}function hu(t,e){if(e=function(t,e){var i,n=e,r=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(o===n.y)return n;if(o===n.next.y)return n.next}i=n.x=n.x&&n.x>=h&&r!==n.x&&pu(oi.x)&&yu(n,t)&&(i=n,d=l),n=n.next;return i}(t,e)){var i=_u(e,t);nu(i,i.next)}}function cu(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function du(t){var e=t,i=t;do{e.x=0&&(t-a)*(n-s)-(i-a)*(e-s)>=0&&(i-a)*(o-s)-(r-a)*(n-s)>=0}function fu(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&vu(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&yu(t,e)&&yu(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&r<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)}function gu(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function mu(t,e){return t.x===e.x&&t.y===e.y}function vu(t,e,i,n){return!!(mu(t,e)&&mu(i,n)||mu(t,n)&&mu(i,e))||gu(t,e,i)>0!=gu(t,e,n)>0&&gu(i,n,t)>0!=gu(i,n,e)>0}function yu(t,e){return gu(t.prev,t,t.next)<0?gu(t,e,t.next)>=0&&gu(t,t.prev,e)>=0:gu(t,e,t.prev)<0||gu(t,t.next,e)<0}function _u(t,e){var i=new wu(t.i,t.x,t.y),n=new wu(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n}function xu(t,e,i,n){var r=new wu(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function bu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function wu(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Su(t,e,i,n){for(var r=0,o=e,a=i-n;ou&&s.push({pivot:Math.floor((l+u)/2),left:u,right:l}),u=o[a].pivot+1,(l=o[a].right)>u&&s.push({pivot:Math.floor((l+u)/2),left:u,right:l})}o=this._parts=s}else for(a=0;a=2e4},doSortTriangles:function(t,e){var i=this.indices;if(0===e){var n=this.attributes.position;t=t.array,this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new i.constructor(i.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var r,o=0,a=0;a0,i={},r=0;r65535?new Uint32Array(3*a):new Uint16Array(3*a),d.material.shader!==e&&d.material.attachShader(e,!0),Jo.setMaterialFromModel(e.__shading,d.material,t,i),s>0&&(this._linesMesh.geometry.resetOffset(),this._linesMesh.geometry.setVertexCount(s),this._linesMesh.geometry.setTriangleCount(l)),this._dataIndexOfVertex=new Uint32Array(o),this._vertexRangeOfDataIndex=new Uint32Array(2*(r-n))},_updateRegionMesh:function(t,e,i,n){for(var r=t.getData(),o=0,a=0,s=!1,l=this._polygonMesh,u=this._linesMesh,h=i;h0;w&&(b*=e.getDevicePixelRatio(),this._updateLinesGeometry(u.geometry,t,h,y,b,t.coordinateSystem.transform)),u.invisible=!w,u.material.set({color:m})}(l=this._polygonMesh).material.transparent=s,l.material.depthMask=!s,l.geometry.updateBoundingBox(),l.frontFace=this.extrudeY?Jo.Mesh.CCW:Jo.Mesh.CW,l.material.get("normalMap")&&l.geometry.generateTangents(),l.seriesIndex=t.seriesIndex,l.on("mousemove",this._onmousemove,this),l.on("mouseout",this._onmouseout,this)},_updateDebugWireframe:function(t){var e=t.getModel("debug.wireframe");if(e.get("show")){var i=Jo.parseColor(e.get("lineStyle.color")||"rgba(0,0,0,0.5)"),n=Mr(e.get("lineStyle.width"),1),r=this._polygonMesh;r.geometry.generateBarycentric(),r.material.define("both","WIREFRAME_TRIANGLE"),r.material.set("wireframeLineColor",i),r.material.set("wireframeLineWidth",n)}},_onmousemove:function(t){var e=this._dataIndexOfVertex[t.triangle[0]];null==e&&(e=-1),e!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(e),this._labelsBuilder.updateLabels([e])),this._lastHoverDataIndex=e,this._polygonMesh.dataIndex=e},_onmouseout:function(t){t.target&&(this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1),this._labelsBuilder.updateLabels([])},_updateGroundPlane:function(t,e,i){var n=t.getModel("groundPlane",t);if(this._groundMesh.invisible=!n.get("show",!0),!this._groundMesh.invisible){var r=t.get("shading"),o=this._groundMaterials[r];o||(o=this._groundMaterials.lambert),Jo.setMaterialFromModel(r,o,n,i),o.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=o,this._groundMesh.material.set("color",Jo.parseColor(n.get("color"))),this._groundMesh.scale.set(e.size[0],e.size[2],1)}},_triangulation:function(t,e,i){this._triangulationResults=[];for(var n=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0],o=t.coordinateSystem,a=e;a1?n:0,D[F][m]=C.points[G+2],l.set(r+F,D[F]),s?(E[0]=(C.points[G]*v[0]-y[0])/x,E[1]=(C.points[G+2]*v[m]-y[m])/x):(E[0]=(V?N:N+Z)/x,E[1]=(D[F][g]*v[g]-y[g])/x),h.set(r+F,E)}for(Bu.sub(P,D[1],D[0]),Bu.sub(O,D[3],D[0]),Bu.cross(k,P,O),Bu.normalize(k,k),F=0;F<4;F++)u.set(r+F,k),p&&c.set(r+F,a);for(F=0;F<6;F++)f[3*o+F]=I[F]+r;r+=4,o+=2,N+=Z}}return e.dirty(),{vertexOffset:r,triangleOffset:o}},_getRegionLinesInfo:function(t,e,i){var n=0,r=0;return e.getRegionModel(t).getModel("itemStyle").get("borderWidth")>0&&e.getRegionPolygonCoords(t).forEach((function(t){var e=t.exterior,o=t.interiors;n+=i.getPolylineVertexCount(e),r+=i.getPolylineTriangleCount(e);for(var a=0;athis._endIndex)){e-=this._startIndex;for(var n=this._vertexRangeOfDataIndex[2*e];n0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var t=this.getDisplacementTexture(),e=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==t||this._displacementScale!==e,this._displacementTexture=t,this._displacementScale=e},isDisplacementChanged:function(){return this._displacementChanged}});n.util.merge(ih.prototype,ca),n.util.merge(ih.prototype,da),n.util.merge(ih.prototype,pa),n.util.merge(ih.prototype,Kl);const nh=ih;var rh=Math.PI,oh=Math.sin,ah=Math.cos,sh=Math.tan,lh=Math.asin,uh=Math.atan2,hh=rh/180,ch=23.4397*hh;function dh(t,e){return uh(oh(t)*ah(ch)-sh(e)*oh(ch),ah(t))}function ph(t,e,i){return uh(oh(t),ah(t)*oh(e)-sh(i)*ah(e))}function fh(t,e,i){return lh(oh(e)*oh(i)+ah(e)*ah(i)*ah(t))}var gh={getPosition:function(t,e,i){var n=hh*-i,r=hh*e,o=function(t){return function(t){return t.valueOf()/864e5-.5+2440588}(t)-2451545}(t),a=function(t){var e,i,n=(i=function(t){return hh*(357.5291+.98560028*t)}(t))+hh*(1.9148*oh(i)+.02*oh(2*i)+3e-4*oh(3*i))+102.9372*hh+rh;return{dec:(e=n,lh(oh(0)*ah(ch)+ah(0)*oh(ch)*oh(e))),ra:dh(n,0)}}(o),s=function(t,e){return hh*(280.16+360.9856235*t)-e}(o,n)-a.ra;return{azimuth:ph(s,r,a.dec),altitude:fh(s,r,a.dec)}}};const mh=gh;Jo.Shader.import(Ho),Jo.Shader.import("@export ecgl.atmosphere.vertex\nattribute vec3 position: POSITION;\nattribute vec3 normal : NORMAL;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n\n\n@export ecgl.atmosphere.fragment\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform float glowPower;\nuniform vec3 glowColor;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor = vec4(glowColor, intensity * intensity);\n}\n@end");const vh=n.ComponentView.extend({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(t,e){this.groupGL=new Jo.Node,this._sphereGeometry=new Jo.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new Jo.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new Jo.PlaneGeometry,this._earthMesh=new Jo.Mesh({renderNormal:!0}),this._atmosphereMesh=new Jo.Mesh,this._atmosphereGeometry=new Jo.SphereGeometry({widthSegments:80,heightSegments:40}),this._atmosphereMaterial=new Jo.Material({shader:new Jo.Shader(Jo.Shader.source("ecgl.atmosphere.vertex"),Jo.Shader.source("ecgl.atmosphere.fragment")),transparent:!0}),this._atmosphereMesh.geometry=this._atmosphereGeometry,this._atmosphereMesh.material=this._atmosphereMaterial,this._atmosphereMesh.frontFace=Jo.Mesh.CW,this._lightRoot=new Jo.Node,this._sceneHelper=new Fa,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._atmosphereMesh),this.groupGL.add(this._earthMesh),this._control=new Ia({zr:e.getZr()}),this._control.init(),this._layerMeshes={}},render:function(t,e,i){var n=t.coordinateSystem,r=t.get("shading");n.viewGL.add(this._lightRoot),t.get("show")?n.viewGL.add(this.groupGL):n.viewGL.remove(this.groupGL),this._sceneHelper.setScene(n.viewGL.scene),n.viewGL.setPostEffect(t.getModel("postEffect"),i),n.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling"));var o=this._earthMesh;o.geometry=this._sphereGeometry;var a="ecgl."+r;o.material&&o.material.shader.name===a||(o.material=Jo.createMaterial(a)),Jo.setMaterialFromModel(r,o.material,t,i),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach((function(t){var e=o.material.get(t);e&&(e.flipY=!1)})),o.material.set("color",Jo.parseColor(t.get("baseColor")));var s=.99*n.radius;if(o.scale.set(s,s,s),t.get("atmosphere.show")){o.material.define("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!1,this._atmosphereMaterial.setUniforms({glowPower:t.get("atmosphere.glowPower")||6,glowColor:t.get("atmosphere.color")||"#ffffff"}),o.material.setUniforms({glowPower:t.get("atmosphere.innerGlowPower")||2,glowColor:t.get("atmosphere.color")||"#ffffff"});var l=t.get("atmosphere.offset")||5;this._atmosphereMesh.scale.set(s+l,s+l,s+l)}else o.material.undefine("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!0;var u=o.material.setTextureImage("diffuseMap",t.get("baseTexture"),i,{flipY:!1,anisotropic:8});u&&u.surface&&u.surface.attachToMesh(o);var h=o.material.setTextureImage("bumpMap",t.get("heightTexture"),i,{flipY:!1,anisotropic:8});h&&h.surface&&h.surface.attachToMesh(o),o.material[t.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(t,i),this._displaceVertices(t,i),this._updateViewControl(t,i),this._updateLayers(t,i)},afterRender:function(t,e,i,n){var r=n.renderer;this._sceneHelper.updateAmbientCubemap(r,t,i),this._sceneHelper.updateSkybox(r,t,i)},_updateLayers:function(t,e){var i=t.coordinateSystem,r=t.get("layers"),o=i.radius,a=[],s=[],l=[],u=[];n.util.each(r,(function(t){var r=new n.Model(t),h=r.get("type"),c=Jo.loadTexture(r.get("texture"),e,{flipY:!1,anisotropic:8});if(c.surface&&c.surface.attachToMesh(this._earthMesh),"blend"===h){var d=r.get("blendTo"),p=Mr(r.get("intensity"),1);"emission"===d?(l.push(c),u.push(p)):(a.push(c),s.push(p))}else{var f=r.get("id"),g=this._layerMeshes[f];g||(g=this._layerMeshes[f]=new Jo.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0})),"lambert"===r.get("shading")?(g.material=g.__lambertMaterial||new Jo.Material({autoUpdateTextureStatus:!1,shader:Jo.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),g.__lambertMaterial=g.material):(g.material=g.__colorMaterial||new Jo.Material({autoUpdateTextureStatus:!1,shader:Jo.createShader("ecgl.color"),transparent:!0,depthMask:!1}),g.__colorMaterial=g.material),g.material.enableTexture("diffuseMap");var m=r.get("distance"),v=o+(null==m?i.radius/100:m);g.scale.set(v,v,v),o=v;var y=this._blankTexture||(this._blankTexture=Jo.createBlankTexture("rgba(255, 255, 255, 0)"));g.material.set("diffuseMap",y),Jo.loadTexture(r.get("texture"),e,{flipY:!1,anisotropic:8},(function(t){t.surface&&t.surface.attachToMesh(g),g.material.set("diffuseMap",t),e.getZr().refresh()})),r.get("show")?this.groupGL.add(g):this.groupGL.remove(g)}}),this);var h=this._earthMesh.material;h.define("fragment","LAYER_DIFFUSEMAP_COUNT",a.length),h.define("fragment","LAYER_EMISSIVEMAP_COUNT",l.length),h.set("layerDiffuseMap",a),h.set("layerDiffuseIntensity",s),h.set("layerEmissiveMap",l),h.set("layerEmissionIntensity",u);var c=t.getModel("debug.wireframe");if(c.get("show")){h.define("both","WIREFRAME_TRIANGLE");var d=Jo.parseColor(c.get("lineStyle.color")||"rgba(0,0,0,0.5)"),p=Mr(c.get("lineStyle.width"),1);h.set("wireframeLineWidth",p),h.set("wireframeLineColor",d)}else h.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(t,e){var i=t.coordinateSystem,n=t.getModel("viewControl"),r=(i.viewGL.camera,this),o=this._control;o.setViewGL(i.viewGL);var a,s,l=n.get("targetCoord");null!=l&&(s=l[0]+90,a=l[1]),o.setFromViewControlModel(n,{baseDistance:i.radius,alpha:a,beta:s}),o.off("update"),o.on("update",(function(){e.dispatchAction({type:"globeChangeCamera",alpha:o.getAlpha(),beta:o.getBeta(),distance:o.getDistance()-i.radius,center:o.getCenter(),from:r.uid,globeId:t.id})}))},_displaceVertices:function(t,e){var i=t.get("displacementQuality"),n=t.get("debug.wireframe.show"),r=t.coordinateSystem;if(t.isDisplacementChanged()||i!==this._displacementQuality||n!==this._showDebugWireframe){this._displacementQuality=i,this._showDebugWireframe=n;var o=this._sphereGeometry,a={low:100,medium:200,high:400,ultra:800}[i]||200,s=a/2;(o.widthSegments!==a||n)&&(o.widthSegments=a,o.heightSegments=s,o.build()),this._doDisplaceVertices(o,r),n&&o.generateBarycentric()}},_doDisplaceVertices:function(t,e){var i=t.attributes.position.value,n=t.attributes.texcoord0.value,r=t.__originalPosition;r&&r.length===i.length||((r=new Float32Array(i.length)).set(i),t.__originalPosition=r);for(var o=e.displacementWidth,a=e.displacementHeight,s=e.displacementData,l=0;l50&&(o=1e3);var a=[];Oh.perspective(a,Eh,this.width/this.height,1,o),this.viewGL.camera.projectionMatrix.setArray(a),this.viewGL.camera.decomposeProjectionMatrix(),a=Oh.identity([]);var s=this.dataToPoint(this.center);Oh.scale(a,a,[1,-1,1]),Oh.translate(a,a,[0,0,-t]),Oh.rotateX(a,a,e),Oh.rotateZ(a,a,-this.bearing/180*Math.PI),Oh.translate(a,a,[-s[0]*this.getScale()*Rh,-s[1]*this.getScale()*Rh,0]),this.viewGL.camera.viewMatrix.array=a;var l=[];Oh.invert(l,a),this.viewGL.camera.worldTransform.array=l,this.viewGL.camera.decomposeWorldTransform();var u,h=kh*this.getScale();if(this.altitudeExtent&&!isNaN(this.boxHeight)){var c=this.altitudeExtent[1]-this.altitudeExtent[0];u=this.boxHeight/c*this.getScale()/Math.pow(2,this._initialZoom-this.zoomOffset)}else u=h/(2*Math.PI*6378e3*Math.abs(Math.cos(this.center[1]*(Math.PI/180))))*this.altitudeScale*Rh;this.viewGL.rootNode.scale.set(this.getScale()*Rh,this.getScale()*Rh,u)}},getScale:function(){return Math.pow(2,this.zoom-this.zoomOffset)},projectOnTile:function(t,e){return this.projectOnTileWithScale(t,this.getScale()*kh,e)},projectOnTileWithScale:function(t,e,i){var n=t[0],r=t[1]*Nh/180,o=e*(n*Nh/180+Nh)/(2*Nh),a=e*(Nh-Math.log(Math.tan(Nh/4+.5*r)))/(2*Nh);return(i=i||[])[0]=o,i[1]=a,i},unprojectFromTile:function(t,e){return this.unprojectOnTileWithScale(t,this.getScale()*kh,e)},unprojectOnTileWithScale:function(t,e,i){var n=t[0],r=t[1],o=n/e*(2*Nh)-Nh,a=2*(Math.atan(Math.exp(Nh-r/e*(2*Nh)))-Nh/4);return(i=i||[])[0]=180*o/Nh,i[1]=180*a/Nh,i},dataToPoint:function(t,e){return(e=this.projectOnTileWithScale(t,kh,e))[0]-=this._origin[0],e[1]-=this._origin[1],e[2]=isNaN(t[2])?0:t[2],isNaN(t[2])||(e[2]=t[2],this.altitudeExtent&&(e[2]-=this.altitudeExtent[0])),e}};const Bh=zh;function Zh(){Bh.apply(this,arguments)}function Fh(t,e,i){function n(t,e){var i=e.getWidth(),n=e.getHeight(),r=e.getDevicePixelRatio();this.viewGL.setViewport(0,0,i,n,r),this.width=i,this.height=n,this.altitudeScale=t.get("altitudeScale"),this.boxHeight=t.get("boxHeight")}function r(t,e){if("auto"!==this.model.get("boxHeight")){var i=[1/0,-1/0];t.eachSeries((function(t){if(t.coordinateSystem===this){var e=t.getData(),n=t.coordDimToDataDim("alt")[0];if(n){var r=e.getDataExtent(n,!0);i[0]=Math.min(i[0],r[0]),i[1]=Math.max(i[1],r[1])}}}),this),i&&isFinite(i[1]-i[0])&&(this.altitudeExtent=i)}}return{dimensions:e.prototype.dimensions,create:function(o,a){var s=[];return o.eachComponent(t,(function(t){var i=t.__viewGL;i||(i=t.__viewGL=new El).setRootNode(new Jo.Node);var o=new e;o.viewGL=t.__viewGL,o.resize=n,o.resize(t,a),s.push(o),t.coordinateSystem=o,o.model=t,o.update=r})),o.eachSeries((function(e){if(e.get("coordinateSystem")===t){var i=e.getReferringComponents(t).models[0];if(i||(i=o.getComponent(t)),!i)throw new Error(t+' "'+Mr(e.get(t+"Index"),e.get(t+"Id"),0)+'" not found');e.coordinateSystem=i.coordinateSystem}})),i&&i(s,o,a),s}}}Zh.prototype=new Bh,Zh.prototype.constructor=Zh,Zh.prototype.type="mapbox3D";const Vh=Fh("mapbox3D",Zh,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMapboxCameraOption())}))}));(0,n.use)((function(t){t.registerComponentModel(Ch),t.registerComponentView(Ph),t.registerCoordinateSystem("mapbox3D",Vh),t.registerAction({type:"mapbox3DChangeCamera",event:"mapbox3dcamerachanged",update:"mapbox3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"mapbox3D",query:t},(function(e){e.setMapboxCameraOption(t)}))}))}));var Gh=["zoom","center","pitch","bearing"],Hh=n.ComponentModel.extend({type:"maptalks3D",layoutMode:"box",coordinateSystem:null,defaultOption:{zlevel:-10,urlTemplate:"http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",attribution:'© OpenStreetMap contributors, © CARTO',center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMaptalksCameraOption:function(){var t=this;return Gh.reduce((function(e,i){return e[i]=t.get(i),e}),{})},setMaptalksCameraOption:function(t){null!=t&&Gh.forEach((function(e){null!=t[e]&&(this.option[e]=t[e])}),this)},getMaptalks:function(){return this._maptalks},setMaptalks:function(t){this._maptalks=t}});n.util.merge(Hh.prototype,da),n.util.merge(Hh.prototype,pa);const Uh=Hh;function Wh(t,e,i,n){if(this.id=t,this.zr=e,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!maptalks)throw new Error("Maptalks library must be included. See https://maptalks.org");this._maptalks=new maptalks.Map(this.dom,{center:i,zoom:n,doubleClickZoom:!1,fog:!1}),this._initEvents()}Wh.prototype.setUnpainted=function(){},Wh.prototype.resize=function(){this._maptalks.checkSize()},Wh.prototype.getMaptalks=function(){return this._maptalks},Wh.prototype.clear=function(){},Wh.prototype.refresh=function(){this._maptalks.checkSize()};var jh=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","DOMMouseScroll","touchstart","touchend","touchmove","touchcancel"];Wh.prototype._initEvents=function(){var t=this.dom;this._handlers=this._handlers||{contextmenu:function(t){return t.preventDefault(),!1}},jh.forEach((function(e){this._handlers[e]=function(i){var n={};for(var r in i)n[r]=i[r];n.bubbles=!1;var o=new i.constructor(i.type,n);"mousewheel"===e||"DOMMouseScroll"===e?t.dispatchEvent(o):t.firstElementChild.dispatchEvent(o)},this.zr.dom.addEventListener(e,this._handlers[e])}),this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},Wh.prototype.dispose=function(){jh.forEach((function(t){this.zr.dom.removeEventListener(t,this._handlers[t])}),this),this._maptalks.remove()};const Xh=Wh;Jo.Shader.import(Dh);const Yh=n.ComponentView.extend({type:"maptalks3D",__ecgl__:!0,init:function(t,e){this._groundMesh=new Jo.Mesh({geometry:new Jo.PlaneGeometry,material:new Jo.Material({shader:new Jo.Shader({vertex:Jo.Shader.source("ecgl.displayShadow.vertex"),fragment:Jo.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},_initMaptalksLayer:function(t,e){var i=e.getZr();this._zrLayer=new Xh("maptalks3D",i,t.get("center"),t.get("zoom")),i.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new Jo.Node,this._sceneHelper=new Fa(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var n=this._zrLayer.getMaptalks(),r=this._dispatchInteractAction.bind(this,e,n);["zoomend","zooming","zoomstart","dragrotating","pitch","pitchend","movestart","moving","moveend","resize","touchstart","touchmove","touchend","animating"].forEach((function(t){n.on(t,r)}))},render:function(t,e,i){this._zrLayer||this._initMaptalksLayer(t,i);var n=this._zrLayer.getMaptalks(),r=t.get("urlTemplate"),o=n.getBaseLayer();r!==this._oldUrlTemplate&&(o?o.setOptions({urlTemplate:r,attribution:t.get("attribution")}):(o=new maptalks.TileLayer("maptalks-echarts-gl-baselayer",{urlTemplate:r,subdomains:["a","b","c"],attribution:t.get("attribution")}),n.setBaseLayer(o))),this._oldUrlTemplate=r,n.setCenter(t.get("center")),n.setZoom(t.get("zoom"),{animation:!1}),n.setPitch(t.get("pitch")),n.setBearing(t.get("bearing")),t.setMaptalks(n);var a=t.coordinateSystem;a.viewGL.scene.add(this._lightRoot),a.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(a.viewGL.scene),this._sceneHelper.updateLight(t),a.viewGL.setPostEffect(t.getModel("postEffect"),i),a.viewGL.setTemporalSuperSampling(t.getModel("temporalSuperSampling")),this._maptalks3DModel=t},afterRender:function(t,e,i,n){var r=n.renderer;this._sceneHelper.updateAmbientCubemap(r,t,i),this._sceneHelper.updateSkybox(r,t,i),t.coordinateSystem.viewGL.scene.traverse((function(t){t.material&&(t.material.define("fragment","NORMAL_UP_AXIS",2),t.material.define("fragment","NORMAL_FRONT_AXIS",1))}))},updateCamera:function(t,e,i,n){t.coordinateSystem.setCameraOption(n),this._updateGroundMesh(),i.getZr().refresh()},_dispatchInteractAction:function(t,e,i){var n;t.dispatchAction({type:"maptalks3DChangeCamera",pitch:e.getPitch(),zoom:(n=e.getResolution(),19-Math.log(n/qh)/Math.LN2+1),center:e.getCenter().toArray(),bearing:e.getBearing(),maptalks3DId:this._maptalks3DModel&&this._maptalks3DModel.id})},_updateGroundMesh:function(){if(this._maptalks3DModel){var t=this._maptalks3DModel.coordinateSystem,e=t.dataToPoint(t.center);this._groundMesh.position.set(e[0],e[1],-.001);var i=new Jo.Plane(new Jo.Vector3(0,0,1),0),n=t.viewGL.camera.castRay(new Jo.Vector2(-1,-1)),r=t.viewGL.camera.castRay(new Jo.Vector2(1,1)),o=n.intersectPlane(i),a=r.intersectPlane(i),s=o.dist(a)/t.viewGL.rootNode.scale.x;this._groundMesh.scale.set(s,s,1)}},dispose:function(t,e){this._zrLayer&&this._zrLayer.dispose(),e.getZr().painter.delLayer(-1e3)}}),qh=12756274*Math.PI/(256*Math.pow(2,20));function Kh(){Bh.apply(this,arguments),this.maxPitch=85,this.zoomOffset=1}Kh.prototype=new Bh,Kh.prototype.constructor=Kh,Kh.prototype.type="maptalks3D";const Jh=Fh("maptalks3D",Kh,(function(t){t.forEach((function(t){t.setCameraOption(t.model.getMaptalksCameraOption())}))}));(0,n.use)((function(t){t.registerComponentModel(Uh),t.registerComponentView(Yh),t.registerCoordinateSystem("maptalks3D",Jh),t.registerAction({type:"maptalks3DChangeCamera",event:"maptalks3dcamerachanged",update:"maptalks3D:updateCamera"},(function(t,e){e.eachComponent({mainType:"maptalks3D",query:t},(function(e){e.setMaptalksCameraOption(t)}))}))}));var Qh=Pa.vec3,$h=n.helper.dataStack.isDimensionStacked;function tc(t,e,i){for(var n=t.getDataExtent(e),r=t.getDataExtent(i),o=n[1]-n[0]||n[0],a=r[1]-r[0]||r[0],s=new Uint8Array(2500),l=0;l0&&d>0||c<0&&d<0)),g=["x","y","z"].map((function(e){return t.coordDimToDataDim(e)[0]})),m=$h(i,g[2]),v=m?i.getCalculationInfo("stackResultDimension"):g[2];i.each(g,(function(t,n,o,a){var s=i.get(v,a),l=m?s-o:f?0:p[0],u=e.dataToPoint([t,n,l]),h=e.dataToPoint([t,n,s]),c=Qh.dist(u,h),d=[0,h[1]"+o.join("
    ")}(o):n.format.encodeHTML(n.format.addCommas(o)),s=r.getName(e),l=Eu(r,e);n.util.isObject(l)&&l.colorStops&&(l=(l.colorStops[0]||{}).color),l=l||"transparent";var u=n.format.getTooltipMarker(l),h=t.name;return"\0-"===h&&(h=""),h=h?n.format.encodeHTML(h)+(i?": ":"
    "):"",i?u+h+a:h+u+(s?n.format.encodeHTML(s)+": "+a:a)}function sc(t,e,i){i=i||t.getSource();var r=e||n.getCoordinateSystemDimensions(t.get("coordinateSystem"))||["x","y","z"],o=n.helper.createDimensions(i,{dimensionsDefine:i.dimensionsDefine||t.get("dimensions"),encodeDefine:i.encodeDefine||t.get("encode"),coordDimensions:r.map((function(e){var i=t.getReferringComponents(e+"Axis3D").models[0];return{type:i&&"category"===i.get("type")?"ordinal":"float",name:e}}))});"cartesian3D"===t.get("coordinateSystem")&&o.forEach((function(e){if(r.indexOf(e.coordDim)>=0){var i=t.getReferringComponents(e.coordDim+"Axis3D").models[0];i&&"category"===i.get("type")&&(e.ordinalMeta=i.getOrdinalMeta())}}));var a=n.helper.dataStack.enableDataStack(t,o,{byIndex:!0,stackedCoordDimension:"z"}),s=new n.List(o,t);return s.setCalculationInfo(a),s.initData(i),s}var lc=n.SeriesModel.extend({type:"series.bar3D",dependencies:["globe"],visualStyleAccessPathvisu:"itemStyle",getInitialData:function(t,e){return sc(this)},getFormattedLabel:function(t,e,i,n){var r=oc.getFormattedLabel(this,t,e,i,n);return null==r&&(r=this.getData().get("z",t)),r},formatTooltip:function(t){return ac(this,t)},defaultOption:{coordinateSystem:"cartesian3D",globeIndex:0,grid3DIndex:0,zlevel:-10,bevelSize:0,bevelSmoothness:2,onGridPlane:"xy",shading:"color",minHeight:0,itemStyle:{opacity:1},label:{show:!1,distance:2,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},emphasis:{label:{show:!0}},animationDurationUpdate:500}});n.util.merge(lc.prototype,Kl);const uc=lc;var hc,cc,dc,pc,fc,gc,mc,vc,yc=Pa.vec3,_c=Pa.mat3,xc=Gi.extend((function(){return{attributes:{position:new Gi.Attribute("position","float",3,"POSITION"),normal:new Gi.Attribute("normal","float",3,"NORMAL"),color:new Gi.Attribute("color","float",4,"COLOR"),prevPosition:new Gi.Attribute("prevPosition","float",3),prevNormal:new Gi.Attribute("prevNormal","float",3)},dynamic:!0,enableNormal:!1,bevelSize:1,bevelSegments:0,_dataIndices:null,_vertexOffset:0,_triangleOffset:0}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0},setBarCount:function(t){var e=this.enableNormal,i=this.getBarVertexCount()*t,n=this.getBarTriangleCount()*t;this.vertexCount!==i&&(this.attributes.position.init(i),e?this.attributes.normal.init(i):this.attributes.normal.value=null,this.attributes.color.init(i)),this.triangleCount!==n&&(this.indices=i>65535?new Uint32Array(3*n):new Uint16Array(3*n),this._dataIndices=new Uint32Array(i))},getBarVertexCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarVertexCount(t):this.enableNormal?24:8},getBarTriangleCount:function(){var t=this.bevelSize>0?this.bevelSegments:0;return t>0?this._getBevelBarTriangleCount(t):12},_getBevelBarVertexCount:function(t){return 4*(t+1)*(t+1)*2},_getBevelBarTriangleCount:function(t){return(4*t+3+1)*(2*t+1)*2+4},setColor:function(t,e){for(var i=this.getBarVertexCount(),n=i*(t+1),r=i*t;r0&&this.bevelSegments>0)this._addBevelBar(t,c,g,m,this.bevelSize,this.bevelSegments,v);else{yc.copy(r,c),yc.normalize(r,r),yc.cross(o,g,r),yc.normalize(o,o),yc.cross(n,r,o),yc.normalize(o,o),yc.negate(a,n),yc.negate(s,r),yc.negate(l,o),e(u[0],t,n,m[0]/2),e(u[0],u[0],o,m[2]/2),e(u[1],t,n,m[0]/2),e(u[1],u[1],l,m[2]/2),e(u[2],t,a,m[0]/2),e(u[2],u[2],l,m[2]/2),e(u[3],t,a,m[0]/2),e(u[3],u[3],o,m[2]/2),e(i,t,r,m[1]),e(u[4],i,n,m[0]/2),e(u[4],u[4],o,m[2]/2),e(u[5],i,n,m[0]/2),e(u[5],u[5],l,m[2]/2),e(u[6],i,a,m[0]/2),e(u[6],u[6],l,m[2]/2),e(u[7],i,a,m[0]/2),e(u[7],u[7],o,m[2]/2);var x=this.attributes;if(this.enableNormal){h[0]=n,h[1]=a,h[2]=r,h[3]=s,h[4]=o,h[5]=l;for(var b=this._vertexOffset,w=0;w0&&(p++,h[3]<.99&&(f=!0))}})),a.geometry.setBarCount(p);var g=i.getLayout("orient"),m=this._barIndexOfData=new Int32Array(i.count());p=0,i.each((function(t){if(i.hasValue(t)){var e=i.getItemLayout(t),n=e[0],r=e[1],a=e[2],s=4*t;h[0]=c[s++],h[1]=c[s++],h[2]=c[s++],h[3]=c[s++],h[3]>0&&(o._barMesh.geometry.addBar(n,r,g,a,h,t),m[t]=p++)}else m[t]=-1})),a.geometry.dirty(),a.geometry.updateBoundingBox();var v=a.material;v.transparent=f,v.depthMask=!f,a.geometry.sortTriangles=f,this._initHandler(t,e)},_initHandler:function(t,e){var i=t.getData(),n=this._barMesh,r="cartesian3D"===t.coordinateSystem.type;n.seriesIndex=t.seriesIndex;var o=-1;n.off("mousemove"),n.off("mouseout"),n.on("mousemove",(function(t){var a=n.geometry.getDataIndexOfVertex(t.triangle[0]);a!==o&&(this._downplay(o),this._highlight(a),this._labelsBuilder.updateLabels([a]),r&&e.dispatchAction({type:"grid3DShowAxisPointer",value:[i.get("x",a),i.get("y",a),i.get("z",a,!0)]})),o=a,n.dataIndex=a}),this),n.on("mouseout",(function(t){this._downplay(o),this._labelsBuilder.updateLabels(),o=-1,n.dataIndex=-1,r&&e.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_highlight:function(t){var e=this._data;if(e){var i=this._barIndexOfData[t];if(!(i<0)){var r=e.getItemModel(t).getModel("emphasis.itemStyle"),o=r.get("color"),a=r.get("opacity");if(null==o){var s=Eu(e,t);o=n.color.lift(s,-.4)}null==a&&(a=Nu(e,t));var l=Jo.parseColor(o);l[3]*=a,this._barMesh.geometry.setColor(i,l),this._api.getZr().refresh()}}},_downplay:function(t){var e=this._data;if(e){var i=this._barIndexOfData[t];if(!(i<0)){var n=Eu(e,t),r=Nu(e,t),o=Jo.parseColor(n);o[3]*=r,this._barMesh.geometry.setColor(i,o),this._api.getZr().refresh()}}},highlight:function(t,e,i,n){this._toggleStatus("highlight",t,e,i,n)},downplay:function(t,e,i,n){this._toggleStatus("downplay",t,e,i,n)},_toggleStatus:function(t,e,i,r,o){var a=e.getData(),s=Cr(a,o),l=this;null!=s?n.util.each(oc.normalizeToArray(s),(function(e){"highlight"===t?this._highlight(e):this._downplay(e)}),this):a.each((function(e){"highlight"===t?l._highlight(e):l._downplay(e)}))},remove:function(){this.groupGL.removeAll()},dispose:function(){this._labelsBuilder.dispose(),this.groupGL.removeAll()}});(0,n.use)((function(t){t.registerChartView(Sc),t.registerSeriesModel(uc),rc(t),t.registerProcessor((function(t,e){t.eachSeriesByType("bar3d",(function(t){var e=t.getData();e.filterSelf((function(t){return e.hasValue(t)}))}))}))}));const Tc=n.SeriesModel.extend({type:"series.line3D",dependencies:["grid3D"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",getInitialData:function(t,e){return sc(this)},formatTooltip:function(t){return ac(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,lineStyle:{width:2},animationDurationUpdate:500}});function Mc(t,e,i,n,r,o,a){if(0===r)return!1;var s,l=r;if(a>e+l&&a>n+l||at+l&&o>i+l||o=0){var m=3*l,v=new ye(this._points[m],this._points[m+1],this._points[m+2]);o.push({dataIndex:l,point:v,pointWorld:v.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(v)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});(0,n.use)((function(t){t.registerChartView(Ac),t.registerSeriesModel(Tc),t.registerLayout((function(t,e){t.eachSeriesByType("line3D",(function(t){var e=t.getData(),i=t.coordinateSystem;if(i){if("cartesian3D"!==i.type)return;var n=new Float32Array(3*e.count()),r=[],o=[],a=i.dimensions.map((function(e){return t.coordDimToDataDim(e)[0]}));i&&e.each(a,(function(t,e,a,s){r[0]=t,r[1]=e,r[2]=a,i.dataToPoint(r,o),n[3*s]=o[0],n[3*s+1]=o[1],n[3*s+2]=o[2]})),e.setLayout("points",n)}}))}))}));const Lc=n.SeriesModel.extend({type:"series.scatter3D",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,getInitialData:function(t,e){return sc(this)},getFormattedLabel:function(t,e,i,n){var r=oc.getFormattedLabel(this,t,e,i,n);if(null==r){var o=this.getData(),a=o.dimensions[o.dimensions.length-1];r=o.get(a,t)}return r},formatTooltip:function(t){return ac(this,t)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,progressive:1e5,progressiveThreshold:1e5,grid3DIndex:0,globeIndex:0,symbol:"circle",symbolSize:10,blendMode:"source-over",label:{show:!1,position:"right",distance:5,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},itemStyle:{opacity:.8},emphasis:{label:{show:!0}},animationDurationUpdate:500}});function Ic(t,e,i){(e=e||document.createElement("canvas")).width=t,e.height=t;var n=e.getContext("2d");return i&&i(n),e}var Dc={getMarginByStyle:function(t){var e=t.minMargin||0,i=0;t.stroke&&"none"!==t.stroke&&(i=null==t.lineWidth?1:t.lineWidth);var n=t.shadowBlur||0,r=t.shadowOffsetX||0,o=t.shadowOffsetY||0,a={};return a.left=Math.max(i/2,-r+n,e),a.right=Math.max(i/2,r+n,e),a.top=Math.max(i/2,-o+n,e),a.bottom=Math.max(i/2,o+n,e),a},createSymbolSprite:function(t,e,i,r){var o=function(t,e,i,r){n.util.isArray(e)||(e=[e,e]);var o=Dc.getMarginByStyle(i,void 0),a=e[0]+o.left+o.right,s=e[1]+o.top+o.bottom,l=n.helper.createSymbol(t,0,0,e[0],e[1]),u=Math.max(a,s);l.x=o.left,l.y=o.top,a>s?l.y+=(u-s)/2:l.x+=(u-a)/2;var h=l.getBoundingRect();return l.x-=h.x,l.y-=h.y,l.setStyle(i),l.update(),l.__size=u,l}(t,e,i),a=Dc.getMarginByStyle(i);return{image:Ic(o.__size,r,(function(t){n.innerDrawElementOnCanvas(t,o)})),margin:a}},createSDFFromCanvas:function(t,e,i,n){return Ic(e,n,(function(e){var n=t.getContext("2d").getImageData(0,0,t.width,t.height);e.putImageData(function(t,e,i){var n=e.width,r=e.height,o=t.canvas.width,a=t.canvas.height,s=n/o,l=r/a;function u(t){return t<128?1:-1}function h(t,o){var a=1/0;t=Math.floor(t*s);for(var h=(o=Math.floor(o*l))*n+t,c=u(e.data[4*h]),d=Math.max(o-i,0);d=2e4},doSortVertices:function(t,e){var i=this.indices,n=Oc.create();if(!i){i=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var r=0;r.05);else for(r=0;r<3;r++)this._progressiveQuickSort(3*e+r);this.dirtyIndices()},_simpleSort:function(t){var e=this._zList,i=this.indices;function n(t,i){return e[i]-e[t]}t?Array.prototype.sort.call(i,n):Lu.sort(i,n,0,i.length-1)},_progressiveQuickSort:function(t){var e=this._zList,i=this.indices;this._quickSort=this._quickSort||new Lu,this._quickSort.step(i,(function(t,i){return e[i]-e[t]}),t)}};var Ec=Pa.vec4;Jo.Shader.import("@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end");const Nc=Jo.Mesh.extend((function(){var t=new Jo.Geometry({dynamic:!0,attributes:{color:new Jo.Geometry.Attribute("color","float",4,"COLOR"),position:new Jo.Geometry.Attribute("position","float",3,"POSITION"),size:new Jo.Geometry.Attribute("size","float",1),prevPosition:new Jo.Geometry.Attribute("prevPosition","float",3),prevSize:new Jo.Geometry.Attribute("prevSize","float",1)}});Object.assign(t,kc);var e=new Jo.Material({shader:Jo.createShader("ecgl.sdfSprite"),transparent:!0,depthMask:!1});e.enableTexture("sprite"),e.define("both","VERTEX_COLOR"),e.define("both","VERTEX_SIZE");var i=new Jo.Texture2D({image:document.createElement("canvas"),flipY:!1});return e.set("sprite",i),t.pick=this._pick.bind(this),{geometry:t,material:e,mode:Jo.Mesh.POINTS,sizeScale:1}}),{_pick:function(t,e,i,n,r,o){var a=this._positionNDC;if(a)for(var s=i.viewport,l=2/s.width,u=2/s.height,h=this.geometry.vertexCount-1;h>=0;h--){var c,d=a[2*(c=this.geometry.indices?this.geometry.indices[h]:h)],p=a[2*c+1],f=this.geometry.attributes.size.get(c)/this.sizeScale/2;if(t>d-f*l&&tp-f*u&&e2?(f=this._updateSymbolSprite(t,d,h,c),s.enableTexture("sprite")):s.disableTexture("sprite"),u.position.init(r-n);var g=[];if(p){s.undefine("VERTEX_SIZE"),s.undefine("VERTEX_COLOR");var m=function(t){const e=t.getVisual("style");if(e)return e[t.getVisual("drawType")]}(a),v=function(t){return t.getVisual("style").opacity}(a);Jo.parseColor(m,g),g[3]*=v,s.set({color:g,u_Size:h.maxSize*this._sizeScale})}else s.set({color:[1,1,1,1]}),s.define("VERTEX_SIZE"),s.define("VERTEX_COLOR"),u.size.init(r-n),u.color.init(r-n),this._originalOpacity=new Float32Array(r-n);for(var y=a.getLayout("points"),_=u.position.value,x=0;x1?(a[0]=i.maxSize,a[1]=i.maxSize/i.aspect):(a[1]=i.maxSize,a[0]=i.maxSize*i.aspect),a[0]=a[0]||1,a[1]=a[1]||1,this._symbolType===i.type&&(o=a,(r=this._symbolSize)&&o&&r[0]===o[0]&&r[1]===o[1])&&this._lineWidth===e.lineWidth||(Pc.createSymbolSprite(i.type,a,{fill:"#fff",lineWidth:e.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(a[0]/2,10)},this._spriteImageCanvas),Pc.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),20,this._mesh.material.get("sprite").image),this._symbolType=i.type,this._symbolSize=a,this._lineWidth=e.lineWidth),this._spriteImageCanvas.width/i.maxSize*n},_updateMaterial:function(t,e){var i="lighter"===t.get("blendMode")?Jo.additiveBlend:null,n=this._mesh.material;n.blend=i,n.set("lineWidth",e.lineWidth/20);var r=Jo.parseColor(e.stroke);n.set("strokeColor",r),n.transparent=!0,n.depthMask=!1,n.depthTest=!this.is2D,n.sortVertices=!this.is2D},_updateLabelBuilder:function(t,e,i){var n=t.getData(),r=this._mesh.geometry,o=r.attributes.position.value,a=(e=this._startDataIndex,this._mesh.sizeScale);this._labelsBuilder.updateData(n,e,i),this._labelsBuilder.getLabelPosition=function(t,i,n){var r=3*(t-e);return[o[r],o[r+1],o[r+2]]},this._labelsBuilder.getLabelDistance=function(t,i,n){return r.attributes.size.get(t-e)/a/2+n},this._labelsBuilder.updateLabels()},_updateAnimation:function(t){Jo.updateVertexAnimation([["prevPosition","position"],["prevSize","size"]],this._prevMesh,this._mesh,t)},_updateHandler:function(t,e,i){var n,r=t.getData(),o=this._mesh,a=this,s=-1,l=t.coordinateSystem&&"cartesian3D"===t.coordinateSystem.type;l&&(n=t.coordinateSystem.model),o.seriesIndex=t.seriesIndex,o.off("mousemove"),o.off("mouseout"),o.on("mousemove",(function(e){var u=e.vertexIndex+a._startDataIndex;u!==s&&(this.highlightOnMouseover&&(this.downplay(r,s),this.highlight(r,u),this._labelsBuilder.updateLabels([u])),l&&i.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get(t.coordDimToDataDim("x")[0],u),r.get(t.coordDimToDataDim("y")[0],u),r.get(t.coordDimToDataDim("z")[0],u)],grid3DIndex:n.componentIndex})),o.dataIndex=u,s=u}),this),o.on("mouseout",(function(t){var e=t.vertexIndex+a._startDataIndex;this.highlightOnMouseover&&(this.downplay(r,e),this._labelsBuilder.updateLabels()),s=-1,o.dataIndex=-1,l&&i.dispatchAction({type:"grid3DHideAxisPointer",grid3DIndex:n.componentIndex})}),this)},updateLayout:function(t,e,i){var n=t.getData();if(this._mesh){var r=this._mesh.geometry.attributes.position.value,o=n.getLayout("points");if(this.is2D)for(var a=0;athis._endDataIndex||ethis._endDataIndex||e 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end");const od=Jo.Mesh.extend((function(){var t=new Jo.Material({shader:new Jo.Shader(Jo.Shader.source("ecgl.trail2.vertex"),Jo.Shader.source("ecgl.trail2.fragment")),transparent:!0,depthMask:!1}),e=new Na({dynamic:!0});return e.createAttribute("dist","float",1),e.createAttribute("distAll","float",1),e.createAttribute("start","float",1),{geometry:e,material:t,culling:!1,$ignorePicking:!0}}),{updateData:function(t,e,i){var n=t.hostModel,r=this.geometry,o=n.getModel("effect"),a=o.get("trailWidth")*e.getDevicePixelRatio(),s=o.get("trailLength"),l=n.get("effect.constantSpeed"),u=1e3*n.get("effect.period"),h=null!=l;h?this.material.set("speed",l/1e3):this.material.set("period",u),this.material[h?"define":"undefine"]("vertex","CONSTANT_SPEED");var c=n.get("polyline");r.trailLength=s,this.material.set("trailLength",s),r.resetOffset(),["position","positionPrev","positionNext"].forEach((function(t){r.attributes[t].value=i.attributes[t].value})),["dist","distAll","start","offset","color"].forEach((function(t){r.attributes[t].init(r.vertexCount)})),r.indices=i.indices;var d=[],p=o.get("trailColor"),f=o.get("trailOpacity"),g=null!=p,m=null!=f;this.updateWorldTransform();var v=this.worldTransform.x.len(),y=this.worldTransform.y.len(),_=this.worldTransform.z.len(),x=0,b=0;t.each((function(e){var n=t.getItemLayout(e),o=m?f:Nu(t,e),s=Eu(t,e);null==o&&(o=1),(d=Jo.parseColor(g?p:s,d))[3]*=o;for(var l=c?i.getPolylineVertexCount(n):i.getCubicCurveVertexCount(n[0],n[1],n[2],n[3]),w=0,S=[],T=[],M=x;Mx&&(w+=rd.dist(S,T)),r.attributes.dist.set(M,w),rd.copy(T,S);b=Math.max(b,w);var C=Math.random()*(h?w:u);for(M=x;M0?1:-1)*a/2),r.attributes.color.set(M,d);x+=l})),this.material.set("spotSize",.1*b*s),this.material.set("spotIntensity",o.get("spotIntensity")),r.dirty()},setAnimationTime:function(t){this.material.set("time",t)}});Jo.Shader.import(ns);const ad=n.ChartView.extend({type:"lines3D",__ecgl__:!0,init:function(t,e){this.groupGL=new Jo.Node,this._meshLinesMaterial=new Jo.Material({shader:Jo.createShader("ecgl.meshLines3D"),transparent:!0,depthMask:!1}),this._linesMesh=new Jo.Mesh({geometry:new Na,material:this._meshLinesMaterial,$ignorePicking:!0}),this._trailMesh=new od},render:function(t,e,i){this.groupGL.add(this._linesMesh);var n=t.coordinateSystem,r=t.getData();if(n&&n.viewGL){n.viewGL.add(this.groupGL),this._updateLines(t,e,i);var o=n.viewGL.isLinearSpace()?"define":"undefine";this._linesMesh.material[o]("fragment","SRGB_DECODE"),this._trailMesh.material[o]("fragment","SRGB_DECODE")}var a=this._trailMesh;if(a.stopAnimation(),t.get("effect.show")){this.groupGL.add(a),a.updateData(r,i,this._linesMesh.geometry),a.__time=a.__time||0;var s=36e5;this._curveEffectsAnimator=a.animate("",{loop:!0}).when(s,{__time:s}).during((function(){a.setAnimationTime(a.__time)})).start()}else this.groupGL.remove(a),this._curveEffectsAnimator=null;this._linesMesh.material.blend=this._trailMesh.material.blend="lighter"===t.get("blendMode")?Jo.additiveBlend:null},pauseEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.pause()},resumeEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.resume()},toggleEffect:function(){var t=this._curveEffectsAnimator;t&&(t.isPaused()?t.resume():t.pause())},_updateLines:function(t,e,i){var n=t.getData(),r=t.coordinateSystem,o=this._linesMesh.geometry,a=t.get("polyline");o.expandLine=!0;var s=function(t){return null!=t.radius?t.radius:null!=t.size?Math.max(t.size[0],t.size[1],t.size[2]):100}(r);o.segmentScale=s/20;var l="lineStyle.width".split("."),u=i.getDevicePixelRatio(),h=0;n.each((function(t){var e=n.getItemModel(t).get(l);null==e&&(e=1),n.setItemVisual(t,"lineWidth",e),h=Math.max(e,h)})),o.useNativeLine=!1;var c=0,d=0;n.each((function(t){var e=n.getItemLayout(t);a?(c+=o.getPolylineVertexCount(e),d+=o.getPolylineTriangleCount(e)):(c+=o.getCubicCurveVertexCount(e[0],e[1],e[2],e[3]),d+=o.getCubicCurveTriangleCount(e[0],e[1],e[2],e[3]))})),o.setVertexCount(c),o.setTriangleCount(d),o.resetOffset();var p=[];n.each((function(t){var e=n.getItemLayout(t),i=Eu(n,t),r=Nu(n,t),s=n.getItemVisual(t,"lineWidth")*u;null==r&&(r=1),(p=Jo.parseColor(i,p))[3]*=r,a?o.addPolyline(e,p,s):o.addCubicCurve(e[0],e[1],e[2],e[3],p,s)})),o.dirty()},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});function sd(t,e){for(var i=[],n=0;n0;this._updateSurfaceMesh(this._surfaceMesh,t,h,p);var f=this._surfaceMesh.material;p?(f.define("WIREFRAME_QUAD"),f.set("wireframeLineWidth",d),f.set("wireframeLineColor",Jo.parseColor(c.get("lineStyle.color")))):f.undefine("WIREFRAME_QUAD"),this._initHandler(t,i),this._updateAnimation(t)},_updateAnimation:function(t){Jo.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,t)},_createSurfaceMesh:function(){var t=new Jo.Mesh({geometry:new Jo.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new Jo.Material({shader:new Jo.Shader(Jo.Shader.source("ecgl.sm.depth.vertex"),Jo.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return t.geometry.createAttribute("barycentric","float",4),t.geometry.createAttribute("prevPosition","float",3),t.geometry.createAttribute("prevNormal","float",3),Object.assign(t.geometry,ku),t},_initHandler:function(t,e){var i=t.getData(),n=this._surfaceMesh,r=t.coordinateSystem;n.seriesIndex=t.seriesIndex;var o=-1;n.off("mousemove"),n.off("mouseout"),n.on("mousemove",(function(t){var a=function(t,e){for(var i=1/0,r=-1,o=[],a=0;a=0){var s=[];n.geometry.attributes.position.get(a,s);for(var l=r.pointToData(s),u=1/0,h=-1,c=[],d=0;d65535?Uint32Array:Uint16Array)((f-1)*(g-1)*6),w=function(t,e,i){i[1]=t*g+e,i[0]=t*g+e+1,i[3]=(t+1)*g+e+1,i[2]=(t+1)*g+e},S=!1;if(l){var T=[],M=[],C=0;m?h.init(r.vertexCount):h.value=null;for(var A=[[],[],[]],L=[],I=[],D=pd.create(),P=function(t,e,i){var n=3*e;return i[0]=t[n],i[1]=t[n+1],i[2]=t[n+2],i},O=new Float32Array(a.length),k=new Float32Array(a.length/3*4),E=0;E0;){if(Math.floor(s/h)===s/h)return[h,s/h];h--}return[h=Math.floor(Math.sqrt(s)),h]},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function gd(t,e){for(var i=[],n=0;n=0&&t.call(e,i[r],r)},t.prototype.eachEdge=function(t,e){for(var i=this.edges,n=i.length,r=0;r=0&&i[r].node1.dataIndex>=0&&i[r].node2.dataIndex>=0&&t.call(e,i[r],r)},t.prototype.breadthFirstTraverse=function(t,e,i,n){if(e instanceof Cd||(e=this._nodesMap[Td(e)]),e){for(var r="out"===i?"outEdges":"in"===i?"inEdges":"edges",o=0;o=0&&i.node2.dataIndex>=0})),r=0,o=n.length;r=0&&this[t][e].setItemVisual(this.dataIndex,i,n)},getVisual:function(i){return this[t][e].getItemVisual(this.dataIndex,i)},setLayout:function(i,n){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,i,n)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}}yo(Cd,Ld("hostGraph","data")),yo(Ad,Ld("hostGraph","edgeData"));const Id=Md;var Dd=va();function Pd(t,e){if(Dd(this).mainData===this){var i=vo({},Dd(this).datas);i[this.dataType]=e,Rd(e,i,t)}else zd(e,this.dataType,Dd(this).mainData,t);return e}function Od(t,e){return t.struct&&t.struct.update(),e}function kd(t,e){return xo(Dd(e).datas,(function(i,n){i!==e&&zd(i.cloneShallow(),n,e,t)})),e}function Ed(t){var e=Dd(this).mainData;return null==t||null==e?e:Dd(e).datas[t]}function Nd(){var t=Dd(this).mainData;return null==t?[{data:t}]:bo(wo(Dd(t).datas),(function(e){return{type:e,data:Dd(t).datas[e]}}))}function Rd(t,e,i){Dd(t).datas={},xo(e,(function(e,n){zd(e,n,t,i)}))}function zd(t,e,i,n){Dd(i).datas[e]=t,Dd(t).mainData=i,t.dataType=e,n.struct&&(t[n.structAttr]=n.struct,n.struct[n.datasAttr[e]]=t),t.getLinkedData=Ed,t.getLinkedDataAll=Nd}var Bd=n.SeriesModel.extend({type:"series.graphGL",visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,init:function(t){Bd.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this._updateCategoriesData()},mergeOption:function(t){Bd.superApply(this,"mergeOption",arguments),this._updateCategoriesData()},getFormattedLabel:function(t,e,i,n){var r=oc.getFormattedLabel(this,t,e,i,n);if(null==r){var o=this.getData(),a=o.dimensions[o.dimensions.length-1];r=o.get(a,t)}return r},getInitialData:function(t,e){var i=t.edges||t.links||[],r=t.data||t.nodes||[],o=this;if(r&&i)return function(t,e,i,r,o){for(var a=new Id(!0),s=0;s "+f)),c++)}var g=n.helper.createDimensions(t,{coordDimensions:["value"]});(l=new n.List(g,i)).initData(t);var m,v,y,_=new n.List(["value"],i);return _.initData(h,u),o&&o(l,_),v=(m={mainData:l,struct:a,structAttr:"graph",datas:{node:l,edge:_},datasAttr:{node:"data",edge:"edgeData"}}).mainData,(y=m.datas)||(y={main:v},m.datasAttr={main:"data"}),m.datas=m.mainData=null,Rd(v,y,m),xo(y,(function(t){xo(v.TRANSFERABLE_METHODS,(function(e){t.wrapMethod(e,So(Pd,m))}))})),v.wrapMethod("cloneShallow",So(kd,m)),xo(v.CHANGABLE_METHODS,(function(t){v.wrapMethod(t,So(Od,m))})),function(t,e){if(!t)throw new Error(void 0)}(y[v.dataType]===v),a.update(),a}(r,i,this,0,(function(t,i){t.wrapMethod("getItemModel",(function(t){const e=o._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));const n=e.getModel([]).getModel;function r(t,e){const i=n.call(this,t,e);return i.resolveParentPath=a,i}function a(t){if(t&&("label"===t[0]||"label"===t[1])){const e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}i.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=a,t.getModel=r,t}))})).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,i){if("edge"===i){var r=this.getData(),o=this.getDataParams(t,i),a=r.graph.getEdgeByIndex(t),s=r.getName(a.node1.dataIndex),l=r.getName(a.node2.dataIndex),u=[];return null!=s&&u.push(s),null!=l&&u.push(l),u=n.format.encodeHTML(u.join(" > ")),o.value&&(u+=" : "+n.format.encodeHTML(o.value)),u}return Bd.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=(this.option.categories||[]).map((function(t){return null!=t.value?t:Object.assign({value:0},t)})),e=new n.List(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t,!0)}))},setView:function(t){null!=t.zoom&&(this.option.zoom=t.zoom),null!=t.offset&&(this.option.offset=t.offset)},setNodePosition:function(t){for(var e=0;e65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(t){this.triangleCount!==t&&(this.indices=0===t?null:this.vertexCount>65535?new Uint32Array(3*t):new Uint16Array(3*t))},_getCubicCurveApproxStep:function(t,e,i,n){return 1/(Fd.dist(t,e)+Fd.dist(i,e)+Fd.dist(n,i)+1)*this.segmentScale},getCubicCurveVertexCount:function(t,e,i,n){var r=this._getCubicCurveApproxStep(t,e,i,n),o=Math.ceil(1/r);return this.useNativeLine?2*o:2*o+2},getCubicCurveTriangleCount:function(t,e,i,n){var r=this._getCubicCurveApproxStep(t,e,i,n),o=Math.ceil(1/r);return this.useNativeLine?0:2*o},getLineVertexCount:function(){return this.getPolylineVertexCount(Vd)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(Vd)},getPolylineVertexCount:function(t){var e;return e="number"==typeof t?t:"number"!=typeof t[0]?t.length:t.length/2,this.useNativeLine?2*(e-1):2*(e-1)+2},getPolylineTriangleCount:function(t){var e;return e="number"==typeof t?t:"number"!=typeof t[0]?t.length:t.length/2,this.useNativeLine?0:2*(e-1)},addCubicCurve:function(t,e,i,n,r,o){null==o&&(o=1);var a=t[0],s=t[1],l=e[0],u=e[1],h=i[0],c=i[1],d=n[0],p=n[1],f=this._getCubicCurveApproxStep(t,e,i,n),g=f*f,m=g*f,v=3*f,y=3*g,_=6*g,x=6*m,b=a-2*l+h,w=s-2*u+c,S=3*(l-h)-a+d,T=3*(u-c)-s+p,M=a,C=s,A=(l-a)*v+b*y+S*m,L=(u-s)*v+w*y+T*m,I=b*_+S*x,D=w*_+T*x,P=S*x,O=T*x,k=0,E=0,N=Math.ceil(1/f),R=new Float32Array(3*(N+1)),z=(R=[],0);for(E=0;E1&&(M=A>0?Math.min(M,d):Math.max(M,d),C=L>0?Math.min(C,p):Math.max(C,p));this.addPolyline(R,r,o)},addLine:function(t,e,i,n){this.addPolyline([t,e],i,n)},addPolyline:function(){var t=Fd.create(),e=Fd.create(),i=Fd.create(),n=Fd.create(),r=[],o=[],a=[];return function(s,l,u,h,c){if(s.length){var d="number"!=typeof s[0];if(null==c&&(c=d?s.length:s.length/2),!(c<2)){null==h&&(h=0),null==u&&(u=1),this._itemVertexOffsets.push(this._vertexOffset);for(var p,f=d?"number"!=typeof l[0]:l.length/4===c,g=this.attributes.position,m=this.attributes.color,v=this.attributes.offset,y=this.attributes.normal,_=this.indices,x=this._vertexOffset,b=0;b1&&(g.copy(x,x-1),m.copy(x,x-1),x++);else{var T;if(b0){Fd.sub(t,r,a),Fd.sub(e,o,r),Fd.normalize(t,t),Fd.normalize(e,e),Fd.add(n,t,e),Fd.normalize(n,n);var M=u/2*Math.min(1/Fd.dot(t,n),2);i[0]=-n[1],i[1]=n[0],T=M}else Fd.sub(t,o,r),Fd.normalize(t,t),i[0]=-t[1],i[1]=t[0],T=u/2;else Fd.sub(t,r,a),Fd.normalize(t,t),i[0]=-t[1],i[1]=t[0],T=u/2;y.set(x,i),y.set(x+1,i),v.set(x,T),v.set(x+1,-T),Fd.copy(a,r),g.set(x,r),g.set(x+1,r),m.set(x,p),m.set(x+1,p),x+=2}if(this.useNativeLine)m.set(x,p),g.set(x,r),x++;else if(b>0){var C=3*this._faceOffset;(_=this.indices)[C]=x-4,_[C+1]=x-3,_[C+2]=x-2,_[C+3]=x-3,_[C+4]=x-1,_[C+5]=x-2,this._faceOffset+=2}}this._vertexOffset=x}}}}(),setItemColor:function(t,e){for(var i=this._itemVertexOffsets[t],n=t 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end");var Ud={repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null};function Wd(t){var e={type:Jo.Texture.FLOAT,minFilter:Jo.Texture.NEAREST,magFilter:Jo.Texture.NEAREST};this._positionSourceTex=new Jo.Texture2D(e),this._positionSourceTex.flipY=!1,this._positionTex=new Jo.Texture2D(e),this._positionPrevTex=new Jo.Texture2D(e),this._forceTex=new Jo.Texture2D(e),this._forcePrevTex=new Jo.Texture2D(e),this._weightedSumTex=new Jo.Texture2D(e),this._weightedSumTex.width=this._weightedSumTex.height=1,this._globalSpeedTex=new Jo.Texture2D(e),this._globalSpeedPrevTex=new Jo.Texture2D(e),this._globalSpeedTex.width=this._globalSpeedTex.height=1,this._globalSpeedPrevTex.width=this._globalSpeedPrevTex.height=1,this._nodeRepulsionPass=new fr({fragment:Jo.Shader.source("ecgl.forceAtlas2.updateNodeRepulsion")}),this._positionPass=new fr({fragment:Jo.Shader.source("ecgl.forceAtlas2.updatePosition")}),this._globalSpeedPass=new fr({fragment:Jo.Shader.source("ecgl.forceAtlas2.calcGlobalSpeed")}),this._copyPass=new fr({fragment:Jo.Shader.source("clay.compositor.output")});var i=function(t){t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE)};this._edgeForceMesh=new Jo.Mesh({geometry:new Jo.Geometry({attributes:{node1:new Jo.Geometry.Attribute("node1","float",2),node2:new Jo.Geometry.Attribute("node2","float",2),weight:new Jo.Geometry.Attribute("weight","float",1)},dynamic:!0,mainAttribute:"node1"}),material:new Jo.Material({transparent:!0,shader:Jo.createShader("ecgl.forceAtlas2.updateEdgeAttraction"),blend:i,depthMask:!1,depthText:!1}),mode:Jo.Mesh.POINTS}),this._weightedSumMesh=new Jo.Mesh({geometry:new Jo.Geometry({attributes:{node:new Jo.Geometry.Attribute("node","float",2)},dynamic:!0,mainAttribute:"node"}),material:new Jo.Material({transparent:!0,shader:Jo.createShader("ecgl.forceAtlas2.calcWeightedSum"),blend:i,depthMask:!1,depthText:!1}),mode:Jo.Mesh.POINTS}),this._framebuffer=new Zn({depthBuffer:!1}),this._dummyCamera=new Jo.OrthographicCamera({left:-1,right:1,top:1,bottom:-1,near:0,far:100}),this._globalSpeed=0}Wd.prototype.updateOption=function(t){for(var e in Ud)this[e]=Ud[e];var i=this._nodes.length;if(this.jitterTolerence=i>5e4?10:i>5e3?1:.1,this.scaling=i>100?2:10,t)for(var e in Ud)null!=t[e]&&(this[e]=t[e]);if(this.repulsionByDegree)for(var n=this._positionSourceTex.pixels,r=0;rt},Wd.prototype._swapTexture=function(){var t=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=t,t=this._forcePrevTex,this._forcePrevTex=this._forceTex,this._forceTex=t,t=this._globalSpeedPrevTex,this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=t},Wd.prototype._initFromSource=function(t){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(t),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(t),t.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),t.gl.clear(t.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(t)},Wd.prototype._resize=function(t,e){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach((function(i){this[i].width=t,this[i].height=e,this[i].dirty()}),this)},Wd.prototype.dispose=function(t){this._framebuffer.dispose(t),this._copyPass.dispose(t),this._nodeRepulsionPass.dispose(t),this._positionPass.dispose(t),this._globalSpeedPass.dispose(t),this._edgeForceMesh.geometry.dispose(t),this._weightedSumMesh.geometry.dispose(t),this._positionSourceTex.dispose(t),this._positionTex.dispose(t),this._positionPrevTex.dispose(t),this._forceTex.dispose(t),this._forcePrevTex.dispose(t),this._weightedSumTex.dispose(t),this._globalSpeedTex.dispose(t),this._globalSpeedPrevTex.dispose(t)};const jd=Wd;var Xd=function(){var t=function(){return new Float32Array(2)},e=function(t,e){var i=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(i*i+n*n)},i=function(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)},n=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t},r=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},o=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t},a=function(t,e,i){return t[0]=e,t[1]=i,t};function s(){this.subRegions=[],this.nSubRegions=0,this.node=null,this.mass=0,this.centerOfMass=null,this.bbox=new Float32Array(4),this.size=0}var l=s.prototype;function u(){this.position=new Float32Array(2),this.force=t(),this.forcePrev=t(),this.mass=1,this.inDegree=0,this.outDegree=0}function h(t,e){this.source=t,this.target=e,this.weight=1}function c(){this.autoSettings=!0,this.barnesHutOptimize=!0,this.barnesHutTheta=1.5,this.repulsionByDegree=!0,this.linLogMode=!1,this.strongGravityMode=!1,this.gravity=1,this.scaling=1,this.edgeWeightInfluence=1,this.jitterTolerence=.1,this.preventOverlap=!1,this.dissuadeHubs=!1,this.rootRegion=new s,this.rootRegion.centerOfMass=t(),this.nodes=[],this.edges=[],this.bbox=new Float32Array(4),this.gravityCenter=null,this._massArr=null,this._swingingArr=null,this._sizeArr=null,this._globalSpeed=0}l.beforeUpdate=function(){for(var t=0;t=t&&this.bbox[1]<=e&&this.bbox[3]>=e},l.setBBox=function(t,e,i,n){this.bbox[0]=t,this.bbox[1]=e,this.bbox[2]=i,this.bbox[3]=n,this.size=(i-t+n-e)/2},l._newSubRegion=function(){var t=this.subRegions[this.nSubRegions];return t||(t=new s,this.subRegions[this.nSubRegions]=t),this.nSubRegions++,t},l._addNodeToSubRegion=function(t){var e=this.findSubRegion(t.position[0],t.position[1]),i=this.bbox;if(!e){var n=(i[0]+i[2])/2,r=(i[1]+i[3])/2,o=(i[2]-i[0])/2,a=(i[3]-i[1])/2,s=t.position[0]>=n?1:0,l=t.position[1]>=r?1:0;(e=this._newSubRegion()).setBBox(s*o+i[0],l*a+i[1],(s+1)*o+i[0],(l+1)*a+i[1])}e.addNode(t)},l._updateCenterOfMass=function(t){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var e=this.centerOfMass[0]*this.mass,i=this.centerOfMass[1]*this.mass;e+=t.position[0]*t.mass,i+=t.position[1]*t.mass,this.mass+=t.mass,this.centerOfMass[0]=e/this.mass,this.centerOfMass[1]=i/this.mass};var d=c.prototype;d.initNodes=function(t,e,i){var n=e.length;this.nodes.length=0;for(var r=void 0!==i,o=0;o0&&(this.strongGravityMode?this.applyNodeStrongGravity(c):this.applyNodeGravity(c))}for(u=0;u0&&(v=Math.min(v/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=v,u=0;u0&&(_=Math.min(x*_,10)/x,n(h.position,h.position,h.force,_))}},d.applyRegionToNodeRepulsion=function(){var e=t();return function(t,i){if(t.node)this.applyNodeToNodeRepulsion(t.node,i,!0);else{o(e,i.position,t.centerOfMass);var r=e[0]*e[0]+e[1]*e[1];if(r>this.barnesHutTheta*t.size*t.size){var a=this.scaling*i.mass*t.mass/r;n(i.force,i.force,e,a)}else for(var s=0;s0)s=this.scaling*t.mass*i.mass/(l*l);else{if(!(l<0))return;s=100*this.scaling*t.mass*i.mass}}else s=this.scaling*t.mass*i.mass/a;n(t.force,t.force,e,s),n(i.force,i.force,e,-s)}}}}(),d.applyEdgeAttraction=function(){var e=t();return function(t){var r=t.source,a=t.target;o(e,r.position,a.position);var s,l,u=i(e);s=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?t.weight:Math.pow(t.weight,this.edgeWeightInfluence),this.preventOverlap&&(u=u-r.size-a.size)<=0||(l=this.linLogMode?-s*Math.log(u+1)/(u+1):-s,n(r.force,r.force,e,l),n(a.force,a.force,e,-l))}}(),d.applyNodeGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position);var r=i(e);n(t.force,t.force,e,this.gravity*t.mass/(r+1))}}(),d.applyNodeStrongGravity=function(){var e=t();return function(t){o(e,this.gravityCenter,t.position),n(t.force,t.force,e,this.gravity*t.mass)}}(),d.updateBBox=function(){for(var t=1/0,e=1/0,i=-1/0,n=-1/0,r=0;r5e4?10:o>5e3?1:.1,e.scaling=o>100?2:10,e.barnesHutOptimize=o>1e3,t)for(var i in Yd)null!=t[i]&&(e[i]=t[i]);if(!e.gravityCenter){for(var a=[1/0,1/0],s=[-1/0,-1/0],l=0;lt},qd.prototype.getNodePosition=function(t,e){if(e||(e=new Float32Array(2*this._nodes.length)),this._positionArr)for(var i=0;i0?1.1:.9,o=Math.max(Math.min(this._zoom*r,this.maxZoom),this.minZoom);r=o/this._zoom;var a=this._convertPos(i,n),s=(a.x-this._dx)*(r-1),l=(a.y-this._dy)*(r-1);this._dx-=s,this._dy-=l,this._zoom=o,this._needsUpdate=!0}}},dispose:function(){var t=this.zr;t.off("mousedown",this._mouseDownHandler),t.off("mousemove",this._mouseMoveHandler),t.off("mouseup",this._mouseUpHandler),t.off("mousewheel",this._mouseWheelHandler),t.off("globalout",this._mouseUpHandler),t.animation.off("frame",this._update)}});var Qd=Pa.vec2;Jo.Shader.import("@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end");var $d=1;const tp=n.ChartView.extend({type:"graphGL",__ecgl__:!0,init:function(t,e){this.groupGL=new Jo.Node,this.viewGL=new El("orthographic"),this.viewGL.camera.left=this.viewGL.camera.right=0,this.viewGL.add(this.groupGL),this._pointsBuilder=new zc(!0,e),this._forceEdgesMesh=new Jo.Mesh({material:new Jo.Material({shader:Jo.createShader("ecgl.forceAtlas2.edges"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new Jo.Geometry({attributes:{node:new Jo.Geometry.Attribute("node","float",2),color:new Jo.Geometry.Attribute("color","float",4,"COLOR")},dynamic:!0,mainAttribute:"node"}),renderOrder:-1,mode:Jo.Mesh.LINES}),this._edgesMesh=new Jo.Mesh({material:new Jo.Material({shader:Jo.createShader("ecgl.meshLines2D"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new Hd({useNativeLine:!1,dynamic:!0}),renderOrder:-1,culling:!1}),this._layoutId=0,this._control=new Jd({zr:e.getZr(),viewGL:this.viewGL}),this._control.setTarget(this.groupGL),this._control.init(),this._clickHandler=this._clickHandler.bind(this)},render:function(t,e,i){this.groupGL.add(this._pointsBuilder.rootNode),this._model=t,this._api=i,this._initLayout(t,e,i),this._pointsBuilder.update(t,e,i),this._forceLayoutInstance instanceof jd||this.groupGL.remove(this._forceEdgesMesh),this._updateCamera(t,i),this._control.off("update"),this._control.on("update",(function(){i.dispatchAction({type:"graphGLRoam",seriesId:t.id,zoom:this._control.getZoom(),offset:this._control.getOffset()}),this._pointsBuilder.updateView(this.viewGL.camera)}),this),this._control.setZoom(Mr(t.get("zoom"),1)),this._control.setOffset(t.get("offset")||[0,0]);var n=this._pointsBuilder.getPointsMesh();if(n.off("mousemove",this._mousemoveHandler),n.off("mouseout",this._mouseOutHandler,this),i.getZr().off("click",this._clickHandler),this._pointsBuilder.highlightOnMouseover=!0,t.get("focusNodeAdjacency")){var r=t.get("focusNodeAdjacencyOn");"click"===r?i.getZr().on("click",this._clickHandler):"mouseover"===r&&(n.on("mousemove",this._mousemoveHandler,this),n.on("mouseout",this._mouseOutHandler,this),this._pointsBuilder.highlightOnMouseover=!1)}this._lastMouseOverDataIndex=-1},_clickHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(t){if(!this._layouting){var e=this._pointsBuilder.getPointsMesh().dataIndex;e>=0?e!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:e}):this._mouseOutHandler(t),this._lastMouseOverDataIndex=e}},_mouseOutHandler:function(t){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(t,e){var i=this._forceEdgesMesh.geometry,n=e.getEdgeData(),r=0,o=this._forceLayoutInstance,a=2*n.count();i.attributes.node.init(a),i.attributes.color.init(a),n.each((function(e){var a=t[e];i.attributes.node.set(r,o.getNodeUV(a.node1)),i.attributes.node.set(r+1,o.getNodeUV(a.node2));var s=Eu(n,a.dataIndex),l=Jo.parseColor(s);l[3]*=Mr(Nu(n,a.dataIndex),1),i.attributes.color.set(r,l),i.attributes.color.set(r+1,l),r+=2})),i.dirty()},_updateMeshLinesGeometry:function(){var t=this._model.getEdgeData(),e=this._edgesMesh.geometry,i=(t=this._model.getEdgeData(),this._model.getData().getLayout("points"));e.resetOffset(),e.setVertexCount(t.count()*e.getLineVertexCount()),e.setTriangleCount(t.count()*e.getLineTriangleCount());var n=[],r=[],o=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*t.count()),this._edgeIndicesMap=new Float32Array(t.count()),t.each((function(a){var s=t.graph.getEdgeByIndex(a),l=2*s.node1.dataIndex,u=2*s.node2.dataIndex;n[0]=i[l],n[1]=i[l+1],r[0]=i[u],r[1]=i[u+1];var h=Eu(t,s.dataIndex),c=Jo.parseColor(h);c[3]*=Mr(Nu(t,s.dataIndex),1);var d=t.getItemModel(s.dataIndex),p=Mr(d.get(o),1)*this._api.getDevicePixelRatio();e.addLine(n,r,c,p);for(var f=0;f<4;f++)this._originalEdgeColors[4*s.dataIndex+f]=c[f];this._edgeIndicesMap[s.dataIndex]=a}),this),e.dirty()},_updateForceNodesGeometry:function(t){for(var e=this._pointsBuilder.getPointsMesh(),i=[],n=0;n=p&&(l._syncNodePosition(t),d=0),i.getZr().refresh(),Qo((function(){f(e)}))}))};Qo((function(){l._forceLayoutInstanceToDispose&&(l._forceLayoutInstanceToDispose.dispose(r.layer.renderer),l._forceLayoutInstanceToDispose=null),f(u)})),this._layouting=!0}}},stopLayout:function(t,e,i,n){n&&null!=n.from&&n.from!==this.uid||(this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(n&&n.beforeLayout||(this._syncNodePosition(t),this._updateAfterLayout(t,e,i)),this._api.getZr().refresh(),this._layouting=!1))},_syncNodePosition:function(t){var e=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);t.getData().setLayout("points",e),t.setNodePosition(e)},_updateAfterLayout:function(t,e,i){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(t,e,i),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(t,e,i,n){var r=this._model.getData();this._downplayAll();var o=n.dataIndex,a=r.graph,s=[],l=a.getNodeByIndex(o);s.push(l),l.edges.forEach((function(t){t.dataIndex<0||(t.node1!==l&&s.push(t.node1),t.node2!==l&&s.push(t.node2))}),this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach((function(t){this._pointsBuilder.highlight(r,t.dataIndex)}),this),this._pointsBuilder.updateLabels(s.map((function(t){return t.dataIndex})));var u=[];l.edges.forEach((function(t){t.dataIndex>=0&&(this._highlightEdge(t.dataIndex),u.push(t))}),this),this._focusNodes=s,this._focusEdges=u},unfocusNodeAdjacency:function(t,e,i,n){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(t){var e=this._model.getEdgeData().getItemModel(t),i=Jo.parseColor(e.get("emphasis.lineStyle.color")||e.get("lineStyle.color")),n=Mr(e.get("emphasis.lineStyle.opacity"),e.get("lineStyle.opacity"),1);i[3]*=n,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],i)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach((function(t){this._pointsBuilder.downplay(this._model.getData(),t.dataIndex)}),this),this._focusEdges&&this._focusEdges.forEach((function(t){this._downplayEdge(t.dataIndex)}),this)},_downplayEdge:function(t){var e=this._getColor(t,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],e)},_setEdgeFade:(ep=[],function(t,e){this._getColor(t,ep),ep[3]*=e,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[t],ep)}),_getColor:function(t,e){for(var i=0;i<4;i++)e[i]=this._originalEdgeColors[4*t+i];return e},_fadeOutEdgesAll:function(t){this._model.getData().graph.eachEdge((function(e){this._setEdgeFade(e.dataIndex,t)}),this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(t,e){this.viewGL.setViewport(0,0,e.getWidth(),e.getHeight(),e.getDevicePixelRatio());for(var i=this.viewGL.camera,n=t.getData().getLayout("points"),r=Qd.create(1/0,1/0),o=Qd.create(-1/0,-1/0),a=[],s=0;si.left&&ui.top)){var h=Math.max(o[0]-r[0],10),c=h/e.getWidth()*e.getHeight();h*=1.4,c*=1.4,r[0]-=.2*h,i.left=r[0],i.top=l-c/2,i.bottom=l+c/2,i.right=h+r[0],i.near=0,i.far=100}},dispose:function(){var t=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(t),this.groupGL.removeAll(),this._layoutId=-1,this._pointsBuilder.dispose()},remove:function(){this.groupGL.removeAll(),this._control.dispose()}});var ep;function ip(t){return t instanceof Array||(t=[t,t]),t}(0,n.use)((function(t){function e(){}t.registerChartView(tp),t.registerSeriesModel(Zd),t.registerVisual((function(t){const e={};t.eachSeriesByType("graphGL",(function(t){var i=t.getCategoriesData(),r=t.getData(),o={};i.each((function(n){var r=i.getName(n);o["ec-"+r]=n;var a=i.getItemModel(n),s=a.getModel("itemStyle").getItemStyle();s.fill||(s.fill=t.getColorFromPalette(r,e)),i.setItemVisual(n,"style",s);var l=["symbol","symbolSize","symbolKeepAspect"];for(let t=0;t65535?new Uint32Array(3*n):new Uint16Array(3*n))},addLine:function(t){var e=this._vertexOffset;this.attributes.position.set(e,[t[0],t[1],1]),this.attributes.position.set(e+1,[t[0],t[1],-1]),this.attributes.position.set(e+2,[t[0],t[1],2]),this.attributes.position.set(e+3,[t[0],t[1],-2]),this.setTriangleIndices(this._faceOffset++,[e,e+1,e+2]),this.setTriangleIndices(this._faceOffset++,[e+1,e+2,e+3]),this._vertexOffset+=4}});jt.import("@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n");var op=function(){this.motionBlurFactor=.99,this.vectorFieldTexture=new Ii({type:wi.FLOAT,flipY:!1}),this.particleLife=[5,20],this._particleType="point",this._particleSize=1,this.particleColor=[1,1,1,1],this.particleSpeedScaling=1,this._thisFrameTexture=null,this._particlePass=null,this._spawnTexture=null,this._particleTexture0=null,this._particleTexture1=null,this._particlePointsMesh=null,this._surfaceFrameBuffer=null,this._elapsedTime=0,this._scene=null,this._camera=null,this._lastFrameTexture=null,this._supersampling=1,this._downsampleTextures=[],this._width=512,this._height=512,this.init()};op.prototype={constructor:op,init:function(){var t={type:wi.FLOAT,minFilter:wi.NEAREST,magFilter:wi.NEAREST,useMipmap:!1};this._spawnTexture=new Ii(t),this._particleTexture0=new Ii(t),this._particleTexture1=new Ii(t),this._frameBuffer=new Zn({depthBuffer:!1}),this._particlePass=new fr({fragment:jt.source("ecgl.vfParticle.particle.fragment")}),this._particlePass.setUniform("velocityTexture",this.vectorFieldTexture),this._particlePass.setUniform("spawnTexture",this._spawnTexture),this._downsamplePass=new fr({fragment:jt.source("clay.compositor.downsample")});var e=new Ti({renderOrder:10,material:new lt({shader:new jt(jt.source("ecgl.vfParticle.renderPoints.vertex"),jt.source("ecgl.vfParticle.renderPoints.fragment"))}),mode:Ti.POINTS,geometry:new Gi({dynamic:!0,mainAttribute:"texcoord0"})}),i=new Ti({renderOrder:10,material:new lt({shader:new jt(jt.source("ecgl.vfParticle.renderLines.vertex"),jt.source("ecgl.vfParticle.renderLines.fragment"))}),geometry:new rp,culling:!1}),n=new Ti({material:new lt({shader:new jt(jt.source("ecgl.color.vertex"),jt.source("ecgl.color.fragment"))}),geometry:new Gn});n.material.enableTexture("diffuseMap"),this._particlePointsMesh=e,this._particleLinesMesh=i,this._lastFrameFullQuadMesh=n,this._camera=new hr,this._thisFrameTexture=new Ii,this._lastFrameTexture=new Ii},setParticleDensity:function(t,e){for(var i=new Float32Array(t*e*4),n=0,r=this.particleLife,o=0;o0?t[t.length-1]:this._lastFrameTexture},setRegion:function(t){this._particlePass.setUniform("region",t)},resize:function(t,e){this._lastFrameTexture.width=t*this._supersampling,this._lastFrameTexture.height=e*this._supersampling,this._thisFrameTexture.width=t*this._supersampling,this._thisFrameTexture.height=e*this._supersampling,this._width=t,this._height=e},setParticleSize:function(t){var e=this._getParticleMesh();if(t<=2)return e.material.disableTexture("spriteTexture"),void(e.material.transparent=!1);this._spriteTexture||(this._spriteTexture=new Ii),this._spriteTexture.image&&this._spriteTexture.image.width===t||(this._spriteTexture.image=function(t){var e=document.createElement("canvas");e.width=e.height=t;var i=e.getContext("2d");return i.fillStyle="#fff",i.arc(t/2,t/2,t/2,0,2*Math.PI),i.fill(),e}(t),this._spriteTexture.dirty()),e.material.transparent=!0,e.material.enableTexture("spriteTexture"),e.material.set("spriteTexture",this._spriteTexture),this._particleSize=t},setGradientTexture:function(t){var e=this._getParticleMesh().material;e[t?"enableTexture":"disableTexture"]("gradientTexture"),e.setUniform("gradientTexture",t)},setColorTextureImage:function(t,e){this._getParticleMesh().material.setTextureImage("colorTexture",t,e,{flipY:!0})},setParticleType:function(t){this._particleType=t},clearFrame:function(t){var e=this._frameBuffer;e.attach(this._lastFrameTexture),e.bind(t),t.gl.clear(t.gl.DEPTH_BUFFER_BIT|t.gl.COLOR_BUFFER_BIT),e.unbind(t)},setSupersampling:function(t){this._supersampling=t,this.resize(this._width,this._height)},_updateDownsampleTextures:function(t,e){for(var i=this._downsampleTextures,n=Math.max(Math.floor(Math.log(this._supersampling/e.getDevicePixelRatio())/Math.log(2)),0),r=2,o=this._width*this._supersampling,a=this._height*this._supersampling,s=0;s=359&&(r[0]>0&&(r[0]=0),o[0]1?(e.material.shader!==this._meshLinesShader&&e.material.attachShader(this._meshLinesShader),e.mode=Jo.Mesh.TRIANGLES):(e.material.shader!==this._nativeLinesShader&&e.material.attachShader(this._nativeLinesShader),e.mode=Jo.Mesh.LINES),i=i||0,n=n||r.count(),s.resetOffset();var h=0,c=0,d=[],p=[],f=[],g=[],m=[],v=.3,y=.7;function _(){p[0]=d[0]*y+g[0]*v-(d[1]-g[1])*o,p[1]=d[1]*y+g[1]*v-(g[0]-d[0])*o,f[0]=d[0]*v+g[0]*y-(d[1]-g[1])*o,f[1]=d[1]*v+g[1]*y-(g[0]-d[0])*o}if(a||0!==o)for(var x=i;x{t.exports=n}},e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}return i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(468)})())},9827:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var n=i(7537),r=i.n(n),o=i(3645),a=i.n(o)()(r());a.push([t.id,'.marker-cluster-small {\n\tbackground-color: rgba(181, 226, 140, 0.6);\n\t}\n.marker-cluster-small div {\n\tbackground-color: rgba(110, 204, 57, 0.6);\n\t}\n\n.marker-cluster-medium {\n\tbackground-color: rgba(241, 211, 87, 0.6);\n\t}\n.marker-cluster-medium div {\n\tbackground-color: rgba(240, 194, 12, 0.6);\n\t}\n\n.marker-cluster-large {\n\tbackground-color: rgba(253, 156, 115, 0.6);\n\t}\n.marker-cluster-large div {\n\tbackground-color: rgba(241, 128, 23, 0.6);\n\t}\n\n\t/* IE 6-8 fallback colors */\n.leaflet-oldie .marker-cluster-small {\n\tbackground-color: rgb(181, 226, 140);\n\t}\n.leaflet-oldie .marker-cluster-small div {\n\tbackground-color: rgb(110, 204, 57);\n\t}\n\n.leaflet-oldie .marker-cluster-medium {\n\tbackground-color: rgb(241, 211, 87);\n\t}\n.leaflet-oldie .marker-cluster-medium div {\n\tbackground-color: rgb(240, 194, 12);\n\t}\n\n.leaflet-oldie .marker-cluster-large {\n\tbackground-color: rgb(253, 156, 115);\n\t}\n.leaflet-oldie .marker-cluster-large div {\n\tbackground-color: rgb(241, 128, 23);\n}\n\n.marker-cluster {\n\tbackground-clip: padding-box;\n\tborder-radius: 20px;\n\t}\n.marker-cluster div {\n\twidth: 30px;\n\theight: 30px;\n\tmargin-left: 5px;\n\tmargin-top: 5px;\n\n\ttext-align: center;\n\tborder-radius: 15px;\n\tfont: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;\n\t}\n.marker-cluster span {\n\tline-height: 30px;\n\t}',"",{version:3,sources:["webpack://./node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css"],names:[],mappings:"AAAA;CACC,0CAA0C;CAC1C;AACD;CACC,yCAAyC;CACzC;;AAED;CACC,yCAAyC;CACzC;AACD;CACC,yCAAyC;CACzC;;AAED;CACC,0CAA0C;CAC1C;AACD;CACC,yCAAyC;CACzC;;CAEA,2BAA2B;AAC5B;CACC,oCAAoC;CACpC;AACD;CACC,mCAAmC;CACnC;;AAED;CACC,mCAAmC;CACnC;AACD;CACC,mCAAmC;CACnC;;AAED;CACC,oCAAoC;CACpC;AACD;CACC,mCAAmC;AACpC;;AAEA;CACC,4BAA4B;CAC5B,mBAAmB;CACnB;AACD;CACC,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,eAAe;;CAEf,kBAAkB;CAClB,mBAAmB;CACnB,yDAAyD;CACzD;AACD;CACC,iBAAiB;CACjB",sourcesContent:['.marker-cluster-small {\n\tbackground-color: rgba(181, 226, 140, 0.6);\n\t}\n.marker-cluster-small div {\n\tbackground-color: rgba(110, 204, 57, 0.6);\n\t}\n\n.marker-cluster-medium {\n\tbackground-color: rgba(241, 211, 87, 0.6);\n\t}\n.marker-cluster-medium div {\n\tbackground-color: rgba(240, 194, 12, 0.6);\n\t}\n\n.marker-cluster-large {\n\tbackground-color: rgba(253, 156, 115, 0.6);\n\t}\n.marker-cluster-large div {\n\tbackground-color: rgba(241, 128, 23, 0.6);\n\t}\n\n\t/* IE 6-8 fallback colors */\n.leaflet-oldie .marker-cluster-small {\n\tbackground-color: rgb(181, 226, 140);\n\t}\n.leaflet-oldie .marker-cluster-small div {\n\tbackground-color: rgb(110, 204, 57);\n\t}\n\n.leaflet-oldie .marker-cluster-medium {\n\tbackground-color: rgb(241, 211, 87);\n\t}\n.leaflet-oldie .marker-cluster-medium div {\n\tbackground-color: rgb(240, 194, 12);\n\t}\n\n.leaflet-oldie .marker-cluster-large {\n\tbackground-color: rgb(253, 156, 115);\n\t}\n.leaflet-oldie .marker-cluster-large div {\n\tbackground-color: rgb(241, 128, 23);\n}\n\n.marker-cluster {\n\tbackground-clip: padding-box;\n\tborder-radius: 20px;\n\t}\n.marker-cluster div {\n\twidth: 30px;\n\theight: 30px;\n\tmargin-left: 5px;\n\tmargin-top: 5px;\n\n\ttext-align: center;\n\tborder-radius: 15px;\n\tfont: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;\n\t}\n.marker-cluster span {\n\tline-height: 30px;\n\t}'],sourceRoot:""}]);const s=a},7785:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var n=i(7537),r=i.n(n),o=i(3645),a=i.n(o)()(r());a.push([t.id,".leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {\n\t-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;\n\t-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;\n\t-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;\n\ttransition: transform 0.3s ease-out, opacity 0.3s ease-in;\n}\n\n.leaflet-cluster-spider-leg {\n\t/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */\n\t-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;\n\t-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;\n\t-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;\n\ttransition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;\n}\n","",{version:3,sources:["webpack://./node_modules/leaflet.markercluster/dist/MarkerCluster.css"],names:[],mappings:"AAAA;CACC,yEAAyE;CACzE,mEAAmE;CACnE,+DAA+D;CAC/D,yDAAyD;AAC1D;;AAEA;CACC,2HAA2H;CAC3H,gGAAgG;CAChG,uFAAuF;CACvF,iFAAiF;CACjF,wEAAwE;AACzE",sourcesContent:[".leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {\n\t-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;\n\t-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;\n\t-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;\n\ttransition: transform 0.3s ease-out, opacity 0.3s ease-in;\n}\n\n.leaflet-cluster-spider-leg {\n\t/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */\n\t-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;\n\t-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;\n\t-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;\n\ttransition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;\n}\n"],sourceRoot:""}]);const s=a},3645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,n,r,o){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(n)for(var s=0;s0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=o),i&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=i):h[2]=i),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),e.push(h))}},e}},7537:t=>{"use strict";t.exports=function(t){var e=t[1],i=t[3];if(!i)return e;if("function"==typeof btoa){var n=btoa(unescape(encodeURIComponent(JSON.stringify(i)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(n),o="/*# ".concat(r," */"),a=i.sources.map((function(t){return"/*# sourceURL=".concat(i.sourceRoot||"").concat(t," */")}));return[e].concat(a).concat([o]).join("\n")}return[e].join("\n")}},481:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Axis:()=>r.RD,ChartView:()=>r.TA,ComponentModel:()=>r.tF,ComponentView:()=>r.Ir,List:()=>r.aV,Model:()=>r.Hn,PRIORITY:()=>r.Hr,SeriesModel:()=>r.wJ,color:()=>r.$_,connect:()=>r.$j,dataTool:()=>r.Ok,dependencies:()=>r.HO,disConnect:()=>r.eU,disconnect:()=>r.zP,dispose:()=>r.B9,env:()=>r.OB,extendChartView:()=>r.Zy,extendComponentModel:()=>r.tv,extendComponentView:()=>r.Sp,extendSeriesModel:()=>r.Zr,format:()=>r.WU,getCoordinateSystemDimensions:()=>r.wL,getInstanceByDom:()=>r.JE,getInstanceById:()=>r.rp,getMap:()=>r.FU,graphic:()=>r.Q,helper:()=>r._y,init:()=>r.S1,innerDrawElementOnCanvas:()=>r.z$,matrix:()=>r.pI,number:()=>r.Rx,parseGeoJSON:()=>r.Nu,parseGeoJson:()=>r.pQ,registerAction:()=>r.zl,registerCoordinateSystem:()=>r.RS,registerLayout:()=>r.qR,registerLoading:()=>r.yn,registerLocale:()=>r.I2,registerMap:()=>r.je,registerPostInit:()=>r.sq,registerPostUpdate:()=>r.Br,registerPreprocessor:()=>r.ds,registerProcessor:()=>r.Pu,registerTheme:()=>r.aW,registerTransform:()=>r.rV,registerUpdateLifecycle:()=>r.YK,registerVisual:()=>r.Og,setCanvasCreator:()=>r.jQ,setPlatformAPI:()=>r.g2,throttle:()=>r.P2,time:()=>r.XV,use:()=>r.D$,util:()=>r.D5,vector:()=>r.xr,version:()=>r.i8,zrUtil:()=>r.gf,zrender:()=>r.x_});var n=i(8023),r=i(9060),o=i(2488),a=i(2874),s=i(8751),l=i(4276),u=i(9979),h=i(7472),c=Math.sin,d=Math.cos,p=Math.PI,f=2*Math.PI,g=180/p,m=function(){function t(){}return t.prototype.reset=function(t){this._start=!0,this._d=[],this._str="",this._p=Math.pow(10,t||4)},t.prototype.moveTo=function(t,e){this._add("M",t,e)},t.prototype.lineTo=function(t,e){this._add("L",t,e)},t.prototype.bezierCurveTo=function(t,e,i,n,r,o){this._add("C",t,e,i,n,r,o)},t.prototype.quadraticCurveTo=function(t,e,i,n){this._add("Q",t,e,i,n)},t.prototype.arc=function(t,e,i,n,r,o){this.ellipse(t,e,i,i,0,n,r,o)},t.prototype.ellipse=function(t,e,i,n,r,o,s,l){var u=s-o,h=!l,m=Math.abs(u),v=(0,a.zT)(m-f)||(h?u>=f:-u>=f),y=u>0?u%f:u%f+f,_=!1;_=!!v||!(0,a.zT)(m)&&y>=p==!!h;var x=t+i*d(o),b=e+n*c(o);this._start&&this._add("M",x,b);var w=Math.round(r*g);if(v){var S=1/this._p,T=(h?1:-1)*(f-S);this._add("A",i,n,w,1,+h,t+i*d(o+T),e+n*c(o+T)),S>.01&&this._add("A",i,n,w,0,+h,x,b)}else{var M=t+i*d(s),C=e+n*c(s);this._add("A",i,n,w,+_,+h,M,C)}},t.prototype.rect=function(t,e,i,n){this._add("M",t,e),this._add("l",i,0),this._add("l",0,n),this._add("l",-i,0),this._add("Z")},t.prototype.closePath=function(){this._d.length>0&&this._add("Z")},t.prototype._add=function(t,e,i,n,r,o,a,s,l){for(var u=[],h=this._p,c=1;c"}(r,e.attrs)+(0,M.F1)(e.text)+(n?""+i+(0,_.map)(n,(function(e){return t(e)})).join(i)+i:"")+("")}(t)}function P(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssClassIdx:0,cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function O(t,e,i,n){return I("svg","root",{width:t,height:e,xmlns:C,"xmlns:xlink":A,version:"1.1",baseProfile:"full",viewBox:!!n&&"0 0 "+t+" "+e},i)}var k=i(8819),E=i(4995),N=i(2604),R=i(89),z=i(826),B={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"},Z="transform-origin";function F(t,e,i){var n=(0,_.extend)({},t.shape);(0,_.extend)(n,e),t.buildPath(i,n);var r=new v;return r.reset((0,a.Gk)(t)),i.rebuildPath(r,1),r.generateStr(),r.getStr()}function V(t,e){var i=e.originX,n=e.originY;(i||n)&&(t[Z]=i+"px "+n+"px")}var G={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function H(t,e){var i=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[i]=t,i}function U(t){return(0,_.isString)(t)?B[t]?"cubic-bezier("+B[t]+")":(0,z.H)(t)?t:"":""}function W(t,e,i,n){var r=t.animators,o=r.length,s=[];if(t instanceof R.Z){var l=function(t,e,i){var n,r,o=t.shape.paths,a={};if((0,_.each)(o,(function(t){var e=P(i.zrId);e.animation=!0,W(t,{},e,!0);var o=e.cssAnims,s=e.cssNodes,l=(0,_.keys)(o),u=l.length;if(u){var h=o[r=l[u-1]];for(var c in h){var d=h[c];a[c]=a[c]||{d:""},a[c].d+=d.d||""}for(var p in s){var f=s[p].animation;f.indexOf(r)>=0&&(n=f)}}})),n){e.d=!1;var s=H(a,i);return n.replace(r,s)}}(t,e,i);if(l)s.push(l);else if(!o)return}else if(!o)return;for(var u={},h=0;h0})).length)return H(c,i)+" "+r[0]+" both"}for(var v in u){(l=m(u[v]))&&s.push(l)}if(s.length){var y=i.zrId+"-cls-"+i.cssClassIdx++;i.cssNodes["."+y]={animation:s.join(",")},e.class=y}}var j=i(1590),X=i(5855),Y=Math.round;function q(t){return t&&(0,_.isString)(t.src)}function K(t){return t&&(0,_.isFunction)(t.toDataURL)}function J(t,e,i,n){T((function(r,o){var s="fill"===r||"stroke"===r;s&&(0,a.H3)(o)?function(t,e,i,n){var r,o=t[i],s={gradientUnits:o.global?"userSpaceOnUse":"objectBoundingBox"};if((0,a.I1)(o))r="linearGradient",s.x1=o.x,s.y1=o.y,s.x2=o.x2,s.y2=o.y2;else{if(!(0,a.gO)(o))return void 0;r="radialGradient",s.cx=(0,_.retrieve2)(o.x,.5),s.cy=(0,_.retrieve2)(o.y,.5),s.r=(0,_.retrieve2)(o.r,.5)}for(var l=o.colorStops,u=[],h=0,c=l.length;hl?bt(t,null==i[c+1]?null:i[c+1].elm,i,s,c):wt(t,e,a,l))}(i,n,r):vt(r)?(vt(t.text)&&ft(i,""),bt(i,null,r,0,r.length-1)):vt(n)?wt(i,n,0,n.length-1):vt(t.text)&&ft(i,""):t.text!==e.text&&(vt(n)&&wt(i,n,0,n.length-1),ft(i,e.text)))}var Mt=i(7606),Ct=0,At=function(){function t(t,e,i){if(this.type="svg",this.refreshHover=function(){0},this.configLayer=function(){0},this.storage=e,this._opts=i=(0,_.extend)({},i),this.root=t,this._id="zr"+Ct++,this._oldVNode=O(i.width,i.height),t&&!i.ssr){var n=this._viewport=document.createElement("div");n.style.cssText="position:relative;overflow:hidden";var r=this._svgDom=this._oldVNode.elm=L("svg");St(null,this._oldVNode),n.appendChild(r),t.appendChild(n)}this.resize(i.width,i.height)}return t.prototype.getType=function(){return this.type},t.prototype.getViewportRoot=function(){return this._viewport},t.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},t.prototype.getSvgDom=function(){return this._svgDom},t.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",function(t,e){if(_t(t,e))Tt(t,e);else{var i=t.elm,n=dt(i);xt(e),null!==n&&(ut(n,e.elm,pt(i)),wt(n,[t],0,0))}}(this._oldVNode,t),this._oldVNode=t}},t.prototype.renderOneToVNode=function(t){return at(t,P(this._id))},t.prototype.renderToVNode=function(t){t=t||{};var e=this.storage.getDisplayList(!0),i=this._backgroundColor,n=this._width,r=this._height,o=P(this._id);o.animation=t.animation,o.willUpdate=t.willUpdate,o.compress=t.compress;var s=[];if(i&&"none"!==i){var l=(0,a.ut)(i),u=l.color,h=l.opacity;this._bgVNode=I("rect","bg",{width:n,height:r,x:"0",y:"0",id:"0",fill:u,"fill-opacity":h}),s.push(this._bgVNode)}else this._bgVNode=null;var c=t.compress?null:this._mainVNode=I("g","main",{},[]);this._paintList(e,o,c?c.children:s),c&&s.push(c);var d=(0,_.map)((0,_.keys)(o.defs),(function(t){return o.defs[t]}));if(d.length&&s.push(I("defs","defs",{},d)),t.animation){var p=function(t,e,i){var n=(i=i||{}).newline?"\n":"",r=" {"+n,o=n+"}",a=(0,_.map)((0,_.keys)(t),(function(e){return e+r+(0,_.map)((0,_.keys)(t[e]),(function(i){return i+":"+t[e][i]+";"})).join(n)+o})).join(n),s=(0,_.map)((0,_.keys)(e),(function(t){return"@keyframes "+t+r+(0,_.map)((0,_.keys)(e[t]),(function(i){return i+r+(0,_.map)((0,_.keys)(e[t][i]),(function(n){var r=e[t][i][n];return"d"===n&&(r='path("'+r+'")'),n+":"+r+";"})).join(n)+o})).join(n)+o})).join(n);return a||s?[""].join(n):""}(o.cssNodes,o.cssAnims,{newline:!0});if(p){var f=I("style","stl",{},[],p);s.push(f)}}return O(n,r,s,t.useViewBox)},t.prototype.renderToString=function(t){return t=t||{},D(this.renderToVNode({animation:(0,_.retrieve2)(t.cssAnimation,!0),willUpdate:!1,compress:!0,useViewBox:(0,_.retrieve2)(t.useViewBox,!0)}),{newline:!0})},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t;var e=this._bgVNode;if(e&&e.elm){var i=(0,a.ut)(t),n=i.color,r=i.opacity;e.elm.setAttribute("fill",n),r<1&&e.elm.setAttribute("fill-opacity",r)}},t.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},t.prototype._paintList=function(t,e,i){for(var n,r,o=t.length,a=[],s=0,l=0,u=0;u=0&&(!c||!r||c[f]!==r[f]);f--);for(var g=p-1;g>f;g--)n=a[--s-1];for(var m=f+1;m-1&&(s.style.stroke=s.style.fill,s.style.fill="#fff",s.style.lineWidth=2),e},e.type="series.line",e.dependencies=["grid","polar"],e.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:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0,universalTransition:{divideShape:"clone"},triggerLineEvent:!1},e}(Pt.Z);var Nt=i(8162),Rt=i(6351),zt=i(9936);function Bt(t,e,i){var n=t.getBaseAxis(),r=t.getOtherAxis(n),o=function(t,e){var i=0,n=t.scale.getExtent();"start"===e?i=n[0]:"end"===e?i=n[1]:(0,_.isNumber)(e)&&!isNaN(e)?i=e:n[0]>0?i=n[0]:n[1]<0&&(i=n[1]);return i}(r,i),a=n.dim,s=r.dim,l=e.mapDimension(s),u=e.mapDimension(a),h="x"===s||"radius"===s?1:0,c=(0,_.map)(t.dimensions,(function(t){return e.mapDimension(t)})),d=!1,p=e.getCalculationInfo("stackResultDimension");return(0,zt.M)(e,c[0])&&(d=!0,c[0]=p),(0,zt.M)(e,c[1])&&(d=!0,c[1]=p),{dataDimsForPoint:c,valueStart:o,valueAxisDim:s,baseAxisDim:a,stacked:!!d,valueDim:l,baseDim:u,baseDataOffset:h,stackedOverDimension:e.getCalculationInfo("stackedOverDimension")}}function Zt(t,e,i,n){var r=NaN;t.stacked&&(r=i.get(i.getCalculationInfo("stackedOverDimension"),n)),isNaN(r)&&(r=t.valueStart);var o=t.baseDataOffset,a=[];return a[o]=i.get(t.baseDim,n),a[1-o]=r,e.dataToPoint(a)}var Ft=i(887);var Vt=i(1899),Gt=i(4292),Ht=i(2234),Ut=i(7011),Wt=Math.min,jt=Math.max;function Xt(t,e){return isNaN(t)||isNaN(e)}function Yt(t,e,i,n,r,o,a,s,l){for(var u,h,c,d,p,f,g=i,m=0;m=r||g<0)break;if(Xt(v,y)){if(l){g+=o;continue}break}if(g===i)t[o>0?"moveTo":"lineTo"](v,y),c=v,d=y;else{var _=v-u,x=y-h;if(_*_+x*x<.5){g+=o;continue}if(a>0){for(var b=g+o,w=e[2*b],S=e[2*b+1];w===v&&S===y&&m=n||Xt(w,S))p=v,f=y;else{C=w-u,A=S-h;var D=v-u,P=w-v,O=y-h,k=S-y,E=void 0,N=void 0;if("x"===s){var R=C>0?1:-1;p=v-R*(E=Math.abs(D))*a,f=y,L=v+R*(N=Math.abs(P))*a,I=y}else if("y"===s){var z=A>0?1:-1;p=v,f=y-z*(E=Math.abs(O))*a,L=v,I=y+z*(N=Math.abs(k))*a}else E=Math.sqrt(D*D+O*O),p=v-C*a*(1-(M=(N=Math.sqrt(P*P+k*k))/(N+E))),f=y-A*a*(1-M),I=y+A*a*M,L=Wt(L=v+C*a*M,jt(w,v)),I=Wt(I,jt(S,y)),L=jt(L,Wt(w,v)),f=y-(A=(I=jt(I,Wt(S,y)))-y)*E/N,p=Wt(p=v-(C=L-v)*E/N,jt(u,v)),f=Wt(f,jt(h,y)),L=v+(C=v-(p=jt(p,Wt(u,v))))*N/E,I=y+(A=y-(f=jt(f,Wt(h,y))))*N/E}t.bezierCurveTo(c,d,p,f,v,y),c=L,d=I}else t.lineTo(v,y)}u=v,h=y,g+=o}return m}var qt=function(){this.smooth=0,this.smoothConstraint=!0},Kt=function(t){function e(e){var i=t.call(this,e)||this;return i.type="ec-polyline",i}return(0,It.ZT)(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new qt},e.prototype.buildPath=function(t,e){var i=e.points,n=0,r=i.length/2;if(e.connectNulls){for(;r>0&&Xt(i[2*r-2],i[2*r-1]);r--);for(;n=0){var m=a?(h-n)*g+n:(u-i)*g+i;return a?[t,m]:[m,t]}i=u,n=h;break;case o.C:u=r[l++],h=r[l++],c=r[l++],d=r[l++],p=r[l++],f=r[l++];var v=a?(0,Ut.kD)(i,u,c,p,t,s):(0,Ut.kD)(n,h,d,f,t,s);if(v>0)for(var y=0;y=0){m=a?(0,Ut.af)(n,h,d,f,_):(0,Ut.af)(i,u,c,p,_);return a?[t,m]:[m,t]}}i=p,n=f}}},e}(s.ZP),Jt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,It.ZT)(e,t),e}(qt),Qt=function(t){function e(e){var i=t.call(this,e)||this;return i.type="ec-polygon",i}return(0,It.ZT)(e,t),e.prototype.getDefaultShape=function(){return new Jt},e.prototype.buildPath=function(t,e){var i=e.points,n=e.stackedOnPoints,r=0,o=i.length/2,a=e.smoothMonotone;if(e.connectNulls){for(;o>0&&Xt(i[2*o-2],i[2*o-1]);o--);for(;r=0;a--){var s=t.getDimensionInfo(n[a].dimension);if("x"===(r=s&&s.coordDim)||"y"===r){o=n[a];break}}if(o){var l=e.getAxis(r),u=_.map(o.stops,(function(t){return{coord:l.toGlobalCoord(l.dataToCoord(t.value)),color:t.color}})),h=u.length,c=o.outerColors.slice();h&&u[0].coord>u[h-1].coord&&(u.reverse(),c.reverse());var d=function(t,e){var i,n,r=[],o=t.length;function a(t,e,i){var n=t.coord,r=(i-n)/(e.coord-n);return{coord:i,color:(0,se.lerp)(r,[t.color,e.color])}}for(var s=0;se){n?r.push(a(n,l,e)):i&&r.push(a(i,l,0),a(i,l,e));break}i&&(r.push(a(i,l,0)),i=null),r.push(l),n=l}}return r}(u,"x"===r?i.getWidth():i.getHeight()),p=d.length;if(!p&&h)return u[0].coord<0?c[1]?c[1]:u[h-1].color:c[0]?c[0]:u[0].color;var f=d[0].coord-10,g=d[p-1].coord+10,m=g-f;if(m<.001)return"transparent";_.each(d,(function(t){t.offset=(t.coord-f)/m})),d.push({offset:p?d[p-1].offset:.5,color:c[1]||"transparent"}),d.unshift({offset:p?d[0].offset:.5,color:c[0]||"transparent"});var v=new Vt.Z(0,0,0,0,d,!0);return v[r]=f,v[r+"2"]=g,v}}}function fe(t,e,i){var n=t.get("showAllSymbol"),r="auto"===n;if(!n||r){var o=i.getAxesByScale("ordinal")[0];if(o&&(!r||!function(t,e){var i=t.getExtent(),n=Math.abs(i[1]-i[0])/t.scale.count();isNaN(n)&&(n=0);for(var r=e.count(),o=Math.max(1,Math.round(r/5)),a=0;an)return!1;return!0}(o,e))){var a=e.mapDimension(o.dim),s={};return _.each(o.getViewLabels(),(function(t){var e=o.scale.getRawOrdinalNumber(t.tickValue);s[e]=1})),function(t){return!s.hasOwnProperty(e.get(a,t))}}}}function ge(t,e){return[t[2*e],t[2*e+1]]}function me(t){if(t.get(["endLabel","show"]))return!0;for(var e=0;e0&&"bolder"===t.get(["emphasis","lineStyle","width"]))&&(p.getState("emphasis").style.lineWidth=+p.style.lineWidth+1);(0,oe.A)(p).seriesIndex=t.seriesIndex,(0,ie.k5)(p,O,k,E);var N=ce(t.get("smooth")),R=t.get("smoothMonotone");if(p.setShape({smooth:N,smoothMonotone:R,connectNulls:S}),f){var z=a.getCalculationInfo("stackedOnSeries"),B=0;f.useStyle(_.defaults(l.getAreaStyle(),{fill:L,opacity:.7,lineJoin:"bevel",decal:a.getVisual("style").decal})),z&&(B=ce(z.get("smooth"))),f.setShape({smooth:N,stackedOnSmooth:B,smoothMonotone:R,connectNulls:S}),(0,ie.WO)(f,t,"areaStyle"),(0,oe.A)(f).seriesIndex=t.seriesIndex,(0,ie.k5)(f,O,k,E)}var Z=function(t){n._changePolyState(t)};a.eachItemGraphicEl((function(t){t&&(t.onHoverStateChange=Z)})),this._polyline.onHoverStateChange=Z,this._data=a,this._coordSys=r,this._stackedOnPoints=b,this._points=u,this._step=A,this._valueOrigin=y,t.get("triggerLineEvent")&&(this.packEventData(t,p),f&&this.packEventData(t,f))},e.prototype.packEventData=function(t,e){(0,oe.A)(e).eventData={componentType:"series",componentSubType:"line",componentIndex:t.componentIndex,seriesIndex:t.seriesIndex,seriesName:t.name,seriesType:"line"}},e.prototype.highlight=function(t,e,i,n){var r=t.getData(),o=Ht.gO(r,n);if(this._changePolyState("emphasis"),!(o instanceof Array)&&null!=o&&o>=0){var a=r.getLayout("points"),s=r.getItemGraphicEl(o);if(!s){var l=a[2*o],u=a[2*o+1];if(isNaN(l)||isNaN(u))return;if(this._clipShapeForSymbol&&!this._clipShapeForSymbol.contain(l,u))return;var h=t.get("zlevel")||0,c=t.get("z")||0;(s=new Rt.Z(r,o)).x=l,s.y=u,s.setZ(h,c);var d=s.getSymbolPath().getTextContent();d&&(d.zlevel=h,d.z=c,d.z2=this._polyline.z2+1),s.__temp=!0,r.setItemGraphicEl(o,s),s.stopSymbolAnimation(!0),this.group.add(s)}s.highlight()}else $t.Z.prototype.highlight.call(this,t,e,i,n)},e.prototype.downplay=function(t,e,i,n){var r=t.getData(),o=Ht.gO(r,n);if(this._changePolyState("normal"),null!=o&&o>=0){var a=r.getItemGraphicEl(o);a&&(a.__temp?(r.setItemGraphicEl(o,null),this.group.remove(a)):a.downplay())}else $t.Z.prototype.downplay.call(this,t,e,i,n)},e.prototype._changePolyState=function(t){var e=this._polygon;(0,ie.Gl)(this._polyline,t),e&&(0,ie.Gl)(e,t)},e.prototype._newPolyline=function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new Kt({shape:{points:t},segmentIgnoreThreshold:2,z2:10}),this._lineGroup.add(e),this._polyline=e,e},e.prototype._newPolygon=function(t,e){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new Qt({shape:{points:t,stackedOnPoints:e},segmentIgnoreThreshold:2}),this._lineGroup.add(i),this._polygon=i,i},e.prototype._initSymbolLabelAnimation=function(t,e,i){var n,r,o=e.getBaseAxis(),a=o.inverse;"cartesian2d"===e.type?(n=o.isHorizontal(),r=!1):"polar"===e.type&&(n="angle"===o.dim,r=!0);var s=t.hostModel,l=s.get("animationDuration");_.isFunction(l)&&(l=l(null));var u=s.get("animationDelay")||0,h=_.isFunction(u)?u(null):u;t.eachItemGraphicEl((function(t,o){var s=t;if(s){var c=[t.x,t.y],d=void 0,p=void 0,f=void 0;if(i)if(r){var g=i,m=e.pointToCoord(c);n?(d=g.startAngle,p=g.endAngle,f=-m[1]/180*Math.PI):(d=g.r0,p=g.r,f=m[0])}else{var v=i;n?(d=v.x,p=v.x+v.width,f=t.x):(d=v.y+v.height,p=v.y,f=t.y)}var y=p===d?0:(f-d)/(p-d);a&&(y=1-y);var x=_.isFunction(u)?u(o):l*y+h,b=s.getSymbolPath(),w=b.getTextContent();s.attr({scaleX:0,scaleY:0}),s.animateTo({scaleX:1,scaleY:1},{duration:200,setToFinal:!0,delay:x}),w&&w.animateFrom({style:{opacity:0}},{duration:300,delay:x}),b.disableLabelAnimation=!0}}))},e.prototype._initOrUpdateEndLabel=function(t,e,i){var n=t.getModel("endLabel");if(me(t)){var r=t.getData(),o=this._polyline,a=r.getLayout("points");if(!a)return o.removeTextContent(),void(this._endLabel=null);var s=this._endLabel;s||((s=this._endLabel=new j.ZP({z2:200})).ignoreClip=!0,o.setTextContent(this._endLabel),o.disableLabelAnimation=!0);var l=function(t){for(var e,i,n=t.length/2;n>0&&(e=t[2*n-2],i=t[2*n-1],isNaN(e)||isNaN(i));n--);return n-1}(a);l>=0&&((0,ne.ni)(o,(0,ne.k3)(t,"endLabel"),{inheritColor:i,labelFetcher:t,labelDataIndex:l,defaultText:function(t,e,i){return null!=i?(0,re.O)(r,i):(0,re.H)(r,t)},enableTextSetter:!0},function(t,e){var i=e.getBaseAxis(),n=i.isHorizontal(),r=i.inverse,o=n?r?"right":"left":"center",a=n?"middle":r?"top":"bottom";return{normal:{align:t.get("align")||o,verticalAlign:t.get("verticalAlign")||a}}}(n,e)),o.textConfig.position=null)}else this._endLabel&&(this._polyline.removeTextContent(),this._endLabel=null)},e.prototype._endLabelOnDuring=function(t,e,i,n,r,o,a){var s=this._endLabel,l=this._polyline;if(s){t<1&&null==n.originalX&&(n.originalX=s.x,n.originalY=s.y);var u=i.getLayout("points"),h=i.hostModel,c=h.get("connectNulls"),d=o.get("precision"),p=o.get("distance")||0,f=a.getBaseAxis(),g=f.isHorizontal(),m=f.inverse,v=e.shape,y=m?g?v.x:v.y+v.height:g?v.x+v.width:v.y,_=(g?p:0)*(m?-1:1),x=(g?0:-p)*(m?-1:1),b=g?"x":"y",w=function(t,e,i){for(var n,r,o=t.length/2,a="x"===i?0:1,s=0,l=-1,u=0;u=e||n>=e&&r<=e){l=u;break}s=u,n=r}else n=r;return{range:[s,l],t:(e-n)/(r-n)}}(u,y,b),S=w.range,T=S[1]-S[0],M=void 0;if(T>=1){if(T>1&&!c){var C=ge(u,S[0]);s.attr({x:C[0]+_,y:C[1]+x}),r&&(M=h.getRawValue(S[0]))}else{(C=l.getPointOn(y,b))&&s.attr({x:C[0]+_,y:C[1]+x});var A=h.getRawValue(S[0]),L=h.getRawValue(S[1]);r&&(M=Ht.pk(i,d,A,L,w.t))}n.lastFrameIndex=S[0]}else{var I=1===t||n.lastFrameIndex>0?S[0]:0;C=ge(u,I);r&&(M=h.getRawValue(I)),s.attr({x:C[0]+_,y:C[1]+x})}r&&(0,ne.qA)(s).setLabelText(M)}},e.prototype._doUpdateAnimation=function(t,e,i,n,r,o,a){var s=this._polyline,l=this._polygon,u=t.hostModel,h=function(t,e,i,n,r,o,a,s){for(var l=function(t,e){var i=[];return e.diff(t).add((function(t){i.push({cmd:"+",idx:t})})).update((function(t,e){i.push({cmd:"=",idx:e,idx1:t})})).remove((function(t){i.push({cmd:"-",idx:t})})).execute(),i}(t,e),u=[],h=[],c=[],d=[],p=[],f=[],g=[],m=Bt(r,e,a),v=t.getLayout("points")||[],y=e.getLayout("points")||[],_=0;_3e3||l&&he(d,f)>3e3)return s.stopAnimation(),s.setShape({points:p}),void(l&&(l.stopAnimation(),l.setShape({points:p,stackedOnPoints:f})));s.shape.__points=h.current,s.shape.points=c;var g={shape:{points:p}};h.current!==c&&(g.shape.__points=h.next),s.stopAnimation(),Gt.D(s,g,u),l&&(l.setShape({points:c,stackedOnPoints:d}),l.stopAnimation(),Gt.D(l,{shape:{stackedOnPoints:f}},u),s.shape.points!==l.shape.points&&(l.shape.points=s.shape.points));for(var m=[],v=h.status,y=0;ye&&(e=t[i]);return isFinite(e)?e:NaN},min:function(t){for(var e=1/0,i=0;i10&&"cartesian2d"===o.type&&r){var s=o.getBaseAxis(),l=o.getOtherAxis(s),u=s.getExtent(),h=i.getDevicePixelRatio(),c=Math.abs(u[1]-u[0])*(h||1),d=Math.round(a/c);if(isFinite(d)&&d>1){"lttb"===r&&t.setData(n.lttbDownSample(n.mapDimension(l.dim),1/d));var p=void 0;(0,_.isString)(r)?p=be[r]:(0,_.isFunction)(r)&&(p=r),p&&t.setData(n.downSample(n.mapDimension(l.dim),1/d,p,we))}}}}}var Te=i(9093),Me=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.getInitialData=function(t,e){return(0,Dt.Z)(null,this,{useEncodeDefaulter:!0})},e.prototype.getMarkerPosition=function(t){var e=this.coordinateSystem;if(e&&e.clampData){var i=e.dataToPoint(e.clampData(t)),n=this.getData(),r=n.getLayout("offset"),o=n.getLayout("size");return i[e.getBaseAxis().isHorizontal()?0:1]+=r+o/2,i}return[NaN,NaN]},e.type="series.__base_bar__",e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod"},e}(Pt.Z);Pt.Z.registerClass(Me);const Ce=Me;var Ae=i(2151);const Le=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.getInitialData=function(){return(0,Dt.Z)(null,this,{useEncodeDefaulter:!0,createInvertedIndices:!!this.get("realtimeSort",!0)||null})},e.prototype.getProgressive=function(){return!!this.get("large")&&this.get("progressive")},e.prototype.getProgressiveThreshold=function(){var t=this.get("progressiveThreshold"),e=this.get("largeThreshold");return e>t&&(t=e),t},e.prototype.brushSelector=function(t,e,i){return i.rect(e.getItemLayout(t))},e.type="series.bar",e.dependencies=["grid","polar"],e.defaultOption=(0,Ae.ZL)(Ce.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:"#212121"}},realtimeSort:!1}),e}(Ce);var Ie=i(1177),De=i(56),Pe=i(1205),Oe=i(270),ke=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0},Ee=function(t){function e(e){var i=t.call(this,e)||this;return i.type="sausage",i}return(0,It.ZT)(e,t),e.prototype.getDefaultShape=function(){return new ke},e.prototype.buildPath=function(t,e){var i=e.cx,n=e.cy,r=Math.max(e.r0||0,0),o=Math.max(e.r,0),a=.5*(o-r),s=r+a,l=e.startAngle,u=e.endAngle,h=e.clockwise,c=2*Math.PI,d=h?u-lo)return!0;o=u}return!1},e.prototype._isOrderDifferentInView=function(t,e){for(var i=e.scale,n=i.getExtent(),r=Math.max(0,n[0]),o=Math.min(n[1],i.getOrdinalMeta().categories.length-1);r<=o;++r)if(t.ordinalNumbers[r]!==i.getRawOrdinalNumber(r))return!0},e.prototype._updateSortWithinSameData=function(t,e,i,n){if(this._isOrderChangedWithinSameData(t,e,i)){var r=this._dataSort(t,i,e);this._isOrderDifferentInView(r,i)&&(this._removeOnRenderedListener(n),n.dispatchAction({type:"changeAxisOrder",componentType:i.dim+"Axis",axisId:i.index,sortInfo:r}))}},e.prototype._dispatchInitSort=function(t,e,i){var n=e.baseAxis,r=this._dataSort(t,n,(function(i){return t.get(t.mapDimension(e.otherAxis.dim),i)}));i.dispatchAction({type:"changeAxisOrder",componentType:n.dim+"Axis",isInitSort:!0,axisId:n.index,sortInfo:r})},e.prototype.remove=function(t,e){this._clear(this._model),this._removeOnRenderedListener(e)},e.prototype.dispose=function(t,e){this._removeOnRenderedListener(e)},e.prototype._removeOnRenderedListener=function(t){this._onRendered&&(t.getZr().off("rendered",this._onRendered),this._onRendered=null)},e.prototype._clear=function(t){var e=this.group,i=this._data;t&&t.isAnimationEnabled()&&i&&!this._isLargeDraw?(this._removeBackground(),this._backgroundEls=[],i.eachItemGraphicEl((function(e){(0,Gt.XD)(e,t,(0,oe.A)(e).dataIndex)}))):e.removeAll(),this._data=null,this._isFirstFrame=!0},e.prototype._removeBackground=function(){this.group.remove(this._backgroundGroup),this._backgroundGroup=null},e.type="bar",e}($t.Z),Ve={cartesian2d:function(t,e){var i=e.width<0?-1:1,n=e.height<0?-1:1;i<0&&(e.x+=e.width,e.width=-e.width),n<0&&(e.y+=e.height,e.height=-e.height);var r=t.x+t.width,o=t.y+t.height,a=Be(e.x,t.x),s=Ze(e.x+e.width,r),l=Be(e.y,t.y),u=Ze(e.y+e.height,o),h=sr?s:a,e.y=c&&l>o?u:l,e.width=h?0:s-a,e.height=c?0:u-l,i<0&&(e.x+=e.width,e.width=-e.width),n<0&&(e.y+=e.height,e.height=-e.height),h||c},polar:function(t,e){var i=e.r0<=e.r?1:-1;if(i<0){var n=e.r;e.r=e.r0,e.r0=n}var r=Ze(e.r,t.r),o=Be(e.r0,t.r0);e.r=r,e.r0=o;var a=r-o<0;if(i<0){n=e.r;e.r=e.r0,e.r0=n}return a}},Ge={cartesian2d:function(t,e,i,n,r,o,a,s,l){var u=new De.Z({shape:(0,_.extend)({},n),z2:1});(u.__dataIndex=i,u.name="item",o)&&(u.shape[r?"height":"width"]=0);return u},polar:function(t,e,i,n,r,o,a,s,l){var h=!r&&l?Ne:Pe.C,c=new h({shape:n,z2:1});c.name="item";var d,p,f=qe(r);if(c.calculateTextPosition=(d=f,p=({isRoundCap:h===Ne}||{}).isRoundCap,function(t,e,i){var n=e.position;if(!n||n instanceof Array)return(0,u.wI)(t,e,i);var r=d(n),o=null!=e.distance?e.distance:5,a=this.shape,s=a.cx,l=a.cy,h=a.r,c=a.r0,f=(h+c)/2,g=a.startAngle,m=a.endAngle,v=(g+m)/2,y=p?Math.abs(h-c)/2:0,_=Math.cos,x=Math.sin,b=s+h*_(g),w=l+h*x(g),S="left",T="top";switch(r){case"startArc":b=s+(c-o)*_(v),w=l+(c-o)*x(v),S="center",T="top";break;case"insideStartArc":b=s+(c+o)*_(v),w=l+(c+o)*x(v),S="center",T="bottom";break;case"startAngle":b=s+f*_(g)+Re(g,o+y,!1),w=l+f*x(g)+ze(g,o+y,!1),S="right",T="middle";break;case"insideStartAngle":b=s+f*_(g)+Re(g,-o+y,!1),w=l+f*x(g)+ze(g,-o+y,!1),S="left",T="middle";break;case"middle":b=s+f*_(v),w=l+f*x(v),S="center",T="middle";break;case"endArc":b=s+(h+o)*_(v),w=l+(h+o)*x(v),S="center",T="bottom";break;case"insideEndArc":b=s+(h-o)*_(v),w=l+(h-o)*x(v),S="center",T="top";break;case"endAngle":b=s+f*_(m)+Re(m,o+y,!0),w=l+f*x(m)+ze(m,o+y,!0),S="left",T="middle";break;case"insideEndAngle":b=s+f*_(m)+Re(m,-o+y,!0),w=l+f*x(m)+ze(m,-o+y,!0),S="right",T="middle";break;default:return(0,u.wI)(t,e,i)}return(t=t||{}).x=b,t.y=w,t.align=S,t.verticalAlign=T,t}),o){var g=r?"r":"endAngle",m={};c.shape[g]=r?0:n.startAngle,m[g]=n[g],(s?Gt.D:Gt.KZ)(c,{shape:m},o)}return c}};function He(t,e,i,n,r,o,a,s){var l,u;o?(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||(a?Gt.D:Gt.KZ)(i,{shape:l},e,r,null);var h=e?t.baseAxis.model:null;(a?Gt.D:Gt.KZ)(i,{shape:u},h,r)}function Ue(t,e){for(var i=0;i0?1:-1,a=n.height>0?1:-1;return{x:n.x+o*r/2,y:n.y+a*r/2,width:n.width-o*r,height:n.height-a*r}},polar:function(t,e,i){var n=t.getItemLayout(e);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}}};function qe(t){return function(t){var e=t?"Arc":"Angle";return function(t){switch(t){case"start":case"insideStart":case"end":case"insideEnd":return t+e;default:return t}}}(t)}function Ke(t,e,i,n,r,o,a,s){var l=e.getItemVisual(i,"style");s||t.setShape("r",n.get(["itemStyle","borderRadius"])||0),t.useStyle(l);var u=n.getShallow("cursor");u&&t.attr("cursor",u);var h=s?a?r.r>=r.r0?"endArc":"startArc":r.endAngle>=r.startAngle?"endAngle":"startAngle":a?r.height>=0?"bottom":"top":r.width>=0?"right":"left",c=(0,ne.k3)(n);(0,ne.ni)(t,c,{labelFetcher:o,labelDataIndex:i,defaultText:(0,re.H)(o.getData(),i),inheritColor:l.fill,defaultOpacity:l.opacity,defaultOutsidePosition:h});var d=t.getTextContent();if(s&&d){var p=n.get(["label","position"]);t.textConfig.inside="middle"===p||null,function(t,e,i,n){if((0,_.isNumber)(n))t.setTextConfig({rotation:n});else if((0,_.isArray)(e))t.setTextConfig({rotation:0});else{var r,o=t.shape,a=o.clockwise?o.startAngle:o.endAngle,s=o.clockwise?o.endAngle:o.startAngle,l=(a+s)/2,u=i(e);switch(u){case"startArc":case"insideStartArc":case"middle":case"insideEndArc":case"endArc":r=l;break;case"startAngle":case"insideStartAngle":r=a;break;case"endAngle":case"insideEndAngle":r=s;break;default:return void t.setTextConfig({rotation:0})}var h=1.5*Math.PI-r;"middle"===u&&h>Math.PI/2&&h<1.5*Math.PI&&(h-=Math.PI),t.setTextConfig({rotation:h})}}(t,"outside"===p?h:p,qe(a),n.get(["label","rotate"]))}(0,ne.pe)(d,c,o.getRawValue(i),(function(t){return(0,re.O)(e,t)}));var f=n.getModel(["emphasis"]);(0,ie.k5)(t,f.get("focus"),f.get("blurScope"),f.get("disabled")),(0,ie.WO)(t,n),function(t){return null!=t.startAngle&&null!=t.endAngle&&t.startAngle===t.endAngle}(r)&&(t.style.fill="none",t.style.stroke="none",(0,_.each)(t.states,(function(t){t.style&&(t.style.fill=t.style.stroke="none")})))}var Je=function(){},Qe=function(t){function e(e){var i=t.call(this,e)||this;return i.type="largeBar",i}return(0,It.ZT)(e,t),e.prototype.getDefaultShape=function(){return new Je},e.prototype.buildPath=function(t,e){for(var i=e.points,n=this.baseDimIdx,r=1-this.baseDimIdx,o=[],a=[],s=this.barWidth,l=0;l=s[0]&&e<=s[0]+l[0]&&i>=s[1]&&i<=s[1]+l[1])return a[h]}return-1}(this,t.offsetX,t.offsetY);(0,oe.A)(this).dataIndex=e>=0?e:null}),30,!1);function ei(t,e,i){if(ee(i,"cartesian2d")){var n=e,r=i.getArea();return{x:t?n.x:r.x,y:t?r.y:n.y,width:t?n.width:r.width,height:t?r.height:n.height}}var o=e;return{cx:(r=i.getArea()).cx,cy:r.cy,r0:t?r.r0:o.r0,r:t?r.r:o.r,startAngle:t?o.startAngle:0,endAngle:t?o.endAngle:2*Math.PI}}const ii=Fe;var ni=i(1891),ri=i(5669),oi=i(6172),ai=2*Math.PI,si=Math.PI/180;function li(t,e){return oi.ME(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function ui(t,e){var i=li(t,e),n=t.get("center"),r=t.get("radius");_.isArray(r)||(r=[0,r]),_.isArray(n)||(n=[n,n]);var o,a,s=(0,ri.GM)(i.width,e.getWidth()),l=(0,ri.GM)(i.height,e.getHeight()),u=Math.min(s,l),h=(0,ri.GM)(r[0],u/2),c=(0,ri.GM)(r[1],u/2),d=t.coordinateSystem;if(d){var p=d.dataToPoint(n);o=p[0]||0,a=p[1]||0}else o=(0,ri.GM)(n[0],s)+i.x,a=(0,ri.GM)(n[1],l)+i.y;return{cx:o,cy:a,r0:h,r:c}}function hi(t,e,i){e.eachSeriesByType(t,(function(t){var e=t.getData(),n=e.mapDimension("value"),r=li(t,i),o=ui(t,i),a=o.cx,s=o.cy,l=o.r,u=o.r0,h=-t.get("startAngle")*si,c=t.get("minAngle")*si,d=0;e.each(n,(function(t){!isNaN(t)&&d++}));var p=e.getSum(n),f=Math.PI/(p||d)*2,g=t.get("clockwise"),m=t.get("roseType"),v=t.get("stillShowZeroSum"),y=e.getDataExtent(n);y[0]=0;var _=ai,x=0,b=h,w=g?1:-1;if(e.setLayout({viewRect:r,r:l}),e.each(n,(function(t,i){var n;if(isNaN(t))e.setItemLayout(i,{angle:NaN,startAngle:NaN,endAngle:NaN,clockwise:g,cx:a,cy:s,r0:u,r:m?NaN:l});else{(n="area"!==m?0===p&&v?f:t*f:ai/d)i?a:o,h=Math.abs(l.label.y-i);if(h>=u.maxY){var c=l.label.x-e-l.len2*r,d=n+l.len,f=Math.abs(c)t.unconstrainedWidth?null:p:null;n.setStyle("width",f)}var g=n.getBoundingRect();o.width=g.width;var m=(n.style.margin||0)+2.1;o.height=g.height+m,o.y-=(o.height-c)/2}}}function _i(t){return"center"===t.position}function xi(t){var e,i,n=t.getData(),r=[],o=!1,a=(t.get("minShowLabelAngle")||0)*mi,s=n.getLayout("viewRect"),l=n.getLayout("r"),u=s.width,h=s.x,c=s.y,d=s.height;function p(t){t.ignore=!0}n.each((function(t){var s=n.getItemGraphicEl(t),c=s.shape,d=s.getTextContent(),f=s.getTextGuideLine(),g=n.getItemModel(t),m=g.getModel("label"),v=m.get("position")||g.get(["emphasis","label","position"]),y=m.get("distanceToLabelLine"),x=m.get("alignTo"),b=(0,ri.GM)(m.get("edgeDistance"),u),w=m.get("bleedMargin"),S=g.getModel("labelLine"),T=S.get("length");T=(0,ri.GM)(T,u);var M=S.get("length2");if(M=(0,ri.GM)(M,u),Math.abs(c.endAngle-c.startAngle)0?"right":"left":P>0?"left":"right"}var Z=Math.PI,F=0,V=m.get("rotate");if((0,_.isNumber)(V))F=V*(Z/180);else if("center"===v)F=0;else if("radial"===V||!0===V){F=P<0?-D+Z:-D}else if("tangential"===V&&"outside"!==v&&"outer"!==v){var G=Math.atan2(P,O);G<0&&(G=2*Z+G),O>0&&(G=Z+G),F=G-Z}if(o=!!F,d.x=C,d.y=A,d.rotation=F,d.setStyle({verticalAlign:"middle"}),k){d.setStyle({align:I});var H=d.states.select;H&&(H.x+=d.x,H.y+=d.y)}else{var U=d.getBoundingRect().clone();U.applyTransform(d.getComputedTransform());var W=(d.style.margin||0)+2.1;U.y-=W/2,U.height+=W,r.push({label:d,labelLine:f,position:v,len:T,len2:M,minTurnAngle:S.get("minTurnAngle"),maxSurfaceAngle:S.get("maxSurfaceAngle"),surfaceNormal:new pi.Z(P,O),linePoints:L,textAlign:I,labelDistance:y,labelAlignTo:x,edgeDistance:b,bleedMargin:w,rect:U,unconstrainedWidth:U.width,labelStyleWidth:d.style.width})}s.setTextConfig({inside:k})}})),!o&&t.get("avoidLabelOverlap")&&function(t,e,i,n,r,o,a,s){for(var l=[],u=[],h=Number.MAX_VALUE,c=-Number.MAX_VALUE,d=0;d0){for(var l=o.getItemLayout(0),u=1;isNaN(l&&l.startAngle)&&u=i.r0}},e.type="pie",e}($t.Z);var Ti=i(5623),Mi=i(5101);function Ci(t,e,i){e=(0,_.isArray)(e)&&{coordDimensions:e}||(0,_.extend)({encodeDefine:t.getEncode()},e);var n=t.getSource(),r=(0,Ti.Z)(n,e).dimensions,o=new Mi.Z(r,t);return o.initData(n,i),o}var Ai=i(1772),Li=i(2019);const Ii=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,It.ZT)(e,t),e.prototype.init=function(e){t.prototype.init.apply(this,arguments),this.legendVisualProvider=new Li.Z(_.bind(this.getData,this),_.bind(this.getRawData,this)),this._defaultLabelLine(e)},e.prototype.mergeOption=function(){t.prototype.mergeOption.apply(this,arguments)},e.prototype.getInitialData=function(){var t=Ci(this,{coordDimensions:["value"],encodeDefaulter:_.curry(Ai.Ss,this)}),e=[];return t.each(t.mapDimension("value"),(function(t){e.push(t)})),this.seats=(0,ri.HD)(e,t.hostModel.get("percentPrecision")),t},e.prototype.getDataParams=function(e){var i=t.prototype.getDataParams.call(this,e);return i.percent=this.seats[e],i.$vars.push("percent"),i},e.prototype._defaultLabelLine=function(t){Ht.Cc(t,"labelLine",["show"]);var e=t.labelLine,i=t.emphasis.labelLine;e.show=e.show&&t.label.show,i.show=i.show&&t.emphasis.label.show},e.type="series.pie",e.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,minShowLabelAngle:0,selectedOffset:10,percentPrecision:2,stillShowZeroSum:!0,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%",bleedMargin:10,distanceToLabelLine:5},labelLine:{show:!0,length:15,length2:15,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"},e}(Pt.Z);const Di=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.hasSymbolVisual=!0,i}return(0,It.ZT)(e,t),e.prototype.getInitialData=function(t,e){return(0,Dt.Z)(null,this,{useEncodeDefaulter:!0})},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?5e3:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?1e4:this.get("progressiveThreshold"):t},e.prototype.brushSelector=function(t,e,i){return i.point(e.getItemLayout(t))},e.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},e.type="series.scatter",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},e}(Pt.Z);var Pi=i(641),Oi=function(){},ki=function(t){function e(e){var i=t.call(this,e)||this;return i._off=0,i.hoverDataIdx=-1,i}return(0,It.ZT)(e,t),e.prototype.getDefaultShape=function(){return new Oi},e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.buildPath=function(t,e){var i,n=e.points,r=e.size,o=this.symbolProxy,a=o.shape,s=t.getContext?t.getContext():t,l=s&&r[0]<4,u=this.softClipShape;if(l)this._ctx=s;else{for(this._ctx=null,i=this._off;i=0;s--){var l=2*s,u=n[l]-o/2,h=n[l+1]-a/2;if(t>=u&&e>=h&&t<=u+o&&e<=h+a)return s}return-1},e.prototype.contain=function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect();return t=i[0],e=i[1],n.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape,i=e.points,n=e.size,r=n[0],o=n[1],a=1/0,s=1/0,l=-1/0,u=-1/0,h=0;h=0&&(l.dataIndex=i+(t.startIndex||0))}))},t.prototype.remove=function(){this._clear()},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();const Ni=Ei;const Ri=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){var n=t.getData();this._updateSymbolDraw(n,t).updateData(n,{clipShape:this._getClipShape(t)}),this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,i){var n=t.getData();this._updateSymbolDraw(n,t).incrementalPrepareUpdate(n),this._finished=!1},e.prototype.incrementalRender=function(t,e,i){this._symbolDraw.incrementalUpdate(t,e.getData(),{clipShape:this._getClipShape(e)}),this._finished=t.end===e.getData().count()},e.prototype.updateTransform=function(t,e,i){var n=t.getData();if(this.group.dirty(),!this._finished||n.count()>1e4)return{update:!0};var r=(0,xe.Z)("").reset(t,e,i);r.progress&&r.progress({start:0,end:n.count(),count:n.count()},n),this._symbolDraw.updateLayout(n)},e.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},e.prototype._getClipShape=function(t){var e=t.coordinateSystem,i=e&&e.getArea&&e.getArea();return t.get("clip",!0)?i:null},e.prototype._updateSymbolDraw=function(t,e){var i=this._symbolDraw,n=e.pipelineContext.large;return i&&n===this._isLargeDraw||(i&&i.remove(),i=this._symbolDraw=n?new Ni:new Nt.Z,this._isLargeDraw=n,this.group.removeAll()),this.group.add(i.group),i},e.prototype.remove=function(t,e){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},e.prototype.dispose=function(){},e.type="scatter",e}($t.Z);var zi=i(3166),Bi=i(8071);const Zi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,It.ZT)(e,t),e.type="grid",e.dependencies=["xAxis","yAxis"],e.layoutMode="box",e.defaultOption={show:!1,z:0,left:"10%",top:60,right:"10%",bottom:70,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"},e}(Bi.Z);var Fi=i(6650),Vi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,It.ZT)(e,t),e.prototype.getCoordSysModel=function(){return this.getReferringComponents("grid",Ht.C6).models[0]},e.type="cartesian2dAxis",e}(Bi.Z);_.mixin(Vi,Fi.W);var Gi={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:!0,onZeroAxisIndex:null,lineStyle:{color:"#6E7079",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},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},splitLine:{show:!0,lineStyle:{color:["#E0E6F1"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},Hi=_.merge({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},Gi),Ui=_.merge({boundaryGap:[0,0],axisLine:{show:"auto"},axisTick:{show:"auto"},splitNumber:5,minorTick:{show:!1,splitNumber:5,length:3,lineStyle:{}},minorSplitLine:{show:!1,lineStyle:{color:"#F4F7FD",width:1}}},Gi);const Wi={category:Hi,value:Ui,time:_.merge({splitNumber:6,axisLabel:{showMinLabel:!1,showMaxLabel:!1,rich:{primary:{fontWeight:"bold"}}},splitLine:{show:!1}},Ui),log:_.defaults({logBase:10},Ui)};var ji=i(1401),Xi={value:1,category:1,time:1,log:1};function Yi(t,e,i,n){(0,_.each)(Xi,(function(r,o){var a=(0,_.merge)((0,_.merge)({},Wi[o],!0),n,!0),s=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e+"Axis."+o,i}return(0,It.ZT)(i,t),i.prototype.mergeDefaultAndTheme=function(t,e){var i=(0,oi.YD)(this),n=i?(0,oi.tE)(t):{},r=e.getTheme();(0,_.merge)(t,r.get(o+"Axis")),(0,_.merge)(t,this.getDefaultOption()),t.type=qi(t),i&&(0,oi.dt)(t,n,i)},i.prototype.optionUpdated=function(){"category"===this.option.type&&(this.__ordinalMeta=ji.Z.createByAxisModel(this))},i.prototype.getCategories=function(t){var e=this.option;if("category"===e.type)return t?e.data:this.__ordinalMeta.categories},i.prototype.getOrdinalMeta=function(){return this.__ordinalMeta},i.type=e+"Axis."+o,i.defaultOption=a,i}(i);t.registerComponentModel(s)})),t.registerSubTypeDefaulter(e+"Axis",qi)}function qi(t){return t.type||(t.data?"category":"value")}var Ki=i(7947);const Ji=function(){function t(t){this.type="cartesian",this._dimList=[],this._axes={},this.name=t||""}return t.prototype.getAxis=function(t){return this._axes[t]},t.prototype.getAxes=function(){return _.map(this._dimList,(function(t){return this._axes[t]}),this)},t.prototype.getAxesByScale=function(t){return t=t.toLowerCase(),_.filter(this.getAxes(),(function(e){return e.scale.type===t}))},t.prototype.addAxis=function(t){var e=t.dim;this._axes[e]=t,this._dimList.push(e)},t}();var Qi=i(4247),$i=i(1362),tn=["x","y"];function en(t){return"interval"===t.type||"time"===t.type}const nn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cartesian2d",e.dimensions=tn,e}return(0,It.ZT)(e,t),e.prototype.calcAffineTransform=function(){this._transform=this._invTransform=null;var t=this.getAxis("x").scale,e=this.getAxis("y").scale;if(en(t)&&en(e)){var i=t.getExtent(),n=e.getExtent(),r=this.dataToPoint([i[0],n[0]]),o=this.dataToPoint([i[1],n[1]]),a=i[1]-i[0],s=n[1]-n[0];if(a&&s){var l=(o[0]-r[0])/a,u=(o[1]-r[1])/s,h=r[0]-i[0]*l,c=r[1]-n[0]*u,d=this._transform=[l,0,0,u,h,c];this._invTransform=(0,Qi.invert)([],d)}}},e.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAxis("x")},e.prototype.containPoint=function(t){var e=this.getAxis("x"),i=this.getAxis("y");return e.contain(e.toLocalCoord(t[0]))&&i.contain(i.toLocalCoord(t[1]))},e.prototype.containData=function(t){return this.getAxis("x").containData(t[0])&&this.getAxis("y").containData(t[1])},e.prototype.containZone=function(t,e){var i=this.dataToPoint(t),n=this.dataToPoint(e),r=this.getArea(),o=new Pi.Z(i[0],i[1],n[0]-i[0],n[1]-i[1]);return r.intersect(o)},e.prototype.dataToPoint=function(t,e,i){i=i||[];var n=t[0],r=t[1];if(this._transform&&null!=n&&isFinite(n)&&null!=r&&isFinite(r))return(0,$i.applyTransform)(i,t,this._transform);var o=this.getAxis("x"),a=this.getAxis("y");return i[0]=o.toGlobalCoord(o.dataToCoord(n,e)),i[1]=a.toGlobalCoord(a.dataToCoord(r,e)),i},e.prototype.clampData=function(t,e){var i=this.getAxis("x").scale,n=this.getAxis("y").scale,r=i.getExtent(),o=n.getExtent(),a=i.parse(t[0]),s=n.parse(t[1]);return(e=e||[])[0]=Math.min(Math.max(Math.min(r[0],r[1]),a),Math.max(r[0],r[1])),e[1]=Math.min(Math.max(Math.min(o[0],o[1]),s),Math.max(o[0],o[1])),e},e.prototype.pointToData=function(t,e){var i=[];if(this._invTransform)return(0,$i.applyTransform)(i,t,this._invTransform);var n=this.getAxis("x"),r=this.getAxis("y");return i[0]=n.coordToData(n.toLocalCoord(t[0]),e),i[1]=r.coordToData(r.toLocalCoord(t[1]),e),i},e.prototype.getOtherAxis=function(t){return this.getAxis("x"===t.dim?"y":"x")},e.prototype.getArea=function(){var t=this.getAxis("x").getGlobalExtent(),e=this.getAxis("y").getGlobalExtent(),i=Math.min(t[0],t[1]),n=Math.min(e[0],e[1]),r=Math.max(t[0],t[1])-i,o=Math.max(e[0],e[1])-n;return new Pi.Z(i,n,r,o)},e}(Ji);var rn=i(2950),on=function(t){function e(e,i,n,r,o){var a=t.call(this,e,i,n)||this;return a.index=0,a.type=r||"value",a.position=o||"bottom",a}return(0,It.ZT)(e,t),e.prototype.isHorizontal=function(){var t=this.position;return"top"===t||"bottom"===t},e.prototype.getGlobalExtent=function(t){var e=this.getExtent();return e[0]=this.toGlobalCoord(e[0]),e[1]=this.toGlobalCoord(e[1]),t&&e[0]>e[1]&&e.reverse(),e},e.prototype.pointToData=function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},e.prototype.setCategorySortInfo=function(t){if("category"!==this.type)return!1;this.model.option.categorySortInfo=t,this.scale.setSortInfo(t)},e}(rn.Z);const an=on;var sn=i(9069),ln=i(5021),un=i(103),hn=Math.log;function cn(t,e,i){var n=un.Z.prototype,r=n.getTicks.call(i),o=n.getTicks.call(i,!0),a=r.length-1,s=n.getInterval.call(i),l=(0,Ki.Xv)(t,e),u=l.extent,h=l.fixMin,c=l.fixMax;if("log"===t.type){var d=hn(t.base);u=[hn(u[0])/d,hn(u[1])/d]}t.setExtent(u[0],u[1]),t.calcNiceExtent({splitNumber:a,fixMin:h,fixMax:c});var p=n.getExtent.call(t);h&&(u[0]=p[0]),c&&(u[1]=p[1]);var f=n.getInterval.call(t),g=u[0],m=u[1];if(h&&c)f=(m-g)/a;else if(h)for(m=u[0]+f*a;mu[0]&&isFinite(g)&&isFinite(u[0]);)f=(0,ln.r1)(f),g=u[1]-f*a;else{t.getTicks().length-1>a&&(f=(0,ln.r1)(f));var v=f*a;m=Math.ceil(u[1]/f)*f,(g=(0,ri.NM)(m-v))<0&&u[0]>=0?(g=0,m=(0,ri.NM)(v)):m>0&&u[1]<=0&&(m=0,g=-(0,ri.NM)(v))}var y=(r[0].value-o[0].value)/s,_=(r[a].value-o[a].value)/s;n.setExtent.call(t,g+f*y,m+f*_),n.setInterval.call(t,f),(y||_)&&n.setNiceExtent.call(t,g+f,m-f)}var dn=function(){function t(t,e,i){this.type="grid",this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this.axisPointerEnabled=!0,this.dimensions=tn,this._initCartesian(t,e,i),this.model=t}return t.prototype.getRect=function(){return this._rect},t.prototype.update=function(t,e){var i=this._axesMap;function n(t){var e,i=(0,_.keys)(t),n=i.length;if(n){for(var r=[],o=n-1;o>=0;o--){var a=t[+i[o]],s=a.model,l=a.scale;(0,ln.lM)(l)&&s.get("alignTicks")&&null==s.get("interval")?r.push(a):((0,Ki.Jk)(l,s),(0,ln.lM)(l)&&(e=a))}r.length&&(e||(e=r.pop(),(0,Ki.Jk)(e.scale,e.model)),(0,_.each)(r,(function(t){cn(t.scale,t.model,e.scale)})))}}this._updateScale(t,this.model),n(i.x),n(i.y);var r={};(0,_.each)(i.x,(function(t){fn(i,"y",t,r)})),(0,_.each)(i.y,(function(t){fn(i,"x",t,r)})),this.resize(this.model,e)},t.prototype.resize=function(t,e,i){var n=t.getBoxLayoutParams(),r=!i&&t.get("containLabel"),o=(0,oi.ME)(n,{width:e.getWidth(),height:e.getHeight()});this._rect=o;var a=this._axesList;function s(){(0,_.each)(a,(function(t){var e=t.isHorizontal(),i=e?[0,o.width]:[0,o.height],n=t.inverse?1:0;t.setExtent(i[n],i[1-n]),function(t,e){var i=t.getExtent(),n=i[0]+i[1];t.toGlobalCoord="x"===t.dim?function(t){return t+e}:function(t){return n-t+e},t.toLocalCoord="x"===t.dim?function(t){return t-e}:function(t){return n-t+e}}(t,e?o.x:o.y)}))}s(),r&&((0,_.each)(a,(function(t){if(!t.model.get(["axisLabel","inside"])){var e=(0,Ki.Do)(t);if(e){var i=t.isHorizontal()?"height":"width",n=t.model.get(["axisLabel","margin"]);o[i]-=e[i]+n,"top"===t.position?o.y+=e.height+n:"left"===t.position&&(o.x+=e.width+n)}}})),s()),(0,_.each)(this._coordsList,(function(t){t.calcAffineTransform()}))},t.prototype.getAxis=function(t,e){var i=this._axesMap[t];if(null!=i)return i[e||0]},t.prototype.getAxes=function(){return this._axesList.slice()},t.prototype.getCartesian=function(t,e){if(null!=t&&null!=e){var i="x"+t+"y"+e;return this._coordsMap[i]}(0,_.isObject)(t)&&(e=t.yAxisIndex,t=t.xAxisIndex);for(var n=0,r=this._coordsList;n0&&!c.min?c.min=0:null!=c.min&&c.min<0&&!c.max&&(c.max=0);var d=a;null!=c.color&&(d=_.defaults({color:c.color},a));var p=_.merge(_.clone(c),{boundaryGap:t,splitNumber:e,scale:i,axisLine:n,axisTick:r,axisLabel:o,name:c.text,showName:s,nameLocation:"end",nameGap:u,nameTextStyle:d,triggerEvent:h},!1);if(_.isString(l)){var f=p.name;p.name=l.replace("{value}",null!=f?f:"")}else _.isFunction(l)&&(p.name=l(p.name,p));var g=new Gn.Z(p,null,this.ecModel);return _.mixin(g,Fi.W.prototype),g.mainType="radar",g.componentIndex=this.componentIndex,g}),this);this._indicatorModels=c},e.prototype.getIndicatorModels=function(){return this._indicatorModels},e.type="radar",e.defaultOption={z:0,center:["50%","50%"],radius:"75%",startAngle:90,axisName:{show:!0},boundaryGap:[0,0],splitNumber:5,axisNameGap:15,scale:!1,shape:"polygon",axisLine:_.merge({lineStyle:{color:"#bbb"}},Hn.axisLine),axisLabel:Un(Hn.axisLabel,!1),axisTick:Un(Hn.axisTick,!1),splitLine:Un(Hn.splitLine,!0),splitArea:Un(Hn.splitArea,!0),indicator:[]},e}(Bi.Z);const jn=Wn;var Xn=i(65),Yn=i(3782),qn=["axisLine","axisTickLabel","axisName"],Kn=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){this.group.removeAll(),this._buildAxes(t),this._buildSplitLineAndArea(t)},e.prototype._buildAxes=function(t){var e=t.coordinateSystem,i=e.getIndicatorAxes(),n=_.map(i,(function(t){var i=t.model.get("showName")?t.name:"";return new yn.Z(t.model,{axisName:i,position:[e.cx,e.cy],rotation:t.angle,labelDirection:-1,tickDirection:-1,nameDirection:1})}));_.each(n,(function(t){_.each(qn,t.add,t),this.group.add(t.getGroup())}),this)},e.prototype._buildSplitLineAndArea=function(t){var e=t.coordinateSystem,i=e.getIndicatorAxes();if(i.length){var n=t.get("shape"),r=t.getModel("splitLine"),o=t.getModel("splitArea"),a=r.getModel("lineStyle"),s=o.getModel("areaStyle"),l=r.get("show"),u=o.get("show"),h=a.get("color"),c=s.get("color"),d=_.isArray(h)?h:[h],p=_.isArray(c)?c:[c],f=[],g=[];if("circle"===n)for(var m=i[0].getTicksCoords(),v=e.cx,y=e.cy,x=0;x=4&&(l={x:parseFloat(c[0]||0),y:parseFloat(c[1]||0),width:parseFloat(c[2]),height:parseFloat(c[3])})}if(l&&null!=a&&null!=s&&(u=Ir(l,{x:0,y:0,width:a,height:s}),!e.ignoreViewBox)){var d=n;(n=new kt.Z).add(d),d.scaleX=d.scaleY=u.scale,d.x=u.x,d.y=u.y}return e.ignoreRootClip||null==a||null==s||n.setClipPath(new De.Z({shape:{x:0,y:0,width:a,height:s}})),{root:n,width:a,height:s,viewBoxRect:l,viewBoxTransform:u,named:r}},t.prototype._parseNode=function(t,e,i,n,r,o){var a,s=t.nodeName.toLowerCase(),l=n;if("defs"===s&&(r=!0),"text"===s&&(o=!0),"defs"===s||"switch"===s)a=e;else{if(!r){var u=ir[s];if(u&&(0,_.hasOwn)(ir,s)){a=u.call(this,t,e);var h=t.getAttribute("name");if(h){var c={name:h,namedFrom:null,svgNodeTagLower:s,el:a};i.push(c),"g"===s&&(l=c)}else n&&i.push({name:n.name,namedFrom:n,svgNodeTagLower:s,el:a});e.add(a)}}var d=gr[s];if(d&&(0,_.hasOwn)(gr,s)){var p=d.call(this,t),f=t.getAttribute("id");f&&(this._defs[f]=p)}}if(a&&a.isGroup)for(var g=t.firstChild;g;)1===g.nodeType?this._parseNode(g,a,i,l,r,o):3===g.nodeType&&o&&this._parseText(g,a),g=g.nextSibling},t.prototype._parseText=function(t,e){var i=new h.Z({style:{text:t.textContent},silent:!0,x:this._textX||0,y:this._textY||0});yr(e,i),xr(t,i,this._defsUsePending,!1,!1),function(t,e){var i=e.__selfStyle;if(i){var n=i.textBaseline,r=n;n&&"auto"!==n?"baseline"===n?r="alphabetic":"before-edge"===n||"text-before-edge"===n?r="top":"after-edge"===n||"text-after-edge"===n?r="bottom":"central"!==n&&"mathematical"!==n||(r="middle"):r="alphabetic",t.style.textBaseline=r}var o=e.__inheritedStyle;if(o){var a=o.textAlign,s=a;a&&("middle"===a&&(s="center"),t.style.textAlign=s)}}(i,e);var n=i.style,r=n.fontSize;r&&r<9&&(n.fontSize=9,i.scaleX*=r/9,i.scaleY*=r/9);var o=(n.fontSize||n.fontFamily)&&[n.fontStyle,n.fontWeight,(n.fontSize||12)+"px",n.fontFamily||"sans-serif"].join(" ");n.font=o;var a=i.getBoundingRect();return this._textX+=a.width,e.add(i),i},t.internalField=void(ir={g:function(t,e){var i=new kt.Z;return yr(e,i),xr(t,i,this._defsUsePending,!1,!1),i},rect:function(t,e){var i=new De.Z;return yr(e,i),xr(t,i,this._defsUsePending,!1,!1),i.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")}),i.silent=!0,i},circle:function(t,e){var i=new Xn.Z;return yr(e,i),xr(t,i,this._defsUsePending,!1,!1),i.setShape({cx:parseFloat(t.getAttribute("cx")||"0"),cy:parseFloat(t.getAttribute("cy")||"0"),r:parseFloat(t.getAttribute("r")||"0")}),i.silent=!0,i},line:function(t,e){var i=new vn.Z;return yr(e,i),xr(t,i,this._defsUsePending,!1,!1),i.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")}),i.silent=!0,i},ellipse:function(t,e){var i=new ar.Z;return yr(e,i),xr(t,i,this._defsUsePending,!1,!1),i.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")}),i.silent=!0,i},polygon:function(t,e){var i,n=t.getAttribute("points");n&&(i=_r(n));var r=new Rn.Z({shape:{points:i||[]},silent:!0});return yr(e,r),xr(t,r,this._defsUsePending,!1,!1),r},polyline:function(t,e){var i,n=t.getAttribute("points");n&&(i=_r(n));var r=new di.Z({shape:{points:i||[]},silent:!0});return yr(e,r),xr(t,r,this._defsUsePending,!1,!1),r},image:function(t,e){var i=new l.ZP;return yr(e,i),xr(t,i,this._defsUsePending,!1,!1),i.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")}),i.silent=!0,i},text:function(t,e){var i=t.getAttribute("x")||"0",n=t.getAttribute("y")||"0",r=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0";this._textX=parseFloat(i)+parseFloat(r),this._textY=parseFloat(n)+parseFloat(o);var a=new kt.Z;return yr(e,a),xr(t,a,this._defsUsePending,!1,!0),a},tspan:function(t,e){var i=t.getAttribute("x"),n=t.getAttribute("y");null!=i&&(this._textX=parseFloat(i)),null!=n&&(this._textY=parseFloat(n));var r=t.getAttribute("dx")||"0",o=t.getAttribute("dy")||"0",a=new kt.Z;return yr(e,a),xr(t,a,this._defsUsePending,!1,!0),this._textX+=parseFloat(r),this._textY+=parseFloat(o),a},path:function(t,e){var i=t.getAttribute("d")||"",n=(0,sr.iR)(i);return yr(e,n),xr(t,n,this._defsUsePending,!1,!1),n.silent=!0,n}}),t}(),gr={lineargradient:function(t){var e=parseInt(t.getAttribute("x1")||"0",10),i=parseInt(t.getAttribute("y1")||"0",10),n=parseInt(t.getAttribute("x2")||"10",10),r=parseInt(t.getAttribute("y2")||"0",10),o=new Vt.Z(e,i,n,r);return mr(t,o),vr(t,o),o},radialgradient:function(t){var e=parseInt(t.getAttribute("cx")||"0",10),i=parseInt(t.getAttribute("cy")||"0",10),n=parseInt(t.getAttribute("r")||"0",10),r=new lr.Z(e,i,n);return mr(t,r),vr(t,r),r}};function mr(t,e){"userSpaceOnUse"===t.getAttribute("gradientUnits")&&(e.global=!0)}function vr(t,e){for(var i=t.firstChild;i;){if(1===i.nodeType&&"stop"===i.nodeName.toLocaleLowerCase()){var n=i.getAttribute("offset"),r=void 0;r=n&&n.indexOf("%")>0?parseInt(n,10)/100:n?parseFloat(n):0;var o={};Lr(i,o,o);var a=o.stopColor||i.getAttribute("stop-color")||"#000000";e.colorStops.push({offset:r,color:a})}i=i.nextSibling}}function yr(t,e){t&&t.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),(0,_.defaults)(e.__inheritedStyle,t.__inheritedStyle))}function _r(t){for(var e=Tr(t),i=[],n=0;n0;o-=2){var a=n[o],s=n[o-1],l=Tr(a);switch(r=r||Qi.create(),s){case"translate":Qi.translate(r,r,[parseFloat(l[0]),parseFloat(l[1]||"0")]);break;case"scale":Qi.scale(r,r,[parseFloat(l[0]),parseFloat(l[1]||l[0])]);break;case"rotate":Qi.rotate(r,r,-parseFloat(l[0])*Cr);break;case"skewX":var u=Math.tan(parseFloat(l[0])*Cr);Qi.mul(r,[1,0,u,1,0,0],r);break;case"skewY":var h=Math.tan(parseFloat(l[0])*Cr);Qi.mul(r,[1,h,0,1,0,0],r);break;case"matrix":r[0]=parseFloat(l[0]),r[1]=parseFloat(l[1]),r[2]=parseFloat(l[2]),r[3]=parseFloat(l[3]),r[4]=parseFloat(l[4]),r[5]=parseFloat(l[5])}}e.setLocalTransform(r)}}(t,e),Lr(t,a,s),n||function(t,e,i){for(var n=0;n0,f={api:i,geo:s,mapOrGeoModel:t,data:a,isVisualEncodedByVisualMap:p,isGeo:o,transformInfoRaw:c};"geoJSON"===s.resourceType?this._buildGeoJSON(f):"geoSVG"===s.resourceType&&this._buildSVG(f),this._updateController(t,e,i),this._updateMapSelectHandler(t,l,i,n)},t.prototype._buildGeoJSON=function(t){var e=this._regionsGroupByName=_.createHashMap(),i=_.createHashMap(),n=this._regionsGroup,r=t.transformInfoRaw,o=t.mapOrGeoModel,a=t.data,s=t.geo.projection,l=s&&s.stream;function u(t,e){return e&&(t=e(t)),t&&[t[0]*r.scaleX+r.x,t[1]*r.scaleY+r.y]}function h(t){for(var e=[],i=!l&&s&&s.project,n=0;n=0)&&(d=r);var p=a?{normal:{align:"center",verticalAlign:"middle"}}:null;(0,ne.ni)(e,(0,ne.k3)(n),{labelFetcher:d,labelDataIndex:c,defaultText:i},p);var f=e.getTextContent();if(f&&(to(f).ignore=f.ignore,e.textConfig&&a)){var g=e.getBoundingRect().clone();e.textConfig.layoutRect=g,e.textConfig.position=[(a[0]-g.x)/g.width*100+"%",(a[1]-g.y)/g.height*100+"%"]}e.disableLabelAnimation=!0}else e.removeTextContent(),e.removeTextConfig(),e.disableLabelAnimation=null}function ao(t,e,i,n,r,o){t.data?t.data.setItemGraphicEl(o,e):(0,oe.A)(e).eventData={componentType:"geo",componentIndex:r.componentIndex,geoIndex:r.componentIndex,name:i,region:n&&n.option||{}}}function so(t,e,i,n,r){t.data||Ie.setTooltipConfig({el:e,componentModel:r,itemName:i,itemTooltipOption:n.get("tooltip")})}function lo(t,e,i,n,r){e.highDownSilentOnTouch=!!r.get("selectedMode");var o=n.getModel("emphasis"),a=o.get("focus");return(0,ie.k5)(e,a,o.get("blurScope"),o.get("disabled")),t.isGeo&&(0,ie.th)(e,r,i),a}function uo(t,e,i){var n,r=[];function o(){n=[]}function a(){n.length&&(r.push(n),n=[])}var s=e({polygonStart:o,polygonEnd:a,lineStart:o,lineEnd:a,point:function(t,e){isFinite(t)&&isFinite(e)&&n.push([t,e])},sphere:function(){}});return!i&&s.polygonStart(),_.each(t,(function(t){s.lineStart();for(var e=0;e-1&&(i.style.stroke=i.style.fill,i.style.fill="#fff",i.style.lineWidth=2),i},e.type="series.map",e.dependencies=["geo"],e.layoutMode="box",e.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:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{areaColor:"rgba(255,215,0,0.8)"}},select:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{color:"rgba(255,215,0,0.8)"}},nameProperty:"name"},e}(Pt.Z);const go=fo;function mo(t){var e={};t.eachSeriesByType("map",(function(t){var i=t.getHostGeoModel(),n=i?"o"+i.id:"i"+t.getMapType();(e[n]=e[n]||[]).push(t)})),_.each(e,(function(t,e){for(var i,n,r,o=(i=_.map(t,(function(t){return t.getData()})),n=t[0].get("mapValueCalculation"),r={},_.each(i,(function(t){t.each(t.mapDimension("value"),(function(e,i){var n="ec-"+t.getName(i);r[n]=r[n]||[],isNaN(e)||r[n].push(e)}))})),i[0].map(i[0].mapDimension("value"),(function(t,e){for(var o="ec-"+i[0].getName(e),a=0,s=1/0,l=-1/0,u=r[o].length,h=0;h1?(p.width=d,p.height=d/_):(p.height=d,p.width=d*_),p.y=c[1]-p.height/2,p.x=c[0]-p.width/2;else{var b=t.getBoxLayoutParams();b.aspect=_,p=oi.ME(b,{width:v,height:y})}this.setViewRect(p.x,p.y,p.width,p.height),this.setCenter(t.get("center"),e),this.setZoom(t.get("zoom"))}var Mo=function(){function t(){this.dimensions=xo}return t.prototype.create=function(t,e){var i=[];function n(t){return{nameProperty:t.get("nameProperty"),aspectScale:t.get("aspectScale"),projection:t.get("projection")}}t.eachComponent("geo",(function(t,r){var o=t.get("map"),a=new So(o+r,o,_.extend({nameMap:t.get("nameMap")},n(t)));a.zoomLimit=t.get("scaleLimit"),i.push(a),t.coordinateSystem=a,a.model=t,a.resize=To,a.resize(t,e)})),t.eachSeries((function(t){if("geo"===t.get("coordinateSystem")){var e=t.get("geoIndex")||0;t.coordinateSystem=i[e]}}));var r={};return t.eachSeriesByType("map",(function(t){if(!t.getHostGeoModel()){var e=t.getMapType();r[e]=r[e]||[],r[e].push(t)}})),_.each(r,(function(t,r){var o=_.map(t,(function(t){return t.get("nameMap")})),a=new So(r,r,_.extend({nameMap:_.mergeAll(o)},n(t[0])));a.zoomLimit=_.retrieve.apply(null,_.map(t,(function(t){return t.get("scaleLimit")}))),i.push(a),a.resize=To,a.resize(t[0],e),_.each(t,(function(t){t.coordinateSystem=a,function(t,e){_.each(e.get("geoCoord"),(function(e,i){t.addGeoCoord(i,e)}))}(a,t)}))})),i},t.prototype.getFilledRegions=function(t,e,i,n){for(var r=(t||[]).slice(),o=_.createHashMap(),a=0;a=0;){var o=e[i];o.hierNode.prelim+=n,o.hierNode.modifier+=n,r+=o.hierNode.change,n+=o.hierNode.shift+r}}(t);var o=(i[0].hierNode.prelim+i[i.length-1].hierNode.prelim)/2;r?(t.hierNode.prelim=r.hierNode.prelim+e(t,r),t.hierNode.modifier=t.hierNode.prelim-o):t.hierNode.prelim=o}else r&&(t.hierNode.prelim=r.hierNode.prelim+e(t,r));t.parentNode.hierNode.defaultAncestor=function(t,e,i,n){if(e){for(var r=t,o=t,a=o.parentNode.children[0],s=e,l=r.hierNode.modifier,u=o.hierNode.modifier,h=a.hierNode.modifier,c=s.hierNode.modifier;s=Fo(s),o=Vo(o),s&&o;){r=Fo(r),a=Vo(a),r.hierNode.ancestor=t;var d=s.hierNode.prelim+c-o.hierNode.prelim-u+n(s,o);d>0&&(Ho(Go(s,t,i),t,d),u+=d,l+=d),c+=s.hierNode.modifier,u+=o.hierNode.modifier,l+=r.hierNode.modifier,h+=a.hierNode.modifier}s&&!Fo(r)&&(r.hierNode.thread=s,r.hierNode.modifier+=c-l),o&&!Vo(a)&&(a.hierNode.thread=o,a.hierNode.modifier+=u-h,i=t)}return i}(t,r,t.parentNode.hierNode.defaultAncestor||n[0],e)}function Ro(t){var e=t.hierNode.prelim+t.parentNode.hierNode.modifier;t.setLayout({x:e},!0),t.hierNode.modifier+=t.parentNode.hierNode.modifier}function zo(t){return arguments.length?t:Uo}function Bo(t,e){return t-=Math.PI/2,{x:e*Math.cos(t),y:e*Math.sin(t)}}function Zo(t,e){return oi.ME(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function Fo(t){var e=t.children;return e.length&&t.isExpand?e[e.length-1]:t.hierNode.thread}function Vo(t){var e=t.children;return e.length&&t.isExpand?e[0]:t.hierNode.thread}function Go(t,e,i){return t.hierNode.ancestor.parentNode===e.parentNode?t.hierNode.ancestor:i}function Ho(t,e,i){var n=i/(e.hierNode.i-t.hierNode.i);e.hierNode.change-=n,e.hierNode.shift+=i,e.hierNode.modifier+=i,e.hierNode.prelim+=i,t.hierNode.change+=n}function Uo(t,e){return t.parentNode===e.parentNode?1:2}var Wo=i(3933),jo=function(){this.parentPoint=[],this.childPoints=[]},Xo=function(t){function e(e){return t.call(this,e)||this}return(0,It.ZT)(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new jo},e.prototype.buildPath=function(t,e){var i=e.childPoints,n=i.length,r=e.parentPoint,o=i[0],a=i[n-1];if(1===n)return t.moveTo(r[0],r[1]),void t.lineTo(o[0],o[1]);var s=e.orient,l="TB"===s||"BT"===s?0:1,u=1-l,h=(0,ri.GM)(e.forkPosition,1),c=[];c[l]=r[l],c[u]=r[u]+(a[u]-r[u])*h,t.moveTo(r[0],r[1]),t.lineTo(c[0],c[1]),t.moveTo(o[0],o[1]),c[l]=o[l],t.lineTo(c[0],c[1]),c[l]=a[l],t.lineTo(c[0],c[1]),t.lineTo(a[0],a[1]);for(var d=1;dy.x)||(b-=Math.PI);var T=w?"left":"right",M=s.getModel("label"),C=M.get("rotate"),A=C*(Math.PI/180),L=m.getTextContent();L&&(m.setTextConfig({position:M.get("position")||T,rotation:null==C?-b:A,origin:"center"}),L.setStyle("verticalAlign","middle"))}var I=s.get(["emphasis","focus"]),D="relative"===I?_.concatArray(a.getAncestorsIndices(),a.getDescendantIndices()):"ancestor"===I?a.getAncestorsIndices():"descendant"===I?a.getDescendantIndices():null;D&&((0,oe.A)(i).focus=D),function(t,e,i,n,r,o,a,s){var l=e.getModel(),u=t.get("edgeShape"),h=t.get("layout"),c=t.getOrient(),d=t.get(["lineStyle","curveness"]),p=t.get("edgeForkPosition"),f=l.getModel("lineStyle").getLineStyle(),g=n.__edge;if("curve"===u)e.parentNode&&e.parentNode!==i&&(g||(g=n.__edge=new Eo.Z({shape:ta(h,c,d,r,r)})),Gt.D(g,{shape:ta(h,c,d,o,a)},t));else if("polyline"===u)if("orthogonal"===h){if(e!==i&&e.children&&0!==e.children.length&&!0===e.isExpand){for(var m=e.children,v=[],y=0;ye&&(e=n.height)}this.height=e+1},t.prototype.getNodeById=function(t){if(this.getId()===t)return this;for(var e=0,i=this.children,n=i.length;e=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,e)},t.prototype.getLayout=function(){return this.hostTree.data.getItemLayout(this.dataIndex)},t.prototype.getModel=function(t){if(!(this.dataIndex<0))return this.hostTree.data.getItemModel(this.dataIndex).getModel(t)},t.prototype.getLevelModel=function(){return(this.hostTree.levelModels||[])[this.depth]},t.prototype.setVisual=function(t,e){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,e)},t.prototype.getVisual=function(t){return this.hostTree.data.getItemVisual(this.dataIndex,t)},t.prototype.getRawIndex=function(){return this.hostTree.data.getRawIndex(this.dataIndex)},t.prototype.getId=function(){return this.hostTree.data.getId(this.dataIndex)},t.prototype.getChildIndex=function(){if(this.parentNode){for(var t=this.parentNode.children,e=0;e=0){var n=i.getData().tree.root,r=t.targetNode;if(_.isString(r)&&(r=n.getNodeById(r)),r&&n.contains(r))return{node:r};var o=t.targetNodeId;if(null!=o&&(r=n.getNodeById(o)))return{node:r}}}function sa(t){for(var e=[];t;)(t=t.parentNode)&&e.push(t);return e.reverse()}function la(t,e){var i=sa(t);return _.indexOf(i,e)>=0}function ua(t,e){for(var i=[];t;){var n=t.dataIndex;i.push({name:t.name,dataIndex:n,value:e.getRawValue(n)}),t=t.parentNode}return i.reverse(),i}var ha=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hasSymbolVisual=!0,e.ignoreStyleOnData=!0,e}return(0,It.ZT)(e,t),e.prototype.getInitialData=function(t){var e={name:t.name,children:t.data},i=t.leaves||{},n=new Gn.Z(i,this,this.ecModel),r=oa.createTree(e,this,(function(t){t.wrapMethod("getItemModel",(function(t,e){var i=r.getNodeByDataIndex(e);return i&&i.children.length&&i.isExpand||(t.parentModel=n),t}))}));var o=0;r.eachNode("preorder",(function(t){t.depth>o&&(o=t.depth)}));var a=t.expandAndCollapse&&t.initialTreeDepth>=0?t.initialTreeDepth:o;return r.root.eachNode("preorder",(function(t){var e=t.hostTree.data.getRawDataItem(t.dataIndex);t.isExpand=e&&null!=e.collapsed?!e.collapsed:t.depth<=a})),r.data},e.prototype.getOrient=function(){var t=this.get("orient");return"horizontal"===t?t="LR":"vertical"===t&&(t="TB"),t},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.formatTooltip=function(t,e,i){for(var n=this.getData().tree,r=n.root.children[0],o=n.getNodeByDataIndex(t),a=o.getValue(),s=o.name;o&&o!==r;)s=o.parentNode.name+"."+s,o=o.parentNode;return(0,Zn.TX)("nameValue",{name:s,value:a,noValue:isNaN(a)||null==a})},e.prototype.getDataParams=function(e){var i=t.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(e);return i.treeAncestors=ua(n,this),i.collapsed=!n.isExpand,i},e.type="series.tree",e.layoutMode="box",e.defaultOption={z:2,coordinateSystem:"view",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",edgeShape:"curve",edgeForkPosition:"50%",roam:!1,nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:"#ccc",width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderWidth:1.5},label:{show:!0},animationEasing:"linear",animationDuration:700,animationDurationUpdate:500},e}(Pt.Z);const ca=ha;function da(t,e){for(var i,n=[t];i=n.pop();)if(e(i),i.isExpand){var r=i.children;if(r.length)for(var o=r.length-1;o>=0;o--)n.push(r[o])}}function pa(t,e){t.eachSeriesByType("tree",(function(t){!function(t,e){var i=Zo(t,e);t.layoutInfo=i;var n=t.get("layout"),r=0,o=0,a=null;"radial"===n?(r=2*Math.PI,o=Math.min(i.height,i.width)/2,a=zo((function(t,e){return(t.parentNode===e.parentNode?1:2)/t.depth}))):(r=i.width,o=i.height,a=zo());var s=t.getData().tree.root,l=s.children[0];if(l){!function(t){var e=t;e.hierNode={defaultAncestor:null,ancestor:e,prelim:0,modifier:0,change:0,shift:0,i:0,thread:null};for(var i,n,r=[e];i=r.pop();)if(n=i.children,i.isExpand&&n.length)for(var o=n.length-1;o>=0;o--){var a=n[o];a.hierNode={defaultAncestor:null,ancestor:a,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},r.push(a)}}(s),function(t,e,i){for(var n,r=[t],o=[];n=r.pop();)if(o.push(n),n.isExpand){var a=n.children;if(a.length)for(var s=0;sh.getLayout().x&&(h=t),t.depth>c.depth&&(c=t)}));var d=u===h?1:a(u,h)/2,p=d-u.getLayout().x,f=0,g=0,m=0,v=0;if("radial"===n)f=r/(h.getLayout().x+d+p),g=o/(c.depth-1||1),da(l,(function(t){m=(t.getLayout().x+p)*f,v=(t.depth-1)*g;var e=Bo(m,v);t.setLayout({x:e.x,y:e.y,rawX:m,rawY:v},!0)}));else{var y=t.getOrient();"RL"===y||"LR"===y?(g=o/(h.getLayout().x+d+p),f=r/(c.depth-1||1),da(l,(function(t){v=(t.getLayout().x+p)*g,m="LR"===y?(t.depth-1)*f:r-(t.depth-1)*f,t.setLayout({x:m,y:v},!0)}))):"TB"!==y&&"BT"!==y||(f=r/(h.getLayout().x+d+p),g=o/(c.depth-1||1),da(l,(function(t){m=(t.getLayout().x+p)*f,v="TB"===y?(t.depth-1)*g:o-(t.depth-1)*g,t.setLayout({x:m,y:v},!0)})))}}}(t,e)}))}function fa(t){t.eachSeriesByType("tree",(function(t){var e=t.getData();e.tree.eachNode((function(t){var i=t.getModel().getModel("itemStyle").getItemStyle(),n=e.ensureUniqueItemVisual(t.dataIndex,"style");(0,_.extend)(n,i)}))}))}var ga=["treemapZoomToNode","treemapRender","treemapMove"];var ma=i(5494);function va(t){var e=t.getData().tree,i={};e.eachNode((function(e){for(var n=e;n&&n.depth>1;)n=n.parentNode;var r=(0,ma.i)(t.ecModel,n.name||n.dataIndex+"",i);e.setVisual("decal",r)}))}var ya=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.preventUsingHoverLayer=!0,i}return(0,It.ZT)(e,t),e.prototype.getInitialData=function(t,e){var i={name:t.name,children:t.data};_a(i);var n=t.levels||[],r=this.designatedVisualItemStyle={},o=new Gn.Z({itemStyle:r},this,e);n=t.levels=function(t,e){var i,n,r=(0,Ht.kF)(e.get("color")),o=(0,Ht.kF)(e.get(["aria","decal","decals"]));if(!r)return;t=t||[],_.each(t,(function(t){var e=new Gn.Z(t),r=e.get("color"),o=e.get("decal");(e.get(["itemStyle","color"])||r&&"none"!==r)&&(i=!0),(e.get(["itemStyle","decal"])||o&&"none"!==o)&&(n=!0)}));var a=t[0]||(t[0]={});i||(a.color=r.slice());!n&&o&&(a.decal=o.slice());return t}(n,e);var a=_.map(n||[],(function(t){return new Gn.Z(t,o,e)}),this),s=oa.createTree(i,this,(function(t){t.wrapMethod("getItemModel",(function(t,e){var i=s.getNodeByDataIndex(e),n=i?a[i.depth]:null;return t.parentModel=n||o,t}))}));return s.data},e.prototype.optionUpdated=function(){this.resetViewRoot()},e.prototype.formatTooltip=function(t,e,i){var n=this.getData(),r=this.getRawValue(t),o=n.getName(t);return(0,Zn.TX)("nameValue",{name:o,value:r})},e.prototype.getDataParams=function(e){var i=t.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(e);return i.treeAncestors=ua(n,this),i.treePathInfo=i.treeAncestors,i},e.prototype.setLayoutInfo=function(t){this.layoutInfo=this.layoutInfo||{},_.extend(this.layoutInfo,t)},e.prototype.mapIdToIndex=function(t){var e=this._idIndexMap;e||(e=this._idIndexMap=_.createHashMap(),this._idIndexMapCount=0);var i=e.get(t);return null==i&&e.set(t,i=this._idIndexMapCount++),i},e.prototype.getViewRoot=function(){return this._viewRoot},e.prototype.resetViewRoot=function(t){t?this._viewRoot=t:t=this._viewRoot;var e=this.getRawData().tree.root;t&&(t===e||e.contains(t))||(this._viewRoot=e)},e.prototype.enableAriaDecal=function(){va(this)},e.type="series.treemap",e.layoutMode="box",e.defaultOption={progressive:0,left:"center",top:"middle",width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.1024,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{color:"rgba(0,0,0,0.7)",textStyle:{color:"#fff"}},emphasis:{itemStyle:{color:"rgba(0,0,0,0.9)"}}},label:{show:!0,distance:0,padding:5,position:"inside",color:"#fff",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:"#fff",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:[]},e}(Pt.Z);function _a(t){var e=0;_.each(t.children,(function(t){_a(t);var i=t.value;_.isArray(i)&&(i=i[0]),e+=i}));var i=t.value;_.isArray(i)&&(i=i[0]),(null==i||isNaN(i))&&(i=e),i<0&&(i=0),_.isArray(t.value)?t.value[0]=i:t.value=i}const xa=ya;var ba=i(4130),wa=function(){function t(t){this.group=new kt.Z,t.add(this.group)}return t.prototype.render=function(t,e,i,n){var r=t.getModel("breadcrumb"),o=this.group;if(o.removeAll(),r.get("show")&&i){var a=r.getModel("itemStyle"),s=r.getModel("emphasis"),l=a.getModel("textStyle"),u=s.getModel(["itemStyle","textStyle"]),h={pos:{left:r.get("left"),right:r.get("right"),top:r.get("top"),bottom:r.get("bottom")},box:{width:e.getWidth(),height:e.getHeight()},emptyItemWidth:r.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(i,h,l),this._renderContent(t,h,a,s,l,u,n),oi.p$(o,h.pos,h.box)}},t.prototype._prepare=function(t,e,i){for(var n=t;n;n=n.parentNode){var r=(0,Ht.U5)(n.getModel().get("name"),""),o=i.getTextRect(r),a=Math.max(o.width+16,e.emptyItemWidth);e.totalWidth+=a+8,e.renderList.push({node:n,text:r,width:a})}},t.prototype._renderContent=function(t,e,i,n,r,o,a){for(var s=0,l=e.emptyItemWidth,u=t.get(["breadcrumb","height"]),h=oi.lq(e.pos,e.box),c=e.totalWidth,d=e.renderList,p=n.getModel("itemStyle").getItemStyle(),f=d.length-1;f>=0;f--){var g=d[f],m=g.node,v=g.width,y=g.text;c>h.width&&(c-=v-l,v=l,y=null);var x=new Rn.Z({shape:{points:Sa(s,0,v,u,f===d.length-1,0===f)},style:(0,_.defaults)(i.getItemStyle(),{lineJoin:"bevel"}),textContent:new j.ZP({style:(0,ne.Lr)(r,{text:y})}),textConfig:{position:"inside"},z2:1e4*ie.zr,onclick:(0,_.curry)(a,m)});x.disableLabelAnimation=!0,x.getTextContent().ensureState("emphasis").style=(0,ne.Lr)(o,{text:y}),x.ensureState("emphasis").style=p,(0,ie.k5)(x,n.get("focus"),n.get("blurScope"),n.get("disabled")),this.group.add(x),Ta(x,t,m),s+=v+8}},t.prototype.remove=function(){this.group.removeAll()},t}();function Sa(t,e,i,n,r,o){var a=[[r?t:t-5,e],[t+i,e],[t+i,e+n],[r?t:t-5,e+n]];return!o&&a.splice(2,0,[t+i+5,e+n/2]),!r&&a.push([t,e+n/2]),a}function Ta(t,e,i){(0,oe.A)(t).eventData={componentType:"series",componentSubType:"treemap",componentIndex:e.componentIndex,seriesIndex:e.seriesIndex,seriesName:e.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:i&&i.dataIndex,name:i&&i.name},treePathInfo:i&&ua(i,e)}}const Ma=wa;var Ca=function(){function t(){this._storage=[],this._elExistsMap={}}return t.prototype.add=function(t,e,i,n,r){return!this._elExistsMap[t.id]&&(this._elExistsMap[t.id]=!0,this._storage.push({el:t,target:e,duration:i,delay:n,easing:r}),!0)},t.prototype.finished=function(t){return this._finishedCallback=t,this},t.prototype.start=function(){for(var t=this,e=this._storage.length,i=function(){--e<=0&&(t._storage.length=0,t._elExistsMap={},t._finishedCallback&&t._finishedCallback())},n=0,r=this._storage.length;n3||Math.abs(t.dy)>3)){var e=this.seriesModel.getData().tree.root;if(!e)return;var i=e.getLayout();if(!i)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:i.x+t.dx,y:i.y+t.dy,width:i.width,height:i.height}})}},e.prototype._onZoom=function(t){var e=t.originX,i=t.originY;if("animating"!==this._state){var n=this.seriesModel.getData().tree.root;if(!n)return;var r=n.getLayout();if(!r)return;var o=new Pi.Z(r.x,r.y,r.width,r.height),a=this.seriesModel.layoutInfo;e-=a.x,i-=a.y;var s=Qi.create();Qi.translate(s,s,[-e,-i]),Qi.scale(s,s,[t.scale,t.scale]),Qi.translate(s,s,[e,i]),o.applyTransform(s),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:o.x,y:o.y,width:o.width,height:o.height}})}},e.prototype._initEvents=function(t){var e=this;t.on("click",(function(t){if("ready"===e._state){var i=e.seriesModel.get("nodeClick",!0);if(i){var n=e.findTarget(t.offsetX,t.offsetY);if(n){var r=n.node;if(r.getLayout().isLeafRoot)e._rootToNode(n);else if("zoomToNode"===i)e._zoomToNode(n);else if("link"===i){var o=r.hostTree.data.getItemModel(r.dataIndex),a=o.get("link",!0),s=o.get("target",!0)||"blank";a&&(0,ae.MI)(a,s)}}}}}),this)},e.prototype._renderBreadcrumb=function(t,e,i){var n=this;i||(i=null!=t.get("leafDepth",!0)?{node:t.getViewRoot()}:this.findTarget(e.getWidth()/2,e.getHeight()/2))||(i={node:t.getData().tree.root}),(this._breadcrumb||(this._breadcrumb=new Ma(this.group))).render(t,e,i.node,(function(e){"animating"!==n._state&&(la(t.getViewRoot(),e)?n._rootToNode({node:e}):n._zoomToNode({node:e}))}))},e.prototype.remove=function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage={nodeGroup:[],background:[],content:[]},this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},e.prototype.dispose=function(){this._clearController()},e.prototype._zoomToNode=function(t){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},e.prototype._rootToNode=function(t){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},e.prototype.findTarget=function(t,e){var i;return this.seriesModel.getViewRoot().eachNode({attr:"viewChildren",order:"preorder"},(function(n){var r=this._storage.background[n.getRawIndex()];if(r){var o=r.transformCoordToLocal(t,e),a=r.shape;if(!(a.x<=o[0]&&o[0]<=a.x+a.width&&a.y<=o[1]&&o[1]<=a.y+a.height))return!1;i={node:n,offsetX:o[0],offsetY:o[1]}}}),this),i},e.type="treemap",e}($t.Z);const Za=Ba;var Fa=_.each,Va=_.isObject,Ga=-1,Ha=function(){function t(e){var i=e.mappingMethod,n=e.type,r=this.option=_.clone(e);this.type=n,this.mappingMethod=i,this._normalizeData=$a[i];var o=t.visualHandlers[n];this.applyVisual=o.applyVisual,this.getColorMapper=o.getColorMapper,this._normalizedToVisual=o._normalizedToVisual[i],"piecewise"===i?(Ua(r),function(t){var e=t.pieceList;t.hasSpecialVisual=!1,_.each(e,(function(e,i){e.originIndex=i,null!=e.visual&&(t.hasSpecialVisual=!0)}))}(r)):"category"===i?r.categories?function(t){var e=t.categories,i=t.categoryMap={},n=t.visual;if(Fa(e,(function(t,e){i[t]=e})),!_.isArray(n)){var r=[];_.isObject(n)?Fa(n,(function(t,e){var n=i[e];r[null!=n?n:Ga]=t})):r[-1]=n,n=Qa(t,r)}for(var o=e.length-1;o>=0;o--)null==n[o]&&(delete i[e[o]],e.pop())}(r):Ua(r,!0):(_.assert("linear"!==i||r.dataExtent),Ua(r))}return t.prototype.mapValueToVisual=function(t){var e=this._normalizeData(t);return this._normalizedToVisual(e,t)},t.prototype.getNormalizer=function(){return _.bind(this._normalizeData,this)},t.listVisualTypes=function(){return _.keys(t.visualHandlers)},t.isValidType=function(e){return t.visualHandlers.hasOwnProperty(e)},t.eachVisual=function(t,e,i){_.isObject(t)?_.each(t,e,i):e.call(i,t)},t.mapVisual=function(e,i,n){var r,o=_.isArray(e)?[]:_.isObject(e)?{}:(r=!0,null);return t.eachVisual(e,(function(t,e){var a=i.call(n,t,e);r?o=a:o[e]=a})),o},t.retrieveVisuals=function(e){var i,n={};return e&&Fa(t.visualHandlers,(function(t,r){e.hasOwnProperty(r)&&(n[r]=e[r],i=!0)})),i?n:null},t.prepareVisualTypes=function(t){if(_.isArray(t))t=t.slice();else{if(!Va(t))return[];var e=[];Fa(t,(function(t,i){e.push(i)})),t=e}return t.sort((function(t,e){return"color"===e&&"color"!==t&&0===t.indexOf("color")?1:-1})),t},t.dependsOn=function(t,e){return"color"===e?!(!t||0!==t.indexOf(e)):t===e},t.findPieceIndex=function(t,e,i){for(var n,r=1/0,o=0,a=e.length;ou[1]&&(u[1]=l);var h=e.get("colorMappingBy"),c={type:a.name,dataExtent:u,visual:a.range};"color"!==c.type||"index"!==h&&"id"!==h?c.mappingMethod="linear":(c.mappingMethod="category",c.loop=!0);var d=new es(c);return is(d).drColorMappingBy=h,d}(0,r,o,0,u,p);(0,_.each)(p,(function(t,e){if(t.depth>=i.length||t===i[t.depth]){var o=function(t,e,i,n,r,o){var a=(0,_.extend)({},e);if(r){var s=r.type,l="color"===s&&is(r).drColorMappingBy,u="index"===l?n:"id"===l?o.mapIdToIndex(i.getId()):i.getValue(t.get("visualDimension"));a[s]=r.mapValueToVisual(u)}return a}(r,u,t,e,f,n);rs(t,o,i,n)}}))}else s=os(u),h.fill=s}}function os(t){var e=as(t,"color");if(e){var i=as(t,"colorAlpha"),n=as(t,"colorSaturation");return n&&(e=(0,se.modifyHSL)(e,null,null,n)),i&&(e=(0,se.modifyAlpha)(e,i)),e}}function as(t,e){var i=t[e];if(null!=i&&"none"!==i)return i}function ss(t,e){var i=t.get(e);return(0,_.isArray)(i)&&i.length?{name:e,range:i}:null}var ls=Math.max,us=Math.min,hs=_.retrieve,cs=_.each,ds=["itemStyle","borderWidth"],ps=["itemStyle","gapWidth"],fs=["upperLabel","show"],gs=["upperLabel","height"];const ms={seriesType:"treemap",reset:function(t,e,i,n){var r=i.getWidth(),o=i.getHeight(),a=t.option,s=oi.ME(t.getBoxLayoutParams(),{width:i.getWidth(),height:i.getHeight()}),l=a.size||[],u=(0,ri.GM)(hs(s.width,l[0]),r),h=(0,ri.GM)(hs(s.height,l[1]),o),c=n&&n.type,d=aa(n,["treemapZoomToNode","treemapRootToNode"],t),p="treemapRender"===c||"treemapMove"===c?n.rootRect:null,f=t.getViewRoot(),g=sa(f);if("treemapMove"!==c){var m="treemapZoomToNode"===c?function(t,e,i,n,r){var o,a=(e||{}).node,s=[n,r];if(!a||a===i)return s;var l=n*r,u=l*t.option.zoomToNodeRatio;for(;o=a.parentNode;){for(var h=0,c=o.children,d=0,p=c.length;dri.YM&&(u=ri.YM),a=o}ua[1]&&(a[1]=e)}))):a=[NaN,NaN];return{sum:n,dataExtent:a}}(e,a,s);if(0===u.sum)return t.viewChildren=[];if(u.sum=function(t,e,i,n,r){if(!n)return i;for(var o=t.get("visibleMin"),a=r.length,s=a,l=a-1;l>=0;l--){var u=r["asc"===n?a-l-1:l].getValue();u/i*en&&(n=a));var l=t.area*t.area,u=e*e*i;return l?ls(u*n/l,l/(u*r)):1/0}function _s(t,e,i,n,r){var o=e===i.width?0:1,a=1-o,s=["x","y"],l=["width","height"],u=i[s[o]],h=e?t.area/e:0;(r||h>i[l[a]])&&(h=i[l[a]]);for(var c=0,d=t.length;c=r/3?1:2),l=e.y-n(a)*o*(o>=r/3?1:2);a=e.angle-Math.PI/2,t.moveTo(s,l),t.lineTo(e.x+i(a)*o,e.y+n(a)*o),t.lineTo(e.x+i(e.angle)*r,e.y+n(e.angle)*r),t.lineTo(e.x-i(a)*o,e.y-n(a)*o),t.lineTo(s,l)},e}(s.ZP);const Ms=Ts;function Cs(t,e){var i=null==t?"":t+"";return e&&((0,_.isString)(e)?i=e.replace("{value}",i):(0,_.isFunction)(e)&&(i=e(t))),i}var As=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){this.group.removeAll();var n=t.get(["axisLine","lineStyle","color"]),r=function(t,e){var i=t.get("center"),n=e.getWidth(),r=e.getHeight(),o=Math.min(n,r);return{cx:(0,ri.GM)(i[0],e.getWidth()),cy:(0,ri.GM)(i[1],e.getHeight()),r:(0,ri.GM)(t.get("radius"),o/2)}}(t,i);this._renderMain(t,e,i,n,r),this._data=t.getData()},e.prototype.dispose=function(){},e.prototype._renderMain=function(t,e,i,n,r){var o=this.group,a=t.get("clockwise"),s=-t.get("startAngle")/180*Math.PI,l=-t.get("endAngle")/180*Math.PI,u=t.getModel("axisLine"),h=u.get("roundCap")?Ne:Pe.C,c=u.get("show"),d=u.getModel("lineStyle"),p=d.get("width"),f=[s,l];(0,N.L)(f,!a);for(var g=(l=f[1])-(s=f[0]),m=s,v=0;c&&v=t&&(0===e?0:n[e-1][0])Math.PI/2&&(Z+=Math.PI):"tangential"===B?Z=-M-Math.PI/2:(0,_.isNumber)(B)&&(Z=B*Math.PI/180),0===Z?c.add(new j.ZP({style:(0,ne.Lr)(x,{text:E,x:R,y:z,verticalAlign:h<-.8?"top":h>.8?"bottom":"middle",align:u<-.4?"left":u>.4?"right":"center"},{inheritColor:N}),silent:!0})):c.add(new j.ZP({style:(0,ne.Lr)(x,{text:E,x:R,y:z,verticalAlign:"middle",align:"center"},{inheritColor:N}),silent:!0,originX:R,originY:z,rotation:Z}))}if(y.get("show")&&P!==b){O=(O=y.get("distance"))?O+l:l;for(var F=0;F<=w;F++){u=Math.cos(M),h=Math.sin(M);var V=new vn.Z({shape:{x1:u*(f-O)+d,y1:h*(f-O)+p,x2:u*(f-T-O)+d,y2:h*(f-T-O)+p},silent:!0,style:I});"auto"===I.stroke&&V.setStyle({stroke:n((P+F/w)/b)}),c.add(V),M+=A}M-=A}else M+=C}},e.prototype._renderPointer=function(t,e,i,n,r,o,a,s,u){var h=this.group,c=this._data,d=this._progressEls,p=[],f=t.get(["pointer","show"]),g=t.getModel("progress"),m=g.get("show"),v=t.getData(),y=v.mapDimension("value"),x=+t.get("min"),b=+t.get("max"),w=[x,b],S=[o,a];function T(e,i){var n,o=v.getItemModel(e).getModel("pointer"),a=(0,ri.GM)(o.get("width"),r.r),s=(0,ri.GM)(o.get("length"),r.r),l=t.get(["pointer","icon"]),u=o.get("offsetCenter"),h=(0,ri.GM)(u[0],r.r),c=(0,ri.GM)(u[1],r.r),d=o.get("keepAspect");return(n=l?(0,Ot.th)(l,h-a/2,c-s,a,s,null,d):new Ms({shape:{angle:-Math.PI/2,width:a,r:s,x:h,y:c}})).rotation=-(i+Math.PI/2),n.x=r.cx,n.y=r.cy,n}function M(t,e){var i=g.get("roundCap")?Ne:Pe.C,n=g.get("overlap"),a=n?g.get("width"):u/v.count(),l=n?r.r-a:r.r-(t+1)*a,h=n?r.r:r.r-t*a,c=new i({shape:{startAngle:o,endAngle:e,cx:r.cx,cy:r.cy,clockwise:s,r0:l,r:h}});return n&&(c.z2=b-v.get(y,t)%b),c}(m||f)&&(v.diff(c).add((function(e){var i=v.get(y,e);if(f){var n=T(e,o);Gt.KZ(n,{rotation:-((isNaN(+i)?S[0]:(0,ri.NU)(i,w,S,!0))+Math.PI/2)},t),h.add(n),v.setItemGraphicEl(e,n)}if(m){var r=M(e,o),a=g.get("clip");Gt.KZ(r,{shape:{endAngle:(0,ri.NU)(i,w,S,a)}},t),h.add(r),(0,oe.Q)(t.seriesIndex,v.dataType,e,r),p[e]=r}})).update((function(e,i){var n=v.get(y,e);if(f){var r=c.getItemGraphicEl(i),a=r?r.rotation:o,s=T(e,a);s.rotation=a,Gt.D(s,{rotation:-((isNaN(+n)?S[0]:(0,ri.NU)(n,w,S,!0))+Math.PI/2)},t),h.add(s),v.setItemGraphicEl(e,s)}if(m){var l=d[i],u=M(e,l?l.shape.endAngle:o),_=g.get("clip");Gt.D(u,{shape:{endAngle:(0,ri.NU)(n,w,S,_)}},t),h.add(u),(0,oe.Q)(t.seriesIndex,v.dataType,e,u),p[e]=u}})).execute(),v.each((function(t){var e=v.getItemModel(t),i=e.getModel("emphasis"),r=i.get("focus"),o=i.get("blurScope"),a=i.get("disabled");if(f){var s=v.getItemGraphicEl(t),u=v.getItemVisual(t,"style"),h=u.fill;if(s instanceof l.ZP){var c=s.style;s.useStyle((0,_.extend)({image:c.image,x:c.x,y:c.y,width:c.width,height:c.height},u))}else s.useStyle(u),"pointer"!==s.type&&s.setColor(h);s.setStyle(e.getModel(["pointer","itemStyle"]).getItemStyle()),"auto"===s.style.fill&&s.setStyle("fill",n((0,ri.NU)(v.get(y,t),w,[0,1],!0))),s.z2EmphasisLift=0,(0,ie.WO)(s,e),(0,ie.k5)(s,r,o,a)}if(m){var d=p[t];d.useStyle(v.getItemVisual(t,"style")),d.setStyle(e.getModel(["progress","itemStyle"]).getItemStyle()),d.z2EmphasisLift=0,(0,ie.WO)(d,e),(0,ie.k5)(d,r,o,a)}})),this._progressEls=p)},e.prototype._renderAnchor=function(t,e){var i=t.getModel("anchor");if(i.get("show")){var n=i.get("size"),r=i.get("icon"),o=i.get("offsetCenter"),a=i.get("keepAspect"),s=(0,Ot.th)(r,e.cx-n/2+(0,ri.GM)(o[0],e.r),e.cy-n/2+(0,ri.GM)(o[1],e.r),n,n,null,a);s.z2=i.get("showAbove")?1:0,s.setStyle(i.getModel("itemStyle").getItemStyle()),this.group.add(s)}},e.prototype._renderTitleAndDetail=function(t,e,i,n,r){var o=this,a=t.getData(),s=a.mapDimension("value"),l=+t.get("min"),u=+t.get("max"),h=new kt.Z,c=[],d=[],p=t.isAnimationEnabled(),f=t.get(["pointer","showAbove"]);a.diff(this._data).add((function(t){c[t]=new j.ZP({silent:!0}),d[t]=new j.ZP({silent:!0})})).update((function(t,e){c[t]=o._titleEls[e],d[t]=o._detailEls[e]})).execute(),a.each((function(e){var i=a.getItemModel(e),o=a.get(s,e),g=new kt.Z,m=n((0,ri.NU)(o,[l,u],[0,1],!0)),v=i.getModel("title");if(v.get("show")){var y=v.get("offsetCenter"),_=r.cx+(0,ri.GM)(y[0],r.r),x=r.cy+(0,ri.GM)(y[1],r.r);(L=c[e]).attr({z2:f?0:2,style:(0,ne.Lr)(v,{x:_,y:x,text:a.getName(e),align:"center",verticalAlign:"middle"},{inheritColor:m})}),g.add(L)}var b=i.getModel("detail");if(b.get("show")){var w=b.get("offsetCenter"),S=r.cx+(0,ri.GM)(w[0],r.r),T=r.cy+(0,ri.GM)(w[1],r.r),M=(0,ri.GM)(b.get("width"),r.r),C=(0,ri.GM)(b.get("height"),r.r),A=t.get(["progress","show"])?a.getItemVisual(e,"style").fill:m,L=d[e],I=b.get("formatter");L.attr({z2:f?0:2,style:(0,ne.Lr)(b,{x:S,y:T,text:Cs(o,I),width:isNaN(M)?null:M,height:isNaN(C)?null:C,align:"center",verticalAlign:"middle"},{inheritColor:A})}),(0,ne.pe)(L,{normal:b},o,(function(t){return Cs(t,I)})),p&&(0,ne.tD)(L,e,a,t,{getFormattedLabel:function(t,e,i,n,r,a){return Cs(a?a.interpolatedValue:o,I)}}),g.add(L)}h.add(g)})),this.group.add(h),this._titleEls=c,this._detailEls=d},e.type="gauge",e}($t.Z);const Ls=As;const Is=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.visualStyleAccessPath="itemStyle",i}return(0,It.ZT)(e,t),e.prototype.getInitialData=function(t,e){return Ci(this,["value"])},e.type="series.gauge",e.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,"#E6EBF8"]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:"#63677A",width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:"#63677A",width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:"#464646",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:"#fff",borderWidth:0,borderColor:"#5470c6"}},title:{show:!0,offsetCenter:[0,"20%"],color:"#464646",fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:"rgba(0,0,0,0)",borderWidth:0,borderColor:"#ccc",width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:"#464646",fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},e}(Pt.Z);var Ds=["itemStyle","opacity"],Ps=function(t){function e(e,i){var n=t.call(this)||this,r=n,o=new di.Z,a=new j.ZP;return r.setTextContent(a),n.setTextGuideLine(o),n.updateData(e,i,!0),n}return(0,It.ZT)(e,t),e.prototype.updateData=function(t,e,i){var n=this,r=t.hostModel,o=t.getItemModel(e),a=t.getItemLayout(e),s=o.getModel("emphasis"),l=o.get(Ds);l=null==l?1:l,i||(0,Gt.Zi)(n),n.useStyle(t.getItemVisual(e,"style")),n.style.lineJoin="round",i?(n.setShape({points:a.points}),n.style.opacity=0,Gt.KZ(n,{style:{opacity:l}},r,e)):Gt.D(n,{style:{opacity:l},shape:{points:a.points}},r,e),(0,ie.WO)(n,o),this._updateLabel(t,e),(0,ie.k5)(this,s.get("focus"),s.get("blurScope"),s.get("disabled"))},e.prototype._updateLabel=function(t,e){var i=this,n=this.getTextGuideLine(),r=i.getTextContent(),o=t.hostModel,a=t.getItemModel(e),s=t.getItemLayout(e).label,l=t.getItemVisual(e,"style"),u=l.fill;(0,ne.ni)(r,(0,ne.k3)(a),{labelFetcher:t.hostModel,labelDataIndex:e,defaultOpacity:l.opacity,defaultText:t.getName(e)},{normal:{align:s.textAlign,verticalAlign:s.verticalAlign}}),i.setTextConfig({local:!0,inside:!!s.inside,insideStroke:u,outsideFill:u});var h=s.linePoints;n.setShape({points:h}),i.textGuideLineConfig={anchor:h?new pi.Z(h[0][0],h[0][1]):null},Gt.D(r,{style:{x:s.x,y:s.y}},o,e),r.attr({rotation:s.rotation,originX:s.x,originY:s.y,z2:10}),(0,fi.Iu)(i,(0,fi.$x)(a),{stroke:u})},e}(Rn.Z);const Os=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.ignoreLabelLineUpdate=!0,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){var n=t.getData(),r=this._data,o=this.group;n.diff(r).add((function(t){var e=new Ps(n,t);n.setItemGraphicEl(t,e),o.add(e)})).update((function(t,e){var i=r.getItemGraphicEl(e);i.updateData(n,t),o.add(i),n.setItemGraphicEl(t,i)})).remove((function(e){var i=r.getItemGraphicEl(e);Gt.XD(i,t,e)})).execute(),this._data=n},e.prototype.remove=function(){this.group.removeAll(),this._data=null},e.prototype.dispose=function(){},e.type="funnel",e}($t.Z);var ks=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.init=function(e){t.prototype.init.apply(this,arguments),this.legendVisualProvider=new Li.Z(_.bind(this.getData,this),_.bind(this.getRawData,this)),this._defaultLabelLine(e)},e.prototype.getInitialData=function(t,e){return Ci(this,{coordDimensions:["value"],encodeDefaulter:_.curry(Ai.Ss,this)})},e.prototype._defaultLabelLine=function(t){(0,Ht.Cc)(t,"labelLine",["show"]);var e=t.labelLine,i=t.emphasis.labelLine;e.show=e.show&&t.label.show,i.show=i.show&&t.emphasis.label.show},e.prototype.getDataParams=function(e){var i=this.getData(),n=t.prototype.getDataParams.call(this,e),r=i.mapDimension("value"),o=i.getSum(r);return n.percent=o?+(i.get(r,e)/o*100).toFixed(2):0,n.$vars.push("percent"),n},e.type="series.funnel",e.defaultOption={z:2,legendHoverLink:!0,colorBy:"data",left:80,top:60,right:80,bottom:60,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:"#fff",borderWidth:1},emphasis:{label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(Pt.Z);const Es=ks;function Ns(t,e){t.eachSeriesByType("funnel",(function(t){var i=t.getData(),n=i.mapDimension("value"),r=t.get("sort"),o=function(t,e){return oi.ME(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}(t,e),a=t.get("orient"),s=o.width,l=o.height,u=function(t,e){for(var i=t.mapDimension("value"),n=t.mapArray(i,(function(t){return t})),r=[],o="ascending"===e,a=0,s=t.count();a5)return;var n=this._model.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]);"none"!==n.behavior&&this._dispatchExpand({axisExpandWindow:n.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(t){if(!this._mouseDownPoint&&qs(this,"mousemove")){var e=this._model,i=e.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]),n=i.behavior;"jump"===n&&this._throttledDispatchExpand.debounceNextCall(e.get("axisExpandDebounce")),this._throttledDispatchExpand("none"===n?null:{axisExpandWindow:i.axisExpandWindow,animation:"jump"===n?null:{duration:0}})}}};function qs(t,e){var i=t._model;return i.get("axisExpandable")&&i.get("axisExpandTriggerOn")===e}const Ks=Xs;var Js=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.init=function(){t.prototype.init.apply(this,arguments),this.mergeOption({})},e.prototype.mergeOption=function(t){var e=this.option;t&&_.merge(e,t,!0),this._initDimensions()},e.prototype.contains=function(t,e){var i=t.get("parallelIndex");return null!=i&&e.getComponent("parallel",i)===this},e.prototype.setAxisExpand=function(t){_.each(["axisExpandable","axisExpandCenter","axisExpandCount","axisExpandWidth","axisExpandWindow"],(function(e){t.hasOwnProperty(e)&&(this.option[e]=t[e])}),this)},e.prototype._initDimensions=function(){var t=this.dimensions=[],e=this.parallelAxisIndex=[],i=_.filter(this.ecModel.queryComponents({mainType:"parallelAxis"}),(function(t){return(t.get("parallelIndex")||0)===this.componentIndex}),this);_.each(i,(function(i){t.push("dim"+i.get("dim")),e.push(i.componentIndex)}))},e.type="parallel",e.dependencies=["parallelAxis"],e.layoutMode="box",e.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},e}(Bi.Z);const Qs=Js;const $s=function(t){function e(e,i,n,r,o){var a=t.call(this,e,i,n)||this;return a.type=r||"value",a.axisIndex=o,a}return(0,It.ZT)(e,t),e.prototype.isHorizontal=function(){return"horizontal"!==this.coordinateSystem.getModel().get("layout")},e}(rn.Z);var tl=i(9233),el=_.each,il=Math.min,nl=Math.max,rl=Math.floor,ol=Math.ceil,al=ri.NM,sl=Math.PI,ll=function(){function t(t,e,i){this.type="parallel",this._axesMap=_.createHashMap(),this._axesLayout={},this.dimensions=t.dimensions,this._model=t,this._init(t,e,i)}return t.prototype._init=function(t,e,i){var n=t.dimensions,r=t.parallelAxisIndex;el(n,(function(t,i){var n=r[i],o=e.getComponent("parallelAxis",n),a=this._axesMap.set(t,new $s(t,Ki.aG(o),[0,0],o.get("type"),n)),s="category"===a.type;a.onBand=s&&o.get("boundaryGap"),a.inverse=o.get("inverse"),o.axis=a,a.model=o,a.coordinateSystem=o.coordinateSystem=this}),this)},t.prototype.update=function(t,e){this._updateAxesFromSeries(this._model,t)},t.prototype.containPoint=function(t){var e=this._makeLayoutInfo(),i=e.axisBase,n=e.layoutBase,r=e.pixelDimIndex,o=t[1-r],a=t[r];return o>=i&&o<=i+e.axisLength&&a>=n&&a<=n+e.layoutLength},t.prototype.getModel=function(){return this._model},t.prototype._updateAxesFromSeries=function(t,e){e.eachSeries((function(i){if(t.contains(i,e)){var n=i.getData();el(this.dimensions,(function(t){var e=this._axesMap.get(t);e.scale.unionExtentFromData(n,n.mapDimension(t)),Ki.Jk(e.scale,e.model)}),this)}}),this)},t.prototype.resize=function(t,e){this._rect=oi.ME(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()}),this._layoutAxes()},t.prototype.getRect=function(){return this._rect},t.prototype._makeLayoutInfo=function(){var t,e=this._model,i=this._rect,n=["x","y"],r=["width","height"],o=e.get("layout"),a="horizontal"===o?0:1,s=i[r[a]],l=[0,s],u=this.dimensions.length,h=ul(e.get("axisExpandWidth"),l),c=ul(e.get("axisExpandCount")||0,[0,u]),d=e.get("axisExpandable")&&u>3&&u>c&&c>1&&h>0&&s>0,p=e.get("axisExpandWindow");p?(t=ul(p[1]-p[0],l),p[1]=p[0]+t):(t=ul(h*(c-1),l),(p=[h*(e.get("axisExpandCenter")||rl(u/2))-t/2])[1]=p[0]+t);var f=(s-t)/(u-c);f<3&&(f=0);var g=[rl(al(p[0]/h,1))+1,ol(al(p[1]/h,1))-1],m=f/h*p[0];return{layout:o,pixelDimIndex:a,layoutBase:i[n[a]],layoutLength:s,axisBase:i[n[1-a]],axisLength:i[r[1-a]],axisExpandable:d,axisExpandWidth:h,axisCollapseWidth:f,axisExpandWindow:p,axisCount:u,winInnerIndices:g,axisExpandWindow0Pos:m}},t.prototype._layoutAxes=function(){var t=this._rect,e=this._axesMap,i=this.dimensions,n=this._makeLayoutInfo(),r=n.layout;e.each((function(t){var e=[0,n.axisLength],i=t.inverse?1:0;t.setExtent(e[i],e[1-i])})),el(i,(function(e,i){var o=(n.axisExpandable?cl:hl)(i,n),a={horizontal:{x:o.position,y:n.axisLength},vertical:{x:0,y:o.position}},s={horizontal:sl/2,vertical:0},l=[a[r].x+t.x,a[r].y+t.y],u=s[r],h=Qi.create();Qi.rotate(h,h,u),Qi.translate(h,h,l),this._axesLayout[e]={position:l,rotation:u,transform:h,axisNameAvailableWidth:o.axisNameAvailableWidth,axisLabelShow:o.axisLabelShow,nameTruncateMaxWidth:o.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}}),this)},t.prototype.getAxis=function(t){return this._axesMap.get(t)},t.prototype.dataToPoint=function(t,e){return this.axisCoordToPoint(this._axesMap.get(e).dataToCoord(t),e)},t.prototype.eachActiveState=function(t,e,i,n){null==i&&(i=0),null==n&&(n=t.count());var r=this._axesMap,o=this.dimensions,a=[],s=[];_.each(o,(function(e){a.push(t.mapDimension(e)),s.push(r.get(e).model)}));for(var l=this.hasAxisBrushed(),u=i;ur*(1-h[0])?(l="jump",a=s-r*(1-h[2])):(a=s-r*h[1])>=0&&(a=s-r*(1-h[1]))<=0&&(a=0),(a*=e.axisExpandWidth/u)?(0,tl.Z)(a,n,o,"all"):l="none";else{var d=n[1]-n[0];(n=[nl(0,o[1]*s/d-d/2)])[1]=il(o[1],n[0]+d),n[0]=n[1]-d}return{axisExpandWindow:n,behavior:l}},t}();function ul(t,e){return il(nl(t,e[0]),e[1])}function hl(t,e){var i=e.layoutLength/(e.axisCount-1);return{position:i*t,axisNameAvailableWidth:i,axisLabelShow:!0}}function cl(t,e){var i,n,r=e.layoutLength,o=e.axisExpandWidth,a=e.axisCount,s=e.axisCollapseWidth,l=e.winInnerIndices,u=s,h=!1;return t=0;i--)ri.dt(e[i])},e.prototype.getActiveState=function(t){var e=this.activeIntervals;if(!e.length)return"normal";if(null==t||isNaN(+t))return"inactive";if(1===e.length){var i=e[0];if(i[0]<=t&&t<=i[1])return"active"}else for(var n=0,r=e.length;n=0&&(o[r[a].depth]=new Gn.Z(r[a],this,e));if(n&&i){var s=(0,Al.Z)(n,i,this,!0,(function(t,e){t.wrapMethod("getItemModel",(function(t,e){var i=t.parentModel,n=i.getData().getItemLayout(e);if(n){var r=n.depth,o=i.levelModels[r];o&&(t.parentModel=o)}return t})),e.wrapMethod("getItemModel",(function(t,e){var i=t.parentModel,n=i.getGraph().getEdgeByIndex(e).node1.getLayout();if(n){var r=n.depth,o=i.levelModels[r];o&&(t.parentModel=o)}return t}))}));return s.data}},e.prototype.setNodePosition=function(t,e){var i=(this.option.data||this.option.nodes)[t];i.localX=e[0],i.localY=e[1]},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.formatTooltip=function(t,e,i){function n(t){return isNaN(t)||null==t}if("edge"===i){var r=this.getDataParams(t,i),o=r.data,a=r.value,s=o.source+" -- "+o.target;return(0,Zn.TX)("nameValue",{name:s,value:a,noValue:n(a)})}var l=this.getGraph().getNodeByIndex(t).getLayout().value,u=this.getDataParams(t,i).data.name;return(0,Zn.TX)("nameValue",{name:null!=u?u+"":null,value:l,noValue:n(l)})},e.prototype.optionUpdated=function(){},e.prototype.getDataParams=function(e,i){var n=t.prototype.getDataParams.call(this,e,i);if(null==n.value&&"node"===i){var r=this.getGraph().getNodeByIndex(e).getLayout().value;n.value=r}return n},e.type="series.sankey",e.defaultOption={z:2,coordinateSystem:"view",left:"5%",top:"5%",right:"20%",bottom:"5%",orient:"horizontal",nodeWidth:20,nodeGap:8,draggable:!0,layoutIterations:32,label:{show:!0,position:"right",fontSize:12},levels:[],nodeAlign:"justify",lineStyle:{color:"#314656",opacity:.2,curveness:.5},emphasis:{label:{show:!0},lineStyle:{opacity:.5}},select:{itemStyle:{borderColor:"#212121"}},animationEasing:"linear",animationDuration:1e3},e}(Pt.Z);const Il=Ll;function Dl(t,e){t.eachSeriesByType("sankey",(function(t){var i=t.get("nodeWidth"),n=t.get("nodeGap"),r=function(t,e){return oi.ME(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}(t,e);t.layoutInfo=r;var o=r.width,a=r.height,s=t.getGraph(),l=s.nodes,u=s.edges;!function(t){_.each(t,(function(t){var e=Fl(t.outEdges,Zl),i=Fl(t.inEdges,Zl),n=t.getValue()||0,r=Math.max(e,i,n);t.setLayout({value:r},!0)}))}(l),function(t,e,i,n,r,o,a,s,l){(function(t,e,i,n,r,o,a){for(var s=[],l=[],u=[],h=[],c=0,d=0;d=0;v&&m.depth>p&&(p=m.depth),g.setLayout({depth:v?m.depth:c},!0),"vertical"===o?g.setLayout({dy:i},!0):g.setLayout({dx:i},!0);for(var y=0;yc-1?p:c-1;a&&"left"!==a&&function(t,e,i,n){if("right"===e){for(var r=[],o=t,a=0;o.length;){for(var s=0;s0;o--)kl(s,l*=.99,a),Ol(s,r,i,n,a),Vl(s,l,a),Ol(s,r,i,n,a)}(t,e,o,r,n,a,s),function(t,e){var i="vertical"===e?"x":"y";_.each(t,(function(t){t.outEdges.sort((function(t,e){return t.node2.getLayout()[i]-e.node2.getLayout()[i]})),t.inEdges.sort((function(t,e){return t.node1.getLayout()[i]-e.node1.getLayout()[i]}))})),_.each(t,(function(t){var e=0,i=0;_.each(t.outEdges,(function(t){t.setLayout({sy:e},!0),e+=t.getLayout().dy})),_.each(t.inEdges,(function(t){t.setLayout({ty:i},!0),i+=t.getLayout().dy}))}))}(t,s)}(l,u,i,n,o,a,0!==_.filter(l,(function(t){return 0===t.getLayout().value})).length?0:t.get("layoutIterations"),t.get("orient"),t.get("nodeAlign"))}))}function Pl(t){var e=t.hostGraph.data.getRawDataItem(t.dataIndex);return null!=e.depth&&e.depth>=0}function Ol(t,e,i,n,r){var o="vertical"===r?"x":"y";_.each(t,(function(t){var a,s,l;t.sort((function(t,e){return t.getLayout()[o]-e.getLayout()[o]}));for(var u=0,h=t.length,c="vertical"===r?"dx":"dy",d=0;d0&&(a=s.getLayout()[o]+l,"vertical"===r?s.setLayout({x:a},!0):s.setLayout({y:a},!0)),u=s.getLayout()[o]+s.getLayout()[c]+e;if((l=u-e-("vertical"===r?n:i))>0){a=s.getLayout()[o]-l,"vertical"===r?s.setLayout({x:a},!0):s.setLayout({y:a},!0),u=a;for(d=h-2;d>=0;--d)(l=(s=t[d]).getLayout()[o]+s.getLayout()[c]+e-u)>0&&(a=s.getLayout()[o]-l,"vertical"===r?s.setLayout({x:a},!0):s.setLayout({y:a},!0)),u=s.getLayout()[o]}}))}function kl(t,e,i){_.each(t.slice().reverse(),(function(t){_.each(t,(function(t){if(t.outEdges.length){var n=Fl(t.outEdges,El,i)/Fl(t.outEdges,Zl);if(isNaN(n)){var r=t.outEdges.length;n=r?Fl(t.outEdges,Nl,i)/r:0}if("vertical"===i){var o=t.getLayout().x+(n-Bl(t,i))*e;t.setLayout({x:o},!0)}else{var a=t.getLayout().y+(n-Bl(t,i))*e;t.setLayout({y:a},!0)}}}))}))}function El(t,e){return Bl(t.node2,e)*t.getValue()}function Nl(t,e){return Bl(t.node2,e)}function Rl(t,e){return Bl(t.node1,e)*t.getValue()}function zl(t,e){return Bl(t.node1,e)}function Bl(t,e){return"vertical"===e?t.getLayout().x+t.getLayout().dx/2:t.getLayout().y+t.getLayout().dy/2}function Zl(t){return t.getValue()}function Fl(t,e,i){for(var n=0,r=t.length,o=-1;++on&&(n=e)})),_.each(e,(function(e){var r=new es({type:"color",mappingMethod:"linear",dataExtent:[i,n],visual:t.get("color")}).mapValueToVisual(e.getLayout().value),o=e.getModel().get(["itemStyle","color"]);null!=o?(e.setVisual("color",o),e.setVisual("style",{fill:o})):(e.setVisual("color",r),e.setVisual("style",{fill:r}))}))}}))}var Hl=i(381),Ul=function(){function t(){}return t.prototype.getInitialData=function(t,e){var i,n,r=e.getComponent("xAxis",this.get("xAxisIndex")),o=e.getComponent("yAxis",this.get("yAxisIndex")),a=r.get("type"),s=o.get("type");"category"===a?(t.layout="horizontal",i=r.getOrdinalMeta(),n=!0):"category"===s?(t.layout="vertical",i=o.getOrdinalMeta(),n=!0):t.layout=t.layout||"horizontal";var l=["x","y"],u="horizontal"===t.layout?0:1,h=this._baseAxisDim=l[u],c=l[1-u],d=[r,o],p=d[u].get("type"),f=d[1-u].get("type"),g=t.data;if(g&&n){var m=[];_.each(g,(function(t,e){var i;_.isArray(t)?(i=t.slice(),t.unshift(e)):_.isArray(t.value)?((i=_.extend({},t)).value=i.value.slice(),t.value.unshift(e)):i=t,m.push(i)})),t.data=m}var v=this.defaultValueDimensions,y=[{name:h,type:(0,Hl.T)(p),ordinalMeta:i,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:c,type:(0,Hl.T)(f),dimsDef:v.slice()}];return Ci(this,{coordDimensions:y,dimensionsCount:v.length+1,encodeDefaulter:_.curry(Ai.pY,y,this)})},t.prototype.getBaseAxis=function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis},t}(),Wl=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.defaultValueDimensions=[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],i.visualDrawType="stroke",i}return(0,It.ZT)(e,t),e.type="series.boxplot",e.dependencies=["xAxis","yAxis","grid"],e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,boxWidth:[7,50],itemStyle:{color:"#fff",borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0,0,0,0.2)"}},animationDuration:800},e}(Pt.Z);(0,_.mixin)(Wl,Ul,!0);const jl=Wl;var Xl=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){var n=t.getData(),r=this.group,o=this._data;this._data||r.removeAll();var a="horizontal"===t.get("layout")?1:0;n.diff(o).add((function(t){if(n.hasValue(t)){var e=Kl(n.getItemLayout(t),n,t,a,!0);n.setItemGraphicEl(t,e),r.add(e)}})).update((function(t,e){var i=o.getItemGraphicEl(e);if(n.hasValue(t)){var s=n.getItemLayout(t);i?((0,Gt.Zi)(i),Jl(s,i,n,t)):i=Kl(s,n,t,a),r.add(i),n.setItemGraphicEl(t,i)}else r.remove(i)})).remove((function(t){var e=o.getItemGraphicEl(t);e&&r.remove(e)})).execute(),this._data=n},e.prototype.remove=function(t){var e=this.group,i=this._data;this._data=null,i&&i.eachItemGraphicEl((function(t){t&&e.remove(t)}))},e.type="boxplot",e}($t.Z),Yl=function(){},ql=function(t){function e(e){var i=t.call(this,e)||this;return i.type="boxplotBoxPath",i}return(0,It.ZT)(e,t),e.prototype.getDefaultShape=function(){return new Yl},e.prototype.buildPath=function(t,e){var i=e.points,n=0;for(t.moveTo(i[n][0],i[n][1]),n++;n<4;n++)t.lineTo(i[n][0],i[n][1]);for(t.closePath();ng){var b=[v,x];n.push(b)}}}return{boxData:i,outliers:n}}(e.getRawData(),t.config);return[{dimensions:["ItemName","Low","Q1","Q2","Q3","High"],data:i.boxData},{data:i.outliers}]}};var au=["color","borderColor"],su=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){this.group.removeClipPath(),this._progressiveEls=null,this._updateDrawMode(t),this._isLargeDraw?this._renderLarge(t):this._renderNormal(t)},e.prototype.incrementalPrepareRender=function(t,e,i){this._clear(),this._updateDrawMode(t)},e.prototype.incrementalRender=function(t,e,i,n){this._progressiveEls=[],this._isLargeDraw?this._incrementalRenderLarge(t,e):this._incrementalRenderNormal(t,e)},e.prototype.eachRendered=function(t){Ie.traverseElements(this._progressiveEls||this.group,t)},e.prototype._updateDrawMode=function(t){var e=t.pipelineContext.large;null!=this._isLargeDraw&&e===this._isLargeDraw||(this._isLargeDraw=e,this._clear())},e.prototype._renderNormal=function(t){var e=t.getData(),i=this._data,n=this.group,r=e.getLayout("isSimpleBox"),o=t.get("clip",!0),a=t.coordinateSystem,s=a.getArea&&a.getArea();this._data||n.removeAll(),e.diff(i).add((function(i){if(e.hasValue(i)){var a=e.getItemLayout(i);if(o&&cu(s,a))return;var l=hu(a,i,!0);Gt.KZ(l,{shape:{points:a.ends}},t,i),du(l,e,i,r),n.add(l),e.setItemGraphicEl(i,l)}})).update((function(a,l){var u=i.getItemGraphicEl(l);if(e.hasValue(a)){var h=e.getItemLayout(a);o&&cu(s,h)?n.remove(u):(u?(Gt.D(u,{shape:{points:h.ends}},t,a),(0,Gt.Zi)(u)):u=hu(h,a),du(u,e,a,r),n.add(u),e.setItemGraphicEl(a,u))}else n.remove(u)})).remove((function(t){var e=i.getItemGraphicEl(t);e&&n.remove(e)})).execute(),this._data=e},e.prototype._renderLarge=function(t){this._clear(),mu(t,this.group);var e=t.get("clip",!0)?(0,te.lQ)(t.coordinateSystem,!1,t):null;e?this.group.setClipPath(e):this.group.removeClipPath()},e.prototype._incrementalRenderNormal=function(t,e){for(var i,n=e.getData(),r=n.getLayout("isSimpleBox");null!=(i=t.next());){var o=hu(n.getItemLayout(i),i);du(o,n,i,r),o.incremental=!0,this.group.add(o),this._progressiveEls.push(o)}},e.prototype._incrementalRenderLarge=function(t,e){mu(e,this.group,this._progressiveEls,!0)},e.prototype.remove=function(t){this._clear()},e.prototype._clear=function(){this.group.removeAll(),this._data=null},e.type="candlestick",e}($t.Z),lu=function(){},uu=function(t){function e(e){var i=t.call(this,e)||this;return i.type="normalCandlestickBox",i}return(0,It.ZT)(e,t),e.prototype.getDefaultShape=function(){return new lu},e.prototype.buildPath=function(t,e){var i=e.points;this.__simpleBox?(t.moveTo(i[4][0],i[4][1]),t.lineTo(i[6][0],i[6][1])):(t.moveTo(i[0][0],i[0][1]),t.lineTo(i[1][0],i[1][1]),t.lineTo(i[2][0],i[2][1]),t.lineTo(i[3][0],i[3][1]),t.closePath(),t.moveTo(i[4][0],i[4][1]),t.lineTo(i[5][0],i[5][1]),t.moveTo(i[6][0],i[6][1]),t.lineTo(i[7][0],i[7][1]))},e}(s.ZP);function hu(t,e,i){var n=t.ends;return new uu({shape:{points:i?pu(n,t):n},z2:100})}function cu(t,e){for(var i=!0,n=0;n0?"borderColor":"borderColor0"])||i.get(["itemStyle",t>0?"color":"color0"]),o=i.getModel("itemStyle").getItemStyle(au);e.useStyle(o),e.style.fill=null,e.style.stroke=r}const yu=su;var _u=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.defaultValueDimensions=[{name:"open",defaultTooltip:!0},{name:"close",defaultTooltip:!0},{name:"lowest",defaultTooltip:!0},{name:"highest",defaultTooltip:!0}],i}return(0,It.ZT)(e,t),e.prototype.getShadowDim=function(){return"open"},e.prototype.brushSelector=function(t,e,i){var n=e.getItemLayout(t);return n&&i.rect(n.brushRect)},e.type="series.candlestick",e.dependencies=["xAxis","yAxis","grid"],e.defaultOption={z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,layout:null,clip:!0,itemStyle:{color:"#eb5454",color0:"#47b262",borderColor:"#eb5454",borderColor0:"#47b262",borderWidth:1},emphasis:{scale:!0,itemStyle:{borderWidth:2}},barMaxWidth:null,barMinWidth:null,barWidth:null,large:!0,largeThreshold:600,progressive:3e3,progressiveThreshold:1e4,progressiveChunkMode:"mod",animationEasing:"linear",animationDuration:300},e}(Pt.Z);(0,_.mixin)(_u,Ul,!0);const xu=_u;function bu(t){t&&_.isArray(t.series)&&_.each(t.series,(function(t){_.isObject(t)&&"k"===t.type&&(t.type="candlestick")}))}var wu=i(5682),Su=["itemStyle","borderColor"],Tu=["itemStyle","borderColor0"],Mu=["itemStyle","color"],Cu=["itemStyle","color0"],Au={seriesType:"candlestick",plan:(0,wu.Z)(),performRawSeries:!0,reset:function(t,e){function i(t,e){return e.get(t>0?Mu:Cu)}function n(t,e){return e.get(t>0?Su:Tu)}if(!e.isSeriesFiltered(t))return!t.pipelineContext.large&&{progress:function(t,e){for(var r;null!=(r=t.next());){var o=e.getItemModel(r),a=e.getItemLayout(r).sign,s=o.getItemStyle();s.fill=i(a,o),s.stroke=n(a,o)||s.fill;var l=e.ensureUniqueItemVisual(r,"style");(0,_.extend)(l,s)}}}}};const Lu=Au;var Iu={seriesType:"candlestick",plan:(0,wu.Z)(),reset:function(t){var e=t.coordinateSystem,i=t.getData(),n=function(t,e){var i,n=t.getBaseAxis(),r="category"===n.type?n.getBandWidth():(i=n.getExtent(),Math.abs(i[1]-i[0])/e.count()),o=(0,ri.GM)((0,_.retrieve2)(t.get("barMaxWidth"),r),r),a=(0,ri.GM)((0,_.retrieve2)(t.get("barMinWidth"),1),r),s=t.get("barWidth");return null!=s?(0,ri.GM)(s,r):Math.max(Math.min(r/2,o),a)}(t,i),r=["x","y"],o=i.getDimensionIndex(i.mapDimension(r[0])),a=(0,_.map)(i.mapDimensionsAll(r[1]),i.getDimensionIndex,i),s=a[0],l=a[1],u=a[2],h=a[3];if(i.setLayout({candleWidth:n,isSimpleBox:n<=1.3}),!(o<0||a.length<4))return{progress:t.pipelineContext.large?function(t,i){var n,r,a=(0,Ft.o)(4*t.count),c=0,d=[],p=[],f=i.getStore();for(;null!=(r=t.next());){var g=f.get(o,r),m=f.get(s,r),v=f.get(l,r),y=f.get(u,r),_=f.get(h,r);isNaN(g)||isNaN(y)||isNaN(_)?(a[c++]=NaN,c+=3):(a[c++]=Du(f,r,m,v,l),d[0]=g,d[1]=y,n=e.dataToPoint(d,null,p),a[c++]=n?n[0]:NaN,a[c++]=n?n[1]:NaN,d[1]=_,n=e.dataToPoint(d,null,p),a[c++]=n?n[1]:NaN)}i.setLayout("largePoints",a)}:function(t,i){var r,a=i.getStore();for(;null!=(r=t.next());){var c=a.get(o,r),d=a.get(s,r),p=a.get(l,r),f=a.get(u,r),g=a.get(h,r),m=Math.min(d,p),v=Math.max(d,p),y=S(m,c),_=S(v,c),x=S(f,c),b=S(g,c),w=[];T(w,_,0),T(w,y,1),w.push(C(b),C(_),C(x),C(y)),i.setItemLayout(r,{sign:Du(a,r,d,p,l),initBaseline:d>p?_[1]:y[1],ends:w,brushRect:M(f,g,c)})}function S(t,i){var n=[];return n[0]=i,n[1]=t,isNaN(i)||isNaN(t)?[NaN,NaN]:e.dataToPoint(n)}function T(t,e,i){var r=e.slice(),o=e.slice();r[0]=(0,Ie.subPixelOptimize)(r[0]+n/2,1,!1),o[0]=(0,Ie.subPixelOptimize)(o[0]-n/2,1,!0),i?t.push(r,o):t.push(o,r)}function M(t,e,i){var r=S(t,i),o=S(e,i);return r[0]-=n/2,o[0]-=n/2,{x:r[0],y:r[1],width:n,height:o[1]-r[1]}}function C(t){return t[0]=(0,Ie.subPixelOptimize)(t[0],1),t}}}}};function Du(t,e,i,n,r){return i>n?-1:i0?t.get(r,e-1)<=n?1:-1:1}const Pu=Iu;var Ou=i(9517),ku=i(241),Eu=function(){function t(){this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={inRange:null,outOfRange:null};var t=X.qW.createCanvas();this.canvas=t}return t.prototype.update=function(t,e,i,n,r,o){var a=this._getBrush(),s=this._getGradient(r,"inRange"),l=this._getGradient(r,"outOfRange"),u=this.pointSize+this.blurSize,h=this.canvas,c=h.getContext("2d"),d=t.length;h.width=e,h.height=i;for(var p=0;p0){var M=o(v)?s:l;v>0&&(v=v*S+w),_[x++]=M[T],_[x++]=M[T+1],_[x++]=M[T+2],_[x++]=M[T+3]*v*256}else x+=4}return c.putImageData(y,0,0),h},t.prototype._getBrush=function(){var t=this._brushCanvas||(this._brushCanvas=X.qW.createCanvas()),e=this.pointSize+this.blurSize,i=2*e;t.width=i,t.height=i;var n=t.getContext("2d");return n.clearRect(0,0,i,i),n.shadowOffsetX=i,n.shadowBlur=this.blurSize,n.shadowColor="#000",n.beginPath(),n.arc(-e,e,this.pointSize,0,2*Math.PI,!0),n.closePath(),n.fill(),t},t.prototype._getGradient=function(t,e){for(var i=this._gradientPixels,n=i[e]||(i[e]=new Uint8ClampedArray(1024)),r=[0,0,0,0],o=0,a=0;a<256;a++)t[e](a/255,!0,r),n[o++]=r[0],n[o++]=r[1],n[o++]=r[2],n[o++]=r[3];return n},t}();const Nu=Eu;function Ru(t){var e=t.dimensions;return"lng"===e[0]&&"lat"===e[1]}var zu=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){var n;e.eachComponent("visualMap",(function(e){e.eachTargetSeries((function(i){i===t&&(n=e)}))})),this._progressiveEls=null,this.group.removeAll();var r=t.coordinateSystem;"cartesian2d"===r.type||"calendar"===r.type?this._renderOnCartesianAndCalendar(t,i,0,t.getData().count()):Ru(r)&&this._renderOnGeo(r,t,n,i)},e.prototype.incrementalPrepareRender=function(t,e,i){this.group.removeAll()},e.prototype.incrementalRender=function(t,e,i,n){var r=e.coordinateSystem;r&&(Ru(r)?this.render(e,i,n):(this._progressiveEls=[],this._renderOnCartesianAndCalendar(e,n,t.start,t.end,!0)))},e.prototype.eachRendered=function(t){Ie.traverseElements(this._progressiveEls||this.group,t)},e.prototype._renderOnCartesianAndCalendar=function(t,e,i,n,r){var o,a,s,l,u=t.coordinateSystem,h=ee(u,"cartesian2d");if(h){var c=u.getAxis("x"),d=u.getAxis("y");0,o=c.getBandWidth()+.5,a=d.getBandWidth()+.5,s=c.scale.getExtent(),l=d.scale.getExtent()}for(var p=this.group,f=t.getData(),g=t.getModel(["emphasis","itemStyle"]).getItemStyle(),m=t.getModel(["blur","itemStyle"]).getItemStyle(),v=t.getModel(["select","itemStyle"]).getItemStyle(),y=t.get(["itemStyle","borderRadius"]),_=(0,ne.k3)(t),x=t.getModel("emphasis"),b=x.get("focus"),w=x.get("blurScope"),S=x.get("disabled"),T=h?[f.mapDimension("x"),f.mapDimension("y"),f.mapDimension("value")]:[f.mapDimension("time"),f.mapDimension("value")],M=i;Ms[1]||Il[1])continue;var D=u.dataToPoint([L,I]);C=new De.Z({shape:{x:D[0]-o/2,y:D[1]-a/2,width:o,height:a},style:A})}else{if(isNaN(f.get(T[1],M)))continue;C=new De.Z({z2:1,shape:u.dataToRect([f.get(T[0],M)]).contentShape,style:A})}if(f.hasItemOption){var P=f.getItemModel(M),O=P.getModel("emphasis");g=O.getModel("itemStyle").getItemStyle(),m=P.getModel(["blur","itemStyle"]).getItemStyle(),v=P.getModel(["select","itemStyle"]).getItemStyle(),y=P.get(["itemStyle","borderRadius"]),b=O.get("focus"),w=O.get("blurScope"),S=O.get("disabled"),_=(0,ne.k3)(P)}C.shape.r=y;var k=t.getRawValue(M),E="-";k&&null!=k[2]&&(E=k[2]+""),(0,ne.ni)(C,_,{labelFetcher:t,labelDataIndex:M,defaultOpacity:A.opacity,defaultText:E}),C.ensureState("emphasis").style=g,C.ensureState("blur").style=m,C.ensureState("select").style=v,(0,ie.k5)(C,b,w,S),C.incremental=r,r&&(C.states.emphasis.hoverLayer=!0),p.add(C),f.setItemGraphicEl(M,C),this._progressiveEls&&this._progressiveEls.push(C)}},e.prototype._renderOnGeo=function(t,e,i,n){var r=i.targetVisuals.inRange,o=i.targetVisuals.outOfRange,a=e.getData(),s=this._hmLayer||this._hmLayer||new Nu;s.blurSize=e.get("blurSize"),s.pointSize=e.get("pointSize"),s.minOpacity=e.get("minOpacity"),s.maxOpacity=e.get("maxOpacity");var u=t.getViewRect().clone(),h=t.getRoamTransform();u.applyTransform(h);var c=Math.max(u.x,0),d=Math.max(u.y,0),p=Math.min(u.width+u.x,n.getWidth()),f=Math.min(u.height+u.y,n.getHeight()),g=p-c,m=f-d,v=[a.mapDimension("lng"),a.mapDimension("lat"),a.mapDimension("value")],y=a.mapArray(v,(function(e,i,n){var r=t.dataToPoint([e,i]);return r[0]-=c,r[1]-=d,r.push(n),r})),x=i.getExtent(),b="visualMap.continuous"===i.type?function(t,e){var i=t[1]-t[0];return e=[(e[0]-t[0])/i,(e[1]-t[0])/i],function(t){return t>=e[0]&&t<=e[1]}}(x,i.option.range):function(t,e,i){var n=t[1]-t[0],r=(e=_.map(e,(function(e){return{interval:[(e.interval[0]-t[0])/n,(e.interval[1]-t[0])/n]}}))).length,o=0;return function(t){var n;for(n=o;n=0;n--){var a;if((a=e[n].interval)[0]<=t&&t<=a[1]){o=n;break}}return n>=0&&n0?1:-1}(i,o,r,n,c),function(t,e,i,n,r,o,a,s,l,u){var h,c=l.valueDim,d=l.categoryDim,p=Math.abs(i[d.wh]),f=t.getItemVisual(e,"symbolSize");h=_.isArray(f)?f.slice():null==f?["100%","100%"]:[f,f];h[d.index]=(0,ri.GM)(h[d.index],p),h[c.index]=(0,ri.GM)(h[c.index],n?p:Math.abs(o)),u.symbolSize=h;var g=u.symbolScale=[h[0]/s,h[1]/s];g[c.index]*=(l.isHorizontal?-1:1)*a}(t,e,r,o,0,c.boundingLength,c.pxSign,u,n,c),function(t,e,i,n,r){var o=t.get(Vu)||0;o&&(Hu.attr({scaleX:e[0],scaleY:e[1],rotation:i}),Hu.updateTransform(),o/=Hu.getLineScale(),o*=e[n.valueDim.index]);r.valueLineWidth=o||0}(i,c.symbolScale,l,n,c);var d=c.symbolSize,p=(0,Ot.Cq)(i.get("symbolOffset"),d);return function(t,e,i,n,r,o,a,s,l,u,h,c){var d=h.categoryDim,p=h.valueDim,f=c.pxSign,g=Math.max(e[p.index]+s,0),m=g;if(n){var v=Math.abs(l),y=_.retrieve(t.get("symbolMargin"),"15%")+"",x=!1;y.lastIndexOf("!")===y.length-1&&(x=!0,y=y.slice(0,y.length-1));var b=(0,ri.GM)(y,e[p.index]),w=Math.max(g+2*b,0),S=x?0:2*b,T=(0,ri.kE)(n),M=T?n:ah((v+S)/w);w=g+2*(b=(v-M*g)/2/(x?M:Math.max(M-1,1))),S=x?0:2*b,T||"fixed"===n||(M=u?ah((Math.abs(u)+S)/w):0),m=M*w-S,c.repeatTimes=M,c.symbolMargin=b}var C=f*(m/2),A=c.pathPosition=[];A[d.index]=i[d.wh]/2,A[p.index]="start"===a?C:"end"===a?l-C:l/2,o&&(A[0]+=o[0],A[1]+=o[1]);var L=c.bundlePosition=[];L[d.index]=i[d.xy],L[p.index]=i[p.xy];var I=c.barRectShape=_.extend({},i);I[p.wh]=f*Math.max(Math.abs(i[p.wh]),Math.abs(A[p.index]+C)),I[d.wh]=i[d.wh];var D=c.clipShape={};D[d.xy]=-i[d.xy],D[d.wh]=h.ecSize[d.wh],D[p.xy]=0,D[p.wh]=i[p.wh]}(i,d,r,o,0,p,s,c.valueLineWidth,c.boundingLength,c.repeatCutLength,n,c),c}function Wu(t,e){return t.toGlobalCoord(t.dataToCoord(t.scale.parse(e)))}function ju(t){var e=t.symbolPatternSize,i=(0,Ot.th)(t.symbolType,-e/2,-e/2,e,e);return i.attr({culling:!0}),"image"!==i.type&&i.setStyle({strokeNoScale:!0}),i}function Xu(t,e,i,n){var r=t.__pictorialBundle,o=i.symbolSize,a=i.valueLineWidth,s=i.pathPosition,l=e.valueDim,u=i.repeatTimes||0,h=0,c=o[e.valueDim.index]+a+2*i.symbolMargin;for(nh(t,(function(t){t.__pictorialAnimationIndex=h,t.__pictorialRepeatTimes=u,h0:n<0)&&(r=u-1-t),e[l.index]=c*(r-u/2+.5)+s[l.index],{x:e[0],y:e[1],scaleX:i.symbolScale[0],scaleY:i.symbolScale[1],rotation:i.rotation}}}function Yu(t,e,i,n){var r=t.__pictorialBundle,o=t.__pictorialMainPath;o?rh(o,null,{x:i.pathPosition[0],y:i.pathPosition[1],scaleX:i.symbolScale[0],scaleY:i.symbolScale[1],rotation:i.rotation},i,n):(o=t.__pictorialMainPath=ju(i),r.add(o),rh(o,{x:i.pathPosition[0],y:i.pathPosition[1],scaleX:0,scaleY:0,rotation:i.rotation},{scaleX:i.symbolScale[0],scaleY:i.symbolScale[1]},i,n))}function qu(t,e,i){var n=_.extend({},e.barRectShape),r=t.__pictorialBarRect;r?rh(r,null,{shape:n},e,i):((r=t.__pictorialBarRect=new De.Z({z2:2,shape:n,silent:!0,style:{stroke:"transparent",fill:"transparent",lineWidth:0}})).disableMorphing=!0,t.add(r))}function Ku(t,e,i,n){if(i.symbolClip){var r=t.__pictorialClipPath,o=_.extend({},i.clipShape),a=e.valueDim,s=i.animationModel,l=i.dataIndex;if(r)Gt.D(r,{shape:o},s,l);else{o[a.wh]=0,r=new De.Z({shape:o}),t.__pictorialBundle.setClipPath(r),t.__pictorialClipPath=r;var u={};u[a.wh]=i.clipShape[a.wh],Ie[n?"updateProps":"initProps"](r,{shape:u},s,l)}}}function Ju(t,e){var i=t.getItemModel(e);return i.getAnimationDelayParams=Qu,i.isAnimationEnabled=$u,i}function Qu(t){return{index:t.__pictorialAnimationIndex,count:t.__pictorialRepeatTimes}}function $u(){return this.parentModel.isAnimationEnabled()&&!!this.getShallow("animation")}function th(t,e,i,n){var r=new kt.Z,o=new kt.Z;return r.add(o),r.__pictorialBundle=o,o.x=i.bundlePosition[0],o.y=i.bundlePosition[1],i.symbolRepeat?Xu(r,e,i):Yu(r,0,i),qu(r,i,n),Ku(r,e,i,n),r.__pictorialShapeStr=ih(t,i),r.__pictorialSymbolMeta=i,r}function eh(t,e,i,n){var r=n.__pictorialBarRect;r&&r.removeTextContent();var o=[];nh(n,(function(t){o.push(t)})),n.__pictorialMainPath&&o.push(n.__pictorialMainPath),n.__pictorialClipPath&&(i=null),_.each(o,(function(t){Gt.bX(t,{scaleX:0,scaleY:0},i,e,(function(){n.parent&&n.parent.remove(n)}))})),t.setItemGraphicEl(e,null)}function ih(t,e){return[t.getItemVisual(e.dataIndex,"symbol")||"none",!!e.symbolRepeat,!!e.symbolClip].join(":")}function nh(t,e,i){_.each(t.__pictorialBundle.children(),(function(n){n!==t.__pictorialBarRect&&e.call(i,n)}))}function rh(t,e,i,n,r,o){e&&t.attr(e),n.symbolClip&&!r?i&&t.attr(i):i&&Ie[r?"updateProps":"initProps"](t,i,n.animationModel,n.dataIndex,o)}function oh(t,e,i){var n=i.dataIndex,r=i.itemModel,o=r.getModel("emphasis"),a=o.getModel("itemStyle").getItemStyle(),s=r.getModel(["blur","itemStyle"]).getItemStyle(),u=r.getModel(["select","itemStyle"]).getItemStyle(),h=r.getShallow("cursor"),c=o.get("focus"),d=o.get("blurScope"),p=o.get("scale");nh(t,(function(t){if(t instanceof l.ZP){var e=t.style;t.useStyle(_.extend({image:e.image,x:e.x,y:e.y,width:e.width,height:e.height},i.style))}else t.useStyle(i.style);var n=t.ensureState("emphasis");n.style=a,p&&(n.scaleX=1.1*t.scaleX,n.scaleY=1.1*t.scaleY),t.ensureState("blur").style=s,t.ensureState("select").style=u,h&&(t.cursor=h),t.z2=i.z2}));var f=e.valueDim.posDesc[+(i.boundingLength>0)],g=t.__pictorialBarRect;(0,ne.ni)(g,(0,ne.k3)(r),{labelFetcher:e.seriesModel,labelDataIndex:n,defaultText:(0,re.H)(e.seriesModel.getData(),n),inheritColor:i.style.fill,defaultOpacity:i.style.opacity,defaultOutsidePosition:f}),(0,ie.k5)(t,c,d,o.get("disabled"))}function ah(t){var e=Math.round(t);return Math.abs(t-e)<1e-4?e:Math.ceil(t)}const sh=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){var n=this.group,r=t.getData(),o=this._data,a=t.coordinateSystem,s=a.getBaseAxis().isHorizontal(),l=a.master.getRect(),u={ecSize:{width:i.getWidth(),height:i.getHeight()},seriesModel:t,coordSys:a,coordSysExtent:[[l.x,l.x+l.width],[l.y,l.y+l.height]],isHorizontal:s,valueDim:Gu[+s],categoryDim:Gu[1-+s]};return r.diff(o).add((function(t){if(r.hasValue(t)){var e=Ju(r,t),i=Uu(r,t,e,u),o=th(r,u,i);r.setItemGraphicEl(t,o),n.add(o),oh(o,u,i)}})).update((function(t,e){var i=o.getItemGraphicEl(e);if(r.hasValue(t)){var a=Ju(r,t),s=Uu(r,t,a,u),l=ih(r,s);i&&l!==i.__pictorialShapeStr&&(n.remove(i),r.setItemGraphicEl(t,null),i=null),i?function(t,e,i){var n=i.animationModel,r=i.dataIndex,o=t.__pictorialBundle;Gt.D(o,{x:i.bundlePosition[0],y:i.bundlePosition[1]},n,r),i.symbolRepeat?Xu(t,e,i,!0):Yu(t,e,i,!0);qu(t,i,!0),Ku(t,e,i,!0)}(i,u,s):i=th(r,u,s,!0),r.setItemGraphicEl(t,i),i.__pictorialSymbolMeta=s,n.add(i),oh(i,u,s)}else n.remove(i)})).remove((function(t){var e=o.getItemGraphicEl(t);e&&eh(o,t,e.__pictorialSymbolMeta.animationModel,e)})).execute(),this._data=r,this.group},e.prototype.remove=function(t,e){var i=this.group,n=this._data;t.get("animation")?n&&n.eachItemGraphicEl((function(e){eh(n,(0,oe.A)(e).dataIndex,t,e)})):i.removeAll()},e.type="pictorialBar",e}($t.Z);const lh=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.hasSymbolVisual=!0,i.defaultSymbol="roundRect",i}return(0,It.ZT)(e,t),e.prototype.getInitialData=function(e){return e.stack=null,t.prototype.getInitialData.apply(this,arguments)},e.type="series.pictorialBar",e.dependencies=["grid"],e.defaultOption=(0,Ae.ZL)(Ce.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%",progressive:0,emphasis:{scale:!1},select:{itemStyle:{borderColor:"#212121"}}}),e}(Ce);var uh=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i._layers=[],i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){var n=t.getData(),r=this,o=this.group,a=t.getLayerSeries(),s=n.getLayout("layoutInfo"),l=s.rect,u=s.boundaryGap;function h(t){return t.name}o.x=0,o.y=l.y+u[0];var c=new ba.Z(this._layersSeries||[],a,h,h),d=[];function p(e,i,s){var l=r._layers;if("remove"!==e){for(var u,h,c=[],p=[],f=a[i].indices,g=0;go&&(o=s),n.push(s)}for(var u=0;uo&&(o=c)}return{y0:r,max:o}}(l),h=u.y0,c=i/u.max,d=o.length,p=o[0].indices.length,f=0;fMath.PI/2?"right":"left"):T&&"center"!==T?"left"===T?(y=r.r0+S,a>Math.PI/2&&(T="right")):"right"===T&&(y=r.r-S,a>Math.PI/2&&(T="left")):(y=o===2*Math.PI&&0===r.r0?0:(r.r+r.r0)/2,T="center"),g.style.align=T,g.style.verticalAlign=f(d,"verticalAlign")||"middle",g.x=y*s+r.cx,g.y=y*l+r.cy;var M=f(d,"rotate"),C=0;"radial"===M?(C=-a)<-Math.PI/2&&(C+=Math.PI):"tangential"===M?(C=Math.PI/2-a)>Math.PI/2?C-=Math.PI:C<-Math.PI/2&&(C+=Math.PI):_.isNumber(M)&&(C=M*Math.PI/180),g.rotation=C})),h.dirtyStyle()},e}(Pe.C);const mh=gh;var vh="sunburstRootToNode",yh="sunburstHighlight";var _h=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i,n){var r=this;this.seriesModel=t,this.api=i,this.ecModel=e;var o=t.getData(),a=o.tree.root,s=t.getViewRoot(),l=this.group,u=t.get("renderLabelForZeroData"),h=[];s.eachNode((function(t){h.push(t)}));var c=this._oldChildren||[];!function(n,r){if(0===n.length&&0===r.length)return;function s(t){return t.getId()}function h(s,h){!function(n,r){u||!n||n.getValue()||(n=null);if(n!==a&&r!==a)if(r&&r.piece)n?(r.piece.updateData(!1,n,t,e,i),o.setItemGraphicEl(n.dataIndex,r.piece)):function(t){if(!t)return;t.piece&&(l.remove(t.piece),t.piece=null)}(r);else if(n){var s=new mh(n,t,e,i);l.add(s),o.setItemGraphicEl(n.dataIndex,s)}}(null==s?null:n[s],null==h?null:r[h])}new ba.Z(r,n,s,s).add(h).update(h).remove(_.curry(h,null)).execute()}(h,c),function(n,o){o.depth>0?(r.virtualPiece?r.virtualPiece.updateData(!1,n,t,e,i):(r.virtualPiece=new mh(n,t,e,i),l.add(r.virtualPiece)),o.piece.off("click"),r.virtualPiece.on("click",(function(t){r._rootToNode(o.parentNode)}))):r.virtualPiece&&(l.remove(r.virtualPiece),r.virtualPiece=null)}(a,s),this._initEvents(),this._oldChildren=h},e.prototype._initEvents=function(){var t=this;this.group.off("click"),this.group.on("click",(function(e){var i=!1;t.seriesModel.getViewRoot().eachNode((function(n){if(!i&&n.piece&&n.piece===e.target){var r=n.getModel().get("nodeClick");if("rootToNode"===r)t._rootToNode(n);else if("link"===r){var o=n.getModel(),a=o.get("link");if(a){var s=o.get("target",!0)||"_blank";(0,ae.MI)(a,s)}}i=!0}}))}))},e.prototype._rootToNode=function(t){t!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:vh,from:this.uid,seriesId:this.seriesModel.id,targetNode:t})},e.prototype.containPoint=function(t,e){var i=e.getData().getItemLayout(0);if(i){var n=t[0]-i.cx,r=t[1]-i.cy,o=Math.sqrt(n*n+r*r);return o<=i.r&&o>=i.r0}},e.type="sunburst",e}($t.Z);const xh=_h;var bh=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.ignoreStyleOnData=!0,i}return(0,It.ZT)(e,t),e.prototype.getInitialData=function(t,e){var i={name:t.name,children:t.data};wh(i);var n=this._levelModels=_.map(t.levels||[],(function(t){return new Gn.Z(t,this,e)}),this),r=oa.createTree(i,this,(function(t){t.wrapMethod("getItemModel",(function(t,e){var i=r.getNodeByDataIndex(e),o=n[i.depth];return o&&(t.parentModel=o),t}))}));return r.data},e.prototype.optionUpdated=function(){this.resetViewRoot()},e.prototype.getDataParams=function(e){var i=t.prototype.getDataParams.apply(this,arguments),n=this.getData().tree.getNodeByDataIndex(e);return i.treePathInfo=ua(n,this),i},e.prototype.getLevelModel=function(t){return this._levelModels&&this._levelModels[t.depth]},e.prototype.getViewRoot=function(){return this._viewRoot},e.prototype.resetViewRoot=function(t){t?this._viewRoot=t:t=this._viewRoot;var e=this.getRawData().tree.root;t&&(t===e||e.contains(t))||(this._viewRoot=e)},e.prototype.enableAriaDecal=function(){va(this)},e.type="series.sunburst",e.defaultOption={z:2,center:["50%","50%"],radius:[0,"75%"],clockwise:!0,startAngle:90,minAngle:0,stillShowZeroSum:!0,nodeClick:"rootToNode",renderLabelForZeroData:!1,label:{rotate:"radial",show:!0,opacity:1,align:"center",position:"inside",distance:5,silent:!0},itemStyle:{borderWidth:1,borderColor:"white",borderType:"solid",shadowBlur:0,shadowColor:"rgba(0, 0, 0, 0.2)",shadowOffsetX:0,shadowOffsetY:0,opacity:1},emphasis:{focus:"descendant"},blur:{itemStyle:{opacity:.2},label:{opacity:.1}},animationType:"expansion",animationDuration:1e3,animationDurationUpdate:500,data:[],sort:"desc"},e}(Pt.Z);function wh(t){var e=0;_.each(t.children,(function(t){wh(t);var i=t.value;_.isArray(i)&&(i=i[0]),e+=i}));var i=t.value;_.isArray(i)&&(i=i[0]),(null==i||isNaN(i))&&(i=e),i<0&&(i=0),_.isArray(t.value)?t.value[0]=i:t.value=i}const Sh=bh;var Th=Math.PI/180;function Mh(t,e,i){e.eachSeriesByType(t,(function(t){var e=t.get("center"),n=t.get("radius");_.isArray(n)||(n=[0,n]),_.isArray(e)||(e=[e,e]);var r=i.getWidth(),o=i.getHeight(),a=Math.min(r,o),s=(0,ri.GM)(e[0],r),l=(0,ri.GM)(e[1],o),u=(0,ri.GM)(n[0],a/2),h=(0,ri.GM)(n[1],a/2),c=-t.get("startAngle")*Th,d=t.get("minAngle")*Th,p=t.getData().tree.root,f=t.getViewRoot(),g=f.depth,m=t.get("sort");null!=m&&Ch(f,m);var v=0;_.each(f.children,(function(t){!isNaN(t.getValue())&&v++}));var y=f.getValue(),x=Math.PI/(y||v)*2,b=f.depth>0,w=f.height-(b?-1:1),S=(h-u)/(w||1),T=t.get("clockwise"),M=t.get("stillShowZeroSum"),C=T?1:-1,A=function(e,i){if(e){var n=i;if(e!==p){var r=e.getValue(),o=0===y&&M?x:r*x;o1;)r=r.parentNode;var o=i.getColorFromPalette(r.name||r.dataIndex+"",e);return t.depth>1&&(0,_.isString)(o)&&(o=(0,se.lift)(o,(t.depth-1)/(n-1)*.5)),o}(r,t,n.root.height));var a=i.ensureUniqueItemVisual(r.dataIndex,"style");(0,_.extend)(a,o)}))}))}var Lh={color:"fill",borderColor:"stroke"},Ih={symbol:1,symbolSize:1,symbolKeepAspect:1,legendIcon:1,visualMeta:1,liftZ:1,decal:1},Dh=(0,Ht.Yf)();const Ph=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.optionUpdated=function(){this.currentZLevel=this.get("zlevel",!0),this.currentZ=this.get("z",!0)},e.prototype.getInitialData=function(t,e){return(0,Dt.Z)(null,this)},e.prototype.getDataParams=function(e,i,n){var r=t.prototype.getDataParams.call(this,e,i);return n&&(r.info=Dh(n).info),r},e.type="series.custom",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,clip:!1},e}(Pt.Z);function Oh(t,e){return e=e||[0,0],_.map(["x","y"],(function(i,n){var r=this.getAxis(i),o=e[n],a=t[n]/2;return"category"===r.type?r.getBandWidth():Math.abs(r.dataToCoord(o-a)-r.dataToCoord(o+a))}),this)}function kh(t,e){return e=e||[0,0],_.map([0,1],(function(i){var n=e[i],r=t[i]/2,o=[],a=[];return o[i]=n-r,a[i]=n+r,o[1-i]=a[1-i]=e[1-i],Math.abs(this.dataToPoint(o)[i]-this.dataToPoint(a)[i])}),this)}function Eh(t,e){var i=this.getAxis(),n=e instanceof Array?e[0]:e,r=(t instanceof Array?t[0]:t)/2;return"category"===i.type?i.getBandWidth():Math.abs(i.dataToCoord(n-r)-i.dataToCoord(n+r))}function Nh(t,e){return e=e||[0,0],_.map(["Radius","Angle"],(function(i,n){var r=this["get"+i+"Axis"](),o=e[n],a=t[n]/2,s="category"===r.type?r.getBandWidth():Math.abs(r.dataToCoord(o-a)-r.dataToCoord(o+a));return"Angle"===i&&(s=s*Math.PI/180),s}),this)}function Rh(t,e,i,n){return t&&(t.legacy||!1!==t.legacy&&!i&&!n&&"tspan"!==e&&("text"===e||(0,_.hasOwn)(t,"text")))}function zh(t,e,i){var n,r,o,a=t;if("text"===e)o=a;else{o={},(0,_.hasOwn)(a,"text")&&(o.text=a.text),(0,_.hasOwn)(a,"rich")&&(o.rich=a.rich),(0,_.hasOwn)(a,"textFill")&&(o.fill=a.textFill),(0,_.hasOwn)(a,"textStroke")&&(o.stroke=a.textStroke),(0,_.hasOwn)(a,"fontFamily")&&(o.fontFamily=a.fontFamily),(0,_.hasOwn)(a,"fontSize")&&(o.fontSize=a.fontSize),(0,_.hasOwn)(a,"fontStyle")&&(o.fontStyle=a.fontStyle),(0,_.hasOwn)(a,"fontWeight")&&(o.fontWeight=a.fontWeight),r={type:"text",style:o,silent:!0},n={};var s=(0,_.hasOwn)(a,"textPosition");i?n.position=s?a.textPosition:"inside":s&&(n.position=a.textPosition),(0,_.hasOwn)(a,"textPosition")&&(n.position=a.textPosition),(0,_.hasOwn)(a,"textOffset")&&(n.offset=a.textOffset),(0,_.hasOwn)(a,"textRotation")&&(n.rotation=a.textRotation),(0,_.hasOwn)(a,"textDistance")&&(n.distance=a.textDistance)}return Bh(o,t),(0,_.each)(o.rich,(function(t){Bh(t,t)})),{textConfig:n,textContent:r}}function Bh(t,e){e&&(e.font=e.textFont||e.font,(0,_.hasOwn)(e,"textStrokeWidth")&&(t.lineWidth=e.textStrokeWidth),(0,_.hasOwn)(e,"textAlign")&&(t.align=e.textAlign),(0,_.hasOwn)(e,"textVerticalAlign")&&(t.verticalAlign=e.textVerticalAlign),(0,_.hasOwn)(e,"textLineHeight")&&(t.lineHeight=e.textLineHeight),(0,_.hasOwn)(e,"textWidth")&&(t.width=e.textWidth),(0,_.hasOwn)(e,"textHeight")&&(t.height=e.textHeight),(0,_.hasOwn)(e,"textBackgroundColor")&&(t.backgroundColor=e.textBackgroundColor),(0,_.hasOwn)(e,"textPadding")&&(t.padding=e.textPadding),(0,_.hasOwn)(e,"textBorderColor")&&(t.borderColor=e.textBorderColor),(0,_.hasOwn)(e,"textBorderWidth")&&(t.borderWidth=e.textBorderWidth),(0,_.hasOwn)(e,"textBorderRadius")&&(t.borderRadius=e.textBorderRadius),(0,_.hasOwn)(e,"textBoxShadowColor")&&(t.shadowColor=e.textBoxShadowColor),(0,_.hasOwn)(e,"textBoxShadowBlur")&&(t.shadowBlur=e.textBoxShadowBlur),(0,_.hasOwn)(e,"textBoxShadowOffsetX")&&(t.shadowOffsetX=e.textBoxShadowOffsetX),(0,_.hasOwn)(e,"textBoxShadowOffsetY")&&(t.shadowOffsetY=e.textBoxShadowOffsetY))}function Zh(t,e,i){var n=t;n.textPosition=n.textPosition||i.position||"inside",null!=i.offset&&(n.textOffset=i.offset),null!=i.rotation&&(n.textRotation=i.rotation),null!=i.distance&&(n.textDistance=i.distance);var r=n.textPosition.indexOf("inside")>=0,o=t.fill||"#000";Fh(n,e);var a=null==n.textFill;return r?a&&(n.textFill=i.insideFill||"#fff",!n.textStroke&&i.insideStroke&&(n.textStroke=i.insideStroke),!n.textStroke&&(n.textStroke=o),null==n.textStrokeWidth&&(n.textStrokeWidth=2)):(a&&(n.textFill=t.fill||i.outsideFill||"#000"),!n.textStroke&&i.outsideStroke&&(n.textStroke=i.outsideStroke)),n.text=e.text,n.rich=e.rich,(0,_.each)(e.rich,(function(t){Fh(t,t)})),n}function Fh(t,e){e&&((0,_.hasOwn)(e,"fill")&&(t.textFill=e.fill),(0,_.hasOwn)(e,"stroke")&&(t.textStroke=e.fill),(0,_.hasOwn)(e,"lineWidth")&&(t.textStrokeWidth=e.lineWidth),(0,_.hasOwn)(e,"font")&&(t.font=e.font),(0,_.hasOwn)(e,"fontStyle")&&(t.fontStyle=e.fontStyle),(0,_.hasOwn)(e,"fontWeight")&&(t.fontWeight=e.fontWeight),(0,_.hasOwn)(e,"fontSize")&&(t.fontSize=e.fontSize),(0,_.hasOwn)(e,"fontFamily")&&(t.fontFamily=e.fontFamily),(0,_.hasOwn)(e,"align")&&(t.textAlign=e.align),(0,_.hasOwn)(e,"verticalAlign")&&(t.textVerticalAlign=e.verticalAlign),(0,_.hasOwn)(e,"lineHeight")&&(t.textLineHeight=e.lineHeight),(0,_.hasOwn)(e,"width")&&(t.textWidth=e.width),(0,_.hasOwn)(e,"height")&&(t.textHeight=e.height),(0,_.hasOwn)(e,"backgroundColor")&&(t.textBackgroundColor=e.backgroundColor),(0,_.hasOwn)(e,"padding")&&(t.textPadding=e.padding),(0,_.hasOwn)(e,"borderColor")&&(t.textBorderColor=e.borderColor),(0,_.hasOwn)(e,"borderWidth")&&(t.textBorderWidth=e.borderWidth),(0,_.hasOwn)(e,"borderRadius")&&(t.textBorderRadius=e.borderRadius),(0,_.hasOwn)(e,"shadowColor")&&(t.textBoxShadowColor=e.shadowColor),(0,_.hasOwn)(e,"shadowBlur")&&(t.textBoxShadowBlur=e.shadowBlur),(0,_.hasOwn)(e,"shadowOffsetX")&&(t.textBoxShadowOffsetX=e.shadowOffsetX),(0,_.hasOwn)(e,"shadowOffsetY")&&(t.textBoxShadowOffsetY=e.shadowOffsetY),(0,_.hasOwn)(e,"textShadowColor")&&(t.textShadowColor=e.textShadowColor),(0,_.hasOwn)(e,"textShadowBlur")&&(t.textShadowBlur=e.textShadowBlur),(0,_.hasOwn)(e,"textShadowOffsetX")&&(t.textShadowOffsetX=e.textShadowOffsetX),(0,_.hasOwn)(e,"textShadowOffsetY")&&(t.textShadowOffsetY=e.textShadowOffsetY))}var Vh=i(8677),Gh={position:["x","y"],scale:["scaleX","scaleY"],origin:["originX","originY"]},Hh=(0,_.keys)(Gh),Uh=((0,_.reduce)(E.dN,(function(t,e){return t[e]=1,t}),{}),E.dN.join(", "),["","style","shape","extra"]),Wh=(0,Ht.Yf)();function jh(t,e,i,n,r){var o=t+"Animation",a=(0,Gt.ke)(t,n,r)||{},s=Wh(e).userDuring;return a.duration>0&&(a.during=s?(0,_.bind)($h,{el:e,userDuring:s}):null,a.setToFinal=!0,a.scope=t),(0,_.extend)(a,i[o]),a}function Xh(t,e,i,n){var r=(n=n||{}).dataIndex,o=n.isInit,a=n.clearStyle,l=i.isAnimationEnabled(),u=Wh(t),h=e.style;u.userDuring=e.during;var c={},d={};if(function(t,e,i){for(var n=0;n=0)){var c=t.getAnimationStyleProps(),d=c?c.style:null;if(d){!r&&(r=n.style={});var p=(0,_.keys)(i);for(u=0;u0&&t.animateFrom(p,f)}else!function(t,e,i,n,r){if(r){var o=jh("update",t,e,n,i);o.duration>0&&t.animateFrom(r,o)}}(t,e,r||0,i,c);Yh(t,e),h?t.dirty():t.markRedraw()}function Yh(t,e){for(var i=Wh(t).leaveToProps,n=0;n=0){!o&&(o=n[t]={});var d=(0,_.keys)(a);for(h=0;hn[1]&&n.reverse(),{coordSys:{type:"polar",cx:t.cx,cy:t.cy,r:n[1],r0:n[0]},api:{coord:function(n){var r=e.dataToRadius(n[0]),o=i.dataToAngle(n[1]),a=t.coordToPoint([r,o]);return a.push(r,o*Math.PI/180),a},size:_.bind(Nh,t)}}},calendar:function(t){var e=t.getRect(),i=t.getRangeInfo();return{coordSys:{type:"calendar",x:e.x,y:e.y,width:e.width,height:e.height,cellWidth:t.getCellWidth(),cellHeight:t.getCellHeight(),rangeInfo:{start:i.start,end:i.end,weeks:i.weeks,dayCount:i.allDay}},api:{coord:function(e,i){return t.dataToPoint(e,i)}}}}};function vc(t){return t instanceof s.ZP}function yc(t){return t instanceof qr.ZP}const _c=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i,n){this._progressiveEls=null;var r=this._data,o=t.getData(),a=this.group,s=Tc(t,o,e,i);r||a.removeAll(),o.diff(r).add((function(e){Cc(i,null,e,s(e,n),t,a,o)})).remove((function(e){var i=r.getItemGraphicEl(e);i&&qh(i,Dh(i).option,t)})).update((function(e,l){var u=r.getItemGraphicEl(l);Cc(i,u,e,s(e,n),t,a,o)})).execute();var l=t.get("clip",!0)?(0,te.lQ)(t.coordinateSystem,!1,t):null;l?a.setClipPath(l):a.removeClipPath(),this._data=o},e.prototype.incrementalPrepareRender=function(t,e,i){this.group.removeAll(),this._data=null},e.prototype.incrementalRender=function(t,e,i,n,r){var o=e.getData(),a=Tc(e,o,i,n),s=this._progressiveEls=[];function l(t){t.isGroup||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}for(var u=t.start;u=0?e.getStore().get(r,i):void 0}var o=e.get(n.name,i),a=n&&n.ordinalMeta;return a?a.categories[o]:o},styleEmphasis:function(i,n){0;null==n&&(n=s);var r=y(n,sc).getItemStyle(),o=x(n,sc),a=ne.Lr(o,null,null,!0,!0);a.text=o.getShallow("show")?(0,_.retrieve3)(t.getFormattedLabel(n,sc),t.getFormattedLabel(n,lc),(0,re.H)(e,n)):null;var l=ne.nC(o,null,!0);return w(i,r),r=Zh(r,a,l),i&&b(r,i),r.legacy=!0,r},visual:function(t,i){if(null==i&&(i=s),(0,_.hasOwn)(Lh,t)){var n=e.getItemVisual(i,"style");return n?n[Lh[t]]:null}if((0,_.hasOwn)(Ih,t))return e.getItemVisual(i,t)},barLayout:function(t){if("cartesian2d"===o.type){var e=o.getBaseAxis();return(0,Te.Gk)((0,_.defaults)({axis:e},t))}},currentSeriesIndices:function(){return i.getCurrentSeriesIndices()},font:function(t){return ne.qT(t,i)}},a.api||{}),h={context:{},seriesId:t.id,seriesName:t.name,seriesIndex:t.seriesIndex,coordSys:a.coordSys,dataInsideLength:e.count(),encode:Mc(t.getData())},c={},d={},p={},f={},g=0;g=c;f--){var g=e.childAt(f);Oc(e,g,r)}}(t,c,i,n,r),a>=0?o.replaceAt(c,a):o.add(c),c}function Lc(t,e,i){var n,r=Dh(t),o=e.type,a=e.shape,s=e.style;return i.isUniversalTransitionEnabled()||null!=o&&o!==r.customGraphicType||"path"===o&&((n=a)&&((0,_.hasOwn)(n,"pathData")||(0,_.hasOwn)(n,"d")))&&Rc(a)!==r.customPathData||"image"===o&&(0,_.hasOwn)(s,"image")&&s.image!==r.customImagePath}function Ic(t,e,i){var n=e?Dc(t,e):t,r=e?Pc(t,n,sc):t.style,o=t.type,a=n?n.textConfig:null,s=t.textContent,l=s?e?Dc(s,e):s:null;if(r&&(i.isLegacy||Rh(r,o,!!a,!!l))){i.isLegacy=!0;var u=zh(r,o,!e);!a&&u.textConfig&&(a=u.textConfig),!l&&u.textContent&&(l=u.textContent)}if(!e&&l){var h=l;!h.type&&(h.type="text")}var c=e?i[e]:i.normal;c.cfg=a,c.conOpt=l}function Dc(t,e){return e?t?t[e]:null:t}function Pc(t,e,i){var n=e&&e.style;return null==n&&i===sc&&t&&(n=t.styleEmphasis),n}function Oc(t,e,i){e&&qh(e,Dh(t).option,i)}function kc(t,e){var i=t&&t.name;return null!=i?i:"e\0\0"+e}function Ec(t,e){var i=this.context,n=null!=t?i.newChildren[t]:null,r=null!=e?i.oldChildren[e]:null;Ac(i.api,r,i.dataIndex,n,i.seriesModel,i.group)}function Nc(t){var e=this.context,i=e.oldChildren[t];i&&qh(i,Dh(i).option,e.seriesModel)}function Rc(t){return t&&(t.pathData||t.d)}var zc=i(7037);var Bc=i(7329),Zc=i(5539),Fc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,It.ZT)(e,t),e.prototype.makeElOption=function(t,e,i,n,r){var o=i.axis;"angle"===o.dim&&(this.animationThreshold=Math.PI/18);var a=o.polar,s=a.getOtherAxis(o).getExtent(),l=o.dataToCoord(e),u=n.get("type");if(u&&"none"!==u){var h=Zc.fk(n),c=Vc[u](o,a,l,s);c.style=h,t.graphicKey=c.type,t.pointer=c}var d=function(t,e,i,n,r){var o=e.axis,a=o.dataToCoord(t),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l,u,h,c=n.getRadiusAxis().getExtent();if("radius"===o.dim){var d=Qi.create();Qi.rotate(d,d,s),Qi.translate(d,d,[n.cx,n.cy]),l=Ie.applyTransform([a,-r],d);var p=e.getModel("axisLabel").get("rotate")||0,f=yn.Z.innerTextLayout(s,p*Math.PI/180,-1);u=f.textAlign,h=f.textVerticalAlign}else{var g=c[1];l=n.coordToPoint([g+r,a]);var m=n.cx,v=n.cy;u=Math.abs(l[0]-m)/g<.3?"center":l[0]>m?"left":"right",h=Math.abs(l[1]-v)/g<.3?"middle":l[1]>v?"top":"bottom"}return{position:l,align:u,verticalAlign:h}}(e,i,0,a,n.get(["label","margin"]));Zc.$_(t,i,n,r,d)},e}(Bc.Z);var Vc={line:function(t,e,i,n){return"angle"===t.dim?{type:"Line",shape:Zc.BL(e.coordToPoint([n[0],i]),e.coordToPoint([n[1],i]))}:{type:"Circle",shape:{cx:e.cx,cy:e.cy,r:i}}},shadow:function(t,e,i,n){var r=Math.max(1,t.getBandWidth()),o=Math.PI/180;return"angle"===t.dim?{type:"Sector",shape:Zc.Rj(e.cx,e.cy,n[0],n[1],(-i-r/2)*o,(r/2-i)*o)}:{type:"Sector",shape:Zc.Rj(e.cx,e.cy,i-r/2,i+r/2,0,2*Math.PI)}}};const Gc=Fc;const Hc=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.findAxisModel=function(t){var e;return this.ecModel.eachComponent(t,(function(t){t.getCoordSysModel()===this&&(e=t)}),this),e},e.type="polar",e.dependencies=["radiusAxis","angleAxis"],e.defaultOption={z:0,center:["50%","50%"],radius:"80%"},e}(Bi.Z);var Uc=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,It.ZT)(e,t),e.prototype.getCoordSysModel=function(){return this.getReferringComponents("polar",Ht.C6).models[0]},e.type="polarAxis",e}(Bi.Z);_.mixin(Uc,Fi.W);var Wc=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.type="angleAxis",e}(Uc),jc=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.type="radiusAxis",e}(Uc),Xc=function(t){function e(e,i){return t.call(this,"radius",e,i)||this}return(0,It.ZT)(e,t),e.prototype.pointToData=function(t,e){return this.polar.pointToData(t,e)["radius"===this.dim?0:1]},e}(rn.Z);Xc.prototype.dataToRadius=rn.Z.prototype.dataToCoord,Xc.prototype.radiusToData=rn.Z.prototype.coordToData;const Yc=Xc;var qc=(0,Ht.Yf)(),Kc=function(t){function e(e,i){return t.call(this,"angle",e,i||[0,360])||this}return(0,It.ZT)(e,t),e.prototype.pointToData=function(t,e){return this.polar.pointToData(t,e)["radius"===this.dim?0:1]},e.prototype.calculateCategoryInterval=function(){var t=this,e=t.getLabelModel(),i=t.scale,n=i.getExtent(),r=i.count();if(n[1]-n[0]<1)return 0;var o=n[0],a=t.dataToCoord(o+1)-t.dataToCoord(o),s=Math.abs(a),l=u.lP(null==o?"":o+"",e.getFont(),"center","top"),h=Math.max(l.height,7)/s;isNaN(h)&&(h=1/0);var c=Math.max(0,Math.floor(h)),d=qc(t.model),p=d.lastAutoInterval,f=d.lastTickCount;return null!=p&&null!=f&&Math.abs(p-c)<=1&&Math.abs(f-r)<=1&&p>c?c=p:(d.lastTickCount=r,d.lastAutoInterval=c),c},e}(rn.Z);Kc.prototype.dataToAngle=rn.Z.prototype.dataToCoord,Kc.prototype.angleToData=rn.Z.prototype.coordToData;const Jc=Kc;var Qc=["radius","angle"],$c=function(){function t(t){this.dimensions=Qc,this.type="polar",this.cx=0,this.cy=0,this._radiusAxis=new Yc,this._angleAxis=new Jc,this.axisPointerEnabled=!0,this.name=t||"",this._radiusAxis.polar=this._angleAxis.polar=this}return t.prototype.containPoint=function(t){var e=this.pointToCoord(t);return this._radiusAxis.contain(e[0])&&this._angleAxis.contain(e[1])},t.prototype.containData=function(t){return this._radiusAxis.containData(t[0])&&this._angleAxis.containData(t[1])},t.prototype.getAxis=function(t){return this["_"+t+"Axis"]},t.prototype.getAxes=function(){return[this._radiusAxis,this._angleAxis]},t.prototype.getAxesByScale=function(t){var e=[],i=this._angleAxis,n=this._radiusAxis;return i.scale.type===t&&e.push(i),n.scale.type===t&&e.push(n),e},t.prototype.getAngleAxis=function(){return this._angleAxis},t.prototype.getRadiusAxis=function(){return this._radiusAxis},t.prototype.getOtherAxis=function(t){var e=this._angleAxis;return t===e?this._radiusAxis:e},t.prototype.getBaseAxis=function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},t.prototype.getTooltipAxes=function(t){var e=null!=t&&"auto"!==t?this.getAxis(t):this.getBaseAxis();return{baseAxes:[e],otherAxes:[this.getOtherAxis(e)]}},t.prototype.dataToPoint=function(t,e){return this.coordToPoint([this._radiusAxis.dataToRadius(t[0],e),this._angleAxis.dataToAngle(t[1],e)])},t.prototype.pointToData=function(t,e){var i=this.pointToCoord(t);return[this._radiusAxis.radiusToData(i[0],e),this._angleAxis.angleToData(i[1],e)]},t.prototype.pointToCoord=function(t){var e=t[0]-this.cx,i=t[1]-this.cy,n=this.getAngleAxis(),r=n.getExtent(),o=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);n.inverse?o=a-360:a=o+360;var s=Math.sqrt(e*e+i*i);e/=s,i/=s;for(var l=Math.atan2(-i,e)/Math.PI*180,u=la;)l+=360*u;return[s,l]},t.prototype.coordToPoint=function(t){var e=t[0],i=t[1]/180*Math.PI;return[Math.cos(i)*e+this.cx,-Math.sin(i)*e+this.cy]},t.prototype.getArea=function(){var t=this.getAngleAxis(),e=this.getRadiusAxis().getExtent().slice();e[0]>e[1]&&e.reverse();var i=t.getExtent(),n=Math.PI/180;return{cx:this.cx,cy:this.cy,r0:e[0],r:e[1],startAngle:-i[0]*n,endAngle:-i[1]*n,clockwise:t.inverse,contain:function(t,e){var i=t-this.cx,n=e-this.cy,r=i*i+n*n-1e-4,o=this.r,a=this.r0;return r<=o*o&&r>=a*a}}},t.prototype.convertToPixel=function(t,e,i){return td(e)===this?this.dataToPoint(i):null},t.prototype.convertFromPixel=function(t,e,i){return td(e)===this?this.pointToData(i):null},t}();function td(t){var e=t.seriesModel,i=t.polarModel;return i&&i.coordinateSystem||e&&e.coordinateSystem}const ed=$c;function id(t,e){var i=this,n=i.getAngleAxis(),r=i.getRadiusAxis();if(n.scale.setExtent(1/0,-1/0),r.scale.setExtent(1/0,-1/0),t.eachSeries((function(t){if(t.coordinateSystem===i){var e=t.getData();_.each((0,Ki.PY)(e,"radius"),(function(t){r.scale.unionExtentFromData(e,t)})),_.each((0,Ki.PY)(e,"angle"),(function(t){n.scale.unionExtentFromData(e,t)}))}})),(0,Ki.Jk)(n.scale,n.model),(0,Ki.Jk)(r.scale,r.model),"category"===n.type&&!n.onBand){var o=n.getExtent(),a=360/n.scale.count();n.inverse?o[1]+=a:o[1]-=a,n.setExtent(o[0],o[1])}}function nd(t,e){if(t.type=e.get("type"),t.scale=(0,Ki.aG)(e),t.onBand=e.get("boundaryGap")&&"category"===t.type,t.inverse=e.get("inverse"),function(t){return"angleAxis"===t.mainType}(e)){t.inverse=t.inverse!==e.get("clockwise");var i=e.get("startAngle");t.setExtent(i,i+(t.inverse?-360:360))}e.axis=t,t.model=e}var rd={dimensions:Qc,create:function(t,e){var i=[];return t.eachComponent("polar",(function(t,n){var r=new ed(n+"");r.update=id;var o=r.getRadiusAxis(),a=r.getAngleAxis(),s=t.findAxisModel("radiusAxis"),l=t.findAxisModel("angleAxis");nd(o,s),nd(a,l),function(t,e,i){var n=e.get("center"),r=i.getWidth(),o=i.getHeight();t.cx=(0,ri.GM)(n[0],r),t.cy=(0,ri.GM)(n[1],o);var a=t.getRadiusAxis(),s=Math.min(r,o)/2,l=e.get("radius");null==l?l=[0,"100%"]:_.isArray(l)||(l=[0,l]);var u=[(0,ri.GM)(l[0],s),(0,ri.GM)(l[1],s)];a.inverse?a.setExtent(u[1],u[0]):a.setExtent(u[0],u[1])}(r,t,e),i.push(r),t.coordinateSystem=r,r.model=t})),t.eachSeries((function(t){if("polar"===t.get("coordinateSystem")){var e=t.getReferringComponents("polar",Ht.C6).models[0];0,t.coordinateSystem=e.coordinateSystem}})),i}};const od=rd;var ad=["axisLine","axisLabel","axisTick","minorTick","splitLine","minorSplitLine","splitArea"];function sd(t,e,i){e[1]>e[0]&&(e=e.slice().reverse());var n=t.coordToPoint([e[0],i]),r=t.coordToPoint([e[1],i]);return{x1:n[0],y1:n[1],x2:r[0],y2:r[1]}}function ld(t){return t.getRadiusAxis().inverse?0:1}function ud(t){var e=t[0],i=t[t.length-1];e&&i&&Math.abs(Math.abs(e.coord-i.coord)-360)<1e-4&&t.pop()}var hd=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.axisPointerClass="PolarAxisPointer",i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e){if(this.group.removeAll(),t.get("show")){var i=t.axis,n=i.polar,r=n.getRadiusAxis().getExtent(),o=i.getTicksCoords(),a=i.getMinorTicksCoords(),s=_.map(i.getViewLabels(),(function(t){t=_.clone(t);var e=i.scale,n="ordinal"===e.type?e.getRawOrdinalNumber(t.tickValue):t.tickValue;return t.coord=i.dataToCoord(n),t}));ud(s),ud(o),_.each(ad,(function(e){!t.get([e,"show"])||i.scale.isBlank()&&"axisLine"!==e||cd[e](this.group,t,n,o,a,r,s)}),this)}},e.type="angleAxis",e}(_n.Z),cd={axisLine:function(t,e,i,n,r,o){var a,s=e.getModel(["axisLine","lineStyle"]),l=ld(i),u=l?0:1;(a=0===o[u]?new Xn.Z({shape:{cx:i.cx,cy:i.cy,r:o[l]},style:s.getLineStyle(),z2:1,silent:!0}):new Yn.Z({shape:{cx:i.cx,cy:i.cy,r:o[l],r0:o[u]},style:s.getLineStyle(),z2:1,silent:!0})).style.fill=null,t.add(a)},axisTick:function(t,e,i,n,r,o){var a=e.getModel("axisTick"),s=(a.get("inside")?-1:1)*a.get("length"),l=o[ld(i)],u=_.map(n,(function(t){return new vn.Z({shape:sd(i,[l,l+s],t.coord)})}));t.add(Ie.mergePath(u,{style:_.defaults(a.getModel("lineStyle").getLineStyle(),{stroke:e.get(["axisLine","lineStyle","color"])})}))},minorTick:function(t,e,i,n,r,o){if(r.length){for(var a=e.getModel("axisTick"),s=e.getModel("minorTick"),l=(a.get("inside")?-1:1)*s.get("length"),u=o[ld(i)],h=[],c=0;cf?"left":"right",v=Math.abs(p[1]-g)/d<.3?"middle":p[1]>g?"top":"bottom";if(s&&s[c]){var y=s[c];_.isObject(y)&&y.textStyle&&(a=new Gn.Z(y.textStyle,l,l.ecModel))}var x=new j.ZP({silent:yn.Z.isLabelSilent(e),style:(0,ne.Lr)(a,{x:p[0],y:p[1],fill:a.getTextColor()||e.get(["axisLine","lineStyle","color"]),text:n.formattedLabel,align:m,verticalAlign:v})});if(t.add(x),h){var b=yn.Z.makeAxisEventDataBase(e);b.targetType="axisLabel",b.value=n.rawLabel,(0,oe.A)(x).eventData=b}}),this)},splitLine:function(t,e,i,n,r,o){var a=e.getModel("splitLine").getModel("lineStyle"),s=a.get("color"),l=0;s=s instanceof Array?s:[s];for(var u=[],h=0;h=0?"p":"n",C=x;y&&(n[s][T]||(n[s][T]={p:x,n:x}),C=n[s][T][M]);var A=void 0,L=void 0,I=void 0,D=void 0;if("radius"===c.dim){var P=c.dataToCoord(S)-x,O=o.dataToCoord(T);Math.abs(P)=D})}}}))};var bd={startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:0}},wd={splitNumber:5},Sd=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.type="polar",e}(zi.Z);function Td(t,e){e=e||{};var i=t.coordinateSystem,n=t.axis,r={},o=n.position,a=n.orient,s=i.getRect(),l=[s.x,s.x+s.width,s.y,s.y+s.height],u={horizontal:{top:l[2],bottom:l[3]},vertical:{left:l[0],right:l[1]}};r.position=["vertical"===a?u.vertical[o]:l[0],"horizontal"===a?u.horizontal[o]:l[3]];r.rotation=Math.PI/2*{horizontal:0,vertical:1}[a];r.labelDirection=r.tickDirection=r.nameDirection={top:-1,bottom:1,right:1,left:-1}[o],t.get(["axisTick","inside"])&&(r.tickDirection=-r.tickDirection),_.retrieve(e.labelInside,t.get(["axisLabel","inside"]))&&(r.labelDirection=-r.labelDirection);var h=e.rotate;return null==h&&(h=t.get(["axisLabel","rotate"])),r.labelRotation="top"===o?-h:h,r.z2=1,r}var Md=["axisLine","axisTickLabel","axisName"],Cd=["splitArea","splitLine"],Ad=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.axisPointerClass="SingleAxisPointer",i}return(0,It.ZT)(e,t),e.prototype.render=function(e,i,n,r){var o=this.group;o.removeAll();var a=this._axisGroup;this._axisGroup=new kt.Z;var s=Td(e),l=new yn.Z(e,s);_.each(Md,l.add,l),o.add(this._axisGroup),o.add(l.getGroup()),_.each(Cd,(function(t){e.get([t,"show"])&&Ld[t](this,this.group,this._axisGroup,e)}),this),Ie.groupTransition(a,this._axisGroup,e),t.prototype.render.call(this,e,i,n,r)},e.prototype.remove=function(){wn(this)},e.type="singleAxis",e}(_n.Z),Ld={splitLine:function(t,e,i,n){var r=n.axis;if(!r.scale.isBlank()){var o=n.getModel("splitLine"),a=o.getModel("lineStyle"),s=a.get("color");s=s instanceof Array?s:[s];for(var l=a.get("width"),u=n.coordinateSystem.getRect(),h=r.isHorizontal(),c=[],d=0,p=r.getTicksCoords({tickModel:o}),f=[],g=[],m=0;m=e.y&&t[1]<=e.y+e.height:i.contain(i.toLocalCoord(t[1]))&&t[0]>=e.y&&t[0]<=e.y+e.height},t.prototype.pointToData=function(t){var e=this.getAxis();return[e.coordToData(e.toLocalCoord(t["horizontal"===e.orient?0:1]))]},t.prototype.dataToPoint=function(t){var e=this.getAxis(),i=this.getRect(),n=[],r="horizontal"===e.orient?0:1;return t instanceof Array&&(t=t[0]),n[r]=e.toGlobalCoord(e.dataToCoord(+t)),n[1-r]=0===r?i.y+i.height/2:i.x+i.width/2,n},t.prototype.convertToPixel=function(t,e,i){return Nd(e)===this?this.dataToPoint(i):null},t.prototype.convertFromPixel=function(t,e,i){return Nd(e)===this?this.pointToData(i):null},t}();const zd={create:function(t,e){var i=[];return t.eachComponent("singleAxis",(function(n,r){var o=new Rd(n,t,e);o.name="single_"+r,o.resize(n,e),n.coordinateSystem=o,i.push(o)})),t.eachSeries((function(t){if("singleAxis"===t.get("coordinateSystem")){var e=t.getReferringComponents("singleAxis",Ht.C6).models[0];t.coordinateSystem=e&&e.coordinateSystem}})),i},dimensions:Ed};var Bd=["x","y"],Zd=["width","height"],Fd=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,It.ZT)(e,t),e.prototype.makeElOption=function(t,e,i,n,r){var o=i.axis,a=o.coordinateSystem,s=Hd(a,1-Gd(o)),l=a.dataToPoint(e)[0],u=n.get("type");if(u&&"none"!==u){var h=Zc.fk(n),c=Vd[u](o,l,s);c.style=h,t.graphicKey=c.type,t.pointer=c}var d=Td(i);Zc.gf(e,t,d,i,n,r)},e.prototype.getHandleTransform=function(t,e,i){var n=Td(e,{labelInside:!1});n.labelMargin=i.get(["handle","margin"]);var r=Zc.Zh(e.axis,t,n);return{x:r[0],y:r[1],rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,e,i,n){var r=i.axis,o=r.coordinateSystem,a=Gd(r),s=Hd(o,a),l=[t.x,t.y];l[a]+=e[a],l[a]=Math.min(s[1],l[a]),l[a]=Math.max(s[0],l[a]);var u=Hd(o,1-a),h=(u[1]+u[0])/2,c=[h,h];return c[a]=l[a],{x:l[0],y:l[1],rotation:t.rotation,cursorPoint:c,tooltipOption:{verticalAlign:"middle"}}},e}(Bc.Z),Vd={line:function(t,e,i){return{type:"Line",subPixelOptimize:!0,shape:Zc.BL([e,i[0]],[e,i[1]],Gd(t))}},shadow:function(t,e,i){var n=t.getBandWidth(),r=i[1]-i[0];return{type:"Rect",shape:Zc.uE([e-n/2,i[0]],[n,r],Gd(t))}}};function Gd(t){return t.isHorizontal()?0:1}function Hd(t,e){var i=t.getRect();return[i[Bd[e]],i[Bd[e]]+i[Zd[e]]]}const Ud=Fd;var Wd=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.type="single",e}(zi.Z);function jd(t,e){var i,n=t.cellSize;1===(i=_.isArray(n)?n:t.cellSize=[n,n]).length&&(i[1]=i[0]);var r=_.map([0,1],(function(t){return(0,oi.QM)(e,t)&&(i[t]="auto"),null!=i[t]&&"auto"!==i[t]}));(0,oi.dt)(t,e,{type:"box",ignoreSize:r})}const Xd=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.init=function(e,i,n){var r=(0,oi.tE)(e);t.prototype.init.apply(this,arguments),jd(e,r)},e.prototype.mergeOption=function(e){t.prototype.mergeOption.apply(this,arguments),jd(this.option,e)},e.prototype.getCellSize=function(){return this.option.cellSize},e.type="calendar",e.defaultOption={z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{color:"#fff",borderWidth:1,borderColor:"#ccc"},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",color:"#000"},monthLabel:{show:!0,position:"start",margin:5,align:"center",formatter:null,color:"#000"},yearLabel:{show:!0,position:null,margin:30,formatter:null,color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},e}(Bi.Z);var Yd=i(3917),qd=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){var n=this.group;n.removeAll();var r=t.coordinateSystem,o=r.getRangeInfo(),a=r.getOrient(),s=e.getLocaleModel();this._renderDayRect(t,o,n),this._renderLines(t,o,a,n),this._renderYearText(t,o,a,n),this._renderMonthText(t,s,a,n),this._renderWeekText(t,s,o,a,n)},e.prototype._renderDayRect=function(t,e,i){for(var n=t.coordinateSystem,r=t.getModel("itemStyle").getItemStyle(),o=n.getCellWidth(),a=n.getCellHeight(),s=e.start.time;s<=e.end.time;s=n.getNextNDay(s,1).time){var l=n.dataToRect([s],!1).tl,u=new De.Z({shape:{x:l[0],y:l[1],width:o,height:a},cursor:"default",style:r});i.add(u)}},e.prototype._renderLines=function(t,e,i,n){var r=this,o=t.coordinateSystem,a=t.getModel(["splitLine","lineStyle"]).getLineStyle(),s=t.get(["splitLine","show"]),l=a.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var u=e.start,h=0;u.time<=e.end.time;h++){d(u.formatedDate),0===h&&(u=o.getDateInfo(e.start.y+"-"+e.start.m));var c=u.date;c.setMonth(c.getMonth()+1),u=o.getDateInfo(c)}function d(e){r._firstDayOfMonth.push(o.getDateInfo(e)),r._firstDayPoints.push(o.dataToRect([e],!1).tl);var l=r._getLinePointsOfOneWeek(t,e,i);r._tlpoints.push(l[0]),r._blpoints.push(l[l.length-1]),s&&r._drawSplitline(l,a,n)}d(o.getNextNDay(e.end.time,1).formatedDate),s&&this._drawSplitline(r._getEdgesPoints(r._tlpoints,l,i),a,n),s&&this._drawSplitline(r._getEdgesPoints(r._blpoints,l,i),a,n)},e.prototype._getEdgesPoints=function(t,e,i){var n=[t[0].slice(),t[t.length-1].slice()],r="horizontal"===i?0:1;return n[0][r]=n[0][r]-e/2,n[1][r]=n[1][r]+e/2,n},e.prototype._drawSplitline=function(t,e,i){var n=new di.Z({z2:20,shape:{points:t},style:e});i.add(n)},e.prototype._getLinePointsOfOneWeek=function(t,e,i){for(var n=t.coordinateSystem,r=n.getDateInfo(e),o=[],a=0;a<7;a++){var s=n.getNextNDay(r.time,a),l=n.dataToRect([s.time],!1);o[2*s.day]=l.tl,o[2*s.day+1]=l["horizontal"===i?"bl":"tr"]}return o},e.prototype._formatterLabel=function(t,e){return(0,_.isString)(t)&&t?(0,ae.wx)(t,e):(0,_.isFunction)(t)?t(e):e.nameMap},e.prototype._yearTextPositionControl=function(t,e,i,n,r){var o=e[0],a=e[1],s=["center","bottom"];"bottom"===n?(a+=r,s=["center","top"]):"left"===n?o-=r:"right"===n?(o+=r,s=["center","top"]):a-=r;var l=0;return"left"!==n&&"right"!==n||(l=Math.PI/2),{rotation:l,x:o,y:a,style:{align:s[0],verticalAlign:s[1]}}},e.prototype._renderYearText=function(t,e,i,n){var r=t.getModel("yearLabel");if(r.get("show")){var o=r.get("margin"),a=r.get("position");a||(a="horizontal"!==i?"top":"left");var s=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],l=(s[0][0]+s[1][0])/2,u=(s[0][1]+s[1][1])/2,h="horizontal"===i?0:1,c={top:[l,s[h][1]],bottom:[l,s[1-h][1]],left:[s[1-h][0],u],right:[s[h][0],u]},d=e.start.y;+e.end.y>+e.start.y&&(d=d+"-"+e.end.y);var p=r.get("formatter"),f={start:e.start.y,end:e.end.y,nameMap:d},g=this._formatterLabel(p,f),m=new j.ZP({z2:30,style:(0,ne.Lr)(r,{text:g})});m.attr(this._yearTextPositionControl(m,c[a],i,a,o)),n.add(m)}},e.prototype._monthTextPositionControl=function(t,e,i,n,r){var o="left",a="top",s=t[0],l=t[1];return"horizontal"===i?(l+=r,e&&(o="center"),"start"===n&&(a="bottom")):(s+=r,e&&(a="middle"),"start"===n&&(o="right")),{x:s,y:l,align:o,verticalAlign:a}},e.prototype._renderMonthText=function(t,e,i,n){var r=t.getModel("monthLabel");if(r.get("show")){var o=r.get("nameMap"),a=r.get("margin"),s=r.get("position"),l=r.get("align"),u=[this._tlpoints,this._blpoints];o&&!(0,_.isString)(o)||(o&&(e=(0,Yd.G8)(o)||e),o=e.get(["time","monthAbbr"])||[]);var h="start"===s?0:1,c="horizontal"===i?0:1;a="start"===s?-a:a;for(var d="center"===l,p=0;p=n.start.time&&i.timea.end.time&&t.reverse(),t},t.prototype._getRangeInfo=function(t){var e,i=[this.getDateInfo(t[0]),this.getDateInfo(t[1])];i[0].time>i[1].time&&(e=!0,i.reverse());var n=Math.floor(i[1].time/Jd)-Math.floor(i[0].time/Jd)+1,r=new Date(i[0].time),o=r.getDate(),a=i[1].date.getDate();r.setDate(o+n-1);var s=r.getDate();if(s!==a)for(var l=r.getTime()-i[1].time>0?1:-1;(s=r.getDate())!==a&&(r.getTime()-i[1].time)*l>0;)n-=l,r.setDate(s-l);var u=Math.floor((n+i[0].day+6)/7),h=e?1-u:u-1;return e&&i.reverse(),{range:[i[0].formatedDate,i[1].formatedDate],start:i[0],end:i[1],allDay:n,weeks:u,nthWeek:h,fweek:i[0].day,lweek:i[1].day}},t.prototype._getDateByWeeksAndDay=function(t,e,i){var n=this._getRangeInfo(i);if(t>n.weeks||0===t&&en.lweek)return null;var r=7*(t-1)-n.fweek+e,o=new Date(n.start.time);return o.setDate(+n.start.d+r),this.getDateInfo(o)},t.create=function(e,i){var n=[];return e.eachComponent("calendar",(function(r){var o=new t(r,e,i);n.push(o),r.coordinateSystem=o})),e.eachSeries((function(t){"calendar"===t.get("coordinateSystem")&&(t.coordinateSystem=n[t.get("calendarIndex")||0])})),n},t.dimensions=["time","value"],t}();function tp(t,e){var i;return _.each(e,(function(e){null!=t[e]&&"auto"!==t[e]&&(i=!0)})),i}var ep=["transition","enterFrom","leaveTo"],ip=ep.concat(["enterAnimation","updateAnimation","leaveAnimation"]);function np(t,e,i){if(i&&(!t[i]&&e[i]&&(t[i]={}),t=t[i],e=e[i]),t&&e)for(var n=i?ep:ip,r=0;r=0;l--){var p,f;u=i[l];if(f=null!=(p=Ht.U5(u.id,null))?r.get(p):null){var g=f.parent,m=(d=ap(g),g===n?{width:o,height:a}:{width:d.width,height:d.height}),v={},y=oi.p$(f,u,m,null,{hv:u.hv,boundingMode:u.bounding},v);if(!ap(f).isNew&&y){for(var x=u.transition,b={},w=0;w=0)?b[S]=T:f[S]=T}(0,Gt.D)(f,b,t,0)}else f.attr(v)}}},e.prototype._clear=function(){var t=this,e=this._elMap;e.each((function(i){hp(i,ap(i).option,e,t._lastGraphicModel)})),this._elMap=_.createHashMap()},e.prototype.dispose=function(){this._clear()},e.type="graphic",e}(zi.Z);function lp(t){var e=new(_.hasOwn(op,t)?op[t]:Ie.getShapeClass(t))({});return ap(e).type=t,e}function up(t,e,i,n){var r=lp(i);return e.add(r),n.set(t,r),ap(r).id=t,ap(r).isNew=!0,r}function hp(t,e,i,n){t&&t.parent&&("group"===t.type&&t.traverse((function(t){hp(t,e,i,n)})),qh(t,e,n),i.removeKey(ap(t).id))}function cp(t,e,i,n){t.isGroup||_.each([["cursor",qr.ZP.prototype.cursor],["zlevel",n||0],["z",i||0],["z2",0]],(function(i){var n=i[0];_.hasOwn(e,n)?t[n]=_.retrieve2(e[n],i[1]):null==t[n]&&(t[n]=i[1])})),_.each(_.keys(e),(function(i){if(0===i.indexOf("on")){var n=e[i];t[i]=_.isFunction(n)?n:null}})),_.hasOwn(e,"draggable")&&(t.draggable=e.draggable),null!=e.name&&(t.name=e.name),null!=e.id&&(t.id=e.id)}var dp=i(5045),pp=i(7813),fp=["rect","polygon","keep","clear"];function gp(t,e){var i=(0,Ht.kF)(t?t.brush:[]);if(i.length){var n=[];_.each(i,(function(t){var e=t.hasOwnProperty("toolbox")?t.toolbox:[];e instanceof Array&&(n=n.concat(e))}));var r=t&&t.toolbox;_.isArray(r)&&(r=r[0]),r||(r={feature:{}},t.toolbox=[r]);var o,a,s=r.feature||(r.feature={}),l=s.brush||(s.brush={}),u=l.type||(l.type=[]);u.push.apply(u,n),o=u,a={},_.each(o,(function(t){a[t]=1})),o.length=0,_.each(a,(function(t,e){o.push(e)})),e&&!u.length&&u.push.apply(u,fp)}}var mp=i(6211),vp=_.each;function yp(t){if(t)for(var e in t)if(t.hasOwnProperty(e))return!0}function _p(t,e,i){var n={};return vp(e,(function(e){var r,o=n[e]=((r=function(){}).prototype.__hidden=r.prototype,new r);vp(t[e],(function(t,n){if(es.isValidType(n)){var r={type:n,visual:t};i&&i(r,e),o[n]=new es(r),"opacity"===n&&((r=_.clone(r)).type="colorAlpha",o.__hidden.__alphaForOpacity=new es(r))}}))})),n}function xp(t,e,i){var n;_.each(i,(function(t){e.hasOwnProperty(t)&&yp(e[t])&&(n=!0)})),n&&_.each(i,(function(i){e.hasOwnProperty(i)&&yp(e[i])?t[i]=_.clone(e[i]):delete t[i]}))}var bp=i(4564);var wp={lineX:Sp(0),lineY:Sp(1),rect:{point:function(t,e,i){return t&&i.boundingRect.contain(t[0],t[1])},rect:function(t,e,i){return t&&i.boundingRect.intersect(t)}},polygon:{point:function(t,e,i){return t&&i.boundingRect.contain(t[0],t[1])&&bp.X(i.range,t[0],t[1])},rect:function(t,e,i){var n=i.range;if(!t||n.length<=1)return!1;var r=t.x,o=t.y,a=t.width,s=t.height,l=n[0];return!!(bp.X(n,r,o)||bp.X(n,r+a,o)||bp.X(n,r,o+s)||bp.X(n,r+a,o+s)||Pi.Z.create(t).contain(l[0],l[1])||(0,Ie.linePolygonIntersect)(r,o,r+a,o,n)||(0,Ie.linePolygonIntersect)(r,o,r,o+s,n)||(0,Ie.linePolygonIntersect)(r+a,o,r+a,o+s,n)||(0,Ie.linePolygonIntersect)(r,o+s,r+a,o+s,n))||void 0}}};function Sp(t){var e=["x","y"],i=["width","height"];return{point:function(e,i,n){if(e){var r=n.range;return Tp(e[t],r)}},rect:function(n,r,o){if(n){var a=o.range,s=[n[e[t]],n[e[t]]+n[i[t]]];return s[1]e[0][1]&&(e[0][1]=o[0]),o[1]e[1][1]&&(e[1][1]=o[1])}return e&&Ep(e)}};function Ep(t){return new Pi.Z(t[0][0],t[1][0],t[0][1]-t[0][0],t[1][1]-t[1][0])}const Np=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.init=function(t,e){this.ecModel=t,this.api=e,this.model,(this._brushController=new ml.Z(e.getZr())).on("brush",_.bind(this._onBrush,this)).mount()},e.prototype.render=function(t,e,i,n){this.model=t,this._updateController(t,e,i,n)},e.prototype.updateTransform=function(t,e,i,n){Ip(e),this._updateController(t,e,i,n)},e.prototype.updateVisual=function(t,e,i,n){this.updateTransform(t,e,i,n)},e.prototype.updateView=function(t,e,i,n){this._updateController(t,e,i,n)},e.prototype._updateController=function(t,e,i,n){(!n||n.$from!==t.id)&&this._brushController.setPanels(t.brushTargetManager.makePanelOpts(i)).enableBrush(t.brushOption).updateCovers(t.areas.slice())},e.prototype.dispose=function(){this._brushController.dispose()},e.prototype._onBrush=function(t){var e=this.model.id,i=this.model.brushTargetManager.setOutputRanges(t.areas,this.ecModel);(!t.isEnd||t.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:e,areas:_.clone(i),$from:e}),t.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:e,areas:_.clone(i),$from:e})},e.type="brush",e}(zi.Z);function Rp(t,e){return _.merge({brushType:t.brushType,brushMode:t.brushMode,transformable:t.transformable,brushStyle:new Gn.Z(t.brushStyle).getItemStyle(),removeOnClick:t.removeOnClick,z:t.z},e,!0)}const zp=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.areas=[],i.brushOption={},i}return(0,It.ZT)(e,t),e.prototype.optionUpdated=function(t,e){var i=this.option;!e&&xp(i,t,["inBrush","outOfBrush"]);var n=i.inBrush=i.inBrush||{};i.outOfBrush=i.outOfBrush||{color:"#ddd"},n.hasOwnProperty("liftZ")||(n.liftZ=5)},e.prototype.setAreas=function(t){t&&(this.areas=_.map(t,(function(t){return Rp(this.option,t)}),this))},e.prototype.setBrushOption=function(t){this.brushOption=Rp(this.option,t),this.brushType=this.brushOption.brushType},e.type="brush",e.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],e.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(210,219,238,0.3)",borderColor:"#D2DBEE"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},e}(Bi.Z);var Bp=i(1806),Zp=["rect","polygon","lineX","lineY","keep","clear"],Fp=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,It.ZT)(e,t),e.prototype.render=function(t,e,i){var n,r,o;e.eachComponent({mainType:"brush"},(function(t){n=t.brushType,r=t.brushOption.brushMode||"single",o=o||!!t.areas.length})),this._brushType=n,this._brushMode=r,_.each(t.get("type",!0),(function(e){t.setIconStatus(e,("keep"===e?"multiple"===r:"clear"===e?o:e===n)?"emphasis":"normal")}))},e.prototype.updateView=function(t,e,i){this.render(t,e,i)},e.prototype.getIcons=function(){var t=this.model,e=t.get("icon",!0),i={};return _.each(t.get("type",!0),(function(t){e[t]&&(i[t]=e[t])})),i},e.prototype.onclick=function(t,e,i){var n=this._brushType,r=this._brushMode;"clear"===i?(e.dispatchAction({type:"axisAreaSelect",intervals:[]}),e.dispatchAction({type:"brush",command:"clear",areas:[]})):e.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:"keep"===i?n:n!==i&&i,brushMode:"keep"===i?"multiple"===r?"single":"multiple":r}})},e.getDefaultOption=function(t){return{show:!0,type:Zp.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:t.getLocaleModel().get(["toolbox","brush","title"])}},e}(Bp.f1);const Vp=Fp;var Gp=i(8690);const Hp=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.layoutMode="box",i}return(0,It.ZT)(e,t),e.prototype.init=function(t,e,i){this.mergeDefaultAndTheme(t,i),this._initData()},e.prototype.mergeOption=function(e){t.prototype.mergeOption.apply(this,arguments),this._initData()},e.prototype.setCurrentIndex=function(t){null==t&&(t=this.option.currentIndex);var e=this._data.count();this.option.loop?t=(t%e+e)%e:(t>=e&&(t=e-1),t<0&&(t=0)),this.option.currentIndex=t},e.prototype.getCurrentIndex=function(){return this.option.currentIndex},e.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},e.prototype.setPlayState=function(t){this.option.autoPlay=!!t},e.prototype.getPlayState=function(){return!!this.option.autoPlay},e.prototype._initData=function(){var t,e=this.option,i=e.data||[],n=e.axisType,r=this._names=[];"category"===n?(t=[],(0,_.each)(i,(function(e,i){var n,o=(0,Ht.U5)((0,Ht.C4)(e),"");(0,_.isObject)(e)?(n=(0,_.clone)(e)).value=i:n=i,t.push(n),r.push(o)}))):t=i;var o={category:"ordinal",time:"time",value:"number"}[n]||"number";(this._data=new Mi.Z([{name:"value",type:o}],this)).initData(t,r)},e.prototype.getData=function(){return this._data},e.prototype.getCategories=function(){if("category"===this.get("axisType"))return this._names.slice()},e.type="timeline",e.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},e}(Bi.Z);var Up=i(1219),Wp=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.type="timeline.slider",e.defaultOption=(0,Ae.ZL)(Hp.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:"#DAE1F5"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#A4B1D7"},itemStyle:{color:"#A4B1D7",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:15,color:"#316bf3",borderColor:"#fff",borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:"rgba(0, 0, 0, 0.3)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"M2,18.5A1.52,1.52,0,0,1,.92,18a1.49,1.49,0,0,1,0-2.12L7.81,9.36,1,3.11A1.5,1.5,0,1,1,3,.89l8,7.34a1.48,1.48,0,0,1,.49,1.09,1.51,1.51,0,0,1-.46,1.1L3,18.08A1.5,1.5,0,0,1,2,18.5Z",prevIcon:"M10,.5A1.52,1.52,0,0,1,11.08,1a1.49,1.49,0,0,1,0,2.12L4.19,9.64,11,15.89a1.5,1.5,0,1,1-2,2.22L1,10.77A1.48,1.48,0,0,1,.5,9.68,1.51,1.51,0,0,1,1,8.58L9,.92A1.5,1.5,0,0,1,10,.5Z",prevBtnSize:18,nextBtnSize:18,color:"#A4B1D7",borderColor:"#A4B1D7",borderWidth:1},emphasis:{label:{show:!0,color:"#6f778d"},itemStyle:{color:"#316BF3"},controlStyle:{color:"#316BF3",borderColor:"#316BF3",borderWidth:2}},progress:{lineStyle:{color:"#316BF3"},itemStyle:{color:"#316BF3"},label:{color:"#6f778d"}},data:[]}),e}(Hp);(0,_.mixin)(Wp,Up.X.prototype);const jp=Wp;const Xp=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.type="timeline",e}(zi.Z);const Yp=function(t){function e(e,i,n,r){var o=t.call(this,e,i,n)||this;return o.type=r||"value",o}return(0,It.ZT)(e,t),e.prototype.getLabelModel=function(){return this.model.getModel("label")},e.prototype.isHorizontal=function(){return"horizontal"===this.model.get("orient")},e}(rn.Z);var qp=i(5043),Kp=i(1618),Jp=Math.PI,Qp=(0,Ht.Yf)(),$p=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.init=function(t,e){this.api=e},e.prototype.render=function(t,e,i){if(this.model=t,this.api=i,this.ecModel=e,this.group.removeAll(),t.get("show",!0)){var n=this._layout(t,i),r=this._createGroup("_mainGroup"),o=this._createGroup("_labelGroup"),a=this._axis=this._createAxis(n,t);t.formatTooltip=function(t){var e=a.scale.getLabel({value:t});return(0,Zn.TX)("nameValue",{noName:!0,value:e})},(0,_.each)(["AxisLine","AxisTick","Control","CurrentPointer"],(function(e){this["_render"+e](n,r,a,t)}),this),this._renderAxisLabel(n,o,a,t),this._position(n,t)}this._doPlayStop(),this._updateTicksStatus()},e.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},e.prototype.dispose=function(){this._clearTimer()},e.prototype._layout=function(t,e){var i,n,r,o,a=t.get(["label","position"]),s=t.get("orient"),l=function(t,e){return oi.ME(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()},t.get("padding"))}(t,e),u={horizontal:"center",vertical:(i=null==a||"auto"===a?"horizontal"===s?l.y+l.height/2=0||"+"===i?"left":"right"},h={horizontal:i>=0||"+"===i?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:Jp/2},d="vertical"===s?l.height:l.width,p=t.getModel("controlStyle"),f=p.get("show",!0),g=f?p.get("itemSize"):0,m=f?p.get("itemGap"):0,v=g+m,y=t.get(["label","rotate"])||0;y=y*Jp/180;var x=p.get("position",!0),b=f&&p.get("showPlayBtn",!0),w=f&&p.get("showPrevBtn",!0),S=f&&p.get("showNextBtn",!0),T=0,M=d;"left"===x||"bottom"===x?(b&&(n=[0,0],T+=v),w&&(r=[T,0],T+=v),S&&(o=[M-g,0],M-=v)):(b&&(n=[M-g,0],M-=v),w&&(r=[0,0],T+=v),S&&(o=[M-g,0],M-=v));var C=[T,M];return t.get("inverse")&&C.reverse(),{viewRect:l,mainLength:d,orient:s,rotation:c[s],labelRotation:y,labelPosOpt:i,labelAlign:t.get(["label","align"])||u[s],labelBaseline:t.get(["label","verticalAlign"])||t.get(["label","baseline"])||h[s],playPosition:n,prevBtnPosition:r,nextBtnPosition:o,axisExtent:C,controlSize:g,controlGap:m}},e.prototype._position=function(t,e){var i=this._mainGroup,n=this._labelGroup,r=t.viewRect;if("vertical"===t.orient){var o=Qi.create(),a=r.x,s=r.y+r.height;Qi.translate(o,o,[-a,-s]),Qi.rotate(o,o,-Jp/2),Qi.translate(o,o,[a,s]),(r=r.clone()).applyTransform(o)}var l=m(r),u=m(i.getBoundingRect()),h=m(n.getBoundingRect()),c=[i.x,i.y],d=[n.x,n.y];d[0]=c[0]=l[0][0];var p,f=t.labelPosOpt;null==f||(0,_.isString)(f)?(v(c,u,l,1,p="+"===f?0:1),v(d,h,l,1,1-p)):(v(c,u,l,1,p=f>=0?0:1),d[1]=c[1]+f);function g(t){t.originX=l[0][0]-t.x,t.originY=l[1][0]-t.y}function m(t){return[[t.x,t.x+t.width],[t.y,t.y+t.height]]}function v(t,e,i,n,r){t[n]+=i[n][r]-e[n][r]}i.setPosition(c),n.setPosition(d),i.rotation=n.rotation=t.rotation,g(i),g(n)},e.prototype._createAxis=function(t,e){var i=e.getData(),n=e.get("axisType"),r=function(t,e){if(e=e||t.get("type"),e)switch(e){case"category":return new qp.Z({ordinalMeta:t.getCategories(),extent:[1/0,-1/0]});case"time":return new Kp.Z({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default:return new un.Z}}(e,n);r.getTicks=function(){return i.mapArray(["value"],(function(t){return{value:t}}))};var o=i.getDataExtent("value");r.setExtent(o[0],o[1]),r.calcNiceTicks();var a=new Yp("value",r,t.axisExtent,n);return a.model=e,a},e.prototype._createGroup=function(t){var e=this[t]=new kt.Z;return this.group.add(e),e},e.prototype._renderAxisLine=function(t,e,i,n){var r=i.getExtent();if(n.get(["lineStyle","show"])){var o=new vn.Z({shape:{x1:r[0],y1:0,x2:r[1],y2:0},style:(0,_.extend)({lineCap:"round"},n.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});e.add(o);var a=this._progressLine=new vn.Z({shape:{x1:r[0],x2:this._currentPointer?this._currentPointer.x:r[0],y1:0,y2:0},style:(0,_.defaults)({lineCap:"round",lineWidth:o.style.lineWidth},n.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});e.add(a)}},e.prototype._renderAxisTick=function(t,e,i,n){var r=this,o=n.getData(),a=i.scale.getTicks();this._tickSymbols=[],(0,_.each)(a,(function(t){var a=i.dataToCoord(t.value),s=o.getItemModel(t.value),l=s.getModel("itemStyle"),u=s.getModel(["emphasis","itemStyle"]),h=s.getModel(["progress","itemStyle"]),c={x:a,y:0,onclick:(0,_.bind)(r._changeTimeline,r,t.value)},d=tf(s,l,e,c);d.ensureState("emphasis").style=u.getItemStyle(),d.ensureState("progress").style=h.getItemStyle(),(0,ie.vF)(d);var p=(0,oe.A)(d);s.get("tooltip")?(p.dataIndex=t.value,p.dataModel=n):p.dataIndex=p.dataModel=null,r._tickSymbols.push(d)}))},e.prototype._renderAxisLabel=function(t,e,i,n){var r=this;if(i.getLabelModel().get("show")){var o=n.getData(),a=i.getViewLabels();this._tickLabels=[],(0,_.each)(a,(function(n){var a=n.tickValue,s=o.getItemModel(a),l=s.getModel("label"),u=s.getModel(["emphasis","label"]),h=s.getModel(["progress","label"]),c=i.dataToCoord(n.tickValue),d=new j.ZP({x:c,y:0,rotation:t.labelRotation-t.rotation,onclick:(0,_.bind)(r._changeTimeline,r,a),silent:!1,style:(0,ne.Lr)(l,{text:n.formattedLabel,align:t.labelAlign,verticalAlign:t.labelBaseline})});d.ensureState("emphasis").style=(0,ne.Lr)(u),d.ensureState("progress").style=(0,ne.Lr)(h),e.add(d),(0,ie.vF)(d),Qp(d).dataIndex=a,r._tickLabels.push(d)}))}},e.prototype._renderControl=function(t,e,i,n){var r=t.controlSize,o=t.rotation,a=n.getModel("controlStyle").getItemStyle(),s=n.getModel(["emphasis","controlStyle"]).getItemStyle(),l=n.getPlayState(),h=n.get("inverse",!0);function c(t,i,l,h){if(t){var c=(0,u.GM)((0,_.retrieve2)(n.get(["controlStyle",i+"BtnSize"]),r),r),d=function(t,e,i,n){var r=n.style,o=Ie.createIcon(t.get(["controlStyle",e]),n||{},new Pi.Z(i[0],i[1],i[2],i[3]));r&&o.setStyle(r);return o}(n,i+"Icon",[0,-c/2,c,c],{x:t[0],y:t[1],originX:r/2,originY:0,rotation:h?-o:0,rectHover:!0,style:a,onclick:l});d.ensureState("emphasis").style=s,e.add(d),(0,ie.vF)(d)}}c(t.nextBtnPosition,"next",(0,_.bind)(this._changeTimeline,this,h?"-":"+")),c(t.prevBtnPosition,"prev",(0,_.bind)(this._changeTimeline,this,h?"+":"-")),c(t.playPosition,l?"stop":"play",(0,_.bind)(this._handlePlayClick,this,!l),!0)},e.prototype._renderCurrentPointer=function(t,e,i,n){var r=n.getData(),o=n.getCurrentIndex(),a=r.getItemModel(o).getModel("checkpointStyle"),s=this,l={onCreate:function(t){t.draggable=!0,t.drift=(0,_.bind)(s._handlePointerDrag,s),t.ondragend=(0,_.bind)(s._handlePointerDragend,s),ef(t,s._progressLine,o,i,n,!0)},onUpdate:function(t){ef(t,s._progressLine,o,i,n)}};this._currentPointer=tf(a,a,this._mainGroup,{},this._currentPointer,l)},e.prototype._handlePlayClick=function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},e.prototype._handlePointerDrag=function(t,e,i){this._clearTimer(),this._pointerChangeTimeline([i.offsetX,i.offsetY])},e.prototype._handlePointerDragend=function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},e.prototype._pointerChangeTimeline=function(t,e){var i=this._toAxisCoord(t)[0],n=this._axis,r=ri.dt(n.getExtent().slice());i>r[1]&&(i=r[1]),i=0&&(a[o]=+a[o].toFixed(c)),[a,h]}var vf={min:(0,_.curry)(mf,"min"),max:(0,_.curry)(mf,"max"),average:(0,_.curry)(mf,"average"),median:(0,_.curry)(mf,"median")};function yf(t,e){var i=t.getData(),n=t.coordinateSystem;if(e&&!function(t){return!isNaN(parseFloat(t.x))&&!isNaN(parseFloat(t.y))}(e)&&!(0,_.isArray)(e.coord)&&n){var r=n.dimensions,o=_f(e,i,n,t);if((e=(0,_.clone)(e)).type&&vf[e.type]&&o.baseAxis&&o.valueAxis){var a=(0,_.indexOf)(r,o.baseAxis.dim),s=(0,_.indexOf)(r,o.valueAxis.dim),l=vf[e.type](i,o.baseDataDim,o.valueDataDim,a,s);e.coord=l[0],e.value=l[1]}else{for(var u=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],h=0;h<2;h++)vf[u[h]]&&(u[h]=wf(i,i.mapDimension(r[h]),u[h]));e.coord=u}}return e}function _f(t,e,i,n){var r={};return null!=t.valueIndex||null!=t.valueDim?(r.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,r.valueAxis=i.getAxis(function(t,e){var i=t.getData().getDimensionInfo(e);return i&&i.coordDim}(n,r.valueDataDim)),r.baseAxis=i.getOtherAxis(r.valueAxis),r.baseDataDim=e.mapDimension(r.baseAxis.dim)):(r.baseAxis=n.getBaseAxis(),r.valueAxis=i.getOtherAxis(r.baseAxis),r.baseDataDim=e.mapDimension(r.baseAxis.dim),r.valueDataDim=e.mapDimension(r.valueAxis.dim)),r}function xf(t,e){return!(t&&t.containData&&e.coord&&!gf(e))||t.containData(e.coord)}function bf(t,e){return t?function(t,i,n,r){var o=r<2?t.coord&&t.coord[r]:t.value;return(0,ff.yQ)(o,e[r])}:function(t,i,n,r){return(0,ff.yQ)(t.value,e[r])}}function wf(t,e,i){if("average"===i){var n=0,r=0;return t.each(e,(function(t,e){isNaN(t)||(n+=t,r++)})),n/r}return"median"===i?t.getMedian(e):t.getDataExtent(e)["max"===i?1:0]}var Sf=(0,Ht.Yf)();const Tf=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.init=function(){this.markerGroupMap=(0,_.createHashMap)()},e.prototype.render=function(t,e,i){var n=this,r=this.markerGroupMap;r.each((function(t){Sf(t).keep=!1})),e.eachSeries((function(t){var r=df.getMarkerModelFromSeries(t,n.type);r&&n.renderSeries(t,r,e,i)})),r.each((function(t){!Sf(t).keep&&n.group.remove(t.group)}))},e.prototype.markKeep=function(t){Sf(t).keep=!0},e.prototype.toggleBlurSeries=function(t,e){var i=this;(0,_.each)(t,(function(t){var n=df.getMarkerModelFromSeries(t,i.type);n&&n.getData().eachItemGraphicEl((function(t){t&&(e?(0,ie.SX)(t):(0,ie.VP)(t))}))}))},e.type="marker",e}(zi.Z);function Mf(t,e,i){var n=e.coordinateSystem;t.each((function(r){var o,a=t.getItemModel(r),s=ri.GM(a.get("x"),i.getWidth()),l=ri.GM(a.get("y"),i.getHeight());if(isNaN(s)||isNaN(l)){if(e.getMarkerPosition)o=e.getMarkerPosition(t.getValues(t.dimensions,r));else if(n){var u=t.get(n.dimensions[0],r),h=t.get(n.dimensions[1],r);o=n.dataToPoint([u,h])}}else o=[s,l];isNaN(s)||(o[0]=s),isNaN(l)||(o[1]=l),t.setItemLayout(r,o)}))}const Cf=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.updateTransform=function(t,e,i){e.eachSeries((function(t){var e=df.getMarkerModelFromSeries(t,"markPoint");e&&(Mf(e.getData(),t,i),this.markerGroupMap.get(t.id).updateLayout())}),this)},e.prototype.renderSeries=function(t,e,i,n){var r=t.coordinateSystem,o=t.id,a=t.getData(),s=this.markerGroupMap,l=s.get(o)||s.set(o,new Nt.Z),u=function(t,e,i){var n;n=t?(0,_.map)(t&&t.dimensions,(function(t){var i=e.getData().getDimensionInfo(e.getData().mapDimension(t))||{};return(0,_.extend)((0,_.extend)({},i),{name:t,ordinalMeta:null})})):[{name:"value",type:"float"}];var r=new Mi.Z(n,i),o=(0,_.map)(i.get("data"),(0,_.curry)(yf,e));t&&(o=(0,_.filter)(o,(0,_.curry)(xf,t)));var a=bf(!!t,n);return r.initData(o,null,a),r}(r,t,e);e.setData(u),Mf(e.getData(),t,n),u.each((function(t){var i=u.getItemModel(t),n=i.getShallow("symbol"),r=i.getShallow("symbolSize"),o=i.getShallow("symbolRotate"),s=i.getShallow("symbolOffset"),l=i.getShallow("symbolKeepAspect");if((0,_.isFunction)(n)||(0,_.isFunction)(r)||(0,_.isFunction)(o)||(0,_.isFunction)(s)){var h=e.getRawValue(t),c=e.getDataParams(t);(0,_.isFunction)(n)&&(n=n(h,c)),(0,_.isFunction)(r)&&(r=r(h,c)),(0,_.isFunction)(o)&&(o=o(h,c)),(0,_.isFunction)(s)&&(s=s(h,c))}var d=i.getModel("itemStyle").getItemStyle(),p=(0,mp.UL)(a,"color");d.fill||(d.fill=p),u.setItemVisual(t,{symbol:n,symbolSize:r,symbolRotate:o,symbolOffset:s,symbolKeepAspect:l,style:d})})),l.updateData(u),this.group.add(l.group),u.eachItemGraphicEl((function(t){t.traverse((function(t){(0,oe.A)(t).dataModel=e}))})),this.markKeep(l),l.group.silent=e.get("silent")||t.get("silent")},e.type="markPoint",e}(Tf);const Af=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.createMarkerModelFromSeries=function(t,i,n){return new e(t,i,n)},e.type="markLine",e.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"},e}(df);var Lf=i(7145),If=(0,Ht.Yf)(),Df=function(t,e,i,n){var r,o=t.getData();if((0,_.isArray)(n))r=n;else{var a=n.type;if("min"===a||"max"===a||"average"===a||"median"===a||null!=n.xAxis||null!=n.yAxis){var s=void 0,l=void 0;if(null!=n.yAxis||null!=n.xAxis)s=e.getAxis(null!=n.yAxis?"y":"x"),l=(0,_.retrieve)(n.yAxis,n.xAxis);else{var u=_f(n,o,e,t);s=u.valueAxis,l=wf(o,(0,zt.IR)(o,u.valueDataDim),a)}var h="x"===s.dim?0:1,c=1-h,d=(0,_.clone)(n),p={coord:[]};d.type=null,d.coord=[],d.coord[c]=-1/0,p.coord[c]=1/0;var f=i.get("precision");f>=0&&(0,_.isNumber)(l)&&(l=+l.toFixed(Math.min(f,20))),d.coord[h]=p.coord[h]=l,r=[d,p,{type:a,valueIndex:n.valueIndex,value:l}]}else r=[]}var g=[yf(t,r[0]),yf(t,r[1]),(0,_.extend)({},r[2])];return g[2].type=g[2].type||null,(0,_.merge)(g[2],g[0]),(0,_.merge)(g[2],g[1]),g};function Pf(t){return!isNaN(t)&&!isFinite(t)}function Of(t,e,i,n){var r=1-t,o=n.dimensions[t];return Pf(e[r])&&Pf(i[r])&&e[t]===i[t]&&n.getAxis(o).containData(e[t])}function kf(t,e){if("cartesian2d"===t.type){var i=e[0].coord,n=e[1].coord;if(i&&n&&(Of(1,i,n,t)||Of(0,i,n,t)))return!0}return xf(t,e[0])&&xf(t,e[1])}function Ef(t,e,i,n,r){var o,a=n.coordinateSystem,s=t.getItemModel(e),l=ri.GM(s.get("x"),r.getWidth()),u=ri.GM(s.get("y"),r.getHeight());if(isNaN(l)||isNaN(u)){if(n.getMarkerPosition)o=n.getMarkerPosition(t.getValues(t.dimensions,e));else{var h=a.dimensions,c=t.get(h[0],e),d=t.get(h[1],e);o=a.dataToPoint([c,d])}if(ee(a,"cartesian2d")){var p=a.getAxis("x"),f=a.getAxis("y");h=a.dimensions;Pf(t.get(h[0],e))?o[0]=p.toGlobalCoord(p.getExtent()[i?0:1]):Pf(t.get(h[1],e))&&(o[1]=f.toGlobalCoord(f.getExtent()[i?0:1]))}isNaN(l)||(o[0]=l),isNaN(u)||(o[1]=u)}else o=[l,u];t.setItemLayout(e,o)}const Nf=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.updateTransform=function(t,e,i){e.eachSeries((function(t){var e=df.getMarkerModelFromSeries(t,"markLine");if(e){var n=e.getData(),r=If(e).from,o=If(e).to;r.each((function(e){Ef(r,e,!0,t,i),Ef(o,e,!1,t,i)})),n.each((function(t){n.setItemLayout(t,[r.getItemLayout(t),o.getItemLayout(t)])})),this.markerGroupMap.get(t.id).updateLayout()}}),this)},e.prototype.renderSeries=function(t,e,i,n){var r=t.coordinateSystem,o=t.id,a=t.getData(),s=this.markerGroupMap,l=s.get(o)||s.set(o,new Lf.Z);this.group.add(l.group);var u=function(t,e,i){var n;n=t?(0,_.map)(t&&t.dimensions,(function(t){var i=e.getData().getDimensionInfo(e.getData().mapDimension(t))||{};return(0,_.extend)((0,_.extend)({},i),{name:t,ordinalMeta:null})})):[{name:"value",type:"float"}];var r=new Mi.Z(n,i),o=new Mi.Z(n,i),a=new Mi.Z([],i),s=(0,_.map)(i.get("data"),(0,_.curry)(Df,e,t,i));t&&(s=(0,_.filter)(s,(0,_.curry)(kf,t)));var l=bf(!!t,n);return r.initData((0,_.map)(s,(function(t){return t[0]})),null,l),o.initData((0,_.map)(s,(function(t){return t[1]})),null,l),a.initData((0,_.map)(s,(function(t){return t[2]}))),a.hasItemOption=!0,{from:r,to:o,line:a}}(r,t,e),h=u.from,c=u.to,d=u.line;If(e).from=h,If(e).to=c,e.setData(d);var p=e.get("symbol"),f=e.get("symbolSize"),g=e.get("symbolRotate"),m=e.get("symbolOffset");function v(e,i,r){var o=e.getItemModel(i);Ef(e,i,r,t,n);var s=o.getModel("itemStyle").getItemStyle();null==s.fill&&(s.fill=(0,mp.UL)(a,"color")),e.setItemVisual(i,{symbolKeepAspect:o.get("symbolKeepAspect"),symbolOffset:(0,_.retrieve2)(o.get("symbolOffset",!0),m[r?0:1]),symbolRotate:(0,_.retrieve2)(o.get("symbolRotate",!0),g[r?0:1]),symbolSize:(0,_.retrieve2)(o.get("symbolSize"),f[r?0:1]),symbol:(0,_.retrieve2)(o.get("symbol",!0),p[r?0:1]),style:s})}(0,_.isArray)(p)||(p=[p,p]),(0,_.isArray)(f)||(f=[f,f]),(0,_.isArray)(g)||(g=[g,g]),(0,_.isArray)(m)||(m=[m,m]),u.from.each((function(t){v(h,t,!0),v(c,t,!1)})),d.each((function(t){var e=d.getItemModel(t).getModel("lineStyle").getLineStyle();d.setItemLayout(t,[h.getItemLayout(t),c.getItemLayout(t)]),null==e.stroke&&(e.stroke=h.getItemVisual(t,"style").fill),d.setItemVisual(t,{fromSymbolKeepAspect:h.getItemVisual(t,"symbolKeepAspect"),fromSymbolOffset:h.getItemVisual(t,"symbolOffset"),fromSymbolRotate:h.getItemVisual(t,"symbolRotate"),fromSymbolSize:h.getItemVisual(t,"symbolSize"),fromSymbol:h.getItemVisual(t,"symbol"),toSymbolKeepAspect:c.getItemVisual(t,"symbolKeepAspect"),toSymbolOffset:c.getItemVisual(t,"symbolOffset"),toSymbolRotate:c.getItemVisual(t,"symbolRotate"),toSymbolSize:c.getItemVisual(t,"symbolSize"),toSymbol:c.getItemVisual(t,"symbol"),style:e})})),l.updateData(d),u.line.eachItemGraphicEl((function(t){(0,oe.A)(t).dataModel=e,t.traverse((function(t){(0,oe.A)(t).dataModel=e}))})),this.markKeep(l),l.group.silent=e.get("silent")||t.get("silent")},e.type="markLine",e}(Tf);const Rf=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.createMarkerModelFromSeries=function(t,i,n){return new e(t,i,n)},e.type="markArea",e.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},e}(df);var zf=(0,Ht.Yf)(),Bf=function(t,e,i,n){var r=yf(t,n[0]),o=yf(t,n[1]),a=r.coord,s=o.coord;a[0]=(0,_.retrieve)(a[0],-1/0),a[1]=(0,_.retrieve)(a[1],-1/0),s[0]=(0,_.retrieve)(s[0],1/0),s[1]=(0,_.retrieve)(s[1],1/0);var l=(0,_.mergeAll)([{},r,o]);return l.coord=[r.coord,o.coord],l.x0=r.x,l.y0=r.y,l.x1=o.x,l.y1=o.y,l};function Zf(t){return!isNaN(t)&&!isFinite(t)}function Ff(t,e,i,n){var r=1-t;return Zf(e[r])&&Zf(i[r])}function Vf(t,e){var i=e.coord[0],n=e.coord[1],r={coord:i,x:e.x0,y:e.y0},o={coord:n,x:e.x1,y:e.y1};return ee(t,"cartesian2d")?!(!i||!n||!Ff(1,i,n)&&!Ff(0,i,n))||function(t,e,i){return!(t&&t.containZone&&e.coord&&i.coord&&!gf(e)&&!gf(i))||t.containZone(e.coord,i.coord)}(t,r,o):xf(t,r)||xf(t,o)}function Gf(t,e,i,n,r){var o,a=n.coordinateSystem,s=t.getItemModel(e),l=ri.GM(s.get(i[0]),r.getWidth()),u=ri.GM(s.get(i[1]),r.getHeight());if(isNaN(l)||isNaN(u)){if(n.getMarkerPosition)o=n.getMarkerPosition(t.getValues(i,e));else{var h=[p=t.get(i[0],e),f=t.get(i[1],e)];a.clampData&&a.clampData(h,h),o=a.dataToPoint(h,!0)}if(ee(a,"cartesian2d")){var c=a.getAxis("x"),d=a.getAxis("y"),p=t.get(i[0],e),f=t.get(i[1],e);Zf(p)?o[0]=c.toGlobalCoord(c.getExtent()["x0"===i[0]?0:1]):Zf(f)&&(o[1]=d.toGlobalCoord(d.getExtent()["y0"===i[1]?0:1]))}isNaN(l)||(o[0]=l),isNaN(u)||(o[1]=u)}else o=[l,u];return o}var Hf=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],Uf=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.updateTransform=function(t,e,i){e.eachSeries((function(t){var e=df.getMarkerModelFromSeries(t,"markArea");if(e){var n=e.getData();n.each((function(e){var r=(0,_.map)(Hf,(function(r){return Gf(n,e,r,t,i)}));n.setItemLayout(e,r),n.getItemGraphicEl(e).setShape("points",r)}))}}),this)},e.prototype.renderSeries=function(t,e,i,n){var r=t.coordinateSystem,o=t.id,a=t.getData(),s=this.markerGroupMap,l=s.get(o)||s.set(o,{group:new kt.Z});this.group.add(l.group),this.markKeep(l);var u=function(t,e,i){var n,r,o=["x0","y0","x1","y1"];if(t){var a=(0,_.map)(t&&t.dimensions,(function(t){var i=e.getData(),n=i.getDimensionInfo(i.mapDimension(t))||{};return(0,_.extend)((0,_.extend)({},n),{name:t,ordinalMeta:null})}));r=(0,_.map)(o,(function(t,e){return{name:t,type:a[e%2].type}})),n=new Mi.Z(r,i)}else r=[{name:"value",type:"float"}],n=new Mi.Z(r,i);var s=(0,_.map)(i.get("data"),(0,_.curry)(Bf,e,t,i));t&&(s=(0,_.filter)(s,(0,_.curry)(Vf,t)));var l=t?function(t,e,i,n){var o=t.coord[Math.floor(n/2)][n%2];return(0,ff.yQ)(o,r[n])}:function(t,e,i,n){return(0,ff.yQ)(t.value,r[n])};return n.initData(s,null,l),n.hasItemOption=!0,n}(r,t,e);e.setData(u),u.each((function(e){var i=(0,_.map)(Hf,(function(i){return Gf(u,e,i,t,n)})),o=r.getAxis("x").scale,s=r.getAxis("y").scale,l=o.getExtent(),h=s.getExtent(),c=[o.parse(u.get("x0",e)),o.parse(u.get("x1",e))],d=[s.parse(u.get("y0",e)),s.parse(u.get("y1",e))];ri.dt(c),ri.dt(d);var p=!!(l[0]>c[1]||l[1]d[1]||h[1]n[i+e]&&(e=a),r=r&&o.get("preventDefaultMouseMove",!0)})),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!r}}}(r);i.enable(a.controlType,a.opt),i.setPointerChecker(t.containsPoint),Oe.T9(t,"dispatchAction",e.model.get("throttle",!0),"fixRate")}else $f(n,t)}))}))}var ng=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="dataZoom.inside",e}return(0,It.ZT)(e,t),e.prototype.render=function(e,i,n){t.prototype.render.apply(this,arguments),e.noTarget()?this._clear():(this.range=e.getPercentRange(),Qf(n,e,{pan:(0,_.bind)(rg.pan,this),zoom:(0,_.bind)(rg.zoom,this),scrollMove:(0,_.bind)(rg.scrollMove,this)}))},e.prototype.dispose=function(){this._clear(),t.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){!function(t,e){for(var i=Jf(t).coordSysRecordMap,n=i.keys(),r=0;r0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(o[1]-o[0])+o[0],u=Math.max(1/n.scale,0);o[0]=(o[0]-l)*u+l,o[1]=(o[1]-l)*u+l;var h=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();return(0,tl.Z)(0,o,[0,100],0,h.minSpan,h.maxSpan),this.range=o,r[0]!==o[0]||r[1]!==o[1]?o:void 0}},pan:og((function(t,e,i,n,r,o){var a=ag[n]([o.oldX,o.oldY],[o.newX,o.newY],e,r,i);return a.signal*(t[1]-t[0])*a.pixel/a.pixelLength})),scrollMove:og((function(t,e,i,n,r,o){return ag[n]([0,0],[o.scrollDelta,o.scrollDelta],e,r,i).signal*(t[1]-t[0])*o.scrollDelta}))};function og(t){return function(e,i,n,r){var o=this.range,a=o.slice(),s=e.axisModels[0];if(s){var l=t(a,s,e,i,n,r);return(0,tl.Z)(l,a,[0,100],"all"),this.range=a,o[0]!==a[0]||o[1]!==a[1]?a:void 0}}}var ag={grid:function(t,e,i,n,r){var o=i.axis,a={},s=r.model.coordinateSystem.getRect();return t=t||[0,0],"x"===o.dim?(a.pixel=e[0]-t[0],a.pixelLength=s.width,a.pixelStart=s.x,a.signal=o.inverse?1:-1):(a.pixel=e[1]-t[1],a.pixelLength=s.height,a.pixelStart=s.y,a.signal=o.inverse?-1:1),a},polar:function(t,e,i,n,r){var o=i.axis,a={},s=r.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),"radiusAxis"===i.mainType?(a.pixel=e[0]-t[0],a.pixelLength=l[1]-l[0],a.pixelStart=l[0],a.signal=o.inverse?1:-1):(a.pixel=e[1]-t[1],a.pixelLength=u[1]-u[0],a.pixelStart=u[0],a.signal=o.inverse?-1:1),a},singleAxis:function(t,e,i,n,r){var o=i.axis,a=r.model.coordinateSystem.getRect(),s={};return t=t||[0,0],"horizontal"===o.orient?(s.pixel=e[0]-t[0],s.pixelLength=a.width,s.pixelStart=a.x,s.signal=o.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=a.height,s.pixelStart=a.y,s.signal=o.inverse?-1:1),s}};const sg=ng;var lg=i(7543);function ug(t){(0,lg.Z)(t),t.registerComponentModel(Yf),t.registerComponentView(sg),ig(t)}const hg=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=(0,Ae.ZL)(Xf.Z.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:"#d2dbee",borderRadius:3,backgroundColor:"rgba(47,69,84,0)",dataBackground:{lineStyle:{color:"#d2dbee",width:.5},areaStyle:{color:"#d2dbee",opacity:.2}},selectedDataBackground:{lineStyle:{color:"#8fb0f7",width:.5},areaStyle:{color:"#8fb0f7",opacity:.2}},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:"#fff",borderColor:"#ACB8D1"},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:"#D2DBEE",opacity:.7},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:"#6E7079"},brushSelect:!0,brushStyle:{color:"rgba(135,175,274,0.15)"},emphasis:{handleStyle:{borderColor:"#8FB0F7"},moveHandleStyle:{color:"#8FB0F7"}}}),e}(Xf.Z);var cg=i(9186),dg=De.Z,pg="horizontal",fg="vertical",gg=["line","bar","candlestick","scatter"],mg={easing:"cubicOut",duration:100,delay:0},vg=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i._displayables={},i}return(0,It.ZT)(e,t),e.prototype.init=function(t,e){this.api=e,this._onBrush=(0,_.bind)(this._onBrush,this),this._onBrushEnd=(0,_.bind)(this._onBrushEnd,this)},e.prototype.render=function(e,i,n,r){if(t.prototype.render.apply(this,arguments),Oe.T9(this,"_dispatchZoomAction",e.get("throttle"),"fixRate"),this._orient=e.getOrient(),!1!==e.get("show")){if(e.noTarget())return this._clear(),void this.group.removeAll();r&&"dataZoom"===r.type&&r.from===this.uid||this._buildView(),this._updateView()}else this.group.removeAll()},e.prototype.dispose=function(){this._clear(),t.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){Oe.ZH(this,"_dispatchZoomAction");var t=this.api.getZr();t.off("mousemove",this._onBrush),t.off("mouseup",this._onBrushEnd)},e.prototype._buildView=function(){var t=this.group;t.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var e=this._displayables.sliderGroup=new kt.Z;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(e),this._positionGroup()},e.prototype._resetLocation=function(){var t=this.dataZoomModel,e=this.api,i=t.get("brushSelect")?7:0,n=this._findCoordRect(),r={width:e.getWidth(),height:e.getHeight()},o=this._orient===pg?{right:r.width-n.x-n.width,top:r.height-30-7-i,width:n.width,height:30}:{right:7,top:n.y,width:30,height:n.height},a=oi.tE(t.option);(0,_.each)(["right","top","width","height"],(function(t){"ph"===a[t]&&(a[t]=o[t])}));var s=oi.ME(a,r);this._location={x:s.x,y:s.y},this._size=[s.width,s.height],this._orient===fg&&this._size.reverse()},e.prototype._positionGroup=function(){var t=this.group,e=this._location,i=this._orient,n=this.dataZoomModel.getFirstTargetAxisModel(),r=n&&n.get("inverse"),o=this._displayables.sliderGroup,a=(this._dataShadowInfo||{}).otherAxisInverse;o.attr(i!==pg||r?i===pg&&r?{scaleY:a?1:-1,scaleX:-1}:i!==fg||r?{scaleY:a?-1:1,scaleX:-1,rotation:Math.PI/2}:{scaleY:a?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:a?1:-1,scaleX:1});var s=t.getBoundingRect([o]);t.x=e.x-s.x,t.y=e.y-s.y,t.markRedraw()},e.prototype._getViewExtent=function(){return[0,this._size[0]]},e.prototype._renderBackground=function(){var t=this.dataZoomModel,e=this._size,i=this._displayables.sliderGroup,n=t.get("brushSelect");i.add(new dg({silent:!0,shape:{x:0,y:0,width:e[0],height:e[1]},style:{fill:t.get("backgroundColor")},z2:-40}));var r=new dg({shape:{x:0,y:0,width:e[0],height:e[1]},style:{fill:"transparent"},z2:0,onclick:(0,_.bind)(this._onClickPanel,this)}),o=this.api.getZr();n?(r.on("mousedown",this._onBrushStart,this),r.cursor="crosshair",o.on("mousemove",this._onBrush),o.on("mouseup",this._onBrushEnd)):(o.off("mousemove",this._onBrush),o.off("mouseup",this._onBrushEnd)),i.add(r)},e.prototype._renderDataShadow=function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],t){var e=this._size,i=this._shadowSize||[],n=t.series,r=n.getRawData(),o=n.getShadowDim&&n.getShadowDim(),a=o&&r.getDimensionInfo(o)?n.getShadowDim():t.otherDim;if(null!=a){var s=this._shadowPolygonPts,l=this._shadowPolylinePts;if(r!==this._shadowData||a!==this._shadowDim||e[0]!==i[0]||e[1]!==i[1]){var u=r.getDataExtent(a),h=.3*(u[1]-u[0]);u=[u[0]-h,u[1]+h];var c,d=[0,e[1]],p=[0,e[0]],f=[[e[0],0],[0,0]],g=[],m=p[1]/(r.count()-1),v=0,y=Math.round(r.count()/e[0]);r.each([a],(function(t,e){if(y>0&&e%y)v+=m;else{var i=null==t||isNaN(t)||""===t,n=i?0:(0,ri.NU)(t,u,d,!0);i&&!c&&e?(f.push([f[f.length-1][0],0]),g.push([g[g.length-1][0],0])):!i&&c&&(f.push([v,0]),g.push([v,0])),f.push([v,n]),g.push([v,n]),v+=m,c=i}})),s=this._shadowPolygonPts=f,l=this._shadowPolylinePts=g}this._shadowData=r,this._shadowDim=a,this._shadowSize=[e[0],e[1]];for(var _=this.dataZoomModel,x=0;x<3;x++){var b=w(1===x);this._displayables.sliderGroup.add(b),this._displayables.dataShadowSegs.push(b)}}}function w(t){var e=_.getModel(t?"selectedDataBackground":"dataBackground"),i=new kt.Z,n=new Rn.Z({shape:{points:s},segmentIgnoreThreshold:1,style:e.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),r=new di.Z({shape:{points:l},segmentIgnoreThreshold:1,style:e.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return i.add(n),i.add(r),i}},e.prototype._prepareDataShadowInfo=function(){var t=this.dataZoomModel,e=t.get("showDataShadow");if(!1!==e){var i,n=this.ecModel;return t.eachTargetAxis((function(r,o){var a=t.getAxisProxy(r,o).getTargetSeriesModels();(0,_.each)(a,(function(t){if(!(i||!0!==e&&(0,_.indexOf)(gg,t.get("type"))<0)){var a,s=n.getComponent((0,Kf.jQ)(r),o).axis,l={x:"y",y:"x",radius:"angle",angle:"radius"}[r],u=t.coordinateSystem;null!=l&&u.getOtherAxis&&(a=u.getOtherAxis(s).inverse),l=t.getData().mapDimension(l),i={thisAxis:s,series:t,thisDim:r,otherDim:l,otherAxisInverse:a}}}),this)}),this),i}},e.prototype._renderHandle=function(){var t=this.group,e=this._displayables,i=e.handles=[null,null],n=e.handleLabels=[null,null],r=this._displayables.sliderGroup,o=this._size,a=this.dataZoomModel,s=this.api,l=a.get("borderRadius")||0,u=a.get("brushSelect"),h=e.filler=new dg({silent:u,style:{fill:a.get("fillerColor")},textConfig:{position:"inside"}});r.add(h),r.add(new dg({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:o[0],height:o[1],r:l},style:{stroke:a.get("dataBackgroundColor")||a.get("borderColor"),lineWidth:1,fill:"rgba(0,0,0,0)"}})),(0,_.each)([0,1],(function(e){var o=a.get("handleIcon");!Ot.Pw[o]&&o.indexOf("path://")<0&&o.indexOf("image://")<0&&(o="path://"+o);var s=(0,Ot.th)(o,-1,0,2,2,null,!0);s.attr({cursor:yg(this._orient),draggable:!0,drift:(0,_.bind)(this._onDragMove,this,e),ondragend:(0,_.bind)(this._onDragEnd,this),onmouseover:(0,_.bind)(this._showDataInfo,this,!0),onmouseout:(0,_.bind)(this._showDataInfo,this,!1),z2:5});var l=s.getBoundingRect(),u=a.get("handleSize");this._handleHeight=(0,ri.GM)(u,this._size[1]),this._handleWidth=l.width/l.height*this._handleHeight,s.setStyle(a.getModel("handleStyle").getItemStyle()),s.style.strokeNoScale=!0,s.rectHover=!0,s.ensureState("emphasis").style=a.getModel(["emphasis","handleStyle"]).getItemStyle(),(0,ie.vF)(s);var h=a.get("handleColor");null!=h&&(s.style.fill=h),r.add(i[e]=s);var c=a.getModel("textStyle");t.add(n[e]=new j.ZP({silent:!0,invisible:!0,style:(0,ne.Lr)(c,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:c.getTextColor(),font:c.getFont()}),z2:10}))}),this);var c=h;if(u){var d=(0,ri.GM)(a.get("moveHandleSize"),o[1]),p=e.moveHandle=new De.Z({style:a.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:o[1]-.5,height:d}}),f=.8*d,g=e.moveHandleIcon=(0,Ot.th)(a.get("moveHandleIcon"),-f/2,-f/2,f,f,"#fff",!0);g.silent=!0,g.y=o[1]+d/2-.5,p.ensureState("emphasis").style=a.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var m=Math.min(o[1]/2,Math.max(d,10));(c=e.moveZone=new De.Z({invisible:!0,shape:{y:o[1]-m,height:d+m}})).on("mouseover",(function(){s.enterEmphasis(p)})).on("mouseout",(function(){s.leaveEmphasis(p)})),r.add(p),r.add(g),r.add(c)}c.attr({draggable:!0,cursor:yg(this._orient),drift:(0,_.bind)(this._onDragMove,this,"all"),ondragstart:(0,_.bind)(this._showDataInfo,this,!0),ondragend:(0,_.bind)(this._onDragEnd,this),onmouseover:(0,_.bind)(this._showDataInfo,this,!0),onmouseout:(0,_.bind)(this._showDataInfo,this,!1)})},e.prototype._resetInterval=function(){var t=this._range=this.dataZoomModel.getPercentRange(),e=this._getViewExtent();this._handleEnds=[(0,ri.NU)(t[0],[0,100],e,!0),(0,ri.NU)(t[1],[0,100],e,!0)]},e.prototype._updateInterval=function(t,e){var i=this.dataZoomModel,n=this._handleEnds,r=this._getViewExtent(),o=i.findRepresentativeAxisProxy().getMinMaxSpan(),a=[0,100];(0,tl.Z)(e,n,r,i.get("zoomLock")?"all":t,null!=o.minSpan?(0,ri.NU)(o.minSpan,a,r,!0):null,null!=o.maxSpan?(0,ri.NU)(o.maxSpan,a,r,!0):null);var s=this._range,l=this._range=(0,ri.dt)([(0,ri.NU)(n[0],r,a,!0),(0,ri.NU)(n[1],r,a,!0)]);return!s||s[0]!==l[0]||s[1]!==l[1]},e.prototype._updateView=function(t){var e=this._displayables,i=this._handleEnds,n=(0,ri.dt)(i.slice()),r=this._size;(0,_.each)([0,1],(function(t){var n=e.handles[t],o=this._handleHeight;n.attr({scaleX:o/2,scaleY:o/2,x:i[t]+(t?-1:1),y:r[1]/2-o/2})}),this),e.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:r[1]});var o={x:n[0],width:n[1]-n[0]};e.moveHandle&&(e.moveHandle.setShape(o),e.moveZone.setShape(o),e.moveZone.getBoundingRect(),e.moveHandleIcon&&e.moveHandleIcon.attr("x",o.x+o.width/2));for(var a=e.dataShadowSegs,s=[0,n[0],n[1],r[0]],l=0;le[0]||i[1]<0||i[1]>e[1])){var n=this._handleEnds,r=(n[0]+n[1])/2,o=this._updateInterval("all",i[0]-r);this._updateView(),o&&this._dispatchZoomAction(!1)}},e.prototype._onBrushStart=function(t){var e=t.offsetX,i=t.offsetY;this._brushStart=new pi.Z(e,i),this._brushing=!0,this._brushStartTime=+new Date},e.prototype._onBrushEnd=function(t){if(this._brushing){var e=this._displayables.brushRect;if(this._brushing=!1,e){e.attr("ignore",!0);var i=e.shape;if(!(+new Date-this._brushStartTime<200&&Math.abs(i.width)<5)){var n=this._getViewExtent(),r=[0,100];this._range=(0,ri.dt)([(0,ri.NU)(i.x,n,r,!0),(0,ri.NU)(i.x+i.width,n,r,!0)]),this._handleEnds=[i.x,i.x+i.width],this._updateView(),this._dispatchZoomAction(!1)}}}},e.prototype._onBrush=function(t){this._brushing&&(cg.sT(t.event),this._updateBrushRect(t.offsetX,t.offsetY))},e.prototype._updateBrushRect=function(t,e){var i=this._displayables,n=this.dataZoomModel,r=i.brushRect;r||(r=i.brushRect=new dg({silent:!0,style:n.getModel("brushStyle").getItemStyle()}),i.sliderGroup.add(r)),r.attr("ignore",!1);var o=this._brushStart,a=this._displayables.sliderGroup,s=a.transformCoordToLocal(t,e),l=a.transformCoordToLocal(o.x,o.y),u=this._size;s[0]=Math.max(Math.min(u[0],s[0]),0),r.setShape({x:l[0],y:0,width:s[0]-l[0],height:u[1]})},e.prototype._dispatchZoomAction=function(t){var e=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:t?mg:null,start:e[0],end:e[1]})},e.prototype._findCoordRect=function(){var t,e=(0,Kf.rg)(this.dataZoomModel).infoList;if(!t&&e.length){var i=e[0].model.coordinateSystem;t=i.getRect&&i.getRect()}if(!t){var n=this.api.getWidth(),r=this.api.getHeight();t={x:.2*n,y:.2*r,width:.6*n,height:.6*r}}return t},e.type="dataZoom.slider",e}(qf.Z);function yg(t){return"vertical"===t?"ns-resize":"ew-resize"}const _g=vg;function xg(t){t.registerComponentModel(hg),t.registerComponentView(_g),(0,lg.Z)(t)}var bg={get:function(t,e,i){var n=_.clone((wg[t]||{})[e]);return i&&_.isArray(n)?n[n.length-1]:n}},wg={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},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]}};const Sg=bg;var Tg=es.mapVisual,Mg=es.eachVisual,Cg=_.isArray,Ag=_.each,Lg=ri.dt,Ig=ri.NU,Dg=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.stateList=["inRange","outOfRange"],i.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],i.layoutMode={type:"box",ignoreSize:!0},i.dataBound=[-1/0,1/0],i.targetVisuals={},i.controllerVisuals={},i}return(0,It.ZT)(e,t),e.prototype.init=function(t,e,i){this.mergeDefaultAndTheme(t,i)},e.prototype.optionUpdated=function(t,e){var i=this.option;!e&&xp(i,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},e.prototype.resetVisual=function(t){var e=this.stateList;t=_.bind(t,this),this.controllerVisuals=_p(this.option.controller,e,t),this.targetVisuals=_p(this.option.target,e,t)},e.prototype.getItemSymbol=function(){return null},e.prototype.getTargetSeriesIndices=function(){var t=this.option.seriesIndex,e=[];return null==t||"all"===t?this.ecModel.eachSeries((function(t,i){e.push(i)})):e=Ht.kF(t),e},e.prototype.eachTargetSeries=function(t,e){_.each(this.getTargetSeriesIndices(),(function(i){var n=this.ecModel.getSeriesByIndex(i);n&&t.call(e,n)}),this)},e.prototype.isTargetSeries=function(t){var e=!1;return this.eachTargetSeries((function(i){i===t&&(e=!0)})),e},e.prototype.formatValueText=function(t,e,i){var n,r=this.option,o=r.precision,a=this.dataBound,s=r.formatter;i=i||["<",">"],_.isArray(t)&&(t=t.slice(),n=!0);var l=e?t:n?[u(t[0]),u(t[1])]:u(t);return _.isString(s)?s.replace("{value}",n?l[0]:l).replace("{value2}",n?l[1]:l):_.isFunction(s)?n?s(t[0],t[1]):s(t):n?t[0]===a[0]?i[0]+" "+l[1]:t[1]===a[1]?i[1]+" "+l[0]:l[0]+" - "+l[1]:l;function u(t){return t===a[0]?"min":t===a[1]?"max":(+t).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var t=this.option,e=Lg([t.min,t.max]);this._dataExtent=e},e.prototype.getDataDimensionIndex=function(t){var e=this.option.dimension;if(null!=e)return t.getDimensionIndex(e);for(var i=t.dimensions,n=i.length-1;n>=0;n--){var r=i[n],o=t.getDimensionInfo(r);if(!o.isCalculationCoord)return o.storeDimIndex}},e.prototype.getExtent=function(){return this._dataExtent.slice()},e.prototype.completeVisualOption=function(){var t=this.ecModel,e=this.option,i={inRange:e.inRange,outOfRange:e.outOfRange},n=e.target||(e.target={}),r=e.controller||(e.controller={});_.merge(n,i),_.merge(r,i);var o=this.isCategory();function a(i){Cg(e.color)&&!i.inRange&&(i.inRange={color:e.color.slice().reverse()}),i.inRange=i.inRange||{color:t.get("gradientColor")}}a.call(this,n),a.call(this,r),function(t,e,i){var n=t[e],r=t[i];n&&!r&&(r=t[i]={},Ag(n,(function(t,e){if(es.isValidType(e)){var i=Sg.get(e,"inactive",o);null!=i&&(r[e]=i,"color"!==e||r.hasOwnProperty("opacity")||r.hasOwnProperty("colorAlpha")||(r.opacity=[0,0]))}})))}.call(this,n,"inRange","outOfRange"),function(t){var e=(t.inRange||{}).symbol||(t.outOfRange||{}).symbol,i=(t.inRange||{}).symbolSize||(t.outOfRange||{}).symbolSize,n=this.get("inactiveColor"),r=this.getItemSymbol()||"roundRect";Ag(this.stateList,(function(a){var s=this.itemSize,l=t[a];l||(l=t[a]={color:o?n:[n]}),null==l.symbol&&(l.symbol=e&&_.clone(e)||(o?r:[r])),null==l.symbolSize&&(l.symbolSize=i&&_.clone(i)||(o?s[0]:[s[0],s[0]])),l.symbol=Tg(l.symbol,(function(t){return"none"===t?r:t}));var u=l.symbolSize;if(null!=u){var h=-1/0;Mg(u,(function(t){t>h&&(h=t)})),l.symbolSize=Tg(u,(function(t){return Ig(t,[0,h],[0,s[0]],!0)}))}}),this)}.call(this,r)},e.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},e.prototype.isCategory=function(){return!!this.option.categories},e.prototype.setSelected=function(t){},e.prototype.getSelected=function(){return null},e.prototype.getValueState=function(t){return null},e.prototype.getVisualMeta=function(t){return null},e.type="visualMap",e.dependencies=["series"],e.defaultOption={show:!0,z:4,seriesIndex:"all",min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,textStyle:{color:"#333"}},e}(Bi.Z);const Pg=Dg;var Og=[20,140],kg=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.optionUpdated=function(e,i){t.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual((function(t){t.mappingMethod="linear",t.dataExtent=this.getExtent()})),this._resetRange()},e.prototype.resetItemSize=function(){t.prototype.resetItemSize.apply(this,arguments);var e=this.itemSize;(null==e[0]||isNaN(e[0]))&&(e[0]=Og[0]),(null==e[1]||isNaN(e[1]))&&(e[1]=Og[1])},e.prototype._resetRange=function(){var t=this.getExtent(),e=this.option.range;!e||e.auto?(t.auto=1,this.option.range=t):_.isArray(e)&&(e[0]>e[1]&&e.reverse(),e[0]=Math.max(e[0],t[0]),e[1]=Math.min(e[1],t[1]))},e.prototype.completeVisualOption=function(){t.prototype.completeVisualOption.apply(this,arguments),_.each(this.stateList,(function(t){var e=this.option.controller[t].symbolSize;e&&e[0]!==e[1]&&(e[0]=e[1]/3)}),this)},e.prototype.setSelected=function(t){this.option.range=t.slice(),this._resetRange()},e.prototype.getSelected=function(){var t=this.getExtent(),e=ri.dt((this.get("range")||[]).slice());return e[0]>t[1]&&(e[0]=t[1]),e[1]>t[1]&&(e[1]=t[1]),e[0]=i[1]||t<=e[1])?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var e=[];return this.eachTargetSeries((function(i){var n=[],r=i.getData();r.each(this.getDataDimensionIndex(r),(function(e,i){t[0]<=e&&e<=t[1]&&n.push(i)}),this),e.push({seriesId:i.id,dataIndex:n})}),this),e},e.prototype.getVisualMeta=function(t){var e=Eg(this,"outOfRange",this.getExtent()),i=Eg(this,"inRange",this.option.range.slice()),n=[];function r(e,i){n.push({value:e,color:t(e,i)})}for(var o=0,a=0,s=i.length,l=e.length;at[1])break;i.push({color:this.getControllerVisual(o,"color",e),offset:r/100})}return i.push({color:this.getControllerVisual(t[1],"color",e),offset:1}),i},e.prototype._createBarPoints=function(t,e){var i=this.visualMapModel.itemSize;return[[i[0]-e[0],t[0]],[i[0],t[0]],[i[0],t[1]],[i[0]-e[1],t[1]]]},e.prototype._createBarGroup=function(t){var e=this._orient,i=this.visualMapModel.get("inverse");return new kt.Z("horizontal"!==e||i?"horizontal"===e&&i?{scaleX:"bottom"===t?-1:1,rotation:-Math.PI/2}:"vertical"!==e||i?{scaleX:"left"===t?1:-1}:{scaleX:"left"===t?1:-1,scaleY:-1}:{scaleX:"bottom"===t?1:-1,rotation:Math.PI/2})},e.prototype._updateHandle=function(t,e){if(this._useHandle){var i=this._shapes,n=this.visualMapModel,r=i.handleThumbs,o=i.handleLabels,a=n.itemSize,s=n.getExtent();Gg([0,1],(function(l){var u=r[l];u.setStyle("fill",e.handlesColor[l]),u.y=t[l];var h=Vg(t[l],[0,a[1]],s,!0),c=this.getControllerVisual(h,"symbolSize");u.scaleX=u.scaleY=c/a[0],u.x=a[0]-c/2;var d=Ie.applyTransform(i.handleLabelPoints[l],Ie.getTransform(u,this.group));o[l].setStyle({x:d[0],y:d[1],text:n.formatValueText(this._dataInterval[l]),verticalAlign:"middle",align:"vertical"===this._orient?this._applyTransform("left",i.mainGroup):"center"})}),this)}},e.prototype._showIndicator=function(t,e,i,n){var r=this.visualMapModel,o=r.getExtent(),a=r.itemSize,s=[0,a[1]],l=this._shapes,u=l.indicator;if(u){u.attr("invisible",!1);var h=this.getControllerVisual(t,"color",{convertOpacityToAlpha:!0}),c=this.getControllerVisual(t,"symbolSize"),d=Vg(t,o,s,!0),p=a[0]-c/2,f={x:u.x,y:u.y};u.y=d,u.x=p;var g=Ie.applyTransform(l.indicatorLabelPoint,Ie.getTransform(u,this.group)),m=l.indicatorLabel;m.attr("invisible",!1);var v=this._applyTransform("left",l.mainGroup),y="horizontal"===this._orient;m.setStyle({text:(i||"")+r.formatValueText(e),verticalAlign:y?v:"middle",align:y?"center":v});var _={x:p,y:d,style:{fill:h}},x={style:{x:g[0],y:g[1]}};if(r.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var b={duration:100,easing:"cubicInOut",additive:!0};u.x=f.x,u.y=f.y,u.animateTo(_,b),m.animateTo(x,b)}else u.attr(_),m.attr(x);this._firstShowIndicator=!1;var w=this._shapes.handleLabels;if(w)for(var S=0;Sr[1]&&(u[1]=1/0),e&&(u[0]===-1/0?this._showIndicator(l,u[1],"< ",a):u[1]===1/0?this._showIndicator(l,u[0],"> ",a):this._showIndicator(l,l,"≈ ",a));var h=this._hoverLinkDataIndices,c=[];(e||Xg(i))&&(c=this._hoverLinkDataIndices=i.findTargetDataIndices(u));var d=Ht.XI(h,c);this._dispatchHighDown("downplay",Fg(d[0],i)),this._dispatchHighDown("highlight",Fg(d[1],i))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var e;if((0,Do.o)(t.target,(function(t){var i=(0,oe.A)(t);if(null!=i.dataIndex)return e=i,!0}),!0),e){var i=this.ecModel.getSeriesByIndex(e.seriesIndex),n=this.visualMapModel;if(n.isTargetSeries(i)){var r=i.getData(e.dataType),o=r.getStore().get(n.getDataDimensionIndex(r),e.dataIndex);isNaN(o)||this._showIndicator(o,o)}}},e.prototype._hideIndicator=function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0);var e=this._shapes.handleLabels;if(e)for(var i=0;i=0&&(r.dimension=o,n.push(r))}})),t.getData().setVisual("visualMeta",n)}}];function $g(t,e,i,n){for(var r=e.targetVisuals[n],o=es.prepareVisualTypes(r),a={color:(0,mp.UL)(t.getData(),"color")},s=0,l=o.length;s0:t.splitNumber>0)&&!t.calculable?"piecewise":"continuous"})),t.registerAction(Kg,Jg),(0,_.each)(Qg,(function(e){t.registerVisual(t.PRIORITY.VISUAL.COMPONENT,e)})),t.registerPreprocessor(em))}function om(t){t.registerComponentModel(Ng),t.registerComponentView(qg),rm(t)}var am=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i._pieceList=[],i}return(0,It.ZT)(e,t),e.prototype.optionUpdated=function(e,i){t.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var n=this._mode=this._determineMode();this._pieceList=[],sm[this._mode].call(this,this._pieceList),this._resetSelected(e,i);var r=this.option.categories;this.resetVisual((function(t,e){"categories"===n?(t.mappingMethod="category",t.categories=_.clone(r)):(t.dataExtent=this.getExtent(),t.mappingMethod="piecewise",t.pieceList=_.map(this._pieceList,(function(t){return t=_.clone(t),"inRange"!==e&&(t.visual=null),t})))}))},e.prototype.completeVisualOption=function(){var e=this.option,i={},n=es.listVisualTypes(),r=this.isCategory();function o(t,e,i){return t&&t[e]&&t[e].hasOwnProperty(i)}_.each(e.pieces,(function(t){_.each(n,(function(e){t.hasOwnProperty(e)&&(i[e]=1)}))})),_.each(i,(function(t,i){var n=!1;_.each(this.stateList,(function(t){n=n||o(e,t,i)||o(e.target,t,i)}),this),!n&&_.each(this.stateList,(function(t){(e[t]||(e[t]={}))[i]=Sg.get(i,"inRange"===t?"active":"inactive",r)}))}),this),t.prototype.completeVisualOption.apply(this,arguments)},e.prototype._resetSelected=function(t,e){var i=this.option,n=this._pieceList,r=(e?i:t).selected||{};if(i.selected=r,_.each(n,(function(t,e){var i=this.getSelectedMapKey(t);r.hasOwnProperty(i)||(r[i]=!0)}),this),"single"===i.selectedMode){var o=!1;_.each(n,(function(t,e){var i=this.getSelectedMapKey(t);r[i]&&(o?r[i]=!1:o=!0)}),this)}},e.prototype.getItemSymbol=function(){return this.get("itemSymbol")},e.prototype.getSelectedMapKey=function(t){return"categories"===this._mode?t.value+"":t.index+""},e.prototype.getPieceList=function(){return this._pieceList},e.prototype._determineMode=function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},e.prototype.setSelected=function(t){this.option.selected=_.clone(t)},e.prototype.getValueState=function(t){var e=es.findPieceIndex(t,this._pieceList);return null!=e&&this.option.selected[this.getSelectedMapKey(this._pieceList[e])]?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var e=[],i=this._pieceList;return this.eachTargetSeries((function(n){var r=[],o=n.getData();o.each(this.getDataDimensionIndex(o),(function(e,n){es.findPieceIndex(e,i)===t&&r.push(n)}),this),e.push({seriesId:n.id,dataIndex:r})}),this),e},e.prototype.getRepresentValue=function(t){var e;if(this.isCategory())e=t.value;else if(null!=t.value)e=t.value;else{var i=t.interval||[];e=i[0]===-1/0&&i[1]===1/0?0:(i[0]+i[1])/2}return e},e.prototype.getVisualMeta=function(t){if(!this.isCategory()){var e=[],i=["",""],n=this,r=this._pieceList.slice();if(r.length){var o=r[0].interval[0];o!==-1/0&&r.unshift({interval:[-1/0,o]}),(o=r[r.length-1].interval[1])!==1/0&&r.push({interval:[o,1/0]})}else r.push({interval:[-1/0,1/0]});var a=-1/0;return _.each(r,(function(t){var e=t.interval;e&&(e[0]>a&&s([a,e[0]],"outOfRange"),s(e.slice()),a=e[1])}),this),{stops:e,outerColors:i}}function s(r,o){var a=n.getRepresentValue({interval:r});o||(o=n.getValueState(a));var s=t(a,o);r[0]===-1/0?i[0]=s:r[1]===1/0?i[1]=s:e.push({value:r[0],color:s},{value:r[1],color:s})}},e.type="visualMap.piecewise",e.defaultOption=(0,Ae.ZL)(Pg.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}),e}(Pg),sm={splitNumber:function(t){var e=this.option,i=Math.min(e.precision,20),n=this.getExtent(),r=e.splitNumber;r=Math.max(parseInt(r,10),1),e.splitNumber=r;for(var o=(n[1]-n[0])/r;+o.toFixed(i)!==o&&i<5;)i++;e.precision=i,o=+o.toFixed(i),e.minOpen&&t.push({interval:[-1/0,n[0]],close:[0,0]});for(var a=0,s=n[0];a","≥"][e[0]]];t.text=t.text||this.formatValueText(null!=t.value?t.value:t.interval,!1,i)}),this)}};function lm(t,e){var i=t.inverse;("vertical"===t.orient?!i:i)&&e.reverse()}const um=am;const hm=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,It.ZT)(e,t),e.prototype.doRender=function(){var t=this.group;t.removeAll();var e=this.visualMapModel,i=e.get("textGap"),n=e.textStyleModel,r=n.getFont(),o=n.getTextColor(),a=this._getItemAlign(),s=e.itemSize,l=this._getViewData(),u=l.endsText,h=_.retrieve(e.get("showLabel",!0),!u);u&&this._renderEndsText(t,u[0],s,h,a),_.each(l.viewPieceList,(function(n){var l=n.piece,u=new kt.Z;u.onclick=_.bind(this._onItemClick,this,l),this._enableHoverLink(u,n.indexInModelPieceList);var c=e.getRepresentValue(l);if(this._createItemSymbol(u,c,[0,0,s[0],s[1]]),h){var d=this.visualMapModel.getValueState(c);u.add(new j.ZP({style:{x:"right"===a?-i:s[0]+i,y:s[1]/2,text:l.text,verticalAlign:"middle",align:a,font:r,fill:o,opacity:"outOfRange"===d?.5:1}}))}t.add(u)}),this),u&&this._renderEndsText(t,u[1],s,h,a),oi.BZ(e.get("orient"),t,e.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},e.prototype._enableHoverLink=function(t,e){var i=this;t.on("mouseover",(function(){return n("highlight")})).on("mouseout",(function(){return n("downplay")}));var n=function(t){var n=i.visualMapModel;n.option.hoverLink&&i.api.dispatchAction({type:t,batch:Fg(n.findTargetDataIndices(e),n)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,e=t.option;if("vertical"===e.orient)return Zg(t,this.api,t.itemSize);var i=e.align;return i&&"auto"!==i||(i="left"),i},e.prototype._renderEndsText=function(t,e,i,n,r){if(e){var o=new kt.Z,a=this.visualMapModel.textStyleModel;o.add(new j.ZP({style:(0,ne.Lr)(a,{x:n?"right"===r?i[0]:0:i[0]/2,y:i[1]/2,verticalAlign:"middle",align:n?r:"center",text:e})})),t.add(o)}},e.prototype._getViewData=function(){var t=this.visualMapModel,e=_.map(t.getPieceList(),(function(t,e){return{piece:t,indexInModelPieceList:e}})),i=t.get("text"),n=t.get("orient"),r=t.get("inverse");return("horizontal"===n?r:!r)?e.reverse():i&&(i=i.slice().reverse()),{viewPieceList:e,endsText:i}},e.prototype._createItemSymbol=function(t,e,i){t.add((0,Ot.th)(this.getControllerVisual(e,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(e,"color")))},e.prototype._onItemClick=function(t){var e=this.visualMapModel,i=e.option,n=i.selectedMode;if(n){var r=_.clone(i.selected),o=e.getSelectedMapKey(t);"single"===n||!0===n?(r[o]=!0,_.each(r,(function(t,e){r[e]=e===o}))):r[o]=!r[o],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:r})}},e.type="visualMap.piecewise",e}(zg);function cm(t){t.registerComponentModel(um),t.registerComponentView(hm),rm(t)}var dm={label:{enabled:!0},decal:{show:!1}},pm=(0,Ht.Yf)(),fm={};function gm(t,e){var i=t.getModel("aria");if(i.get("enabled")){var n=_.clone(dm);_.merge(n.label,t.getLocaleModel().get("aria"),!1),_.merge(i.option,n,!1),function(){if(i.getModel("decal").get("show")){var e=_.createHashMap();t.eachSeries((function(t){if(!t.isColorBySeries()){var i=e.get(t.type);i||(i={},e.set(t.type,i)),pm(t).scope=i}})),t.eachRawSeries((function(e){if(!t.isSeriesFiltered(e))if(_.isFunction(e.enableAriaDecal))e.enableAriaDecal();else{var i=e.getData();if(e.isColorBySeries()){var n=(0,ma.i)(e.ecModel,e.name,fm,t.getSeriesCount()),r=i.getVisual("decal");i.setVisual("decal",u(r,n))}else{var o=e.getRawData(),a={},s=pm(e).scope;i.each((function(t){var e=i.getRawIndex(t);a[e]=t}));var l=o.count();o.each((function(t){var n=a[t],r=o.getName(t)||t+"",h=(0,ma.i)(e.ecModel,r,s,l),c=i.getItemVisual(n,"decal");i.setItemVisual(n,"decal",u(c,h))}))}}function u(t,e){var i=t?_.extend(_.extend({},e),t):e;return i.dirty=!0,i}}))}}(),function(){var n=t.getLocaleModel().get("aria"),o=i.getModel("label");if(o.option=_.defaults(o.option,n),!o.get("enabled"))return;var a=e.getZr().dom;if(o.get("description"))return void a.setAttribute("aria-label",o.get("description"));var s,l=t.getSeriesCount(),u=o.get(["data","maxCount"])||10,h=o.get(["series","maxCount"])||10,c=Math.min(l,h);if(l<1)return;var d=function(){var e=t.get("title");e&&e.length&&(e=e[0]);return e&&e.text}();s=d?r(o.get(["general","withTitle"]),{title:d}):o.get(["general","withoutTitle"]);var p=[];s+=r(l>1?o.get(["series","multiple","prefix"]):o.get(["series","single","prefix"]),{seriesCount:l}),t.eachSeries((function(e,i){if(i1?o.get(["series","multiple",a]):o.get(["series","single",a]),{seriesId:e.seriesIndex,seriesName:e.get("name"),seriesType:(_=e.subType,t.getLocaleModel().get(["series","typeNames"])[_]||"自定义图")});var s=e.getData();if(s.count()>u)n+=r(o.get(["data","partialData"]),{displayCnt:u});else n+=o.get(["data","allData"]);for(var h=o.get(["data","separator","middle"]),d=o.get(["data","separator","end"]),f=[],g=0;g":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},ym=function(){function t(t){if(null==(this._condVal=(0,_.isString)(t)?new RegExp(t):(0,_.isRegExp)(t)?t:null)){0,(0,nu._y)("")}}return t.prototype.evaluate=function(t){var e=typeof t;return(0,_.isString)(e)?this._condVal.test(t):!!(0,_.isNumber)(e)&&this._condVal.test(t+"")},t}(),_m=function(){function t(){}return t.prototype.evaluate=function(){return this.value},t}(),xm=function(){function t(){}return t.prototype.evaluate=function(){for(var t=this.children,e=0;e2&&l.push(e),e=[t,i]}function f(t,i,n,r){Om(t,n)&&Om(i,r)||e.push(t,i,n,r,n,r)}function g(t,i,n,r,o,a){var s=Math.abs(i-t),l=4*Math.tan(s/4)/3,u=iT:A2&&l.push(e),l}function Em(t,e,i,n,r,o,a,s,l,u){if(Om(t,i)&&Om(e,n)&&Om(r,a)&&Om(o,s))l.push(a,s);else{var h=2/u,c=h*h,d=a-t,p=s-e,f=Math.sqrt(d*d+p*p);d/=f,p/=f;var g=i-t,m=n-e,v=r-a,y=o-s,_=g*g+m*m,x=v*v+y*y;if(_=0&&x-w*w=0)l.push(a,s);else{var S=[],T=[];(0,Ut.Vz)(t,i,r,a,.5,S),(0,Ut.Vz)(e,n,o,s,.5,T),Em(S[0],T[0],S[1],T[1],S[2],T[2],S[3],T[3],l,u),Em(S[4],T[4],S[5],T[5],S[6],T[6],S[7],T[7],l,u)}}}}function Nm(t,e,i){var n=t[e],r=t[1-e],o=Math.abs(n/r),a=Math.ceil(Math.sqrt(o*i)),s=Math.floor(i/a);0===s&&(s=1,a=i);for(var l=[],u=0;u0)for(u=0;uMath.abs(u),c=Nm([l,u],h?0:1,e),d=(h?s:u)/c.length,p=0;p1?null:new pi.Z(p*l+t,p*u+e)}function Zm(t,e,i){var n=new pi.Z;pi.Z.sub(n,i,e),n.normalize();var r=new pi.Z;return pi.Z.sub(r,t,e),r.dot(n)}function Fm(t,e){var i=t[t.length-1];i&&i[0]===e[0]&&i[1]===e[1]||t.push(e)}function Vm(t){var e=t.points,i=[],n=[];(0,Wo.zk)(e,i,n);var r=new Pi.Z(i[0],i[1],n[0]-i[0],n[1]-i[1]),o=r.width,a=r.height,s=r.x,l=r.y,u=new pi.Z,h=new pi.Z;return o>a?(u.x=h.x=s+o/2,u.y=l,h.y=l+a):(u.y=h.y=l+a/2,u.x=s,h.x=s+o),function(t,e,i){for(var n=t.length,r=[],o=0;or,a=Nm([n,r],o?0:1,e),s=o?"width":"height",l=o?"height":"width",u=o?"x":"y",h=o?"y":"x",c=t[s]/a.length,d=0;d0)for(var b=n/i,w=-n/2;w<=n/2;w+=b){var S=Math.sin(w),T=Math.cos(w),M=0;for(_=0;_0;l/=2){var u=0,h=0;(t&l)>0&&(u=1),(e&l)>0&&(h=1),s+=l*l*(3*u^h),0===h&&(1===u&&(t=l-1-t,e=l-1-e),a=t,t=e,e=a)}return s}function nv(t){var e=1/0,i=1/0,n=-1/0,r=-1/0,o=(0,_.map)(t,(function(t){var o=t.getBoundingRect(),a=t.getComputedTransform(),s=o.x+o.width/2+(a?a[4]:0),l=o.y+o.height/2+(a?a[5]:0);return e=Math.min(s,e),i=Math.min(l,i),n=Math.max(s,n),r=Math.max(l,r),[s,l]}));return(0,_.map)(o,(function(o,a){return{cp:o,z:iv(o[0],o[1],e,i,n,r),path:t[a]}})).sort((function(t,e){return t.z-e.z})).map((function(t){return t.path}))}function rv(t){return Hm(t.path,t.count)}function ov(t){return(0,_.isArray)(t[0])}function av(t,e){for(var i=[],n=t.length,r=0;r=0;r--)if(!i[r].many.length){var l=i[s].many;if(l.length<=1){if(!s)return i;s=0}o=l.length;var u=Math.ceil(o/2);i[r].many=l.slice(u,o),i[s].many=l.slice(0,u),s++}return i}var sv={clone:function(t){for(var e=[],i=1-Math.pow(1-t.path.style.opacity,1/t.count),n=0;n0){var l,u,h=n.getModel("universalTransition").get("delay"),c=Object.assign({setToFinal:!0},a);ov(t)&&(l=t,u=e),ov(e)&&(l=e,u=t);for(var d=l?l===t:t.length>e.length,p=l?av(u,l):av(d?e:t,[d?t:e]),f=0,g=0;g1e4))for(var n=i.getIndices(),r=function(t){for(var e=t.dimensions,i=0;i0&&n.group.traverse((function(t){t instanceof s.ZP&&!t.animators.length&&t.animateFrom({style:{opacity:0}},r)}))}))}function mv(t){var e=t.getModel("universalTransition").get("seriesKey");return e||t.id}function vv(t){return(0,_.isArray)(t)?t.sort().join(","):t}function yv(t){if(t.hostModel)return t.hostModel.getModel("universalTransition").get("divideShape")}function _v(t,e){for(var i=0;i=0&&r.push({data:e.oldData[i],divide:yv(e.oldData[i]),dim:t.dimension})})),(0,_.each)((0,Ht.kF)(t.to),(function(t){var e=_v(i.updatedSeries,t);if(e>=0){var n=i.updatedSeries[e].getData();o.push({data:n,divide:yv(n),dim:t.dimension})}})),r.length>0&&o.length>0&&gv(r,o,n)}(t,n,i,e)}));else{var o=function(t,e){var i=(0,_.createHashMap)(),n=(0,_.createHashMap)(),r=(0,_.createHashMap)();return(0,_.each)(t.oldSeries,(function(e,i){var o=t.oldData[i],a=mv(e),s=vv(a);n.set(s,o),(0,_.isArray)(a)&&(0,_.each)(a,(function(t){r.set(t,{data:o,key:s})}))})),(0,_.each)(e.updatedSeries,(function(t){if(t.isUniversalTransitionEnabled()&&t.isAnimationEnabled()){var e=t.getData(),o=mv(t),a=vv(o),s=n.get(a);if(s)i.set(a,{oldSeries:[{divide:yv(s),data:s}],newSeries:[{divide:yv(e),data:e}]});else if((0,_.isArray)(o)){var l=[];(0,_.each)(o,(function(t){var e=n.get(t);e&&l.push({divide:yv(e),data:e})})),l.length&&i.set(a,{oldSeries:l,newSeries:[{data:e,divide:yv(e)}]})}else{var u=r.get(o);if(u){var h=i.get(u.key);h||(h={oldSeries:[{data:u.data,divide:yv(u.data)}],newSeries:[]},i.set(u.key,h)),h.newSeries.push({data:e,divide:yv(e)})}}}})),i}(n,i);(0,_.each)(o.keys(),(function(t){var i=o.get(t);gv(i.oldSeries,i.newSeries,e)}))}(0,_.each)(i.updatedSeries,(function(t){t[Pt.V]&&(t[Pt.V]=!1)}))}for(var a=t.getSeries(),s=n.oldSeries=[],l=n.oldData=[],u=0;u{"use strict";function n(t,e){return t.pointToProjected?t.pointToProjected(e):t.pointToData(e)}function r(t,e,i,r){var o=t.getZoom(),a=t.getCenter(),s=e.zoom,l=t.projectedToPoint?t.projectedToPoint(a):t.dataToPoint(a);if(null!=e.dx&&null!=e.dy&&(l[0]-=e.dx,l[1]-=e.dy,t.setCenter(n(t,l),r)),null!=s){if(i){var u=i.min||0,h=i.max||1/0;s=Math.max(Math.min(o*s,h),u)/o}t.scaleX*=s,t.scaleY*=s;var c=(e.originX-t.x)*(s-1),d=(e.originY-t.y)*(s-1);t.x-=c,t.y-=d,t.updateTransform(),t.setCenter(n(t,l),r),t.setZoom(s*o)}return{center:t.getCenter(),zoom:t.getZoom()}}i.d(e,{A:()=>r})},4292:(t,e,i)=>{"use strict";i.d(e,{D:()=>s,KZ:()=>l,XD:()=>d,Zi:()=>p,_W:()=>f,bX:()=>h,eq:()=>u,ke:()=>o});var n=i(8760),r=(0,i(2234).Yf)();function o(t,e,i,r,o){var a;if(e&&e.ecModel){var s=e.ecModel.getUpdatePayload();a=s&&s.animation}var l="update"===t;if(e&&e.isAnimationEnabled()){var u=void 0,h=void 0,c=void 0;return r?(u=(0,n.retrieve2)(r.duration,200),h=(0,n.retrieve2)(r.easing,"cubicOut"),c=0):(u=e.getShallow(l?"animationDurationUpdate":"animationDuration"),h=e.getShallow(l?"animationEasingUpdate":"animationEasing"),c=e.getShallow(l?"animationDelayUpdate":"animationDelay")),a&&(null!=a.duration&&(u=a.duration),null!=a.easing&&(h=a.easing),null!=a.delay&&(c=a.delay)),(0,n.isFunction)(c)&&(c=c(i,o)),(0,n.isFunction)(u)&&(u=u(i)),{duration:u||0,delay:c,easing:h}}return null}function a(t,e,i,r,a,s,l){var u,h=!1;(0,n.isFunction)(a)?(l=s,s=a,a=null):(0,n.isObject)(a)&&(s=a.cb,l=a.during,h=a.isFrom,u=a.removeOpt,a=a.dataIndex);var c="leave"===t;c||e.stopAnimation("leave");var d=o(t,r,a,c?u||{}:null,r&&r.getAnimationDelayParams?r.getAnimationDelayParams(e,a):null);if(d&&d.duration>0){var p={duration:d.duration,delay:d.delay||0,easing:d.easing,done:s,force:!!s||!!l,setToFinal:!c,scope:t,during:l};h?e.animateFrom(i,p):e.animateTo(i,p)}else e.stopAnimation(),!h&&e.attr(i),l&&l(1),s&&s()}function s(t,e,i,n,r,o){a("update",t,e,i,n,r,o)}function l(t,e,i,n,r,o){a("enter",t,e,i,n,r,o)}function u(t){if(!t.__zr)return!0;for(var e=0;e{"use strict";i.d(e,{N:()=>v});var n=i(8299),r=i(8162),o=i(1525),a=i(2141),s=i(6357),l=i(6351);function u(t,e){var i=e.rippleEffectColor||e.color;t.eachChild((function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?i:null,fill:"fill"===e.brushType?i:null}})}))}var h=function(t){function e(e,i){var n=t.call(this)||this,r=new l.Z(e,i),o=new a.Z;return n.add(r),n.add(o),n.updateData(e,i),n}return(0,n.ZT)(e,t),e.prototype.stopEffectAnimation=function(){this.childAt(1).removeAll()},e.prototype.startEffectAnimation=function(t){for(var e=t.symbolType,i=t.color,n=t.rippleNumber,r=this.childAt(1),a=0;a{"use strict";i.d(e,{N:()=>pt});var n=i(8760);function r(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.eachSeriesByType("graph",(function(t){var i=t.getCategoriesData(),r=t.getGraph().data,o=i.mapArray(i.getName);r.filterSelf((function(t){var i=r.getItemModel(t).getShallow("category");if(null!=i){(0,n.isNumber)(i)&&(i=o[i]);for(var a=0;ar&&(r=e);var a=r%2?r+2:r+3;o=[];for(var s=0;s=0?n+=u:n-=u:f>=0?n-=u:n+=u}return n}function q(t,e){var i=[],n=V.Lx,r=[[],[],[]],o=[[],[]],a=[];e/=2,t.eachEdge((function(t,s){var u=t.getLayout(),h=t.getVisual("fromSymbol"),c=t.getVisual("toSymbol");u.__original||(u.__original=[l.clone(u[0]),l.clone(u[1])],u[2]&&u.__original.push(l.clone(u[2])));var d=u.__original;if(null!=u[2]){if(l.copy(r[0],d[0]),l.copy(r[1],d[2]),l.copy(r[2],d[1]),h&&"none"!==h){var p=x(t.node1),f=Y(r,d[0],p*e);n(r[0][0],r[1][0],r[2][0],f,i),r[0][0]=i[3],r[1][0]=i[4],n(r[0][1],r[1][1],r[2][1],f,i),r[0][1]=i[3],r[1][1]=i[4]}if(c&&"none"!==c){p=x(t.node2),f=Y(r,d[1],p*e);n(r[0][0],r[1][0],r[2][0],f,i),r[1][0]=i[1],r[2][0]=i[2],n(r[0][1],r[1][1],r[2][1],f,i),r[1][1]=i[1],r[2][1]=i[2]}l.copy(u[0],r[0]),l.copy(u[1],r[2]),l.copy(u[2],r[1])}else{if(l.copy(o[0],d[0]),l.copy(o[1],d[1]),l.sub(a,o[1],o[0]),l.normalize(a,a),h&&"none"!==h){p=x(t.node1);l.scaleAndAdd(o[0],o[0],a,p*e)}if(c&&"none"!==c){p=x(t.node2);l.scaleAndAdd(o[1],o[1],a,-p*e)}l.copy(u[0],o[0]),l.copy(u[1],o[1])}}))}var K=i(5797),J=i(106);function Q(t){return"view"===t.type}var $=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,E.ZT)(e,t),e.prototype.init=function(t,e){var i=new N.Z,n=new R.Z,r=this.group;this._controller=new z.Z(e.getZr()),this._controllerHost={target:r},r.add(i.group),r.add(n.group),this._symbolDraw=i,this._lineDraw=n,this._firstRender=!0},e.prototype.render=function(t,e,i){var n=this,r=t.coordinateSystem;this._model=t;var o=this._symbolDraw,a=this._lineDraw,s=this.group;if(Q(r)){var l={x:r.x,y:r.y,scaleX:r.scaleX,scaleY:r.scaleY};this._firstRender?s.attr(l):F.D(s,l,t)}q(t.getGraph(),_(t));var u=t.getData();o.updateData(u);var h=t.getEdgeData();a.updateData(h),this._updateNodeAndLinkScale(),this._updateController(t,e,i),clearTimeout(this._layoutTimeout);var c=t.forceLayout,d=t.get(["force","layoutAnimation"]);c&&this._startForceLayoutIteration(c,d);var p=t.get("layout");u.graph.eachNode((function(e){var i=e.dataIndex,r=e.getGraphicEl(),o=e.getModel();if(r){r.off("drag").off("dragend");var a=o.get("draggable");a&&r.on("drag",(function(o){switch(p){case"force":c.warmUp(),!n._layouting&&n._startForceLayoutIteration(c,d),c.setFixed(i),u.setItemLayout(i,[r.x,r.y]);break;case"circular":u.setItemLayout(i,[r.x,r.y]),e.setLayout({fixed:!0},!0),S(t,"symbolSize",e,[o.offsetX,o.offsetY]),n.updateLayout(t);break;default:u.setItemLayout(i,[r.x,r.y]),v(t.getGraph(),t),n.updateLayout(t)}})).on("dragend",(function(){c&&c.setUnfixed(i)})),r.setDraggable(a&&!!c,!!o.get("cursor")),"adjacency"===o.get(["emphasis","focus"])&&((0,J.A)(r).focus=e.getAdjacentDataIndices())}})),u.graph.eachEdge((function(t){var e=t.getGraphicEl(),i=t.getModel().get(["emphasis","focus"]);e&&"adjacency"===i&&((0,J.A)(e).focus={edge:[t.dataIndex],node:[t.node1.dataIndex,t.node2.dataIndex]})}));var f="circular"===t.get("layout")&&t.get(["circular","rotateLabel"]),g=u.getLayout("cx"),m=u.getLayout("cy");u.graph.eachNode((function(t){M(t,f,g,m)})),this._firstRender=!1},e.prototype.dispose=function(){this._controller&&this._controller.dispose(),this._controllerHost=null},e.prototype._startForceLayoutIteration=function(t,e){var i=this;!function n(){t.step((function(t){i.updateLayout(i._model),(i._layouting=!t)&&(e?i._layoutTimeout=setTimeout(n,16):n())}))}()},e.prototype._updateController=function(t,e,i){var n=this,r=this._controller,o=this._controllerHost,a=this.group;r.setPointerChecker((function(e,n,r){var o=a.getBoundingRect();return o.applyTransform(a.transform),o.contain(n,r)&&!(0,Z.l)(e,i,t)})),Q(t.coordinateSystem)?(r.enable(t.get("roam")),o.zoomLimit=t.get("scaleLimit"),o.zoom=t.coordinateSystem.getZoom(),r.off("pan").off("zoom").on("pan",(function(e){B.e(o,e.dx,e.dy),i.dispatchAction({seriesId:t.id,type:"graphRoam",dx:e.dx,dy:e.dy})})).on("zoom",(function(e){B.H(o,e.scale,e.originX,e.originY),i.dispatchAction({seriesId:t.id,type:"graphRoam",zoom:e.scale,originX:e.originX,originY:e.originY}),n._updateNodeAndLinkScale(),q(t.getGraph(),_(t)),n._lineDraw.updateLayout(),i.updateLabelLayout()}))):r.disable()},e.prototype._updateNodeAndLinkScale=function(){var t=this._model,e=t.getData(),i=_(t);e.eachItemGraphicEl((function(t,e){t&&t.setSymbolScale(i)}))},e.prototype.updateLayout=function(t){q(t.getGraph(),_(t)),this._symbolDraw.updateLayout(),this._lineDraw.updateLayout()},e.prototype.remove=function(t,e){this._symbolDraw&&this._symbolDraw.remove(),this._lineDraw&&this._lineDraw.remove()},e.type="graph",e}(K.Z);const tt=$;var et=i(5101),it=i(2234),nt=i(1497),rt=i(1764),ot=i(2019),at=i(3321),st=i(5685),lt=i(3993),ut=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.hasSymbolVisual=!0,i}return(0,E.ZT)(e,t),e.prototype.init=function(e){t.prototype.init.apply(this,arguments);var i=this;function n(){return i._categoriesData}this.legendVisualProvider=new ot.Z(n,n),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeOption=function(e){t.prototype.mergeOption.apply(this,arguments),this.fillDataTextStyle(e.edges||e.links),this._updateCategoriesData()},e.prototype.mergeDefaultAndTheme=function(e){t.prototype.mergeDefaultAndTheme.apply(this,arguments),(0,it.Cc)(e,"edgeLabel",["show"])},e.prototype.getInitialData=function(t,e){var i,r=t.edges||t.links||[],o=t.data||t.nodes||[],a=this;if(o&&r){h(i=this)&&(i.__curvenessList=[],i.__edgeMap={},c(i));var s=(0,rt.Z)(o,r,this,!0,(function(t,e){t.wrapMethod("getItemModel",(function(t){var e=a._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t}));var i=nt.Z.prototype.getModel;function n(t,e){var n=i.call(this,t,e);return n.resolveParentPath=r,n}function r(t){if(t&&("label"===t[0]||"label"===t[1])){var e=t.slice();return"label"===t[0]?e[0]="edgeLabel":"label"===t[1]&&(e[1]="edgeLabel"),e}return t}e.wrapMethod("getItemModel",(function(t){return t.resolveParentPath=r,t.getModel=n,t}))}));return n.each(s.edges,(function(t){!function(t,e,i,n){if(h(i)){var r=d(t,e,i),o=i.__edgeMap,a=o[p(r)];o[r]&&!a?o[r].isForward=!0:a&&o[r]&&(a.isForward=!0,o[r].isForward=!1),o[r]=o[r]||[],o[r].push(n)}}(t.node1,t.node2,this,t.dataIndex)}),this),s.data}},e.prototype.getGraph=function(){return this.getData().graph},e.prototype.getEdgeData=function(){return this.getGraph().edgeData},e.prototype.getCategoriesData=function(){return this._categoriesData},e.prototype.formatTooltip=function(t,e,i){if("edge"===i){var n=this.getData(),r=this.getDataParams(t,i),o=n.graph.getEdgeByIndex(t),a=n.getName(o.node1.dataIndex),s=n.getName(o.node2.dataIndex),l=[];return null!=a&&l.push(a),null!=s&&l.push(s),(0,st.TX)("nameValue",{name:l.join(" > "),value:r.value,noValue:null==r.value})}return(0,lt.w)({series:this,dataIndex:t,multipleSeries:e})},e.prototype._updateCategoriesData=function(){var t=n.map(this.option.categories||[],(function(t){return null!=t.value?t:n.extend({value:0},t)})),e=new et.Z(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray((function(t){return e.getItemModel(t)}))},e.prototype.setZoom=function(t){this.option.zoom=t},e.prototype.setCenter=function(t){this.option.center=t},e.prototype.isAnimationEnabled=function(){return t.prototype.isAnimationEnabled.call(this)&&!("force"===this.get("layout")&&this.get(["force","layoutAnimation"]))},e.type="series.graph",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.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:"#aaa",width:1,opacity:.5},emphasis:{scale:!0,label:{show:!0}},select:{itemStyle:{borderColor:"#212121"}}},e}(at.Z);const ht=ut;var ct=i(553),dt={type:"graphRoam",event:"graphRoam",update:"none"};function pt(t){t.registerChartView(tt),t.registerSeriesModel(ht),t.registerProcessor(r),t.registerVisual(o),t.registerVisual(s),t.registerLayout(y),t.registerLayout(t.PRIORITY.VISUAL.POST_CHART_LAYOUT,C),t.registerLayout(I),t.registerCoordinateSystem("graphView",{dimensions:D.Z.dimensions,create:k}),t.registerAction({type:"focusNodeAdjacency",event:"focusNodeAdjacency",update:"series:focusNodeAdjacency"},n.noop),t.registerAction({type:"unfocusNodeAdjacency",event:"unfocusNodeAdjacency",update:"series:unfocusNodeAdjacency"},n.noop),t.registerAction(dt,(function(t,e,i){e.eachComponent({mainType:"series",query:t},(function(e){var n=e.coordinateSystem,r=(0,ct.A)(n,t,void 0,i);e.setCenter&&e.setCenter(r.center),e.setZoom&&e.setZoom(r.zoom)}))}))}},9971:(t,e,i)=>{"use strict";i.d(e,{Z:()=>M});var n=i(8299),r=i(8760),o=i(1362),a=i(1525),s=i(9067),l=i(8989),u=i(8751),h=s.Z.prototype,c=l.Z.prototype,d=function(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1};!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}(0,n.ZT)(e,t)}(d);function p(t){return isNaN(+t.cpx1)||isNaN(+t.cpy1)}const f=function(t){function e(e){var i=t.call(this,e)||this;return i.type="ec-line",i}return(0,n.ZT)(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new d},e.prototype.buildPath=function(t,e){p(e)?h.buildPath.call(this,t,e):c.buildPath.call(this,t,e)},e.prototype.pointAt=function(t){return p(this.shape)?h.pointAt.call(this,t):c.pointAt.call(this,t)},e.prototype.tangentAt=function(t){var e=this.shape,i=p(e)?[e.x2-e.x1,e.y2-e.y1]:c.tangentAt.call(this,t);return o.normalize(i,i)},e}(u.ZP);var g=i(4292),m=i(2141),v=i(6357),y=i(6006),_=i(5669),x=["fromSymbol","toSymbol"];function b(t){return"_"+t+"Type"}function w(t,e,i){var n=e.getItemVisual(i,t);if(n&&"none"!==n){var r=e.getItemVisual(i,t+"Size"),o=e.getItemVisual(i,t+"Rotate"),s=e.getItemVisual(i,t+"Offset"),l=e.getItemVisual(i,t+"KeepAspect"),u=a.zp(r),h=a.Cq(s||0,u),c=a.th(n,-u[0]/2+h[0],-u[1]/2+h[1],u[0],u[1],null,l);return c.__specifiedRotation=null==o||isNaN(o)?void 0:+o*Math.PI/180||0,c.name=t,c}}function S(t,e){t.x1=e[0][0],t.y1=e[0][1],t.x2=e[1][0],t.y2=e[1][1],t.percent=1;var i=e[2];i?(t.cpx1=i[0],t.cpy1=i[1]):(t.cpx1=NaN,t.cpy1=NaN)}var T=function(t){function e(e,i,n){var r=t.call(this)||this;return r._createLine(e,i,n),r}return(0,n.ZT)(e,t),e.prototype._createLine=function(t,e,i){var n=t.hostModel,o=function(t){var e=new f({name:"line",subPixelOptimize:!0});return S(e.shape,t),e}(t.getItemLayout(e));o.shape.percent=0,g.KZ(o,{shape:{percent:1}},n,e),this.add(o),(0,r.each)(x,(function(i){var n=w(i,t,e);this.add(n),this[b(i)]=t.getItemVisual(e,i)}),this),this._updateCommonStl(t,e,i)},e.prototype.updateData=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),a=t.getItemLayout(e),s={shape:{}};S(s.shape,a),g.D(o,s,n,e),(0,r.each)(x,(function(i){var n=t.getItemVisual(e,i),r=b(i);if(this[r]!==n){this.remove(this.childOfName(i));var o=w(i,t,e);this.add(o)}this[r]=n}),this),this._updateCommonStl(t,e,i)},e.prototype.getLinePath=function(){return this.childAt(0)},e.prototype._updateCommonStl=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),a=i&&i.emphasisLineStyle,s=i&&i.blurLineStyle,l=i&&i.selectLineStyle,u=i&&i.labelStatesModels,h=i&&i.emphasisDisabled,c=i&&i.focus,d=i&&i.blurScope;if(!i||t.hasItemOption){var p=t.getItemModel(e),f=p.getModel("emphasis");a=f.getModel("lineStyle").getLineStyle(),s=p.getModel(["blur","lineStyle"]).getLineStyle(),l=p.getModel(["select","lineStyle"]).getLineStyle(),h=f.get("disabled"),c=f.get("focus"),d=f.get("blurScope"),u=(0,y.k3)(p)}var g=t.getItemVisual(e,"style"),m=g.stroke;o.useStyle(g),o.style.fill=null,o.style.strokeNoScale=!0,o.ensureState("emphasis").style=a,o.ensureState("blur").style=s,o.ensureState("select").style=l,(0,r.each)(x,(function(t){var e=this.childOfName(t);if(e){e.setColor(m),e.style.opacity=g.opacity;for(var i=0;i0&&(_[0]=-_[0],_[1]=-_[1]);var b=y[0]<0?-1:1;if("start"!==n.__position&&"end"!==n.__position){var w=-Math.atan2(y[1],y[0]);h[0].8?"left":c[0]<-.8?"right":"center",p=c[1]>.8?"top":c[1]<-.8?"bottom":"middle";break;case"start":n.x=-c[0]*g+u[0],n.y=-c[1]*m+u[1],d=c[0]>.8?"right":c[0]<-.8?"left":"center",p=c[1]>.8?"bottom":c[1]<-.8?"top":"middle";break;case"insideStartTop":case"insideStart":case"insideStartBottom":n.x=g*b+u[0],n.y=u[1]+S,d=y[0]<0?"right":"left",n.originX=-g*b,n.originY=-S;break;case"insideMiddleTop":case"insideMiddle":case"insideMiddleBottom":case"middle":n.x=x[0],n.y=x[1]+S,d="center",n.originY=-S;break;case"insideEndTop":case"insideEnd":case"insideEndBottom":n.x=-g*b+h[0],n.y=h[1]+S,d=y[0]>=0?"right":"left",n.originX=g*b,n.originY=-S}n.scaleX=n.scaleY=r,n.setStyle({verticalAlign:n.__verticalAlign||p,align:n.__align||d})}}}function T(t,e){var i=t.__specifiedRotation;if(null==i){var n=s.tangentAt(e);t.attr("rotation",(1===e?-1:1)*Math.PI/2-Math.atan2(n[1],n[0]))}else t.attr("rotation",i)}},e}(m.Z);const M=T},7145:(t,e,i)=>{"use strict";i.d(e,{Z:()=>h});var n=i(2141),r=i(1177),o=i(9971),a=i(6006);function s(t){var e=t.hostModel,i=e.getModel("emphasis");return{lineStyle:e.getModel("lineStyle").getLineStyle(),emphasisLineStyle:i.getModel(["lineStyle"]).getLineStyle(),blurLineStyle:e.getModel(["blur","lineStyle"]).getLineStyle(),selectLineStyle:e.getModel(["select","lineStyle"]).getLineStyle(),emphasisDisabled:i.get("disabled"),blurScope:i.get("blurScope"),focus:i.get("focus"),labelStatesModels:(0,a.k3)(e)}}function l(t){return isNaN(t[0])||isNaN(t[1])}function u(t){return t&&!l(t[0])&&!l(t[1])}const h=function(){function t(t){this.group=new n.Z,this._LineCtor=t||o.Z}return t.prototype.updateData=function(t){var e=this;this._progressiveEls=null;var i=this,n=i.group,r=i._lineData;i._lineData=t,r||n.removeAll();var o=s(t);t.diff(r).add((function(i){e._doAdd(t,i,o)})).update((function(i,n){e._doUpdate(r,t,n,i,o)})).remove((function(t){n.remove(r.getItemGraphicEl(t))})).execute()},t.prototype.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl((function(e,i){e.updateLayout(t,i)}),this)},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=s(t),this._lineData=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e){function i(t){t.isGroup||function(t){return t.animators&&t.animators.length>0}(t)||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[];for(var n=t.start;n{"use strict";i.d(e,{Z:()=>f});var n=i(8299),r=i(1525),o=i(4292),a=i(2141),s=i(106),l=i(6357),u=i(3140),h=i(8760),c=i(6006),d=i(4276);function p(t,e){this.parent.drift(t,e)}const f=function(t){function e(e,i,n,r){var o=t.call(this)||this;return o.updateData(e,i,n,r),o}return(0,n.ZT)(e,t),e.prototype._createSymbol=function(t,e,i,n,o){this.removeAll();var a=(0,r.th)(t,-1,-1,2,2,null,o);a.attr({z2:100,culling:!0,scaleX:n[0]/2,scaleY:n[1]/2}),a.drift=p,this._symbolType=t,this.add(a)},e.prototype.stopSymbolAnimation=function(t){this.childAt(0).stopAnimation(null,t)},e.prototype.getSymbolType=function(){return this._symbolType},e.prototype.getSymbolPath=function(){return this.childAt(0)},e.prototype.highlight=function(){(0,l.fD)(this.childAt(0))},e.prototype.downplay=function(){(0,l.Mh)(this.childAt(0))},e.prototype.setZ=function(t,e){var i=this.childAt(0);i.zlevel=t,i.z=e},e.prototype.setDraggable=function(t,e){var i=this.childAt(0);i.draggable=t,i.cursor=!e&&t?"move":i.cursor},e.prototype.updateData=function(t,i,n,r){this.silent=!1;var a=t.getItemVisual(i,"symbol")||"circle",s=t.hostModel,l=e.getSymbolSize(t,i),u=a!==this._symbolType,h=r&&r.disableAnimation;if(u){var c=t.getItemVisual(i,"symbolKeepAspect");this._createSymbol(a,t,i,l,c)}else{(p=this.childAt(0)).silent=!1;var d={scaleX:l[0]/2,scaleY:l[1]/2};h?p.attr(d):o.D(p,d,s,i),(0,o.Zi)(p)}if(this._updateCommon(t,i,l,n,r),u){var p=this.childAt(0);if(!h){d={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:p.style.opacity}};p.scaleX=p.scaleY=0,p.style.opacity=0,o.KZ(p,d,s,i)}}h&&this.childAt(0).stopAnimation("leave")},e.prototype._updateCommon=function(t,e,i,n,o){var a,s,p,f,g,m,v,y,_,x=this.childAt(0),b=t.hostModel;if(n&&(a=n.emphasisItemStyle,s=n.blurItemStyle,p=n.selectItemStyle,f=n.focus,g=n.blurScope,v=n.labelStatesModels,y=n.hoverScale,_=n.cursorStyle,m=n.emphasisDisabled),!n||t.hasItemOption){var w=n&&n.itemModel?n.itemModel:t.getItemModel(e),S=w.getModel("emphasis");a=S.getModel("itemStyle").getItemStyle(),p=w.getModel(["select","itemStyle"]).getItemStyle(),s=w.getModel(["blur","itemStyle"]).getItemStyle(),f=S.get("focus"),g=S.get("blurScope"),m=S.get("disabled"),v=(0,c.k3)(w),y=S.getShallow("scale"),_=w.getShallow("cursor")}var T=t.getItemVisual(e,"symbolRotate");x.attr("rotation",(T||0)*Math.PI/180||0);var M=(0,r.Cq)(t.getItemVisual(e,"symbolOffset"),i);M&&(x.x=M[0],x.y=M[1]),_&&x.attr("cursor",_);var C=t.getItemVisual(e,"style"),A=C.fill;if(x instanceof d.ZP){var L=x.style;x.useStyle((0,h.extend)({image:L.image,x:L.x,y:L.y,width:L.width,height:L.height},C))}else x.__isEmptyBrush?x.useStyle((0,h.extend)({},C)):x.useStyle(C),x.style.decal=null,x.setColor(A,o&&o.symbolInnerColor),x.style.strokeNoScale=!0;var I=t.getItemVisual(e,"liftZ"),D=this._z2;null!=I?null==D&&(this._z2=x.z2,x.z2+=I):null!=D&&(x.z2=D,this._z2=null);var P=o&&o.useNameLabel;(0,c.ni)(x,v,{labelFetcher:b,labelDataIndex:e,defaultText:function(e){return P?t.getName(e):(0,u.H)(t,e)},inheritColor:A,defaultOpacity:C.opacity}),this._sizeX=i[0]/2,this._sizeY=i[1]/2;var O=x.ensureState("emphasis");O.style=a,x.ensureState("select").style=p,x.ensureState("blur").style=s;var k=null==y||!0===y?Math.max(1.1,3/this._sizeY):isFinite(y)&&y>0?+y:1;O.scaleX=this._sizeX*k,O.scaleY=this._sizeY*k,this.setSymbolScale(1),(0,l.k5)(this,f,g,m)},e.prototype.setSymbolScale=function(t){this.scaleX=this.scaleY=t},e.prototype.fadeOut=function(t,e,i){var n=this.childAt(0),r=(0,s.A)(this).dataIndex,a=i&&i.animation;if(this.silent=n.silent=!0,i&&i.fadeLabel){var l=n.getTextContent();l&&o.bX(l,{style:{opacity:0}},e,{dataIndex:r,removeOpt:a,cb:function(){n.removeTextContent()}})}else n.removeTextContent();o.bX(n,{style:{opacity:0},scaleX:0,scaleY:0},e,{dataIndex:r,cb:t,removeOpt:a})},e.getSymbolSize=function(t,e){return(0,r.zp)(t.getItemVisual(e,"symbolSize"))},e}(a.Z)},8162:(t,e,i)=>{"use strict";i.d(e,{Z:()=>d});var n=i(2141),r=i(4292),o=i(1177),a=i(6351),s=i(8760),l=i(6006);function u(t,e,i,n){return e&&!isNaN(e[0])&&!isNaN(e[1])&&!(n.isIgnore&&n.isIgnore(i))&&!(n.clipShape&&!n.clipShape.contain(e[0],e[1]))&&"none"!==t.getItemVisual(i,"symbol")}function h(t){return null==t||(0,s.isObject)(t)||(t={isIgnore:t}),t||{}}function c(t){var e=t.hostModel,i=e.getModel("emphasis");return{emphasisItemStyle:i.getModel("itemStyle").getItemStyle(),blurItemStyle:e.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:e.getModel(["select","itemStyle"]).getItemStyle(),focus:i.get("focus"),blurScope:i.get("blurScope"),emphasisDisabled:i.get("disabled"),hoverScale:i.get("scale"),labelStatesModels:(0,l.k3)(e),cursorStyle:e.get("cursor")}}const d=function(){function t(t){this.group=new n.Z,this._SymbolCtor=t||a.Z}return t.prototype.updateData=function(t,e){this._progressiveEls=null,e=h(e);var i=this.group,n=t.hostModel,o=this._data,a=this._SymbolCtor,s=e.disableAnimation,l=c(t),d={disableAnimation:s},p=e.getSymbolPoint||function(e){return t.getItemLayout(e)};o||i.removeAll(),t.diff(o).add((function(n){var r=p(n);if(u(t,r,n,e)){var o=new a(t,n,l,d);o.setPosition(r),t.setItemGraphicEl(n,o),i.add(o)}})).update((function(h,c){var f=o.getItemGraphicEl(c),g=p(h);if(u(t,g,h,e)){var m=t.getItemVisual(h,"symbol")||"circle",v=f&&f.getSymbolType&&f.getSymbolType();if(!f||v&&v!==m)i.remove(f),(f=new a(t,h,l,d)).setPosition(g);else{f.updateData(t,h,l,d);var y={x:g[0],y:g[1]};s?f.attr(y):r.D(f,y,n)}i.add(f),t.setItemGraphicEl(h,f)}else i.remove(f)})).remove((function(t){var e=o.getItemGraphicEl(t);e&&e.fadeOut((function(){i.remove(e)}),n)})).execute(),this._getSymbolPoint=p,this._data=t},t.prototype.updateLayout=function(){var t=this,e=this._data;e&&e.eachItemGraphicEl((function(e,i){var n=t._getSymbolPoint(i);e.setPosition(n),e.markRedraw()}))},t.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=c(t),this._data=null,this.group.removeAll()},t.prototype.incrementalUpdate=function(t,e,i){function n(t){t.isGroup||(t.incremental=!0,t.ensureState("emphasis").hoverLayer=!0)}this._progressiveEls=[],i=h(i);for(var r=t.start;r{"use strict";i.d(e,{ID:()=>l,X0:()=>u,lQ:()=>h});var n=i(56),r=i(4292),o=i(1205),a=i(5669),s=i(8760);function l(t,e,i,o,a){var l=t.getArea(),u=l.x,h=l.y,c=l.width,d=l.height,p=i.get(["lineStyle","width"])||2;u-=p/2,h-=p/2,c+=p,d+=p,u=Math.floor(u),c=Math.round(c);var f=new n.Z({shape:{x:u,y:h,width:c,height:d}});if(e){var g=t.getBaseAxis(),m=g.isHorizontal(),v=g.inverse;m?(v&&(f.shape.x+=c),f.shape.width=0):(v||(f.shape.y+=d),f.shape.height=0);var y=(0,s.isFunction)(a)?function(t){a(t,f)}:null;r.KZ(f,{shape:{width:c,height:d,x:u,y:h}},i,null,o,y)}return f}function u(t,e,i){var n=t.getArea(),s=(0,a.NM)(n.r0,1),l=(0,a.NM)(n.r,1),u=new o.C({shape:{cx:(0,a.NM)(t.cx,1),cy:(0,a.NM)(t.cy,1),r0:s,r:l,startAngle:n.startAngle,endAngle:n.endAngle,clockwise:n.clockwise}});e&&("angle"===t.getBaseAxis().dim?u.shape.endAngle=n.startAngle:u.shape.r=s,r.KZ(u,{shape:{endAngle:n.endAngle,r:l}},i));return u}function h(t,e,i,n,r){return t?"polar"===t.type?u(t,e,i):"cartesian2d"===t.type?l(t,e,i,n,r):null:null}},1764:(t,e,i)=>{"use strict";i.d(e,{Z:()=>m});var n=i(8760),r=i(5101);function o(t){return"_EC_"+t}var a=function(){function t(t){this.type="graph",this.nodes=[],this.edges=[],this._nodesMap={},this._edgesMap={},this._directed=t||!1}return t.prototype.isDirected=function(){return this._directed},t.prototype.addNode=function(t,e){t=null==t?""+e:""+t;var i=this._nodesMap;if(!i[o(t)]){var n=new s(t,e);return n.hostGraph=this,this.nodes.push(n),i[o(t)]=n,n}},t.prototype.getNodeByIndex=function(t){var e=this.data.getRawIndex(t);return this.nodes[e]},t.prototype.getNodeById=function(t){return this._nodesMap[o(t)]},t.prototype.addEdge=function(t,e,i){var r=this._nodesMap,a=this._edgesMap;if(n.isNumber(t)&&(t=this.nodes[t]),n.isNumber(e)&&(e=this.nodes[e]),t instanceof s||(t=r[o(t)]),e instanceof s||(e=r[o(e)]),t&&e){var u=t.id+"-"+e.id,h=new l(t,e,i);return h.hostGraph=this,this._directed&&(t.outEdges.push(h),e.inEdges.push(h)),t.edges.push(h),t!==e&&e.edges.push(h),this.edges.push(h),a[u]=h,h}},t.prototype.getEdgeByIndex=function(t){var e=this.edgeData.getRawIndex(t);return this.edges[e]},t.prototype.getEdge=function(t,e){t instanceof s&&(t=t.id),e instanceof s&&(e=e.id);var i=this._edgesMap;return this._directed?i[t+"-"+e]:i[t+"-"+e]||i[e+"-"+t]},t.prototype.eachNode=function(t,e){for(var i=this.nodes,n=i.length,r=0;r=0&&t.call(e,i[r],r)},t.prototype.eachEdge=function(t,e){for(var i=this.edges,n=i.length,r=0;r=0&&i[r].node1.dataIndex>=0&&i[r].node2.dataIndex>=0&&t.call(e,i[r],r)},t.prototype.breadthFirstTraverse=function(t,e,i,n){if(e instanceof s||(e=this._nodesMap[o(e)]),e){for(var r="out"===i?"outEdges":"in"===i?"inEdges":"edges",a=0;a=0&&i.node2.dataIndex>=0}));for(r=0,o=n.length;r=0&&this[t][e].setItemVisual(this.dataIndex,i,n)},getVisual:function(i){return this[t][e].getItemVisual(this.dataIndex,i)},setLayout:function(i,n){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,i,n)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}}n.mixin(s,u("hostGraph","data")),n.mixin(l,u("hostGraph","edgeData"));const h=a;var c=i(9344),d=i(5623),p=i(4267),f=i(8455),g=i(2234);function m(t,e,i,o,a){for(var s=new h(o),l=0;l "+x)),v++)}var b,w=i.get("coordinateSystem");if("cartesian2d"===w||"polar"===w)b=(0,f.Z)(t,i);else{var S=p.Z.get(w),T=S&&S.dimensions||[];n.indexOf(T,"value")<0&&T.concat(["value"]);var M=(0,d.Z)(t,{coordDimensions:T,encodeDefine:i.getEncode()}).dimensions;(b=new r.Z(M,i)).initData(t)}var C=new r.Z(["value"],i);return C.initData(m,u),a&&a(b,C),(0,c.Z)({mainData:b,struct:s,structAttr:"graph",datas:{node:b,edge:C},datasAttr:{node:"data",edge:"edgeData"}}),s.update(),s}},5682:(t,e,i)=>{"use strict";i.d(e,{Z:()=>r});var n=i(2234);function r(){var t=(0,n.Yf)();return function(e){var i=t(e),n=e.pipelineContext,r=!!i.large,o=!!i.progressiveRender,a=i.large=!(!n||!n.large),s=i.progressiveRender=!(!n||!n.progressiveRender);return!(r===a&&o===s)&&"reset"}}},8455:(t,e,i)=>{"use strict";i.d(e,{Z:()=>m});var n=i(8760),r=i(5101),o=i(5623),a=i(381),s=i(2234),l=i(4267),u=function(t){this.coordSysDims=[],this.axisMap=(0,n.createHashMap)(),this.categoryAxisMap=(0,n.createHashMap)(),this.coordSysName=t};var h={cartesian2d:function(t,e,i,n){var r=t.getReferringComponents("xAxis",s.C6).models[0],o=t.getReferringComponents("yAxis",s.C6).models[0];e.coordSysDims=["x","y"],i.set("x",r),i.set("y",o),c(r)&&(n.set("x",r),e.firstCategoryDimIndex=0),c(o)&&(n.set("y",o),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,i,n){var r=t.getReferringComponents("singleAxis",s.C6).models[0];e.coordSysDims=["single"],i.set("single",r),c(r)&&(n.set("single",r),e.firstCategoryDimIndex=0)},polar:function(t,e,i,n){var r=t.getReferringComponents("polar",s.C6).models[0],o=r.findAxisModel("radiusAxis"),a=r.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],i.set("radius",o),i.set("angle",a),c(o)&&(n.set("radius",o),e.firstCategoryDimIndex=0),c(a)&&(n.set("angle",a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},geo:function(t,e,i,n){e.coordSysDims=["lng","lat"]},parallel:function(t,e,i,r){var o=t.ecModel,a=o.getComponent("parallel",t.get("parallelIndex")),s=e.coordSysDims=a.dimensions.slice();(0,n.each)(a.parallelAxisIndex,(function(t,n){var a=o.getComponent("parallelAxis",t),l=s[n];i.set(l,a),c(a)&&(r.set(l,a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=n))}))}};function c(t){return"category"===t.get("type")}var d=i(9574),p=i(9936),f=i(1772),g=i(4279);const m=function(t,e,i){i=i||{};var c,m=e.getSourceManager(),v=!1;t?(v=!0,c=(0,d.nx)(t)):v=(c=m.getSource()).sourceFormat===g.cy;var y=function(t){var e=t.get("coordinateSystem"),i=new u(e),n=h[e];if(n)return n(t,i,i.axisMap,i.categoryAxisMap),i}(e),_=function(t,e){var i,r=t.get("coordinateSystem"),o=l.Z.get(r);return e&&e.coordSysDims&&(i=n.map(e.coordSysDims,(function(t){var i={name:t},n=e.axisMap.get(t);if(n){var r=n.get("type");i.type=(0,a.T)(r)}return i}))),i||(i=o&&(o.getDimensionsInfo?o.getDimensionsInfo():o.dimensions.slice())||["x","y"]),i}(e,y),x=i.useEncodeDefaulter,b=n.isFunction(x)?x:x?n.curry(f.pY,_,e):null,w={coordDimensions:_,generateCoord:i.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:b,canOmitUnusedDimensions:!v},S=(0,o.Z)(c,w),T=function(t,e,i){var r,o;return i&&n.each(t,(function(t,n){var a=t.coordDim,s=i.categoryAxisMap.get(a);s&&(null==r&&(r=n),t.ordinalMeta=s.getOrdinalMeta(),e&&(t.createInvertedIndices=!0)),null!=t.otherDims.itemName&&(o=!0)})),o||null==r||(t[r].otherDims.itemName=0),r}(S.dimensions,i.createInvertedIndices,y),M=v?null:m.getSharedDataStore(S),C=(0,p.BM)(e,{schema:S,store:M}),A=new r.Z(S,e);A.setCalculationInfo(C);var L=null!=T&&function(t){if(t.sourceFormat===g.cy){var e=function(t){var e=0;for(;e{"use strict";i.d(e,{H:()=>o,O:()=>a});var n=i(8540),r=i(8760);function o(t,e){var i=t.mapDimensionsAll("defaultedLabel"),r=i.length;if(1===r){var o=(0,n.hk)(t,e,i[0]);return null!=o?o+"":null}if(r){for(var a=[],s=0;s=0&&n.push(e[a])}return n.join(" ")}},241:(t,e,i)=>{"use strict";i.d(e,{N:()=>B});var n=i(8299),r=i(7145),o=i(2141),a=i(9971),s=i(8760),l=i(1525),u=i(1362),h=i(7011);const c=function(t){function e(e,i,n){var r=t.call(this)||this;return r.add(r.createLine(e,i,n)),r._updateEffectSymbol(e,i),r}return(0,n.ZT)(e,t),e.prototype.createLine=function(t,e,i){return new a.Z(t,e,i)},e.prototype._updateEffectSymbol=function(t,e){var i=t.getItemModel(e).getModel("effect"),n=i.get("symbolSize"),r=i.get("symbol");s.isArray(n)||(n=[n,n]);var o=t.getItemVisual(e,"style"),a=i.get("color")||o&&o.stroke,u=this.childAt(1);this._symbolType!==r&&(this.remove(u),(u=(0,l.th)(r,-.5,-.5,1,1,a)).z2=100,u.culling=!0,this.add(u)),u&&(u.setStyle("shadowColor",a),u.setStyle(i.getItemStyle(["color"])),u.scaleX=n[0],u.scaleY=n[1],u.setColor(a),this._symbolType=r,this._symbolScale=n,this._updateEffectAnimation(t,i,e))},e.prototype._updateEffectAnimation=function(t,e,i){var n=this.childAt(1);if(n){var r=t.getItemLayout(i),o=1e3*e.get("period"),a=e.get("loop"),l=e.get("roundTrip"),u=e.get("constantSpeed"),h=s.retrieve(e.get("delay"),(function(e){return e/t.count()*o/3}));if(n.ignore=!0,this._updateAnimationPoints(n,r),u>0&&(o=this._getLineLength(n)/u*1e3),o!==this._period||a!==this._loop||l!==this._roundTrip){n.stopAnimation();var c=void 0;c=s.isFunction(h)?h(i):h,n.__t>0&&(c=-o*n.__t),this._animateSymbol(n,o,c,a,l)}this._period=o,this._loop=a,this._roundTrip=l}},e.prototype._animateSymbol=function(t,e,i,n,r){if(e>0){t.__t=0;var o=this,a=t.animate("",n).when(r?2*e:e,{__t:r?2:1}).delay(i).during((function(){o._updateSymbolPosition(t)}));n||a.done((function(){o.remove(t)})),a.start()}},e.prototype._getLineLength=function(t){return u.dist(t.__p1,t.__cp1)+u.dist(t.__cp1,t.__p2)},e.prototype._updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},e.prototype.updateData=function(t,e,i){this.childAt(0).updateData(t,e,i),this._updateEffectSymbol(t,e)},e.prototype._updateSymbolPosition=function(t){var e=t.__p1,i=t.__p2,n=t.__cp1,r=t.__t<1?t.__t:2-t.__t,o=[t.x,t.y],a=o.slice(),s=h.Zm,l=h.AZ;o[0]=s(e[0],n[0],i[0],r),o[1]=s(e[1],n[1],i[1],r);var c=t.__t<1?l(e[0],n[0],i[0],r):l(i[0],n[0],e[0],1-r),d=t.__t<1?l(e[1],n[1],i[1],r):l(i[1],n[1],e[1],1-r);t.rotation=-Math.atan2(d,c)-Math.PI/2,"line"!==this._symbolType&&"rect"!==this._symbolType&&"roundRect"!==this._symbolType||(void 0!==t.__lastT&&t.__lastT=0&&!(n[o]<=e);o--);o=Math.min(o,r-2)}else{for(o=a;oe);o++);o=Math.min(o-1,r-2)}var s=(e-n[o])/(n[o+1]-n[o]),l=i[o],u=i[o+1];t.x=l[0]*(1-s)+s*u[0],t.y=l[1]*(1-s)+s*u[1];var h=t.__t<1?u[0]-l[0]:l[0]-u[0],c=t.__t<1?u[1]-l[1]:l[1]-u[1];t.rotation=-Math.atan2(c,h)-Math.PI/2,this._lastFrame=o,this._lastFramePercent=e,t.ignore=!1}},e}(c);var y=i(641),_=i(8751),x=i(9736),b=i(5085),w=i(106),S=function(){this.polyline=!1,this.curveness=0,this.segs=[]},T=function(t){function e(e){var i=t.call(this,e)||this;return i._off=0,i.hoverDataIdx=-1,i}return(0,n.ZT)(e,t),e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new S},e.prototype.buildPath=function(t,e){var i,n=e.segs,r=e.curveness;if(e.polyline)for(i=this._off;i0){t.moveTo(n[i++],n[i++]);for(var a=1;a0){var c=(s+u)/2-(l-h)*r,d=(l+h)/2-(u-s)*r;t.quadraticCurveTo(c,d,u,h)}else t.lineTo(u,h)}this.incremental&&(this._off=i,this.notClear=!0)},e.prototype.findDataIndex=function(t,e){var i=this.shape,n=i.segs,r=i.curveness,o=this.style.lineWidth;if(i.polyline)for(var a=0,s=0;s0)for(var u=n[s++],h=n[s++],c=1;c0){var f=(u+d)/2-(h-p)*r,g=(h+p)/2-(d-u)*r;if(b.m(u,h,f,g,d,p,o,t,e))return a}else if(x.m(u,h,d,p,o,t,e))return a;a++}return-1},e.prototype.contain=function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect();return t=i[0],e=i[1],n.contain(t,e)?(this.hoverDataIdx=this.findDataIndex(t,e))>=0:(this.hoverDataIdx=-1,!1)},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var e=this.shape.segs,i=1/0,n=1/0,r=-1/0,o=-1/0,a=0;a0&&(o.dataIndex=i+t.__startIndex)}))},t.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},t}();const C={seriesType:"lines",plan:(0,i(5682).Z)(),reset:function(t){var e=t.coordinateSystem;if(e){var i=t.get("polyline"),n=t.pipelineContext.large;return{progress:function(r,o){var a=[];if(n){var s=void 0,l=r.end-r.start;if(i){for(var u=0,h=r.start;h0&&(l||s.configLayer(o,{motionBlur:!0,lastFrameAlpha:Math.max(Math.min(a/10+.9,1),0)})),r.updateData(n);var u=t.get("clip",!0)&&(0,A.lQ)(t.coordinateSystem,!1,t);u?this.group.setClipPath(u):this.group.removeClipPath(),this._lastZlevel=o,this._finished=!0},e.prototype.incrementalPrepareRender=function(t,e,i){var n=t.getData();this._updateLineDraw(n,t).incrementalPrepareUpdate(n),this._clearLayer(i),this._finished=!1},e.prototype.incrementalRender=function(t,e,i){this._lineDraw.incrementalUpdate(t,e.getData()),this._finished=t.end===e.getData().count()},e.prototype.eachRendered=function(t){this._lineDraw&&this._lineDraw.eachRendered(t)},e.prototype.updateTransform=function(t,e,i){var n=t.getData(),r=t.pipelineContext;if(!this._finished||r.large||r.progressiveRender)return{update:!0};var o=C.reset(t,e,i);o.progress&&o.progress({start:0,end:n.count(),count:n.count()},n),this._lineDraw.updateLayout(),this._clearLayer(i)},e.prototype._updateLineDraw=function(t,e){var i=this._lineDraw,n=this._showEffect(e),o=!!e.get("polyline"),s=e.pipelineContext.large;return i&&n===this._hasEffet&&o===this._isPolyline&&s===this._isLargeDraw||(i&&i.remove(),i=this._lineDraw=s?new M:new r.Z(o?n?v:m:n?c:a.Z),this._hasEffet=n,this._isPolyline=o,this._isLargeDraw=s),this.group.add(i.group),i},e.prototype._showEffect=function(t){return!!t.get(["effect","show"])},e.prototype._clearLayer=function(t){var e=t.getZr();"svg"===e.painter.getType()||null==this._lastZlevel||e.painter.getLayer(this._lastZlevel).clear(!0)},e.prototype.remove=function(t,e){this._lineDraw&&this._lineDraw.remove(),this._lineDraw=null,this._clearLayer(e)},e.prototype.dispose=function(t,e){this.remove(t,e)},e.type="lines",e}(i(5797).Z);var I=i(3321),D=i(5101),P=i(5685),O="undefined"==typeof Uint32Array?Array:Uint32Array,k="undefined"==typeof Float64Array?Array:Float64Array;function E(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=(0,s.map)(e,(function(t){var e={coords:[t[0].coord,t[1].coord]};return t[0].name&&(e.fromName=t[0].name),t[1].name&&(e.toName=t[1].name),(0,s.mergeAll)([e,t[0],t[1]])})))}const N=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.visualStyleAccessPath="lineStyle",i.visualDrawType="stroke",i}return(0,n.ZT)(e,t),e.prototype.init=function(e){e.data=e.data||[],E(e);var i=this._processFlatCoordsArray(e.data);this._flatCoords=i.flatCoords,this._flatCoordsOffset=i.flatCoordsOffset,i.flatCoords&&(e.data=new Float32Array(i.count)),t.prototype.init.apply(this,arguments)},e.prototype.mergeOption=function(e){if(E(e),e.data){var i=this._processFlatCoordsArray(e.data);this._flatCoords=i.flatCoords,this._flatCoordsOffset=i.flatCoordsOffset,i.flatCoords&&(e.data=new Float32Array(i.count))}t.prototype.mergeOption.apply(this,arguments)},e.prototype.appendData=function(t){var e=this._processFlatCoordsArray(t.data);e.flatCoords&&(this._flatCoords?(this._flatCoords=(0,s.concatArray)(this._flatCoords,e.flatCoords),this._flatCoordsOffset=(0,s.concatArray)(this._flatCoordsOffset,e.flatCoordsOffset)):(this._flatCoords=e.flatCoords,this._flatCoordsOffset=e.flatCoordsOffset),t.data=new Float32Array(e.count)),this.getRawData().appendData(t.data)},e.prototype._getCoordsFromItemModel=function(t){var e=this.getData().getItemModel(t);return e.option instanceof Array?e.option:e.getShallow("coords")},e.prototype.getLineCoordsCount=function(t){return this._flatCoordsOffset?this._flatCoordsOffset[2*t+1]:this._getCoordsFromItemModel(t).length},e.prototype.getLineCoords=function(t,e){if(this._flatCoordsOffset){for(var i=this._flatCoordsOffset[2*t],n=this._flatCoordsOffset[2*t+1],r=0;r ")})},e.prototype.preventIncremental=function(){return!!this.get(["effect","show"])},e.prototype.getProgressive=function(){var t=this.option.progressive;return null==t?this.option.large?1e4:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?2e4:this.get("progressiveThreshold"):t},e.prototype.getZLevelKey=function(){var t=this.getModel("effect"),e=t.get("trailLength");return this.getData().count()>this.getProgressiveThreshold()?this.id:t.get("show")&&e>0?e+"":""},e.type="series.lines",e.dependencies=["grid","polar","geo","calendar"],e.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}},e}(I.Z);function R(t){return t instanceof Array||(t=[t,t]),t}const z={seriesType:"lines",reset:function(t){var e=R(t.get("symbol")),i=R(t.get("symbolSize")),n=t.getData();return n.setVisual("fromSymbol",e&&e[0]),n.setVisual("toSymbol",e&&e[1]),n.setVisual("fromSymbolSize",i&&i[0]),n.setVisual("toSymbolSize",i&&i[1]),{dataEach:n.hasItemOption?function(t,e){var i=t.getItemModel(e),n=R(i.getShallow("symbol",!0)),r=R(i.getShallow("symbolSize",!0));n[0]&&t.setItemVisual(e,"fromSymbol",n[0]),n[1]&&t.setItemVisual(e,"toSymbol",n[1]),r[0]&&t.setItemVisual(e,"fromSymbolSize",r[0]),r[1]&&t.setItemVisual(e,"toSymbolSize",r[1])}:null}}};function B(t){t.registerChartView(L),t.registerSeriesModel(N),t.registerLayout(C),t.registerVisual(z)}},8608:(t,e,i)=>{"use strict";i.d(e,{Z:()=>T});var n=i(8760),r=i(2141),o=i(9067),a=i(1177),s=i(1590),l=i(106),u=i(6006),h=i(1497),c=i(5669),d=i(1525),p=i(4247),f=i(1362),g=i(7947),m=i(4162),v=Math.PI,y=function(){function t(t,e){this.group=new r.Z,this.opt=e,this.axisModel=t,(0,n.defaults)(e,{labelOffset:0,nameDirection:1,tickDirection:1,labelDirection:1,silent:!0,handleAutoShown:function(){return!0}});var i=new r.Z({x:e.position[0],y:e.position[1],rotation:e.rotation});i.updateTransform(),this._transformGroup=i}return t.prototype.hasBuilder=function(t){return!!_[t]},t.prototype.add=function(t){_[t](this.opt,this.axisModel,this.group,this._transformGroup)},t.prototype.getGroup=function(){return this.group},t.innerTextLayout=function(t,e,i){var n,r,o=(0,c.wW)(e-t);return(0,c.mW)(o)?(r=i>0?"top":"bottom",n="center"):(0,c.mW)(o-v)?(r=i>0?"bottom":"top",n="center"):(r="middle",n=o>0&&o0?"right":"left":i>0?"left":"right"),{rotation:o,textAlign:n,textVerticalAlign:r}},t.makeAxisEventDataBase=function(t){var e={componentType:t.mainType,componentIndex:t.componentIndex};return e[t.mainType+"Index"]=t.componentIndex,e},t.isLabelSilent=function(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)},t}(),_={axisLine:function(t,e,i,r){var s=e.get(["axisLine","show"]);if("auto"===s&&t.handleAutoShown&&(s=t.handleAutoShown("axisLine")),s){var l=e.axis.getExtent(),u=r.transform,h=[l[0],0],c=[l[1],0],p=h[0]>c[0];u&&((0,f.applyTransform)(h,h,u),(0,f.applyTransform)(c,c,u));var g=(0,n.extend)({lineCap:"round"},e.getModel(["axisLine","lineStyle"]).getLineStyle()),m=new o.Z({shape:{x1:h[0],y1:h[1],x2:c[0],y2:c[1]},style:g,strokeContainThreshold:t.strokeContainThreshold||5,silent:!0,z2:1});a.subPixelOptimizeLine(m.shape,m.style.lineWidth),m.anid="line",i.add(m);var v=e.get(["axisLine","symbol"]);if(null!=v){var y=e.get(["axisLine","symbolSize"]);(0,n.isString)(v)&&(v=[v,v]),((0,n.isString)(y)||(0,n.isNumber)(y))&&(y=[y,y]);var _=(0,d.Cq)(e.get(["axisLine","symbolOffset"])||0,y),x=y[0],b=y[1];(0,n.each)([{rotate:t.rotation+Math.PI/2,offset:_[0],r:0},{rotate:t.rotation-Math.PI/2,offset:_[1],r:Math.sqrt((h[0]-c[0])*(h[0]-c[0])+(h[1]-c[1])*(h[1]-c[1]))}],(function(e,n){if("none"!==v[n]&&null!=v[n]){var r=(0,d.th)(v[n],-x/2,-b/2,x,b,g.stroke,!0),o=e.r+e.offset,a=p?c:h;r.attr({rotation:e.rotate,x:a[0]+o*Math.cos(t.rotation),y:a[1]-o*Math.sin(t.rotation),silent:!0,z2:11}),i.add(r)}}))}}},axisTickLabel:function(t,e,i,r){var o=function(t,e,i,r){var o=i.axis,a=i.getModel("axisTick"),s=a.get("show");"auto"===s&&r.handleAutoShown&&(s=r.handleAutoShown("axisTick"));if(!s||o.scale.isBlank())return;for(var l=a.getModel("lineStyle"),u=r.tickDirection*a.get("length"),h=S(o.getTicksCoords(),e.transform,u,(0,n.defaults)(l.getLineStyle(),{stroke:i.get(["axisLine","lineStyle","color"])}),"ticks"),c=0;c_[1]?-1:1,b=["start"===p?_[0]-x*m:"end"===p?_[1]+x*m:(_[0]+_[1])/2,w(p)?t.labelOffset+f*m:0],S=e.get("nameRotate");null!=S&&(S=S*v/180),w(p)?h=y.innerTextLayout(t.rotation,null!=S?S:t.rotation,f):(h=function(t,e,i,n){var r,o,a=(0,c.wW)(i-t),s=n[0]>n[1],l="start"===e&&!s||"start"!==e&&s;(0,c.mW)(a-v/2)?(o=l?"bottom":"top",r="center"):(0,c.mW)(a-1.5*v)?(o=l?"top":"bottom",r="center"):(o="middle",r=a<1.5*v&&a>v/2?l?"left":"right":l?"right":"left");return{rotation:a,textAlign:r,textVerticalAlign:o}}(t.rotation,p,S||0,_),null!=(d=t.axisNameAvailableWidth)&&(d=Math.abs(d/Math.sin(h.rotation)),!isFinite(d)&&(d=null)));var T=g.getFont(),M=e.get("nameTruncate",!0)||{},C=M.ellipsis,A=(0,n.retrieve)(t.nameTruncateMaxWidth,M.maxWidth,d),L=new s.ZP({x:b[0],y:b[1],rotation:h.rotation,silent:y.isLabelSilent(e),style:(0,u.Lr)(g,{text:o,font:T,overflow:"truncate",width:A,ellipsis:C,fill:g.getTextColor()||e.get(["axisLine","lineStyle","color"]),align:g.get("align")||h.textAlign,verticalAlign:g.get("verticalAlign")||h.textVerticalAlign}),z2:1});if(a.setTooltipConfig({el:L,componentModel:e,itemName:o}),L.__fullText=o,L.anid="name",e.get("triggerEvent")){var I=y.makeAxisEventDataBase(e);I.targetType="axisName",I.name=o,(0,l.A)(L).eventData=I}r.add(L),L.updateTransform(),i.add(L),L.decomposeTransform()}}};function x(t){t&&(t.ignore=!0)}function b(t,e){var i=t&&t.getBoundingRect().clone(),n=e&&e.getBoundingRect().clone();if(i&&n){var r=p.identity([]);return p.rotate(r,r,-t.rotation),i.applyTransform(p.mul([],r,t.getLocalTransform())),n.applyTransform(p.mul([],r,e.getLocalTransform())),i.intersect(n)}}function w(t){return"middle"===t||"center"===t}function S(t,e,i,n,r){for(var s=[],l=[],u=[],h=0;h{"use strict";i.d(e,{Z:()=>s});var n=i(8299),r=i(8490),o=i(3166),a={};const s=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,n.ZT)(e,t),e.prototype.render=function(e,i,n,o){this.axisPointerClass&&r.iG(e),t.prototype.render.apply(this,arguments),this._doUpdateAxisPointerClass(e,n,!0)},e.prototype.updateAxisPointer=function(t,e,i,n){this._doUpdateAxisPointerClass(t,i,!1)},e.prototype.remove=function(t,e){var i=this._axisPointer;i&&i.remove(e)},e.prototype.dispose=function(e,i){this._disposeAxisPointer(i),t.prototype.dispose.apply(this,arguments)},e.prototype._doUpdateAxisPointerClass=function(t,i,n){var o=e.getAxisPointerClass(this.axisPointerClass);if(o){var a=r.np(t);a?(this._axisPointer||(this._axisPointer=new o)).render(t,a,i,n):this._disposeAxisPointer(i)}},e.prototype._disposeAxisPointer=function(t){this._axisPointer&&this._axisPointer.dispose(t),this._axisPointer=null},e.registerAxisPointerClass=function(t,e){a[t]=e},e.getAxisPointerClass=function(t){return t&&a[t]},e.type="axis",e}(o.Z)},7329:(t,e,i)=>{"use strict";i.d(e,{Z:()=>x});var n=i(8760),r=i(2141),o=i(1177),a=i(1590),s=i(4292),l=i(8490),u=i(9186),h=i(270),c=(0,i(2234).Yf)(),d=n.clone,p=n.bind,f=function(){function t(){this._dragging=!1,this.animationThreshold=15}return t.prototype.render=function(t,e,i,o){var a=e.get("value"),s=e.get("status");if(this._axisModel=t,this._axisPointerModel=e,this._api=i,o||this._lastValue!==a||this._lastStatus!==s){this._lastValue=a,this._lastStatus=s;var l=this._group,u=this._handle;if(!s||"hide"===s)return l&&l.hide(),void(u&&u.hide());l&&l.show(),u&&u.show();var h={};this.makeElOption(h,a,t,e,i);var c=h.graphicKey;c!==this._lastGraphicKey&&this.clear(i),this._lastGraphicKey=c;var d=this._moveAnimation=this.determineAnimation(t,e);if(l){var p=n.curry(g,e,d);this.updatePointerEl(l,h,p),this.updateLabelEl(l,h,p,e)}else l=this._group=new r.Z,this.createPointerEl(l,h,t,e),this.createLabelEl(l,h,t,e),i.getZr().add(l);_(l,e,!0),this._renderHandle(a)}},t.prototype.remove=function(t){this.clear(t)},t.prototype.dispose=function(t){this.clear(t)},t.prototype.determineAnimation=function(t,e){var i=e.get("animation"),n=t.axis,r="category"===n.type,o=e.get("snap");if(!o&&!r)return!1;if("auto"===i||null==i){var a=this.animationThreshold;if(r&&n.getBandWidth()>a)return!0;if(o){var s=l.r(t).seriesDataCount,u=n.getExtent();return Math.abs(u[0]-u[1])/s>a}return!1}return!0===i},t.prototype.makeElOption=function(t,e,i,n,r){},t.prototype.createPointerEl=function(t,e,i,n){var r=e.pointer;if(r){var a=c(t).pointerEl=new o[r.type](d(e.pointer));t.add(a)}},t.prototype.createLabelEl=function(t,e,i,n){if(e.label){var r=c(t).labelEl=new a.ZP(d(e.label));t.add(r),v(r,n)}},t.prototype.updatePointerEl=function(t,e,i){var n=c(t).pointerEl;n&&e.pointer&&(n.setStyle(e.pointer.style),i(n,{shape:e.pointer.shape}))},t.prototype.updateLabelEl=function(t,e,i,n){var r=c(t).labelEl;r&&(r.setStyle(e.label.style),i(r,{x:e.label.x,y:e.label.y}),v(r,n))},t.prototype._renderHandle=function(t){if(!this._dragging&&this.updateHandleTransform){var e,i=this._axisPointerModel,r=this._api.getZr(),a=this._handle,s=i.getModel("handle"),l=i.get("status");if(!s.get("show")||!l||"hide"===l)return a&&r.remove(a),void(this._handle=null);this._handle||(e=!0,a=this._handle=o.createIcon(s.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){u.sT(t.event)},onmousedown:p(this._onHandleDragMove,this,0,0),drift:p(this._onHandleDragMove,this),ondragend:p(this._onHandleDragEnd,this)}),r.add(a)),_(a,i,!1),a.setStyle(s.getItemStyle(null,["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"]));var c=s.get("size");n.isArray(c)||(c=[c,c]),a.scaleX=c[0]/2,a.scaleY=c[1]/2,h.T9(this,"_doDispatchAxisPointer",s.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,e)}},t.prototype._moveHandleToValue=function(t,e){g(this._axisPointerModel,!e&&this._moveAnimation,this._handle,y(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},t.prototype._onHandleDragMove=function(t,e){var i=this._handle;if(i){this._dragging=!0;var n=this.updateHandleTransform(y(i),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(y(n)),c(i).lastProp=null,this._doDispatchAxisPointer()}},t.prototype._doDispatchAxisPointer=function(){if(this._handle){var t=this._payloadInfo,e=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:e.axis.dim,axisIndex:e.componentIndex}]})}},t.prototype._onHandleDragEnd=function(){if(this._dragging=!1,this._handle){var t=this._axisPointerModel.get("value");this._moveHandleToValue(t),this._api.dispatchAction({type:"hideTip"})}},t.prototype.clear=function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),i=this._group,n=this._handle;e&&i&&(this._lastGraphicKey=null,i&&e.remove(i),n&&e.remove(n),this._group=null,this._handle=null,this._payloadInfo=null),h.ZH(this,"_doDispatchAxisPointer")},t.prototype.doClear=function(){},t.prototype.buildLabel=function(t,e,i){return{x:t[i=i||0],y:t[1-i],width:e[i],height:e[1-i]}},t}();function g(t,e,i,n){m(c(i).lastProp,n)||(c(i).lastProp=n,e?s.D(i,n,t):(i.stopAnimation(),i.attr(n)))}function m(t,e){if(n.isObject(t)&&n.isObject(e)){var i=!0;return n.each(e,(function(e,n){i=i&&m(t[n],e)})),!!i}return t===e}function v(t,e){t[e.get(["label","show"])?"show":"hide"]()}function y(t){return{x:t.x||0,y:t.y||0,rotation:t.rotation||0}}function _(t,e,i){var n=e.get("z"),r=e.get("zlevel");t&&t.traverse((function(t){"group"!==t.type&&(null!=n&&(t.z=n),null!=r&&(t.zlevel=r),t.silent=i)}))}const x=f},2448:(t,e,i)=>{"use strict";i.d(e,{Z:()=>o});var n=i(8760),r=i(2234);function o(t,e){var i,o=[],a=t.seriesIndex;if(null==a||!(i=e.getSeriesByIndex(a)))return{point:[]};var s=i.getData(),l=r.gO(s,t);if(null==l||l<0||n.isArray(l))return{point:[]};var u=s.getItemGraphicEl(l),h=i.coordinateSystem;if(i.getTooltipPosition)o=i.getTooltipPosition(l)||[];else if(h&&h.dataToPoint)if(t.isStacked){var c=h.getBaseAxis(),d=h.getOtherAxis(c).dim,p=c.dim,f="x"===d||"radius"===d?1:0,g=s.mapDimension(p),m=[];m[f]=s.get(g,l),m[1-f]=s.get(s.getCalculationInfo("stackResultDimension"),l),o=h.dataToPoint(m)||[]}else o=h.dataToPoint(s.getValues(n.map(h.dimensions,(function(t){return s.mapDimension(t)})),l))||[];else if(u){var v=u.getBoundingRect().clone();v.applyTransform(u.transform),o=[v.x+v.width/2,v.y+v.height/2]}return{point:o,el:u}}},6996:(t,e,i)=>{"use strict";i.d(e,{E:()=>h,z:()=>s});var n=i(8760),r=i(7153),o=(0,i(2234).Yf)(),a=n.each;function s(t,e,i){if(!r.Z.node){var s=e.getZr();o(s).records||(o(s).records={}),function(t,e){if(o(t).initialized)return;function i(i,n){t.on(i,(function(i){var r=function(t){var e={showTip:[],hideTip:[]},i=function(n){var r=e[n.type];r?r.push(n):(n.dispatchAction=i,t.dispatchAction(n))};return{dispatchAction:i,pendings:e}}(e);a(o(t).records,(function(t){t&&n(t,i,r.dispatchAction)})),function(t,e){var i,n=t.showTip.length,r=t.hideTip.length;n?i=t.showTip[n-1]:r&&(i=t.hideTip[r-1]);i&&(i.dispatchAction=null,e.dispatchAction(i))}(r.pendings,e)}))}o(t).initialized=!0,i("click",n.curry(u,"click")),i("mousemove",n.curry(u,"mousemove")),i("globalout",l)}(s,e),(o(s).records[t]||(o(s).records[t]={})).handler=i}}function l(t,e,i){t.handler("leave",null,i)}function u(t,e,i,n){e.handler(t,i,n)}function h(t,e){if(!r.Z.node){var i=e.getZr();(o(i).records||{})[t]&&(o(i).records[t]=null)}}},7037:(t,e,i)=>{"use strict";i.d(e,{N:()=>A});var n=i(1726),r=i(8299),o=i(7329),a=i(5539),s=i(9069),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,r.ZT)(e,t),e.prototype.makeElOption=function(t,e,i,n,r){var o=i.axis,l=o.grid,c=n.get("type"),d=u(l,o).getOtherAxis(o).getGlobalExtent(),p=o.toGlobalCoord(o.dataToCoord(e,!0));if(c&&"none"!==c){var f=a.fk(n),g=h[c](o,p,d);g.style=f,t.graphicKey=g.type,t.pointer=g}var m=s.bK(l.model,i);a.gf(e,t,m,i,n,r)},e.prototype.getHandleTransform=function(t,e,i){var n=s.bK(e.axis.grid.model,e,{labelInside:!1});n.labelMargin=i.get(["handle","margin"]);var r=a.Zh(e.axis,t,n);return{x:r[0],y:r[1],rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},e.prototype.updateHandleTransform=function(t,e,i,n){var r=i.axis,o=r.grid,a=r.getGlobalExtent(!0),s=u(o,r).getOtherAxis(r).getGlobalExtent(),l="x"===r.dim?0:1,h=[t.x,t.y];h[l]+=e[l],h[l]=Math.min(a[1],h[l]),h[l]=Math.max(a[0],h[l]);var c=(s[1]+s[0])/2,d=[c,c];d[l]=h[l];return{x:h[0],y:h[1],rotation:t.rotation,cursorPoint:d,tooltipOption:[{verticalAlign:"middle"},{align:"center"}][l]}},e}(o.Z);function u(t,e){var i={};return i[e.dim+"AxisIndex"]=e.index,t.getCartesian(i)}var h={line:function(t,e,i){return{type:"Line",subPixelOptimize:!0,shape:a.BL([e,i[0]],[e,i[1]],c(t))}},shadow:function(t,e,i){var n=Math.max(1,t.getBandWidth()),r=i[1]-i[0];return{type:"Rect",shape:a.uE([e-n/2,i[0]],[n,r],c(t))}}};function c(t){return"x"===t.dim?0:1}const d=l;const p=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,r.ZT)(e,t),e.type="axisPointer",e.defaultOption={show:"auto",z:50,type:"line",snap:!1,triggerTooltip:!0,value:null,status:null,link:[],animation:null,animationDurationUpdate:200,lineStyle:{color:"#B9BEC9",width:1,type:"dashed"},shadowStyle:{color:"rgba(210,219,238,0.2)"},label:{show:!0,formatter:null,precision:"auto",margin:3,color:"#fff",padding:[5,7,5,7],backgroundColor:"auto",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:"#333",shadowBlur:3,shadowColor:"#aaa",shadowOffsetX:0,shadowOffsetY:2,throttle:40}},e}(i(8071).Z);var f=i(6996);const g=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,r.ZT)(e,t),e.prototype.render=function(t,e,i){var n=e.getComponent("tooltip"),r=t.get("triggerOn")||n&&n.get("triggerOn")||"mousemove|click";f.z("axisPointer",i,(function(t,e,i){"none"!==r&&("leave"===t||r.indexOf(t)>=0)&&i({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})}))},e.prototype.remove=function(t,e){f.E("axisPointer",e)},e.prototype.dispose=function(t,e){f.E("axisPointer",e)},e.type="axisPointer",e}(i(3166).Z);var m=i(8760),v=i(8490),y=i(2234),_=i(2448),x=(0,y.Yf)();function b(t,e,i){var n=t.currTrigger,r=[t.x,t.y],o=t,a=t.dispatchAction||(0,m.bind)(i.dispatchAction,i),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){C(r)&&(r=(0,_.Z)({seriesIndex:o.seriesIndex,dataIndex:o.dataIndex},e).point);var l=C(r),u=o.axesInfo,h=s.axesInfo,c="leave"===n||C(r),d={},p={},f={list:[],map:{}},g={showPointer:(0,m.curry)(S,p),showTooltip:(0,m.curry)(T,f)};(0,m.each)(s.coordSysMap,(function(t,e){var i=l||t.containPoint(r);(0,m.each)(s.coordSysAxesInfo[e],(function(t,e){var n=t.axis,o=function(t,e){for(var i=0;i<(t||[]).length;i++){var n=t[i];if(e.axis.dim===n.axisDim&&e.axis.model.componentIndex===n.axisIndex)return n}}(u,t);if(!c&&i&&(!u||o)){var a=o&&o.value;null!=a||l||(a=n.pointToData(r)),null!=a&&w(t,a,g,!1,d)}}))}));var v={};return(0,m.each)(h,(function(t,e){var i=t.linkGroup;i&&!p[e]&&(0,m.each)(i.axesInfo,(function(e,n){var r=p[n];if(e!==t&&r){var o=r.value;i.mapper&&(o=t.axis.scale.parse(i.mapper(o,M(e),M(t)))),v[t.key]=o}}))})),(0,m.each)(v,(function(t,e){w(h[e],t,g,!0,d)})),function(t,e,i){var n=i.axesInfo=[];(0,m.each)(e,(function(e,i){var r=e.axisPointerModel.option,o=t[i];o?(!e.useHandle&&(r.status="show"),r.value=o.value,r.seriesDataIndices=(o.payloadBatch||[]).slice()):!e.useHandle&&(r.status="hide"),"show"===r.status&&n.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:r.value})}))}(p,h,d),function(t,e,i,n){if(C(e)||!t.list.length)return void n({type:"hideTip"});var r=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:i.tooltipOption,position:i.position,dataIndexInside:r.dataIndexInside,dataIndex:r.dataIndex,seriesIndex:r.seriesIndex,dataByCoordSys:t.list})}(f,r,t,a),function(t,e,i){var n=i.getZr(),r="axisPointerLastHighlights",o=x(n)[r]||{},a=x(n)[r]={};(0,m.each)(t,(function(t,e){var i=t.axisPointerModel.option;"show"===i.status&&(0,m.each)(i.seriesDataIndices,(function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t}))}));var s=[],l=[];(0,m.each)(o,(function(t,e){!a[e]&&l.push(t)})),(0,m.each)(a,(function(t,e){!o[e]&&s.push(t)})),l.length&&i.dispatchAction({type:"downplay",escapeConnect:!0,notBlur:!0,batch:l}),s.length&&i.dispatchAction({type:"highlight",escapeConnect:!0,notBlur:!0,batch:s})}(h,0,i),d}}function w(t,e,i,n,r){var o=t.axis;if(!o.scale.isBlank()&&o.containData(e))if(t.involveSeries){var a=function(t,e){var i=e.axis,n=i.dim,r=t,o=[],a=Number.MAX_VALUE,s=-1;return(0,m.each)(e.seriesModels,(function(e,l){var u,h,c=e.getData().mapDimensionsAll(n);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,i);h=d.dataIndices,u=d.nestestValue}else{if(!(h=e.getData().indicesOfNearest(c[0],t,"category"===i.type?.5:null)).length)return;u=e.getData().get(c[0],h[0])}if(null!=u&&isFinite(u)){var p=t-u,f=Math.abs(p);f<=a&&((f=0&&s<0)&&(a=f,s=p,r=u,o.length=0),(0,m.each)(h,(function(t){o.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})})))}})),{payloadBatch:o,snapToValue:r}}(e,t),s=a.payloadBatch,l=a.snapToValue;s[0]&&null==r.seriesIndex&&(0,m.extend)(r,s[0]),!n&&t.snap&&o.containData(l)&&null!=l&&(e=l),i.showPointer(t,e,s),i.showTooltip(t,a,l)}else i.showPointer(t,e)}function S(t,e,i,n){t[e.key]={value:i,payloadBatch:n}}function T(t,e,i,n){var r=i.payloadBatch,o=e.axis,a=o.model,s=e.axisPointerModel;if(e.triggerTooltip&&r.length){var l=e.coordSys.model,u=v.zm(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:o.dim,axisIndex:a.componentIndex,axisType:a.type,axisId:a.id,value:n,valueLabelOpt:{precision:s.get(["label","precision"]),formatter:s.get(["label","formatter"])},seriesDataIndices:r.slice()})}}function M(t){var e=t.axis.model,i={},n=i.axisDim=t.axis.dim;return i.axisIndex=i[n+"AxisIndex"]=e.componentIndex,i.axisName=i[n+"AxisName"]=e.name,i.axisId=i[n+"AxisId"]=e.id,i}function C(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function A(t){n.Z.registerAxisPointerClass("CartesianAxisPointer",d),t.registerComponentModel(p),t.registerComponentView(g),t.registerPreprocessor((function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!(0,m.isArray)(e)&&(t.axisPointer.link=[e])}})),t.registerProcessor(t.PRIORITY.PROCESSOR.STATISTIC,(function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=(0,v.KM)(t,e)})),t.registerAction({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},b)}},8490:(t,e,i)=>{"use strict";i.d(e,{KM:()=>o,iG:()=>s,np:()=>u,r:()=>l,zm:()=>c});var n=i(1497),r=i(8760);function o(t,e){var i={axesInfo:{},seriesInvolved:!1,coordSysAxesInfo:{},coordSysMap:{}};return function(t,e,i){var o=e.getComponent("tooltip"),s=e.getComponent("axisPointer"),l=s.get("link",!0)||[],u=[];(0,r.each)(i.getCoordinateSystems(),(function(i){if(i.axisPointerEnabled){var d=c(i.model),p=t.coordSysAxesInfo[d]={};t.coordSysMap[d]=i;var f=i.model.getModel("tooltip",o);if((0,r.each)(i.getAxes(),(0,r.curry)(y,!1,null)),i.getTooltipAxes&&o&&f.get("show")){var g="axis"===f.get("trigger"),m="cross"===f.get(["axisPointer","type"]),v=i.getTooltipAxes(f.get(["axisPointer","axis"]));(g||m)&&(0,r.each)(v.baseAxes,(0,r.curry)(y,!m||"cross",g)),m&&(0,r.each)(v.otherAxes,(0,r.curry)(y,"cross",!1))}}function y(o,d,g){var m=g.model.getModel("axisPointer",s),v=m.get("show");if(v&&("auto"!==v||o||h(m))){null==d&&(d=m.get("triggerTooltip")),m=o?function(t,e,i,o,a,s){var l=e.getModel("axisPointer"),u=["type","snap","lineStyle","shadowStyle","label","animation","animationDurationUpdate","animationEasingUpdate","z"],h={};(0,r.each)(u,(function(t){h[t]=(0,r.clone)(l.get(t))})),h.snap="category"!==t.type&&!!s,"cross"===l.get("type")&&(h.type="line");var c=h.label||(h.label={});if(null==c.show&&(c.show=!1),"cross"===a){var d=l.get(["label","show"]);if(c.show=null==d||d,!s){var p=h.lineStyle=l.get("crossStyle");p&&(0,r.defaults)(c,p.textStyle)}}return t.model.getModel("axisPointer",new n.Z(h,i,o))}(g,f,s,e,o,d):m;var y=m.get("snap"),_=c(g.model),x=d||y||"category"===g.type,b=t.axesInfo[_]={key:_,axis:g,coordSys:i,axisPointerModel:m,triggerTooltip:d,involveSeries:x,snap:y,useHandle:h(m),seriesModels:[],linkGroup:null};p[_]=b,t.seriesInvolved=t.seriesInvolved||x;var w=function(t,e){for(var i=e.model,n=e.dim,r=0;r=0||t===e}function s(t){var e=l(t);if(e){var i=e.axisPointerModel,n=e.axis.scale,r=i.option,o=i.get("status"),a=i.get("value");null!=a&&(a=n.parse(a));var s=h(i);null==o&&(r.status=s?"show":"hide");var u=n.getExtent().slice();u[0]>u[1]&&u.reverse(),(null==a||a>u[1])&&(a=u[1]),a{"use strict";i.d(e,{$_:()=>d,BL:()=>m,Rj:()=>y,Zh:()=>f,fk:()=>c,gf:()=>g,gk:()=>p,uE:()=>v});var n=i(8760),r=i(1177),o=i(9979),a=i(8988),s=i(4247),l=i(7947),u=i(8608),h=i(6006);function c(t){var e,i=t.get("type"),n=t.getModel(i+"Style");return"line"===i?(e=n.getLineStyle()).fill=null:"shadow"===i&&((e=n.getAreaStyle()).stroke=null),e}function d(t,e,i,n,r){var s=p(i.get("value"),e.axis,e.ecModel,i.get("seriesDataIndices"),{precision:i.get(["label","precision"]),formatter:i.get(["label","formatter"])}),l=i.getModel("label"),u=a.MY(l.get("padding")||0),c=l.getFont(),d=o.lP(s,c),f=r.position,g=d.width+u[1]+u[3],m=d.height+u[0]+u[2],v=r.align;"right"===v&&(f[0]-=g),"center"===v&&(f[0]-=g/2);var y=r.verticalAlign;"bottom"===y&&(f[1]-=m),"middle"===y&&(f[1]-=m/2),function(t,e,i,n){var r=n.getWidth(),o=n.getHeight();t[0]=Math.min(t[0]+e,r)-e,t[1]=Math.min(t[1]+i,o)-i,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}(f,g,m,n);var _=l.get("backgroundColor");_&&"auto"!==_||(_=e.get(["axisLine","lineStyle","color"])),t.label={x:f[0],y:f[1],style:(0,h.Lr)(l,{text:s,font:c,fill:l.getTextColor(),padding:u,backgroundColor:_}),z2:10}}function p(t,e,i,r,o){t=e.scale.parse(t);var a=e.scale.getLabel({value:t},{precision:o.precision}),s=o.formatter;if(s){var u={value:l.DX(e,{value:t}),axisDimension:e.dim,axisIndex:e.index,seriesData:[]};n.each(r,(function(t){var e=i.getSeriesByIndex(t.seriesIndex),n=t.dataIndexInside,r=e&&e.getDataParams(n);r&&u.seriesData.push(r)})),n.isString(s)?a=s.replace("{value}",a):n.isFunction(s)&&(a=s(u))}return a}function f(t,e,i){var n=s.create();return s.rotate(n,n,i.rotation),s.translate(n,n,i.position),r.applyTransform([t.dataToCoord(e),(i.labelOffset||0)+(i.labelDirection||1)*(i.labelMargin||0)],n)}function g(t,e,i,n,r,o){var a=u.Z.innerTextLayout(i.rotation,0,i.labelDirection);i.labelMargin=r.get(["label","margin"]),d(e,n,r,o,{position:f(n.axis,t,i),align:a.textAlign,verticalAlign:a.textVerticalAlign})}function m(t,e,i){return{x1:t[i=i||0],y1:t[1-i],x2:e[i],y2:e[1-i]}}function v(t,e,i){return{x:t[i=i||0],y:t[1-i],width:e[i],height:e[1-i]}}function y(t,e,i,n,r,o){return{cx:t,cy:e,r0:i,r:n,startAngle:r,endAngle:o,clockwise:!0}}},2719:(t,e,i)=>{"use strict";i.d(e,{Z:()=>h});var n=i(8299),r=i(8760),o=i(8071),a=i(6398),s=i(2234),l=function(){function t(){this.indexList=[],this.indexMap=[]}return t.prototype.add=function(t){this.indexMap[t]||(this.indexList.push(t),this.indexMap[t]=!0)},t}();function u(t){var e={};return(0,r.each)(["start","end","startValue","endValue","throttle"],(function(i){t.hasOwnProperty(i)&&(e[i]=t[i])})),e}const h=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i._autoThrottle=!0,i._noTarget=!0,i._rangePropMode=["percent","percent"],i}return(0,n.ZT)(e,t),e.prototype.init=function(t,e,i){var n=u(t);this.settledOption=n,this.mergeDefaultAndTheme(t,i),this._doInit(n)},e.prototype.mergeOption=function(t){var e=u(t);(0,r.merge)(this.option,t,!0),(0,r.merge)(this.settledOption,e,!0),this._doInit(e)},e.prototype._doInit=function(t){var e=this.option;this._setDefaultThrottle(t),this._updateRangeUse(t);var i=this.settledOption;(0,r.each)([["start","startValue"],["end","endValue"]],(function(t,n){"value"===this._rangePropMode[n]&&(e[t[0]]=i[t[0]]=null)}),this),this._resetTarget()},e.prototype._resetTarget=function(){var t=this.get("orient",!0),e=this._targetAxisInfoMap=(0,r.createHashMap)();this._fillSpecifiedTargetAxis(e)?this._orient=t||this._makeAutoOrientByTargetAxis():(this._orient=t||"horizontal",this._fillAutoTargetAxisByOrient(e,this._orient)),this._noTarget=!0,e.each((function(t){t.indexList.length&&(this._noTarget=!1)}),this)},e.prototype._fillSpecifiedTargetAxis=function(t){var e=!1;return(0,r.each)(a.I,(function(i){var n=this.getReferringComponents((0,a.jQ)(i),s.iP);if(n.specified){e=!0;var o=new l;(0,r.each)(n.models,(function(t){o.add(t.componentIndex)})),t.set(i,o)}}),this),e},e.prototype._fillAutoTargetAxisByOrient=function(t,e){var i=this.ecModel,n=!0;if(n){var o="vertical"===e?"y":"x";u(i.findComponents({mainType:o+"Axis"}),o)}n&&u(i.findComponents({mainType:"singleAxis",filter:function(t){return t.get("orient",!0)===e}}),"single");function u(e,i){var o=e[0];if(o){var a=new l;if(a.add(o.componentIndex),t.set(i,a),n=!1,"x"===i||"y"===i){var u=o.getReferringComponents("grid",s.C6).models[0];u&&(0,r.each)(e,(function(t){o.componentIndex!==t.componentIndex&&u===t.getReferringComponents("grid",s.C6).models[0]&&a.add(t.componentIndex)}))}}}n&&(0,r.each)(a.I,(function(e){if(n){var r=i.findComponents({mainType:(0,a.jQ)(e),filter:function(t){return"category"===t.get("type",!0)}});if(r[0]){var o=new l;o.add(r[0].componentIndex),t.set(e,o),n=!1}}}),this)},e.prototype._makeAutoOrientByTargetAxis=function(){var t;return this.eachTargetAxis((function(e){!t&&(t=e)}),this),"y"===t?"vertical":"horizontal"},e.prototype._setDefaultThrottle=function(t){if(t.hasOwnProperty("throttle")&&(this._autoThrottle=!1),this._autoThrottle){var e=this.ecModel.option;this.option.throttle=e.animation&&e.animationDurationUpdate>0?100:20}},e.prototype._updateRangeUse=function(t){var e=this._rangePropMode,i=this.get("rangeMode");(0,r.each)([["start","startValue"],["end","endValue"]],(function(n,r){var o=null!=t[n[0]],a=null!=t[n[1]];o&&!a?e[r]="percent":!o&&a?e[r]="value":i?e[r]=i[r]:o&&(e[r]="percent")}))},e.prototype.noTarget=function(){return this._noTarget},e.prototype.getFirstTargetAxisModel=function(){var t;return this.eachTargetAxis((function(e,i){null==t&&(t=this.ecModel.getComponent((0,a.jQ)(e),i))}),this),t},e.prototype.eachTargetAxis=function(t,e){this._targetAxisInfoMap.each((function(i,n){(0,r.each)(i.indexList,(function(i){t.call(e,n,i)}))}))},e.prototype.getAxisProxy=function(t,e){var i=this.getAxisModel(t,e);if(i)return i.__dzAxisProxy},e.prototype.getAxisModel=function(t,e){var i=this._targetAxisInfoMap.get(t);if(i&&i.indexMap[e])return this.ecModel.getComponent((0,a.jQ)(t),e)},e.prototype.setRawRange=function(t){var e=this.option,i=this.settledOption;(0,r.each)([["start","startValue"],["end","endValue"]],(function(n){null==t[n[0]]&&null==t[n[1]]||(e[n[0]]=i[n[0]]=t[n[0]],e[n[1]]=i[n[1]]=t[n[1]])}),this),this._updateRangeUse(t)},e.prototype.setCalculatedRange=function(t){var e=this.option;(0,r.each)(["start","startValue","end","endValue"],(function(i){e[i]=t[i]}))},e.prototype.getPercentRange=function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},e.prototype.getValueRange=function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var i=this.findRepresentativeAxisProxy();return i?i.getDataValueWindow():void 0},e.prototype.findRepresentativeAxisProxy=function(t){if(t)return t.__dzAxisProxy;for(var e,i=this._targetAxisInfoMap.keys(),n=0;n{"use strict";i.d(e,{Z:()=>r});var n=i(8299);const r=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,n.ZT)(e,t),e.prototype.render=function(t,e,i,n){this.dataZoomModel=t,this.ecModel=e,this.api=i},e.type="dataZoom",e}(i(3166).Z)},6398:(t,e,i)=>{"use strict";i.d(e,{BL:()=>l,I:()=>r,jQ:()=>s,kc:()=>a,rg:()=>u});var n=i(8760),r=["x","y","radius","angle","single"],o=["cartesian2d","polar","singleAxis"];function a(t){var e=t.get("coordinateSystem");return(0,n.indexOf)(o,e)>=0}function s(t){return t+"Axis"}function l(t,e){var i,r=(0,n.createHashMap)(),o=[],a=(0,n.createHashMap)();t.eachComponent({mainType:"dataZoom",query:e},(function(t){a.get(t.uid)||l(t)}));do{i=!1,t.eachComponent("dataZoom",s)}while(i);function s(t){!a.get(t.uid)&&function(t){var e=!1;return t.eachTargetAxis((function(t,i){var n=r.get(t);n&&n[i]&&(e=!0)})),e}(t)&&(l(t),i=!0)}function l(t){a.set(t.uid,!0),o.push(t),t.eachTargetAxis((function(t,e){(r.get(t)||r.set(t,[]))[e]=!0}))}return o}function u(t){var e=t.ecModel,i={infoList:[],infoMap:(0,n.createHashMap)()};return t.eachTargetAxis((function(t,n){var r=e.getComponent(s(t),n);if(r){var o=r.getCoordSysModel();if(o){var a=o.uid,l=i.infoMap.get(a);l||(l={model:o,axisModels:[]},i.infoList.push(l),i.infoMap.set(a,l)),l.axisModels.push(r)}}})),i}},7543:(t,e,i)=>{"use strict";i.d(e,{Z:()=>g});var n=i(8760),r=i(6398),o=i(5669),a=i(9233),s=i(7947),l=i(8986),u=i(2234),h=n.each,c=o.dt;const d=function(){function t(t,e,i,n){this._dimName=t,this._axisIndex=e,this.ecModel=n,this._dataZoomModel=i}return t.prototype.hostedBy=function(t){return this._dataZoomModel===t},t.prototype.getDataValueWindow=function(){return this._valueWindow.slice()},t.prototype.getDataPercentWindow=function(){return this._percentWindow.slice()},t.prototype.getTargetSeriesModels=function(){var t=[];return this.ecModel.eachSeries((function(e){if((0,r.kc)(e)){var i=(0,r.jQ)(this._dimName),n=e.getReferringComponents(i,u.C6).models[0];n&&this._axisIndex===n.componentIndex&&t.push(e)}}),this),t},t.prototype.getAxisModel=function(){return this.ecModel.getComponent(this._dimName+"Axis",this._axisIndex)},t.prototype.getMinMaxSpan=function(){return n.clone(this._minMaxSpan)},t.prototype.calculateDataWindow=function(t){var e,i=this._dataExtent,n=this.getAxisModel().axis.scale,r=this._dataZoomModel.getRangePropMode(),s=[0,100],l=[],u=[];h(["start","end"],(function(a,h){var c=t[a],d=t[a+"Value"];"percent"===r[h]?(null==c&&(c=s[h]),d=n.parse(o.NU(c,s,i))):(e=!0,d=null==d?i[h]:n.parse(d),c=o.NU(d,i,s)),u[h]=d,l[h]=c})),c(u),c(l);var d=this._minMaxSpan;function p(t,e,i,r,s){var l=s?"Span":"ValueSpan";(0,a.Z)(0,t,i,"all",d["min"+l],d["max"+l]);for(var u=0;u<2;u++)e[u]=o.NU(t[u],i,r,!0),s&&(e[u]=n.parse(e[u]))}return e?p(u,l,i,s,!1):p(l,u,s,i,!0),{valueWindow:u,percentWindow:l}},t.prototype.reset=function(t){if(t===this._dataZoomModel){var e=this.getTargetSeriesModels();this._dataExtent=function(t,e,i){var n=[1/0,-1/0];h(i,(function(t){(0,s.AH)(n,t.getData(),e)}));var r=t.getAxisModel(),o=(0,l.Qw)(r.axis.scale,r,n).calculate();return[o.min,o.max]}(this,this._dimName,e),this._updateMinMaxSpan();var i=this.calculateDataWindow(t.settledOption);this._valueWindow=i.valueWindow,this._percentWindow=i.percentWindow,this._setAxisModel()}},t.prototype.filterData=function(t,e){if(t===this._dataZoomModel){var i=this._dimName,r=this.getTargetSeriesModels(),o=t.get("filterMode"),a=this._valueWindow;"none"!==o&&h(r,(function(t){var e=t.getData(),r=e.mapDimensionsAll(i);if(r.length){if("weakFilter"===o){var s=e.getStore(),l=n.map(r,(function(t){return e.getDimensionIndex(t)}),e);e.filterSelf((function(t){for(var e,i,n,o=0;oa[1];if(h&&!c&&!d)return!0;h&&(n=!0),c&&(e=!0),d&&(i=!0)}return n&&e&&i}))}else h(r,(function(i){if("empty"===o)t.setData(e=e.map(i,(function(t){return function(t){return t>=a[0]&&t<=a[1]}(t)?t:NaN})));else{var n={};n[i]=a,e.selectRange(n)}}));h(r,(function(t){e.setApproximateExtent(a,t)}))}}))}},t.prototype._updateMinMaxSpan=function(){var t=this._minMaxSpan={},e=this._dataZoomModel,i=this._dataExtent;h(["min","max"],(function(n){var r=e.get(n+"Span"),a=e.get(n+"ValueSpan");null!=a&&(a=this.getAxisModel().axis.scale.parse(a)),null!=a?r=o.NU(i[0]+a,i,[0,100],!0):null!=r&&(a=o.NU(r,[0,100],i,!0)-i[0]),t[n+"Span"]=r,t[n+"ValueSpan"]=a}),this)},t.prototype._setAxisModel=function(){var t=this.getAxisModel(),e=this._percentWindow,i=this._valueWindow;if(e){var n=o.M9(i,[0,500]);n=Math.min(n,20);var r=t.axis.scale.rawExtentInfo;0!==e[0]&&r.setDeterminedMinMax("min",+i[0].toFixed(n)),100!==e[1]&&r.setDeterminedMinMax("max",+i[1].toFixed(n)),r.freeze()}},t}();const p={getTargetSeries:function(t){function e(e){t.eachComponent("dataZoom",(function(i){i.eachTargetAxis((function(n,o){var a=t.getComponent((0,r.jQ)(n),o);e(n,o,a,i)}))}))}e((function(t,e,i,n){i.__dzAxisProxy=null}));var i=[];e((function(e,n,r,o){r.__dzAxisProxy||(r.__dzAxisProxy=new d(e,n,o,t),i.push(r.__dzAxisProxy))}));var o=(0,n.createHashMap)();return(0,n.each)(i,(function(t){(0,n.each)(t.getTargetSeriesModels(),(function(t){o.set(t.uid,t)}))})),o},overallReset:function(t,e){t.eachComponent("dataZoom",(function(t){t.eachTargetAxis((function(e,i){t.getAxisProxy(e,i).reset(t)})),t.eachTargetAxis((function(i,n){t.getAxisProxy(i,n).filterData(t,e)}))})),t.eachComponent("dataZoom",(function(t){var e=t.findRepresentativeAxisProxy();if(e){var i=e.getDataPercentWindow(),n=e.getDataValueWindow();t.setCalculatedRange({start:i[0],end:i[1],startValue:n[0],endValue:n[1]})}}))}};var f=!1;function g(t){f||(f=!0,t.registerProcessor(t.PRIORITY.PROCESSOR.FILTER,p),function(t){t.registerAction("dataZoom",(function(t,e){var i=(0,r.BL)(e,t);(0,n.each)(i,(function(e){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})}))}))}(t),t.registerSubTypeDefaulter("dataZoom",(function(){return"slider"})))}},7240:(t,e,i)=>{"use strict";i.d(e,{N:()=>h});var n=i(8299),r=i(8071),o=i(3166),a=i(4279),s=i(6437),l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="dataset",e}return(0,n.ZT)(e,t),e.prototype.init=function(e,i,n){t.prototype.init.call(this,e,i,n),this._sourceManager=new s.U(this),(0,s.t)(this)},e.prototype.mergeOption=function(e,i){t.prototype.mergeOption.call(this,e,i),(0,s.t)(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:a.fY},e}(r.Z),u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="dataset",e}return(0,n.ZT)(e,t),e.type="dataset",e}(o.Z);function h(t){t.registerComponentModel(l),t.registerComponentView(u)}},3448:(t,e,i)=>{"use strict";i.d(e,{Z:()=>$});var n=i(8299),r=i(8760),o=i(1935),a=i(2141),s=i(56),l=i(1177),u=i(7267),h=i(6283),c=i(582),d=i(4130),p=!0,f=Math.min,g=Math.max,m=Math.pow,v="globalPan",y={w:[0,0],e:[0,1],n:[1,0],s:[1,1]},_={w:"ew",e:"ew",n:"ns",s:"ns",ne:"nesw",sw:"nesw",nw:"nwse",se:"nwse"},x={brushStyle:{lineWidth:2,stroke:"rgba(210,219,238,0.3)",fill:"#D2DBEE"},transformable:!0,brushMode:"single",removeOnClick:!1},b=0,w=function(t){function e(e){var i=t.call(this)||this;return i._track=[],i._covers=[],i._handlers={},i._zr=e,i.group=new a.Z,i._uid="brushController_"+b++,(0,r.each)(q,(function(t,e){this._handlers[e]=(0,r.bind)(t,this)}),i),i}return(0,n.ZT)(e,t),e.prototype.enableBrush=function(t){return this._brushType&&this._doDisableBrush(),t.brushType&&this._doEnableBrush(t),this},e.prototype._doEnableBrush=function(t){var e=this._zr;this._enableGlobalPan||c.qn(e,v,this._uid),(0,r.each)(this._handlers,(function(t,i){e.on(i,t)})),this._brushType=t.brushType,this._brushOption=(0,r.merge)((0,r.clone)(x),t,!0)},e.prototype._doDisableBrush=function(){var t=this._zr;c.Ar(t,v,this._uid),(0,r.each)(this._handlers,(function(e,i){t.off(i,e)})),this._brushType=this._brushOption=null},e.prototype.setPanels=function(t){if(t&&t.length){var e=this._panels={};(0,r.each)(t,(function(t){e[t.panelId]=(0,r.clone)(t)}))}else this._panels=null;return this},e.prototype.mount=function(t){t=t||{},this._enableGlobalPan=t.enableGlobalPan;var e=this.group;return this._zr.add(e),e.attr({x:t.x||0,y:t.y||0,rotation:t.rotation||0,scaleX:t.scaleX||1,scaleY:t.scaleY||1}),this._transform=e.getLocalTransform(),this},e.prototype.updateCovers=function(t){t=(0,r.map)(t,(function(t){return(0,r.merge)((0,r.clone)(x),t,!0)}));var e=this._covers,i=this._covers=[],n=this,o=this._creatingCover;return new d.Z(e,t,(function(t,e){return a(t.__brushOption,e)}),a).add(s).update(s).remove((function(t){e[t]!==o&&n.group.remove(e[t])})).execute(),this;function a(t,e){return(null!=t.id?t.id:"\0-brush-index-"+e)+"-"+t.brushType}function s(r,a){var s=t[r];if(null!=a&&e[a]===o)i[r]=e[a];else{var l=i[r]=null!=a?(e[a].__brushOption=s,e[a]):T(n,S(n,s));A(n,l)}}},e.prototype.unmount=function(){return this.enableBrush(!1),P(this),this._zr.remove(this.group),this},e.prototype.dispose=function(){this.unmount(),this.off()},e}(o.Z);function S(t,e){var i=J[e.brushType].createCover(t,e);return i.__brushOption=e,C(i,e),t.group.add(i),i}function T(t,e){var i=L(e);return i.endCreating&&(i.endCreating(t,e),C(e,e.__brushOption)),e}function M(t,e){var i=e.__brushOption;L(e).updateCoverShape(t,e,i.range,i)}function C(t,e){var i=e.z;null==i&&(i=1e4),t.traverse((function(t){t.z=i,t.z2=i}))}function A(t,e){L(e).updateCommon(t,e),M(t,e)}function L(t){return J[t.__brushOption.brushType]}function I(t,e,i){var n,o=t._panels;if(!o)return p;var a=t._transform;return(0,r.each)(o,(function(t){t.isTargetByCursor(e,i,a)&&(n=t)})),n}function D(t,e){var i=t._panels;if(!i)return p;var n=e.__brushOption.panelId;return null!=n?i[n]:p}function P(t){var e=t._covers,i=e.length;return(0,r.each)(e,(function(e){t.group.remove(e)}),t),e.length=0,!!i}function O(t,e){var i=(0,r.map)(t._covers,(function(t){var e=t.__brushOption,i=(0,r.clone)(e.range);return{brushType:e.brushType,panelId:e.panelId,range:i}}));t.trigger("brush",{areas:i,isEnd:!!e.isEnd,removeOnClick:!!e.removeOnClick})}function k(t){var e=t.length-1;return e<0&&(e=0),[t[0],t[e]]}function E(t,e,i,n){var o=new a.Z;return o.add(new s.Z({name:"main",style:B(i),silent:!0,draggable:!0,cursor:"move",drift:(0,r.curry)(V,t,e,o,["n","s","w","e"]),ondragend:(0,r.curry)(O,e,{isEnd:!0})})),(0,r.each)(n,(function(i){o.add(new s.Z({name:i.join(""),style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:(0,r.curry)(V,t,e,o,i),ondragend:(0,r.curry)(O,e,{isEnd:!0})}))})),o}function N(t,e,i,n){var r=n.brushStyle.lineWidth||0,o=g(r,6),a=i[0][0],s=i[1][0],l=a-r/2,u=s-r/2,h=i[0][1],c=i[1][1],d=h-o+r/2,p=c-o+r/2,f=h-a,m=c-s,v=f+r,y=m+r;z(t,e,"main",a,s,f,m),n.transformable&&(z(t,e,"w",l,u,o,y),z(t,e,"e",d,u,o,y),z(t,e,"n",l,u,v,o),z(t,e,"s",l,p,v,o),z(t,e,"nw",l,u,o,o),z(t,e,"ne",d,u,o,o),z(t,e,"sw",l,p,o,o),z(t,e,"se",d,p,o,o))}function R(t,e){var i=e.__brushOption,n=i.transformable,o=e.childAt(0);o.useStyle(B(i)),o.attr({silent:!n,cursor:n?"move":"default"}),(0,r.each)([["w"],["e"],["n"],["s"],["s","e"],["s","w"],["n","e"],["n","w"]],(function(i){var r=e.childOfName(i.join("")),o=1===i.length?F(t,i[0]):function(t,e){var i=[F(t,e[0]),F(t,e[1])];return("e"===i[0]||"w"===i[0])&&i.reverse(),i.join("")}(t,i);r&&r.attr({silent:!n,invisible:!n,cursor:n?_[o]+"-resize":null})}))}function z(t,e,i,n,r,o,a){var s,l,u,h,c,d=e.childOfName(i);d&&d.setShape((s=U(t,e,[[n,r],[n+o,r+a]]),l=f(s[0][0],s[1][0]),u=f(s[0][1],s[1][1]),h=g(s[0][0],s[1][0]),c=g(s[0][1],s[1][1]),{x:l,y:u,width:h-l,height:c-u}))}function B(t){return(0,r.defaults)({strokeNoScale:!0},t.brushStyle)}function Z(t,e,i,n){var r=[f(t,i),f(e,n)],o=[g(t,i),g(e,n)];return[[r[0],o[0]],[r[1],o[1]]]}function F(t,e){var i=l.transformDirection({w:"left",e:"right",n:"top",s:"bottom"}[e],function(t){return l.getTransform(t.group)}(t));return{left:"w",right:"e",top:"n",bottom:"s"}[i]}function V(t,e,i,n,o,a){var s=i.__brushOption,l=t.toRectRange(s.range),u=H(e,o,a);(0,r.each)(n,(function(t){var e=y[t];l[e[0]][e[1]]+=u[e[0]]})),s.range=t.fromRectRange(Z(l[0][0],l[1][0],l[0][1],l[1][1])),A(e,i),O(e,{isEnd:!1})}function G(t,e,i,n){var o=e.__brushOption.range,a=H(t,i,n);(0,r.each)(o,(function(t){t[0]+=a[0],t[1]+=a[1]})),A(t,e),O(t,{isEnd:!1})}function H(t,e,i){var n=t.group,r=n.transformCoordToLocal(e,i),o=n.transformCoordToLocal(0,0);return[r[0]-o[0],r[1]-o[1]]}function U(t,e,i){var n=D(t,e);return n&&n!==p?n.clipPath(i,t._transform):(0,r.clone)(i)}function W(t){var e=t.event;e.preventDefault&&e.preventDefault()}function j(t,e,i){return t.childOfName("main").contain(e,i)}function X(t,e,i,n){var o,a=t._creatingCover,s=t._creatingPanel,l=t._brushOption;if(t._track.push(i.slice()),function(t){var e=t._track;if(!e.length)return!1;var i=e[e.length-1],n=e[0],r=i[0]-n[0],o=i[1]-n[1];return m(r*r+o*o,.5)>6}(t)||a){if(s&&!a){"single"===l.brushMode&&P(t);var u=(0,r.clone)(l);u.brushType=Y(u.brushType,s),u.panelId=s===p?null:s.panelId,a=t._creatingCover=S(t,u),t._covers.push(a)}if(a){var h=J[Y(t._brushType,s)];a.__brushOption.range=h.getCreatingRange(U(t,a,t._track)),n&&(T(t,a),h.updateCommon(t,a)),M(t,a),o={isEnd:n}}}else n&&"single"===l.brushMode&&l.removeOnClick&&I(t,e,i)&&P(t)&&(o={isEnd:n,removeOnClick:!0});return o}function Y(t,e){return"auto"===t?e.defaultBrushType:t}var q={mousedown:function(t){if(this._dragging)K(this,t);else if(!t.target||!t.target.draggable){W(t);var e=this.group.transformCoordToLocal(t.offsetX,t.offsetY);this._creatingCover=null,(this._creatingPanel=I(this,t,e))&&(this._dragging=!0,this._track=[e.slice()])}},mousemove:function(t){var e=t.offsetX,i=t.offsetY,n=this.group.transformCoordToLocal(e,i);if(function(t,e,i){if(t._brushType&&!function(t,e,i){var n=t._zr;return e<0||e>n.getWidth()||i<0||i>n.getHeight()}(t,e.offsetX,e.offsetY)){var n=t._zr,r=t._covers,o=I(t,e,i);if(!t._dragging)for(var a=0;a{"use strict";i.d(e,{Z:()=>_});var n=i(8760),r=i(1177),o=i(1463),a=i(2234),s=["grid","xAxis","yAxis","geo","graph","polar","radiusAxis","angleAxis","bmap"],l=function(){function t(t,e,i){var r=this;this._targetInfoList=[];var o=h(e,t);(0,n.each)(c,(function(t,e){(!i||!i.include||(0,n.indexOf)(i.include,e)>=0)&&t(o,r._targetInfoList)}))}return t.prototype.setOutputRanges=function(t,e){return this.matchOutputRanges(t,e,(function(t,e,i){if((t.coordRanges||(t.coordRanges=[])).push(e),!t.coordRange){t.coordRange=e;var n=f[t.brushType](0,i,e);t.__rangeOffset={offset:m[t.brushType](n.values,t.range,[1,1]),xyMinMax:n.xyMinMax}}})),t},t.prototype.matchOutputRanges=function(t,e,i){(0,n.each)(t,(function(t){var r=this.findTargetInfo(t,e);r&&!0!==r&&(0,n.each)(r.coordSyses,(function(n){var r=f[t.brushType](1,n,t.range,!0);i(t,r.values,n,e)}))}),this)},t.prototype.setInputRanges=function(t,e){(0,n.each)(t,(function(t){var i,n,r,o,a,s=this.findTargetInfo(t,e);if(t.range=t.range||[],s&&!0!==s){t.panelId=s.panelId;var l=f[t.brushType](0,s.coordSys,t.coordRange),u=t.__rangeOffset;t.range=u?m[t.brushType](l.values,u.offset,(i=l.xyMinMax,n=u.xyMinMax,r=y(i),o=y(n),a=[r[0]/o[0],r[1]/o[1]],isNaN(a[0])&&(a[0]=1),isNaN(a[1])&&(a[1]=1),a)):l.values}}),this)},t.prototype.makePanelOpts=function(t,e){return(0,n.map)(this._targetInfoList,(function(i){var n=i.getPanelRect();return{panelId:i.panelId,defaultBrushType:e?e(i):null,clipPath:o.x0(n),isTargetByCursor:o.G(n,t,i.coordSysModel),getLinearBrushOtherExtent:o.VM(n)}}))},t.prototype.controlSeries=function(t,e,i){var r=this.findTargetInfo(t,i);return!0===r||r&&(0,n.indexOf)(r.coordSyses,e.coordinateSystem)>=0},t.prototype.findTargetInfo=function(t,e){for(var i=this._targetInfoList,n=h(e,t),r=0;rt[1]&&t.reverse(),t}function h(t,e){return(0,a.pm)(t,e,{includeMainTypes:s})}var c={grid:function(t,e){var i=t.xAxisModels,r=t.yAxisModels,o=t.gridModels,a=(0,n.createHashMap)(),s={},l={};(i||r||o)&&((0,n.each)(i,(function(t){var e=t.axis.grid.model;a.set(e.id,e),s[e.id]=!0})),(0,n.each)(r,(function(t){var e=t.axis.grid.model;a.set(e.id,e),l[e.id]=!0})),(0,n.each)(o,(function(t){a.set(t.id,t),s[t.id]=!0,l[t.id]=!0})),a.each((function(t){var o=t.coordinateSystem,a=[];(0,n.each)(o.getCartesians(),(function(t,e){((0,n.indexOf)(i,t.getAxis("x").model)>=0||(0,n.indexOf)(r,t.getAxis("y").model)>=0)&&a.push(t)})),e.push({panelId:"grid--"+t.id,gridModel:t,coordSysModel:t,coordSys:a[0],coordSyses:a,getPanelRect:p.grid,xAxisDeclared:s[t.id],yAxisDeclared:l[t.id]})})))},geo:function(t,e){(0,n.each)(t.geoModels,(function(t){var i=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:i,coordSyses:[i],getPanelRect:p.geo})}))}},d=[function(t,e){var i=t.xAxisModel,n=t.yAxisModel,r=t.gridModel;return!r&&i&&(r=i.axis.grid.model),!r&&n&&(r=n.axis.grid.model),r&&r===e.gridModel},function(t,e){var i=t.geoModel;return i&&i===e.geoModel}],p={grid:function(){return this.coordSys.master.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(r.getTransform(t)),e}},f={lineX:(0,n.curry)(g,0),lineY:(0,n.curry)(g,1),rect:function(t,e,i,n){var r=t?e.pointToData([i[0][0],i[1][0]],n):e.dataToPoint([i[0][0],i[1][0]],n),o=t?e.pointToData([i[0][1],i[1][1]],n):e.dataToPoint([i[0][1],i[1][1]],n),a=[u([r[0],o[0]]),u([r[1],o[1]])];return{values:a,xyMinMax:a}},polygon:function(t,e,i,r){var o=[[1/0,-1/0],[1/0,-1/0]];return{values:(0,n.map)(i,(function(i){var n=t?e.pointToData(i,r):e.dataToPoint(i,r);return o[0][0]=Math.min(o[0][0],n[0]),o[1][0]=Math.min(o[1][0],n[1]),o[0][1]=Math.max(o[0][1],n[0]),o[1][1]=Math.max(o[1][1],n[1]),n})),xyMinMax:o}}};function g(t,e,i,r){var o=i.getAxis(["x","y"][t]),a=u((0,n.map)([0,1],(function(t){return e?o.coordToData(o.toLocalCoord(r[t]),!0):o.toGlobalCoord(o.dataToCoord(r[t]))}))),s=[];return s[t]=a,s[1-t]=[NaN,NaN],{values:a,xyMinMax:s}}var m={lineX:(0,n.curry)(v,0),lineY:(0,n.curry)(v,1),rect:function(t,e,i){return[[t[0][0]-i[0]*e[0][0],t[0][1]-i[0]*e[0][1]],[t[1][0]-i[1]*e[1][0],t[1][1]-i[1]*e[1][1]]]},polygon:function(t,e,i){return(0,n.map)(t,(function(t,n){return[t[0]-i[0]*e[n][0],t[1]-i[1]*e[n][1]]}))}};function v(t,e,i,n){return[e[0]-n[t]*i[0],e[1]-n[t]*i[1]]}function y(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}const _=l},9176:(t,e,i)=>{"use strict";i.d(e,{Z:()=>c});var n=i(8299),r=i(1935),o=i(9186),a=i(582),s=i(8760);function l(t,e,i,n,r){t.pointerChecker&&t.pointerChecker(n,r.originX,r.originY)&&(o.sT(n.event),u(t,e,i,n,r))}function u(t,e,i,n,r){r.isAvailableBehavior=(0,s.bind)(h,null,i,n),t.trigger(e,r)}function h(t,e,i){var n=i[t];return!t||n&&(!(0,s.isString)(n)||e.event[n+"Key"])}const c=function(t){function e(e){var i=t.call(this)||this;i._zr=e;var n=(0,s.bind)(i._mousedownHandler,i),r=(0,s.bind)(i._mousemoveHandler,i),o=(0,s.bind)(i._mouseupHandler,i),a=(0,s.bind)(i._mousewheelHandler,i),l=(0,s.bind)(i._pinchHandler,i);return i.enable=function(t,i){this.disable(),this._opt=(0,s.defaults)((0,s.clone)(i)||{},{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),null==t&&(t=!0),!0!==t&&"move"!==t&&"pan"!==t||(e.on("mousedown",n),e.on("mousemove",r),e.on("mouseup",o)),!0!==t&&"scale"!==t&&"zoom"!==t||(e.on("mousewheel",a),e.on("pinch",l))},i.disable=function(){e.off("mousedown",n),e.off("mousemove",r),e.off("mouseup",o),e.off("mousewheel",a),e.off("pinch",l)},i}return(0,n.ZT)(e,t),e.prototype.isDragging=function(){return this._dragging},e.prototype.isPinching=function(){return this._pinching},e.prototype.setPointerChecker=function(t){this.pointerChecker=t},e.prototype.dispose=function(){this.disable()},e.prototype._mousedownHandler=function(t){if(!o.x1(t)){for(var e=t.target;e;){if(e.draggable)return;e=e.__hostTarget||e.parent}var i=t.offsetX,n=t.offsetY;this.pointerChecker&&this.pointerChecker(t,i,n)&&(this._x=i,this._y=n,this._dragging=!0)}},e.prototype._mousemoveHandler=function(t){if(this._dragging&&h("moveOnMouseMove",t,this._opt)&&"pinch"!==t.gestureEvent&&!a.Tf(this._zr,"globalPan")){var e=t.offsetX,i=t.offsetY,n=this._x,r=this._y,s=e-n,l=i-r;this._x=e,this._y=i,this._opt.preventDefaultMouseMove&&o.sT(t.event),u(this,"pan","moveOnMouseMove",t,{dx:s,dy:l,oldX:n,oldY:r,newX:e,newY:i,isAvailableBehavior:null})}},e.prototype._mouseupHandler=function(t){o.x1(t)||(this._dragging=!1)},e.prototype._mousewheelHandler=function(t){var e=h("zoomOnMouseWheel",t,this._opt),i=h("moveOnMouseWheel",t,this._opt),n=t.wheelDelta,r=Math.abs(n),o=t.offsetX,a=t.offsetY;if(0!==n&&(e||i)){if(e){var s=r>3?1.4:r>1?1.2:1.1;l(this,"zoom","zoomOnMouseWheel",t,{scale:n>0?s:1/s,originX:o,originY:a,isAvailableBehavior:null})}if(i){var u=Math.abs(n);l(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:(n>0?1:-1)*(u>3?.4:u>1?.15:.05),originX:o,originY:a,isAvailableBehavior:null})}}},e.prototype._pinchHandler=function(t){a.Tf(this._zr,"globalPan")||l(this,"zoom",null,t,{scale:t.pinchScale>1?1.1:1/1.1,originX:t.pinchX,originY:t.pinchY,isAvailableBehavior:null})},e}(r.Z)},1463:(t,e,i)=>{"use strict";i.d(e,{G:()=>l,VM:()=>s,x0:()=>a});var n=i(641),r=i(1485),o=i(1177);function a(t){return t=u(t),function(e){return o.clipPointsByRect(e,t)}}function s(t,e){return t=u(t),function(i){var n=null!=e?e:i,r=n?t.width:t.height,o=n?t.x:t.y;return[o,o+(r||0)]}}function l(t,e,i){var n=u(t);return function(t,o){return n.contain(o[0],o[1])&&!(0,r.l)(t,e,i)}}function u(t){return n.Z.create(t)}},1485:(t,e,i)=>{"use strict";i.d(e,{l:()=>r});var n={axisPointer:1,tooltip:1,brush:1};function r(t,e,i){var r=e.getComponentByElement(t.topTarget),o=r&&r.coordinateSystem;return r&&r!==i&&!n.hasOwnProperty(r.mainType)&&o&&o.model!==i}},582:(t,e,i)=>{"use strict";i.d(e,{Ar:()=>s,Tf:()=>l,qn:()=>a});var n=i(1615),r=i(8760),o="\0_ec_interaction_mutex";function a(t,e,i){u(t)[e]=i}function s(t,e,i){var n=u(t);n[e]===i&&(n[e]=null)}function l(t,e){return!!u(t)[e]}function u(t){return t[o]||(t[o]={})}n.zl({type:"takeGlobalCursor",event:"globalCursorTaken",update:"update"},r.noop)},9337:(t,e,i)=>{"use strict";i.d(e,{b:()=>a,l:()=>s});var n=i(6172),r=i(8988),o=i(56);function a(t,e,i){var r=e.getBoxLayoutParams(),o=e.get("padding"),a={width:i.getWidth(),height:i.getHeight()},s=(0,n.ME)(r,a,o);(0,n.BZ)(e.get("orient"),t,e.get("itemGap"),s.width,s.height),(0,n.p$)(t,r,a,o)}function s(t,e){var i=r.MY(e.get("padding")),n=e.getItemStyle(["color","opacity"]);return n.fill=e.get("backgroundColor"),t=new o.Z({shape:{x:t.x-i[3],y:t.y-i[0],width:t.width+i[1]+i[3],height:t.height+i[0]+i[2],r:e.get("borderRadius")},style:n,silent:!0,z2:-1})}},1194:(t,e,i)=>{"use strict";function n(t,e,i){var n=t.target;n.x+=e,n.y+=i,n.dirty()}function r(t,e,i,n){var r=t.target,o=t.zoomLimit,a=t.zoom=t.zoom||1;if(a*=e,o){var s=o.min||0,l=o.max||1/0;a=Math.max(Math.min(l,a),s)}var u=a/t.zoom;t.zoom=a,r.x-=(i-r.x)*(u-1),r.y-=(n-r.y)*(u-1),r.scaleX*=u,r.scaleY*=u,r.dirty()}i.d(e,{H:()=>r,e:()=>n})},9233:(t,e,i)=>{"use strict";function n(t,e,i,n,a,s){t=t||0;var l=i[1]-i[0];if(null!=a&&(a=o(a,[0,l])),null!=s&&(s=Math.max(s,null!=a?a:0)),"all"===n){var u=Math.abs(e[1]-e[0]);u=o(u,[0,l]),a=s=o(u,[a,s]),n=0}e[0]=o(e[0],i),e[1]=o(e[1],i);var h=r(e,n);e[n]+=t;var c,d=a||0,p=i.slice();return h.sign<0?p[0]+=d:p[1]-=d,e[n]=o(e[n],p),c=r(e,n),null!=a&&(c.sign!==h.sign||c.spans&&(e[1-n]=e[n]+c.sign*s),e}function r(t,e){var i=t[e]-t[1-e];return{span:Math.abs(i),sign:i>0?-1:i<0?1:e?-1:1}}function o(t,e){return Math.min(null!=e[1]?e[1]:1/0,Math.max(null!=e[0]?e[0]:-1/0,t))}i.d(e,{Z:()=>n})},3450:(t,e,i)=>{"use strict";i.d(e,{N:()=>G});var n=i(8023),r=i(8299),o=i(8760),a=i(1497),s=i(2234),l=i(8071);const u=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.layoutMode={type:"box",ignoreSize:!0},i}return(0,r.ZT)(e,t),e.prototype.init=function(t,e,i){this.mergeDefaultAndTheme(t,i),t.selected=t.selected||{},this._updateSelector(t)},e.prototype.mergeOption=function(e,i){t.prototype.mergeOption.call(this,e,i),this._updateSelector(e)},e.prototype._updateSelector=function(t){var e=t.selector,i=this.ecModel;!0===e&&(e=t.selector=["all","inverse"]),o.isArray(e)&&o.each(e,(function(t,n){o.isString(t)&&(t={type:t}),e[n]=o.merge(t,function(t,e){return"all"===e?{type:"all",title:t.getLocaleModel().get(["legend","selector","all"])}:"inverse"===e?{type:"inverse",title:t.getLocaleModel().get(["legend","selector","inverse"])}:void 0}(i,t.type))}))},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,i=0;i=0},e.prototype.getOrient=function(){return"vertical"===this.get("orient")?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:"#ccc",inactiveBorderColor:"#ccc",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:"#ccc",inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:"#333"},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:"#666",borderWidth:1,borderColor:"#666"},emphasis:{selectorLabel:{show:!0,color:"#eee",backgroundColor:"#666"}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1}},e}(l.Z);var h=i(5673),c=i(2141),d=i(1590),p=i(56),f=i(1177),g=i(6357),m=i(6006),v=i(9337),y=i(6172),_=i(3166),x=i(1525),b=i(9038),w=o.curry,S=o.each,T=c.Z;function M(t,e,i,n){L(t,e,i,n),i.dispatchAction({type:"legendToggleSelect",name:null!=t?t:e}),A(t,e,i,n)}function C(t){for(var e,i=t.getZr().storage.getDisplayList(),n=0,r=i.length;n0?2:0),S(t,(function(i,n){"inherit"===t[n]&&(t[n]=e[n])}))}var l=e.getModel("itemStyle"),u=l.getItemStyle(),h=0===t.lastIndexOf("empty",0)?"fill":"stroke",c=l.getShallow("decal");u.decal=c&&"inherit"!==c?(0,b.I)(c,a):n.decal,"inherit"===u.fill&&(u.fill=n[r]);"inherit"===u.stroke&&(u.stroke=n[h]);"inherit"===u.opacity&&(u.opacity=("fill"===r?n:i).opacity);s(u,n);var d=e.getModel("lineStyle"),p=d.getLineStyle();if(s(p,i),"auto"===u.fill&&(u.fill=n.fill),"auto"===u.stroke&&(u.stroke=n.fill),"auto"===p.stroke&&(p.stroke=n.fill),!o){var f=e.get("inactiveBorderWidth"),g=u[h];u.lineWidth="auto"===f?n.lineWidth>0&&g?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),p.stroke=d.get("inactiveColor"),p.lineWidth=d.get("inactiveWidth")}return{itemStyle:u,lineStyle:p}}(u=A||u||"roundRect",n,s,l,v,w,c),I=new T,D=n.getModel("textStyle");if(!o.isFunction(t.getLegendIcon)||A&&"inherit"!==A){var P="inherit"===A&&t.getData().getVisual("symbol")?"inherit"===M?t.getData().getVisual("symbolRotate"):M:0;I.add(function(t){var e=t.icon||"roundRect",i=(0,x.th)(e,0,0,t.itemWidth,t.itemHeight,t.itemStyle.fill,t.symbolKeepAspect);i.setStyle(t.itemStyle),i.rotation=(t.iconRotate||0)*Math.PI/180,i.setOrigin([t.itemWidth/2,t.itemHeight/2]),e.indexOf("empty")>-1&&(i.style.stroke=i.style.fill,i.style.fill="#fff",i.style.lineWidth=2);return i}({itemWidth:y,itemHeight:_,icon:u,iconRotate:P,itemStyle:L.itemStyle,lineStyle:L.lineStyle,symbolKeepAspect:C}))}else I.add(t.getLegendIcon({itemWidth:y,itemHeight:_,icon:u,iconRotate:M,itemStyle:L.itemStyle,lineStyle:L.lineStyle,symbolKeepAspect:C}));var O="left"===a?y+5:-5,k=a,E=r.get("formatter"),N=e;o.isString(E)&&E?N=E.replace("{name}",null!=e?e:""):o.isFunction(E)&&(N=E(e));var R=n.get("inactiveColor");I.add(new d.ZP({style:(0,m.Lr)(D,{text:N,x:O,y:_/2,fill:w?D.getTextColor():R,align:k,verticalAlign:"middle"})}));var z=new p.Z({shape:I.getBoundingRect(),invisible:!0}),B=n.getModel("tooltip");return B.get("show")&&f.setTooltipConfig({el:z,componentModel:r,itemName:e,itemTooltipOption:B.option}),I.add(z),I.eachChild((function(t){t.silent=!0})),z.silent=!h,this.getContentGroup().add(I),(0,g.vF)(I),I.__legendDataIndex=i,I},e.prototype.layoutInner=function(t,e,i,n,r,o){var a=this.getContentGroup(),s=this.getSelectorGroup();y.BZ(t.get("orient"),a,t.get("itemGap"),i.width,i.height);var l=a.getBoundingRect(),u=[-l.x,-l.y];if(s.markRedraw(),a.markRedraw(),r){y.BZ("horizontal",s,t.get("selectorItemGap",!0));var h=s.getBoundingRect(),c=[-h.x,-h.y],d=t.get("selectorButtonGap",!0),p=t.getOrient().index,f=0===p?"width":"height",g=0===p?"height":"width",m=0===p?"y":"x";"end"===o?c[p]+=l[f]+d:u[p]+=h[f]+d,c[1-p]+=l[g]/2-h[g]/2,s.x=c[0],s.y=c[1],a.x=u[0],a.y=u[1];var v={x:0,y:0};return v[f]=l[f]+d+h[f],v[g]=Math.max(l[g],h[g]),v[m]=Math.min(0,h[m]+c[1-p]),v}return a.x=u[0],a.y=u[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e}(_.Z);function D(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries((function(t){for(var i=0;ii[r],m=[-d.x,-d.y];e||(m[n]=u[l]);var v=[0,0],_=[-f.x,-f.y],x=o.retrieve2(t.get("pageButtonGap",!0),t.get("itemGap",!0));g&&("end"===t.get("pageButtonPosition",!0)?_[n]+=i[r]-f[r]:v[n]+=f[r]+x);_[1-n]+=d[a]/2-f[a]/2,u.setPosition(m),h.setPosition(v),c.setPosition(_);var b={x:0,y:0};if(b[r]=g?i[r]:d[r],b[a]=Math.max(d[a],f[a]),b[s]=Math.min(0,f[s]+_[1-n]),h.__rectSize=i[r],g){var w={x:0,y:0};w[r]=Math.max(i[r]-f[r]-x,0),w[a]=b[a],h.setClipPath(new p.Z({shape:w})),h.__rectSize=w[r]}else c.eachChild((function(t){t.attr({invisible:!0,silent:!0})}));var S=this._getPageInfo(t);return null!=S.pageIndex&&R.D(u,{x:S.contentPosition[0],y:S.contentPosition[1]},g?t:null),this._updatePageInfoView(t,S),b},e.prototype._pageGo=function(t,e,i){var n=this._getPageInfo(e)[t];null!=n&&i.dispatchAction({type:"legendScroll",scrollDataIndex:n,legendId:e.id})},e.prototype._updatePageInfoView=function(t,e){var i=this._controllerGroup;o.each(["pagePrev","pageNext"],(function(n){var r=null!=e[n+"DataIndex"],o=i.childOfName(n);o&&(o.setStyle("fill",r?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),o.cursor=r?"pointer":"default")}));var n=i.childOfName("pageText"),r=t.get("pageFormatter"),a=e.pageIndex,s=null!=a?a+1:0,l=e.pageCount;n&&r&&n.setStyle("text",o.isString(r)?r.replace("{current}",null==s?"":s+"").replace("{total}",null==l?"":l+""):r({current:s,total:l}))},e.prototype._getPageInfo=function(t){var e=t.get("scrollDataIndex",!0),i=this.getContentGroup(),n=this._containerGroup.__rectSize,r=t.getOrient().index,o=B[r],a=Z[r],s=this._findTargetItemIndex(e),l=i.children(),u=l[s],h=l.length,c=h?1:0,d={contentPosition:[i.x,i.y],pageCount:c,pageIndex:c-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!u)return d;var p=y(u);d.contentPosition[r]=-p.s;for(var f=s+1,g=p,m=p,v=null;f<=h;++f)(!(v=y(l[f]))&&m.e>g.s+n||v&&!_(v,g.s))&&(g=m.i>g.i?m:v)&&(null==d.pageNextDataIndex&&(d.pageNextDataIndex=g.i),++d.pageCount),m=v;for(f=s-1,g=p,m=p,v=null;f>=-1;--f)(v=y(l[f]))&&_(m,v.s)||!(g.i=e&&t.s<=e+n}},e.prototype._findTargetItemIndex=function(t){return this._showController?(this.getContentGroup().eachChild((function(n,r){var o=n.__legendDataIndex;null==i&&null!=o&&(i=r),o===t&&(e=r)})),null!=e?e:i):0;var e,i},e.type="legend.scroll",e}(I);function V(t){(0,n.D)(O),t.registerComponentModel(N),t.registerComponentView(F),function(t){t.registerAction("legendScroll","legendscroll",(function(t,e){var i=t.scrollDataIndex;null!=i&&e.eachComponent({mainType:"legend",subType:"scroll",query:t},(function(t){t.setScrollDataIndex(i)}))}))}(t)}function G(t){(0,n.D)(O),(0,n.D)(V)}},8690:(t,e,i)=>{"use strict";i.d(e,{N:()=>g});var n=i(8299),r=i(8760),o=i(1590),a=i(56),s=i(106),l=i(6006),u=i(6172),h=i(8071),c=i(3166),d=i(8988),p=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i.layoutMode={type:"box",ignoreSize:!0},i}return(0,n.ZT)(e,t),e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:0,top:0,backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:"#464646"},subtextStyle:{fontSize:12,color:"#6E7079"}},e}(h.Z),f=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,n.ZT)(e,t),e.prototype.render=function(t,e,i){if(this.group.removeAll(),t.get("show")){var n=this.group,h=t.getModel("textStyle"),c=t.getModel("subtextStyle"),p=t.get("textAlign"),f=r.retrieve2(t.get("textBaseline"),t.get("textVerticalAlign")),g=new o.ZP({style:(0,l.Lr)(h,{text:t.get("text"),fill:h.getTextColor()},{disableBox:!0}),z2:10}),m=g.getBoundingRect(),v=t.get("subtext"),y=new o.ZP({style:(0,l.Lr)(c,{text:v,fill:c.getTextColor(),y:m.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),_=t.get("link"),x=t.get("sublink"),b=t.get("triggerEvent",!0);g.silent=!_&&!b,y.silent=!x&&!b,_&&g.on("click",(function(){(0,d.MI)(_,"_"+t.get("target"))})),x&&y.on("click",(function(){(0,d.MI)(x,"_"+t.get("subtarget"))})),(0,s.A)(g).eventData=(0,s.A)(y).eventData=b?{componentType:"title",componentIndex:t.componentIndex}:null,n.add(g),v&&n.add(y);var w=n.getBoundingRect(),S=t.getBoxLayoutParams();S.width=w.width,S.height=w.height;var T=(0,u.ME)(S,{width:i.getWidth(),height:i.getHeight()},t.get("padding"));p||("middle"===(p=t.get("left")||t.get("right"))&&(p="center"),"right"===p?T.x+=T.width:"center"===p&&(T.x+=T.width/2)),f||("center"===(f=t.get("top")||t.get("bottom"))&&(f="middle"),"bottom"===f?T.y+=T.height:"middle"===f&&(T.y+=T.height/2),f=f||"top"),n.x=T.x,n.y=T.y,n.markRedraw();var M={align:p,verticalAlign:f};g.setStyle(M),y.setStyle(M),w=n.getBoundingRect();var C=T.margin,A=t.getItemStyle(["color","opacity"]);A.fill=t.get("backgroundColor");var L=new a.Z({shape:{x:w.x-C[3],y:w.y-C[0],width:w.width+C[1]+C[3],height:w.height+C[0]+C[2],r:t.get("borderRadius")},style:A,subPixelOptimize:!0,silent:!0});n.add(L)}},e.type="title",e}(c.Z);function g(t){t.registerComponentModel(p),t.registerComponentView(f)}},1806:(t,e,i)=>{"use strict";i.d(e,{Bm:()=>a,f1:()=>n,ls:()=>o});var n=function(){},r={};function o(t,e){r[t]=e}function a(t){return r[t]}},5045:(t,e,i)=>{"use strict";i.d(e,{N:()=>et});var n=i(8023),r=i(8299);const o=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,r.ZT)(e,t),e.type="dataZoom.select",e}(i(2719).Z);const a=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,r.ZT)(e,t),e.type="dataZoom.select",e}(i(2159).Z);var s=i(7543);function l(t){t.registerComponentModel(o),t.registerComponentView(a),(0,s.Z)(t)}var u=i(8760),h=i(1806);const c=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,r.ZT)(e,t),e.prototype.optionUpdated=function(){t.prototype.optionUpdated.apply(this,arguments);var e=this.ecModel;u.each(this.option.feature,(function(t,i){var n=h.Bm(i);n&&(n.getDefaultOption&&(n.defaultOption=n.getDefaultOption(e)),u.merge(t,n.defaultOption))}))},e.type="toolbox",e.layoutMode={type:"box",ignoreSize:!0},e.defaultOption={show:!0,z:6,orient:"horizontal",left:"right",top:"top",backgroundColor:"transparent",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemSize:15,itemGap:8,showTitle:!0,iconStyle:{borderColor:"#666",color:"none"},emphasis:{iconStyle:{borderColor:"#3E98C5"}},tooltip:{show:!1,position:"bottom"}},e}(i(8071).Z);var d=i(9979),p=i(1177),f=i(6357),g=i(1497),m=i(4130),v=i(9337),y=i(3166),_=i(2151),x=i(1590);const b=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,r.ZT)(e,t),e.prototype.render=function(t,e,i,n){var r=this.group;if(r.removeAll(),t.get("show")){var o=+t.get("itemSize"),a="vertical"===t.get("orient"),s=t.get("feature")||{},l=this._features||(this._features={}),c=[];u.each(s,(function(t,e){c.push(e)})),new m.Z(this._featureNames||[],c).add(y).update(y).remove(u.curry(y,null)).execute(),this._featureNames=c,v.b(r,t,i),r.add(v.l(r.getBoundingRect(),t)),a||r.eachChild((function(t){var e=t.__title,n=t.ensureState("emphasis"),a=n.textConfig||(n.textConfig={}),s=t.getTextContent(),l=s&&s.ensureState("emphasis");if(l&&!u.isFunction(l)&&e){var h=l.style||(l.style={}),c=d.lP(e,x.ZP.makeFont(h)),p=t.x+r.x,f=!1;t.y+r.y+o+c.height>i.getHeight()&&(a.position="top",f=!0);var g=f?-5-c.height:o+10;p+c.width/2>i.getWidth()?(a.position=["100%",g],h.align="right"):p-c.width/2<0&&(a.position=[0,g],h.align="left")}}))}function y(d,m){var v,y=c[d],b=c[m],w=s[y],S=new g.Z(w,t,t.ecModel);if(n&&null!=n.newTitle&&n.featureName===y&&(w.title=n.newTitle),y&&!b){if(function(t){return 0===t.indexOf("my")}(y))v={onclick:S.option.onclick,featureName:y};else{var T=(0,h.Bm)(y);if(!T)return;v=new T}l[y]=v}else if(!(v=l[b]))return;v.uid=(0,_.Kr)("toolbox-feature"),v.model=S,v.ecModel=e,v.api=i;var M=v instanceof h.f1;y||!b?!S.get("show")||M&&v.unusable?M&&v.remove&&v.remove(e,i):(!function(n,s,l){var c,d,g=n.getModel("iconStyle"),m=n.getModel(["emphasis","iconStyle"]),v=s instanceof h.f1&&s.getIcons?s.getIcons():n.get("icon"),y=n.get("title")||{};u.isString(v)?(c={})[l]=v:c=v;u.isString(y)?(d={})[l]=y:d=y;var _=n.iconPaths={};u.each(c,(function(l,h){var c=p.createIcon(l,{},{x:-o/2,y:-o/2,width:o,height:o});c.setStyle(g.getItemStyle()),c.ensureState("emphasis").style=m.getItemStyle();var v=new x.ZP({style:{text:d[h],align:m.get("textAlign"),borderRadius:m.get("textBorderRadius"),padding:m.get("textPadding"),fill:null},ignore:!0});c.setTextContent(v),p.setTooltipConfig({el:c,componentModel:t,itemName:h,formatterParamsExtra:{title:d[h]}}),c.__title=d[h],c.on("mouseover",(function(){var e=m.getItemStyle(),n=a?null==t.get("right")&&"right"!==t.get("left")?"right":"left":null==t.get("bottom")&&"bottom"!==t.get("top")?"bottom":"top";v.setStyle({fill:m.get("textFill")||e.fill||e.stroke||"#000",backgroundColor:m.get("textBackgroundColor")}),c.setTextConfig({position:m.get("textPosition")||n}),v.ignore=!t.get("showTitle"),i.enterEmphasis(this)})).on("mouseout",(function(){"emphasis"!==n.get(["iconStatus",h])&&i.leaveEmphasis(this),v.hide()})),("emphasis"===n.get(["iconStatus",h])?f.fD:f.Mh)(c),r.add(c),c.on("click",u.bind(s.onclick,s,e,i,h)),_[h]=c}))}(S,v,y),S.setIconStatus=function(t,e){var i=this.option,n=this.iconPaths;i.iconStatus=i.iconStatus||{},i.iconStatus[t]=e,n[t]&&("emphasis"===e?f.fD:f.Mh)(n[t])},v instanceof h.f1&&v.render&&v.render(S,e,i,n)):M&&v.dispose&&v.dispose(e,i)}},e.prototype.updateView=function(t,e,i,n){u.each(this._features,(function(t){t instanceof h.f1&&t.updateView&&t.updateView(t.model,e,i,n)}))},e.prototype.remove=function(t,e){u.each(this._features,(function(i){i instanceof h.f1&&i.remove&&i.remove(t,e)})),this.group.removeAll()},e.prototype.dispose=function(t,e){u.each(this._features,(function(i){i instanceof h.f1&&i.dispose&&i.dispose(t,e)}))},e.type="toolbox",e}(y.Z);var w=i(7153);const S=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,r.ZT)(e,t),e.prototype.onclick=function(t,e){var i=this.model,n=i.get("name")||t.get("title.0.text")||"echarts",r="svg"===e.getZr().painter.getType(),o=r?"svg":i.get("type",!0)||"png",a=e.getConnectedDataURL({type:o,backgroundColor:i.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",connectedBackgroundColor:i.get("connectedBackgroundColor"),excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")}),s=w.Z.browser;if((0,u.isFunction)(MouseEvent)&&(s.newEdge||!s.ie&&!s.edge)){var l=document.createElement("a");l.download=n+"."+o,l.target="_blank",l.href=a;var h=new MouseEvent("click",{view:document.defaultView,bubbles:!0,cancelable:!1});l.dispatchEvent(h)}else if(window.navigator.msSaveOrOpenBlob||r){var c=a.split(","),d=c[0].indexOf("base64")>-1,p=r?decodeURIComponent(c[1]):c[1];d&&(p=window.atob(p));var f=n+"."+o;if(window.navigator.msSaveOrOpenBlob){for(var g=p.length,m=new Uint8Array(g);g--;)m[g]=p.charCodeAt(g);var v=new Blob([m]);window.navigator.msSaveOrOpenBlob(v,f)}else{var y=document.createElement("iframe");document.body.appendChild(y);var _=y.contentWindow,x=_.document;x.open("image/svg+xml","replace"),x.write(p),x.close(),_.focus(),x.execCommand("SaveAs",!0,f),document.body.removeChild(y)}}else{var b=i.get("lang"),S='',T=window.open();T.document.write(S),T.document.title=n}},e.getDefaultOption=function(t){return{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:t.getLocaleModel().get(["toolbox","saveAsImage","title"]),type:"png",connectedBackgroundColor:"#fff",name:"",excludeComponents:["toolbox"],lang:t.getLocaleModel().get(["toolbox","saveAsImage","lang"])}},e}(h.f1);var T=i(1615),M=i(2234),C="__ec_magicType_stack__",A=[["line","bar"],["stack"]],L=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,r.ZT)(e,t),e.prototype.getIcons=function(){var t=this.model,e=t.get("icon"),i={};return u.each(t.get("type"),(function(t){e[t]&&(i[t]=e[t])})),i},e.getDefaultOption=function(t){return{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:t.getLocaleModel().get(["toolbox","magicType","title"]),option:{},seriesIndex:{}}},e.prototype.onclick=function(t,e,i){var n=this.model,r=n.get(["seriesIndex",i]);if(I[i]){var o,a={series:[]};u.each(A,(function(t){u.indexOf(t,i)>=0&&u.each(t,(function(t){n.setIconStatus(t,"normal")}))})),n.setIconStatus(i,"emphasis"),t.eachComponent({mainType:"series",query:null==r?null:{seriesIndex:r}},(function(t){var e=t.subType,r=t.id,o=I[i](e,r,t,n);o&&(u.defaults(o,t.option),a.series.push(o));var s=t.coordinateSystem;if(s&&"cartesian2d"===s.type&&("line"===i||"bar"===i)){var l=s.getAxesByScale("ordinal")[0];if(l){var h=l.dim+"Axis",c=t.getReferringComponents(h,M.C6).models[0].componentIndex;a[h]=a[h]||[];for(var d=0;d<=c;d++)a[h][c]=a[h][c]||{};a[h][c].boundaryGap="bar"===i}}}));var s=i;"stack"===i&&(o=u.merge({stack:n.option.title.tiled,tiled:n.option.title.stack},n.option.title),"emphasis"!==n.get(["iconStatus",i])&&(s="tiled")),e.dispatchAction({type:"changeMagicType",currentType:s,newOption:a,newTitle:o,featureName:"magicType"})}},e}(h.f1),I={line:function(t,e,i,n){if("bar"===t)return u.merge({id:e,type:"line",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get(["option","line"])||{},!0)},bar:function(t,e,i,n){if("line"===t)return u.merge({id:e,type:"bar",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},n.get(["option","bar"])||{},!0)},stack:function(t,e,i,n){var r=i.get("stack")===C;if("line"===t||"bar"===t)return n.setIconStatus("stack",r?"normal":"emphasis"),u.merge({id:e,stack:r?"":C},n.get(["option","stack"])||{},!0)}};T.zl({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},(function(t,e){e.mergeOption(t.newOption)}));const D=L;var P=i(9186),O=new Array(60).join("-"),k="\t";function E(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}var N=new RegExp("[\t]+","g");function R(t,e){var i=t.split(new RegExp("\n*"+O+"\n*","g")),n={series:[]};return u.each(i,(function(t,i){if(function(t){if(t.slice(0,t.indexOf("\n")).indexOf(k)>=0)return!0}(t)){var r=function(t){for(var e=t.split(/\n+/g),i=E(e.shift()).split(N),n=[],r=u.map(i,(function(t){return{name:t,data:[]}})),o=0;o1?"emphasis":"normal")}(t,e)},e.prototype.onclick=function(t,e,i){Q[i].call(this)},e.prototype.remove=function(t,e){this._brushController&&this._brushController.unmount()},e.prototype.dispose=function(t,e){this._brushController&&this._brushController.dispose()},e.prototype._onBrush=function(t){var e=t.areas;if(t.isEnd&&e.length){var i={},n=this.ecModel;this._brushController.updateCovers([]),new j.Z($(this.model),n,{include:["grid"]}).matchOutputRanges(e,n,(function(t,e,i){if("cartesian2d"===i.type){var n=t.brushType;"rect"===n?(r("x",i,e[0]),r("y",i,e[1])):r({lineX:"x",lineY:"y"}[n],i,e)}})),function(t,e){var i=G(t);F(e,(function(e,n){for(var r=i.length-1;r>=0&&!i[r][n];r--);if(r<0){var o=t.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(o){var a=o.getPercentRange();i[0][n]={dataZoomId:n,start:a[0],end:a[1]}}}})),i.push(e)}(n,i),this._dispatchZoomAction(i)}function r(t,e,r){var o=e.getAxis(t),a=o.model,s=function(t,e,i){var n;return i.eachComponent({mainType:"dataZoom",subType:"select"},(function(i){i.getAxisModel(t,e.componentIndex)&&(n=i)})),n}(t,a,n),l=s.findRepresentativeAxisProxy(a).getMinMaxSpan();null==l.minValueSpan&&null==l.maxValueSpan||(r=(0,X.Z)(0,r.slice(),o.scale.getExtent(),0,l.minValueSpan,l.maxValueSpan)),s&&(i[s.id]={dataZoomId:s.id,startValue:r[0],endValue:r[1]})}},e.prototype._dispatchZoomAction=function(t){var e=[];q(t,(function(t,i){e.push(u.clone(t))})),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},e.getDefaultOption=function(t){return{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:t.getLocaleModel().get(["toolbox","dataZoom","title"]),brushStyle:{borderWidth:0,color:"rgba(210,219,238,0.2)"}}},e}(h.f1),Q={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(function(t){var e=G(t),i=e[e.length-1];e.length>1&&e.pop();var n={};return F(i,(function(t,i){for(var r=e.length-1;r>=0;r--)if(t=e[r][i]){n[i]=t;break}})),n}(this.ecModel))}};function $(t){var e={xAxisIndex:t.get("xAxisIndex",!0),yAxisIndex:t.get("yAxisIndex",!0),xAxisId:t.get("xAxisId",!0),yAxisId:t.get("yAxisId",!0)};return null==e.xAxisIndex&&null==e.xAxisId&&(e.xAxisIndex="all"),null==e.yAxisIndex&&null==e.yAxisId&&(e.yAxisIndex="all"),e}(0,Y.f)("dataZoom",(function(t){var e=t.getComponent("toolbox",0),i=["feature","dataZoom"];if(e&&null!=e.get(i)){var n=e.getModel(i),r=[],o=$(n),a=(0,M.pm)(t,o);return q(a.xAxisModels,(function(t){return s(t,"xAxis","xAxisIndex")})),q(a.yAxisModels,(function(t){return s(t,"yAxis","yAxisIndex")})),r}function s(t,e,i){var o=t.componentIndex,a={type:"select",$fromToolbox:!0,filterMode:n.get("filterMode",!0)||"filter",id:K+e+o};a[i]=o,r.push(a)}}));const tt=J;function et(t){t.registerComponentModel(c),t.registerComponentView(b),(0,h.ls)("saveAsImage",S),(0,h.ls)("magicType",D),(0,h.ls)("dataView",Z),(0,h.ls)("dataZoom",tt),(0,h.ls)("restore",U),(0,n.D)(l)}},7813:(t,e,i)=>{"use strict";i.d(e,{N:()=>$});var n=i(7037),r=i(8023),o=i(8299);const a=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,o.ZT)(e,t),e.type="tooltip",e.dependencies=["axisPointer"],e.defaultOption={z:60,show:!0,showContent:!0,trigger:"item",triggerOn:"mousemove|click",alwaysShowContent:!1,displayMode:"single",renderMode:"auto",confine:null,showDelay:0,hideDelay:100,transitionDuration:.4,enterable:!1,backgroundColor:"#fff",shadowBlur:10,shadowColor:"rgba(0, 0, 0, .2)",shadowOffsetX:1,shadowOffsetY:2,borderRadius:4,borderWidth:1,padding:null,extraCssText:"",axisPointer:{type:"line",axis:"auto",animation:"auto",animationDurationUpdate:200,animationEasingUpdate:"exponentialOut",crossStyle:{color:"#999",width:1,type:"dashed",textStyle:{}}},textStyle:{color:"#666",fontSize:14}},e}(i(8071).Z);var s=i(8760),l=i(7153),u=i(9186),h=i(4690),c=i(8988);function d(t){var e=t.get("confine");return null!=e?!!e:"richText"===t.get("renderMode")}function p(t){if(l.Z.domSupported)for(var e=document.documentElement.style,i=0,n=t.length;i-1?(h+="top:50%",d+="translateY(-50%) rotate("+(a="left"===l?-225:-45)+"deg)"):(h+="left:50%",d+="translateX(-50%) rotate("+(a="top"===l?225:45)+"deg)");var p=a*Math.PI/180,f=u+r,g=f*Math.abs(Math.cos(p))+f*Math.abs(Math.sin(p)),m=e+" solid "+r+"px;";return'
    '}(i,n,r)),(0,s.isString)(t))o.innerHTML=t+a;else if(t){o.innerHTML="",(0,s.isArray)(t)||(t=[t]);for(var l=0;l=0;o--){var a=t[o];a&&(a instanceof z.Z&&(a=a.get("tooltip",!0)),(0,s.isString)(a)&&(a={formatter:a}),a&&(n=new z.Z(a,n,r)))}return n}function K(t,e){return t.dispatchAction||(0,s.bind)(e.dispatchAction,e)}function J(t){return"center"===t||"middle"===t}const Q=function(t){function e(){var i=null!==t&&t.apply(this,arguments)||this;return i.type=e.type,i}return(0,o.ZT)(e,t),e.prototype.init=function(t,e){if(!l.Z.node&&e.getDom()){var i=t.getComponent("tooltip"),n=this._renderMode=(0,V.U9)(i.get("renderMode"));this._tooltipContent="richText"===n?new O(e):new M(e.getDom(),e,{appendToBody:i.get("appendToBody",!0)})}},e.prototype.render=function(t,e,i){if(!l.Z.node&&i.getDom()){this.group.removeAll(),this._tooltipModel=t,this._ecModel=e,this._api=i,this._alwaysShowContent=t.get("alwaysShowContent");var n=this._tooltipContent;n.update(t),n.setEnterable(t.get("enterable")),this._initGlobalListener(),this._keepShow(),"richText"!==this._renderMode&&t.get("transitionDuration")?(0,X.T9)(this,"_updatePosition",50,"fixRate"):(0,X.ZH)(this,"_updatePosition")}},e.prototype._initGlobalListener=function(){var t=this._tooltipModel.get("triggerOn");B.z("itemTooltip",this._api,(0,s.bind)((function(e,i,n){"none"!==t&&(t.indexOf(e)>=0?this._tryShow(i,n):"leave"===e&&this._hide(n))}),this))},e.prototype._keepShow=function(){var t=this._tooltipModel,e=this._ecModel,i=this._api,n=t.get("triggerOn");if(null!=this._lastX&&null!=this._lastY&&"none"!==n&&"click"!==n){var r=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout((function(){!i.isDisposed()&&r.manuallyShowTip(t,e,i,{x:r._lastX,y:r._lastY,dataByCoordSys:r._lastDataByCoordSys})}))}},e.prototype.manuallyShowTip=function(t,e,i,n){if(n.from!==this.uid&&!l.Z.node&&i.getDom()){var r=K(n,i);this._ticket="";var o=n.dataByCoordSys,a=function(t,e,i){var n=(0,V.zH)(t).queryOptionMap,r=n.keys()[0];if(!r||"series"===r)return;var o=(0,V.HZ)(e,r,n.get(r),{useDefault:!1,enableAll:!1,enableNone:!1}),a=o.models[0];if(!a)return;var s,l=i.getViewOfComponentModel(a);if(l.group.traverse((function(e){var i=(0,U.A)(e).tooltipConfig;if(i&&i.name===t.name)return s=e,!0})),s)return{componentMainType:r,componentIndex:a.componentIndex,el:s}}(n,e,i);if(a){var s=a.el.getBoundingRect().clone();s.applyTransform(a.el.transform),this._tryShow({offsetX:s.x+s.width/2,offsetY:s.y+s.height/2,target:a.el,position:n.position,positionDefault:"bottom"},r)}else if(n.tooltip&&null!=n.x&&null!=n.y){var u=Y;u.x=n.x,u.y=n.y,u.update(),(0,U.A)(u).tooltipConfig={name:null,option:n.tooltip},this._tryShow({offsetX:n.x,offsetY:n.y,target:u},r)}else if(o)this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,dataByCoordSys:o,tooltipOption:n.tooltipOption},r);else if(null!=n.seriesIndex){if(this._manuallyAxisShowTip(t,e,i,n))return;var h=(0,N.Z)(n,e),c=h.point[0],d=h.point[1];null!=c&&null!=d&&this._tryShow({offsetX:c,offsetY:d,target:h.el,position:n.position,positionDefault:"bottom"},r)}else null!=n.x&&null!=n.y&&(i.dispatchAction({type:"updateAxisPointer",x:n.x,y:n.y}),this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,target:i.getZr().findHover(n.x,n.y).target},r))}},e.prototype.manuallyHideTip=function(t,e,i,n){var r=this._tooltipContent;!this._alwaysShowContent&&this._tooltipModel&&r.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=this._lastDataByCoordSys=null,n.from!==this.uid&&this._hide(K(n,i))},e.prototype._manuallyAxisShowTip=function(t,e,i,n){var r=n.seriesIndex,o=n.dataIndex,a=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=r&&null!=o&&null!=a){var s=e.getSeriesByIndex(r);if(s)if("axis"===q([s.getData().getItemModel(o),s,(s.coordinateSystem||{}).model],this._tooltipModel).get("trigger"))return i.dispatchAction({type:"updateAxisPointer",seriesIndex:r,dataIndex:o,position:n.position}),!0}},e.prototype._tryShow=function(t,e){var i=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var n=t.dataByCoordSys;if(n&&n.length)this._showAxisTooltip(n,t);else if(i){var r,o;this._lastDataByCoordSys=null,(0,j.o)(i,(function(t){return null!=(0,U.A)(t).dataIndex?(r=t,!0):null!=(0,U.A)(t).tooltipConfig?(o=t,!0):void 0}),!0),r?this._showSeriesItemTooltip(t,r,e):o?this._showComponentItemTooltip(t,o,e):this._hide(e)}else this._lastDataByCoordSys=null,this._hide(e)}},e.prototype._showOrMove=function(t,e){var i=t.get("showDelay");e=(0,s.bind)(e,this),clearTimeout(this._showTimout),i>0?this._showTimout=setTimeout(e,i):e()},e.prototype._showAxisTooltip=function(t,e){var i=this._ecModel,n=this._tooltipModel,r=[e.offsetX,e.offsetY],o=q([e.tooltipOption],n),a=this._renderMode,l=[],u=(0,v.TX)("section",{blocks:[],noHeader:!0}),h=[],d=new v.iv;(0,s.each)(t,(function(t){(0,s.each)(t.dataByAxis,(function(t){var e=i.getComponent(t.axisDim+"Axis",t.axisIndex),r=t.value;if(e&&null!=r){var o=F.gk(r,e.axis,i,t.seriesDataIndices,t.valueLabelOpt),p=(0,v.TX)("section",{header:o,noHeader:!(0,s.trim)(o),sortBlocks:!0,blocks:[]});u.blocks.push(p),(0,s.each)(t.seriesDataIndices,(function(u){var f=i.getSeriesByIndex(u.seriesIndex),g=u.dataIndexInside,m=f.getDataParams(g);if(!(m.dataIndex<0)){m.axisDim=t.axisDim,m.axisIndex=t.axisIndex,m.axisType=t.axisType,m.axisId=t.axisId,m.axisValue=Z.DX(e.axis,{value:r}),m.axisValueLabel=o,m.marker=d.makeTooltipMarker("item",(0,c.Lz)(m.color),a);var v=(0,W.f)(f.formatTooltip(g,!0,null)),y=v.frag;if(y){var _=q([f],n).get("valueFormatter");p.blocks.push(_?(0,s.extend)({valueFormatter:_},y):y)}v.text&&h.push(v.text),l.push(m)}}))}}))})),u.blocks.reverse(),h.reverse();var p=e.position,f=o.get("order"),g=(0,v.BY)(u,d,a,f,i.get("useUTC"),o.get("textStyle"));g&&h.unshift(g);var m="richText"===a?"\n\n":"
    ",y=h.join(m);this._showOrMove(o,(function(){this._updateContentNotChangedOnAxis(t,l)?this._updatePosition(o,p,r[0],r[1],this._tooltipContent,l):this._showTooltipContent(o,y,l,Math.random()+"",r[0],r[1],p,null,d)}))},e.prototype._showSeriesItemTooltip=function(t,e,i){var n=this._ecModel,r=(0,U.A)(e),o=r.seriesIndex,a=n.getSeriesByIndex(o),l=r.dataModel||a,u=r.dataIndex,h=r.dataType,d=l.getData(h),p=this._renderMode,f=t.positionDefault,g=q([d.getItemModel(u),l,a&&(a.coordinateSystem||{}).model],this._tooltipModel,f?{position:f}:null),m=g.get("trigger");if(null==m||"item"===m){var y=l.getDataParams(u,h),_=new v.iv;y.marker=_.makeTooltipMarker("item",(0,c.Lz)(y.color),p);var x=(0,W.f)(l.formatTooltip(u,!1,h)),b=g.get("order"),w=g.get("valueFormatter"),S=x.frag,T=S?(0,v.BY)(w?(0,s.extend)({valueFormatter:w},S):S,_,p,b,n.get("useUTC"),g.get("textStyle")):x.text,M="item_"+l.name+"_"+u;this._showOrMove(g,(function(){this._showTooltipContent(g,T,y,M,t.offsetX,t.offsetY,t.position,t.target,_)})),i({type:"showTip",dataIndexInside:u,dataIndex:d.getRawIndex(u),seriesIndex:o,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,e,i){var n=(0,U.A)(e),r=n.tooltipConfig.option||{};if((0,s.isString)(r)){r={content:r,formatter:r}}var o=[r],a=this._ecModel.getComponent(n.componentMainType,n.componentIndex);a&&o.push(a),o.push({formatter:r.content});var l=t.positionDefault,u=q(o,this._tooltipModel,l?{position:l}:null),h=u.get("content"),c=Math.random()+"",d=new v.iv;this._showOrMove(u,(function(){var i=(0,s.clone)(u.get("formatterParams")||{});this._showTooltipContent(u,h,i,c,t.offsetX,t.offsetY,t.position,e,d)})),i({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,e,i,n,r,o,a,l,u){if(this._ticket="",t.get("showContent")&&t.get("show")){var h=this._tooltipContent;h.setEnterable(t.get("enterable"));var d=t.get("formatter");a=a||t.get("position");var p=e,f=this._getNearestPoint([r,o],i,t.get("trigger"),t.get("borderColor")).color;if(d)if((0,s.isString)(d)){var g=t.ecModel.get("useUTC"),m=(0,s.isArray)(i)?i[0]:i;p=d,m&&m.axisType&&m.axisType.indexOf("time")>=0&&(p=(0,H.WU)(m.axisValue,p,g)),p=(0,c.kF)(p,i,!0)}else if((0,s.isFunction)(d)){var v=(0,s.bind)((function(e,n){e===this._ticket&&(h.setContent(n,u,t,f,a),this._updatePosition(t,a,r,o,h,i,l))}),this);this._ticket=n,p=d(i,n,v)}else p=d;h.setContent(p,u,t,f,a),h.show(t,f),this._updatePosition(t,a,r,o,h,i,l)}},e.prototype._getNearestPoint=function(t,e,i,n){return"axis"===i||(0,s.isArray)(e)?{color:n||("html"===this._renderMode?"#fff":"none")}:(0,s.isArray)(e)?void 0:{color:n||e.color||e.borderColor}},e.prototype._updatePosition=function(t,e,i,n,r,o,a){var l=this._api.getWidth(),u=this._api.getHeight();e=e||t.get("position");var h=r.getSize(),c=t.get("align"),p=t.get("verticalAlign"),f=a&&a.getBoundingRect().clone();if(a&&f.applyTransform(a.transform),(0,s.isFunction)(e)&&(e=e([i,n],o,r.el,f,{viewSize:[l,u],contentSize:h.slice()})),(0,s.isArray)(e))i=(0,k.GM)(e[0],l),n=(0,k.GM)(e[1],u);else if((0,s.isObject)(e)){var g=e;g.width=h[0],g.height=h[1];var m=(0,R.ME)(g,{width:l,height:u});i=m.x,n=m.y,c=null,p=null}else if((0,s.isString)(e)&&a){var v=function(t,e,i,n){var r=i[0],o=i[1],a=Math.ceil(Math.SQRT2*n)+8,s=0,l=0,u=e.width,h=e.height;switch(t){case"inside":s=e.x+u/2-r/2,l=e.y+h/2-o/2;break;case"top":s=e.x+u/2-r/2,l=e.y-o-a;break;case"bottom":s=e.x+u/2-r/2,l=e.y+h+a;break;case"left":s=e.x-r-a,l=e.y+h/2-o/2;break;case"right":s=e.x+u+a,l=e.y+h/2-o/2}return[s,l]}(e,f,h,t.get("borderWidth"));i=v[0],n=v[1]}else{v=function(t,e,i,n,r,o,a){var s=i.getSize(),l=s[0],u=s[1];null!=o&&(t+l+o+2>n?t-=l+o:t+=o);null!=a&&(e+u+a>r?e-=u+a:e+=a);return[t,e]}(i,n,r,l,u,c?null:20,p?null:20);i=v[0],n=v[1]}if(c&&(i-=J(c)?h[0]/2:"right"===c?h[0]:0),p&&(n-=J(p)?h[1]/2:"bottom"===p?h[1]:0),d(t)){v=function(t,e,i,n,r){var o=i.getSize(),a=o[0],s=o[1];return t=Math.min(t+a,n)-a,e=Math.min(e+s,r)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}(i,n,r,l,u);i=v[0],n=v[1]}r.moveTo(i,n)},e.prototype._updateContentNotChangedOnAxis=function(t,e){var i=this._lastDataByCoordSys,n=this._cbParamsList,r=!!i&&i.length===t.length;return r&&(0,s.each)(i,(function(i,o){var a=i.dataByAxis||[],l=(t[o]||{}).dataByAxis||[];(r=r&&a.length===l.length)&&(0,s.each)(a,(function(t,i){var o=l[i]||{},a=t.seriesDataIndices||[],u=o.seriesDataIndices||[];(r=r&&t.value===o.value&&t.axisType===o.axisType&&t.axisId===o.axisId&&a.length===u.length)&&(0,s.each)(a,(function(t,e){var i=u[e];r=r&&t.seriesIndex===i.seriesIndex&&t.dataIndex===i.dataIndex})),n&&(0,s.each)(t.seriesDataIndices,(function(t){var i=t.seriesIndex,o=e[i],a=n[i];o&&a&&a.data!==o.data&&(r=!1)}))}))})),this._lastDataByCoordSys=t,this._cbParamsList=e,!!r},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,e){!l.Z.node&&e.getDom()&&((0,X.ZH)(this,"_updatePosition"),this._tooltipContent.dispose(),B.E("itemTooltip",e))},e.type="tooltip",e}(G.Z);function $(t){(0,r.D)(n.N),t.registerComponentModel(a),t.registerComponentView(Q),t.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},s.noop),t.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},s.noop)}},3993:(t,e,i)=>{"use strict";i.d(e,{w:()=>s});var n=i(8760),r=i(5685),o=i(8540),a=i(2234);function s(t){var e,i,s,l,u=t.series,h=t.dataIndex,c=t.multipleSeries,d=u.getData(),p=d.mapDimensionsAll("defaultedTooltip"),f=p.length,g=u.getRawValue(h),m=(0,n.isArray)(g),v=(0,r.jT)(u,h);if(f>1||m&&!f){var y=function(t,e,i,a,s){var l=e.getData(),u=(0,n.reduce)(t,(function(t,e,i){var n=l.getDimensionInfo(i);return t||n&&!1!==n.tooltip&&null!=n.displayName}),!1),h=[],c=[],d=[];function p(t,e){var i=l.getDimensionInfo(e);i&&!1!==i.otherDims.tooltip&&(u?d.push((0,r.TX)("nameValue",{markerType:"subItem",markerColor:s,name:i.displayName,value:t,valueType:i.type})):(h.push(t),c.push(i.type)))}return a.length?(0,n.each)(a,(function(t){p((0,o.hk)(l,i,t),t)})):(0,n.each)(t,p),{inlineValues:h,inlineValueTypes:c,blocks:d}}(g,u,h,p,v);e=y.inlineValues,i=y.inlineValueTypes,s=y.blocks,l=y.inlineValues[0]}else if(f){var _=d.getDimensionInfo(p[0]);l=e=(0,o.hk)(d,h,p[0]),i=_.type}else l=e=m?g[0]:g;var x=(0,a.yu)(u),b=x&&u.name||"",w=d.getName(h),S=c?b:w;return(0,r.TX)("section",{header:b,noHeader:c||!x,sortParam:l,blocks:[(0,r.TX)("nameValue",{markerType:"item",markerColor:v,name:S,noName:!(0,n.trim)(S),value:e,valueType:i})].concat(s||[])})}},5685:(t,e,i)=>{"use strict";i.d(e,{BY:()=>y,TX:()=>d,d_:()=>w,iv:()=>S,jT:()=>b});var n=i(4690),r=i(8988),o=i(8760),a=i(8407),s=i(5669),l="line-height:1";function u(t,e){var i=t.color||"#6e7079",r=t.fontSize||12,o=t.fontWeight||"400",a=t.color||"#464646",s=t.fontSize||14,l=t.fontWeight||"900";return"html"===e?{nameStyle:"font-size:"+(0,n.F1)(r+"")+"px;color:"+(0,n.F1)(i)+";font-weight:"+(0,n.F1)(o+""),valueStyle:"font-size:"+(0,n.F1)(s+"")+"px;color:"+(0,n.F1)(a)+";font-weight:"+(0,n.F1)(l+"")}:{nameStyle:{fontSize:r,fill:i,fontWeight:o},valueStyle:{fontSize:s,fill:a,fontWeight:l}}}var h=[0,10,20,30],c=["","\n","\n\n","\n\n\n"];function d(t,e){return e.type=t,e}function p(t){return"section"===t.type}function f(t){return p(t)?m:v}function g(t){if(p(t)){var e=0,i=t.blocks.length,n=i>1||i>0&&!t.noHeader;return(0,o.each)(t.blocks,(function(t){var i=g(t);i>=e&&(e=i+ +(n&&(!i||p(t)&&!t.noHeader)))})),e}return 0}function m(t,e,i,s){var d,p=e.noHeader,m=(d=g(e),{html:h[d],richText:c[d]}),v=[],y=e.blocks||[];(0,o.assert)(!y||(0,o.isArray)(y)),y=y||[];var b=t.orderMode;if(e.sortBlocks&&b){y=y.slice();var w={valueAsc:"asc",valueDesc:"desc"};if((0,o.hasOwn)(w,b)){var S=new a.ID(w[b],null);y.sort((function(t,e){return S.evaluate(t.sortParam,e.sortParam)}))}else"seriesDesc"===b&&y.reverse()}(0,o.each)(y,(function(i,n){var r=e.valueFormatter,a=f(i)(r?(0,o.extend)((0,o.extend)({},t),{valueFormatter:r}):t,i,n>0?m.html:0,s);null!=a&&v.push(a)}));var T="richText"===t.renderMode?v.join(m.richText):_(v.join(""),p?i:m.html);if(p)return T;var M=(0,r.uX)(e.header,"ordinal",t.useUTC),C=u(s,t.renderMode).nameStyle;return"richText"===t.renderMode?x(t,M,C)+m.richText+T:_('
    '+(0,n.F1)(M)+"
    "+T,i)}function v(t,e,i,a){var s=t.renderMode,l=e.noName,h=e.noValue,c=!e.markerType,d=e.name,p=t.useUTC,f=e.valueFormatter||t.valueFormatter||function(t){return t=(0,o.isArray)(t)?t:[t],(0,o.map)(t,(function(t,e){return(0,r.uX)(t,(0,o.isArray)(v)?v[e]:v,p)}))};if(!l||!h){var g=c?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",s),m=l?"":(0,r.uX)(d,"ordinal",p),v=e.valueType,y=h?[]:f(e.value),b=!c||!l,w=!c&&l,S=u(a,s),T=S.nameStyle,M=S.valueStyle;return"richText"===s?(c?"":g)+(l?"":x(t,m,T))+(h?"":function(t,e,i,n,r){var a=[r],s=n?10:20;return i&&a.push({padding:[0,0,0,s],align:"right"}),t.markupStyleCreator.wrapRichTextStyle((0,o.isArray)(e)?e.join(" "):e,a)}(t,y,b,w,M)):_((c?"":g)+(l?"":function(t,e,i){return''+(0,n.F1)(t)+""}(m,!c,T))+(h?"":function(t,e,i,r){var a=i?"10px":"20px",s=e?"float:right;margin-left:"+a:"";return t=(0,o.isArray)(t)?t:[t],''+(0,o.map)(t,(function(t){return(0,n.F1)(t)})).join("  ")+""}(y,b,w,M)),i)}}function y(t,e,i,n,r,o){if(t)return f(t)({useUTC:r,renderMode:i,orderMode:n,markupStyleCreator:e,valueFormatter:t.valueFormatter},t,0,o)}function _(t,e){return'
    '+t+'
    '}function x(t,e,i){return t.markupStyleCreator.wrapRichTextStyle(e,i)}function b(t,e){var i=t.getData().getItemVisual(e,"style")[t.visualDrawType];return(0,r.Lz)(i)}function w(t,e){var i=t.get("padding");return null!=i?i:"richText"===e?[8,10]:10}var S=function(){function t(){this.richTextStyles={},this._nextStyleNameId=(0,s.jj)()}return t.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},t.prototype.makeTooltipMarker=function(t,e,i){var n="richText"===i?this._generateStyleName():null,a=(0,r.A0)({color:e,type:t,renderMode:i,markerId:n});return(0,o.isString)(a)?a:(this.richTextStyles[n]=a.style,a.content)},t.prototype.wrapRichTextStyle=function(t,e){var i={};(0,o.isArray)(e)?(0,o.each)(e,(function(t){return(0,o.extend)(i,t)})):(0,o.extend)(i,e);var n=this._generateStyleName();return this.richTextStyles[n]=i,"{"+n+"|"+t+"}"},t}()},2950:(t,e,i)=>{"use strict";i.d(e,{Z:()=>_});var n=i(8760),r=i(5669),o=i(9979),a=i(2234),s=i(7947),l=(0,a.Yf)();function u(t){return"category"===t.type?function(t){var e=t.getLabelModel(),i=c(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:i.labelCategoryInterval}:i}(t):function(t){var e=t.scale.getTicks(),i=(0,s.J9)(t);return{labels:n.map(e,(function(e,n){return{level:e.level,formattedLabel:i(e,n),rawLabel:t.scale.getLabel(e),tickValue:e.value}}))}}(t)}function h(t,e){return"category"===t.type?function(t,e){var i,r,o=d(t,"ticks"),a=(0,s.rk)(e),l=p(o,a);if(l)return l;e.get("show")&&!t.scale.isBlank()||(i=[]);if(n.isFunction(a))i=m(t,a,!0);else if("auto"===a){var u=c(t,t.getLabelModel());r=u.labelCategoryInterval,i=n.map(u.labels,(function(t){return t.tickValue}))}else i=g(t,r=a,!0);return f(o,a,{ticks:i,tickCategoryInterval:r})}(t,e):{ticks:n.map(t.scale.getTicks(),(function(t){return t.value}))}}function c(t,e){var i,r,o=d(t,"labels"),a=(0,s.rk)(e),u=p(o,a);return u||(n.isFunction(a)?i=m(t,a):(r="auto"===a?function(t){var e=l(t).autoInterval;return null!=e?e:l(t).autoInterval=t.calculateCategoryInterval()}(t):a,i=g(t,r)),f(o,a,{labels:i,labelCategoryInterval:r}))}function d(t,e){return l(t)[e]||(l(t)[e]=[])}function p(t,e){for(var i=0;i1&&c/u>2&&(h=Math.round(Math.ceil(h/u)*u));var d=(0,s.WY)(t),p=a.get("showMinLabel")||d,f=a.get("showMaxLabel")||d;p&&h!==o[0]&&m(o[0]);for(var g=h;g<=o[1];g+=u)m(g);function m(t){var e={value:t};l.push(i?t:{formattedLabel:n(e),rawLabel:r.getLabel(e),tickValue:t})}return f&&g-u!==o[1]&&m(o[1]),l}function m(t,e,i){var r=t.scale,o=(0,s.J9)(t),a=[];return n.each(r.getTicks(),(function(t){var n=r.getLabel(t),s=t.value;e(t.value,n)&&a.push(i?s:{formattedLabel:o(t),rawLabel:n,tickValue:s})})),a}var v=[0,1];function y(t,e){var i=(t[1]-t[0])/e/2;t[0]+=i,t[1]-=i}const _=function(){function t(t,e,i){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=e,this._extent=i||[0,0]}return t.prototype.contain=function(t){var e=this._extent,i=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return t>=i&&t<=n},t.prototype.containData=function(t){return this.scale.contain(t)},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.getPixelPrecision=function(t){return(0,r.M9)(t||this.scale.getExtent(),this._extent)},t.prototype.setExtent=function(t,e){var i=this._extent;i[0]=t,i[1]=e},t.prototype.dataToCoord=function(t,e){var i=this._extent,n=this.scale;return t=n.normalize(t),this.onBand&&"ordinal"===n.type&&y(i=i.slice(),n.count()),(0,r.NU)(t,v,i,e)},t.prototype.coordToData=function(t,e){var i=this._extent,n=this.scale;this.onBand&&"ordinal"===n.type&&y(i=i.slice(),n.count());var o=(0,r.NU)(t,i,v,e);return this.scale.scale(o)},t.prototype.pointToData=function(t,e){},t.prototype.getTicksCoords=function(t){var e=(t=t||{}).tickModel||this.getTickModel(),i=h(this,e).ticks,o=(0,n.map)(i,(function(t){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(t):t),tickValue:t}}),this);return function(t,e,i,o){var a=e.length;if(!t.onBand||i||!a)return;var s,l,u=t.getExtent();if(1===a)e[0].coord=u[0],s=e[1]={coord:u[0]};else{var h=e[a-1].tickValue-e[0].tickValue,c=(e[a-1].coord-e[0].coord)/h;(0,n.each)(e,(function(t){t.coord-=c/2})),l=1+t.scale.getExtent()[1]-e[a-1].tickValue,s={coord:e[a-1].coord+c*l},e.push(s)}var d=u[0]>u[1];p(e[0].coord,u[0])&&(o?e[0].coord=u[0]:e.shift());o&&p(u[0],e[0].coord)&&e.unshift({coord:u[0]});p(u[1],s.coord)&&(o?s.coord=u[1]:e.pop());o&&p(s.coord,u[1])&&e.push({coord:u[1]});function p(t,e){return t=(0,r.NM)(t),e=(0,r.NM)(e),d?t>e:t0&&t<100||(t=5);var e=this.scale.getMinorTicks(t);return(0,n.map)(e,(function(t){return(0,n.map)(t,(function(t){return{coord:this.dataToCoord(t),tickValue:t}}),this)}),this)},t.prototype.getViewLabels=function(){return u(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")},t.prototype.getTickModel=function(){return this.model.getModel("axisTick")},t.prototype.getBandWidth=function(){var t=this._extent,e=this.scale.getExtent(),i=e[1]-e[0]+(this.onBand?1:0);0===i&&(i=1);var n=Math.abs(t[1]-t[0]);return Math.abs(n)/i},t.prototype.calculateCategoryInterval=function(){return function(t){var e=function(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}(t),i=(0,s.J9)(t),n=(e.axisRotate-e.labelRotate)/180*Math.PI,r=t.scale,a=r.getExtent(),u=r.count();if(a[1]-a[0]<1)return 0;var h=1;u>40&&(h=Math.max(1,Math.floor(u/40)));for(var c=a[0],d=t.dataToCoord(c+1)-t.dataToCoord(c),p=Math.abs(d*Math.cos(n)),f=Math.abs(d*Math.sin(n)),g=0,m=0;c<=a[1];c+=h){var v,y,_=o.lP(i({value:c}),e.font,"center","top");v=1.3*_.width,y=1.3*_.height,g=Math.max(g,v,7),m=Math.max(m,y,7)}var x=g/p,b=m/f;isNaN(x)&&(x=1/0),isNaN(b)&&(b=1/0);var w=Math.max(0,Math.floor(Math.min(x,b))),S=l(t.model),T=t.getExtent(),M=S.lastAutoInterval,C=S.lastTickCount;return null!=M&&null!=C&&Math.abs(M-w)<=1&&Math.abs(C-u)<=1&&M>w&&S.axisExtent0===T[0]&&S.axisExtent1===T[1]?w=M:(S.lastTickCount=u,S.lastAutoInterval=w,S.axisExtent0=T[0],S.axisExtent1=T[1]),w}(this)},t}()},3845:(t,e,i)=>{"use strict";i.d(e,{Z:()=>c});var n=i(8299),r=i(1362),o=i(4247),a=i(641),s=i(4995),l=i(5669),u=r.applyTransform;function h(t){var e=t.seriesModel;return e?e.coordinateSystem:null}const c=function(t){function e(e){var i=t.call(this)||this;return i.type="view",i.dimensions=["x","y"],i._roamTransformable=new s.ZP,i._rawTransformable=new s.ZP,i.name=e,i}return(0,n.ZT)(e,t),e.prototype.setBoundingRect=function(t,e,i,n){return this._rect=new a.Z(t,e,i,n),this._rect},e.prototype.getBoundingRect=function(){return this._rect},e.prototype.setViewRect=function(t,e,i,n){this._transformTo(t,e,i,n),this._viewRect=new a.Z(t,e,i,n)},e.prototype._transformTo=function(t,e,i,n){var r=this.getBoundingRect(),o=this._rawTransformable;o.transform=r.calculateTransform(new a.Z(t,e,i,n));var s=o.parent;o.parent=null,o.decomposeTransform(),o.parent=s,this._updateTransform()},e.prototype.setCenter=function(t,e){t&&(this._center=[(0,l.GM)(t[0],e.getWidth()),(0,l.GM)(t[1],e.getHeight())],this._updateCenterAndZoom())},e.prototype.setZoom=function(t){t=t||1;var e=this.zoomLimit;e&&(null!=e.max&&(t=Math.min(e.max,t)),null!=e.min&&(t=Math.max(e.min,t))),this._zoom=t,this._updateCenterAndZoom()},e.prototype.getDefaultCenter=function(){var t=this.getBoundingRect();return[t.x+t.width/2,t.y+t.height/2]},e.prototype.getCenter=function(){return this._center||this.getDefaultCenter()},e.prototype.getZoom=function(){return this._zoom||1},e.prototype.getRoamTransform=function(){return this._roamTransformable.getLocalTransform()},e.prototype._updateCenterAndZoom=function(){var t=this._rawTransformable.getLocalTransform(),e=this._roamTransformable,i=this.getDefaultCenter(),n=this.getCenter(),o=this.getZoom();n=r.applyTransform([],n,t),i=r.applyTransform([],i,t),e.originX=n[0],e.originY=n[1],e.x=i[0]-n[0],e.y=i[1]-n[1],e.scaleX=e.scaleY=o,this._updateTransform()},e.prototype._updateTransform=function(){var t=this._roamTransformable,e=this._rawTransformable;e.parent=t,t.updateTransform(),e.updateTransform(),o.copy(this.transform||(this.transform=[]),e.transform||o.create()),this._rawTransform=e.getLocalTransform(),this.invTransform=this.invTransform||[],o.invert(this.invTransform,this.transform),this.decomposeTransform()},e.prototype.getTransformInfo=function(){var t=this._rawTransformable,e=this._roamTransformable,i=new s.ZP;return i.transform=e.transform,i.decomposeTransform(),{roam:{x:i.x,y:i.y,scaleX:i.scaleX,scaleY:i.scaleY},raw:{x:t.x,y:t.y,scaleX:t.scaleX,scaleY:t.scaleY}}},e.prototype.getViewRect=function(){return this._viewRect},e.prototype.getViewRectAfterRoam=function(){var t=this.getBoundingRect().clone();return t.applyTransform(this.transform),t},e.prototype.dataToPoint=function(t,e,i){var n=e?this._rawTransform:this.transform;return i=i||[],n?u(i,t,n):r.copy(i,t)},e.prototype.pointToData=function(t){var e=this.invTransform;return e?u([],t,e):[t[0],t[1]]},e.prototype.convertToPixel=function(t,e,i){var n=h(e);return n===this?n.dataToPoint(i):null},e.prototype.convertFromPixel=function(t,e,i){var n=h(e);return n===this?n.pointToData(i):null},e.prototype.containPoint=function(t){return this.getViewRectAfterRoam().contain(t[0],t[1])},e.dimensions=["x","y"],e}(s.ZP)},7947:(t,e,i)=>{"use strict";i.d(e,{aG:()=>L,Do:()=>O,DX:()=>P,PY:()=>N,rk:()=>k,Xv:()=>C,Yb:()=>I,J9:()=>D,Jk:()=>A,WY:()=>E,AH:()=>R});var n=i(8760),r=i(5043),o=i(103),a=i(379),s=i(9093),l=i(641),u=i(1618),h=i(8299),c=i(5669),d=i(5021),p=a.Z.prototype,f=o.Z.prototype,g=c.NM,m=Math.floor,v=Math.ceil,y=Math.pow,_=Math.log,x=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e.base=10,e._originalScale=new o.Z,e._interval=0,e}return(0,h.ZT)(e,t),e.prototype.getTicks=function(t){var e=this._originalScale,i=this._extent,r=e.getExtent(),o=f.getTicks.call(this,t);return n.map(o,(function(t){var e=t.value,n=c.NM(y(this.base,e));return n=e===i[0]&&this._fixMin?w(n,r[0]):n,{value:n=e===i[1]&&this._fixMax?w(n,r[1]):n}}),this)},e.prototype.setExtent=function(t,e){var i=_(this.base);t=_(Math.max(0,t))/i,e=_(Math.max(0,e))/i,f.setExtent.call(this,t,e)},e.prototype.getExtent=function(){var t=this.base,e=p.getExtent.call(this);e[0]=y(t,e[0]),e[1]=y(t,e[1]);var i=this._originalScale.getExtent();return this._fixMin&&(e[0]=w(e[0],i[0])),this._fixMax&&(e[1]=w(e[1],i[1])),e},e.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=_(t[0])/_(e),t[1]=_(t[1])/_(e),p.unionExtent.call(this,t)},e.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},e.prototype.calcNiceTicks=function(t){t=t||10;var e=this._extent,i=e[1]-e[0];if(!(i===1/0||i<=0)){var n=c.Xd(i);for(t/i*n<=.5&&(n*=10);!isNaN(n)&&Math.abs(n)<1&&Math.abs(n)>0;)n*=10;var r=[c.NM(v(e[0]/n)*n),c.NM(m(e[1]/n)*n)];this._interval=n,this._niceExtent=r}},e.prototype.calcNiceExtent=function(t){f.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return t=_(t)/_(this.base),d.XS(t,this._extent)},e.prototype.normalize=function(t){return t=_(t)/_(this.base),d.Fv(t,this._extent)},e.prototype.scale=function(t){return t=d.bA(t,this._extent),y(this.base,t)},e.type="log",e}(a.Z),b=x.prototype;function w(t,e){return g(t,c.p8(e))}b.getMinorTicks=f.getMinorTicks,b.getLabel=f.getLabel,a.Z.registerClass(x);const S=x;var T=i(9936),M=i(8986);function C(t,e){var i=t.type,r=(0,M.Qw)(t,e,t.getExtent()).calculate();t.setBlank(r.isBlank);var o=r.min,a=r.max,l=e.ecModel;if(l&&"time"===i){var u=(0,s.Ge)("bar",l),h=!1;if(n.each(u,(function(t){h=h||t.getBaseAxis()===e.axis})),h){var c=(0,s.My)(u),d=function(t,e,i,r){var o=i.axis.getExtent(),a=o[1]-o[0],l=(0,s.G_)(r,i.axis);if(void 0===l)return{min:t,max:e};var u=1/0;n.each(l,(function(t){u=Math.min(t.offset,u)}));var h=-1/0;n.each(l,(function(t){h=Math.max(t.offset+t.width,h)})),u=Math.abs(u),h=Math.abs(h);var c=u+h,d=e-t,p=d/(1-(u+h)/a)-d;return e+=p*(h/c),t-=p*(u/c),{min:t,max:e}}(o,a,e,c);o=d.min,a=d.max}}return{extent:[o,a],fixMin:r.minFixed,fixMax:r.maxFixed}}function A(t,e){var i=e,n=C(t,i),r=n.extent,o=i.get("splitNumber");t instanceof S&&(t.base=i.get("logBase"));var a=t.type,s=i.get("interval"),l="interval"===a||"time"===a;t.setExtent(r[0],r[1]),t.calcNiceExtent({splitNumber:o,fixMin:n.fixMin,fixMax:n.fixMax,minInterval:l?i.get("minInterval"):null,maxInterval:l?i.get("maxInterval"):null}),null!=s&&t.setInterval&&t.setInterval(s)}function L(t,e){if(e=e||t.get("type"))switch(e){case"category":return new r.Z({ordinalMeta:t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),extent:[1/0,-1/0]});case"time":return new u.Z({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default:return new(a.Z.getClass(e)||o.Z)}}function I(t){var e=t.scale.getExtent(),i=e[0],n=e[1];return!(i>0&&n>0||i<0&&n<0)}function D(t){var e,i,r=t.getLabelModel().get("formatter"),o="category"===t.type?t.scale.getExtent()[0]:null;return"time"===t.scale.type?(i=r,function(e,n){return t.scale.getFormattedLabel(e,n,i)}):n.isString(r)?function(e){return function(i){var n=t.scale.getLabel(i);return e.replace("{value}",null!=n?n:"")}}(r):n.isFunction(r)?(e=r,function(i,n){return null!=o&&(n=i.value-o),e(P(t,i),n,null!=i.level?{level:i.level}:null)}):function(e){return t.scale.getLabel(e)}}function P(t,e){return"category"===t.type?t.scale.getLabel(e):e.value}function O(t){var e=t.model,i=t.scale;if(e.get(["axisLabel","show"])&&!i.isBlank()){var n,o,a=i.getExtent();o=i instanceof r.Z?i.count():(n=i.getTicks()).length;var s,u,h,c,d,p,f,g,m=t.getLabelModel(),v=D(t),y=1;o>40&&(y=Math.ceil(o/40));for(var _=0;_t[1]&&(t[1]=n[1])}))}},6650:(t,e,i)=>{"use strict";i.d(e,{W:()=>n});var n=function(){function t(){}return t.prototype.getNeedCrossZero=function(){return!this.option.scale},t.prototype.getCoordSysModel=function(){},t}()},9069:(t,e,i)=>{"use strict";i.d(e,{Mk:()=>s,Yh:()=>a,bK:()=>o});var n=i(8760),r=i(2234);function o(t,e,i){i=i||{};var r=t.coordinateSystem,o=e.axis,a={},s=o.getAxesOnZeroOf()[0],l=o.position,u=s?"onZero":l,h=o.dim,c=r.getRect(),d=[c.x,c.x+c.width,c.y,c.y+c.height],p={left:0,right:1,top:0,bottom:1,onZero:2},f=e.get("offset")||0,g="x"===h?[d[2]-f,d[3]+f]:[d[0]-f,d[1]+f];if(s){var m=s.toGlobalCoord(s.dataToCoord(0));g[p.onZero]=Math.max(Math.min(m,g[1]),g[0])}a.position=["y"===h?g[p[u]]:d[0],"x"===h?g[p[u]]:d[3]],a.rotation=Math.PI/2*("x"===h?0:1);a.labelDirection=a.tickDirection=a.nameDirection={top:-1,bottom:1,left:-1,right:1}[l],a.labelOffset=s?g[p[l]]-g[p.onZero]:0,e.get(["axisTick","inside"])&&(a.tickDirection=-a.tickDirection),n.retrieve(i.labelInside,e.get(["axisLabel","inside"]))&&(a.labelDirection=-a.labelDirection);var v=e.get(["axisLabel","rotate"]);return a.labelRotate="top"===u?-v:v,a.z2=1,a}function a(t){return"cartesian2d"===t.get("coordinateSystem")}function s(t){var e={xAxisModel:null,yAxisModel:null};return n.each(e,(function(i,n){var o=n.replace(/Model$/,""),a=t.getReferringComponents(o,r.C6).models[0];e[n]=a})),e}},4215:(t,e,i)=>{"use strict";i.d(e,{Im:()=>m,Ni:()=>g,Qh:()=>p,jM:()=>f});var n=i(8299),r=i(641),o=i(1362),a=i(4564),s=i(4247),l=i(8760),u=[];function h(t,e){for(var i=0;ii&&(t=r,i=a)}if(t)return function(t){for(var e=0,i=0,n=0,r=t.length,o=t[r-1][0],a=t[r-1][1],s=0;s{"use strict";i.d(e,{Z:()=>s});var n=i(8760),r=i(4215);function o(t,e,i){for(var n=0;n>1^-(1&s),l=l>>1^-(1&l),r=s+=r,o=l+=o,n.push([s/i,l/i])}return n}function s(t,e){return t=function(t){if(!t.UTF8Encoding)return t;var e=t,i=e.UTF8Scale;null==i&&(i=1024);var r=e.features;return n.each(r,(function(t){var e=t.geometry,r=e.encodeOffsets,s=e.coordinates;if(r)switch(e.type){case"LineString":e.coordinates=a(s,r,i);break;case"Polygon":case"MultiLineString":o(s,r,i);break;case"MultiPolygon":n.each(s,(function(t,e){return o(t,r[e],i)}))}})),e.UTF8Encoding=!1,e}(t),n.map(n.filter(t.features,(function(t){return t.geometry&&t.properties&&t.geometry.coordinates.length>0})),(function(t){var i=t.properties,o=t.geometry,a=[];switch(o.type){case"Polygon":var s=o.coordinates;a.push(new r.Qh(s[0],s.slice(1)));break;case"MultiPolygon":n.each(o.coordinates,(function(t){t[0]&&a.push(new r.Qh(t[0],t.slice(1)))}));break;case"LineString":a.push(new r.jM([o.coordinates]));break;case"MultiLineString":a.push(new r.jM(o.coordinates))}var l=new r.Ni(i[e||"name"],a,i.cp);return l.properties=i,l}))}},8986:(t,e,i)=>{"use strict";i.d(e,{Qw:()=>l});var n=i(8760),r=i(9979),o=function(){function t(t,e,i){this._prepareParams(t,e,i)}return t.prototype._prepareParams=function(t,e,i){i[1]0&&l>0&&!u&&(s=0),s<0&&l<0&&!h&&(l=0));var d=this._determinedMin,p=this._determinedMax;return null!=d&&(s=d,u=!0),null!=p&&(l=p,h=!0),{min:s,max:l,minFixed:u,maxFixed:h,isBlank:c}},t.prototype.modifyDataMinMax=function(t,e){this[s[t]]=e},t.prototype.setDeterminedMinMax=function(t,e){this[a[t]]=e},t.prototype.freeze=function(){this.frozen=!0},t}(),a={min:"_determinedMin",max:"_determinedMax"},s={min:"_dataMin",max:"_dataMax"};function l(t,e,i){var n=t.rawExtentInfo;return n||(n=new o(t,e,i),t.rawExtentInfo=n,n)}function u(t,e){return null==e?null:(0,n.eqNaN)(e)?NaN:t.parse(e)}},4267:(t,e,i)=>{"use strict";i.d(e,{Z:()=>o});var n=i(8760),r={};const o=function(){function t(){this._coordinateSystems=[]}return t.prototype.create=function(t,e){var i=[];n.each(r,(function(n,r){var o=n.create(t,e);i=i.concat(o||[])})),this._coordinateSystems=i},t.prototype.update=function(t,e){n.each(this._coordinateSystems,(function(i){i.update&&i.update(t,e)}))},t.prototype.getCoordinateSystems=function(){return this._coordinateSystems.slice()},t.register=function(t,e){r[t]=e},t.get=function(t){return r[t]},t}()},1615:(t,e,i)=>{"use strict";i.d(e,{Hr:()=>be,$j:()=>pi,Ok:()=>zi,HO:()=>ye,eU:()=>fi,zP:()=>gi,B9:()=>mi,wL:()=>Ai,JE:()=>vi,rp:()=>yi,FU:()=>Ni,S1:()=>di,zl:()=>Mi,RS:()=>Ci,qR:()=>Li,yn:()=>Oi,I2:()=>he.I2,je:()=>Ei,sq:()=>wi,Br:()=>Si,ds:()=>xi,Pu:()=>bi,aW:()=>_i,OB:()=>Ri,YK:()=>Ti,Og:()=>Ii,jQ:()=>ki,i8:()=>ve});var n=i(8299),r=i(2780),o=i(8760),a=i(7153),s=i(6816),l=i(1935),u=i(2234),h=i(1497),c=i(8071),d="";"undefined"!=typeof navigator&&(d=navigator.platform||"");var p="rgba(0, 0, 0, 0.2)";const f={darkMode:"auto",colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:p,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:p,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:p,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:p,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:p,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:p,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}},textStyle:{fontFamily:d.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 g,m,v,y=i(1772),_=i(2468),x=i(5494),b="\0_ec_inner";var w=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,n.ZT)(e,t),e.prototype.init=function(t,e,i,n,r,o){n=n||{},this.option=null,this._theme=new h.Z(n),this._locale=new h.Z(r),this._optionManager=o},e.prototype.setOption=function(t,e,i){var n=M(e);this._optionManager.setOption(t,i,n),this._resetOption(null,n)},e.prototype.resetOption=function(t,e){return this._resetOption(t,M(e))},e.prototype._resetOption=function(t,e){var i=!1,n=this._optionManager;if(!t||"recreate"===t){var r=n.mountOption("recreate"===t);0,this.option&&"recreate"!==t?(this.restoreData(),this._mergeOption(r,e)):v(this,r),i=!0}if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var a=n.getTimelineOption(this);a&&(i=!0,this._mergeOption(a,e))}if(!t||"recreate"===t||"media"===t){var s=n.getMediaOption(this);s.length&&(0,o.each)(s,(function(t){i=!0,this._mergeOption(t,e)}),this)}return i},e.prototype.mergeOption=function(t){this._mergeOption(t,null)},e.prototype._mergeOption=function(t,e){var i=this.option,n=this._componentsMap,r=this._componentsCount,a=[],s=(0,o.createHashMap)(),l=e&&e.replaceMergeMainTypeMap;(0,y.md)(this),(0,o.each)(t,(function(t,e){null!=t&&(c.Z.hasClass(e)?e&&(a.push(e),s.set(e,!0)):i[e]=null==i[e]?(0,o.clone)(t):(0,o.merge)(i[e],t,!0))})),l&&l.each((function(t,e){c.Z.hasClass(e)&&!s.get(e)&&(a.push(e),s.set(e,!0))})),c.Z.topologicalTravel(a,c.Z.getAllClassMainTypes(),(function(e){var a=(0,_.R)(this,e,u.kF(t[e])),s=n.get(e),h=s?l&&l.get(e)?"replaceMerge":"normalMerge":"replaceAll",d=u.ab(s,a,h);u.O0(d,e,c.Z),i[e]=null,n.set(e,null),r.set(e,0);var p,f=[],m=[],v=0;(0,o.each)(d,(function(t,i){var n=t.existing,r=t.newOption;if(r){var a="series"===e,s=c.Z.getClass(e,t.keyInfo.subType,!a);if(!s)return;if("tooltip"===e){if(p)return void 0;p=!0}if(n&&n.constructor===s)n.name=t.keyInfo.name,n.mergeOption(r,this),n.optionUpdated(r,!1);else{var l=(0,o.extend)({componentIndex:i},t.keyInfo);n=new s(r,this,this,l),(0,o.extend)(n,l),t.brandNew&&(n.__requireNewView=!0),n.init(r,this,this),n.optionUpdated(null,!0)}}else n&&(n.mergeOption({},this),n.optionUpdated({},!1));n?(f.push(n.option),m.push(n),v++):(f.push(void 0),m.push(void 0))}),this),i[e]=f,n.set(e,m),r.set(e,v),"series"===e&&g(this)}),this),this._seriesIndices||g(this)},e.prototype.getOption=function(){var t=(0,o.clone)(this.option);return(0,o.each)(t,(function(e,i){if(c.Z.hasClass(i)){for(var n=u.kF(e),r=n.length,o=!1,a=r-1;a>=0;a--)n[a]&&!u.lY(n[a])?o=!0:(n[a]=null,!o&&r--);n.length=r,t[i]=n}})),delete t[b],t},e.prototype.getTheme=function(){return this._theme},e.prototype.getLocaleModel=function(){return this._locale},e.prototype.setUpdatePayload=function(t){this._payload=t},e.prototype.getUpdatePayload=function(){return this._payload},e.prototype.getComponent=function(t,e){var i=this._componentsMap.get(t);if(i){var n=i[e||0];if(n)return n;if(null==e)for(var r=0;r=e:"max"===i?t<=e:t===e})(n[a],t,o)||(r=!1)}})),r}const k=P;var E=o.each,N=o.isObject,R=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function z(t){var e=t&&t.itemStyle;if(e)for(var i=0,n=R.length;i=0;g--){var m=t[g];if(s||(d=m.data.rawIndexOf(m.stackedByDimension,c)),d>=0){var v=m.data.getByRawIndex(m.stackResultDimension,d);if("all"===l||"positive"===l&&v>0||"negative"===l&&v<0||"samesign"===l&&p>=0&&v>0||"samesign"===l&&p<=0&&v<0){p=(0,tt.S$)(p,v),f=v;break}}}return n[0]=p,n[1]=f,n}))}))}var it=i(3321),nt=i(3166),rt=i(5797),ot=i(56),at=i(4276),st=i(4292),lt=i(8751),ut=i(106),ht=i(6357),ct=i(270),dt=i(9066),pt=i(9887),ft=i(7515),gt=(0,u.Yf)(),mt={itemStyle:(0,dt.Z)(pt.t,!0),lineStyle:(0,dt.Z)(ft.v,!0)},vt={lineStyle:"stroke",itemStyle:"fill"};function yt(t,e){var i=t.visualStyleMapper||mt[e];return i||(console.warn("Unkown style type '"+e+"'."),mt.itemStyle)}function _t(t,e){var i=t.visualDrawType||vt[e];return i||(console.warn("Unkown style type '"+e+"'."),"fill")}var xt={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var i=t.getData(),n=t.visualStyleAccessPath||"itemStyle",r=t.getModel(n),a=yt(t,n)(r),s=r.getShallow("decal");s&&(i.setVisual("decal",s),s.dirty=!0);var l=_t(t,n),u=a[l],h=(0,o.isFunction)(u)?u:null,c="auto"===a.fill||"auto"===a.stroke;if(!a[l]||h||c){var d=t.getColorFromPalette(t.name,null,e.getSeriesCount());a[l]||(a[l]=d,i.setVisual("colorFromPalette",!0)),a.fill="auto"===a.fill||(0,o.isFunction)(a.fill)?d:a.fill,a.stroke="auto"===a.stroke||(0,o.isFunction)(a.stroke)?d:a.stroke}if(i.setVisual("style",a),i.setVisual("drawType",l),!e.isSeriesFiltered(t)&&h)return i.setVisual("colorFromPalette",!1),{dataEach:function(e,i){var n=t.getDataParams(i),r=(0,o.extend)({},a);r[l]=h(n),e.setItemVisual(i,"style",r)}}}},bt=new h.Z,wt={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.ignoreStyleOnData&&!e.isSeriesFiltered(t)){var i=t.getData(),n=t.visualStyleAccessPath||"itemStyle",r=yt(t,n),a=i.getVisual("drawType");return{dataEach:i.hasItemOption?function(t,e){var i=t.getRawDataItem(e);if(i&&i[n]){bt.option=i[n];var s=r(bt),l=t.ensureUniqueItemVisual(e,"style");(0,o.extend)(l,s),bt.option.decal&&(t.setItemVisual(e,"decal",bt.option.decal),bt.option.decal.dirty=!0),a in s&&t.setItemVisual(e,"colorFromPalette",!1)}}:null}}}},St={performRawSeries:!0,overallReset:function(t){var e=(0,o.createHashMap)();t.eachSeries((function(t){var i=t.getColorBy();if(!t.isColorBySeries()){var n=t.type+"-"+i,r=e.get(n);r||(r={},e.set(n,r)),gt(t).scope=r}})),t.eachSeries((function(e){if(!e.isColorBySeries()&&!t.isSeriesFiltered(e)){var i=e.getRawData(),n={},r=e.getData(),o=gt(e).scope,a=e.visualStyleAccessPath||"itemStyle",s=_t(e,a);r.each((function(t){var e=r.getRawIndex(t);n[e]=t})),i.each((function(t){var a=n[t];if(r.getItemVisual(a,"colorFromPalette")){var l=r.ensureUniqueItemVisual(a,"style"),u=i.getName(t)||t+"",h=i.count();l[s]=e.getColorFromPalette(u,o,h)}}))}}))}},Tt=i(2141),Mt=i(1590),Ct=i(7786),At=Math.PI;var Lt=i(8674),It=i(2151),Dt=function(){function t(t,e,i,n){this._stageTaskMap=(0,o.createHashMap)(),this.ecInstance=t,this.api=e,i=this._dataProcessorHandlers=i.slice(),n=this._visualHandlers=n.slice(),this._allHandlers=i.concat(n)}return t.prototype.restoreData=function(t,e){t.restoreData(e),this._stageTaskMap.each((function(t){var e=t.overallTask;e&&e.dirty()}))},t.prototype.getPerformArgs=function(t,e){if(t.__pipeline){var i=this._pipelineMap.get(t.__pipeline.id),n=i.context,r=!e&&i.progressiveEnabled&&(!n||n.progressiveRender)&&t.__idxInPipeline>i.blockIndex?i.step:null,o=n&&n.modDataCount;return{step:r,modBy:null!=o?Math.ceil(o/r):null,modDataCount:o}}},t.prototype.getPipeline=function(t){return this._pipelineMap.get(t)},t.prototype.updateStreamModes=function(t,e){var i=this._pipelineMap.get(t.uid),n=t.getData().count(),r=i.progressiveEnabled&&e.incrementalPrepareRender&&n>=i.threshold,o=t.get("large")&&n>=t.get("largeThreshold"),a="mod"===t.get("progressiveChunkMode")?n:null;t.pipelineContext=i.context={progressiveRender:r,modDataCount:a,large:o}},t.prototype.restorePipelines=function(t){var e=this,i=e._pipelineMap=(0,o.createHashMap)();t.eachSeries((function(t){var n=t.getProgressive(),r=t.uid;i.set(r,{id:r,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:n&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(n||700),count:0}),e._pipe(t,t.dataTask)}))},t.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.api.getModel(),i=this.api;(0,o.each)(this._allHandlers,(function(n){var r=t.get(n.uid)||t.set(n.uid,{});(0,o.assert)(!(n.reset&&n.overallReset),""),n.reset&&this._createSeriesStageTask(n,r,e,i),n.overallReset&&this._createOverallStageTask(n,r,e,i)}),this)},t.prototype.prepareView=function(t,e,i,n){var r=t.renderTask,o=r.context;o.model=e,o.ecModel=i,o.api=n,r.__block=!t.incrementalPrepareRender,this._pipe(e,r)},t.prototype.performDataProcessorTasks=function(t,e){this._performStageTasks(this._dataProcessorHandlers,t,e,{block:!0})},t.prototype.performVisualTasks=function(t,e,i){this._performStageTasks(this._visualHandlers,t,e,i)},t.prototype._performStageTasks=function(t,e,i,n){n=n||{};var r=!1,a=this;function s(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}(0,o.each)(t,(function(t,o){if(!n.visualType||n.visualType===t.visualType){var l=a._stageTaskMap.get(t.uid),u=l.seriesTaskMap,h=l.overallTask;if(h){var c,d=h.agentStubMap;d.each((function(t){s(n,t)&&(t.dirty(),c=!0)})),c&&h.dirty(),a.updatePayload(h,i);var p=a.getPerformArgs(h,n.block);d.each((function(t){t.perform(p)})),h.perform(p)&&(r=!0)}else u&&u.each((function(o,l){s(n,o)&&o.dirty();var u=a.getPerformArgs(o,n.block);u.skip=!t.performRawSeries&&e.isSeriesFiltered(o.context.model),a.updatePayload(o,i),o.perform(u)&&(r=!0)}))}})),this.unfinished=r||this.unfinished},t.prototype.performSeriesTasks=function(t){var e;t.eachSeries((function(t){e=t.dataTask.perform()||e})),this.unfinished=e||this.unfinished},t.prototype.plan=function(){this._pipelineMap.each((function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)}))},t.prototype.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},t.prototype._createSeriesStageTask=function(t,e,i,n){var r=this,a=e.seriesTaskMap,s=e.seriesTaskMap=(0,o.createHashMap)(),l=t.seriesType,u=t.getTargetSeries;function h(e){var o=e.uid,l=s.set(o,a&&a.get(o)||(0,Lt.v)({plan:Nt,reset:Rt,count:Zt}));l.context={model:e,ecModel:i,api:n,useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:r},r._pipe(e,l)}t.createOnAllSeries?i.eachRawSeries(h):l?i.eachRawSeriesByType(l,h):u&&u(i,n).each(h)},t.prototype._createOverallStageTask=function(t,e,i,n){var r=this,a=e.overallTask=e.overallTask||(0,Lt.v)({reset:Pt});a.context={ecModel:i,api:n,overallReset:t.overallReset,scheduler:r};var s=a.agentStubMap,l=a.agentStubMap=(0,o.createHashMap)(),u=t.seriesType,h=t.getTargetSeries,c=!0,d=!1;function p(t){var e=t.uid,i=l.set(e,s&&s.get(e)||(d=!0,(0,Lt.v)({reset:Ot,onDirty:Et})));i.context={model:t,overallProgress:c},i.agent=a,i.__block=c,r._pipe(t,i)}(0,o.assert)(!t.createOnAllSeries,""),u?i.eachRawSeriesByType(u,p):h?h(i,n).each(p):(c=!1,(0,o.each)(i.getSeries(),p)),d&&a.dirty()},t.prototype._pipe=function(t,e){var i=t.uid,n=this._pipelineMap.get(i);!n.head&&(n.head=e),n.tail&&n.tail.pipe(e),n.tail=e,e.__idxInPipeline=n.count++,e.__pipeline=n},t.wrapStageHandler=function(t,e){return(0,o.isFunction)(t)&&(t={overallReset:t,seriesType:Ft(t)}),t.uid=(0,It.Kr)("stageHandler"),e&&(t.visualType=e),t},t}();function Pt(t){t.overallReset(t.ecModel,t.api,t.payload)}function Ot(t){return t.overallProgress&&kt}function kt(){this.agent.dirty(),this.getDownstream().dirty()}function Et(){this.agent&&this.agent.dirty()}function Nt(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function Rt(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=(0,u.kF)(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?(0,o.map)(e,(function(t,e){return Bt(e)})):zt}var zt=Bt(0);function Bt(t){return function(e,i){var n=i.data,r=i.resetDefines[t];if(r&&r.dataEach)for(var o=e.start;o0&&h===r.length-u.length){var c=r.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,o=!0)}}s.hasOwnProperty(r)&&(i[r]=t,o=!0),o||(n[r]=t)}))}return{cptQuery:e,dataQuery:i,otherQuery:n}},t.prototype.filter=function(t,e){var i=this.eventInfo;if(!i)return!0;var n=i.targetEl,r=i.packedEvent,o=i.model,a=i.view;if(!o||!a)return!0;var s=e.cptQuery,l=e.dataQuery;return u(s,o,"mainType")&&u(s,o,"subType")&&u(s,o,"index","componentIndex")&&u(s,o,"name")&&u(s,o,"id")&&u(l,r,"name")&&u(l,r,"dataIndex")&&u(l,r,"dataType")&&(!a.filterForExposedEvent||a.filterForExposedEvent(t,e.otherQuery,n,r));function u(t,e,i,n){return null==t[i]||e[n||i]===t[i]}},t.prototype.afterTrigger=function(){this.eventInfo=null},t}(),ie=["symbol","symbolSize","symbolRotate","symbolOffset"],ne=ie.concat(["symbolKeepAspect"]),re={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var i=t.getData();if(t.legendIcon&&i.setVisual("legendIcon",t.legendIcon),t.hasSymbolVisual){for(var n={},r={},a=!1,s=0;s0&&t.unfinished);t.unfinished||this._zr.flush()}}},e.prototype.getDom=function(){return this._dom},e.prototype.getId=function(){return this.id},e.prototype.getZr=function(){return this._zr},e.prototype.isSSR=function(){return this._ssr},e.prototype.setOption=function(t,e,i){if(!this[we])if(this._disposed)$e(this.id);else{var n,r,a;if((0,o.isObject)(e)&&(i=e.lazyUpdate,n=e.silent,r=e.replaceMerge,a=e.transition,e=e.notMerge),this[we]=!0,!this._model||e){var s=new k(this._api),l=this._theme,u=this._model=new C;u.scheduler=this._scheduler,u.ssr=this._ssr,u.init(null,null,null,l,this._locale,s)}this._model.setOption(t,{replaceMerge:r},ni);var h={seriesTransition:a,optionChanged:!0};if(i)this[Se]={silent:n,updateParams:h},this[we]=!1,this.getZr().wakeUp();else{try{De(this),ke.update.call(this,null,h)}catch(t){throw this[Se]=null,this[we]=!1,t}this._ssr||this._zr.flush(),this[Se]=null,this[we]=!1,ze.call(this,n),Be.call(this,n)}}},e.prototype.setTheme=function(){(0,se.Sh)("ECharts#setTheme() is DEPRECATED in ECharts 3.0")},e.prototype.getModel=function(){return this._model},e.prototype.getOption=function(){return this._model&&this._model.getOption()},e.prototype.getWidth=function(){return this._zr.getWidth()},e.prototype.getHeight=function(){return this._zr.getHeight()},e.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr||me&&window.devicePixelRatio||1},e.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},e.prototype.renderToCanvas=function(t){return t=t||{},this._zr.painter.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},e.prototype.renderToSVGString=function(t){return t=t||{},this._zr.painter.renderToString({useViewBox:t.useViewBox})},e.prototype.getSvgDataURL=function(){if(a.Z.svgSupported){var t=this._zr,e=t.storage.getDisplayList();return(0,o.each)(e,(function(t){t.stopAnimation(null,!0)})),t.painter.toDataURL()}},e.prototype.getDataURL=function(t){if(!this._disposed){var e=(t=t||{}).excludeComponents,i=this._model,n=[],r=this;(0,o.each)(e,(function(t){i.eachComponent({mainType:t},(function(t){var e=r._componentsMap[t.__viewId];e.group.ignore||(n.push(e),e.group.ignore=!0)}))}));var a="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return(0,o.each)(n,(function(t){t.group.ignore=!1})),a}$e(this.id)},e.prototype.getConnectedDataURL=function(t){if(!this._disposed){var e="svg"===t.type,i=this.group,n=Math.min,a=Math.max,s=1/0;if(li[i]){var l=s,u=s,h=-1/0,c=-1/0,d=[],p=t&&t.pixelRatio||this.getDevicePixelRatio();(0,o.each)(si,(function(r,s){if(r.group===i){var p=e?r.getZr().painter.getSvgDom().innerHTML:r.renderToCanvas((0,o.clone)(t)),f=r.getDom().getBoundingClientRect();l=n(f.left,l),u=n(f.top,u),h=a(f.right,h),c=a(f.bottom,c),d.push({dom:p,left:f.left,top:f.top})}}));var f=(h*=p)-(l*=p),g=(c*=p)-(u*=p),m=fe.qW.createCanvas(),v=r.init(m,{renderer:e?"svg":"canvas"});if(v.resize({width:f,height:g}),e){var y="";return(0,o.each)(d,(function(t){var e=t.left-l,i=t.top-u;y+=''+t.dom+""})),v.painter.getSvgRoot().innerHTML=y,t.connectedBackgroundColor&&v.painter.setBackgroundColor(t.connectedBackgroundColor),v.refreshImmediately(),v.painter.toDataURL()}return t.connectedBackgroundColor&&v.add(new ot.Z({shape:{x:0,y:0,width:f,height:g},style:{fill:t.connectedBackgroundColor}})),(0,o.each)(d,(function(t){var e=new at.ZP({style:{x:t.left*p-l,y:t.top*p-u,image:t.dom}});v.add(e)})),v.refreshImmediately(),m.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}$e(this.id)},e.prototype.convertToPixel=function(t,e){return Ee(this,"convertToPixel",t,e)},e.prototype.convertFromPixel=function(t,e){return Ee(this,"convertFromPixel",t,e)},e.prototype.containPixel=function(t,e){if(!this._disposed){var i,n=this._model,r=u.pm(n,t);return(0,o.each)(r,(function(t,n){n.indexOf("Models")>=0&&(0,o.each)(t,(function(t){var r=t.coordinateSystem;if(r&&r.containPoint)i=i||!!r.containPoint(e);else if("seriesModels"===n){var o=this._chartsMap[t.__viewId];o&&o.containPoint&&(i=i||o.containPoint(e,t))}else 0}),this)}),this),!!i}$e(this.id)},e.prototype.getVisual=function(t,e){var i=this._model,n=u.pm(i,t,{defaultMainType:"series"});var r=n.seriesModel.getData(),o=n.hasOwnProperty("dataIndexInside")?n.dataIndexInside:n.hasOwnProperty("dataIndex")?r.indexOfRawIndex(n.dataIndex):null;return null!=o?(0,ae.Or)(r,o,e):(0,ae.UL)(r,e)},e.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},e.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},e.prototype._initEvents=function(){var t=this;(0,o.each)(Qe,(function(e){var i=function(i){var n,r=t.getModel(),a=i.target;if("globalout"===e?n={}:a&&(0,ce.o)(a,(function(t){var e=(0,ut.A)(t);if(e&&null!=e.dataIndex){var i=e.dataModel||r.getSeriesByIndex(e.seriesIndex);return n=i&&i.getDataParams(e.dataIndex,e.dataType)||{},!0}if(e.eventData)return n=(0,o.extend)({},e.eventData),!0}),!0),n){var s=n.componentType,l=n.componentIndex;"markLine"!==s&&"markPoint"!==s&&"markArea"!==s||(s="series",l=n.seriesIndex);var u=s&&null!=l&&r.getComponent(s,l),h=u&&t["series"===u.mainType?"_chartsMap":"_componentsMap"][u.__viewId];0,n.event=i,n.type=e,t._$eventProcessor.eventInfo={targetEl:a,packedEvent:n,model:u,view:h},t.trigger(e,n)}};i.zrEventfulCallAtLast=!0,t._zr.on(e,i,t)})),(0,o.each)(ei,(function(e,i){t._messageCenter.on(i,(function(t){this.trigger(i,t)}),t)})),(0,o.each)(["selectchanged"],(function(e){t._messageCenter.on(e,(function(t){this.trigger(e,t)}),t)})),(0,le.s)(this._messageCenter,this,this._api)},e.prototype.isDisposed=function(){return this._disposed},e.prototype.clear=function(){this._disposed?$e(this.id):this.setOption({series:[]},!0)},e.prototype.dispose=function(){if(this._disposed)$e(this.id);else{this._disposed=!0,this.getDom()&&u.P$(this.getDom(),ci,"");var t=this,e=t._api,i=t._model;(0,o.each)(t._componentsViews,(function(t){t.dispose(i,e)})),(0,o.each)(t._chartsViews,(function(t){t.dispose(i,e)})),t._zr.dispose(),t._dom=t._model=t._chartsMap=t._componentsMap=t._chartsViews=t._componentsViews=t._scheduler=t._api=t._zr=t._throttledZrFlush=t._theme=t._coordSysMgr=t._messageCenter=null,delete si[t.id]}},e.prototype.resize=function(t){if(!this[we])if(this._disposed)$e(this.id);else{this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var i=e.resetOption("media"),n=t&&t.silent;this[Se]&&(null==n&&(n=this[Se].silent),i=!0,this[Se]=null),this[we]=!0;try{i&&De(this),ke.update.call(this,{type:"resize",animation:(0,o.extend)({duration:0},t&&t.animation)})}catch(t){throw this[we]=!1,t}this[we]=!1,ze.call(this,n),Be.call(this,n)}}},e.prototype.showLoading=function(t,e){if(this._disposed)$e(this.id);else if((0,o.isObject)(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),ai[t]){var i=ai[t](this._api,e),n=this._zr;this._loadingFX=i,n.add(i)}},e.prototype.hideLoading=function(){this._disposed?$e(this.id):(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},e.prototype.makeActionFromEvent=function(t){var e=(0,o.extend)({},t);return e.type=ei[t.type],e},e.prototype.dispatchAction=function(t,e){if(this._disposed)$e(this.id);else if((0,o.isObject)(e)||(e={silent:!!e}),ti[t.type]&&this._model)if(this[we])this._pendingActions.push(t);else{var i=e.silent;Re.call(this,t,i);var n=e.flush;n?this._zr.flush():!1!==n&&a.Z.browser.weChat&&this._throttledZrFlush(),ze.call(this,i),Be.call(this,i)}},e.prototype.updateLabelLayout=function(){pe.trigger("series:layoutlabels",this._model,this._api,{updatedSeries:[]})},e.prototype.appendData=function(t){if(this._disposed)$e(this.id);else{var e=t.seriesIndex;0,this.getModel().getSeriesByIndex(e).appendData(t),this._scheduler.unfinished=!0,this.getZr().wakeUp()}},e.internalField=function(){function t(t){t.clearColorPalette(),t.eachSeries((function(t){t.clearColorPalette()}))}function e(t){for(var e=[],i=t.currentStates,n=0;n0?{duration:o,delay:n.get("delay"),easing:n.get("easing")}:null;i.eachRendered((function(t){if(t.states&&t.states.emphasis){if(st.eq(t))return;if(t instanceof lt.ZP&&(0,ht.e9)(t),t.__dirty){var i=t.prevStates;i&&t.useStates(i)}if(r){t.stateTransition=a;var n=t.getTextContent(),o=t.getTextGuideLine();n&&(n.stateTransition=a),o&&(o.stateTransition=a)}t.__dirty&&e(t)}}))}De=function(t){var e=t._scheduler;e.restorePipelines(t._model),e.prepareStageTasks(),Pe(t,!0),Pe(t,!1),e.plan()},Pe=function(t,e){for(var i=t._model,n=t._scheduler,r=e?t._componentsViews:t._chartsViews,o=e?t._componentsMap:t._chartsMap,a=t._zr,s=t._api,l=0;le.get("hoverLayerThreshold")&&!a.Z.node&&!a.Z.worker&&e.eachSeries((function(e){if(!e.preventUsingHoverLayer){var i=t._chartsMap[e.__viewId];i.__alive&&i.eachRendered((function(t){t.states.emphasis&&(t.states.emphasis.hoverLayer=!0)}))}}))}(t,e),pe.trigger("series:afterupdate",e,n,s)},je=function(t){t[Te]=!0,t.getZr().wakeUp()},Xe=function(t){t[Te]&&(t.getZr().storage.traverse((function(t){st.eq(t)||e(t)})),t[Te]=!1)},Ue=function(t){return new(function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return(0,n.ZT)(i,e),i.prototype.getCoordinateSystems=function(){return t._coordSysMgr.getCoordinateSystems()},i.prototype.getComponentByElement=function(e){for(;e;){var i=e.__ecComponentInfo;if(null!=i)return t._model.getComponent(i.mainType,i.index);e=e.parent}},i.prototype.enterEmphasis=function(e,i){(0,ht.fD)(e,i),je(t)},i.prototype.leaveEmphasis=function(e,i){(0,ht.Mh)(e,i),je(t)},i.prototype.enterBlur=function(e){(0,ht.SX)(e),je(t)},i.prototype.leaveBlur=function(e){(0,ht.VP)(e),je(t)},i.prototype.enterSelect=function(e){(0,ht.XX)(e),je(t)},i.prototype.leaveSelect=function(e){(0,ht.SJ)(e),je(t)},i.prototype.getModel=function(){return t.getModel()},i.prototype.getViewOfComponentModel=function(e){return t.getViewOfComponentModel(e)},i.prototype.getViewOfSeriesModel=function(e){return t.getViewOfSeriesModel(e)},i}(L))(t)},We=function(t){function e(t,e){for(var i=0;i=0)){Di.push(i);var a=Wt.wrapStageHandler(i,r);a.__prio=e,a.__raw=i,t.push(a)}}function Oi(t,e){ai[t]=e}function ki(t){(0,fe.g2)({createCanvas:t})}function Ei(t,e,i){var n=(0,ge.C)("registerMap");n&&n(t,e,i)}function Ni(t){var e=(0,ge.C)("getMap");return e&&e(t)}var Ri=ue.DA;Ii(_e,xt),Ii(xe,wt),Ii(xe,St),Ii(_e,re),Ii(xe,oe),Ii(7e3,(function(t,e){t.eachRawSeries((function(i){if(!t.isSeriesFiltered(i)){var n=i.getData();n.hasItemVisual()&&n.each((function(t){var i=n.getItemVisual(t,"decal");i&&(n.ensureUniqueItemVisual(t,"style").decal=(0,de.I)(i,e))}));var r=n.getVisual("decal");if(r)n.getVisual("style").decal=(0,de.I)(r,e)}}))})),xi($),bi(900,(function(t){var e=(0,o.createHashMap)();t.eachSeries((function(t){var i=t.get("stack");if(i){var n=e.get(i)||e.set(i,[]),r=t.getData(),o={stackResultDimension:r.getCalculationInfo("stackResultDimension"),stackedOverDimension:r.getCalculationInfo("stackedOverDimension"),stackedDimension:r.getCalculationInfo("stackedDimension"),stackedByDimension:r.getCalculationInfo("stackedByDimension"),isStackedByIndex:r.getCalculationInfo("isStackedByIndex"),data:r,seriesModel:t};if(!o.stackedDimension||!o.isStackedByIndex&&!o.stackedByDimension)return;n.length&&r.setCalculationInfo("stackedOnSeries",n[n.length-1].seriesModel),n.push(o)}})),e.each(et)})),Oi("default",(function(t,e){e=e||{},o.defaults(e,{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var i=new Tt.Z,n=new ot.Z({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});i.add(n);var r,a=new Mt.ZP({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),s=new ot.Z({style:{fill:"none"},textContent:a,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});return i.add(s),e.showSpinner&&((r=new Ct.Z({shape:{startAngle:-At/2,endAngle:-At/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001})).animateShape(!0).when(1e3,{endAngle:3*At/2}).start("circularInOut"),r.animateShape(!0).when(1e3,{startAngle:3*At/2}).delay(300).start("circularInOut"),i.add(r)),i.resize=function(){var i=a.getBoundingRect().width,o=e.showSpinner?e.spinnerRadius:0,l=(t.getWidth()-2*o-(e.showSpinner&&i?10:0)-i)/2-(e.showSpinner&&i?0:5+i/2)+(e.showSpinner?0:i/2)+(i?0:o),u=t.getHeight()/2;e.showSpinner&&r.setShape({cx:l,cy:u}),s.setShape({x:l-o,y:u-o,width:2*o,height:2*o}),n.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},i.resize(),i})),Mi({type:ht.Ki,event:ht.Ki,update:ht.Ki},o.noop),Mi({type:ht.yx,event:ht.yx,update:ht.yx},o.noop),Mi({type:ht.Hg,event:ht.Hg,update:ht.Hg},o.noop),Mi({type:ht.JQ,event:ht.JQ,update:ht.JQ},o.noop),Mi({type:ht.iK,event:ht.iK,update:ht.iK},o.noop),_i("light",Xt),_i("dark",$t);var zi={}},9428:(t,e,i)=>{"use strict";i.d(e,{C:()=>o,M:()=>r});var n={};function r(t,e){n[t]=e}function o(t){return n[t]}},3917:(t,e,i)=>{"use strict";i.d(e,{sO:()=>c,D0:()=>p,Li:()=>g,G8:()=>f,I2:()=>d});var n=i(1497),r=i(7153);var o=i(8760),a="ZH",s="EN",l=s,u={},h={},c=r.Z.domSupported&&(document.documentElement.lang||navigator.language||navigator.browserLanguage).toUpperCase().indexOf(a)>-1?a:l;function d(t,e){t=t.toUpperCase(),h[t]=new n.Z(e),u[t]=e}function p(t){if((0,o.isString)(t)){var e=u[t.toUpperCase()]||{};return t===a||t===s?(0,o.clone)(e):(0,o.merge)((0,o.clone)(e),(0,o.clone)(u[l]),!1)}return(0,o.merge)((0,o.clone)(t),(0,o.clone)(u[l]),!1)}function f(t){return h[t]}function g(){return h[l]}d(s,{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"}},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:". "}}}}),d(a,{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:"旭日图"}},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:""}}}})},8674:(t,e,i)=>{"use strict";i.d(e,{v:()=>r});var n=i(8760);function r(t){return new o(t)}var o=function(){function t(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0}return t.prototype.perform=function(t){var e,i=this._upstream,r=t&&t.skip;if(this._dirty&&i){var o=this.context;o.data=o.outputData=i.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this),this._plan&&!r&&(e=this._plan(this.context));var a,s=c(this._modBy),l=this._modDataCount||0,u=c(t&&t.modBy),h=t&&t.modDataCount||0;function c(t){return!(t>=1)&&(t=1),t}s===u&&l===h||(e="reset"),(this._dirty||"reset"===e)&&(this._dirty=!1,a=this._doReset(r)),this._modBy=u,this._modDataCount=h;var d=t&&t.step;if(this._dueEnd=i?i._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var p=this._dueIndex,f=Math.min(null!=d?this._dueIndex+d:1/0,this._dueEnd);if(!r&&(a||p1&&n>0?s:a}};return o;function a(){return e=t?null:o{"use strict";function n(t){return null==t?0:t.length||1}function r(t){return t}i.d(e,{Z:()=>o});const o=function(){function t(t,e,i,n,o,a){this._old=t,this._new=e,this._oldKeyGetter=i||r,this._newKeyGetter=n||r,this.context=o,this._diffModeMultiple="multiple"===a}return t.prototype.add=function(t){return this._add=t,this},t.prototype.update=function(t){return this._update=t,this},t.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this},t.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this},t.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this},t.prototype.remove=function(t){return this._remove=t,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var t=this._old,e=this._new,i={},r=new Array(t.length),o=new Array(e.length);this._initIndexMap(t,null,r,"_oldKeyGetter"),this._initIndexMap(e,i,o,"_newKeyGetter");for(var a=0;a1){var h=l.shift();1===l.length&&(i[s]=l[0]),this._update&&this._update(h,a)}else 1===u?(i[s]=null,this._update&&this._update(l,a)):this._remove&&this._remove(a)}this._performRestAdd(o,i)},t.prototype._executeMultiple=function(){var t=this._old,e=this._new,i={},r={},o=[],a=[];this._initIndexMap(t,i,o,"_oldKeyGetter"),this._initIndexMap(e,r,a,"_newKeyGetter");for(var s=0;s1&&1===d)this._updateManyToOne&&this._updateManyToOne(h,u),r[l]=null;else if(1===c&&d>1)this._updateOneToMany&&this._updateOneToMany(h,u),r[l]=null;else if(1===c&&1===d)this._update&&this._update(h,u),r[l]=null;else if(c>1&&d>1)this._updateManyToMany&&this._updateManyToMany(h,u),r[l]=null;else if(c>1)for(var p=0;p1)for(var s=0;s{"use strict";i.d(e,{ZP:()=>g,hG:()=>h});var n,r=i(8760),o=i(8407),a=i(9574),s="undefined",l=typeof Uint32Array===s?Array:Uint32Array,u=typeof Uint16Array===s?Array:Uint16Array,h=typeof Int32Array===s?Array:Int32Array,c=typeof Float64Array===s?Array:Float64Array,d={float:c,int:h,ordinal:Array,number:Array,time:c};function p(t){return t>65535?l:u}function f(t,e,i,n,r){var o=d[i||"float"];if(r){var a=t[e],s=a&&a.length;if(s!==n){for(var l=new o(n),u=0;uv[1]&&(v[1]=m)}return this._rawCount=this._count=l,{start:s,end:l}},t.prototype._initDataFromProvider=function(t,e,i){for(var n=this._provider,o=this._chunks,a=this._dimensions,s=a.length,l=this._rawExtent,u=(0,r.map)(a,(function(t){return t.property})),h=0;hy[1]&&(y[1]=v)}}!n.persistent&&n.clean&&n.clean(),this._rawCount=this._count=e,this._extent=[]},t.prototype.count=function(){return this._count},t.prototype.get=function(t,e){if(!(e>=0&&e=0&&e=this._rawCount||t<0)return-1;if(!this._indices)return t;var e=this._indices,i=e[t];if(null!=i&&it))return o;r=o-1}}return-1},t.prototype.indicesOfNearest=function(t,e,i){var n=this._chunks[t],r=[];if(!n)return r;null==i&&(i=1/0);for(var o=1/0,a=-1,s=0,l=0,u=this.count();l=0&&a<0)&&(o=c,a=h,s=0),h===a&&(r[s++]=l))}return r.length=s,r},t.prototype.getIndices=function(){var t,e=this._indices;if(e){var i=e.constructor,n=this._count;if(i===Array){t=new i(n);for(var r=0;r=h&&b<=c||isNaN(b))&&(s[l++]=g),g++}f=!0}else if(2===o){m=d[n[0]];var y=d[n[1]],_=t[n[1]][0],x=t[n[1]][1];for(v=0;v=h&&b<=c||isNaN(b))&&(w>=_&&w<=x||isNaN(w))&&(s[l++]=g),g++}f=!0}}if(!f)if(1===o)for(v=0;v=h&&b<=c||isNaN(b))&&(s[l++]=S)}else for(v=0;vt[C][1])&&(T=!1)}T&&(s[l++]=e.getRawIndex(v))}return lm[1]&&(m[1]=g)}}}},t.prototype.lttbDownSample=function(t,e){var i,n,r,o=this.clone([t],!0),a=o._chunks[t],s=this.count(),l=0,u=Math.floor(1/e),h=this.getRawIndex(0),c=new(p(this._rawCount))(Math.min(2*(Math.ceil(s/u)+2),s));c[l++]=h;for(var d=1;di&&(i=n,r=C)}M>0&&Mu-f&&(s=u-f,a.length=s);for(var g=0;gh[1]&&(h[1]=v),c[d++]=y}return r._count=d,r._indices=c,r._updateGetRawIdx(),r},t.prototype.each=function(t,e){if(this._count)for(var i=t.length,n=this._chunks,r=0,o=this.count();ra&&(a=l)}return n=[o,a],this._extent[t]=n,n},t.prototype.getRawDataItem=function(t){var e=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(e);for(var i=[],n=this._chunks,r=0;r=0?this._indices[t]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=function(){function t(t,e,i,n){return(0,o.yQ)(t[n],this._dimensions[n])}n={arrayRows:t,objectRows:function(t,e,i,n){return(0,o.yQ)(t[e],this._dimensions[n])},keyedColumns:t,original:function(t,e,i,n){var r=t&&(null==t.value?t:t.value);return(0,o.yQ)(r instanceof Array?r[n]:r,this._dimensions[n])},typedArray:function(t,e,i,n){return t[n]}}}(),t}()},1401:(t,e,i)=>{"use strict";i.d(e,{Z:()=>a});var n=i(8760),r=0;function o(t){return(0,n.isObject)(t)&&null!=t.value?t.value:t+""}const a=function(){function t(t){this.categories=t.categories||[],this._needCollect=t.needCollect,this._deduplication=t.deduplication,this.uid=++r}return t.createByAxisModel=function(e){var i=e.option,r=i.data,a=r&&(0,n.map)(r,o);return new t({categories:a,needCollect:!a,deduplication:!1!==i.dedplication})},t.prototype.getOrdinal=function(t){return this._getOrCreateMap().get(t)},t.prototype.parseAndCollect=function(t){var e,i=this._needCollect;if(!(0,n.isString)(t)&&!i)return t;if(i&&!this._deduplication)return e=this.categories.length,this.categories[e]=t,e;var r=this._getOrCreateMap();return null==(e=r.get(t))&&(i?(e=this.categories.length,this.categories[e]=t,r.set(t,e)):e=NaN),e},t.prototype._getOrCreateMap=function(){return this._map||(this._map=(0,n.createHashMap)(this.categories))},t}()},5101:(t,e,i)=>{"use strict";i.d(e,{Z:()=>A});var n,r,o,a,s,l,u,h=i(8760),c=i(1497),d=i(4130),p=i(8540),f=i(381),g=i(5440),m=i(4279),v=i(2234),y=i(106),_=i(9574),x=i(3834),b=i(1029),w=h.isObject,S=h.map,T="undefined"==typeof Int32Array?Array:Int32Array,M=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],C=["_approximateExtent"];const A=function(){function t(t,e){var i;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","lttbDownSample","map"],this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","lttbDownSample"];var n=!1;(0,b.bB)(t)?(i=t.dimensions,this._dimOmitted=t.isDimensionOmitted(),this._schema=t):(n=!0,i=t),i=i||["x","y"];for(var r={},o=[],a={},s=!1,l={},u=0;u=e)){var i=this._store.getProvider();this._updateOrdinalMeta();var r=this._nameList,o=this._idList;if(i.getSource().sourceFormat===m.cy&&!i.pure)for(var a=[],s=t;s0},t.prototype.ensureUniqueItemVisual=function(t,e){var i=this._itemVisuals,n=i[t];n||(n=i[t]={});var r=n[e];return null==r&&(r=this.getVisual(e),h.isArray(r)?r=r.slice():w(r)&&(r=h.extend({},r)),n[e]=r),r},t.prototype.setItemVisual=function(t,e,i){var n=this._itemVisuals[t]||{};this._itemVisuals[t]=n,w(e)?h.extend(n,e):n[e]=i},t.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},t.prototype.setLayout=function(t,e){w(t)?h.extend(this._layout,t):this._layout[t]=e},t.prototype.getLayout=function(t){return this._layout[t]},t.prototype.getItemLayout=function(t){return this._itemLayouts[t]},t.prototype.setItemLayout=function(t,e,i){this._itemLayouts[t]=i?h.extend(this._itemLayouts[t]||{},e):e},t.prototype.clearItemLayouts=function(){this._itemLayouts.length=0},t.prototype.setItemGraphicEl=function(t,e){var i=this.hostModel&&this.hostModel.seriesIndex;(0,y.Q)(i,this.dataType,t,e),this._graphicEls[t]=e},t.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},t.prototype.eachItemGraphicEl=function(t,e){h.each(this._graphicEls,(function(i,n){i&&t&&t.call(e,i,n)}))},t.prototype.cloneShallow=function(e){return e||(e=new t(this._schema?this._schema:S(this.dimensions,this._getDimInfo,this),this.hostModel)),s(e,this),e._store=this._store,e},t.prototype.wrapMethod=function(t,e){var i=this[t];h.isFunction(i)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=i.apply(this,arguments);return e.apply(this,[t].concat(h.slice(arguments)))})},t.internalField=(n=function(t){var e=t._invertedIndicesMap;h.each(e,(function(i,n){var r=t._dimInfos[n],o=r.ordinalMeta,a=t._store;if(o){i=e[n]=new T(o.categories.length);for(var s=0;s1&&(l+="__ec__"+h),n[e]=l}})),t}()},5440:(t,e,i)=>{"use strict";i.d(e,{Z:()=>r});var n=i(8760);const r=function(t){this.otherDims={},null!=t&&n.extend(this,t)}},9574:(t,e,i)=>{"use strict";i.d(e,{Kp:()=>d,Ld:()=>l,ML:()=>c,QY:()=>g,_P:()=>u,nx:()=>h});var n=i(8760),r=i(4279),o=i(2234),a=i(1772),s=function(t){this.data=t.data||(t.sourceFormat===r.hL?{}:[]),this.sourceFormat=t.sourceFormat||r.RA,this.seriesLayoutBy=t.seriesLayoutBy||r.fY,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var e=this.dimensionsDefine=t.dimensionsDefine;if(e)for(var i=0;i{"use strict";i.d(e,{Eo:()=>l,Jj:()=>c,Jl:()=>d,bB:()=>u,v5:()=>h});var n=i(8760),r=i(2234),o=i(9574),a=(0,r.Yf)(),s={float:"f",int:"i",ordinal:"o",number:"n",time:"t"},l=function(){function t(t){this.dimensions=t.dimensions,this._dimOmitted=t.dimensionOmitted,this.source=t.source,this._fullDimCount=t.fullDimensionCount,this._updateDimOmitted(t.dimensionOmitted)}return t.prototype.isDimensionOmitted=function(){return this._dimOmitted},t.prototype._updateDimOmitted=function(t){this._dimOmitted=t,t&&(this._dimNameMap||(this._dimNameMap=c(this.source)))},t.prototype.getSourceDimensionIndex=function(t){return(0,n.retrieve2)(this._dimNameMap.get(t),-1)},t.prototype.getSourceDimension=function(t){var e=this.source.dimensionsDefine;if(e)return e[t]},t.prototype.makeStoreSchema=function(){for(var t=this._fullDimCount,e=(0,o.QY)(this.source),i=!d(t),n="",r=[],a=0,l=0;a30}},5623:(t,e,i)=>{"use strict";i.d(e,{Z:()=>d,q:()=>c});var n=i(4279),r=i(5440),o=i(8760),a=i(9574),s=i(3834),l=i(2234),u=i(1772),h=i(1029);function c(t,e){return d(t,e).dimensions}function d(t,e){(0,a.Ld)(t)||(t=(0,a.nx)(t));var i=(e=e||{}).coordDimensions||[],c=e.dimensionsDefine||t.dimensionsDefine||[],d=(0,o.createHashMap)(),f=[],g=function(t,e,i,n){var r=Math.max(t.dimensionsDetectedCount||1,e.length,i.length,n||0);return(0,o.each)(e,(function(t){var e;(0,o.isObject)(t)&&(e=t.dimsDef)&&(r=Math.max(r,e.length))})),r}(t,i,c,e.dimensionsCount),m=e.canOmitUnusedDimensions&&(0,h.Jl)(g),v=c===t.dimensionsDefine,y=v?(0,h.Jj)(t):(0,h.v5)(c),_=e.encodeDefine;!_&&e.encodeDefaulter&&(_=e.encodeDefaulter(t,g));for(var x=(0,o.createHashMap)(_),b=new s.hG(g),w=0;w0&&(n.name=r+(a-1)),a++,e.set(r,a)}}(f),new h.Eo({source:t,dimensions:f,fullDimensionCount:g,dimensionOmitted:m})}function p(t,e,i){var n=e.data;if(i||n.hasOwnProperty(t)){for(var r=0;n.hasOwnProperty(t+r);)r++;t+=r}return e.set(t,!0),t}},8540:(t,e,i)=>{"use strict";i.d(e,{Pl:()=>d,_j:()=>g,a:()=>y,hk:()=>S,tB:()=>b});var n,r,o,a,s,l=i(8760),u=i(2234),h=i(9574),c=i(4279),d=function(){function t(t,e){var i=(0,h.Ld)(t)?t:(0,h.nx)(t);this._source=i;var n=this._data=i.data;i.sourceFormat===c.J5&&(this._offset=0,this._dimSize=e,this._data=n),s(this,n,i)}var e;return t.prototype.getSource=function(){return this._source},t.prototype.count=function(){return 0},t.prototype.getItem=function(t,e){},t.prototype.appendData=function(t){},t.prototype.clean=function(){},t.protoInitialize=((e=t.prototype).pure=!1,void(e.persistent=!0)),t.internalField=function(){var t;s=function(t,r,o){var s=o.sourceFormat,u=o.seriesLayoutBy,h=o.startIndex,d=o.dimensionsDefine,p=a[w(s,u)];if((0,l.extend)(t,p),s===c.J5)t.getItem=e,t.count=n,t.fillStorage=i;else{var f=g(s,u);t.getItem=(0,l.bind)(f,null,r,h,d);var m=y(s,u);t.count=(0,l.bind)(m,null,r,h,d)}};var e=function(t,e){t-=this._offset,e=e||[];for(var i=this._data,n=this._dimSize,r=n*t,o=0;ou&&(u=p)}s[0]=l,s[1]=u}},n=function(){return this._data?this._data.length/this._dimSize:0};function r(t){for(var e=0;e{"use strict";i.d(e,{BM:()=>o,IR:()=>s,M:()=>a});var n=i(8760),r=i(1029);function o(t,e,i){var o,a,s,l=(i=i||{}).byIndex,u=i.stackedCoordDimension;!function(t){return!(0,r.bB)(t.schema)}(e)?(a=e.schema,o=a.dimensions,s=e.store):o=e;var h,c,d,p,f=!(!t||!t.get("stack"));if((0,n.each)(o,(function(t,e){(0,n.isString)(t)&&(o[e]=t={name:t}),f&&!t.isExtraCoord&&(l||h||!t.ordinalMeta||(h=t),c||"ordinal"===t.type||"time"===t.type||u&&u!==t.coordDim||(c=t))})),!c||l||h||(l=!0),c){d="__\0ecstackresult_"+t.id,p="__\0ecstackedover_"+t.id,h&&(h.createInvertedIndices=!0);var g=c.coordDim,m=c.type,v=0;(0,n.each)(o,(function(t){t.coordDim===g&&v++}));var y={name:d,coordDim:g,coordDimIndex:v,type:m,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:o.length},_={name:p,coordDim:p,coordDimIndex:v+1,type:m,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:o.length+1};a?(s&&(y.storeDimIndex=s.ensureCalculationDimension(p,m),_.storeDimIndex=s.ensureCalculationDimension(d,m)),a.appendCalculationDimension(y),a.appendCalculationDimension(_)):(o.push(y),o.push(_))}return{stackedDimension:c&&c.name,stackedByDimension:h&&h.name,isStackedByIndex:l,stackedOverDimension:p,stackResultDimension:d}}function a(t,e){return!!e&&e===t.getCalculationInfo("stackedDimension")}function s(t,e){return a(t,e)?t.getCalculationInfo("stackResultDimension"):e}},8407:(t,e,i)=>{"use strict";i.d(e,{ID:()=>c,o2:()=>l,tR:()=>p,yQ:()=>a});var n=i(5669),r=i(8760),o=i(175);function a(t,e){var i=e&&e.type;return"ordinal"===i?t:("time"!==i||(0,r.isNumber)(t)||null==t||"-"===t||(t=+(0,n.sG)(t)),null==t||""===t?NaN:+t)}var s=(0,r.createHashMap)({number:function(t){return parseFloat(t)},time:function(t){return+(0,n.sG)(t)},trim:function(t){return(0,r.isString)(t)?(0,r.trim)(t):t}});function l(t){return s.get(t)}var u={lt:function(t,e){return te},gte:function(t,e){return t>=e}},h=function(){function t(t,e){if(!(0,r.isNumber)(e)){0,(0,o._y)("")}this._opFn=u[t],this._rvalFloat=(0,n.FK)(e)}return t.prototype.evaluate=function(t){return(0,r.isNumber)(t)?this._opFn(t,this._rvalFloat):this._opFn((0,n.FK)(t),this._rvalFloat)},t}(),c=function(){function t(t,e){var i="desc"===t;this._resultLT=i?1:-1,null==e&&(e=i?"min":"max"),this._incomparable="min"===e?-1/0:1/0}return t.prototype.evaluate=function(t,e){var i=(0,r.isNumber)(t)?t:(0,n.FK)(t),o=(0,r.isNumber)(e)?e:(0,n.FK)(e),a=isNaN(i),s=isNaN(o);if(a&&(i=this._incomparable),s&&(o=this._incomparable),a&&s){var l=(0,r.isString)(t),u=(0,r.isString)(e);l&&(i=u?t:0),u&&(o=l?e:0)}return io?-this._resultLT:0},t}(),d=function(){function t(t,e){this._rval=e,this._isEQ=t,this._rvalTypeof=typeof e,this._rvalFloat=(0,n.FK)(e)}return t.prototype.evaluate=function(t){var e=t===this._rval;if(!e){var i=typeof t;i===this._rvalTypeof||"number"!==i&&"number"!==this._rvalTypeof||(e=(0,n.FK)(t)===this._rvalFloat)}return this._isEQ?e:!e},t}();function p(t,e){return"eq"===t||"ne"===t?new d("eq"===t,e):(0,r.hasOwn)(u,t)?new h(t,e):null}},381:(t,e,i)=>{"use strict";i.d(e,{T:()=>l,y:()=>a});var n=i(8760),r=i(4279),o=function(){function t(t,e){this._encode=t,this._schema=e}return t.prototype.get=function(){return{fullDimensions:this._getFullDimensionNames(),encode:this._encode}},t.prototype._getFullDimensionNames=function(){return this._cachedDimNames||(this._cachedDimNames=this._schema?this._schema.makeOutputDimensionNames():[]),this._cachedDimNames},t}();function a(t,e){var i={},a=i.encode={},l=(0,n.createHashMap)(),u=[],h=[],c={};(0,n.each)(t.dimensions,(function(e){var i,n=t.getDimensionInfo(e),o=n.coordDim;if(o){0;var d=n.coordDimIndex;s(a,o)[d]=e,n.isExtraCoord||(l.set(o,1),"ordinal"!==(i=n.type)&&"time"!==i&&(u[0]=e),s(c,o)[d]=t.getDimensionIndex(n.name)),n.defaultTooltip&&h.push(e)}r.f7.each((function(t,e){var i=s(a,e),r=n.otherDims[e];null!=r&&!1!==r&&(i[r]=n.name)}))}));var d=[],p={};l.each((function(t,e){var i=a[e];p[e]=i[0],d=d.concat(i)})),i.dataDimsOnCoord=d,i.dataDimIndicesOnCoord=(0,n.map)(d,(function(e){return t.getDimensionInfo(e).storeDimIndex})),i.encodeFirstDimNotExtra=p;var f=a.label;f&&f.length&&(u=f.slice());var g=a.tooltip;return g&&g.length?h=g.slice():h.length||(h=u.slice()),a.defaultedLabel=u,a.defaultedTooltip=h,i.userOutput=new o(c,e),i}function s(t,e){return t.hasOwnProperty(e)||(t[e]=[]),t[e]}function l(t){return"category"===t?"ordinal":"time"===t?"time":"float"}},9344:(t,e,i)=>{"use strict";i.d(e,{Z:()=>d});var n=i(8760),r=(0,i(2234).Yf)();function o(t,e){if(r(o=this).mainData===o){var i=(0,n.extend)({},r(this).datas);i[this.dataType]=e,h(e,i,t)}else c(e,this.dataType,r(this).mainData,t);var o;return e}function a(t,e){return t.struct&&t.struct.update(),e}function s(t,e){return(0,n.each)(r(e).datas,(function(i,n){i!==e&&c(i.cloneShallow(),n,e,t)})),e}function l(t){var e=r(this).mainData;return null==t||null==e?e:r(e).datas[t]}function u(){var t=r(this).mainData;return null==t?[{data:t}]:(0,n.map)((0,n.keys)(r(t).datas),(function(e){return{type:e,data:r(t).datas[e]}}))}function h(t,e,i){r(t).datas={},(0,n.each)(e,(function(e,n){c(e,n,t,i)}))}function c(t,e,i,n){r(i).datas[e]=t,r(t).mainData=i,t.dataType=e,n.struct&&(t[n.structAttr]=n.struct,n.struct[n.datasAttr[e]]=t),t.getLinkedData=l,t.getLinkedDataAll=u}const d=function(t){var e=t.mainData,i=t.datas;i||(i={main:e},t.datasAttr={main:"data"}),t.datas=t.mainData=null,h(e,i,t),(0,n.each)(i,(function(i){(0,n.each)(e.TRANSFERABLE_METHODS,(function(e){i.wrapMethod(e,(0,n.curry)(o,t))}))})),e.wrapMethod("cloneShallow",(0,n.curry)(s,t)),(0,n.each)(e.CHANGABLE_METHODS,(function(i){e.wrapMethod(i,(0,n.curry)(a,t))})),(0,n.assert)(i[e.dataType]===e)}},1772:(t,e,i)=>{"use strict";i.d(e,{Dq:()=>a,JT:()=>d,Ss:()=>h,Wd:()=>c,md:()=>l,pY:()=>u,u7:()=>p});var n=i(2234),r=i(8760),o=i(4279),a={Must:1,Might:2,Not:3},s=(0,n.Yf)();function l(t){s(t).datasetMap=(0,r.createHashMap)()}function u(t,e,i){var n={},o=c(e);if(!o||!t)return n;var a,l,u=[],h=[],d=e.ecModel,p=s(d).datasetMap,f=o.uid+"_"+i.seriesLayoutBy;t=t.slice(),(0,r.each)(t,(function(e,i){var o=(0,r.isObject)(e)?e:t[i]={name:e};"ordinal"===o.type&&null==a&&(a=i,l=v(o)),n[o.name]=[]}));var g=p.get(f)||p.set(f,{categoryWayDim:l,valueWayDim:0});function m(t,e,i){for(var n=0;n{"use strict";i.d(e,{U:()=>h,t:()=>c});var n=i(8760),r=i(9574),o=i(4279),a=i(1772),s=i(437),l=i(3834),u=i(8540),h=function(){function t(t){this._sourceList=[],this._storeList=[],this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t}return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(t,e){this._sourceList=t,this._upstreamSignList=e,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)},t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase},t.prototype.prepareSource=function(){this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var t,e,i=this._sourceHost,a=this._getUpstreamSourceManagers(),s=!!a.length;if(d(i)){var l=i,u=void 0,h=void 0,c=void 0;if(s){var p=a[0];p.prepareSource(),u=(c=p.getSource()).data,h=c.sourceFormat,e=[p._getVersionSign()]}else u=l.get("data",!0),h=(0,n.isTypedArray)(u)?o.J5:o.cy,e=[];var f=this._getSourceMetaRawOption()||{},g=c&&c.metaRawOption||{},m=(0,n.retrieve2)(f.seriesLayoutBy,g.seriesLayoutBy)||null,v=(0,n.retrieve2)(f.sourceHeader,g.sourceHeader),y=(0,n.retrieve2)(f.dimensions,g.dimensions);t=m!==g.seriesLayoutBy||!!v!=!!g.sourceHeader||y?[(0,r._P)(u,{seriesLayoutBy:m,sourceHeader:v,dimensions:y},h)]:[]}else{var _=i;if(s){var x=this._applyTransform(a);t=x.sourceList,e=x.upstreamSignList}else{var b=_.get("source",!0);t=[(0,r._P)(b,this._getSourceMetaRawOption(),null)],e=[]}}this._setLocalSource(t,e)},t.prototype._applyTransform=function(t){var e,i=this._sourceHost,o=i.get("transform",!0),a=i.get("fromTransformResult",!0);if(null!=a){1!==t.length&&p("")}var l=[],u=[];return(0,n.each)(t,(function(t){t.prepareSource();var e=t.getSource(a||0);null==a||e||p(""),l.push(e),u.push(t._getVersionSign())})),o?e=(0,s.vK)(o,l,{datasetIndex:i.componentIndex}):null!=a&&(e=[(0,r.ML)(l[0])]),{sourceList:e,upstreamSignList:u}},t.prototype._isDirty=function(){if(this._dirty)return!0;for(var t=this._getUpstreamSourceManagers(),e=0;e{"use strict";i.d(e,{DA:()=>m,vK:()=>v});var n=i(4279),r=i(2234),o=i(8760),a=i(8540),s=i(8407),l=i(175),u=i(9574),h=function(){function t(){}return t.prototype.getRawData=function(){throw new Error("not supported")},t.prototype.getRawDataItem=function(t){throw new Error("not supported")},t.prototype.cloneRawData=function(){},t.prototype.getDimensionInfo=function(t){},t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){},t.prototype.retrieveValue=function(t,e){},t.prototype.retrieveValueFromItem=function(t,e){},t.prototype.convertValue=function(t,e){return(0,s.yQ)(t,e)},t}();function c(t){if(!_(t.sourceFormat)){0,(0,l._y)("")}return t.data}function d(t){var e=t.sourceFormat,i=t.data;if(!_(e)){0,(0,l._y)("")}if(e===n.XD){for(var r=[],a=0,s=i.length;a{"use strict";i.d(e,{RD:()=>pt.Z,TA:()=>p.Z,tF:()=>h.Z,Ir:()=>c.Z,aV:()=>f.Z,Hn:()=>T.Z,Hr:()=>u.Hr,wJ:()=>d.Z,$_:()=>_,$j:()=>u.$j,Ok:()=>u.Ok,HO:()=>u.HO,eU:()=>u.eU,zP:()=>u.zP,B9:()=>u.B9,OB:()=>dt.Z,Zy:()=>yt,tv:()=>gt,Sp:()=>mt,Zr:()=>vt,WU:()=>s,wL:()=>u.wL,JE:()=>u.JE,rp:()=>u.rp,FU:()=>u.FU,Q:()=>a,_y:()=>n,S1:()=>u.S1,z$:()=>ft.RV,pI:()=>m,Rx:()=>r,Nu:()=>Z.Z,pQ:()=>Z.Z,zl:()=>u.zl,RS:()=>u.RS,qR:()=>u.qR,yn:()=>u.yn,I2:()=>u.I2,je:()=>u.je,sq:()=>u.sq,Br:()=>u.Br,ds:()=>u.ds,Pu:()=>u.Pu,aW:()=>u.aW,rV:()=>u.OB,YK:()=>u.YK,Og:()=>u.Og,jQ:()=>u.jQ,g2:()=>B.g2,P2:()=>x.P2,XV:()=>o,D$:()=>z.D,D5:()=>l,xr:()=>v,i8:()=>u.i8,gf:()=>y,x_:()=>g});var n={};i.r(n),i.d(n,{createDimensions:()=>I.q,createList:()=>O,createScale:()=>E,createSymbol:()=>D.th,createTextStyle:()=>R,dataStack:()=>k,enableHoverEmphasis:()=>P.vF,getECData:()=>A.A,getLayoutRect:()=>M.ME,mixinAxisModelCommonMethods:()=>N});var r={};i.r(r),i.d(r,{MAX_SAFE_INTEGER:()=>F.YM,asc:()=>F.dt,getPercentWithPrecision:()=>F.eJ,getPixelPrecision:()=>F.M9,getPrecision:()=>F.p8,getPrecisionSafe:()=>F.ZB,isNumeric:()=>F.kE,isRadianAroundZero:()=>F.mW,linearMap:()=>F.NU,nice:()=>F.kx,numericToNumber:()=>F.FK,parseDate:()=>F.sG,quantile:()=>F.VR,quantity:()=>F.Xd,quantityExponent:()=>F.xW,reformIntervals:()=>F.nR,remRadian:()=>F.wW,round:()=>F.NM});var o={};i.r(o),i.d(o,{format:()=>V.WU,parse:()=>F.sG});var a={};i.r(a),i.d(a,{Arc:()=>it.Z,BezierCurve:()=>et.Z,BoundingRect:()=>st.Z,Circle:()=>X.Z,CompoundPath:()=>rt.Z,Ellipse:()=>Y.Z,Group:()=>U.Z,Image:()=>W.ZP,IncrementalDisplayable:()=>nt.Z,Line:()=>tt.Z,LinearGradient:()=>ot.Z,Polygon:()=>J.Z,Polyline:()=>Q.Z,RadialGradient:()=>at.Z,Rect:()=>$.Z,Ring:()=>K.Z,Sector:()=>q.C,Text:()=>j.ZP,clipPointsByRect:()=>G.clipPointsByRect,clipRectByRect:()=>G.clipRectByRect,createIcon:()=>G.createIcon,extendPath:()=>G.extendPath,extendShape:()=>G.extendShape,getShapeClass:()=>G.getShapeClass,getTransform:()=>G.getTransform,initProps:()=>H.KZ,makeImage:()=>G.makeImage,makePath:()=>G.makePath,mergePath:()=>G.mergePath,registerShape:()=>G.registerShape,resizePath:()=>G.resizePath,updateProps:()=>H.D});var s={};i.r(s),i.d(s,{addCommas:()=>lt.OD,capitalFirst:()=>lt.ew,encodeHTML:()=>ut.F1,formatTime:()=>lt.mr,formatTpl:()=>lt.kF,getTextRect:()=>ct,getTooltipMarker:()=>lt.A0,normalizeCssArray:()=>lt.MY,toCamelCase:()=>lt.zW,truncateText:()=>ht.aF});var l={};i.r(l),i.d(l,{bind:()=>y.bind,clone:()=>y.clone,curry:()=>y.curry,defaults:()=>y.defaults,each:()=>y.each,extend:()=>y.extend,filter:()=>y.filter,indexOf:()=>y.indexOf,inherits:()=>y.inherits,isArray:()=>y.isArray,isFunction:()=>y.isFunction,isObject:()=>y.isObject,isString:()=>y.isString,map:()=>y.map,merge:()=>y.merge,reduce:()=>y.reduce});var u=i(1615),h=i(8071),c=i(3166),d=i(3321),p=i(5797),f=i(5101),g=i(2780),m=i(4247),v=i(1362),y=i(8760),_=i(5673),x=i(270),b=i(8455),w=i(7947),S=i(6650),T=i(1497),M=i(6172),C=i(9936),A=i(106),L=i(6006),I=i(5623),D=i(1525),P=i(6357);function O(t){return(0,b.Z)(null,t)}var k={isDimensionStacked:C.M,enableDataStack:C.BM,getStackedDimension:C.IR};function E(t,e){var i=e;e instanceof T.Z||(i=new T.Z(e));var n=w.aG(i);return n.setExtent(t[0],t[1]),w.Jk(n,i),n}function N(t){y.mixin(t,S.W)}function R(t,e){return e=e||{},(0,L.Lr)(t,null,null,"normal"!==e.state)}var z=i(8023),B=i(5855),Z=i(6672),F=i(5669),V=i(5015),G=i(1177),H=i(4292),U=i(2141),W=i(4276),j=i(1590),X=i(65),Y=i(1524),q=i(1205),K=i(3782),J=i(6283),Q=i(7267),$=i(56),tt=i(9067),et=i(8989),it=i(7786),nt=i(7806),rt=i(89),ot=i(1899),at=i(6952),st=i(641),lt=i(8988),ut=i(4690),ht=i(6656);function ct(t,e,i,n,r,o,a,s){return new j.ZP({style:{text:t,font:e,align:i,verticalAlign:n,padding:r,rich:o,overflow:a?"truncate":null,lineHeight:s}}).getBoundingRect()}var dt=i(7153),pt=i(2950),ft=i(9026);function gt(t){var e=h.Z.extend(t);return h.Z.registerClass(e),e}function mt(t){var e=c.Z.extend(t);return c.Z.registerClass(e),e}function vt(t){var e=d.Z.extend(t);return d.Z.registerClass(e),e}function yt(t){var e=p.Z.extend(t);return p.Z.registerClass(e),e}var _t=i(7164);(0,z.D)(_t.T)},8023:(t,e,i)=>{"use strict";i.d(e,{D:()=>p});var n=i(1615),r=i(3166),o=i(5797),a=i(8071),s=i(3321),l=i(8760),u=i(9428),h=i(2780),c=[],d={registerPreprocessor:n.ds,registerProcessor:n.Pu,registerPostInit:n.sq,registerPostUpdate:n.Br,registerUpdateLifecycle:n.YK,registerAction:n.zl,registerCoordinateSystem:n.RS,registerLayout:n.qR,registerVisual:n.Og,registerTransform:n.OB,registerLoading:n.yn,registerMap:n.je,registerImpl:u.M,PRIORITY:n.Hr,ComponentModel:a.Z,ComponentView:r.Z,SeriesModel:s.Z,ChartView:o.Z,registerComponentModel:function(t){a.Z.registerClass(t)},registerComponentView:function(t){r.Z.registerClass(t)},registerSeriesModel:function(t){s.Z.registerClass(t)},registerChartView:function(t){o.Z.registerClass(t)},registerSubTypeDefaulter:function(t,e){a.Z.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){(0,h.registerPainter)(t,e)}};function p(t){(0,l.isArray)(t)?(0,l.each)(t,(function(t){p(t)})):(0,l.indexOf)(c,t)>=0||(c.push(t),(0,l.isFunction)(t)&&(t={install:t}),t.install(d))}},7164:(t,e,i)=>{"use strict";i.d(e,{T:()=>S});var n=i(2234),r=i(641),o=i(4292),a=i(106),s=i(5669),l=i(4995),u=i(7377),h=i(8760),c=i(4162),d=i(6006);function p(t){if(t){for(var e=[],i=0;i=0&&i.attr(b.oldLayoutSelect),(0,h.indexOf)(p,"emphasis")>=0&&i.attr(b.oldLayoutEmphasis)),(0,o.D)(i,u,e,l)}else if(i.attr(u),!(0,d.qA)(i).valueAnimation){var f=(0,h.retrieve2)(i.style.opacity,1);i.style.opacity=0,(0,o.KZ)(i,{style:{opacity:f}},e,l)}if(b.oldLayout=u,i.states.select){var g=b.oldLayoutSelect={};_(g,u,x),_(g,i.states.select,x)}if(i.states.emphasis){var m=b.oldLayoutEmphasis={};_(m,u,x),_(m,i.states.emphasis,x)}(0,d.tD)(i,l,c,e,e)}if(n&&!n.ignore&&!n.invisible){r=(b=y(n)).oldLayout;var b,w={points:n.shape.points};r?(n.attr({shape:r}),(0,o.D)(n,{shape:w},e)):(n.setShape(w),n.style.strokePercent=0,(0,o.KZ)(n,{style:{strokePercent:1}},e)),b.oldLayout=w}},t}();var w=(0,n.Yf)();function S(t){t.registerUpdateLifecycle("series:beforeupdate",(function(t,e,i){var n=w(e).labelManager;n||(n=w(e).labelManager=new b),n.clearLabels()})),t.registerUpdateLifecycle("series:layoutlabels",(function(t,e,i){var n=w(e).labelManager;i.updatedSeries.forEach((function(t){n.addLabelsOfSeries(e.getViewOfSeriesModel(t))})),n.updateLayoutConfig(e),n.layout(e),n.processLabelsOverall()}))}},7377:(t,e,i)=>{"use strict";i.d(e,{$x:()=>R,Iu:()=>N,_A:()=>O,d:()=>L,qK:()=>P});var n=i(239),r=i(8751),o=i(7267),a=i(2604),s=i(9502),l=i(7011),u=i(8760),h=i(4247),c=i(1362),d=i(6357),p=2*Math.PI,f=a.Z.CMD,g=["top","right","bottom","left"];function m(t,e,i,n,r){var o=i.width,a=i.height;switch(t){case"top":n.set(i.x+o/2,i.y-e),r.set(0,-1);break;case"bottom":n.set(i.x+o/2,i.y+a+e),r.set(0,1);break;case"left":n.set(i.x-e,i.y+a/2),r.set(-1,0);break;case"right":n.set(i.x+o+e,i.y+a/2),r.set(1,0)}}function v(t,e,i,n,r,o,a,l,u){a-=t,l-=e;var h=Math.sqrt(a*a+l*l),c=(a/=h)*i+t,d=(l/=h)*i+e;if(Math.abs(n-r)%p<1e-4)return u[0]=c,u[1]=d,h-i;if(o){var f=n;n=(0,s.m)(r),r=(0,s.m)(f)}else n=(0,s.m)(n),r=(0,s.m)(r);n>r&&(r+=p);var g=Math.atan2(l,a);if(g<0&&(g+=p),g>=n&&g<=r||g+p>=n&&g+p<=r)return u[0]=c,u[1]=d,h-i;var m=i*Math.cos(n)+t,v=i*Math.sin(n)+e,y=i*Math.cos(r)+t,_=i*Math.sin(r)+e,x=(m-a)*(m-a)+(v-l)*(v-l),b=(y-a)*(y-a)+(_-l)*(_-l);return x0){e=e/180*Math.PI,S.fromArray(t[0]),T.fromArray(t[1]),M.fromArray(t[2]),n.Z.sub(C,S,T),n.Z.sub(A,M,T);var i=C.len(),r=A.len();if(!(i<.001||r<.001)){C.scale(1/i),A.scale(1/r);var o=C.dot(A);if(Math.cos(e)1&&n.Z.copy(D,M),D.toArray(t[1])}}}}function O(t,e,i){if(i<=180&&i>0){i=i/180*Math.PI,S.fromArray(t[0]),T.fromArray(t[1]),M.fromArray(t[2]),n.Z.sub(C,T,S),n.Z.sub(A,M,T);var r=C.len(),o=A.len();if(!(r<.001||o<.001))if(C.scale(1/r),A.scale(1/o),C.dot(e)=s)n.Z.copy(D,M);else{D.scaleAndAdd(A,a/Math.tan(Math.PI/2-l));var u=M.x!==T.x?(D.x-T.x)/(M.x-T.x):(D.y-T.y)/(M.y-T.y);if(isNaN(u))return;u<0?n.Z.copy(D,T):u>1&&n.Z.copy(D,M)}D.toArray(t[1])}}}function k(t,e,i,n){var r="normal"===i,o=r?t:t.ensureState(i);o.ignore=e;var a=n.get("smooth");a&&!0===a&&(a=.3),o.shape=o.shape||{},a>0&&(o.shape.smooth=a);var s=n.getModel("lineStyle").getLineStyle();r?t.useStyle(s):o.style=s}function E(t,e){var i=e.smooth,n=e.points;if(n)if(t.moveTo(n[0][0],n[0][1]),i>0&&n.length>=3){var r=c.dist(n[0],n[1]),o=c.dist(n[1],n[2]);if(!r||!o)return t.lineTo(n[1][0],n[1][1]),void t.lineTo(n[2][0],n[2][1]);var a=Math.min(r,o)*i,s=c.lerp([],n[1],n[0],a/r),l=c.lerp([],n[1],n[2],a/o),u=c.lerp([],s,l,.5);t.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),t.bezierCurveTo(l[0],l[1],l[0],l[1],n[2][0],n[2][1])}else for(var h=1;h{"use strict";i.d(e,{GI:()=>l,VT:()=>o,WE:()=>s,yl:()=>u});var n=i(3848),r=i(641);function o(t){for(var e=[],i=0;i0&&o&&w(-c/a,0,a);var m,v,y=t[0],_=t[a-1];return x(),m<0&&S(-m,.8),v<0&&S(v,.8),x(),b(m,v,1),b(v,m,-1),x(),m<0&&T(-m),v<0&&T(v),u}function x(){m=y.rect[e]-n,v=r-_.rect[e]-_.rect[i]}function b(t,e,i){if(t<0){var n=Math.min(e,-t);if(n>0){w(n*i,0,a);var r=n+t;r<0&&S(-r*i,1)}else S(-t*i,1)}}function w(i,n,r){0!==i&&(u=!0);for(var o=n;o0)for(l=0;l0;l--){w(-(o[l-1]*c),l,a)}}}function T(t){var e=t<0?-1:1;t=Math.abs(t);for(var i=Math.ceil(t/(a-1)),n=0;n0?w(i,0,n+1):w(-i,a-n-1,a),(t-=i)<=0)return}}function s(t,e,i,n){return a(t,"x","width",e,i,n)}function l(t,e,i,n){return a(t,"y","height",e,i,n)}function u(t){var e=[];t.sort((function(t,e){return e.priority-t.priority}));var i=new r.Z(0,0,0,0);function o(t){if(!t.ignore){var e=t.ensureState("emphasis");null==e.ignore&&(e.ignore=!1)}t.ignore=!0}for(var a=0;a{"use strict";i.d(e,{Lr:()=>p,k3:()=>d,nC:()=>f,ni:()=>c,pe:()=>b,qA:()=>x,qT:()=>_,tD:()=>w});var n=i(1590),r=i(8760),o=i(6357),a=i(2234),s=i(4292),l={};function u(t,e){for(var i=0;i{"use strict";i.d(e,{Bk:()=>v,G_:()=>g,Ge:()=>d,Gk:()=>c,My:()=>p,bK:()=>m});var n=i(8760),r=i(5669),o=i(9936),a=i(5682),s=i(887),l="__ec_stack_";function u(t){return t.get("stack")||l+t.seriesIndex}function h(t){return t.dim+t.index}function c(t){var e=[],i=t.axis,r="axis0";if("category"===i.type){for(var o=i.getBandWidth(),a=0;a0&&(a=null===a?l:Math.min(a,l))}i[r]=a}}return i}(t),i=[];return(0,n.each)(t,(function(t){var n,o=t.coordinateSystem.getBaseAxis(),a=o.getExtent();if("category"===o.type)n=o.getBandWidth();else if("value"===o.type||"time"===o.type){var s=o.dim+"_"+o.index,l=e[s],c=Math.abs(a[1]-a[0]),d=o.scale.getExtent(),p=Math.abs(d[1]-d[0]);n=l?c/p*l:c}else{var f=t.getData();n=Math.abs(a[1]-a[0])/f.count()}var g=(0,r.GM)(t.get("barWidth"),n),m=(0,r.GM)(t.get("barMaxWidth"),n),v=(0,r.GM)(t.get("barMinWidth")||(_(t)?.5:1),n),y=t.get("barGap"),x=t.get("barCategoryGap");i.push({bandWidth:n,barWidth:g,barMaxWidth:m,barMinWidth:v,barGap:y,barCategoryGap:x,axisKey:h(o),stackId:u(t)})})),f(i)}function f(t){var e={};(0,n.each)(t,(function(t,i){var n=t.axisKey,r=t.bandWidth,o=e[n]||{bandWidth:r,remainedWidth:r,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},a=o.stacks;e[n]=o;var s=t.stackId;a[s]||o.autoWidthCount++,a[s]=a[s]||{width:0,maxWidth:0};var l=t.barWidth;l&&!a[s].width&&(a[s].width=l,l=Math.min(o.remainedWidth,l),o.remainedWidth-=l);var u=t.barMaxWidth;u&&(a[s].maxWidth=u);var h=t.barMinWidth;h&&(a[s].minWidth=h);var c=t.barGap;null!=c&&(o.gap=c);var d=t.barCategoryGap;null!=d&&(o.categoryGap=d)}));var i={};return(0,n.each)(e,(function(t,e){i[e]={};var o=t.stacks,a=t.bandWidth,s=t.categoryGap;if(null==s){var l=(0,n.keys)(o).length;s=Math.max(35-4*l,15)+"%"}var u=(0,r.GM)(s,a),h=(0,r.GM)(t.gap,1),c=t.remainedWidth,d=t.autoWidthCount,p=(c-u)/(d+(d-1)*h);p=Math.max(p,0),(0,n.each)(o,(function(t){var e=t.maxWidth,i=t.minWidth;if(t.width){n=t.width;e&&(n=Math.min(n,e)),i&&(n=Math.max(n,i)),t.width=n,c-=n+h*n,d--}else{var n=p;e&&en&&(n=i),n!==p&&(t.width=n,c-=n+h*n,d--)}})),p=(c-u)/(d+(d-1)*h),p=Math.max(p,0);var f,g=0;(0,n.each)(o,(function(t,e){t.width||(t.width=p),f=t,g+=t.width*(1+h)})),f&&(g-=f.width*h);var m=-g/2;(0,n.each)(o,(function(t,n){i[e][n]=i[e][n]||{bandWidth:a,offset:m,width:t.width},m+=t.width*(1+h)}))})),i}function g(t,e,i){if(t&&e){var n=t[h(e)];return null!=n&&null!=i?n[u(i)]:n}}function m(t,e){var i=d(t,e),r=p(i);(0,n.each)(i,(function(t){var e=t.getData(),i=t.coordinateSystem.getBaseAxis(),n=u(t),o=r[h(i)][n],a=o.offset,s=o.width;e.setLayout({bandWidth:o.bandWidth,offset:a,size:s})}))}function v(t){return{seriesType:t,plan:(0,a.Z)(),reset:function(t){if(y(t)){var e=t.getData(),i=t.coordinateSystem,n=i.getBaseAxis(),r=i.getOtherAxis(n),a=e.getDimensionIndex(e.mapDimension(r.dim)),l=e.getDimensionIndex(e.mapDimension(n.dim)),u=t.get("showBackground",!0),h=e.mapDimension(r.dim),c=e.getCalculationInfo("stackResultDimension"),d=(0,o.M)(e,h)&&!!e.getCalculationInfo("stackedOnSeries"),p=r.isHorizontal(),f=function(t,e){return e.toGlobalCoord(e.dataToCoord("log"===e.type?1:0))}(0,r),g=_(t),m=t.get("barMinHeight")||0,v=c&&e.getDimensionIndex(c),x=e.getLayout("size"),b=e.getLayout("offset");return{progress:function(t,e){for(var n,r=t.count,o=g&&(0,s.o)(3*r),h=g&&u&&(0,s.o)(3*r),c=g&&(0,s.o)(r),y=i.master.getRect(),_=p?y.width:y.height,w=e.getStore(),S=0;null!=(n=t.next());){var T=w.get(d?v:a,n),M=w.get(l,n),C=f,A=void 0;d&&(A=+T-w.get(a,n));var L=void 0,I=void 0,D=void 0,P=void 0;if(p){var O=i.dataToPoint([T,M]);if(d)C=i.dataToPoint([A,M])[0];L=C,I=O[1]+b,D=O[0]-C,P=x,Math.abs(D){"use strict";i.d(e,{Z:()=>s});var n=i(8760),r=i(5682),o=i(9936),a=i(887);function s(t,e){return{seriesType:t,plan:(0,r.Z)(),reset:function(t){var i=t.getData(),r=t.coordinateSystem,s=t.pipelineContext,l=e||s.large;if(r){var u=(0,n.map)(r.dimensions,(function(t){return i.mapDimension(t)})).slice(0,2),h=u.length,c=i.getCalculationInfo("stackResultDimension");(0,o.M)(i,u[0])&&(u[0]=c),(0,o.M)(i,u[1])&&(u[1]=c);var d=i.getStore(),p=i.getDimensionIndex(u[0]),f=i.getDimensionIndex(u[1]);return h&&{progress:function(t,e){for(var i=t.end-t.start,n=l&&(0,a.o)(i*h),o=[],s=[],u=t.start,c=0;u{"use strict";i.d(e,{s:()=>s,y:()=>o});var n=i(8760),r=i(2234);function o(t,e){function i(e,i){var n=[];return e.eachComponent({mainType:"series",subType:t,query:i},(function(t){n.push(t.seriesIndex)})),n}(0,n.each)([[t+"ToggleSelect","toggleSelect"],[t+"Select","select"],[t+"UnSelect","unselect"]],(function(t){e(t[0],(function(e,r,o){e=(0,n.extend)({},e),o.dispatchAction((0,n.extend)(e,{type:t[1],seriesIndex:i(r,e)}))}))}))}function a(t,e,i,o,a){var s=t+e;i.isSilent(s)||o.eachComponent({mainType:"series",subType:"pie"},(function(t){for(var e=t.seriesIndex,o=t.option.selectedMap,l=a.selected,u=0;u{"use strict";i.d(e,{Z:()=>d});var n=i(8299),r=i(8760),o=i(1497),a=i(2151),s=i(4251),l=i(2234),u=i(6172),h=(0,l.Yf)(),c=function(t){function e(e,i,n){var r=t.call(this,e,i,n)||this;return r.uid=a.Kr("ec_cpt_model"),r}var i;return(0,n.ZT)(e,t),e.prototype.init=function(t,e,i){this.mergeDefaultAndTheme(t,i)},e.prototype.mergeDefaultAndTheme=function(t,e){var i=u.YD(this),n=i?u.tE(t):{},o=e.getTheme();r.merge(t,o.get(this.mainType)),r.merge(t,this.getDefaultOption()),i&&u.dt(t,n,i)},e.prototype.mergeOption=function(t,e){r.merge(this.option,t,!0);var i=u.YD(this);i&&u.dt(this.option,t,i)},e.prototype.optionUpdated=function(t,e){},e.prototype.getDefaultOption=function(){var t=this.constructor;if(!(0,s.PT)(t))return t.defaultOption;var e=h(this);if(!e.defaultOption){for(var i=[],n=t;n;){var o=n.prototype.defaultOption;o&&i.push(o),n=n.superClass}for(var a={},l=i.length-1;l>=0;l--)a=r.merge(a,i[l],!0);e.defaultOption=a}return e.defaultOption},e.prototype.getReferringComponents=function(t,e){var i=t+"Index",n=t+"Id";return(0,l.HZ)(this.ecModel,t,{index:this.get(i,!0),id:this.get(n,!0)},e)},e.prototype.getBoxLayoutParams=function(){var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}},e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(t){this.option.zlevel=t},e.protoInitialize=((i=e.prototype).type="component",i.id="",i.name="",i.mainType="",i.subType="",void(i.componentIndex=0)),e}(o.Z);(0,s.pw)(c,o.Z),(0,s.au)(c),a.cj(c),a.jS(c,(function(t){var e=[];r.each(c.getClassesByMainType(t),(function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])})),e=r.map(e,(function(t){return(0,s.u9)(t).main})),"dataset"!==t&&r.indexOf(e,"dataset")<=0&&e.unshift("dataset");return e}));const d=c},1497:(t,e,i)=>{"use strict";i.d(e,{Z:()=>v});var n=i(7153),r=i(4251),o=(0,i(9066).Z)([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),a=function(){function t(){}return t.prototype.getAreaStyle=function(t,e){return o(this,t,e)},t}(),s=i(6006),l=i(1590),u=["textStyle","color"],h=["fontStyle","fontWeight","fontSize","fontFamily","padding","lineHeight","rich","width","height","overflow"],c=new l.ZP;const d=function(){function t(){}return t.prototype.getTextColor=function(t){var e=this.ecModel;return this.getShallow("color")||(!t&&e?e.get(u):null)},t.prototype.getFont=function(){return(0,s.qT)({fontStyle:this.getShallow("fontStyle"),fontWeight:this.getShallow("fontWeight"),fontSize:this.getShallow("fontSize"),fontFamily:this.getShallow("fontFamily")},this.ecModel)},t.prototype.getTextRect=function(t){for(var e={text:t,verticalAlign:this.getShallow("verticalAlign")||this.getShallow("baseline")},i=0;i{"use strict";i.d(e,{V:()=>v,Z:()=>C});var n=i(8299),r=i(8760),o=i(7153),a=i(2234),s=i(8071),l=i(5494),u=i(1219),h=i(6172),c=i(8674),d=i(4251),p=i(6437),f=i(3993),g=a.Yf();function m(t,e){return t.getName(e)||t.getId(e)}var v="__universalTransitionEnabled",y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectedDataIndicesMap={},e}var i;return(0,n.ZT)(e,t),e.prototype.init=function(t,e,i){this.seriesIndex=this.componentIndex,this.dataTask=(0,c.v)({count:x,reset:b}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,i),(g(this).sourceManager=new p.U(this)).prepareSource();var n=this.getInitialData(t,i);S(n,this),this.dataTask.context.data=n,g(this).dataBeforeProcessed=n,_(this),this._initSelectedMapFromData(n)},e.prototype.mergeDefaultAndTheme=function(t,e){var i=(0,h.YD)(this),n=i?(0,h.tE)(t):{},o=this.subType;s.Z.hasClass(o)&&(o+="Series"),r.merge(t,e.getTheme().get(this.subType)),r.merge(t,this.getDefaultOption()),a.Cc(t,"label",["show"]),this.fillDataTextStyle(t.data),i&&(0,h.dt)(t,n,i)},e.prototype.mergeOption=function(t,e){t=r.merge(this.option,t,!0),this.fillDataTextStyle(t.data);var i=(0,h.YD)(this);i&&(0,h.dt)(this.option,t,i);var n=g(this).sourceManager;n.dirty(),n.prepareSource();var o=this.getInitialData(t,e);S(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,g(this).dataBeforeProcessed=o,_(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(t){if(t&&!r.isTypedArray(t))for(var e=["show"],i=0;ithis.getShallow("animationThreshold")&&(e=!1),!!e},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,e,i){var n=this.ecModel,r=l._.prototype.getColorFromPalette.call(this,t,e,i);return r||(r=n.getColorFromPalette(t,e,i)),r},e.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)},e.prototype.getProgressive=function(){return this.get("progressive")},e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")},e.prototype.select=function(t,e){this._innerSelect(this.getData(e),t)},e.prototype.unselect=function(t,e){var i=this.option.selectedMap;if(i){var n=this.option.selectedMode,r=this.getData(e);if("series"===n||"all"===i)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var o=0;o=0&&i.push(o)}return i},e.prototype.isSelected=function(t,e){var i=this.option.selectedMap;if(!i)return!1;var n=this.getData(e);return("all"===i||i[m(n,t)])&&!n.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[v])return!0;var t=this.option.universalTransition;return!!t&&(!0===t||t&&t.enabled)},e.prototype._innerSelect=function(t,e){var i,n,o=this.option,a=o.selectedMode,s=e.length;if(a&&s)if("series"===a)o.selectedMap="all";else if("multiple"===a){r.isObject(o.selectedMap)||(o.selectedMap={});for(var l=o.selectedMap,u=0;u0&&this._innerSelect(t,e)}},e.registerClass=function(t){return s.Z.registerClass(t)},e.protoInitialize=((i=e.prototype).type="series.__base__",i.seriesIndex=0,i.ignoreStyleOnData=!1,i.hasSymbolVisual=!1,i.defaultSymbol="circle",i.visualStyleAccessPath="itemStyle",void(i.visualDrawType="fill")),e}(s.Z);function _(t){var e=t.name;a.yu(t)||(t.name=function(t){var e=t.getRawData(),i=e.mapDimensionsAll("seriesName"),n=[];return r.each(i,(function(t){var i=e.getDimensionInfo(t);i.displayName&&n.push(i.displayName)})),n.join(" ")}(t)||e)}function x(t){return t.model.getRawData().count()}function b(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),w}function w(t,e){e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function S(t,e){r.each(r.concatArray(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),(function(i){t.wrapMethod(i,r.curry(T,e))}))}function T(t,e){var i=M(t);return i&&i.setOutputEnd((e||this).count()),e}function M(t){var e=(t.ecModel||{}).scheduler,i=e&&e.getPipeline(t.uid);if(i){var n=i.currentTask;if(n){var r=n.agentStubMap;r&&(n=r.get(t.uid))}return n}}r.mixin(y,u.X),r.mixin(y,l._),(0,d.pw)(y,s.Z);const C=y},2468:(t,e,i)=>{"use strict";i.d(e,{R:()=>a,f:()=>o});var n=i(8760),r=(0,n.createHashMap)();function o(t,e){(0,n.assert)(null==r.get(t)&&e),r.set(t,e)}function a(t,e,i){var n=r.get(e);if(!n)return i;var o=n(t);return o?i.concat(o):i}},1219:(t,e,i)=>{"use strict";i.d(e,{X:()=>s,f:()=>l});var n=i(8760),r=i(8540),o=i(8988),a=/\{@(.+?)\}/g,s=function(){function t(){}return t.prototype.getDataParams=function(t,e){var i=this.getData(e),n=this.getRawValue(t,e),r=i.getRawIndex(t),o=i.getName(t),a=i.getRawDataItem(t),s=i.getItemVisual(t,"style"),l=s&&s[i.getItemVisual(t,"drawType")||"fill"],u=s&&s.stroke,h=this.mainType,c="series"===h,d=i.userOutput&&i.userOutput.get();return{componentType:h,componentSubType:this.subType,componentIndex:this.componentIndex,seriesType:c?this.subType:null,seriesIndex:this.seriesIndex,seriesId:c?this.id:null,seriesName:c?this.name:null,name:o,dataIndex:r,data:a,dataType:e,value:n,color:l,borderColor:u,dimensionNames:d?d.fullDimensions:null,encode:d?d.encode:null,$vars:["seriesName","name","value"]}},t.prototype.getFormattedLabel=function(t,e,i,s,l,u){e=e||"normal";var h=this.getData(i),c=this.getDataParams(t,i);(u&&(c.value=u.interpolatedValue),null!=s&&n.isArray(c.value)&&(c.value=c.value[s]),l)||(l=h.getItemModel(t).get("normal"===e?["label","formatter"]:[e,"label","formatter"]));return n.isFunction(l)?(c.status=e,c.dimensionIndex=s,l(c)):n.isString(l)?(0,o.kF)(l,c).replace(a,(function(e,i){var o=i.length,a=i;"["===a.charAt(0)&&"]"===a.charAt(o-1)&&(a=+a.slice(1,o-1));var s=(0,r.hk)(h,t,a);if(u&&n.isArray(u.interpolatedValue)){var l=h.getDimensionIndex(a);l>=0&&(s=u.interpolatedValue[l])}return null!=s?s+"":""})):void 0},t.prototype.getRawValue=function(t,e){return(0,r.hk)(this.getData(e),t)},t.prototype.formatTooltip=function(t,e,i){},t}();function l(t){var e,i;return n.isObject(t)?t.type&&(i=t):e=t,{text:e,frag:i}}},9887:(t,e,i)=>{"use strict";i.d(e,{D:()=>a,t:()=>r});var n=i(9066),r=[["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","borderType"],["lineDashOffset","borderDashOffset"],["lineCap","borderCap"],["lineJoin","borderJoin"],["miterLimit","borderMiterLimit"]],o=(0,n.Z)(r),a=function(){function t(){}return t.prototype.getItemStyle=function(t,e){return o(this,t,e)},t}()},7515:(t,e,i)=>{"use strict";i.d(e,{K:()=>a,v:()=>r});var n=i(9066),r=[["lineWidth","width"],["stroke","color"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["lineDash","type"],["lineDashOffset","dashOffset"],["lineCap","cap"],["lineJoin","join"],["miterLimit"]],o=(0,n.Z)(r),a=function(){function t(){}return t.prototype.getLineStyle=function(t){return o(this,t)},t}()},9066:(t,e,i)=>{"use strict";i.d(e,{Z:()=>r});var n=i(8760);function r(t,e){for(var i=0;i=0||o&&n.indexOf(o,l)<0)){var u=i.getShallow(l,e);null!=u&&(a[t[s][0]]=u)}}return a}}},5494:(t,e,i)=>{"use strict";i.d(e,{_:()=>a,i:()=>s});var n=i(2234),r=(0,n.Yf)(),o=(0,n.Yf)(),a=function(){function t(){}return t.prototype.getColorFromPalette=function(t,e,i){var o=(0,n.kF)(this.get("color",!0)),a=this.get("colorLayer",!0);return l(this,r,o,a,t,e,i)},t.prototype.clearColorPalette=function(){var t,e;(e=r)(t=this).paletteIdx=0,e(t).paletteNameMap={}},t}();function s(t,e,i,r){var a=(0,n.kF)(t.get(["aria","decal","decals"]));return l(t,o,a,null,e,i,r)}function l(t,e,i,n,r,o,a){var s=e(o=o||t),l=s.paletteIdx||0,u=s.paletteNameMap=s.paletteNameMap||{};if(u.hasOwnProperty(r))return u[r];var h=null!=a&&n?function(t,e){for(var i=t.length,n=0;ne)return t[n];return t[i-1]}(n,a):i;if((h=h||i)&&h.length){var c=h[l];return r&&(u[r]=c),s.paletteIdx=(l+1)%h.length,c}}},2488:(t,e,i)=>{"use strict";i.d(e,{N:()=>b});var n=i(7588),r=i(8760),o=i(8299),a=i(1935),s=i(7606),l=i(9026),u=i(641),h=i(1736),c=i(5855);function d(t,e,i){var n=c.qW.createCanvas(),r=e.getWidth(),o=e.getHeight(),a=n.style;return a&&(a.position="absolute",a.left="0",a.top="0",a.width=r+"px",a.height=o+"px",n.setAttribute("data-zr-dom-id",t)),n.width=r*i,n.height=o*i,n}const p=function(t){function e(e,i,o){var a,s=t.call(this)||this;s.motionBlur=!1,s.lastFrameAlpha=.7,s.dpr=1,s.virtual=!1,s.config={},s.incremental=!1,s.zlevel=0,s.maxRepaintRectCount=5,s.__dirty=!0,s.__firstTimePaint=!0,s.__used=!1,s.__drawIndex=0,s.__startIndex=0,s.__endIndex=0,s.__prevStartIndex=null,s.__prevEndIndex=null,o=o||n.KL,"string"==typeof e?a=d(e,i,o):r.isObject(e)&&(e=(a=e).id),s.id=e,s.dom=a;var l=a.style;return l&&(r.disableUserSelect(a),a.onselectstart=function(){return!1},l.padding="0",l.margin="0",l.borderWidth="0"),s.painter=i,s.dpr=o,s}return(0,o.ZT)(e,t),e.prototype.getElementCount=function(){return this.__endIndex-this.__startIndex},e.prototype.afterBrush=function(){this.__prevStartIndex=this.__startIndex,this.__prevEndIndex=this.__endIndex},e.prototype.initContext=function(){this.ctx=this.dom.getContext("2d"),this.ctx.dpr=this.dpr},e.prototype.setUnpainted=function(){this.__firstTimePaint=!0},e.prototype.createBackBuffer=function(){var t=this.dpr;this.domBack=d("back-"+this.id,this.painter,t),this.ctxBack=this.domBack.getContext("2d"),1!==t&&this.ctxBack.scale(t,t)},e.prototype.createRepaintRects=function(t,e,i,n){if(this.__firstTimePaint)return this.__firstTimePaint=!1,null;var r,o=[],a=this.maxRepaintRectCount,s=!1,l=new u.Z(0,0,0,0);function c(t){if(t.isFinite()&&!t.isZero())if(0===o.length){(e=new u.Z(0,0,0,0)).copy(t),o.push(e)}else{for(var e,i=!1,n=1/0,r=0,h=0;h=a)}}for(var d=this.__startIndex;d15)break}i.prevElClipPaths&&u.restore()};if(d)if(0===d.length)s=l.__endIndex;else for(var x=p.dpr,b=0;b0&&t>n[0]){for(s=0;st);s++);a=i[n[s]]}if(n.splice(s+1,0,t),i[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?o.insertBefore(e.dom,l.nextSibling):o.appendChild(e.dom)}else o.firstChild?o.insertBefore(e.dom,o.firstChild):o.appendChild(e.dom);e.__painter=this}},t.prototype.eachLayer=function(t,e){for(var i=this._zlevelList,n=0;n0?y:0),this._needsManuallyCompositing),c.__builtin__||r.logError("ZLevel "+u+" has been used by unkown layer "+c.id),c!==a&&(c.__used=!0,c.__startIndex!==o&&(c.__dirty=!0),c.__startIndex=o,c.incremental?c.__drawIndex=-1:c.__drawIndex=o,e(o),a=c),l.__dirty&h.YV&&!l.__inHover&&(c.__dirty=!0,c.incremental&&c.__drawIndex<0&&(c.__drawIndex=o))}e(o),this.eachBuiltinLayer((function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)}))},t.prototype.clear=function(){return this.eachBuiltinLayer(this._clearLayer),this},t.prototype._clearLayer=function(t){t.clear()},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t,r.each(this._layers,(function(t){t.setUnpainted()}))},t.prototype.configLayer=function(t,e){if(e){var i=this._layerConfig;i[t]?r.merge(i[t],e,!0):i[t]=e;for(var n=0;n{"use strict";i.d(e,{Z:()=>h});var n=i(8299),r=i(5669),o=i(8988),a=i(379),s=i(5021),l=r.NM,u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="interval",e._interval=0,e._intervalPrecision=2,e}return(0,n.ZT)(e,t),e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return s.XS(t,this._extent)},e.prototype.normalize=function(t){return s.Fv(t,this._extent)},e.prototype.scale=function(t){return s.bA(t,this._extent)},e.prototype.setExtent=function(t,e){var i=this._extent;isNaN(t)||(i[0]=parseFloat(t)),isNaN(e)||(i[1]=parseFloat(e))},e.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),this.setExtent(e[0],e[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=s.lb(t)},e.prototype.getTicks=function(t){var e=this._interval,i=this._extent,n=this._niceExtent,r=this._intervalPrecision,o=[];if(!e)return o;i[0]1e4)return[];var s=o.length?o[o.length-1].value:n[1];return i[1]>s&&(t?o.push({value:l(s+e,r)}):o.push({value:i[1]})),o},e.prototype.getMinorTicks=function(t){for(var e=this.getTicks(!0),i=[],n=this.getExtent(),r=1;rn[0]&&c{"use strict";i.d(e,{Z:()=>u});var n=i(8299),r=i(379),o=i(1401),a=i(5021),s=i(8760),l=function(t){function e(e){var i=t.call(this,e)||this;i.type="ordinal";var n=i.getSetting("ordinalMeta");return n||(n=new o.Z({})),(0,s.isArray)(n)&&(n=new o.Z({categories:(0,s.map)(n,(function(t){return(0,s.isObject)(t)?t.value:t}))})),i._ordinalMeta=n,i._extent=i.getSetting("extent")||[0,n.categories.length-1],i}return(0,n.ZT)(e,t),e.prototype.parse=function(t){return null==t?NaN:(0,s.isString)(t)?this._ordinalMeta.getOrdinal(t):Math.round(t)},e.prototype.contain=function(t){return t=this.parse(t),a.XS(t,this._extent)&&null!=this._ordinalMeta.categories[t]},e.prototype.normalize=function(t){return t=this._getTickNumber(this.parse(t)),a.Fv(t,this._extent)},e.prototype.scale=function(t){return t=Math.round(a.bA(t,this._extent)),this.getRawOrdinalNumber(t)},e.prototype.getTicks=function(){for(var t=[],e=this._extent,i=e[0];i<=e[1];)t.push({value:i}),i++;return t},e.prototype.getMinorTicks=function(t){},e.prototype.setSortInfo=function(t){if(null!=t){for(var e=t.ordinalNumbers,i=this._ordinalNumbersByTick=[],n=this._ticksByOrdinalNumber=[],r=0,o=this._ordinalMeta.categories.length,a=Math.min(o,e.length);r=0&&t=0&&t=t},e.prototype.getOrdinalMeta=function(){return this._ordinalMeta},e.prototype.calcNiceTicks=function(){},e.prototype.calcNiceExtent=function(){},e.type="ordinal",e}(r.Z);r.Z.registerClass(l);const u=l},379:(t,e,i)=>{"use strict";i.d(e,{Z:()=>o});var n=i(4251),r=function(){function t(t){this._setting=t||{},this._extent=[1/0,-1/0]}return t.prototype.getSetting=function(t){return this._setting[t]},t.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},t.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},t.prototype.getExtent=function(){return this._extent.slice()},t.prototype.setExtent=function(t,e){var i=this._extent;isNaN(t)||(i[0]=t),isNaN(e)||(i[1]=e)},t.prototype.isInExtentRange=function(t){return this._extent[0]<=t&&this._extent[1]>=t},t.prototype.isBlank=function(){return this._isBlank},t.prototype.setBlank=function(t){this._isBlank=t},t}();n.au(r);const o=r},1618:(t,e,i)=>{"use strict";i.d(e,{Z:()=>y});var n=i(8299),r=i(5669),o=i(5015),a=i(5021),s=i(103),l=i(379),u=i(8760),h=function(t){function e(e){var i=t.call(this,e)||this;return i.type="time",i}return(0,n.ZT)(e,t),e.prototype.getLabel=function(t){var e=this.getSetting("useUTC");return(0,o.WU)(t.value,o.V8[(0,o.xC)((0,o.Tj)(this._minLevelUnit))]||o.V8.second,e,this.getSetting("locale"))},e.prototype.getFormattedLabel=function(t,e,i){var n=this.getSetting("useUTC"),r=this.getSetting("locale");return(0,o.k7)(t,e,i,r,n)},e.prototype.getTicks=function(){var t=this._interval,e=this._extent,i=[];if(!t)return i;i.push({value:e[0],level:0});var n=this.getSetting("useUTC"),a=function(t,e,i,n){var a=1e4,s=o.FW,l=0;function h(t,e,i,r,o,a,s){for(var l=new Date(e),u=e,h=l[r]();u1&&0===c&&s.unshift({value:s[0].value-x})}}for(c=0;c=n[0]&&C<=n[1]&&x++)}var A=(n[1]-n[0])/e;if(x>1.5*A&&b>A/1.5)break;if(y.push(T),x>A||t===s[w])break}_=[]}}0;var L=(0,u.filter)((0,u.map)(y,(function(t){return(0,u.filter)(t,(function(t){return t.value>=n[0]&&t.value<=n[1]&&!t.notAdd}))})),(function(t){return t.length>0})),I=[],D=L.length-1;for(w=0;wi&&(this._approxInterval=i);var o=c.length,a=Math.min(function(t,e,i,n){for(;i>>1;t[r][1]16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function p(t){return(t/=30*o.s2)>6?6:t>3?3:t>2?2:1}function f(t){return(t/=o.dV)>12?12:t>6?6:t>3.5?4:t>2?2:1}function g(t,e){return(t/=e?o.yR:o.WT)>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function m(t){return r.kx(t,!0)}function v(t,e,i){var n=new Date(t);switch((0,o.Tj)(e)){case"year":case"month":n[(0,o.vh)(i)](0);case"day":n[(0,o.f5)(i)](1);case"hour":n[(0,o.En)(i)](0);case"minute":n[(0,o.eN)(i)](0);case"second":n[(0,o.rM)(i)](0),n[(0,o.cb)(i)](0)}return n.getTime()}l.Z.registerClass(h);const y=h},5021:(t,e,i)=>{"use strict";i.d(e,{Fv:()=>h,Qf:()=>o,XS:()=>u,bA:()=>c,lM:()=>r,lb:()=>s,r1:()=>a});var n=i(5669);function r(t){return"interval"===t.type||"log"===t.type}function o(t,e,i,r){var o={},a=t[1]-t[0],u=o.interval=(0,n.kx)(a/e,!0);null!=i&&ur&&(u=o.interval=r);var h=o.intervalPrecision=s(u);return function(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),l(t,0,e),l(t,1,e),t[0]>t[1]&&(t[0]=t[1])}(o.niceTickExtent=[(0,n.NM)(Math.ceil(t[0]/u)*u,h),(0,n.NM)(Math.floor(t[1]/u)*u,h)],t),o}function a(t){var e=Math.pow(10,(0,n.xW)(t)),i=t/e;return i?2===i?i=3:3===i?i=5:i*=2:i=1,(0,n.NM)(i*e)}function s(t){return(0,n.p8)(t)+2}function l(t,e,i){t[e]=Math.max(Math.min(t[e],i[1]),i[0])}function u(t,e){return t>=e[0]&&t<=e[1]}function h(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function c(t,e){return t*(e[1]-e[0])+e[0]}},4251:(t,e,i)=>{"use strict";i.d(e,{PT:()=>l,Qj:()=>d,au:()=>g,dm:()=>u,pw:()=>h,u9:()=>s});var n=i(8299),r=i(8760),o="___EC__COMPONENT__CONTAINER___",a="___EC__EXTENDED_CLASS___";function s(t){var e={main:"",sub:""};if(t){var i=t.split(".");e.main=i[0]||"",e.sub=i[1]||""}return e}function l(t){return!(!t||!t[a])}function u(t,e){t.$constructor=t,t.extend=function(t){var e,i,o=this;return i=o,r.isFunction(i)&&/^class\s/.test(Function.prototype.toString.call(i))?e=function(t){function e(){return t.apply(this,arguments)||this}return(0,n.ZT)(e,t),e}(o):(e=function(){(t.$constructor||o).apply(this,arguments)},r.inherits(e,this)),r.extend(e.prototype,t),e[a]=!0,e.extend=this.extend,e.superCall=p,e.superApply=f,e.superClass=o,e}}function h(t,e){t.extend=e.extend}var c=Math.round(10*Math.random());function d(t){var e=["__\0is_clz",c++].join("_");t.prototype[e]=!0,t.isInstance=function(t){return!(!t||!t[e])}}function p(t,e){for(var i=[],n=2;n{"use strict";i.d(e,{Kr:()=>a,ZL:()=>u,cj:()=>s,jS:()=>l});var n=i(8760),r=i(4251),o=Math.round(10*Math.random());function a(t){return[t||"",o++].join("_")}function s(t){var e={};t.registerSubTypeDefaulter=function(t,i){var n=(0,r.u9)(t);e[n.main]=i},t.determineSubType=function(i,n){var o=n.type;if(!o){var a=(0,r.u9)(i).main;t.hasSubTypes(i)&&e[a]&&(o=e[a](n))}return o}}function l(t,e){function i(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]}t.topologicalTravel=function(t,r,o,a){if(t.length){var s=function(t){var r={},o=[];return n.each(t,(function(a){var s=i(r,a),l=function(t,e){var i=[];return n.each(t,(function(t){n.indexOf(e,t)>=0&&i.push(t)})),i}(s.originalDeps=e(a),t);s.entryCount=l.length,0===s.entryCount&&o.push(a),n.each(l,(function(t){n.indexOf(s.predecessor,t)<0&&s.predecessor.push(t);var e=i(r,t);n.indexOf(e.successor,t)<0&&e.successor.push(a)}))})),{graph:r,noEntryList:o}}(r),l=s.graph,u=s.noEntryList,h={};for(n.each(t,(function(t){h[t]=!0}));u.length;){var c=u.pop(),d=l[c],p=!!h[c];p&&(o.call(a,c,d.originalDeps.slice()),delete h[c]),n.each(d.successor,p?g:f)}n.each(h,(function(){throw new Error("")}))}function f(t){l[t].entryCount--,0===l[t].entryCount&&u.push(t)}function g(t){h[t]=!0,f(t)}}}function u(t,e){return n.merge(n.merge({},t,!0),e,!0)}},9038:(t,e,i)=>{"use strict";i.d(e,{I:()=>g});var n=Math.round(9*Math.random()),r="function"==typeof Object.defineProperty;const o=function(){function t(){this._id="__ec_inner_"+n++}return t.prototype.get=function(t){return this._guard(t)[this._id]},t.prototype.set=function(t,e){var i=this._guard(t);return r?Object.defineProperty(i,this._id,{value:e,enumerable:!1,configurable:!0}):i[this._id]=e,this},t.prototype.delete=function(t){return!!this.has(t)&&(delete this._guard(t)[this._id],!0)},t.prototype.has=function(t){return!!this._guard(t)[this._id]},t.prototype._guard=function(t){if(t!==Object(t))throw TypeError("Value of WeakMap is not a non-null object.");return t},t}();var a=i(4070),s=i(8760),l=i(5669),u=i(1525),h=i(9026),c=i(5855),d=new o,p=new a.ZP(100),f=["symbol","symbolSize","symbolKeepAspect","color","backgroundColor","dashArrayX","dashArrayY","maxTileWidth","maxTileHeight"];function g(t,e){if("none"===t)return null;var i=e.getDevicePixelRatio(),n=e.getZr(),r="svg"===n.painter.type;t.dirty&&d.delete(t);var o=d.get(t);if(o)return o;var a=(0,s.defaults)(t,{symbol:"rect",symbolSize:1,symbolKeepAspect:!0,color:"rgba(0, 0, 0, 0.2)",backgroundColor:null,dashArrayX:5,dashArrayY:5,rotation:0,maxTileWidth:512,maxTileHeight:512});"none"===a.backgroundColor&&(a.backgroundColor=null);var g={repeat:"repeat"};return function(t){for(var e,o=[i],d=!0,g=0;g{"use strict";function n(t,e,i){for(var n;t&&(!e(t)||(n=t,!i));)t=t.__hostTarget||t.parent;return n}i.d(e,{o:()=>n})},8988:(t,e,i)=>{"use strict";i.d(e,{A0:()=>g,Lz:()=>y,MI:()=>_,MY:()=>u,OD:()=>s,ew:()=>v,kF:()=>p,mr:()=>m,uX:()=>h,wx:()=>f,zW:()=>l});var n=i(8760),r=i(4690),o=i(5669),a=i(5015);function s(t){if(!(0,o.kE)(t))return n.isString(t)?t:"-";var e=(t+"").split(".");return e[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(e.length>1?"."+e[1]:"")}function l(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()})),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}var u=n.normalizeCssArray;function h(t,e,i){function r(t){return t&&n.trim(t)?t:"-"}function l(t){return!(null==t||isNaN(t)||!isFinite(t))}var u="time"===e,h=t instanceof Date;if(u||h){var c=u?(0,o.sG)(t):t;if(!isNaN(+c))return(0,a.WU)(c,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",i);if(h)return"-"}if("ordinal"===e)return n.isStringSafe(t)?r(t):n.isNumber(t)&&l(t)?t+"":"-";var d=(0,o.FK)(t);return l(d)?s(d):n.isStringSafe(t)?r(t):"boolean"==typeof t?t+"":"-"}var c=["a","b","c","d","e","f","g"],d=function(t,e){return"{"+t+(null==e?"":e)+"}"};function p(t,e,i){n.isArray(e)||(e=[e]);var o=e.length;if(!o)return"";for(var a=e[0].$vars||[],s=0;s':'':{renderMode:s,content:"{"+(i.markerId||"markerX")+"|} ",style:"subItem"===a?{width:4,height:4,borderRadius:2,backgroundColor:o}:{width:10,height:10,borderRadius:5,backgroundColor:o}}:""}function m(t,e,i){"week"!==t&&"month"!==t&&"quarter"!==t&&"half-year"!==t&&"year"!==t||(t="MM-dd\nyyyy");var n=(0,o.sG)(e),r=i?"getUTC":"get",s=n[r+"FullYear"](),l=n[r+"Month"]()+1,u=n[r+"Date"](),h=n[r+"Hours"](),c=n[r+"Minutes"](),d=n[r+"Seconds"](),p=n[r+"Milliseconds"]();return t=t.replace("MM",(0,a.vk)(l,2)).replace("M",l).replace("yyyy",s).replace("yy",(0,a.vk)(s%100+"",2)).replace("dd",(0,a.vk)(u,2)).replace("d",u).replace("hh",(0,a.vk)(h,2)).replace("h",h).replace("mm",(0,a.vk)(c,2)).replace("m",c).replace("ss",(0,a.vk)(d,2)).replace("s",d).replace("SSS",(0,a.vk)(p,3))}function v(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function y(t,e){return e=e||"transparent",n.isString(t)?t:n.isObject(t)&&t.colorStops&&(t.colorStops[0]||{}).color||e}function _(t,e){if("_blank"===e||"blank"===e){var i=window.open();i.opener=null,i.location.href=t}else window.open(t,e)}},1177:(t,e,i)=>{"use strict";i.r(e),i.d(e,{Arc:()=>x.Z,BezierCurve:()=>_.Z,BoundingRect:()=>T.Z,Circle:()=>c.Z,CompoundPath:()=>b.Z,Ellipse:()=>d.Z,Group:()=>u.Z,Image:()=>l.ZP,IncrementalDisplayable:()=>A.Z,Line:()=>y.Z,LinearGradient:()=>w.Z,OrientedBoundingRect:()=>M.Z,Path:()=>a.ZP,Point:()=>C.Z,Polygon:()=>g.Z,Polyline:()=>m.Z,RadialGradient:()=>S.Z,Rect:()=>v.Z,Ring:()=>f.Z,Sector:()=>p.C,Text:()=>h.ZP,applyTransform:()=>q,clipPointsByRect:()=>$,clipRectByRect:()=>tt,createIcon:()=>et,extendPath:()=>z,extendShape:()=>N,getShapeClass:()=>Z,getTransform:()=>Y,groupTransition:()=>Q,initProps:()=>P.KZ,isElementRemoved:()=>P.eq,lineLineIntersect:()=>nt,linePolygonIntersect:()=>it,makeImage:()=>V,makePath:()=>F,mergePath:()=>H,registerShape:()=>B,removeElement:()=>P.bX,removeElementWithFadeOut:()=>P.XD,resizePath:()=>U,setTooltipConfig:()=>ot,subPixelOptimize:()=>X,subPixelOptimizeLine:()=>W,subPixelOptimizeRect:()=>j,transformDirection:()=>K,traverseElements:()=>st,updateProps:()=>P.D});var n=i(6051),r=i(4247),o=i(1362),a=i(8751),s=i(4995),l=i(4276),u=i(2141),h=i(1590),c=i(65),d=i(1524),p=i(1205),f=i(3782),g=i(6283),m=i(7267),v=i(56),y=i(9067),_=i(8989),x=i(7786),b=i(89),w=i(1899),S=i(6952),T=i(641),M=i(3848),C=i(239),A=i(7806),L=i(4380),I=i(8760),D=i(106),P=i(4292),O=Math.max,k=Math.min,E={};function N(t){return a.ZP.extend(t)}var R=n.Pc;function z(t,e){return R(t,e)}function B(t,e){E[t]=e}function Z(t){if(E.hasOwnProperty(t))return E[t]}function F(t,e,i,r){var o=n.iR(t,e);return i&&("center"===r&&(i=G(i,o.getBoundingRect())),U(o,i)),o}function V(t,e,i){var n=new l.ZP({style:{image:t,x:e.x,y:e.y,width:e.width,height:e.height},onload:function(t){if("center"===i){var r={width:t.width,height:t.height};n.setStyle(G(e,r))}}});return n}function G(t,e){var i,n=e.width/e.height,r=t.height*n;return i=r<=t.width?t.height:(r=t.width)/n,{x:t.x+t.width/2-r/2,y:t.y+t.height/2-i/2,width:r,height:i}}var H=n.AA;function U(t,e){if(t.applyTransform){var i=t.getBoundingRect().calculateTransform(e);t.applyTransform(i)}}function W(t,e){return L._3(t,t,{lineWidth:e}),t}function j(t){return L.Pw(t.shape,t.shape,t.style),t}var X=L.vu;function Y(t,e){for(var i=r.identity([]);t&&t!==e;)r.mul(i,t.getLocalTransform(),i),t=t.parent;return i}function q(t,e,i){return e&&!(0,I.isArrayLike)(e)&&(e=s.ZP.getLocalTransform(e)),i&&(e=r.invert([],e)),o.applyTransform([],t,e)}function K(t,e,i){var n=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),r=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),o=["left"===t?-n:"right"===t?n:0,"top"===t?-r:"bottom"===t?r:0];return o=q(o,e,i),Math.abs(o[0])>Math.abs(o[1])?o[0]>0?"right":"left":o[1]>0?"bottom":"top"}function J(t){return!t.isGroup}function Q(t,e,i){if(t&&e){var n,r=(n={},t.traverse((function(t){J(t)&&t.anid&&(n[t.anid]=t)})),n);e.traverse((function(t){if(J(t)&&t.anid){var e=r[t.anid];if(e){var n=o(t);t.attr(o(e)),(0,P.D)(t,n,i,(0,D.A)(t).dataIndex)}}}))}function o(t){var e={x:t.x,y:t.y,rotation:t.rotation};return function(t){return null!=t.shape}(t)&&(e.shape=(0,I.extend)({},t.shape)),e}}function $(t,e){return(0,I.map)(t,(function(t){var i=t[0];i=O(i,e.x),i=k(i,e.x+e.width);var n=t[1];return n=O(n,e.y),[i,n=k(n,e.y+e.height)]}))}function tt(t,e){var i=O(t.x,e.x),n=k(t.x+t.width,e.x+e.width),r=O(t.y,e.y),o=k(t.y+t.height,e.y+e.height);if(n>=i&&o>=r)return{x:i,y:r,width:n-i,height:o-r}}function et(t,e,i){var n=(0,I.extend)({rectHover:!0},e),r=n.style={strokeNoScale:!0};if(i=i||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(r.image=t.slice(8),(0,I.defaults)(r,i),new l.ZP(n)):F(t.replace("path://",""),n,i,"center")}function it(t,e,i,n,r){for(var o=0,a=r[r.length-1];o=-1e-6)return!1;var f=t-r,g=e-o,m=rt(f,g,u,h)/p;if(m<0||m>1)return!1;var v=rt(f,g,c,d)/p;return!(v<0||v>1)}function rt(t,e,i,n){return t*n-i*e}function ot(t){var e=t.itemTooltipOption,i=t.componentModel,n=t.itemName,r=(0,I.isString)(e)?{formatter:e}:e,o=i.mainType,a=i.componentIndex,s={componentType:o,name:n,$vars:["name"]};s[o+"Index"]=a;var l=t.formatterParamsExtra;l&&(0,I.each)((0,I.keys)(l),(function(t){(0,I.hasOwn)(s,t)||(s[t]=l[t],s.$vars.push(t))}));var u=(0,D.A)(t.el);u.componentMainType=o,u.componentIndex=a,u.tooltipConfig={name:n,option:(0,I.defaults)({content:n,formatterParams:s},r)}}function at(t,e){var i;t.isGroup&&(i=e(t)),i||t.traverse(e)}function st(t,e){if(t)if((0,I.isArray)(t))for(var i=0;i{"use strict";i.d(e,{A:()=>n,Q:()=>r});var n=(0,i(2234).Yf)(),r=function(t,e,i,r){if(r){var o=n(r);o.dataIndex=i,o.dataType=e,o.seriesIndex=t,"group"===r.type&&r.traverse((function(r){var o=n(r);o.seriesIndex=t,o.dataIndex=i,o.dataType=e}))}}},6172:(t,e,i)=>{"use strict";i.d(e,{BZ:()=>c,ME:()=>p,QM:()=>g,QT:()=>_,YD:()=>m,dt:()=>v,gN:()=>l,lq:()=>d,p$:()=>f,tE:()=>y});var n=i(8760),r=i(641),o=i(5669),a=i(8988),s=n.each,l=["left","right","top","bottom","width","height"],u=[["width","left","right"],["height","top","bottom"]];function h(t,e,i,n,r){var o=0,a=0;null==n&&(n=1/0),null==r&&(r=1/0);var s=0;e.eachChild((function(l,u){var h,c,d=l.getBoundingRect(),p=e.childAt(u+1),f=p&&p.getBoundingRect();if("horizontal"===t){var g=d.width+(f?-f.x+d.x:0);(h=o+g)>n||l.newline?(o=0,h=g,a+=s+i,s=d.height):s=Math.max(s,d.height)}else{var m=d.height+(f?-f.y+d.y:0);(c=a+m)>r||l.newline?(o+=s+i,a=0,c=m,s=d.width):s=Math.max(s,d.width)}l.newline||(l.x=o,l.y=a,l.markRedraw(),"horizontal"===t?o=h+i:a=c+i)}))}var c=h;n.curry(h,"vertical"),n.curry(h,"horizontal");function d(t,e,i){var n=e.width,r=e.height,s=(0,o.GM)(t.left,n),l=(0,o.GM)(t.top,r),u=(0,o.GM)(t.right,n),h=(0,o.GM)(t.bottom,r);return(isNaN(s)||isNaN(parseFloat(t.left)))&&(s=0),(isNaN(u)||isNaN(parseFloat(t.right)))&&(u=n),(isNaN(l)||isNaN(parseFloat(t.top)))&&(l=0),(isNaN(h)||isNaN(parseFloat(t.bottom)))&&(h=r),i=a.MY(i||0),{width:Math.max(u-s-i[1]-i[3],0),height:Math.max(h-l-i[0]-i[2],0)}}function p(t,e,i){i=a.MY(i||0);var n=e.width,s=e.height,l=(0,o.GM)(t.left,n),u=(0,o.GM)(t.top,s),h=(0,o.GM)(t.right,n),c=(0,o.GM)(t.bottom,s),d=(0,o.GM)(t.width,n),p=(0,o.GM)(t.height,s),f=i[2]+i[0],g=i[1]+i[3],m=t.aspect;switch(isNaN(d)&&(d=n-h-g-l),isNaN(p)&&(p=s-c-f-u),null!=m&&(isNaN(d)&&isNaN(p)&&(m>n/s?d=.8*n:p=.8*s),isNaN(d)&&(d=m*p),isNaN(p)&&(p=d/m)),isNaN(l)&&(l=n-h-d-g),isNaN(u)&&(u=s-c-p-f),t.left||t.right){case"center":l=n/2-d/2-i[3];break;case"right":l=n-d-g}switch(t.top||t.bottom){case"middle":case"center":u=s/2-p/2-i[0];break;case"bottom":u=s-p-f}l=l||0,u=u||0,isNaN(d)&&(d=n-g-l-(h||0)),isNaN(p)&&(p=s-f-u-(c||0));var v=new r.Z(l+i[3],u+i[0],d,p);return v.margin=i,v}function f(t,e,i,o,a,s){var l,u=!a||!a.hv||a.hv[0],h=!a||!a.hv||a.hv[1],c=a&&a.boundingMode||"all";if((s=s||t).x=t.x,s.y=t.y,!u&&!h)return!1;if("raw"===c)l="group"===t.type?new r.Z(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(l=t.getBoundingRect(),t.needLocalTransform()){var d=t.getLocalTransform();(l=l.clone()).applyTransform(d)}var f=p(n.defaults({width:l.width,height:l.height},e),i,o),g=u?f.x-l.x:0,m=h?f.y-l.y:0;return"raw"===c?(s.x=g,s.y=m):(s.x+=g,s.y+=m),s===t&&t.markRedraw(),!0}function g(t,e){return null!=t[u[e][0]]||null!=t[u[e][1]]&&null!=t[u[e][2]]}function m(t){var e=t.layoutMode||t.constructor.layoutMode;return n.isObject(e)?e:e?{type:e}:null}function v(t,e,i){var r=i&&i.ignoreSize;!n.isArray(r)&&(r=[r,r]);var o=l(u[0],0),a=l(u[1],1);function l(i,n){var o={},a=0,l={},u=0;if(s(i,(function(e){l[e]=t[e]})),s(i,(function(t){h(e,t)&&(o[t]=l[t]=e[t]),c(o,t)&&a++,c(l,t)&&u++})),r[n])return c(e,i[1])?l[i[2]]=null:c(e,i[2])&&(l[i[1]]=null),l;if(2!==u&&a){if(a>=2)return o;for(var d=0;d{"use strict";i.d(e,{Sh:()=>s,ZK:()=>a,_y:()=>l});var n={},r="undefined"!=typeof console&&console.warn&&console.log;function o(t,e,i){if(r){if(i){if(n[e])return;n[e]=!0}console[t]("[ECharts] "+e)}}function a(t,e){o("warn",t,e)}function s(t){0}function l(t){throw new Error(t)}},2234:(t,e,i)=>{"use strict";i.d(e,{C4:()=>d,C6:()=>L,Cc:()=>h,Co:()=>p,HZ:()=>D,IL:()=>O,O0:()=>b,P$:()=>P,Td:()=>c,U5:()=>v,U9:()=>k,XI:()=>w,Yf:()=>T,ab:()=>f,g0:()=>x,gO:()=>S,iP:()=>I,kF:()=>u,lY:()=>_,pk:()=>N,pm:()=>C,pv:()=>E,yu:()=>y,zH:()=>A});var n=i(8760),r=i(7153),o=i(5669);function a(t,e,i){return(e-t)*i+t}var s="series\0",l="\0_ec_\0";function u(t){return t instanceof Array?t:null==t?[]:[t]}function h(t,e,i){if(t){t[e]=t[e]||{},t.emphasis=t.emphasis||{},t.emphasis[e]=t.emphasis[e]||{};for(var n=0,r=i.length;n{"use strict";i.d(e,{FK:()=>M,GM:()=>a,HD:()=>p,M9:()=>c,NM:()=>s,NU:()=>o,S$:()=>f,VR:()=>S,Xd:()=>x,YM:()=>g,ZB:()=>h,dt:()=>l,eJ:()=>d,jj:()=>A,kE:()=>C,kx:()=>w,mW:()=>v,nR:()=>T,nl:()=>I,p8:()=>u,sG:()=>_,wW:()=>m,xW:()=>b});var n=i(8760),r=1e-4;function o(t,e,i,n){var r=e[0],o=e[1],a=i[0],s=i[1],l=o-r,u=s-a;if(0===l)return 0===u?a:(a+s)/2;if(n)if(l>0){if(t<=r)return a;if(t>=o)return s}else{if(t>=r)return a;if(t<=o)return s}else{if(t===r)return a;if(t===o)return s}return(t-r)/l*u+a}function a(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return n.isString(t)?(i=t,i.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t;var i}function s(t,e,i){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),t=(+t).toFixed(e),i?t:+t}function l(t){return t.sort((function(t,e){return t-e})),t}function u(t){if(t=+t,isNaN(t))return 0;if(t>1e-14)for(var e=1,i=0;i<15;i++,e*=10)if(Math.round(t*e)/e===t)return i;return h(t)}function h(t){var e=t.toString().toLowerCase(),i=e.indexOf("e"),n=i>0?+e.slice(i+1):0,r=i>0?i:e.length,o=e.indexOf("."),a=o<0?0:r-1-o;return Math.max(0,a-n)}function c(t,e){var i=Math.log,n=Math.LN10,r=Math.floor(i(t[1]-t[0])/n),o=Math.round(i(Math.abs(e[1]-e[0]))/n),a=Math.min(Math.max(-r+o,0),20);return isFinite(a)?a:20}function d(t,e,i){return t[e]&&p(t,i)[e]||0}function p(t,e){var i=n.reduce(t,(function(t,e){return t+(isNaN(e)?0:e)}),0);if(0===i)return[];for(var r=Math.pow(10,e),o=n.map(t,(function(t){return(isNaN(t)?0:t)/i*r*100})),a=100*r,s=n.map(o,(function(t){return Math.floor(t)})),l=n.reduce(s,(function(t,e){return t+e}),0),u=n.map(o,(function(t,e){return t-s[e]}));lh&&(h=u[d],c=d);++s[c],u[c]=0,++l}return n.map(s,(function(t){return t/r}))}function f(t,e){var i=Math.max(u(t),u(e)),n=t+e;return i>20?n:s(n,i)}var g=9007199254740991;function m(t){var e=2*Math.PI;return(t%e+e)%e}function v(t){return t>-1e-4&&t=10&&e++,e}function w(t,e){var i=b(t),n=Math.pow(10,i),r=t/n;return t=(e?r<1.5?1:r<2.5?2:r<4?3:r<7?5:10:r<1?1:r<2?2:r<3?3:r<5?5:10)*n,i>=-20?+t.toFixed(i<0?-i:0):t}function S(t,e){var i=(t.length-1)*e+1,n=Math.floor(i),r=+t[n-1],o=i-n;return o?r+o*(t[n]-r):r}function T(t){t.sort((function(t,e){return s(t,e,0)?-1:1}));for(var e=-1/0,i=1,n=0;n{"use strict";i.d(e,{$l:()=>Q,Av:()=>ht,C5:()=>it,CX:()=>p,Gl:()=>N,Hg:()=>x,Ib:()=>ot,JQ:()=>b,Ki:()=>y,L1:()=>g,MA:()=>z,Mh:()=>V,Nj:()=>ut,RW:()=>dt,SJ:()=>W,SX:()=>G,T5:()=>X,UL:()=>K,VP:()=>H,WO:()=>lt,XX:()=>U,aG:()=>pt,ci:()=>et,e9:()=>gt,fD:()=>F,iK:()=>w,k5:()=>rt,oJ:()=>J,og:()=>tt,qc:()=>m,th:()=>ct,vF:()=>nt,wU:()=>f,xp:()=>ft,xr:()=>$,yx:()=>_,zI:()=>q,zr:()=>v});var n=i(4070),r=i(8760),o=i(106),a=i(5673),s=i(2234),l=i(8751),u=1,h={},c=(0,s.Yf)(),d=(0,s.Yf)(),p=1,f=2,g=["emphasis","blur","select"],m=["normal","emphasis","blur","select"],v=10,y="highlight",_="downplay",x="select",b="unselect",w="toggleSelect";function S(t){return null!=t&&"none"!==t}var T=new n.ZP(100);function M(t){if((0,r.isString)(t)){var e=T.get(t);return e||(e=a.lift(t,-.1),T.put(t,e)),e}if((0,r.isGradientObject)(t)){var i=(0,r.extend)({},t);return i.colorStops=(0,r.map)(t.colorStops,(function(t){return{offset:t.offset,color:a.lift(t.color,-.1)}})),i}return t}function C(t,e,i){t.onHoverStateChange&&(t.hoverState||0)!==i&&t.onHoverStateChange(e),t.hoverState=i}function A(t){C(t,"emphasis",f)}function L(t){t.hoverState===f&&C(t,"normal",0)}function I(t){C(t,"blur",p)}function D(t){t.hoverState===p&&C(t,"normal",0)}function P(t){t.selected=!0}function O(t){t.selected=!1}function k(t,e,i){e(t,i)}function E(t,e,i){k(t,e,i),t.isGroup&&t.traverse((function(t){k(t,e,i)}))}function N(t,e){switch(e){case"emphasis":t.hoverState=f;break;case"normal":t.hoverState=0;break;case"blur":t.hoverState=p;break;case"select":t.selected=!0}}function R(t,e){var i=this.states[t];if(this.style){if("emphasis"===t)return function(t,e,i,n){var o=i&&(0,r.indexOf)(i,"select")>=0,a=!1;if(t instanceof l.ZP){var s=c(t),u=o&&s.selectFill||s.normalFill,h=o&&s.selectStroke||s.normalStroke;if(S(u)||S(h)){var d=(n=n||{}).style||{};"inherit"===d.fill?(a=!0,n=(0,r.extend)({},n),(d=(0,r.extend)({},d)).fill=u):!S(d.fill)&&S(u)?(a=!0,n=(0,r.extend)({},n),(d=(0,r.extend)({},d)).fill=M(u)):!S(d.stroke)&&S(h)&&(a||(n=(0,r.extend)({},n),d=(0,r.extend)({},d)),d.stroke=M(h)),n.style=d}}if(n&&null==n.z2){a||(n=(0,r.extend)({},n));var p=t.z2EmphasisLift;n.z2=t.z2+(null!=p?p:v)}return n}(this,0,e,i);if("blur"===t)return function(t,e,i){var n=(0,r.indexOf)(t.currentStates,e)>=0,o=t.style.opacity,a=n?null:function(t,e,i,n){for(var r=t.style,o={},a=0;a0){var o={dataIndex:r,seriesIndex:t.seriesIndex};null!=n&&(o.dataType=n),e.push(o)}}))})),e}function nt(t,e,i){ut(t,!0),E(t,z),ot(t,e,i)}function rt(t,e,i,n){n?function(t){ut(t,!1)}(t):nt(t,e,i)}function ot(t,e,i){var n=(0,o.A)(t);null!=e?(n.focus=e,n.blurScope=i):n.focus&&(n.focus=null)}var at=["emphasis","blur","select"],st={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"};function lt(t,e,i,n){i=i||"itemStyle";for(var r=0;r{"use strict";i.d(e,{Cq:()=>S,Pw:()=>y,th:()=>b,zp:()=>w});var n=i(8760),r=i(8751),o=i(9067),a=i(56),s=i(65),l=i(1177),u=i(641),h=i(9979),c=i(5669),d=r.ZP.extend({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,r=e.width/2,o=e.height/2;t.moveTo(i,n-o),t.lineTo(i+r,n+o),t.lineTo(i-r,n+o),t.closePath()}}),p=r.ZP.extend({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,r=e.width/2,o=e.height/2;t.moveTo(i,n-o),t.lineTo(i+r,n),t.lineTo(i,n+o),t.lineTo(i-r,n),t.closePath()}}),f=r.ZP.extend({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,n=e.y,r=e.width/5*3,o=Math.max(r,e.height),a=r/2,s=a*a/(o-a),l=n-o+a+s,u=Math.asin(s/a),h=Math.cos(u)*a,c=Math.sin(u),d=Math.cos(u),p=.6*a,f=.7*a;t.moveTo(i-h,l+s),t.arc(i,l,a,Math.PI-u,2*Math.PI+u),t.bezierCurveTo(i+h-c*p,l+s+d*p,i,n-f,i,n),t.bezierCurveTo(i,n-f,i-h+c*p,l+s+d*p,i-h,l+s),t.closePath()}}),g=r.ZP.extend({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.height,n=e.width,r=e.x,o=e.y,a=n/3*2;t.moveTo(r,o),t.lineTo(r+a,o+i),t.lineTo(r,o+i/4*3),t.lineTo(r-a,o+i),t.lineTo(r,o),t.closePath()}}),m={line:o.Z,rect:a.Z,roundRect:a.Z,square:a.Z,circle:s.Z,diamond:p,pin:f,arrow:g,triangle:d},v={line:function(t,e,i,n,r){r.x1=t,r.y1=e+n/2,r.x2=t+i,r.y2=e+n/2},rect:function(t,e,i,n,r){r.x=t,r.y=e,r.width=i,r.height=n},roundRect:function(t,e,i,n,r){r.x=t,r.y=e,r.width=i,r.height=n,r.r=Math.min(i,n)/4},square:function(t,e,i,n,r){var o=Math.min(i,n);r.x=t,r.y=e,r.width=o,r.height=o},circle:function(t,e,i,n,r){r.cx=t+i/2,r.cy=e+n/2,r.r=Math.min(i,n)/2},diamond:function(t,e,i,n,r){r.cx=t+i/2,r.cy=e+n/2,r.width=i,r.height=n},pin:function(t,e,i,n,r){r.x=t+i/2,r.y=e+n/2,r.width=i,r.height=n},arrow:function(t,e,i,n,r){r.x=t+i/2,r.y=e+n/2,r.width=i,r.height=n},triangle:function(t,e,i,n,r){r.cx=t+i/2,r.cy=e+n/2,r.width=i,r.height=n}},y={};(0,n.each)(m,(function(t,e){y[e]=new t}));var _=r.ZP.extend({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},calculateTextPosition:function(t,e,i){var n=(0,h.wI)(t,e,i),r=this.shape;return r&&"pin"===r.symbolType&&"inside"===e.position&&(n.y=i.y+.4*i.height),n},buildPath:function(t,e,i){var n=e.symbolType;if("none"!==n){var r=y[n];r||(r=y[n="rect"]),v[n](e.x,e.y,e.width,e.height,r.shape),r.buildPath(t,r.shape,i)}}});function x(t,e){if("image"!==this.type){var i=this.style;this.__isEmptyBrush?(i.stroke=t,i.fill=e||"#fff",i.lineWidth=2):"line"===this.shape.symbolType?i.stroke=t:i.fill=t,this.markRedraw()}}function b(t,e,i,n,r,o,a){var s,h=0===t.indexOf("empty");return h&&(t=t.substr(5,1).toLowerCase()+t.substr(6)),(s=0===t.indexOf("image://")?l.makeImage(t.slice(8),new u.Z(e,i,n,r),a?"center":"cover"):0===t.indexOf("path://")?l.makePath(t.slice(7),{},new u.Z(e,i,n,r),a?"center":"cover"):new _({shape:{symbolType:t,x:e,y:i,width:n,height:r}})).__isEmptyBrush=h,s.setColor=x,o&&s.setColor(o),s}function w(t){return(0,n.isArray)(t)||(t=[+t,+t]),[t[0]||0,t[1]||0]}function S(t,e){if(null!=t)return(0,n.isArray)(t)||(t=[t,t]),[(0,c.GM)(t[0],e[0])||0,(0,c.GM)((0,n.retrieve2)(t[1],t[0]),e[1])||0]}},270:(t,e,i)=>{"use strict";i.d(e,{P2:()=>a,T9:()=>s,ZH:()=>l});var n="\0__throttleOriginMethod",r="\0__throttleRate",o="\0__throttleType";function a(t,e,i){var n,r,o,a,s,l=0,u=0,h=null;function c(){u=(new Date).getTime(),h=null,t.apply(o,a||[])}e=e||0;var d=function(){for(var t=[],d=0;d=0?c():h=setTimeout(c,-r),l=n};return d.clear=function(){h&&(clearTimeout(h),h=null)},d.debounceNextCall=function(t){s=t},d}function s(t,e,i,s){var l=t[e];if(l){var u=l[n]||l,h=l[o];if(l[r]!==i||h!==s){if(null==i||!s)return t[e]=u;(l=t[e]=a(u,i,"debounce"===s))[n]=u,l[o]=s,l[r]=i}return l}}function l(t,e){var i=t[e];i&&i[n]&&(i.clear&&i.clear(),t[e]=i[n])}},5015:(t,e,i)=>{"use strict";i.d(e,{$K:()=>_,CW:()=>C,En:()=>N,FW:()=>m,MV:()=>D,P5:()=>c,RZ:()=>P,Tj:()=>y,V8:()=>f,WT:()=>s,WU:()=>b,Wp:()=>L,cb:()=>B,dV:()=>u,eN:()=>R,f5:()=>E,fn:()=>I,k7:()=>w,q5:()=>T,rM:()=>z,s2:()=>h,sx:()=>M,vh:()=>k,vk:()=>v,xC:()=>x,xL:()=>O,xz:()=>A,yR:()=>l});var n=i(8760),r=i(5669),o=i(3917),a=i(1497),s=1e3,l=60*s,u=60*l,h=24*u,c=365*h,d={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},p="{yyyy}-{MM}-{dd}",f={year:"{yyyy}",month:"{yyyy}-{MM}",day:p,hour:p+" "+d.hour,minute:p+" "+d.minute,second:p+" "+d.second,millisecond:d.none},g=["year","month","day","hour","minute","second","millisecond"],m=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function v(t,e){return"0000".substr(0,e-(t+="").length)+t}function y(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default:return t}}function _(t){return t===y(t)}function x(t){switch(t){case"year":case"month":return"day";case"millisecond":return"millisecond";default:return"second"}}function b(t,e,i,n){var s=r.sG(t),l=s[M(i)](),u=s[C(i)]()+1,h=Math.floor((u-1)/3)+1,c=s[A(i)](),d=s["get"+(i?"UTC":"")+"Day"](),p=s[L(i)](),f=(p-1)%12+1,g=s[I(i)](),m=s[D(i)](),y=s[P(i)](),_=(n instanceof a.Z?n:(0,o.G8)(n||o.sO)||(0,o.Li)()).getModel("time"),x=_.get("month"),b=_.get("monthAbbr"),w=_.get("dayOfWeek"),S=_.get("dayOfWeekAbbr");return(e||"").replace(/{yyyy}/g,l+"").replace(/{yy}/g,l%100+"").replace(/{Q}/g,h+"").replace(/{MMMM}/g,x[u-1]).replace(/{MMM}/g,b[u-1]).replace(/{MM}/g,v(u,2)).replace(/{M}/g,u+"").replace(/{dd}/g,v(c,2)).replace(/{d}/g,c+"").replace(/{eeee}/g,w[d]).replace(/{ee}/g,S[d]).replace(/{e}/g,d+"").replace(/{HH}/g,v(p,2)).replace(/{H}/g,p+"").replace(/{hh}/g,v(f+"",2)).replace(/{h}/g,f+"").replace(/{mm}/g,v(g,2)).replace(/{m}/g,g+"").replace(/{ss}/g,v(m,2)).replace(/{s}/g,m+"").replace(/{SSS}/g,v(y,3)).replace(/{S}/g,y+"")}function w(t,e,i,r,o){var a=null;if(n.isString(i))a=i;else if(n.isFunction(i))a=i(t.value,e,{level:t.level});else{var s=n.extend({},d);if(t.level>0)for(var l=0;l=0;--l)if(u[h]){a=u[h];break}a=a||s.none}if(n.isArray(a)){var c=null==t.level?0:t.level>=0?t.level:a.length+t.level;a=a[c=Math.min(c,a.length-1)]}}return b(new Date(t.value),a,o,r)}function S(t,e){var i=r.sG(t),n=i[C(e)]()+1,o=i[A(e)](),a=i[L(e)](),s=i[I(e)](),l=i[D(e)](),u=0===i[P(e)](),h=u&&0===l,c=h&&0===s,d=c&&0===a,p=d&&1===o;return p&&1===n?"year":p?"month":d?"day":c?"hour":h?"minute":u?"second":"millisecond"}function T(t,e,i){var o=n.isNumber(t)?r.sG(t):t;switch(e=e||S(t,i)){case"year":return o[M(i)]();case"half-year":return o[C(i)]()>=6?1:0;case"quarter":return Math.floor((o[C(i)]()+1)/4);case"month":return o[C(i)]();case"day":return o[A(i)]();case"half-day":return o[L(i)]()/24;case"hour":return o[L(i)]();case"minute":return o[I(i)]();case"second":return o[D(i)]();case"millisecond":return o[P(i)]()}}function M(t){return t?"getUTCFullYear":"getFullYear"}function C(t){return t?"getUTCMonth":"getMonth"}function A(t){return t?"getUTCDate":"getDate"}function L(t){return t?"getUTCHours":"getHours"}function I(t){return t?"getUTCMinutes":"getMinutes"}function D(t){return t?"getUTCSeconds":"getSeconds"}function P(t){return t?"getUTCMilliseconds":"getMilliseconds"}function O(t){return t?"setUTCFullYear":"setFullYear"}function k(t){return t?"setUTCMonth":"setMonth"}function E(t){return t?"setUTCDate":"setDate"}function N(t){return t?"setUTCHours":"setHours"}function R(t){return t?"setUTCMinutes":"setMinutes"}function z(t){return t?"setUTCSeconds":"setSeconds"}function B(t){return t?"setUTCMilliseconds":"setMilliseconds"}},4279:(t,e,i)=>{"use strict";i.d(e,{J5:()=>l,RA:()=>u,Wc:()=>c,XD:()=>o,cy:()=>r,f7:()=>n,fY:()=>h,hL:()=>s,qb:()=>a});var n=(0,i(8760).createHashMap)(["tooltip","label","itemName","itemId","itemGroupId","seriesName"]),r="original",o="arrayRows",a="objectRows",s="keyedColumns",l="typedArray",u="unknown",h="column",c="row"},887:(t,e,i)=>{"use strict";i.d(e,{o:()=>a});var n=i(8760),r="undefined"!=typeof Float32Array,o=r?Float32Array:Array;function a(t){return(0,n.isArray)(t)?r?new Float32Array(t):t:new o(t)}},5797:(t,e,i)=>{"use strict";i.d(e,{Z:()=>x});var n=i(8760),r=i(2141),o=i(2151),a=i(4251),s=i(2234),l=i(6357),u=i(8674),h=i(5682),c=i(1177),d=s.Yf(),p=(0,h.Z)(),f=function(){function t(){this.group=new r.Z,this.uid=o.Kr("viewChart"),this.renderTask=(0,u.v)({plan:v,reset:y}),this.renderTask.context={view:this}}return t.prototype.init=function(t,e){},t.prototype.render=function(t,e,i,n){0},t.prototype.highlight=function(t,e,i,n){var r=t.getData(n&&n.dataType);r&&m(r,n,"emphasis")},t.prototype.downplay=function(t,e,i,n){var r=t.getData(n&&n.dataType);r&&m(r,n,"normal")},t.prototype.remove=function(t,e){this.group.removeAll()},t.prototype.dispose=function(t,e){},t.prototype.updateView=function(t,e,i,n){this.render(t,e,i,n)},t.prototype.updateLayout=function(t,e,i,n){this.render(t,e,i,n)},t.prototype.updateVisual=function(t,e,i,n){this.render(t,e,i,n)},t.prototype.eachRendered=function(t){(0,c.traverseElements)(this.group,t)},t.markUpdateMethod=function(t,e){d(t).updateMethod=e},t.protoInitialize=void(t.prototype.type="chart"),t}();function g(t,e,i){t&&(0,l.Av)(t)&&("emphasis"===e?l.fD:l.Mh)(t,i)}function m(t,e,i){var r=s.gO(t,e),o=e&&null!=e.highlightKey?(0,l.RW)(e.highlightKey):null;null!=r?(0,n.each)(s.kF(r),(function(e){g(t.getItemGraphicEl(e),i,o)})):t.eachItemGraphicEl((function(t){g(t,i,o)}))}function v(t){return p(t.model)}function y(t){var e=t.model,i=t.ecModel,n=t.api,r=t.payload,o=e.pipelineContext.progressiveRender,a=t.view,s=r&&d(r).updateMethod,l=o?"incrementalPrepareRender":s&&a[s]?s:"render";return"render"!==l&&a[l](e,i,n,r),_[l]}a.dm(f,["dispose"]),a.au(f);var _={incrementalPrepareRender:{progress:function(t,e){e.view.incrementalRender(t,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(t,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}};const x=f},3166:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var n=i(2141),r=i(2151),o=i(4251),a=function(){function t(){this.group=new n.Z,this.uid=r.Kr("viewComponent")}return t.prototype.init=function(t,e){},t.prototype.render=function(t,e,i,n){},t.prototype.dispose=function(t,e){},t.prototype.updateView=function(t,e,i,n){},t.prototype.updateLayout=function(t,e,i,n){},t.prototype.updateVisual=function(t,e,i,n){},t.prototype.toggleBlurSeries=function(t,e,i){},t.prototype.eachRendered=function(t){var e=this.group;e&&e.traverse(t)},t}();o.dm(a),o.au(a);const s=a},2019:(t,e,i)=>{"use strict";i.d(e,{Z:()=>n});const n=function(){function t(t,e){this._getDataWithEncodedVisual=t,this._getRawData=e}return t.prototype.getAllNames=function(){var t=this._getRawData();return t.mapArray(t.getName)},t.prototype.containName=function(t){return this._getRawData().indexOfName(t)>=0},t.prototype.indexOfName=function(t){return this._getDataWithEncodedVisual().indexOfName(t)},t.prototype.getItemVisual=function(t,e){return this._getDataWithEncodedVisual().getItemVisual(t,e)},t}()},6211:(t,e,i)=>{"use strict";function n(t,e,i){switch(i){case"color":return t.getItemVisual(e,"style")[t.getVisual("drawType")];case"opacity":return t.getItemVisual(e,"style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getItemVisual(e,i)}}function r(t,e){switch(e){case"color":return t.getVisual("style")[t.getVisual("drawType")];case"opacity":return t.getVisual("style").opacity;case"symbol":case"symbolSize":case"liftZ":return t.getVisual(e)}}function o(t,e,i,n){switch(i){case"color":t.ensureUniqueItemVisual(e,"style")[t.getVisual("drawType")]=n,t.setItemVisual(e,"colorFromPalette",!1);break;case"opacity":t.ensureUniqueItemVisual(e,"style").opacity=n;break;case"symbol":case"symbolSize":case"liftZ":t.setItemVisual(e,i,n)}}i.d(e,{LZ:()=>o,Or:()=>n,UL:()=>r})},8299:(t,e,i)=>{"use strict";i.d(e,{ZT:()=>r}); +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},n(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}Object.create;Object.create},7734:(t,e,i)=>{"use strict";i.d(e,{Z:()=>w});var n=i(4995),r=i(8677),o=i(641),a=i(1935),s=i(9979),l=i(8760),u=i(7588),h=i(5673),c=i(1736),d="__zr_normal__",p=n.dN.concat(["ignore"]),f=(0,l.reduce)(n.dN,(function(t,e){return t[e]=!0,t}),{ignore:!1}),g={},m=new o.Z(0,0,0,0),v=function(){function t(t){this.id=(0,l.guid)(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e,i){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var n=this.transform;n||(n=this.transform=[1,0,0,1,0,0]),n[4]+=t,n[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var i=this.textConfig,n=i.local,r=e.innerTransformable,o=void 0,a=void 0,l=!1;r.parent=n?this:null;var u=!1;if(r.copyTransform(e),null!=i.position){var h=m;i.layoutRect?h.copy(i.layoutRect):h.copy(this.getBoundingRect()),n||h.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(g,i,h):(0,s.wI)(g,i,h),r.x=g.x,r.y=g.y,o=g.align,a=g.verticalAlign;var d=i.origin;if(d&&null!=i.rotation){var p=void 0,f=void 0;"center"===d?(p=.5*h.width,f=.5*h.height):(p=(0,s.GM)(d[0],h.width),f=(0,s.GM)(d[1],h.height)),u=!0,r.originX=-r.x+p+(n?0:h.x),r.originY=-r.y+f+(n?0:h.y)}}null!=i.rotation&&(r.rotation=i.rotation);var v=i.offset;v&&(r.x+=v[0],r.y+=v[1],u||(r.originX=-v[0],r.originY=-v[1]));var y=null==i.inside?"string"==typeof i.position&&i.position.indexOf("inside")>=0:i.inside,_=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),x=void 0,b=void 0,w=void 0;y&&this.canBeInsideText()?(x=i.insideFill,b=i.insideStroke,null!=x&&"auto"!==x||(x=this.getInsideTextFill()),null!=b&&"auto"!==b||(b=this.getInsideTextStroke(x),w=!0)):(x=i.outsideFill,b=i.outsideStroke,null!=x&&"auto"!==x||(x=this.getOutsideFill()),null!=b&&"auto"!==b||(b=this.getOutsideStroke(x),w=!0)),(x=x||"#000")===_.fill&&b===_.stroke&&w===_.autoStroke&&o===_.align&&a===_.verticalAlign||(l=!0,_.fill=x,_.stroke=b,_.autoStroke=w,_.align=o,_.verticalAlign=a,e.setDefaultTextStyle(_)),e.__dirty|=c.YV,l&&e.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(t){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?u.GD:u.vU},t.prototype.getOutsideStroke=function(t){var e=this.__zr&&this.__zr.getBackgroundColor(),i="string"==typeof e&&(0,h.parse)(e);i||(i=[255,255,255,1]);for(var n=i[3],r=this.__zr.isDarkMode(),o=0;o<3;o++)i[o]=i[o]*n+(r?0:255)*(1-n);return i[3]=1,(0,h.stringify)(i,"rgba")},t.prototype.traverse=function(t,e){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},(0,l.extend)(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if((0,l.isObject)(t))for(var i=t,n=(0,l.keys)(i),r=0;r0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(d,!1,t)},t.prototype.useState=function(t,e,i,n){var r=t===d;if(this.hasState()||!r){var o=this.currentStates,a=this.stateTransition;if(!((0,l.indexOf)(o,t)>=0)||!e&&1!==o.length){var s;if(this.stateProxy&&!r&&(s=this.stateProxy(t)),s||(s=this.states&&this.states[t]),s||r){r||this.saveCurrentToNormalState(s);var u=!!(s&&s.hoverLayer||n);u&&this._toggleHoverLayerFlag(!0),this._applyStateObj(t,s,this._normalState,e,!i&&!this.__inHover&&a&&a.duration>0,a);var h=this._textContent,p=this._textGuide;return h&&h.useState(t,e,i,u),p&&p.useState(t,e,i,u),r?(this.currentStates=[],this._normalState={}):e?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!u&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~c.YV),s}(0,l.logError)("State "+t+" not exists.")}}},t.prototype.useStates=function(t,e,i){if(t.length){var n=[],r=this.currentStates,o=t.length,a=o===r.length;if(a)for(var s=0;s0,f);var g=this._textContent,m=this._textGuide;g&&g.useStates(t,e,d),m&&m.useStates(t,e,d),this._updateAnimationTargets(),this.currentStates=t.slice(),this.markRedraw(),!d&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=~c.YV)}else this.clearStates()},t.prototype._updateAnimationTargets=function(){for(var t=0;t=0){var i=this.currentStates.slice();i.splice(e,1),this.useStates(i)}},t.prototype.replaceState=function(t,e,i){var n=this.currentStates.slice(),r=(0,l.indexOf)(n,t),o=(0,l.indexOf)(n,e)>=0;r>=0?o?n.splice(r,1):n[r]=e:i&&!o&&n.push(e),this.useStates(n)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,i={},n=0;n=0&&e.splice(i,1)})),this.animators.push(t),i&&i.animation.addAnimator(t),i&&i.wakeUp()},t.prototype.updateDuringAnimation=function(t){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var i=this.animators,n=i.length,r=[],o=0;o0&&i.during&&o[0].during((function(t,e){i.during(e)}));for(var d=0;d0||o.force&&!s.length){var C,A=void 0,L=void 0,I=void 0;if(u){L={},f&&(A={});for(T=0;T{"use strict";i.d(e,{V:()=>v,Z:()=>S});var n={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,i=.1,n=.4;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=n*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-n.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*n.bounceIn(2*t):.5*n.bounceOut(2*t-1)+.5}};const r=n;var o=i(8760),a=i(826);const s=function(){function t(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||o.noop,this.ondestroy=t.ondestroy||o.noop,this.onrestart=t.onrestart||o.noop,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var i=this._life,n=t-this._startTime-this._pausedTime,r=n/i;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=n%i;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=(0,o.isFunction)(t)?t:r[t]||(0,a.H)(t)},t}();var l=i(5673),u=i(2874),h=Array.prototype.slice;function c(t,e,i){return(e-t)*i+t}function d(t,e,i,n){for(var r=e.length,o=0;on?e:t,o=Math.min(i,n),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)n.length=a;else for(var s=o;s=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,i){this._needsSort=!0;var n=this.keyframes,s=n.length,h=!1,c=6,d=e;if((0,o.isArrayLike)(e)){var p=function(t){return(0,o.isArrayLike)(t&&t[0])?2:1}(e);c=p,(1===p&&!(0,o.isNumber)(e[0])||2===p&&!(0,o.isNumber)(e[0][0]))&&(h=!0)}else if((0,o.isNumber)(e)&&!(0,o.eqNaN)(e))c=0;else if((0,o.isString)(e))if(isNaN(+e)){var f=l.parse(e);f&&(d=f,c=3)}else c=0;else if((0,o.isGradientObject)(e)){var g=(0,o.extend)({},d);g.colorStops=(0,o.map)(e.colorStops,(function(t){return{offset:t.offset,color:l.parse(t.color)}})),(0,u.I1)(e)?c=4:(0,u.gO)(e)&&(c=5),d=g}0===s?this.valType=c:c===this.valType&&6!==c||(h=!0),this.discrete=this.discrete||h;var m={time:t,value:d,rawValue:e,percent:0};return i&&(m.easing=i,m.easingFunc=(0,o.isFunction)(i)?i:r[i]||(0,a.H)(i)),n.push(m),m},t.prototype.prepare=function(t,e){var i=this.keyframes;this._needsSort&&i.sort((function(t,e){return t.time-e.time}));for(var n=this.valType,r=i.length,o=i[r-1],a=this.discrete,s=x(n),l=_(n),u=0;u=0&&!(u[i].percent<=e);i--);i=m(i,h-2)}else{for(i=g;ie);i++);i=m(i-1,h-2)}r=u[i+1],n=u[i]}if(n&&r){this._lastFr=i,this._lastFrP=e;var v=r.percent-n.percent,w=0===v?1:m((e-n.percent)/v,1);r.easingFunc&&(w=r.easingFunc(w));var S=a?this._additiveValue:f?b:t[p];if(!x(l)&&!f||S||(S=this._additiveValue=[]),this.discrete)t[p]=w<1?n.rawValue:r.rawValue;else if(x(l))1===l?d(S,n[s],r[s],w):function(t,e,i,n){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,v(l),n),this._trackKeys.push(a)}s.addKeyframe(t,v(e[a]),n)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,i=0;i0)){this._started=1;for(var e=this,i=[],n=this._maxTime||0,r=0;r1){var s=a.pop();r.addKeyframe(s.time,t[n]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}()},826:(t,e,i)=>{"use strict";i.d(e,{H:()=>a});var n=i(7011),r=i(8760),o=/cubic-bezier\(([0-9,\.e ]+)\)/;function a(t){var e=t&&o.exec(t);if(e){var i=e[1].split(","),a=+(0,r.trim)(i[0]),s=+(0,r.trim)(i[1]),l=+(0,r.trim)(i[2]),u=+(0,r.trim)(i[3]);if(isNaN(a+s+l+u))return;var h=[];return function(t){return t<=0?0:t>=1?1:(0,n.kD)(0,a,l,1,t,h)&&(0,n.af)(0,s,u,1,h[0])}}}},8935:(t,e,i)=>{"use strict";i.d(e,{Z:()=>n});const n=i(7153).Z.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)}},2851:(t,e,i)=>{"use strict";i.d(e,{a:()=>r});var n=i(8760);function r(t){var e,i,r=t.style,o=r.lineDash&&r.lineWidth>0&&(e=r.lineDash,i=r.lineWidth,e&&"solid"!==e&&i>0?"dashed"===e?[4*i,2*i]:"dotted"===e?[i]:(0,n.isNumber)(e)?[e]:(0,n.isArray)(e)?e:null:null),a=r.lineDashOffset;if(o){var s=r.strokeNoScale&&t.getLineScale?t.getLineScale():1;s&&1!==s&&(o=(0,n.map)(o,(function(t){return t/s})),a/=s)}return[o,a]}},9026:(t,e,i)=>{"use strict";i.d(e,{Dm:()=>I,RV:()=>L,RZ:()=>x});var n=i(3795),r=i(2604),o=i(8819),a=i(7606),s=i(8751),l=i(4276),u=i(7472),h=i(8760),c=i(2851),d=i(1736),p=i(5855),f=new r.Z(!0);function g(t){var e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))}function m(t){return"string"==typeof t&&"none"!==t}function v(t){var e=t.fill;return null!=e&&"none"!==e}function y(t,e){if(null!=e.fillOpacity&&1!==e.fillOpacity){var i=t.globalAlpha;t.globalAlpha=e.fillOpacity*e.opacity,t.fill(),t.globalAlpha=i}else t.fill()}function _(t,e){if(null!=e.strokeOpacity&&1!==e.strokeOpacity){var i=t.globalAlpha;t.globalAlpha=e.strokeOpacity*e.opacity,t.stroke(),t.globalAlpha=i}else t.stroke()}function x(t,e,i){var n=(0,o.Gq)(e.image,e.__image,i);if((0,o.v5)(n)){var r=t.createPattern(n,e.repeat||"repeat");if("function"==typeof DOMMatrix&&r&&r.setTransform){var a=new DOMMatrix;a.translateSelf(e.x||0,e.y||0),a.rotateSelf(0,0,(e.rotation||0)*h.RADIAN_TO_DEGREE),a.scaleSelf(e.scaleX||1,e.scaleY||1),r.setTransform(a)}return r}}var b=["shadowBlur","shadowOffsetX","shadowOffsetY"],w=[["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]];function S(t,e,i,r,o){var a=!1;if(!r&&e===(i=i||{}))return!1;if(r||e.opacity!==i.opacity){C(t,o),a=!0;var s=Math.max(Math.min(e.opacity,1),0);t.globalAlpha=isNaN(s)?n.tj.opacity:s}(r||e.blend!==i.blend)&&(a||(C(t,o),a=!0),t.globalCompositeOperation=e.blend||n.tj.blend);for(var l=0;l{"use strict";function n(t){return isFinite(t)}function r(t,e,i){for(var r="radial"===e.type?function(t,e,i){var r=i.width,o=i.height,a=Math.min(r,o),s=null==e.x?.5:e.x,l=null==e.y?.5:e.y,u=null==e.r?.5:e.r;return e.global||(s=s*r+i.x,l=l*o+i.y,u*=a),s=n(s)?s:.5,l=n(l)?l:.5,u=u>=0&&n(u)?u:.5,t.createRadialGradient(s,l,0,s,l,u)}(t,e,i):function(t,e,i){var r=null==e.x?0:e.x,o=null==e.x2?1:e.x2,a=null==e.y?0:e.y,s=null==e.y2?0:e.y2;return e.global||(r=r*i.width+i.x,o=o*i.width+i.x,a=a*i.height+i.y,s=s*i.height+i.y),r=n(r)?r:0,o=n(o)?o:1,a=n(a)?a:0,s=n(s)?s:0,t.createLinearGradient(r,a,o,s)}(t,e,i),o=e.colorStops,a=0;ar,ap:()=>s,cF:()=>o})},7588:(t,e,i)=>{"use strict";i.d(e,{Ak:()=>o,GD:()=>s,KL:()=>r,iv:()=>l,vU:()=>a});var n=1;i(7153).Z.hasGlobalWindow&&(n=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var r=n,o=.4,a="#333",s="#ccc",l="#eee"},9736:(t,e,i)=>{"use strict";function n(t,e,i,n,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>n+s||at+s&&o>i+s||on})},4564:(t,e,i)=>{"use strict";i.d(e,{X:()=>o});var n=i(3537);function r(t,e){return Math.abs(t-e)<1e-8}function o(t,e,i){var o=0,a=t[0];if(!a)return!1;for(var s=1;s{"use strict";i.d(e,{m:()=>r});var n=i(7011);function r(t,e,i,r,o,a,s,l,u){if(0===s)return!1;var h=s;return!(u>e+h&&u>r+h&&u>a+h||ut+h&&l>i+h&&l>o+h||l{"use strict";i.d(e,{Dp:()=>d,GM:()=>p,M3:()=>h,dz:()=>s,lP:()=>u,mU:()=>c,wI:()=>f});var n=i(641),r=i(4070),o=i(5855),a={};function s(t,e){e=e||o.Uo;var i=a[e];i||(i=a[e]=new r.ZP(500));var n=i.get(t);return null==n&&(n=o.qW.measureText(t,e).width,i.put(t,n)),n}function l(t,e,i,r){var o=s(t,e),a=d(e),l=h(0,o,i),u=c(0,a,r);return new n.Z(l,u,o,a)}function u(t,e,i,r){var o=((t||"")+"").split("\n");if(1===o.length)return l(o[0],e,i,r);for(var a=new n.Z(0,0,0,0),s=0;s=0?parseFloat(t)/100*e:parseFloat(t):t}function f(t,e,i){var n=e.position||"inside",r=null!=e.distance?e.distance:5,o=i.height,a=i.width,s=o/2,l=i.x,u=i.y,h="left",c="top";if(n instanceof Array)l+=p(n[0],i.width),u+=p(n[1],i.height),h=null,c=null;else switch(n){case"left":l-=r,u+=s,h="right",c="middle";break;case"right":l+=r+a,u+=s,c="middle";break;case"top":l+=a/2,u-=r,h="center",c="bottom";break;case"bottom":l+=a/2,u+=o+r,h="center";break;case"inside":l+=a/2,u+=s,h="center",c="middle";break;case"insideLeft":l+=r,u+=s,c="middle";break;case"insideRight":l+=a-r,u+=s,h="right",c="middle";break;case"insideTop":l+=a/2,u+=r,h="center";break;case"insideBottom":l+=a/2,u+=o-r,h="center",c="bottom";break;case"insideTopLeft":l+=r,u+=r;break;case"insideTopRight":l+=a-r,u+=r,h="right";break;case"insideBottomLeft":l+=r,u+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,u+=o-r,h="right",c="bottom"}return(t=t||{}).x=l,t.y=u,t.align=h,t.verticalAlign=c,t}},9502:(t,e,i)=>{"use strict";i.d(e,{m:()=>r});var n=2*Math.PI;function r(t){return(t%=n)<0&&(t+=n),t}},3537:(t,e,i)=>{"use strict";function n(t,e,i,n,r,o){if(o>e&&o>n||or?s:0}i.d(e,{Z:()=>n})},641:(t,e,i)=>{"use strict";i.d(e,{Z:()=>p});var n=i(4247),r=i(239),o=Math.min,a=Math.max,s=new r.Z,l=new r.Z,u=new r.Z,h=new r.Z,c=new r.Z,d=new r.Z;const p=function(){function t(t,e,i,n){i<0&&(t+=i,i=-i),n<0&&(e+=n,n=-n),this.x=t,this.y=e,this.width=i,this.height=n}return t.prototype.union=function(t){var e=o(t.x,this.x),i=o(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=a(t.x+t.width,this.x+this.width)-e:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=a(t.y+t.height,this.y+this.height)-i:this.height=t.height,this.x=e,this.y=i},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,i=t.width/e.width,r=t.height/e.height,o=n.create();return n.translate(o,o,[-e.x,-e.y]),n.scale(o,o,[i,r]),n.translate(o,o,[t.x,t.y]),o},t.prototype.intersect=function(e,i){if(!e)return!1;e instanceof t||(e=t.create(e));var n=this,o=n.x,a=n.x+n.width,s=n.y,l=n.y+n.height,u=e.x,h=e.x+e.width,p=e.y,f=e.y+e.height,g=!(av&&(v=w,y<_?r.Z.set(d,-y,0):r.Z.set(d,_,0)):wv&&(v=S,x=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,i,n){if(n){if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],c=n[3],d=n[4],p=n[5];return e.x=i.x*r+d,e.y=i.y*c+p,e.width=i.width*r,e.height=i.height*c,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}s.x=u.x=i.x,s.y=h.y=i.y,l.x=h.x=i.x+i.width,l.y=u.y=i.y+i.height,s.transform(n),h.transform(n),l.transform(n),u.transform(n),e.x=o(s.x,l.x,u.x,h.x),e.y=o(s.y,l.y,u.y,h.y);var f=a(s.x,l.x,u.x,h.x),g=a(s.y,l.y,u.y,h.y);e.width=f-e.x,e.height=g-e.y}else e!==i&&t.copy(e,i)},t}()},1935:(t,e,i)=>{"use strict";i.d(e,{Z:()=>n});const n=function(){function t(t){t&&(this._$eventProcessor=t)}return t.prototype.on=function(t,e,i,n){this._$handlers||(this._$handlers={});var r=this._$handlers;if("function"==typeof e&&(n=i,i=e,e=null),!i||!t)return this;var o=this._$eventProcessor;null!=e&&o&&o.normalizeQuery&&(e=o.normalizeQuery(e)),r[t]||(r[t]=[]);for(var a=0;a{"use strict";i.d(e,{ZP:()=>o});var n=function(t){this.value=t},r=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new n(t);return this.insertEntry(e),e},t.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++},t.prototype.remove=function(t){var e=t.prev,i=t.next;e?e.next=i:this.head=i,i?i.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}();const o=function(){function t(t){this._list=new r,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var i=this._list,r=this._map,o=null;if(null==r[t]){var a=i.len(),s=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var l=i.head;i.remove(l),delete r[l.key],o=l.value,this._lastRemovedEntry=l}s?s.value=e:s=new n(e),s.key=t,i.insertEntry(s),r[t]=s}return o},t.prototype.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}()},3848:(t,e,i)=>{"use strict";i.d(e,{Z:()=>l});var n=i(239),r=[0,0],o=[0,0],a=new n.Z,s=new n.Z;const l=function(){function t(t,e){this._corners=[],this._axes=[],this._origin=[0,0];for(var i=0;i<4;i++)this._corners[i]=new n.Z;for(i=0;i<2;i++)this._axes[i]=new n.Z;t&&this.fromBoundingRect(t,e)}return t.prototype.fromBoundingRect=function(t,e){var i=this._corners,r=this._axes,o=t.x,a=t.y,s=o+t.width,l=a+t.height;if(i[0].set(o,a),i[1].set(s,a),i[2].set(s,l),i[3].set(o,l),e)for(var u=0;u<4;u++)i[u].transform(e);n.Z.sub(r[0],i[1],i[0]),n.Z.sub(r[1],i[3],i[0]),r[0].normalize(),r[1].normalize();for(u=0;u<2;u++)this._origin[u]=r[u].dot(i[0])},t.prototype.intersect=function(t,e){var i=!0,r=!e;return a.set(1/0,1/0),s.set(0,0),!this._intersectCheckOneSide(this,t,a,s,r,1)&&(i=!1,r)||!this._intersectCheckOneSide(t,this,a,s,r,-1)&&(i=!1,r)||r||n.Z.copy(e,i?a:s),i},t.prototype._intersectCheckOneSide=function(t,e,i,a,s,l){for(var u=!0,h=0;h<2;h++){var c=this._axes[h];if(this._getProjMinMaxOnAxis(h,t._corners,r),this._getProjMinMaxOnAxis(h,e._corners,o),r[1]o[1]){if(u=!1,s)return u;var d=Math.abs(o[0]-r[1]),p=Math.abs(r[0]-o[1]);Math.min(d,p)>a.len()&&(d{"use strict";i.d(e,{L:()=>M,Z:()=>C});var n=i(1362),r=i(641),o=i(7588),a=i(3933),s=i(7011),l={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},u=[],h=[],c=[],d=[],p=[],f=[],g=Math.min,m=Math.max,v=Math.cos,y=Math.sin,_=Math.abs,x=Math.PI,b=2*x,w="undefined"!=typeof Float32Array,S=[];function T(t){return Math.round(t/x*1e8)/1e8%2*x}function M(t,e){var i=T(t[0]);i<0&&(i+=b);var n=i-t[0],r=t[1];r+=n,!e&&r-i>=b?r=i+b:e&&i-r>=b?r=i-b:!e&&i>r?r=i+(b-T(i-r)):e&&i0&&(this._ux=_(i/o.KL/t)||0,this._uy=_(i/o.KL/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this._drawPendingPt(),this.addData(l.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var i=_(t-this._xi),n=_(e-this._yi),r=i>this._ux||n>this._uy;if(this.addData(l.L,t,e),this._ctx&&r&&this._ctx.lineTo(t,e),r)this._xi=t,this._yi=e,this._pendingPtDist=0;else{var o=i*i+n*n;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(t,e,i,n,r,o){return this._drawPendingPt(),this.addData(l.C,t,e,i,n,r,o),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,r,o),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,i,n){return this._drawPendingPt(),this.addData(l.Q,t,e,i,n),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this._xi=i,this._yi=n,this},t.prototype.arc=function(t,e,i,n,r,o){this._drawPendingPt(),S[0]=n,S[1]=r,M(S,o),n=S[0];var a=(r=S[1])-n;return this.addData(l.A,t,e,i,i,n,a,0,o?0:1),this._ctx&&this._ctx.arc(t,e,i,n,r,o),this._xi=v(r)*i+t,this._yi=y(r)*i+e,this},t.prototype.arcTo=function(t,e,i,n,r){return this._drawPendingPt(),this._ctx&&this._ctx.arcTo(t,e,i,n,r),this},t.prototype.rect=function(t,e,i,n){return this._drawPendingPt(),this._ctx&&this._ctx.rect(t,e,i,n),this.addData(l.R,t,e,i,n),this},t.prototype.closePath=function(){this._drawPendingPt(),this.addData(l.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&t.closePath(),this._xi=e,this._yi=i,this},t.prototype.fill=function(t){t&&t.fill(),this.toStatic()},t.prototype.stroke=function(t){t&&t.stroke(),this.toStatic()},t.prototype.len=function(){return this._len},t.prototype.setData=function(t){var e=t.length;this.data&&this.data.length===e||!w||(this.data=new Float32Array(e));for(var i=0;iu.length&&(this._expandData(),u=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],e=0;e11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){c[0]=c[1]=p[0]=p[1]=Number.MAX_VALUE,d[0]=d[1]=f[0]=f[1]=-Number.MAX_VALUE;var t,e=this.data,i=0,o=0,s=0,u=0;for(t=0;ti||_(T)>n||p===e-1)&&(w=Math.sqrt(z*z+T*T),r=S,o=A);break;case l.C:var M=t[p++],C=t[p++],A=(S=t[p++],t[p++]),L=t[p++],I=t[p++];w=(0,s.Ci)(r,o,M,C,S,A,L,I,10),r=L,o=I;break;case l.Q:M=t[p++],C=t[p++],S=t[p++],A=t[p++];w=(0,s.wQ)(r,o,M,C,S,A,10),r=S,o=A;break;case l.A:var D=t[p++],P=t[p++],O=t[p++],k=t[p++],E=t[p++],N=t[p++],R=N+E;p+=1;t[p++];x&&(a=v(E)*O+D,u=y(E)*k+P),w=m(O,k)*g(b,Math.abs(N)),r=v(R)*O+D,o=y(R)*k+P;break;case l.R:a=r=t[p++],u=o=t[p++],w=2*t[p++]+2*t[p++];break;case l.Z:var z=a-r;T=u-o;w=Math.sqrt(z*z+T*T),r=a,o=u}w>=0&&(h[d++]=w,c+=w)}return this._pathLen=c,c},t.prototype.rebuildPath=function(t,e){var i,n,r,o,a,c,d,p,f,x,b=this.data,w=this._ux,S=this._uy,T=this._len,M=e<1,C=0,A=0,L=0;if(!M||(this._pathSegLen||this._calculateLength(),d=this._pathSegLen,p=e*this._pathLen))t:for(var I=0;I0&&(t.lineTo(f,x),L=0),D){case l.M:i=r=b[I++],n=o=b[I++],t.moveTo(r,o);break;case l.L:a=b[I++],c=b[I++];var O=_(a-r),k=_(c-o);if(O>w||k>S){if(M){if(C+(nt=d[A++])>p){var E=(p-C)/nt;t.lineTo(r*(1-E)+a*E,o*(1-E)+c*E);break t}C+=nt}t.lineTo(a,c),r=a,o=c,L=0}else{var N=O*O+k*k;N>L&&(f=a,x=c,L=N)}break;case l.C:var R=b[I++],z=b[I++],B=b[I++],Z=b[I++],F=b[I++],V=b[I++];if(M){if(C+(nt=d[A++])>p){E=(p-C)/nt;(0,s.Vz)(r,R,B,F,E,u),(0,s.Vz)(o,z,Z,V,E,h),t.bezierCurveTo(u[1],h[1],u[2],h[2],u[3],h[3]);break t}C+=nt}t.bezierCurveTo(R,z,B,Z,F,V),r=F,o=V;break;case l.Q:R=b[I++],z=b[I++],B=b[I++],Z=b[I++];if(M){if(C+(nt=d[A++])>p){E=(p-C)/nt;(0,s.Lx)(r,R,B,E,u),(0,s.Lx)(o,z,Z,E,h),t.quadraticCurveTo(u[1],h[1],u[2],h[2]);break t}C+=nt}t.quadraticCurveTo(R,z,B,Z),r=B,o=Z;break;case l.A:var G=b[I++],H=b[I++],U=b[I++],W=b[I++],j=b[I++],X=b[I++],Y=b[I++],q=!b[I++],K=U>W?U:W,J=_(U-W)>.001,Q=j+X,$=!1;if(M)C+(nt=d[A++])>p&&(Q=j+X*(p-C)/nt,$=!0),C+=nt;if(J&&t.ellipse?t.ellipse(G,H,U,W,Y,j,Q,q):t.arc(G,H,K,j,Q,q),$)break t;P&&(i=v(j)*U+G,n=y(j)*W+H),r=v(Q)*U+G,o=y(Q)*W+H;break;case l.R:i=r=b[I],n=o=b[I+1],a=b[I++],c=b[I++];var tt=b[I++],et=b[I++];if(M){if(C+(nt=d[A++])>p){var it=p-C;t.moveTo(a,c),t.lineTo(a+g(it,tt),c),(it-=tt)>0&&t.lineTo(a+tt,c+g(it,et)),(it-=et)>0&&t.lineTo(a+m(tt-it,0),c+et),(it-=tt)>0&&t.lineTo(a,c+m(et-it,0));break t}C+=nt}t.rect(a,c,tt,et);break;case l.Z:if(M){var nt;if(C+(nt=d[A++])>p){E=(p-C)/nt;t.lineTo(r*(1-E)+i*E,o*(1-E)+n*E);break t}C+=nt}t.closePath(),r=i,o=n}}},t.prototype.clone=function(){var e=new t,i=this.data;return e.data=i.slice?i.slice():Array.prototype.slice.call(i),e._len=this._len,e},t.CMD=l,t.initDefaultProps=((e=t.prototype)._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,void(e._version=0)),t}()},239:(t,e,i)=>{"use strict";i.d(e,{Z:()=>n});const n=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,i=this.y;return this.x=t[0]*e+t[2]*i+t[4],this.y=t[1]*e+t[3]*i+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,i){t.x=e,t.y=i},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,i){t.x=e.x+i.x,t.y=e.y+i.y},t.sub=function(t,e,i){t.x=e.x-i.x,t.y=e.y-i.y},t.scale=function(t,e,i){t.x=e.x*i,t.y=e.y*i},t.scaleAndAdd=function(t,e,i,n){t.x=e.x+i.x*n,t.y=e.y+i.y*n},t.lerp=function(t,e,i,n){var r=1-n;t.x=r*e.x+n*i.x,t.y=r*e.y+n*i.y},t}()},4995:(t,e,i)=>{"use strict";i.d(e,{ZP:()=>g,dN:()=>p,kY:()=>f});var n=i(4247),r=i(1362),o=n.identity,a=5e-5;function s(t){return t>a||t<-5e-5}var l=[],u=[],h=n.create(),c=Math.abs,d=function(){function t(){}var e;return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},t.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},t.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},t.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},t.prototype.needLocalTransform=function(){return s(this.rotation)||s(this.x)||s(this.y)||s(this.scaleX-1)||s(this.scaleY-1)||s(this.skewX)||s(this.skewY)},t.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,e=this.needLocalTransform(),i=this.transform;e||t?(i=i||n.create(),e?this.getLocalTransform(i):o(i),t&&(e?n.mul(i,t,i):n.copy(i,t)),this.transform=i,this._resolveGlobalScaleRatio(i)):i&&o(i)},t.prototype._resolveGlobalScaleRatio=function(t){var e=this.globalScaleRatio;if(null!=e&&1!==e){this.getGlobalScale(l);var i=l[0]<0?-1:1,r=l[1]<0?-1:1,o=((l[0]-i)*e+i)/l[0]||0,a=((l[1]-r)*e+r)/l[1]||0;t[0]*=o,t[1]*=o,t[2]*=a,t[3]*=a}this.invTransform=this.invTransform||n.create(),n.invert(this.invTransform,t)},t.prototype.getComputedTransform=function(){for(var t=this,e=[];t;)e.push(t),t=t.parent;for(;t=e.pop();)t.updateTransform();return this.transform},t.prototype.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],i=t[2]*t[2]+t[3]*t[3],n=Math.atan2(t[1],t[0]),r=Math.PI/2+n-Math.atan2(t[3],t[2]);i=Math.sqrt(i)*Math.cos(r),e=Math.sqrt(e),this.skewX=r,this.skewY=0,this.rotation=-n,this.x=+t[4],this.y=+t[5],this.scaleX=e,this.scaleY=i,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(n.mul(u,t.invTransform,e),e=u);var i=this.originX,r=this.originY;(i||r)&&(h[4]=i,h[5]=r,n.mul(u,e,h),u[4]-=i,u[5]-=r,e=u),this.setLocalTransform(e)}},t.prototype.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},t.prototype.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&r.applyTransform(i,i,n),i},t.prototype.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&r.applyTransform(i,i,n),i},t.prototype.getLineScale=function(){var t=this.transform;return t&&c(t[0]-1)>1e-10&&c(t[3]-1)>1e-10?Math.sqrt(c(t[0]*t[3]-t[2]*t[1])):1},t.prototype.copyTransform=function(t){f(this,t)},t.getLocalTransform=function(t,e){e=e||[];var i=t.originX||0,r=t.originY||0,o=t.scaleX,a=t.scaleY,s=t.anchorX,l=t.anchorY,u=t.rotation||0,h=t.x,c=t.y,d=t.skewX?Math.tan(t.skewX):0,p=t.skewY?Math.tan(-t.skewY):0;if(i||r||s||l){var f=i+s,g=r+l;e[4]=-f*o-d*g*a,e[5]=-g*a-p*f*o}else e[4]=e[5]=0;return e[0]=o,e[3]=a,e[1]=p*o,e[2]=d*a,u&&n.rotate(e,e,u),e[4]+=i+h,e[5]+=r+c,e},t.initDefaultProps=((e=t.prototype).scaleX=e.scaleY=e.globalScaleRatio=1,void(e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0)),t}(),p=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function f(t,e){for(var i=0;i{"use strict";i.d(e,{H9:()=>v,mJ:()=>y,qL:()=>_,u4:()=>f,zk:()=>p});var n=i(1362),r=i(7011),o=Math.min,a=Math.max,s=Math.sin,l=Math.cos,u=2*Math.PI,h=n.create(),c=n.create(),d=n.create();function p(t,e,i){if(0!==t.length){for(var n=t[0],r=n[0],s=n[0],l=n[1],u=n[1],h=1;h1e-4)return f[0]=t-i,f[1]=e-r,g[0]=t+i,void(g[1]=e+r);if(h[0]=l(o)*i+t,h[1]=s(o)*r+e,c[0]=l(a)*i+t,c[1]=s(a)*r+e,m(f,h,c),v(g,h,c),(o%=u)<0&&(o+=u),(a%=u)<0&&(a+=u),o>a&&!p?a+=u:oo&&(d[0]=l(x)*i+t,d[1]=s(x)*r+e,m(f,d,f),v(g,d,g))}},7011:(t,e,i)=>{"use strict";i.d(e,{AZ:()=>S,Ci:()=>b,Jz:()=>T,Lx:()=>C,QC:()=>M,Vz:()=>_,Wr:()=>A,X_:()=>m,Zm:()=>w,af:()=>g,kD:()=>v,pP:()=>y,t1:()=>x,wQ:()=>L});var n=i(1362),r=Math.pow,o=Math.sqrt,a=1e-8,s=1e-4,l=o(3),u=1/3,h=(0,n.create)(),c=(0,n.create)(),d=(0,n.create)();function p(t){return t>-1e-8&&ta||t<-1e-8}function g(t,e,i,n,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*n+3*o*i)}function m(t,e,i,n,r){var o=1-r;return 3*(((e-t)*o+2*(i-e)*r)*o+(n-i)*r*r)}function v(t,e,i,n,a,s){var h=n+3*(e-i)-t,c=3*(i-2*e+t),d=3*(e-t),f=t-a,g=c*c-3*h*d,m=c*d-9*h*f,v=d*d-3*c*f,y=0;if(p(g)&&p(m)){if(p(c))s[0]=0;else(I=-d/c)>=0&&I<=1&&(s[y++]=I)}else{var _=m*m-4*g*v;if(p(_)){var x=m/g,b=-x/2;(I=-c/h+x)>=0&&I<=1&&(s[y++]=I),b>=0&&b<=1&&(s[y++]=b)}else if(_>0){var w=o(_),S=g*c+1.5*h*(-m+w),T=g*c+1.5*h*(-m-w);(I=(-c-((S=S<0?-r(-S,u):r(S,u))+(T=T<0?-r(-T,u):r(T,u))))/(3*h))>=0&&I<=1&&(s[y++]=I)}else{var M=(2*g*c-3*h*m)/(2*o(g*g*g)),C=Math.acos(M)/3,A=o(g),L=Math.cos(C),I=(-c-2*A*L)/(3*h),D=(b=(-c+A*(L+l*Math.sin(C)))/(3*h),(-c+A*(L-l*Math.sin(C)))/(3*h));I>=0&&I<=1&&(s[y++]=I),b>=0&&b<=1&&(s[y++]=b),D>=0&&D<=1&&(s[y++]=D)}}return y}function y(t,e,i,n,r){var a=6*i-12*e+6*t,s=9*e+3*n-3*t-9*i,l=3*e-3*t,u=0;if(p(s)){if(f(a))(c=-l/a)>=0&&c<=1&&(r[u++]=c)}else{var h=a*a-4*s*l;if(p(h))r[0]=-a/(2*s);else if(h>0){var c,d=o(h),g=(-a-d)/(2*s);(c=(-a+d)/(2*s))>=0&&c<=1&&(r[u++]=c),g>=0&&g<=1&&(r[u++]=g)}}return u}function _(t,e,i,n,r,o){var a=(e-t)*r+t,s=(i-e)*r+e,l=(n-i)*r+i,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=n}function x(t,e,i,r,a,l,u,p,f,m,v){var y,_,x,b,w,S=.005,T=1/0;h[0]=f,h[1]=m;for(var M=0;M<1;M+=.05)c[0]=g(t,i,a,u,M),c[1]=g(e,r,l,p,M),(b=(0,n.distSquare)(h,c))=0&&b=0&&c<=1&&(r[u++]=c)}else{var h=s*s-4*a*l;if(p(h))(c=-s/(2*a))>=0&&c<=1&&(r[u++]=c);else if(h>0){var c,d=o(h),g=(-s-d)/(2*a);(c=(-s+d)/(2*a))>=0&&c<=1&&(r[u++]=c),g>=0&&g<=1&&(r[u++]=g)}}return u}function M(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function C(t,e,i,n,r){var o=(e-t)*n+t,a=(i-e)*n+e,s=(a-o)*n+o;r[0]=t,r[1]=o,r[2]=s,r[3]=s,r[4]=a,r[5]=i}function A(t,e,i,r,a,l,u,p,f){var g,m=.005,v=1/0;h[0]=u,h[1]=p;for(var y=0;y<1;y+=.05){c[0]=w(t,i,a,y),c[1]=w(e,r,l,y),(S=(0,n.distSquare)(h,c))=0&&S{"use strict";i.d(e,{F1:()=>f,UK:()=>c,A4:()=>h,YB:()=>u});var n=i(7153),r=Math.log(2);function o(t,e,i,n,a,s){var l=n+"-"+a,u=t.length;if(s.hasOwnProperty(l))return s[l];if(1===e){var h=Math.round(Math.log((1<>1)%2;a.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",n[s]+":0",r[l]+":0",n[1-s]+":auto",r[1-l]+":auto",""].join("!important;"),t.appendChild(a),i.push(a)}return i}(e,l),h=function(t,e,i){for(var n=i?"invTrans":"trans",r=e[n],o=e.srcCoords,s=[],l=[],u=!0,h=0;h<4;h++){var c=t[h].getBoundingClientRect(),d=2*h,p=c.left,f=c.top;s.push(p,f),u=u&&o&&p===o[d]&&f===o[d+1],l.push(t[h].offsetLeft,t[h].offsetTop)}return u&&r?r:(e.srcCoords=s,e[n]=i?a(l,s):a(s,l))}(u,l,o);if(h)return h(t,i,r),!0}return!1}function c(t){return"CANVAS"===t.nodeName.toUpperCase()}var d=/([&<>"'])/g,p={"&":"&","<":"<",">":">",'"':""","'":"'"};function f(t){return null==t?"":(t+"").replace(d,(function(t,e){return p[e]}))}},7153:(t,e,i)=>{"use strict";i.d(e,{Z:()=>o});var n=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},r=new function(){this.browser=new n,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(r.wxa=!0,r.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?r.worker=!0:"undefined"==typeof navigator?(r.node=!0,r.svgSupported=!0):function(t,e){var i=e.browser,n=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);n&&(i.firefox=!0,i.version=n[1]);r&&(i.ie=!0,i.version=r[1]);o&&(i.edge=!0,i.version=o[1],i.newEdge=+o[1].split(".")[0]>18);a&&(i.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!i.ie&&!i.edge,e.pointerEventsSupported="onpointerdown"in window&&(i.edge||i.ie&&+i.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(i.ie&&"transition"in s||i.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||i.ie&&+i.version>=9}(navigator.userAgent,r);const o=r},9186:(t,e,i)=>{"use strict";i.d(e,{OD:()=>c,Oo:()=>d,eV:()=>l,iP:()=>h,sT:()=>f,x1:()=>g,xg:()=>p});var n=i(7153),r=i(4690),o=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,a=[],s=n.Z.browser.firefox&&+n.Z.browser.version.split(".")[0]<39;function l(t,e,i,n){return i=i||{},n?u(t,e,i):s&&null!=e.layerX&&e.layerX!==e.offsetX?(i.zrX=e.layerX,i.zrY=e.layerY):null!=e.offsetX?(i.zrX=e.offsetX,i.zrY=e.offsetY):u(t,e,i),i}function u(t,e,i){if(n.Z.domSupported&&t.getBoundingClientRect){var o=e.clientX,s=e.clientY;if((0,r.UK)(t)){var l=t.getBoundingClientRect();return i.zrX=o-l.left,void(i.zrY=s-l.top)}if((0,r.A4)(a,t,o,s))return i.zrX=a[0],void(i.zrY=a[1])}i.zrX=i.zrY=0}function h(t){return t||window.event}function c(t,e,i){if(null!=(e=h(e)).zrX)return e;var n=e.type;if(n&&n.indexOf("touch")>=0){var r="touchend"!==n?e.targetTouches[0]:e.changedTouches[0];r&&l(t,r,e,i)}else{l(t,e,e,i);var a=function(t){var e=t.wheelDelta;if(e)return e;var i=t.deltaX,n=t.deltaY;if(null==i||null==n)return e;return 3*(0!==n?Math.abs(n):Math.abs(i))*(n>0?-1:n<0?1:i>0?-1:1)}(e);e.zrDelta=a?a/120:-(e.detail||0)/3}var s=e.button;return null==e.which&&void 0!==s&&o.test(e.type)&&(e.which=1&s?1:2&s?3:4&s?2:0),e}function d(t,e,i,n){t.addEventListener(e,i,n)}function p(t,e,i,n){t.removeEventListener(e,i,n)}var f=function(t){t.preventDefault(),t.stopPropagation(),t.cancelBubble=!0};function g(t){return 2===t.which||3===t.which}},4247:(t,e,i)=>{"use strict";function n(){return[1,0,0,1,0,0]}function r(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function o(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function a(t,e,i){var n=e[0]*i[0]+e[2]*i[1],r=e[1]*i[0]+e[3]*i[1],o=e[0]*i[2]+e[2]*i[3],a=e[1]*i[2]+e[3]*i[3],s=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t}function s(t,e,i){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+i[0],t[5]=e[5]+i[1],t}function l(t,e,i){var n=e[0],r=e[2],o=e[4],a=e[1],s=e[3],l=e[5],u=Math.sin(i),h=Math.cos(i);return t[0]=n*h+a*u,t[1]=-n*u+a*h,t[2]=r*h+s*u,t[3]=-r*u+h*s,t[4]=h*o+u*l,t[5]=h*l-u*o,t}function u(t,e,i){var n=i[0],r=i[1];return t[0]=e[0]*n,t[1]=e[1]*r,t[2]=e[2]*n,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*r,t}function h(t,e){var i=e[0],n=e[2],r=e[4],o=e[1],a=e[3],s=e[5],l=i*a-o*n;return l?(l=1/l,t[0]=a*l,t[1]=-o*l,t[2]=-n*l,t[3]=i*l,t[4]=(n*s-a*r)*l,t[5]=(o*r-i*s)*l,t):null}function c(t){var e=[1,0,0,1,0,0];return o(e,t),e}i.r(e),i.d(e,{clone:()=>c,copy:()=>o,create:()=>n,identity:()=>r,invert:()=>h,mul:()=>a,rotate:()=>l,scale:()=>u,translate:()=>s})},5855:(t,e,i)=>{"use strict";i.d(e,{Uo:()=>o,g2:()=>h,n5:()=>n,qW:()=>u,rk:()=>r});var n=12,r="sans-serif",o=n+"px "+r;var a,s,l=function(t){var e={};if("undefined"==typeof JSON)return e;for(var i=0;i=0)c=h*t.length;else for(var d=0;d{"use strict";i.d(e,{Z:()=>l});function n(t,e,i,n){var r=e+1;if(r===i)return 1;if(n(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function r(t,e,i,n,r){for(n===e&&n++;n>>1])<0?l=o:s=o+1;var u=n-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function o(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])>0){for(s=n-r;l0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}for(a++;a>>1);o(t,e[i+h])>0?a=h+1:l=h}return l}function a(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])<0){for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=n-r;l=0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a>>1);o(t,e[i+h])<0?l=h:a=h+1}return l}function s(t,e){var i,n,r,s=7,l=0;i=t.length;var u=[];function h(i){var h=n[i],c=r[i],d=n[i+1],p=r[i+1];r[i]=c+p,i===l-3&&(n[i+1]=n[i+2],r[i+1]=r[i+2]),l--;var f=a(t[d],t,h,c,0,e);h+=f,0!==(c-=f)&&0!==(p=o(t[h+c-1],t,d,p,p-1,e))&&(c<=p?function(i,n,r,l){var h=0;for(h=0;h=7||g>=7);if(m)break;v<0&&(v=0),v+=2}if((s=v)<1&&(s=1),1===n){for(h=0;h=0;h--)t[g+h]=t[f+h];return void(t[p]=u[d])}var m=s;for(;;){var v=0,y=0,_=!1;do{if(e(u[d],t[c])<0){if(t[p--]=t[c--],v++,y=0,0==--n){_=!0;break}}else if(t[p--]=u[d--],y++,v=0,1==--l){_=!0;break}}while((v|y)=0;h--)t[g+h]=t[f+h];if(0===n){_=!0;break}}if(t[p--]=u[d--],1==--l){_=!0;break}if(0!==(y=l-o(t[c],u,0,l,l-1,e))){for(l-=y,g=(p-=y)+1,f=(d-=y)+1,h=0;h=7||y>=7);if(_)break;m<0&&(m=0),m+=2}(s=m)<1&&(s=1);if(1===l){for(g=(p-=n)+1,f=(c-=n)+1,h=n-1;h>=0;h--)t[g+h]=t[f+h];t[p]=u[d]}else{if(0===l)throw new Error;for(f=p-(l-1),h=0;h1;){var t=l-2;if(t>=1&&r[t-1]<=r[t]+r[t+1]||t>=2&&r[t-2]<=r[t]+r[t-1])r[t-1]r[t+1])break;h(t)}},forceMergeRuns:function(){for(;l>1;){var t=l-2;t>0&&r[t-1]=32;)e|=1&t,t>>=1;return t+e}(a);do{if((l=n(t,i,o,e))h&&(c=h),r(t,i,i+c,i+l,e),l=c}u.pushRun(i,l),u.mergeRuns(),a-=l,i+=l}while(0!==a);u.forceMergeRuns()}}}},8760:(t,e,i)=>{"use strict";i.r(e),i.d(e,{HashMap:()=>ot,RADIAN_TO_DEGREE:()=>dt,assert:()=>tt,bind:()=>E,clone:()=>y,concatArray:()=>st,createCanvas:()=>S,createHashMap:()=>at,createObject:()=>lt,curry:()=>N,defaults:()=>w,disableUserSelect:()=>ut,each:()=>L,eqNaN:()=>Y,extend:()=>b,filter:()=>P,find:()=>O,guid:()=>m,hasOwn:()=>ht,indexOf:()=>T,inherits:()=>M,isArray:()=>R,isArrayLike:()=>A,isBuiltInObject:()=>G,isDom:()=>U,isFunction:()=>z,isGradientObject:()=>W,isImagePatternObject:()=>j,isNumber:()=>F,isObject:()=>V,isPrimitive:()=>rt,isRegExp:()=>X,isString:()=>B,isStringSafe:()=>Z,isTypedArray:()=>H,keys:()=>k,logError:()=>v,map:()=>I,merge:()=>_,mergeAll:()=>x,mixin:()=>C,noop:()=>ct,normalizeCssArray:()=>$,reduce:()=>D,retrieve:()=>q,retrieve2:()=>K,retrieve3:()=>J,setAsPrimitive:()=>nt,slice:()=>Q,trim:()=>et});var n=i(5855),r=D(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],(function(t,e){return t["[object "+e+"]"]=!0,t}),{}),o=D(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],(function(t,e){return t["[object "+e+"Array]"]=!0,t}),{}),a=Object.prototype.toString,s=Array.prototype,l=s.forEach,u=s.filter,h=s.slice,c=s.map,d=function(){}.constructor,p=d?d.prototype:null,f="__proto__",g=2311;function m(){return g++}function v(){for(var t=[],e=0;e{"use strict";function n(t,e){return null==t&&(t=0),null==e&&(e=0),[t,e]}function r(t,e){return t[0]=e[0],t[1]=e[1],t}function o(t){return[t[0],t[1]]}function a(t,e,i){return t[0]=e,t[1]=i,t}function s(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t}function l(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t}function u(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function h(t){return Math.sqrt(d(t))}i.r(e),i.d(e,{add:()=>s,applyTransform:()=>M,clone:()=>o,copy:()=>r,create:()=>n,dist:()=>x,distSquare:()=>w,distance:()=>_,distanceSquare:()=>b,div:()=>g,dot:()=>m,len:()=>h,lenSquare:()=>d,length:()=>c,lengthSquare:()=>p,lerp:()=>T,max:()=>A,min:()=>C,mul:()=>f,negate:()=>S,normalize:()=>y,scale:()=>v,scaleAndAdd:()=>l,set:()=>a,sub:()=>u});var c=h;function d(t){return t[0]*t[0]+t[1]*t[1]}var p=d;function f(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function g(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t}function m(t,e){return t[0]*e[0]+t[1]*e[1]}function v(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}function y(t,e){var i=h(e);return 0===i?(t[0]=0,t[1]=0):(t[0]=e[0]/i,t[1]=e[1]/i),t}function _(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}var x=_;function b(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}var w=b;function S(t,e){return t[0]=-e[0],t[1]=-e[1],t}function T(t,e,i,n){return t[0]=e[0]+n*(i[0]-e[0]),t[1]=e[1]+n*(i[1]-e[1]),t}function M(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[2]*r+i[4],t[1]=i[1]*n+i[3]*r+i[5],t}function C(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t}function A(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t}},89:(t,e,i)=>{"use strict";i.d(e,{Z:()=>o});var n=i(8299),r=i(8751);const o=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="compound",e}return(0,n.ZT)(e,t),e.prototype._updatePathDirty=function(){for(var t=this.shape.paths,e=this.shapeChanged(),i=0;i{"use strict";i.d(e,{ZP:()=>m,ik:()=>h,tj:()=>u});var n=i(8299),r=i(7734),o=i(641),a=i(8760),s=i(1736),l="__zr_style_"+Math.round(10*Math.random()),u={shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",opacity:1,blend:"source-over"},h={style:{shadowBlur:!0,shadowOffsetX:!0,shadowOffsetY:!0,shadowColor:!0,opacity:!0}};u[l]=!0;var c=["z","z2","invisible"],d=["invisible"],p=function(t){function e(e){return t.call(this,e)||this}var i;return(0,n.ZT)(e,t),e.prototype._init=function(e){for(var i=(0,a.keys)(e),n=0;n{"use strict";i.d(e,{Z:()=>n});const n=function(){function t(t){this.colorStops=t||[]}return t.prototype.addColorStop=function(t,e){this.colorStops.push({offset:t,color:e})},t}()},2141:(t,e,i)=>{"use strict";i.d(e,{Z:()=>l});var n=i(8299),r=i(8760),o=i(7734),a=i(641),s=function(t){function e(e){var i=t.call(this)||this;return i.isGroup=!0,i._children=[],i.attr(e),i}return(0,n.ZT)(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.children=function(){return this._children.slice()},e.prototype.childAt=function(t){return this._children[t]},e.prototype.childOfName=function(t){for(var e=this._children,i=0;i=0&&(i.splice(n,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,e){var i=r.indexOf(this._children,t);return i>=0&&this.replaceAt(e,i),this},e.prototype.replaceAt=function(t,e){var i=this._children,n=i[e];if(t&&t!==this&&t.parent!==this&&t!==n){i[e]=t,n.parent=null;var r=this.__zr;r&&n.removeSelfFromZr(r),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},e.prototype.remove=function(t){var e=this.__zr,i=this._children,n=r.indexOf(i,t);return n<0||(i.splice(n,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh()),this},e.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,i=0;i{"use strict";i.d(e,{ZP:()=>h});var n=i(8299),r=i(3795),o=i(641),a=i(8760),s=(0,a.defaults)({x:0,y:0},r.tj),l={style:(0,a.defaults)({x:!0,y:!0,width:!0,height:!0,sx:!0,sy:!0,sWidth:!0,sHeight:!0},r.ik.style)};var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,n.ZT)(e,t),e.prototype.createStyle=function(t){return(0,a.createObject)(s,t)},e.prototype._getSize=function(t){var e=this.style,i=e[t];if(null!=i)return i;var n,r=(n=e.image)&&"string"!=typeof n&&n.width&&n.height?e.image:this.__image;if(!r)return 0;var o="width"===t?"height":"width",a=e[o];return null==a?r[t]:r[t]/r[o]*a},e.prototype.getWidth=function(){return this._getSize("width")},e.prototype.getHeight=function(){return this._getSize("height")},e.prototype.getAnimationStyleProps=function(){return l},e.prototype.getBoundingRect=function(){var t=this.style;return this._rect||(this._rect=new o.Z(t.x||0,t.y||0,this.getWidth(),this.getHeight())),this._rect},e}(r.ZP);u.prototype.type="image";const h=u},7806:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var n=i(8299),r=i(3795),o=i(641),a=[];const s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.notClear=!0,e.incremental=!0,e._displayables=[],e._temporaryDisplayables=[],e._cursor=0,e}return(0,n.ZT)(e,t),e.prototype.traverse=function(t,e){t.call(e,this)},e.prototype.useStyle=function(){this.style={}},e.prototype.getCursor=function(){return this._cursor},e.prototype.innerAfterBrush=function(){this._cursor=this._displayables.length},e.prototype.clearDisplaybles=function(){this._displayables=[],this._temporaryDisplayables=[],this._cursor=0,this.markRedraw(),this.notClear=!1},e.prototype.clearTemporalDisplayables=function(){this._temporaryDisplayables=[]},e.prototype.addDisplayable=function(t,e){e?this._temporaryDisplayables.push(t):this._displayables.push(t),this.markRedraw()},e.prototype.addDisplayables=function(t,e){e=e||!1;for(var i=0;i{"use strict";i.d(e,{Z:()=>r});var n=i(8299);const r=function(t){function e(e,i,n,r,o,a){var s=t.call(this,o)||this;return s.x=null==e?0:e,s.y=null==i?0:i,s.x2=null==n?1:n,s.y2=null==r?0:r,s.type="linear",s.global=a||!1,s}return(0,n.ZT)(e,t),e}(i(6126).Z)},8751:(t,e,i)=>{"use strict";i.d(e,{$t:()=>A,ZP:()=>D});var n=i(8299),r=i(3795),o=i(2604),a=i(9736),s=i(7011);function l(t,e,i,n,r,o,a,l,u,h,c){if(0===u)return!1;var d=u;return!(c>e+d&&c>n+d&&c>o+d&&c>l+d||ct+d&&h>i+d&&h>r+d&&h>a+d||hi||d+ur&&(r+=c);var f=Math.atan2(l,s);return f<0&&(f+=c),f>=n&&f<=r||f+c>=n&&f+c<=r}var p=i(3537),f=o.Z.CMD,g=2*Math.PI;var m=[-1,-1,-1],v=[-1,-1];function y(t,e,i,n,r,o,a,l,u,h){if(h>e&&h>n&&h>o&&h>l||h1&&(c=void 0,c=v[0],v[0]=v[1],v[1]=c),g=s.af(e,n,o,l,v[0]),f>1&&(y=s.af(e,n,o,l,v[1]))),2===f?xe&&l>n&&l>o||l=0&&h<=1){for(var c=0,d=s.Zm(e,n,o,h),p=0;pi||s<-i)return 0;var l=Math.sqrt(i*i-s*s);m[0]=-l,m[1]=l;var u=Math.abs(n-r);if(u<1e-4)return 0;if(u>=g-1e-4){n=0,r=g;var h=o?1:-1;return a>=m[0]+t&&a<=m[1]+t?h:0}if(n>r){var c=n;n=r,r=c}n<0&&(n+=g,r+=g);for(var d=0,p=0;p<2;p++){var f=m[p];if(f+t>a){var v=Math.atan2(s,f);h=o?1:-1;v<0&&(v=g+v),(v>=n&&v<=r||v+g>=n&&v+g<=r)&&(v>Math.PI/2&&v<1.5*Math.PI&&(h=-h),d+=h)}}return d}function b(t,e,i,n,r){for(var o,s,h,c,g=t.data,m=t.len(),v=0,b=0,w=0,S=0,T=0,M=0;M1&&(i||(v+=(0,p.Z)(b,w,S,T,n,r))),A&&(S=b=g[M],T=w=g[M+1]),C){case f.M:b=S=g[M++],w=T=g[M++];break;case f.L:if(i){if(a.m(b,w,g[M],g[M+1],e,n,r))return!0}else v+=(0,p.Z)(b,w,g[M],g[M+1],n,r)||0;b=g[M++],w=g[M++];break;case f.C:if(i){if(l(b,w,g[M++],g[M++],g[M++],g[M++],g[M],g[M+1],e,n,r))return!0}else v+=y(b,w,g[M++],g[M++],g[M++],g[M++],g[M],g[M+1],n,r)||0;b=g[M++],w=g[M++];break;case f.Q:if(i){if(u.m(b,w,g[M++],g[M++],g[M],g[M+1],e,n,r))return!0}else v+=_(b,w,g[M++],g[M++],g[M],g[M+1],n,r)||0;b=g[M++],w=g[M++];break;case f.A:var L=g[M++],I=g[M++],D=g[M++],P=g[M++],O=g[M++],k=g[M++];M+=1;var E=!!(1-g[M++]);o=Math.cos(O)*D+L,s=Math.sin(O)*P+I,A?(S=o,T=s):v+=(0,p.Z)(b,w,o,s,n,r);var N=(n-L)*P/D+L;if(i){if(d(L,I,P,O,O+k,E,e,N,r))return!0}else v+=x(L,I,P,O,O+k,E,N,r);b=Math.cos(O+k)*D+L,w=Math.sin(O+k)*P+I;break;case f.R:if(S=b=g[M++],T=w=g[M++],o=S+g[M++],s=T+g[M++],i){if(a.m(S,T,o,T,e,n,r)||a.m(o,T,o,s,e,n,r)||a.m(o,s,S,s,e,n,r)||a.m(S,s,S,T,e,n,r))return!0}else v+=(0,p.Z)(o,T,o,s,n,r),v+=(0,p.Z)(S,s,S,T,n,r);break;case f.Z:if(i){if(a.m(b,w,S,T,e,n,r))return!0}else v+=(0,p.Z)(b,w,S,T,n,r);b=S,w=T}}return i||(h=w,c=T,Math.abs(h-c)<1e-4)||(v+=(0,p.Z)(b,w,S,T,n,r)||0),0!==v}var w=i(8760),S=i(5673),T=i(7588),M=i(1736),C=i(4995),A=(0,w.defaults)({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},r.tj),L={style:(0,w.defaults)({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},r.ik.style)},I=C.dN.concat(["invisible","culling","z","z2","zlevel","parent"]);const D=function(t){function e(e){return t.call(this,e)||this}var i;return(0,n.ZT)(e,t),e.prototype.update=function(){var i=this;t.prototype.update.call(this);var n=this.style;if(n.decal){var r=this._decalEl=this._decalEl||new e;r.buildPath===e.prototype.buildPath&&(r.buildPath=function(t){i.buildPath(t,i.shape)}),r.silent=!0;var o=r.style;for(var a in n)o[a]!==n[a]&&(o[a]=n[a]);o.fill=n.fill?n.decal:null,o.decal=null,o.shadowColor=null,n.strokeFirst&&(o.stroke=null);for(var s=0;s.5?T.vU:e>.2?T.iv:T.GD}if(t)return T.GD}return T.vU},e.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if((0,w.isString)(e)){var i=this.__zr;if(!(!i||!i.isDarkMode())===(0,S.lum)(t,0)0))},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,i=!t;if(i){var n=!1;this.path||(n=!0,this.createPathProxy());var r=this.path;(n||this.__dirty&M.RH)&&(r.beginPath(),this.buildPath(r,this.shape,!1),this.pathUpdated()),t=r.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var o=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||i){o.copy(t);var a=e.strokeNoScale?this.getLineScale():1,s=e.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}a>1e-10&&(o.width+=s/a,o.height+=s/a,o.x-=s/a/2,o.y-=s/a/2)}return o}return t},e.prototype.contain=function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),r=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),function(t,e,i,n){return b(t,e,!0,i,n)}(o,a/s,t,e)))return!0}if(this.hasFill())return function(t,e,i){return b(t,0,!1,e,i)}(o,t,e)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=M.RH,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(e,i){"shape"===e?this.setShape(i):t.prototype.attrKV.call(this,e,i)},e.prototype.setShape=function(t,e){var i=this.shape;return i||(i=this.shape={}),"string"==typeof t?i[t]=e:(0,w.extend)(i,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(this.__dirty&M.RH)},e.prototype.createStyle=function(t){return(0,w.createObject)(A,t)},e.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var i=this._normalState;e.shape&&!i.shape&&(i.shape=(0,w.extend)({},this.shape))},e.prototype._applyStateObj=function(e,i,n,r,o,a){t.prototype._applyStateObj.call(this,e,i,n,r,o,a);var s,l=!(i&&r);if(i&&i.shape?o?r?s=i.shape:(s=(0,w.extend)({},n.shape),(0,w.extend)(s,i.shape)):(s=(0,w.extend)({},r?this.shape:n.shape),(0,w.extend)(s,i.shape)):l&&(s=n.shape),s)if(o){this.shape=(0,w.extend)({},this.shape);for(var u={},h=(0,w.keys)(s),c=0;c{"use strict";i.d(e,{Z:()=>r});var n=i(8299);const r=function(t){function e(e,i,n,r,o){var a=t.call(this,r)||this;return a.x=null==e?.5:e,a.y=null==i?.5:i,a.r=null==n?.5:n,a.type="radial",a.global=o||!1,a}return(0,n.ZT)(e,t),e}(i(6126).Z)},7472:(t,e,i)=>{"use strict";i.d(e,{Z:()=>c});var n=i(8299),r=i(3795),o=i(9979),a=i(8751),s=i(8760),l=i(5855),u=(0,s.defaults)({strokeFirst:!0,font:l.Uo,x:0,y:0,textAlign:"left",textBaseline:"top",miterLimit:2},a.$t),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,n.ZT)(e,t),e.prototype.hasStroke=function(){var t=this.style,e=t.stroke;return null!=e&&"none"!==e&&t.lineWidth>0},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.createStyle=function(t){return(0,s.createObject)(u,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var e=t.text;null!=e?e+="":e="";var i=(0,o.lP)(e,t.font,t.textAlign,t.textBaseline);if(i.x+=t.x||0,i.y+=t.y||0,this.hasStroke()){var n=t.lineWidth;i.x-=n/2,i.y-=n/2,i.width+=n,i.height+=n}this._rect=i}return this._rect},e.initDefaultProps=void(e.prototype.dirtyRectTolerance=10),e}(r.ZP);h.prototype.type="tspan";const c=h},1590:(t,e,i)=>{"use strict";i.d(e,{VG:()=>_,Y1:()=>b,ZP:()=>L});var n=i(8299),r=i(6656),o=i(7472),a=i(8760),s=i(9979),l=i(4276),u=i(56),h=i(641),c=i(3795),d=i(5855),p={fill:"#000"},f={style:(0,a.defaults)({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},c.ik.style)},g=function(t){function e(e){var i=t.call(this)||this;return i.type="text",i._children=[],i._defaultStyle=p,i.attr(e),i}return(0,n.ZT)(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var e=0;e0,z=null!=t.width&&("truncate"===t.overflow||"break"===t.overflow||"breakAll"===t.overflow),B=a.calculatedLineHeight,Z=0;Z=0&&"right"===(O=w[P]).align;)this._placeToken(O,t,T,v,D,"right",_),M-=O.width,D-=O.width,P--;for(I+=(n-(I-m)-(y-D)-M)/2;L<=P;)O=w[L],this._placeToken(O,t,T,v,I+O.width/2,"center",_),I+=O.width,L++;v+=T}},e.prototype._placeToken=function(t,e,i,n,r,l,u){var c=e.rich[t.styleName]||{};c.text=t.text;var p=t.verticalAlign,f=n+i/2;"top"===p?f=n+t.height/2:"bottom"===p&&(f=n+i-t.height/2),!t.isLineHolder&&A(c)&&this._renderBackground(c,e,"right"===l?r-t.width:"center"===l?r-t.width/2:r,f-t.height/2,t.width,t.height);var g=!!c.backgroundColor,m=t.textPadding;m&&(r=M(r,l,m),f-=t.height/2-m[0]-t.innerHeight/2);var v=this._getOrCreateChild(o.Z),y=v.createStyle();v.useStyle(y);var _=this._defaultStyle,b=!1,w=0,C=T("fill"in c?c.fill:"fill"in e?e.fill:(b=!0,_.fill)),L=S("stroke"in c?c.stroke:"stroke"in e?e.stroke:g||u||_.autoStroke&&!b?null:(w=2,_.stroke)),I=c.textShadowBlur>0||e.textShadowBlur>0;y.text=t.text,y.x=r,y.y=f,I&&(y.shadowBlur=c.textShadowBlur||e.textShadowBlur||0,y.shadowColor=c.textShadowColor||e.textShadowColor||"transparent",y.shadowOffsetX=c.textShadowOffsetX||e.textShadowOffsetX||0,y.shadowOffsetY=c.textShadowOffsetY||e.textShadowOffsetY||0),y.textAlign=l,y.textBaseline="middle",y.font=t.font||d.Uo,y.opacity=(0,a.retrieve3)(c.opacity,e.opacity,1),x(y,c),L&&(y.lineWidth=(0,a.retrieve3)(c.lineWidth,e.lineWidth,w),y.lineDash=(0,a.retrieve2)(c.lineDash,e.lineDash),y.lineDashOffset=e.lineDashOffset||0,y.stroke=L),C&&(y.fill=C);var D=t.contentWidth,P=t.contentHeight;v.setBoundingRect(new h.Z((0,s.M3)(y.x,D,y.textAlign),(0,s.mU)(y.y,P,y.textBaseline),D,P))},e.prototype._renderBackground=function(t,e,i,n,r,o){var s,h,c,d=t.backgroundColor,p=t.borderWidth,f=t.borderColor,g=d&&d.image,m=d&&!g,v=t.borderRadius,y=this;if(m||t.lineHeight||p&&f){(s=this._getOrCreateChild(u.Z)).useStyle(s.createStyle()),s.style.fill=null;var _=s.shape;_.x=i,_.y=n,_.width=r,_.height=o,_.r=v,s.dirtyShape()}if(m)(c=s.style).fill=d||null,c.fillOpacity=(0,a.retrieve2)(t.fillOpacity,1);else if(g){(h=this._getOrCreateChild(l.ZP)).onload=function(){y.dirtyStyle()};var x=h.style;x.image=d.image,x.x=i,x.y=n,x.width=r,x.height=o}p&&f&&((c=s.style).lineWidth=p,c.stroke=f,c.strokeOpacity=(0,a.retrieve2)(t.strokeOpacity,1),c.lineDash=t.borderDash,c.lineDashOffset=t.borderDashOffset||0,s.strokeContainThreshold=0,s.hasFill()&&s.hasStroke()&&(c.strokeFirst=!0,c.lineWidth*=2));var b=(s||h).style;b.shadowBlur=t.shadowBlur||0,b.shadowColor=t.shadowColor||"transparent",b.shadowOffsetX=t.shadowOffsetX||0,b.shadowOffsetY=t.shadowOffsetY||0,b.opacity=(0,a.retrieve3)(t.opacity,e.opacity,1)},e.makeFont=function(t){var e="";return b(t)&&(e=[t.fontStyle,t.fontWeight,_(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),e&&(0,a.trim)(e)||t.textFont||t.font},e}(c.ZP),m={left:!0,right:1,center:1},v={top:1,bottom:1,middle:1},y=["fontStyle","fontWeight","fontSize","fontFamily"];function _(t){return"string"!=typeof t||-1===t.indexOf("px")&&-1===t.indexOf("rem")&&-1===t.indexOf("em")?isNaN(+t)?d.n5+"px":t+"px":t}function x(t,e){for(var i=0;i{"use strict";i.d(e,{RH:()=>o,SE:()=>r,YV:()=>n});var n=1,r=2,o=4},8819:(t,e,i)=>{"use strict";i.d(e,{Gq:()=>s,ko:()=>a,v5:()=>u});var n=i(4070),r=i(5855),o=new n.ZP(50);function a(t){if("string"==typeof t){var e=o.get(t);return e&&e.image}return t}function s(t,e,i,n,a){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!i)return e;var s=o.get(t),h={hostEl:i,cb:n,cbPayload:a};return s?!u(e=s.image)&&s.pending.push(h):((e=r.qW.loadImage(t,l,l)).__zrImageSrc=t,o.put(t,e.__cachedImgObj={image:e,pending:[h]})),e}return t}return e}function l(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e{"use strict";i.d(e,{$F:()=>g,NY:()=>c,aF:()=>s});var n=i(8819),r=i(8760),o=i(9979),a=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function s(t,e,i,n,r){if(!e)return"";var o=(t+"").split("\n");r=l(e,i,n,r);for(var a=0,s=o.length;a=l;h++)u-=l;var c=(0,o.dz)(i,e);return c>u&&(i="",c=0),u=t-c,a.ellipsis=i,a.ellipsisWidth=c,a.contentWidth=u,a.containerWidth=t,a}function u(t,e){var i=e.containerWidth,n=e.font,r=e.contentWidth;if(!i)return"";var a=(0,o.dz)(t,n);if(a<=i)return t;for(var s=0;;s++){if(a<=r||s>=e.maxIterations){t+=e.ellipsis;break}var l=0===s?h(t,r,e.ascCharWidth,e.cnCharWidth):a>0?Math.floor(t.length*r/a):0;t=t.substr(0,l),a=(0,o.dz)(t,n)}return""===t&&(t=e.placeholder),t}function h(t,e,i,n){for(var r=0,o=0,a=t.length;ov&&f){var y=Math.floor(v/d);i=i.slice(0,y)}if(t&&h&&null!=g)for(var x=l(g,s,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),b=0;bp&&m(i,t.substring(p,g),e,d),m(i,l[2],e,d,l[1]),p=a.lastIndex}ph){L>0?(M.tokens=M.tokens.slice(0,L),S(M,A,C),i.lines=i.lines.slice(0,T+1)):i.lines=i.lines.slice(0,T);break t}var E=I.width,N=null==E||"auto"===E;if("string"==typeof E&&"%"===E.charAt(E.length-1))Z.percentWidth=E,v.push(Z),Z.contentWidth=(0,o.dz)(Z.text,O);else{if(N){var R=I.backgroundColor,z=R&&R.image;z&&(z=n.ko(z),n.v5(z)&&(Z.width=Math.max(Z.width,z.width*k/z.height)))}var B=b&&null!=u?u-A:null;null!=B&&B0&&v+n.accumWidth>n.width&&(a=e.split("\n"),f=!0),n.accumWidth=v}else{var y=_(e,c,n.width,n.breakAll,n.accumWidth);n.accumWidth=y.accumWidth+m,s=y.linesWidths,a=y.lines}}else a=e.split("\n");for(var x=0;x=33&&e<=383}(t)||!!v[t]}function _(t,e,i,n,r){for(var a=[],s=[],l="",u="",h=0,c=0,d=0;di:r+c+f>i)?c?(l||u)&&(g?(l||(l=u,u="",c=h=0),a.push(l),s.push(c-h),u+=p,l="",c=h+=f):(u&&(l+=u,u="",h=0),a.push(l),s.push(c),l=p,c=f)):g?(a.push(u),s.push(h),u=p,h=f):(a.push(p),s.push(f)):(c+=f,g?(u+=p,h+=f):(u&&(l+=u,u="",h=0),l+=p))}else u&&(l+=u,c+=h),a.push(l),s.push(c),l="",u="",h=0,c=0}return a.length||l||(l=t,u="",h=0),u&&(l+=u),l&&(a.push(l),s.push(c)),1===a.length&&(c+=r),{accumWidth:c,lines:a,linesWidths:s}}},5826:(t,e,i)=>{"use strict";i.d(e,{L:()=>r});var n=i(1362);function r(t,e,i){var r=e.smooth,o=e.points;if(o&&o.length>=2){if(r){var a=function(t,e,i,r){var o,a,s,l,u=[],h=[],c=[],d=[];if(r){s=[1/0,1/0],l=[-1/0,-1/0];for(var p=0,f=t.length;p{"use strict";i.d(e,{Pw:()=>o,_3:()=>r,vu:()=>a});var n=Math.round;function r(t,e,i){if(e){var r=e.x1,o=e.x2,s=e.y1,l=e.y2;t.x1=r,t.x2=o,t.y1=s,t.y2=l;var u=i&&i.lineWidth;return u?(n(2*r)===n(2*o)&&(t.x1=t.x2=a(r,u,!0)),n(2*s)===n(2*l)&&(t.y1=t.y2=a(s,u,!0)),t):t}}function o(t,e,i){if(e){var n=e.x,r=e.y,o=e.width,s=e.height;t.x=n,t.y=r,t.width=o,t.height=s;var l=i&&i.lineWidth;return l?(t.x=a(n,l,!0),t.y=a(r,l,!0),t.width=Math.max(a(n+o,l,!1)-t.x,0===o?0:1),t.height=Math.max(a(r+s,l,!1)-t.y,0===s?0:1),t):t}}function a(t,e,i){if(!e)return t;var r=n(2*t);return(r+n(e))%2==0?r/2:(r+(i?1:-1))/2}},7786:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var n=i(8299),r=i(8751),o=function(){this.cx=0,this.cy=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0},a=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new o},e.prototype.buildPath=function(t,e){var i=e.cx,n=e.cy,r=Math.max(e.r,0),o=e.startAngle,a=e.endAngle,s=e.clockwise,l=Math.cos(o),u=Math.sin(o);t.moveTo(l*r+i,u*r+n),t.arc(i,n,r,o,a,!s)},e}(r.ZP);a.prototype.type="arc";const s=a},8989:(t,e,i)=>{"use strict";i.d(e,{Z:()=>c});var n=i(8299),r=i(8751),o=i(1362),a=i(7011),s=[],l=function(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.cpx1=0,this.cpy1=0,this.percent=1};function u(t,e,i){var n=t.cpx2,r=t.cpy2;return null!=n||null!=r?[(i?a.X_:a.af)(t.x1,t.cpx1,t.cpx2,t.x2,e),(i?a.X_:a.af)(t.y1,t.cpy1,t.cpy2,t.y2,e)]:[(i?a.AZ:a.Zm)(t.x1,t.cpx1,t.x2,e),(i?a.AZ:a.Zm)(t.y1,t.cpy1,t.y2,e)]}var h=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new l},e.prototype.buildPath=function(t,e){var i=e.x1,n=e.y1,r=e.x2,o=e.y2,l=e.cpx1,u=e.cpy1,h=e.cpx2,c=e.cpy2,d=e.percent;0!==d&&(t.moveTo(i,n),null==h||null==c?(d<1&&((0,a.Lx)(i,l,r,d,s),l=s[1],r=s[2],(0,a.Lx)(n,u,o,d,s),u=s[1],o=s[2]),t.quadraticCurveTo(l,u,r,o)):(d<1&&((0,a.Vz)(i,l,h,r,d,s),l=s[1],h=s[2],r=s[3],(0,a.Vz)(n,u,c,o,d,s),u=s[1],c=s[2],o=s[3]),t.bezierCurveTo(l,u,h,c,r,o)))},e.prototype.pointAt=function(t){return u(this.shape,t,!1)},e.prototype.tangentAt=function(t){var e=u(this.shape,t,!0);return o.normalize(e,e)},e}(r.ZP);h.prototype.type="bezier-curve";const c=h},65:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var n=i(8299),r=i(8751),o=function(){this.cx=0,this.cy=0,this.r=0},a=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultShape=function(){return new o},e.prototype.buildPath=function(t,e){t.moveTo(e.cx+e.r,e.cy),t.arc(e.cx,e.cy,e.r,0,2*Math.PI)},e}(r.ZP);a.prototype.type="circle";const s=a},1524:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var n=i(8299),r=i(8751),o=function(){this.cx=0,this.cy=0,this.rx=0,this.ry=0},a=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultShape=function(){return new o},e.prototype.buildPath=function(t,e){var i=.5522848,n=e.cx,r=e.cy,o=e.rx,a=e.ry,s=o*i,l=a*i;t.moveTo(n-o,r),t.bezierCurveTo(n-o,r-l,n-s,r-a,n,r-a),t.bezierCurveTo(n+s,r-a,n+o,r-l,n+o,r),t.bezierCurveTo(n+o,r+l,n+s,r+a,n,r+a),t.bezierCurveTo(n-s,r+a,n-o,r+l,n-o,r),t.closePath()},e}(r.ZP);a.prototype.type="ellipse";const s=a},9067:(t,e,i)=>{"use strict";i.d(e,{Z:()=>u});var n=i(8299),r=i(8751),o=i(4380),a={},s=function(){this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.percent=1},l=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new s},e.prototype.buildPath=function(t,e){var i,n,r,s;if(this.subPixelOptimize){var l=(0,o._3)(a,e,this.style);i=l.x1,n=l.y1,r=l.x2,s=l.y2}else i=e.x1,n=e.y1,r=e.x2,s=e.y2;var u=e.percent;0!==u&&(t.moveTo(i,n),u<1&&(r=i*(1-u)+r*u,s=n*(1-u)+s*u),t.lineTo(r,s))},e.prototype.pointAt=function(t){var e=this.shape;return[e.x1*(1-t)+e.x2*t,e.y1*(1-t)+e.y2*t]},e}(r.ZP);l.prototype.type="line";const u=l},6283:(t,e,i)=>{"use strict";i.d(e,{Z:()=>l});var n=i(8299),r=i(8751),o=i(5826),a=function(){this.points=null,this.smooth=0,this.smoothConstraint=null},s=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultShape=function(){return new a},e.prototype.buildPath=function(t,e){o.L(t,e,!0)},e}(r.ZP);s.prototype.type="polygon";const l=s},7267:(t,e,i)=>{"use strict";i.d(e,{Z:()=>l});var n=i(8299),r=i(8751),o=i(5826),a=function(){this.points=null,this.percent=1,this.smooth=0,this.smoothConstraint=null},s=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultStyle=function(){return{stroke:"#000",fill:null}},e.prototype.getDefaultShape=function(){return new a},e.prototype.buildPath=function(t,e){o.L(t,e,!1)},e}(r.ZP);s.prototype.type="polyline";const l=s},56:(t,e,i)=>{"use strict";i.d(e,{Z:()=>u});var n=i(8299),r=i(8751);var o=i(4380),a=function(){this.x=0,this.y=0,this.width=0,this.height=0},s={},l=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultShape=function(){return new a},e.prototype.buildPath=function(t,e){var i,n,r,a;if(this.subPixelOptimize){var l=(0,o.Pw)(s,e,this.style);i=l.x,n=l.y,r=l.width,a=l.height,l.r=e.r,e=l}else i=e.x,n=e.y,r=e.width,a=e.height;e.r?function(t,e){var i,n,r,o,a,s=e.x,l=e.y,u=e.width,h=e.height,c=e.r;u<0&&(s+=u,u=-u),h<0&&(l+=h,h=-h),"number"==typeof c?i=n=r=o=c:c instanceof Array?1===c.length?i=n=r=o=c[0]:2===c.length?(i=r=c[0],n=o=c[1]):3===c.length?(i=c[0],n=o=c[1],r=c[2]):(i=c[0],n=c[1],r=c[2],o=c[3]):i=n=r=o=0,i+n>u&&(i*=u/(a=i+n),n*=u/a),r+o>u&&(r*=u/(a=r+o),o*=u/a),n+r>h&&(n*=h/(a=n+r),r*=h/a),i+o>h&&(i*=h/(a=i+o),o*=h/a),t.moveTo(s+i,l),t.lineTo(s+u-n,l),0!==n&&t.arc(s+u-n,l+n,n,-Math.PI/2,0),t.lineTo(s+u,l+h-r),0!==r&&t.arc(s+u-r,l+h-r,r,0,Math.PI/2),t.lineTo(s+o,l+h),0!==o&&t.arc(s+o,l+h-o,o,Math.PI/2,Math.PI),t.lineTo(s,l+i),0!==i&&t.arc(s+i,l+i,i,Math.PI,1.5*Math.PI)}(t,e):t.rect(i,n,r,a)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(r.ZP);l.prototype.type="rect";const u=l},3782:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var n=i(8299),r=i(8751),o=function(){this.cx=0,this.cy=0,this.r=0,this.r0=0},a=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultShape=function(){return new o},e.prototype.buildPath=function(t,e){var i=e.cx,n=e.cy,r=2*Math.PI;t.moveTo(i+e.r,n),t.arc(i,n,e.r,0,r,!1),t.moveTo(i+e.r0,n),t.arc(i,n,e.r0,0,r,!0)},e}(r.ZP);a.prototype.type="ring";const s=a},1205:(t,e,i)=>{"use strict";i.d(e,{C:()=>b});var n=i(8299),r=i(8751),o=i(8760),a=Math.PI,s=2*a,l=Math.sin,u=Math.cos,h=Math.acos,c=Math.atan2,d=Math.abs,p=Math.sqrt,f=Math.max,g=Math.min,m=1e-4;function v(t,e,i,n,r,o,a){var s=t-i,l=e-n,u=(a?o:-o)/p(s*s+l*l),h=u*l,c=-u*s,d=t+h,g=e+c,m=i+h,v=n+c,y=(d+m)/2,_=(g+v)/2,x=m-d,b=v-g,w=x*x+b*b,S=r-o,T=d*v-m*g,M=(b<0?-1:1)*p(f(0,S*S*w-T*T)),C=(T*b-x*M)/w,A=(-T*x-b*M)/w,L=(T*b+x*M)/w,I=(-T*x+b*M)/w,D=C-y,P=A-_,O=L-y,k=I-_;return D*D+P*P>O*O+k*k&&(C=L,A=I),{cx:C,cy:A,x0:-h,y0:-c,x1:C*(r/S-1),y1:A*(r/S-1)}}function y(t,e){var i,n=f(e.r,0),r=f(e.r0||0,0),y=n>0;if(y||r>0){if(y||(n=r,r=0),r>n){var _=n;n=r,r=_}var x=e.startAngle,b=e.endAngle;if(!isNaN(x)&&!isNaN(b)){var w=e.cx,S=e.cy,T=!!e.clockwise,M=d(b-x),C=M>s&&M%s;if(C>m&&(M=C),n>m)if(M>s-m)t.moveTo(w+n*u(x),S+n*l(x)),t.arc(w,S,n,x,b,!T),r>m&&(t.moveTo(w+r*u(b),S+r*l(b)),t.arc(w,S,r,b,x,T));else{var A=void 0,L=void 0,I=void 0,D=void 0,P=void 0,O=void 0,k=void 0,E=void 0,N=void 0,R=void 0,z=void 0,B=void 0,Z=void 0,F=void 0,V=void 0,G=void 0,H=n*u(x),U=n*l(x),W=r*u(b),j=r*l(b),X=M>m;if(X){var Y=e.cornerRadius;Y&&(A=(i=function(t){var e;if((0,o.isArray)(t)){var i=t.length;if(!i)return t;e=1===i?[t[0],t[0],0,0]:2===i?[t[0],t[0],t[1],t[1]]:3===i?t.concat(t[2]):t}else e=[t,t,t,t];return e}(Y))[0],L=i[1],I=i[2],D=i[3]);var q=d(n-r)/2;if(P=g(q,I),O=g(q,D),k=g(q,A),E=g(q,L),z=N=f(P,O),B=R=f(k,E),(N>m||R>m)&&(Z=n*u(b),F=n*l(b),V=r*u(x),G=r*l(x),Mm){var nt=g(I,z),rt=g(D,z),ot=v(V,G,H,U,n,nt,T),at=v(Z,F,W,j,n,rt,T);t.moveTo(w+ot.cx+ot.x0,S+ot.cy+ot.y0),z0&&t.arc(w+ot.cx,S+ot.cy,nt,c(ot.y0,ot.x0),c(ot.y1,ot.x1),!T),t.arc(w,S,n,c(ot.cy+ot.y1,ot.cx+ot.x1),c(at.cy+at.y1,at.cx+at.x1),!T),rt>0&&t.arc(w+at.cx,S+at.cy,rt,c(at.y1,at.x1),c(at.y0,at.x0),!T))}else t.moveTo(w+H,S+U),t.arc(w,S,n,x,b,!T);else t.moveTo(w+H,S+U);if(r>m&&X)if(B>m){nt=g(A,B),ot=v(W,j,Z,F,r,-(rt=g(L,B)),T),at=v(H,U,V,G,r,-nt,T);t.lineTo(w+ot.cx+ot.x0,S+ot.cy+ot.y0),B0&&t.arc(w+ot.cx,S+ot.cy,rt,c(ot.y0,ot.x0),c(ot.y1,ot.x1),!T),t.arc(w,S,r,c(ot.cy+ot.y1,ot.cx+ot.x1),c(at.cy+at.y1,at.cx+at.x1),T),nt>0&&t.arc(w+at.cx,S+at.cy,nt,c(at.y1,at.x1),c(at.y0,at.x0),!T))}else t.lineTo(w+W,S+j),t.arc(w,S,r,b,x,T);else t.lineTo(w+W,S+j)}else t.moveTo(w,S);t.closePath()}}}var _=function(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=2*Math.PI,this.clockwise=!0,this.cornerRadius=0},x=function(t){function e(e){return t.call(this,e)||this}return(0,n.ZT)(e,t),e.prototype.getDefaultShape=function(){return new _},e.prototype.buildPath=function(t,e){y(t,e)},e.prototype.isZeroArea=function(){return this.shape.startAngle===this.shape.endAngle||this.shape.r===this.shape.r0},e}(r.ZP);x.prototype.type="sector";const b=x},2874:(t,e,i)=>{"use strict";i.d(e,{Cv:()=>v,Gk:()=>S,H3:()=>b,I1:()=>_,Pn:()=>c,R:()=>y,gA:()=>T,gO:()=>x,i2:()=>g,jY:()=>p,m1:()=>w,mU:()=>f,n1:()=>m,oF:()=>M,qV:()=>d,ut:()=>s,zT:()=>u});var n=i(8760),r=i(5673),o=i(7153),a=Math.round;function s(t){var e;if(t&&"transparent"!==t){if("string"==typeof t&&t.indexOf("rgba")>-1){var i=(0,r.parse)(t);i&&(t="rgb("+i[0]+","+i[1]+","+i[2]+")",e=i[3])}}else t="none";return{color:t,opacity:null==e?1:e}}var l=1e-4;function u(t){return t-1e-4}function h(t){return a(1e3*t)/1e3}function c(t){return a(1e4*t)/1e4}function d(t){return"matrix("+h(t[0])+","+h(t[1])+","+h(t[2])+","+h(t[3])+","+c(t[4])+","+c(t[5])+")"}var p={left:"start",right:"end",center:"middle",middle:"middle"};function f(t,e,i){return"top"===i?t+=e/2:"bottom"===i&&(t-=e/2),t}function g(t){return t&&(t.shadowBlur||t.shadowOffsetX||t.shadowOffsetY)}function m(t){var e=t.style,i=t.getGlobalScale();return[e.shadowColor,(e.shadowBlur||0).toFixed(2),(e.shadowOffsetX||0).toFixed(2),(e.shadowOffsetY||0).toFixed(2),i[0],i[1]].join(",")}function v(t){return t&&!!t.image}function y(t){return v(t)||function(t){return t&&!!t.svgElement}(t)}function _(t){return"linear"===t.type}function x(t){return"radial"===t.type}function b(t){return t&&("linear"===t.type||"radial"===t.type)}function w(t){return"url(#"+t+")"}function S(t){var e=t.getGlobalScale(),i=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(i)/Math.log(10)),1)}function T(t){var e=t.x||0,i=t.y||0,r=(t.rotation||0)*n.RADIAN_TO_DEGREE,o=(0,n.retrieve2)(t.scaleX,1),s=(0,n.retrieve2)(t.scaleY,1),l=t.skewX||0,u=t.skewY||0,h=[];return(e||i)&&h.push("translate("+e+"px,"+i+"px)"),r&&h.push("rotate("+r+")"),1===o&&1===s||h.push("scale("+o+","+s+")"),(l||u)&&h.push("skew("+a(l*n.RADIAN_TO_DEGREE)+"deg, "+a(u*n.RADIAN_TO_DEGREE)+"deg)"),h.join(" ")}var M=o.Z.hasGlobalWindow&&(0,n.isFunction)(window.btoa)?function(t){return window.btoa(unescape(t))}:"undefined"!=typeof Buffer?function(t){return Buffer.from(t).toString("base64")}:function(t){return null}},5673:(t,e,i)=>{"use strict";i.r(e),i.d(e,{fastLerp:()=>x,fastMapToColor:()=>b,lerp:()=>w,lift:()=>y,lum:()=>A,mapToColor:()=>S,modifyAlpha:()=>M,modifyHSL:()=>T,parse:()=>m,random:()=>L,stringify:()=>C,toHex:()=>_});var n=i(4070),r={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 o(t){return(t=Math.round(t))<0?0:t>255?255:t}function a(t){return t<0?0:t>1?1:t}function s(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?o(parseFloat(e)/100*255):o(parseInt(e,10))}function l(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?a(parseFloat(e)/100):a(parseFloat(e))}function u(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function h(t,e,i){return t+(e-t)*i}function c(t,e,i,n,r){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t}function d(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var p=new n.ZP(20),f=null;function g(t,e){f&&d(f,e),f=p.put(t,f||e.slice())}function m(t,e){if(t){e=e||[];var i=p.get(t);if(i)return d(e,i);var n=(t+="").replace(/ /g,"").toLowerCase();if(n in r)return d(e,r[n]),g(t,e),e;var o,a=n.length;if("#"===n.charAt(0))return 4===a||5===a?(o=parseInt(n.slice(1,4),16))>=0&&o<=4095?(c(e,(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,5===a?parseInt(n.slice(4),16)/15:1),g(t,e),e):void c(e,0,0,0,1):7===a||9===a?(o=parseInt(n.slice(1,7),16))>=0&&o<=16777215?(c(e,(16711680&o)>>16,(65280&o)>>8,255&o,9===a?parseInt(n.slice(7),16)/255:1),g(t,e),e):void c(e,0,0,0,1):void 0;var u=n.indexOf("("),h=n.indexOf(")");if(-1!==u&&h+1===a){var f=n.substr(0,u),m=n.substr(u+1,h-(u+1)).split(","),y=1;switch(f){case"rgba":if(4!==m.length)return 3===m.length?c(e,+m[0],+m[1],+m[2],1):c(e,0,0,0,1);y=l(m.pop());case"rgb":return m.length>=3?(c(e,s(m[0]),s(m[1]),s(m[2]),3===m.length?y:l(m[3])),g(t,e),e):void c(e,0,0,0,1);case"hsla":return 4!==m.length?void c(e,0,0,0,1):(m[3]=l(m[3]),v(m,e),g(t,e),e);case"hsl":return 3!==m.length?void c(e,0,0,0,1):(v(m,e),g(t,e),e);default:return}}c(e,0,0,0,1)}}function v(t,e){var i=(parseFloat(t[0])%360+360)%360/360,n=l(t[1]),r=l(t[2]),a=r<=.5?r*(n+1):r+n-r*n,s=2*r-a;return c(e=e||[],o(255*u(s,a,i+1/3)),o(255*u(s,a,i)),o(255*u(s,a,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}function y(t,e){var i=m(t);if(i){for(var n=0;n<3;n++)i[n]=e<0?i[n]*(1-e)|0:(255-i[n])*e+i[n]|0,i[n]>255?i[n]=255:i[n]<0&&(i[n]=0);return C(i,4===i.length?"rgba":"rgb")}}function _(t){var e=m(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function x(t,e,i){if(e&&e.length&&t>=0&&t<=1){i=i||[];var n=t*(e.length-1),r=Math.floor(n),s=Math.ceil(n),l=e[r],u=e[s],c=n-r;return i[0]=o(h(l[0],u[0],c)),i[1]=o(h(l[1],u[1],c)),i[2]=o(h(l[2],u[2],c)),i[3]=a(h(l[3],u[3],c)),i}}var b=x;function w(t,e,i){if(e&&e.length&&t>=0&&t<=1){var n=t*(e.length-1),r=Math.floor(n),s=Math.ceil(n),l=m(e[r]),u=m(e[s]),c=n-r,d=C([o(h(l[0],u[0],c)),o(h(l[1],u[1],c)),o(h(l[2],u[2],c)),a(h(l[3],u[3],c))],"rgba");return i?{color:d,leftIndex:r,rightIndex:s,value:n}:d}}var S=w;function T(t,e,i,n){var r,o=m(t);if(t)return o=function(t){if(t){var e,i,n=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(n,r,o),s=Math.max(n,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,i=0;else{i=u<.5?l/(s+a):l/(2-s-a);var h=((s-n)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;n===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var p=[360*e,i,u];return null!=t[3]&&p.push(t[3]),p}}(o),null!=e&&(o[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=i&&(o[1]=l(i)),null!=n&&(o[2]=l(n)),C(v(o),"rgba")}function M(t,e){var i=m(t);if(i&&null!=e)return i[3]=a(e),C(i,"rgba")}function C(t,e){if(t&&t.length){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}}function A(t,e){var i=m(t);return i?(.299*i[0]+.587*i[1]+.114*i[2])*i[3]/255+(1-i[3])*e:0}function L(){return C([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}},6051:(t,e,i)=>{"use strict";i.d(e,{U5:()=>I,iR:()=>C,Pc:()=>A,AA:()=>L});var n=i(8299),r=i(8751),o=i(2604),a=i(1362),s=o.Z.CMD,l=[[],[],[]],u=Math.sqrt,h=Math.atan2;function c(t,e){if(e){var i,n,r,o,c,d,p=t.data,f=t.len(),g=s.M,m=s.C,v=s.L,y=s.R,_=s.A,x=s.Q;for(r=0,o=0;r1&&(a*=p(x),s*=p(x));var b=(r===o?-1:1)*p((a*a*(s*s)-a*a*(v*v)-s*s*(d*d))/(a*a*(v*v)+s*s*(d*d)))||0,w=b*a*v/s,S=b*-s*d/a,T=(t+i)/2+g(c)*w-f(c)*S,M=(e+n)/2+f(c)*w+g(c)*S,C=_([1,0],[(d-w)/a,(v-S)/s]),A=[(d-w)/a,(v-S)/s],L=[(-1*d-w)/a,(-1*v-S)/s],I=_(A,L);if(y(A,L)<=-1&&(I=m),y(A,L)>=1&&(I=0),I<0){var D=Math.round(I/m*1e6)/1e6;I=2*m+D%2*m}h.addData(u,T,M,a,s,C,I,c,o)}var b=/([mlvhzcqtsa])([^mlvhzcqtsa]*)/gi,w=/-?([0-9]*\.)?[0-9]+([eE]-?[0-9]+)?/g;var S=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return(0,n.ZT)(e,t),e.prototype.applyTransform=function(t){},e}(r.ZP);function T(t){return null!=t.setData}function M(t,e){var i=function(t){var e=new o.Z;if(!t)return e;var i,n=0,r=0,a=n,s=r,l=o.Z.CMD,u=t.match(b);if(!u)return e;for(var h=0;h{"use strict";i.r(e),i.d(e,{dispose:()=>lt,disposeAll:()=>ut,getInstance:()=>ht,init:()=>st,registerPainter:()=>ct,version:()=>dt});var n=i(7153),r=i(8760),o=i(8299),a=i(1362),s=function(t,e){this.target=t,this.topTarget=e&&e.topTarget};const l=function(){function t(t){this.handler=t,t.on("mousedown",this._dragStart,this),t.on("mousemove",this._drag,this),t.on("mouseup",this._dragEnd,this)}return t.prototype._dragStart=function(t){for(var e=t.target;e&&!e.draggable;)e=e.parent||e.__hostTarget;e&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.handler.dispatchToElement(new s(e,t),"dragstart",t.event))},t.prototype._drag=function(t){var e=this._draggingTarget;if(e){var i=t.offsetX,n=t.offsetY,r=i-this._x,o=n-this._y;this._x=i,this._y=n,e.drift(r,o,t),this.handler.dispatchToElement(new s(e,t),"drag",t.event);var a=this.handler.findHover(i,n,e).target,l=this._dropTarget;this._dropTarget=a,e!==a&&(l&&a!==l&&this.handler.dispatchToElement(new s(l,t),"dragleave",t.event),a&&a!==l&&this.handler.dispatchToElement(new s(a,t),"dragenter",t.event))}},t.prototype._dragEnd=function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.handler.dispatchToElement(new s(e,t),"dragend",t.event),this._dropTarget&&this.handler.dispatchToElement(new s(this._dropTarget,t),"drop",t.event),this._draggingTarget=null,this._dropTarget=null},t}();var u=i(1935),h=i(9186),c=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,i){return this._doTrack(t,e,i),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,i){var n=t.touches;if(n){for(var r={points:[],touches:[],target:e,event:t},o=0,a=n.length;o1&&r&&r.length>1){var a=d(r)/d(o);!isFinite(a)&&(a=1),e.pinchScale=a;var s=[((n=r)[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2];return e.pinchX=s[0],e.pinchY=s[1],{type:"pinch",target:t[0].target,event:e}}}}},f=i(641),g="silent";function m(){h.sT(this.event)}var v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return(0,o.ZT)(e,t),e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(u.Z),y=function(t,e){this.x=t,this.y=e},_=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],x=new f.Z(0,0,0,0),b=function(t){function e(e,i,n,r,o){var a=t.call(this)||this;return a._hovered=new y(0,0),a.storage=e,a.painter=i,a.painterRoot=r,a._pointerSize=o,n=n||new v,a.proxy=null,a.setHandlerProxy(n),a._draggingMgr=new l(a),a}return(0,o.ZT)(e,t),e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(r.each(_,(function(e){t.on&&t.on(e,this[e],this)}),this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var e=t.zrX,i=t.zrY,n=T(this,e,i),r=this._hovered,o=r.target;o&&!o.__zr&&(o=(r=this.findHover(r.x,r.y)).target);var a=this._hovered=n?new y(e,i):this.findHover(e,i),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},e.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new y(0,0)},e.prototype.dispatch=function(t,e){var i=this[t];i&&i.call(this,e)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},e.prototype.dispatchToElement=function(t,e,i){var n=(t=t||{}).target;if(!n||!n.silent){for(var r="on"+e,o=function(t,e,i){return{type:t,event:i,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:i.zrX,offsetY:i.zrY,gestureEvent:i.gestureEvent,pinchX:i.pinchX,pinchY:i.pinchY,pinchScale:i.pinchScale,wheelDelta:i.zrDelta,zrByTouch:i.zrByTouch,which:i.which,stop:m}}(e,t,i);n&&(n[r]&&(o.cancelBubble=!!n[r].call(n,o)),n.trigger(e,o),n=n.__hostTarget?n.__hostTarget:n.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer((function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)})))}},e.prototype.findHover=function(t,e,i){var n=this.storage.getDisplayList(),r=new y(t,e);if(S(n,r,t,e,i),this._pointerSize&&!r.target){for(var o=[],a=this._pointerSize,s=a/2,l=new f.Z(t-s,e-s,a,a),u=n.length-1;u>=0;u--){var h=n[u];h===i||h.ignore||h.ignoreCoarsePointer||h.parent&&h.parent.ignoreCoarsePointer||(x.copy(h.getBoundingRect()),h.transform&&x.applyTransform(h.transform),x.intersect(l)&&o.push(h))}if(o.length)for(var c=Math.PI/12,d=2*Math.PI,p=0;p=0;o--){var a=t[o],s=void 0;if(a!==r&&!a.ignore&&(s=w(a,i,n))&&(!e.topTarget&&(e.topTarget=a),s!==g)){e.target=a;break}}}function T(t,e,i){var n=t.painter;return e<0||e>n.getWidth()||i<0||i>n.getHeight()}r.each(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(t){b.prototype[t]=function(e){var i,n,r=e.zrX,o=e.zrY,s=T(this,r,o);if("mouseup"===t&&s||(n=(i=this.findHover(r,o)).target),"mousedown"===t)this._downEl=n,this._downPoint=[e.zrX,e.zrY],this._upEl=n;else if("mouseup"===t)this._upEl=n;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||a.dist(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(i,t,e)}}));const M=b;var C=i(6816),A=i(1736),L=!1;function I(){L||(L=!0,console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors"))}function D(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}const P=function(){function t(){this._roots=[],this._displayList=[],this._displayListLen=0,this.displayableSortFunc=D}return t.prototype.traverse=function(t,e){for(var i=0;i0&&(u.__clipPaths=[]),isNaN(u.z)&&(I(),u.z=0),isNaN(u.z2)&&(I(),u.z2=0),isNaN(u.zlevel)&&(I(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var h=t.getDecalElement&&t.getDecalElement();h&&this._updateAndAddDisplayable(h,e,i);var c=t.getTextGuideLine();c&&this._updateAndAddDisplayable(c,e,i);var d=t.getTextContent();d&&this._updateAndAddDisplayable(d,e,i)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,i=t.length;e=0&&this._roots.splice(n,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}();var O=i(8935),k=i(8677);function E(){return(new Date).getTime()}const N=function(t){function e(e){var i=t.call(this)||this;return i._running=!1,i._time=0,i._pausedTime=0,i._pauseStart=0,i._paused=!1,e=e||{},i.stage=e.stage||{},i}return(0,o.ZT)(e,t),e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},e.prototype.removeClip=function(t){if(t.animation){var e=t.prev,i=t.next;e?e.next=i:this._head=i,i?i.prev=e:this._tail=e,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},e.prototype.update=function(t){for(var e=E()-this._pausedTime,i=e-this._time,n=this._head;n;){var r=n.next;n.step(e,i)?(n.ondestroy(),this.removeClip(n),n=r):n=r}this._time=e,t||(this.trigger("frame",i),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0,(0,O.Z)((function e(){t._running&&((0,O.Z)(e),!t._paused&&t.update())}))},e.prototype.start=function(){this._running||(this._time=E(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=E(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=E()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._head=this._tail=null},e.prototype.isFinished=function(){return null==this._head},e.prototype.animate=function(t,e){e=e||{},this.start();var i=new k.Z(t,e.loop);return this.addAnimator(i),i},e}(u.Z);var R,z,B=n.Z.domSupported,Z=(z={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:R=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:r.map(R,(function(t){var e=t.replace("mouse","pointer");return z.hasOwnProperty(e)?e:t}))}),F=["mousemove","mouseup"],V=["pointermove","pointerup"],G=!1;function H(t){var e=t.pointerType;return"pen"===e||"touch"===e}function U(t){t&&(t.zrByTouch=!0)}function W(t,e){for(var i=e,n=!1;i&&9!==i.nodeType&&!(n=i.domBelongToZr||i!==e&&i===t.painterRoot);)i=i.parentNode;return n}var j=function(t,e){this.stopPropagation=r.noop,this.stopImmediatePropagation=r.noop,this.preventDefault=r.noop,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY},X={mousedown:function(t){t=(0,h.OD)(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=(0,h.OD)(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=(0,h.OD)(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){W(this,(t=(0,h.OD)(this.dom,t)).toElement||t.relatedTarget)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){G=!0,t=(0,h.OD)(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){G||(t=(0,h.OD)(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){U(t=(0,h.OD)(this.dom,t)),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),X.mousemove.call(this,t),X.mousedown.call(this,t)},touchmove:function(t){U(t=(0,h.OD)(this.dom,t)),this.handler.processGesture(t,"change"),X.mousemove.call(this,t)},touchend:function(t){U(t=(0,h.OD)(this.dom,t)),this.handler.processGesture(t,"end"),X.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<300&&X.click.call(this,t)},pointerdown:function(t){X.mousedown.call(this,t)},pointermove:function(t){H(t)||X.mousemove.call(this,t)},pointerup:function(t){X.mouseup.call(this,t)},pointerout:function(t){H(t)||X.mouseout.call(this,t)}};r.each(["click","dblclick","contextmenu"],(function(t){X[t]=function(e){e=(0,h.OD)(this.dom,e),this.trigger(t,e)}}));var Y={pointermove:function(t){H(t)||Y.mousemove.call(this,t)},pointerup:function(t){Y.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function q(t,e){var i=e.domHandlers;n.Z.pointerEventsSupported?r.each(Z.pointer,(function(n){J(e,n,(function(e){i[n].call(t,e)}))})):(n.Z.touchEventsSupported&&r.each(Z.touch,(function(n){J(e,n,(function(r){i[n].call(t,r),function(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout((function(){t.touching=!1,t.touchTimer=null}),700)}(e)}))})),r.each(Z.mouse,(function(n){J(e,n,(function(r){r=(0,h.iP)(r),e.touching||i[n].call(t,r)}))})))}function K(t,e){function i(i){J(e,i,(function(n){n=(0,h.iP)(n),W(t,n.target)||(n=function(t,e){return(0,h.OD)(t.dom,new j(t,e),!0)}(t,n),e.domHandlers[i].call(t,n))}),{capture:!0})}n.Z.pointerEventsSupported?r.each(V,i):n.Z.touchEventsSupported||r.each(F,i)}function J(t,e,i,n){t.mounted[e]=i,t.listenerOpts[e]=n,(0,h.Oo)(t.domTarget,e,i,n)}function Q(t){var e=t.mounted;for(var i in e)e.hasOwnProperty(i)&&(0,h.xg)(t.domTarget,i,e[i],t.listenerOpts[i]);t.mounted={}}var $=function(t,e){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=t,this.domHandlers=e};const tt=function(t){function e(e,i){var n=t.call(this)||this;return n.__pointerCapturing=!1,n.dom=e,n.painterRoot=i,n._localHandlerScope=new $(e,X),B&&(n._globalHandlerScope=new $(document,Y)),q(n,n._localHandlerScope),n}return(0,o.ZT)(e,t),e.prototype.dispose=function(){Q(this._localHandlerScope),B&&Q(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,B&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var e=this._globalHandlerScope;t?K(this,e):Q(e)}},e}(u.Z);var et=i(5673),it=i(7588),nt=i(2141),rt={},ot={};var at=function(){function t(t,e,i){var o=this;this._sleepAfterStill=10,this._stillFrameAccum=0,this._needsRefresh=!0,this._needsRefreshHover=!0,this._darkMode=!1,i=i||{},this.dom=e,this.id=t;var a=new P,s=i.renderer||"canvas";rt[s]||(s=r.keys(rt)[0]),i.useDirtyRect=null!=i.useDirtyRect&&i.useDirtyRect;var l=new rt[s](e,a,i,t),u=i.ssr||l.ssrOnly;this.storage=a,this.painter=l;var h,c=n.Z.node||n.Z.worker||u?null:new tt(l.getViewportRoot(),l.root),d=i.useCoarsePointer;(null==d||"auto"===d?n.Z.touchEventsSupported:!!d)&&(h=r.retrieve2(i.pointerSize,44)),this.handler=new M(a,l,c,l.root,h),this.animation=new N({stage:{update:u?null:function(){return o._flush(!0)}}}),u||this.animation.start()}return t.prototype.add=function(t){t&&(this.storage.addRoot(t),t.addSelfToZr(this),this.refresh())},t.prototype.remove=function(t){t&&(this.storage.delRoot(t),t.removeSelfFromZr(this),this.refresh())},t.prototype.configLayer=function(t,e){this.painter.configLayer&&this.painter.configLayer(t,e),this.refresh()},t.prototype.setBackgroundColor=function(t){this.painter.setBackgroundColor&&this.painter.setBackgroundColor(t),this.refresh(),this._backgroundColor=t,this._darkMode=function(t){if(!t)return!1;if("string"==typeof t)return(0,et.lum)(t,1)0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this.animation.start(),this._stillFrameAccum=0},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover()},t.prototype.resize=function(t){t=t||{},this.painter.resize(t.width,t.height),this.handler.resize()},t.prototype.clearAnimation=function(){this.animation.clear()},t.prototype.getWidth=function(){return this.painter.getWidth()},t.prototype.getHeight=function(){return this.painter.getHeight()},t.prototype.setCursorStyle=function(t){this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){return this.handler.findHover(t,e)},t.prototype.on=function(t,e,i){return this.handler.on(t,e,i),this},t.prototype.off=function(t,e){this.handler.off(t,e)},t.prototype.trigger=function(t,e){this.handler.trigger(t,e)},t.prototype.clear=function(){for(var t=this.storage.getRoots(),e=0;e=i;)e=e.__parent;return this._currentShownBounds.contains(e.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(t,e):this._animationAddLayerNonAnimated(t,e)),this},removeLayer:function(t){return t instanceof L.LayerGroup?this.removeLayers([t]):t.getLatLng?this._map?t.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(t)),this._removeLayer(t,!0),this.fire("layerremove",{layer:t}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),t.off(this._childMarkerEventHandlers,this),this._featureGroup.hasLayer(t)&&(this._featureGroup.removeLayer(t),t.clusterShow&&t.clusterShow()),this):this:(!this._arraySplice(this._needsClustering,t)&&this.hasLayer(t)&&this._needsRemoving.push({layer:t,latlng:t._latlng}),this.fire("layerremove",{layer:t}),this):(this._nonPointGroup.removeLayer(t),this.fire("layerremove",{layer:t}),this)},addLayers:function(t,e){if(!L.Util.isArray(t))return this.addLayer(t);var i,n=this._featureGroup,r=this._nonPointGroup,o=this.options.chunkedLoading,a=this.options.chunkInterval,s=this.options.chunkProgress,l=t.length,u=0,h=!0;if(this._map){var c=(new Date).getTime(),d=L.bind((function(){var p=(new Date).getTime();for(this._map&&this._unspiderfy&&this._unspiderfy();ua);u++)if((i=t[u])instanceof L.LayerGroup)h&&(t=t.slice(),h=!1),this._extractNonGroupLayers(i,t),l=t.length;else if(i.getLatLng){if(!this.hasLayer(i)&&(this._addLayer(i,this._maxZoom),e||this.fire("layeradd",{layer:i}),i.__parent&&2===i.__parent.getChildCount())){var f=i.__parent.getAllChildMarkers(),g=f[0]===i?f[1]:f[0];n.removeLayer(g)}}else r.addLayer(i),e||this.fire("layeradd",{layer:i});s&&s(u,l,(new Date).getTime()-c),u===l?(this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)):setTimeout(d,this.options.chunkDelay)}),this);d()}else for(var p=this._needsClustering;u=0;e--)t.extend(this._needsClustering[e].getLatLng());return t.extend(this._nonPointGroup.getBounds()),t},eachLayer:function(t,e){var i,n,r,o=this._needsClustering.slice(),a=this._needsRemoving;for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(o),n=o.length-1;n>=0;n--){for(i=!0,r=a.length-1;r>=0;r--)if(a[r].layer===o[n]){i=!1;break}i&&t.call(e,o[n])}this._nonPointGroup.eachLayer(t,e)},getLayers:function(){var t=[];return this.eachLayer((function(e){t.push(e)})),t},getLayer:function(t){var e=null;return t=parseInt(t,10),this.eachLayer((function(i){L.stamp(i)===t&&(e=i)})),e},hasLayer:function(t){if(!t)return!1;var e,i=this._needsClustering;for(e=i.length-1;e>=0;e--)if(i[e]===t)return!0;for(e=(i=this._needsRemoving).length-1;e>=0;e--)if(i[e].layer===t)return!1;return!(!t.__parent||t.__parent._group!==this)||this._nonPointGroup.hasLayer(t)},zoomToShowLayer:function(t,e){var i=this._map;"function"!=typeof e&&(e=function(){});var n=function(){!i.hasLayer(t)&&!i.hasLayer(t.__parent)||this._inZoomAnimation||(this._map.off("moveend",n,this),this.off("animationend",n,this),i.hasLayer(t)?e():t.__parent._icon&&(this.once("spiderfied",e,this),t.__parent.spiderfy()))};t._icon&&this._map.getBounds().contains(t.getLatLng())?e():t.__parent._zoom=0;i--)if(t[i]===e)return t.splice(i,1),!0},_removeFromGridUnclustered:function(t,e){for(var i=this._map,n=this._gridUnclustered,r=Math.floor(this._map.getMinZoom());e>=r&&n[e].removeObject(t,i.project(t.getLatLng(),e));e--);},_childMarkerDragStart:function(t){t.target.__dragStart=t.target._latlng},_childMarkerMoved:function(t){if(!this._ignoreMove&&!t.target.__dragStart){var e=t.target._popup&&t.target._popup.isOpen();this._moveChild(t.target,t.oldLatLng,t.latlng),e&&t.target.openPopup()}},_moveChild:function(t,e,i){t._latlng=e,this.removeLayer(t),t._latlng=i,this.addLayer(t)},_childMarkerDragEnd:function(t){var e=t.target.__dragStart;delete t.target.__dragStart,e&&this._moveChild(t.target,e,t.target._latlng)},_removeLayer:function(t,e,i){var n=this._gridClusters,r=this._gridUnclustered,o=this._featureGroup,a=this._map,s=Math.floor(this._map.getMinZoom());e&&this._removeFromGridUnclustered(t,this._maxZoom);var l,u=t.__parent,h=u._markers;for(this._arraySplice(h,t);u&&(u._childCount--,u._boundsNeedUpdate=!0,!(u._zoom"+e+"",className:"marker-cluster"+i,iconSize:new L.Point(40,40)})},_bindEvents:function(){var t=this._map,e=this.options.spiderfyOnMaxZoom,i=this.options.showCoverageOnHover,n=this.options.zoomToBoundsOnClick,r=this.options.spiderfyOnEveryZoom;(e||n||r)&&this.on("clusterclick clusterkeypress",this._zoomOrSpiderfy,this),i&&(this.on("clustermouseover",this._showCoverage,this),this.on("clustermouseout",this._hideCoverage,this),t.on("zoomend",this._hideCoverage,this))},_zoomOrSpiderfy:function(t){var e=t.layer,i=e;if("clusterkeypress"!==t.type||!t.originalEvent||13===t.originalEvent.keyCode){for(;1===i._childClusters.length;)i=i._childClusters[0];i._zoom===this._maxZoom&&i._childCount===e._childCount&&this.options.spiderfyOnMaxZoom?e.spiderfy():this.options.zoomToBoundsOnClick&&e.zoomToBounds(),this.options.spiderfyOnEveryZoom&&e.spiderfy(),t.originalEvent&&13===t.originalEvent.keyCode&&this._map._container.focus()}},_showCoverage:function(t){var e=this._map;this._inZoomAnimation||(this._shownPolygon&&e.removeLayer(this._shownPolygon),t.layer.getChildCount()>2&&t.layer!==this._spiderfied&&(this._shownPolygon=new L.Polygon(t.layer.getConvexHull(),this.options.polygonOptions),e.addLayer(this._shownPolygon)))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_unbindEvents:function(){var t=this.options.spiderfyOnMaxZoom,e=this.options.showCoverageOnHover,i=this.options.zoomToBoundsOnClick,n=this.options.spiderfyOnEveryZoom,r=this._map;(t||i||n)&&this.off("clusterclick clusterkeypress",this._zoomOrSpiderfy,this),e&&(this.off("clustermouseover",this._showCoverage,this),this.off("clustermouseout",this._hideCoverage,this),r.off("zoomend",this._hideCoverage,this))},_zoomEnd:function(){this._map&&(this._mergeSplitClusters(),this._zoom=Math.round(this._map._zoom),this._currentShownBounds=this._getExpandedVisibleBounds())},_moveEnd:function(){if(!this._inZoomAnimation){var t=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),this._zoom,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,Math.round(this._map._zoom),t),this._currentShownBounds=t}},_generateInitialClusters:function(){var t=Math.ceil(this._map.getMaxZoom()),e=Math.floor(this._map.getMinZoom()),i=this.options.maxClusterRadius,n=i;"function"!=typeof i&&(n=function(){return i}),null!==this.options.disableClusteringAtZoom&&(t=this.options.disableClusteringAtZoom-1),this._maxZoom=t,this._gridClusters={},this._gridUnclustered={};for(var r=t;r>=e;r--)this._gridClusters[r]=new L.DistanceGrid(n(r)),this._gridUnclustered[r]=new L.DistanceGrid(n(r));this._topClusterLevel=new this._markerCluster(this,e-1)},_addLayer:function(t,e){var i,n,r=this._gridClusters,o=this._gridUnclustered,a=Math.floor(this._map.getMinZoom());for(this.options.singleMarkerMode&&this._overrideMarkerIcon(t),t.on(this._childMarkerEventHandlers,this);e>=a;e--){i=this._map.project(t.getLatLng(),e);var s=r[e].getNearObject(i);if(s)return s._addChild(t),void(t.__parent=s);if(s=o[e].getNearObject(i)){var l=s.__parent;l&&this._removeLayer(s,!1);var u=new this._markerCluster(this,e,s,t);r[e].addObject(u,this._map.project(u._cLatLng,e)),s.__parent=u,t.__parent=u;var h=u;for(n=e-1;n>l._zoom;n--)h=new this._markerCluster(this,n,h),r[n].addObject(h,this._map.project(s.getLatLng(),n));return l._addChild(h),void this._removeFromGridUnclustered(s,e)}o[e].addObject(t,i)}this._topClusterLevel._addChild(t),t.__parent=this._topClusterLevel},_refreshClustersIcons:function(){this._featureGroup.eachLayer((function(t){t instanceof L.MarkerCluster&&t._iconNeedsUpdate&&t._updateIcon()}))},_enqueue:function(t){this._queue.push(t),this._queueTimeout||(this._queueTimeout=setTimeout(L.bind(this._processQueue,this),300))},_processQueue:function(){for(var t=0;tt?(this._animationStart(),this._animationZoomOut(this._zoom,t)):this._moveEnd()},_getExpandedVisibleBounds:function(){return this.options.removeOutsideVisibleBounds?L.Browser.mobile?this._checkBoundsMaxLat(this._map.getBounds()):this._checkBoundsMaxLat(this._map.getBounds().pad(1)):this._mapBoundsInfinite},_checkBoundsMaxLat:function(t){var e=this._maxLat;return void 0!==e&&(t.getNorth()>=e&&(t._northEast.lat=1/0),t.getSouth()<=-e&&(t._southWest.lat=-1/0)),t},_animationAddLayerNonAnimated:function(t,e){if(e===t)this._featureGroup.addLayer(t);else if(2===e._childCount){e._addToMap();var i=e.getAllChildMarkers();this._featureGroup.removeLayer(i[0]),this._featureGroup.removeLayer(i[1])}else e._updateIcon()},_extractNonGroupLayers:function(t,e){var i,n=t.getLayers(),r=0;for(e=e||[];r=0;i--)a=l[i],n.contains(a._latlng)||r.removeLayer(a)})),this._forceLayout(),this._topClusterLevel._recursivelyBecomeVisible(n,e),r.eachLayer((function(t){t instanceof L.MarkerCluster||!t._icon||t.clusterShow()})),this._topClusterLevel._recursively(n,t,e,(function(t){t._recursivelyRestoreChildPositions(e)})),this._ignoreMove=!1,this._enqueue((function(){this._topClusterLevel._recursively(n,t,o,(function(t){r.removeLayer(t),t.clusterShow()})),this._animationEnd()}))},_animationZoomOut:function(t,e){this._animationZoomOutSingle(this._topClusterLevel,t-1,e),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),t,this._getExpandedVisibleBounds())},_animationAddLayer:function(t,e){var i=this,n=this._featureGroup;n.addLayer(t),e!==t&&(e._childCount>2?(e._updateIcon(),this._forceLayout(),this._animationStart(),t._setPos(this._map.latLngToLayerPoint(e.getLatLng())),t.clusterHide(),this._enqueue((function(){n.removeLayer(t),t.clusterShow(),i._animationEnd()}))):(this._forceLayout(),i._animationStart(),i._animationZoomOutSingle(e,this._map.getMaxZoom(),this._zoom)))}},_animationZoomOutSingle:function(t,e,i){var n=this._getExpandedVisibleBounds(),r=Math.floor(this._map.getMinZoom());t._recursivelyAnimateChildrenInAndAddSelfToMap(n,r,e+1,i);var o=this;this._forceLayout(),t._recursivelyBecomeVisible(n,i),this._enqueue((function(){if(1===t._childCount){var a=t._markers[0];this._ignoreMove=!0,a.setLatLng(a.getLatLng()),this._ignoreMove=!1,a.clusterShow&&a.clusterShow()}else t._recursively(n,i,r,(function(t){t._recursivelyRemoveChildrenFromMap(n,r,e+1)}));o._animationEnd()}))},_animationEnd:function(){this._map&&(this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim","")),this._inZoomAnimation--,this.fire("animationend")},_forceLayout:function(){L.Util.falseFn(document.body.offsetWidth)}}),L.markerClusterGroup=function(t){return new L.MarkerClusterGroup(t)};var i=L.MarkerCluster=L.Marker.extend({options:L.Icon.prototype.options,initialize:function(t,e,i,n){L.Marker.prototype.initialize.call(this,i?i._cLatLng||i.getLatLng():new L.LatLng(0,0),{icon:this,pane:t.options.clusterPane}),this._group=t,this._zoom=e,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._bounds=new L.LatLngBounds,i&&this._addChild(i),n&&this._addChild(n)},getAllChildMarkers:function(t,e){t=t||[];for(var i=this._childClusters.length-1;i>=0;i--)this._childClusters[i].getAllChildMarkers(t,e);for(var n=this._markers.length-1;n>=0;n--)e&&this._markers[n].__dragStart||t.push(this._markers[n]);return t},getChildCount:function(){return this._childCount},zoomToBounds:function(t){for(var e,i=this._childClusters.slice(),n=this._group._map,r=n.getBoundsZoom(this._bounds),o=this._zoom+1,a=n.getZoom();i.length>0&&r>o;){o++;var s=[];for(e=0;eo?this._group._map.setView(this._latlng,o):r<=a?this._group._map.setView(this._latlng,a+1):this._group._map.fitBounds(this._bounds,t)},getBounds:function(){var t=new L.LatLngBounds;return t.extend(this._bounds),t},_updateIcon:function(){this._iconNeedsUpdate=!0,this._icon&&this.setIcon(this)},createIcon:function(){return this._iconNeedsUpdate&&(this._iconObj=this._group.options.iconCreateFunction(this),this._iconNeedsUpdate=!1),this._iconObj.createIcon()},createShadow:function(){return this._iconObj.createShadow()},_addChild:function(t,e){this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._setClusterCenter(t),t instanceof L.MarkerCluster?(e||(this._childClusters.push(t),t.__parent=this),this._childCount+=t._childCount):(e||this._markers.push(t),this._childCount++),this.__parent&&this.__parent._addChild(t,!0)},_setClusterCenter:function(t){this._cLatLng||(this._cLatLng=t._cLatLng||t._latlng)},_resetBounds:function(){var t=this._bounds;t._southWest&&(t._southWest.lat=1/0,t._southWest.lng=1/0),t._northEast&&(t._northEast.lat=-1/0,t._northEast.lng=-1/0)},_recalculateBounds:function(){var t,e,i,n,r=this._markers,o=this._childClusters,a=0,s=0,l=this._childCount;if(0!==l){for(this._resetBounds(),t=0;t=0;i--)(n=r[i])._icon&&(n._setPos(e),n.clusterHide())}),(function(t){var i,n,r=t._childClusters;for(i=r.length-1;i>=0;i--)(n=r[i])._icon&&(n._setPos(e),n.clusterHide())}))},_recursivelyAnimateChildrenInAndAddSelfToMap:function(t,e,i,n){this._recursively(t,n,e,(function(r){r._recursivelyAnimateChildrenIn(t,r._group._map.latLngToLayerPoint(r.getLatLng()).round(),i),r._isSingleParent()&&i-1===n?(r.clusterShow(),r._recursivelyRemoveChildrenFromMap(t,e,i)):r.clusterHide(),r._addToMap()}))},_recursivelyBecomeVisible:function(t,e){this._recursively(t,this._group._map.getMinZoom(),e,null,(function(t){t.clusterShow()}))},_recursivelyAddChildrenToMap:function(t,e,i){this._recursively(i,this._group._map.getMinZoom()-1,e,(function(n){if(e!==n._zoom)for(var r=n._markers.length-1;r>=0;r--){var o=n._markers[r];i.contains(o._latlng)&&(t&&(o._backupLatlng=o.getLatLng(),o.setLatLng(t),o.clusterHide&&o.clusterHide()),n._group._featureGroup.addLayer(o))}}),(function(e){e._addToMap(t)}))},_recursivelyRestoreChildPositions:function(t){for(var e=this._markers.length-1;e>=0;e--){var i=this._markers[e];i._backupLatlng&&(i.setLatLng(i._backupLatlng),delete i._backupLatlng)}if(t-1===this._zoom)for(var n=this._childClusters.length-1;n>=0;n--)this._childClusters[n]._restorePosition();else for(var r=this._childClusters.length-1;r>=0;r--)this._childClusters[r]._recursivelyRestoreChildPositions(t)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(t,e,i,n){var r,o;this._recursively(t,e-1,i-1,(function(t){for(o=t._markers.length-1;o>=0;o--)r=t._markers[o],n&&n.contains(r._latlng)||(t._group._featureGroup.removeLayer(r),r.clusterShow&&r.clusterShow())}),(function(t){for(o=t._childClusters.length-1;o>=0;o--)r=t._childClusters[o],n&&n.contains(r._latlng)||(t._group._featureGroup.removeLayer(r),r.clusterShow&&r.clusterShow())}))},_recursively:function(t,e,i,n,r){var o,a,s=this._childClusters,l=this._zoom;if(e<=l&&(n&&n(this),r&&l===i&&r(this)),l=0;o--)(a=s[o])._boundsNeedUpdate&&a._recalculateBounds(),t.intersects(a._bounds)&&a._recursively(t,e,i,n,r)},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}});L.Marker.include({clusterHide:function(){var t=this.options.opacity;return this.setOpacity(0),this.options.opacity=t,this},clusterShow:function(){return this.setOpacity(this.options.opacity)}}),L.DistanceGrid=function(t){this._cellSize=t,this._sqCellSize=t*t,this._grid={},this._objectPoint={}},L.DistanceGrid.prototype={addObject:function(t,e){var i=this._getCoord(e.x),n=this._getCoord(e.y),r=this._grid,o=r[n]=r[n]||{},a=o[i]=o[i]||[],s=L.Util.stamp(t);this._objectPoint[s]=e,a.push(t)},updateObject:function(t,e){this.removeObject(t),this.addObject(t,e)},removeObject:function(t,e){var i,n,r=this._getCoord(e.x),o=this._getCoord(e.y),a=this._grid,s=a[o]=a[o]||{},l=s[r]=s[r]||[];for(delete this._objectPoint[L.Util.stamp(t)],i=0,n=l.length;i=0;i--)n=e[i],(r=this.getDistant(n,t))>0&&(s.push(n),r>o&&(o=r,a=n));return{maxPoint:a,newPoints:s}},buildConvexHull:function(t,e){var i=[],n=this.findMostDistantPointFromBaseLine(t,e);return n.maxPoint?i=(i=i.concat(this.buildConvexHull([t[0],n.maxPoint],n.newPoints))).concat(this.buildConvexHull([n.maxPoint,t[1]],n.newPoints)):[t[0]]},getConvexHull:function(t){var e,i=!1,n=!1,r=!1,o=!1,a=null,s=null,l=null,u=null,h=null,c=null;for(e=t.length-1;e>=0;e--){var d=t[e];(!1===i||d.lat>i)&&(a=d,i=d.lat),(!1===n||d.latr)&&(l=d,r=d.lng),(!1===o||d.lng=0;e--)t=i[e].getLatLng(),n.push(t);return L.QuickHull.getConvexHull(n)}}),L.MarkerCluster.include({_2PI:2*Math.PI,_circleFootSeparation:25,_circleStartAngle:0,_spiralFootSeparation:28,_spiralLengthStart:11,_spiralLengthFactor:5,_circleSpiralSwitchover:9,spiderfy:function(){if(this._group._spiderfied!==this&&!this._group._inZoomAnimation){var t,e=this.getAllChildMarkers(null,!0),i=this._group._map.latLngToLayerPoint(this._latlng);this._group._unspiderfy(),this._group._spiderfied=this,this._group.options.spiderfyShapePositions?t=this._group.options.spiderfyShapePositions(e.length,i):e.length>=this._circleSpiralSwitchover?t=this._generatePointsSpiral(e.length,i):(i.y+=10,t=this._generatePointsCircle(e.length,i)),this._animationSpiderfy(e,t)}},unspiderfy:function(t){this._group._inZoomAnimation||(this._animationUnspiderfy(t),this._group._spiderfied=null)},_generatePointsCircle:function(t,e){var i,n,r=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+t)/this._2PI,o=this._2PI/t,a=[];for(r=Math.max(r,35),a.length=t,i=0;i=0;i--)i=0;e--)t=o[e],r.removeLayer(t),t._preSpiderfyLatlng&&(t.setLatLng(t._preSpiderfyLatlng),delete t._preSpiderfyLatlng),t.setZIndexOffset&&t.setZIndexOffset(0),t._spiderLeg&&(n.removeLayer(t._spiderLeg),delete t._spiderLeg);i.fire("unspiderfied",{cluster:this,markers:o}),i._ignoreMove=!1,i._spiderfied=null}}),L.MarkerClusterNonAnimated=L.MarkerCluster.extend({_animationSpiderfy:function(t,e){var i,n,r,o,a=this._group,s=a._map,l=a._featureGroup,u=this._group.options.spiderLegPolylineOptions;for(a._ignoreMove=!0,i=0;i=0;i--)s=h.layerPointToLatLng(e[i]),(n=t[i])._preSpiderfyLatlng=n._latlng,n.setLatLng(s),n.clusterShow&&n.clusterShow(),f&&((o=(r=n._spiderLeg)._path).style.strokeDashoffset=0,r.setStyle({opacity:m}));this.setOpacity(.3),u._ignoreMove=!1,setTimeout((function(){u._animationEnd(),u.fire("spiderfied",{cluster:l,markers:t})}),200)},_animationUnspiderfy:function(t){var e,i,n,r,o,a,s=this,l=this._group,u=l._map,h=l._featureGroup,c=t?u._latLngToNewLayerPoint(this._latlng,t.zoom,t.center):u.latLngToLayerPoint(this._latlng),d=this.getAllChildMarkers(null,!0),p=L.Path.SVG;for(l._ignoreMove=!0,l._animationStart(),this.setOpacity(1),i=d.length-1;i>=0;i--)(e=d[i])._preSpiderfyLatlng&&(e.closePopup(),e.setLatLng(e._preSpiderfyLatlng),delete e._preSpiderfyLatlng,a=!0,e._setPos&&(e._setPos(c),a=!1),e.clusterHide&&(e.clusterHide(),a=!1),a&&h.removeLayer(e),p&&(o=(r=(n=e._spiderLeg)._path).getTotalLength()+.1,r.style.strokeDashoffset=o,n.setStyle({opacity:0})));l._ignoreMove=!1,setTimeout((function(){var t=0;for(i=d.length-1;i>=0;i--)(e=d[i])._spiderLeg&&t++;for(i=d.length-1;i>=0;i--)(e=d[i])._spiderLeg&&(e.clusterShow&&e.clusterShow(),e.setZIndexOffset&&e.setZIndexOffset(0),t>1&&h.removeLayer(e),u.removeLayer(e._spiderLeg),delete e._spiderLeg);l._animationEnd(),l.fire("unspiderfied",{cluster:s,markers:d})}),200)}}),L.MarkerClusterGroup.include({_spiderfied:null,unspiderfy:function(){this._unspiderfy.apply(this,arguments)},_spiderfierOnAdd:function(){this._map.on("click",this._unspiderfyWrapper,this),this._map.options.zoomAnimation&&this._map.on("zoomstart",this._unspiderfyZoomStart,this),this._map.on("zoomend",this._noanimationUnspiderfy,this),L.Browser.touch||this._map.getRenderer(this)},_spiderfierOnRemove:function(){this._map.off("click",this._unspiderfyWrapper,this),this._map.off("zoomstart",this._unspiderfyZoomStart,this),this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._map.off("zoomend",this._noanimationUnspiderfy,this),this._noanimationUnspiderfy()},_unspiderfyZoomStart:function(){this._map&&this._map.on("zoomanim",this._unspiderfyZoomAnim,this)},_unspiderfyZoomAnim:function(t){L.DomUtil.hasClass(this._map._mapPane,"leaflet-touching")||(this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy(t))},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(t){this._spiderfied&&this._spiderfied.unspiderfy(t)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(t){t._spiderLeg&&(this._featureGroup.removeLayer(t),t.clusterShow&&t.clusterShow(),t.setZIndexOffset&&t.setZIndexOffset(0),this._map.removeLayer(t._spiderLeg),delete t._spiderLeg)}}),L.MarkerClusterGroup.include({refreshClusters:function(t){return t?t instanceof L.MarkerClusterGroup?t=t._topClusterLevel.getAllChildMarkers():t instanceof L.LayerGroup?t=t._layers:t instanceof L.MarkerCluster?t=t.getAllChildMarkers():t instanceof L.Marker&&(t=[t]):t=this._topClusterLevel.getAllChildMarkers(),this._flagParentsIconsNeedUpdate(t),this._refreshClustersIcons(),this.options.singleMarkerMode&&this._refreshSingleMarkerModeMarkers(t),this},_flagParentsIconsNeedUpdate:function(t){var e,i;for(e in t)for(i=t[e].__parent;i;)i._iconNeedsUpdate=!0,i=i.__parent},_refreshSingleMarkerModeMarkers:function(t){var e,i;for(e in t)i=t[e],this.hasLayer(i)&&i.setIcon(this._overrideMarkerIcon(i))}}),L.Marker.include({refreshIconOptions:function(t,e){var i=this.options.icon;return L.setOptions(i,t),this.setIcon(i),e&&this.__parent&&this.__parent._group.refreshClusters(this),this}}),t.MarkerClusterGroup=e,t.MarkerCluster=i,Object.defineProperty(t,"__esModule",{value:!0})}(e)},531:function(t,e){ +/* @preserve + * Leaflet 1.9.3, a JS library for interactive maps. https://leafletjs.com + * (c) 2010-2022 Vladimir Agafonkin, (c) 2010-2011 CloudMade + */ +!function(t){"use strict";function e(t){for(var e,i,n=1,r=arguments.length;n=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=R(t);var e=this.min,i=this.max,n=t.min,r=(t=t.max).x>=e.x&&n.x<=i.x;return t=t.y>=e.y&&n.y<=i.y,r&&t},overlaps:function(t){t=R(t);var e=this.min,i=this.max,n=t.min,r=(t=t.max).x>e.x&&n.xe.y&&n.y=n.lat&&i.lat<=r.lat&&e.lng>=n.lng&&i.lng<=r.lng},intersects:function(t){t=B(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=(t=t.getNorthEast()).lat>=e.lat&&n.lat<=i.lat;return t=t.lng>=e.lng&&n.lng<=i.lng,r&&t},overlaps:function(t){t=B(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),r=(t=t.getNorthEast()).lat>e.lat&&n.late.lng&&n.lng","http://www.w3.org/2000/svg"===(Ct.firstChild&&Ct.firstChild.namespaceURI));function At(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var Lt={ie:J,ielt9:Q,edge:$,webkit:tt,android:et,android23:it,androidStock:nt,opera:rt,chrome:ot,gecko:at,safari:st,phantom:lt,opera12:ut,win:ht,ie3d:ct,webkit3d:dt,gecko3d:K,any3d:pt,mobile:Yi,mobileWebkit:ft,mobileWebkit3d:gt,msPointer:mt,pointer:vt,touch:_t,touchNative:yt,mobileOpera:xt,mobileGecko:bt,retina:wt,passiveEvents:St,canvas:Tt,svg:Mt,vml:!Mt&&function(){try{var t=document.createElement("div"),e=(t.innerHTML='',t.firstChild);return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}(),inlineSvg:Ct,mac:0===navigator.platform.indexOf("Mac"),linux:0===navigator.platform.indexOf("Linux")},It=Lt.msPointer?"MSPointerDown":"pointerdown",Dt=Lt.msPointer?"MSPointerMove":"pointermove",Pt=Lt.msPointer?"MSPointerUp":"pointerup",Ot=Lt.msPointer?"MSPointerCancel":"pointercancel",kt={touchstart:It,touchmove:Dt,touchend:Pt,touchcancel:Ot},Et={touchstart:function(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&Oe(e),Vt(t,e)},touchmove:Vt,touchend:Vt,touchcancel:Vt},Nt={},Rt=!1;function zt(t,e,i){return"touchstart"!==e||Rt||(document.addEventListener(It,Bt,!0),document.addEventListener(Dt,Zt,!0),document.addEventListener(Pt,Ft,!0),document.addEventListener(Ot,Ft,!0),Rt=!0),Et[e]?(i=Et[e].bind(this,i),t.addEventListener(kt[e],i,!1),i):(console.warn("wrong event specified:",e),u)}function Bt(t){Nt[t.pointerId]=t}function Zt(t){Nt[t.pointerId]&&(Nt[t.pointerId]=t)}function Ft(t){delete Nt[t.pointerId]}function Vt(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){for(var i in e.touches=[],Nt)e.touches.push(Nt[i]);e.changedTouches=[e],t(e)}}var Gt=200;function Ht(t,e){t.addEventListener("dblclick",e);var i,n=0;function r(t){var r;1!==t.detail?i=t.detail:"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||(r=Ee(t)).some((function(t){return t instanceof HTMLLabelElement&&t.attributes.for}))&&!r.some((function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement}))||((r=Date.now())-n<=Gt?2==++i&&e(function(t){var e,i,n={};for(i in t)e=t[i],n[i]=e&&e.bind?e.bind(t):e;return(t=n).type="dblclick",n.detail=2,n.isTrusted=!1,n._simulated=!0,n}(t)):i=1,n=r)}return t.addEventListener("click",r),{dblclick:e,simDblclick:r}}var Ut,Wt,jt,Xt,Yt,qt,Kt=de(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Jt=de(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Qt="webkitTransition"===Jt||"OTransition"===Jt?Jt+"End":"transitionend";function $t(t){return"string"==typeof t?document.getElementById(t):t}function te(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];return"auto"===(i=i&&"auto"!==i||!document.defaultView?i:(t=document.defaultView.getComputedStyle(t,null))?t[e]:null)?null:i}function ee(t,e,i){return(t=document.createElement(t)).className=e||"",i&&i.appendChild(t),t}function ie(t){var e=t.parentNode;e&&e.removeChild(t)}function ne(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function re(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function oe(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ae(t,e){return void 0!==t.classList?t.classList.contains(e):0<(t=he(t)).length&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(t)}function se(t,e){var i;if(void 0!==t.classList)for(var n=d(e),r=0,o=n.length;rthis.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var i=this.getCenter();return t=this._limitCenter(i,this._zoom,B(t)),i.equals(t)||this.panTo(t,e),this._enforcingBounds=!1,this},panInside:function(t,e){var i=E((e=e||{}).paddingTopLeft||e.padding||[0,0]),n=E(e.paddingBottomRight||e.padding||[0,0]),r=this.project(this.getCenter()),o=(t=this.project(t),(i=R([(o=this.getPixelBounds()).min.add(i),o.max.subtract(n)])).getSize());return i.contains(t)||(this._enforcingBounds=!0,n=t.subtract(i.getCenter()),i=i.extend(t).getSize().subtract(o),r.x+=n.x<0?-i.x:i.x,r.y+=n.y<0?-i.y:i.y,this.panTo(this.unproject(r),e),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=e({animate:!1,pan:!0},!0===t?{animate:!0}:t);var i=this.getSize(),n=(this._sizeChanged=!0,this._lastCenter=null,this.getSize()),o=i.divideBy(2).round(),a=n.divideBy(2).round();return(o=o.subtract(a)).x||o.y?(t.animate&&t.pan?this.panBy(o):(t.pan&&this._rawPanBy(o),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:i,newSize:n})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){var i,n;return t=this._locateOptions=e({timeout:1e4,watch:!1},t),"geolocation"in navigator?(i=r(this._handleGeolocationResponse,this),n=r(this._handleGeolocationError,this),t.watch?this._locationWatchId=navigator.geolocation.watchPosition(i,n,t):navigator.geolocation.getCurrentPosition(i,n,t)):this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e;this._container._leaflet_id&&(e=t.code,t=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+t+"."}))},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e,i,n=new Z(t.coords.latitude,t.coords.longitude),r=n.toBounds(2*t.coords.accuracy),o=this._locateOptions,a=(o.setView&&(e=this.getBoundsZoom(r),this.setView(n,o.maxZoom?Math.min(e,o.maxZoom):e)),{latlng:n,bounds:r,timestamp:t.timestamp});for(i in t.coords)"number"==typeof t.coords[i]&&(a[i]=t.coords[i]);this.fire("locationfound",a)}},addHandler:function(t,e){return e&&(e=this[t]=new e(this),this._handlers.push(e),this.options[t]&&e.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(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ie(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(C(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ie(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){return e=ee("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),e||this._mapPane),t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new z(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=B(t),i=E(i||[0,0]);var n=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),a=t.getNorthWest(),s=(t=t.getSouthEast(),i=this.getSize().subtract(i),t=R(this.project(t,n),this.project(a,n)).getSize(),a=Lt.any3d?this.options.zoomSnap:1,i.x/t.x);return i=i.y/t.y,t=e?Math.max(s,i):Math.min(s,i),n=this.getScaleZoom(t,n),a&&(n=Math.round(n/(a/100))*(a/100),n=e?Math.ceil(n/a)*a:Math.floor(n/a)*a),Math.max(r,Math.min(o,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new O(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){return new N(t=this._getTopLeftPoint(t,e),t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;return e=void 0===e?this._zoom:e,t=i.zoom(t*i.scale(e)),isNaN(t)?1/0:t},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(F(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(E(t),e)},layerPointToLatLng:function(t){return t=E(t).add(this.getPixelOrigin()),this.unproject(t)},latLngToLayerPoint:function(t){return this.project(F(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(F(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(B(t))},distance:function(t,e){return this.options.crs.distance(F(t),F(e))},containerPointToLayerPoint:function(t){return E(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return E(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){return t=this.containerPointToLayerPoint(E(t)),this.layerPointToLatLng(t)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(F(t)))},mouseEventToContainerPoint:function(t){return Ne(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){if(!(t=this._container=$t(t)))throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");we(t,"scroll",this._onScroll,this),this._containerId=a(t)},_initLayout:function(){var t=this._container,e=(this._fadeAnimated=this.options.fadeAnimation&&Lt.any3d,se(t,"leaflet-container"+(Lt.touch?" leaflet-touch":"")+(Lt.retina?" leaflet-retina":"")+(Lt.ielt9?" leaflet-oldie":"")+(Lt.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":"")),te(t,"position"));"absolute"!==e&&"relative"!==e&&"fixed"!==e&&"sticky"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),fe(this._mapPane,new O(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(se(t.markerPane,"leaflet-zoom-hide"),se(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,i){fe(this._mapPane,new O(0,0));var n=!this._loaded,r=(this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset"),this._zoom!==e);this._moveStart(r,i)._move(t,e)._moveEnd(r),this.fire("viewreset"),n&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,i,n){void 0===e&&(e=this._zoom);var r=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),n?i&&i.pinch&&this.fire("zoom",i):((r||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return C(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){fe(this._mapPane,this._getMapPanePos().subtract(t))},_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(t){this._targets={};var e=t?Te:we;e((this._targets[a(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),Lt.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){C(this._resizeRequest),this._resizeRequest=M((function(){this.invalidateSize({debounceMoveend:!0})}),this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var i,n=[],r="mouseout"===e||"mouseover"===e,o=t.target||t.srcElement,s=!1;o;){if((i=this._targets[a(o)])&&("click"===e||"preclick"===e)&&this._draggableMoved(i)){s=!0;break}if(i&&i.listens(e,!0)){if(r&&!Be(o,t))break;if(n.push(i),r)break}if(o===this._container)break;o=o.parentNode}return n.length||s||r||!this.listens(e,!0)?n:[this]},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e,i=t.target||t.srcElement;!this._loaded||i._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(i)||("mousedown"===(e=t.type)&&ye(i),this._fireDOMEvent(t,e))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,n){"click"===t.type&&((l=e({},t)).type="preclick",this._fireDOMEvent(l,l.type,n));var r=this._findEventTargets(t,i);if(n){for(var o=[],a=0;athis.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e);if(n=this._getCenterOffset(t)._divideBy(1-1/n),!0!==i.animate&&!this.getSize().contains(n))return!1;M((function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)}),this)}return!0},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,se(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&le(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 Ve(t){return new He(t)}var Ge,He=I.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition();return t=t._controlCorners[i],se(e,"leaflet-control"),-1!==i.indexOf("bottom")?t.insertBefore(e,t.firstChild):t.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ie(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",(e=document.createElement("div")).innerHTML=t,e.firstChild},_addItem:function(t){var e,i=document.createElement("label"),n=this._map.hasLayer(t.layer),r=((t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=n):e=this._createRadioElement("leaflet-base-layers_"+a(this),n),this._layerControlInputs.push(e),e.layerId=a(t.layer),we(e,"click",this._onInputClick,this),n=document.createElement("span")).innerHTML=" "+t.name,document.createElement("span"));return i.appendChild(r),r.appendChild(e),r.appendChild(n),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(i),this._checkDisabledLayers(),i},_onInputClick:function(){var t,e,i=this._layerControlInputs,n=[],r=[];this._handlingClick=!0;for(var o=i.length-1;0<=o;o--)t=i[o],e=this._getLayer(t.layerId).layer,t.checked?n.push(e):t.checked||r.push(e);for(o=0;oe.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;we(t,"click",Oe),this.expand(),setTimeout((function(){Te(t,"click",Oe)}))}})),We=He.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=ee("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.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(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,i,n,r){return(i=ee("a",i,n)).innerHTML=t,i.href="#",i.title=e,i.setAttribute("role","button"),i.setAttribute("aria-label",e),Pe(i),we(i,"click",ke),we(i,"click",r,this),we(i,"click",this._refocusOnMap,this),i},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";le(this._zoomInButton,e),le(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(se(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(se(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}}),je=(Fe.mergeOptions({zoomControl:!0}),Fe.addInitHook((function(){this.options.zoomControl&&(this.zoomControl=new We,this.addControl(this.zoomControl))})),He.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=ee("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=ee("div",e,i)),t.imperial&&(this._iScale=ee("div",e,i))},_update:function(){var t=(e=this._map).getSize().y/2,e=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t);this._updateScale(this._mScale,e<1e3?e+" m":e/1e3+" km",e/t)},_updateImperial:function(t){var e,i;5280<(t*=3.2808399)?(i=this._getRoundNum(e=t/5280),this._updateScale(this._iScale,i+" mi",i/e)):(i=this._getRoundNum(t),this._updateScale(this._iScale,i+" ft",i/t))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1);return e*(10<=(t/=e)?10:5<=t?5:3<=t?3:2<=t?2:1)}})),Xe=He.extend({options:{position:"bottomright",prefix:''+(Lt.inlineSvg?' ':"")+"Leaflet"},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var e in(t.attributionControl=this)._container=ee("div","leaflet-control-attribution"),Pe(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",(function(){this.removeAttribution(t.layer.getAttribution())}),this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t,e=[];for(t in this._attributions)this._attributions[t]&&e.push(t);var i=[];this.options.prefix&&i.push(this.options.prefix),e.length&&i.push(e.join(", ")),this._container.innerHTML=i.join(' ')}}}),Ye=(Fe.mergeOptions({attributionControl:!0}),Fe.addInitHook((function(){this.options.attributionControl&&(new Xe).addTo(this)})),He.Layers=Ue,He.Zoom=We,He.Scale=je,He.Attribution=Xe,Ve.layers=function(t,e,i){return new Ue(t,e,i)},Ve.zoom=function(t){return new We(t)},Ve.scale=function(t){return new je(t)},Ve.attribution=function(t){return new Xe(t)},$=I.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}}),$.addTo=function(t,e){return t.addHandler(e,this),this},tt={Events:D},Lt.touch?"touchstart mousedown":"mousedown"),qe=P.extend({options:{clickTolerance:3},initialize:function(t,e,i,n){p(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(we(this._dragStartTarget,Ye,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(qe._dragging===this&&this.finishDrag(!0),Te(this._dragStartTarget,Ye,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var e,i;this._enabled&&(this._moved=!1,ae(this._element,"leaflet-zoom-anim")||(t.touches&&1!==t.touches.length?qe._dragging===this&&this.finishDrag():qe._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((qe._dragging=this)._preventOutline&&ye(this._element),me(),jt(),this._moving||(this.fire("down"),i=t.touches?t.touches[0]:t,e=xe(this._element),this._startPoint=new O(i.clientX,i.clientY),this._startPos=ge(this._element),this._parentScale=be(e),i="mousedown"===t.type,we(document,i?"mousemove":"touchmove",this._onMove,this),we(document,i?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(t){var e;this._enabled&&(t.touches&&1e&&(i.push(t[n]),r=n);return re.max.x&&(i|=2),t.ye.max.y&&(i|=8),i}function ei(t,e,i,n){var r=e.x,o=(e=e.y,i.x-r),a=i.y-e,s=o*o+a*a;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(u=!u);return u||vi.prototype._containsPoint.call(this,t,!0)}}),_i=ui.extend({initialize:function(t,e){p(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,r=v(t)?t:t.features;if(r){for(e=0,i=r.length;eo.x&&(a=i.x+s-o.x+r.x),i.x-a-n.x<(s=0)&&(a=i.x-n.x),i.y+e+r.y>o.y&&(s=i.y+e-o.y+r.y),i.y-s-n.y<0&&(s=i.y-n.y),(a||s)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([a,s]))))},_getAnchor:function(){return E(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}})),Ei=(Fe.mergeOptions({closePopupOnClick:!0}),Fe.include({openPopup:function(t,e,i){return this._initOverlay(ki,t,e,i).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),ut.include({bindPopup:function(t,e){return this._popup=this._initOverlay(ki,this._popup,t,e),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(t){return this._popup&&(this instanceof ui||(this._popup._source=this),this._popup._prepareOpen(t||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()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e;this._popup&&this._map&&(ke(t),e=t.layer||t.target,this._popup._source!==e||e instanceof fi?(this._popup._source=e,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}}),Oi.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Oi.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Oi.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Oi.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ee("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+a(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,i=this._map,n=this._container,r=i.latLngToContainerPoint(i.getCenter()),o=(i=i.layerPointToContainerPoint(t),this.options.direction),a=n.offsetWidth,s=n.offsetHeight,l=E(this.options.offset),u=this._getAnchor();i="top"===o?(e=a/2,s):"bottom"===o?(e=a/2,0):(e="center"===o?a/2:"right"===o?0:"left"===o?a:i.xthis.options.maxZoom||nthis.options.maxZoom||void 0!==this.options.minZoom&&ri.max.x)||!e.wrapLat&&(t.yi.max.y))return!1}return!this.options.bounds||(e=this._tileCoordsToBounds(t),B(this.options.bounds).overlaps(e))},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i);return i=n.add(i),[e.unproject(n,t.z),e.unproject(i,t.z)]},_tileCoordsToBounds:function(t){return t=new z((t=this._tileCoordsToNwSe(t))[0],t[1]),this.options.noWrap?t:this._map.wrapLatLngBounds(t)},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=new O(+(t=t.split(":"))[0],+t[1]);return e.z=+t[2],e},_removeTile:function(t){var e=this._tiles[t];e&&(ie(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){se(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=u,t.onmousemove=u,Lt.ielt9&&this.options.opacity<1&&ce(t,this.options.opacity)},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(r(this._tileReady,this,t,null,o)),fe(o,i),this._tiles[n]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);(i=this._tiles[n])&&(i.loaded=+new Date,this._map._fadeAnimated?(ce(i.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(se(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Lt.ielt9||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new O(this._wrapX?l(t.x,this._wrapX):t.x,this._wrapY?l(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new N(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),zi=Ri.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,(e=p(this,e)).detectRetina&&Lt.retina&&0')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),Ui=(dt={_initContainer:function(){this._container=ee("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Fi.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=Hi("shape");se(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=Hi("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ie(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,r=t._container;r.stroked=!!n.stroke,r.filled=!!n.fill,n.stroke?(e=e||(t._stroke=Hi("stroke")),r.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=v(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(r.removeChild(e),t._stroke=null),n.fill?(i=i||(t._fill=Hi("fill")),r.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(r.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){re(t._container)},_bringToBack:function(t){oe(t._container)}},Lt.vml?Hi:Y),Wi=Fi.extend({_initContainer:function(){this._container=Ui("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Ui("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ie(this._container),Te(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){var t,e,i;this._map._animatingZoom&&this._bounds||(Fi.prototype._update.call(this),e=(t=this._bounds).getSize(),i=this._container,this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),fe(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update"))},_initPath:function(t){var e=t._path=Ui("path");t.options.className&&se(e,t.options.className),t.options.interactive&&se(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ie(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path;t=t.options,e&&(t.stroke?(e.setAttribute("stroke",t.color),e.setAttribute("stroke-opacity",t.opacity),e.setAttribute("stroke-width",t.weight),e.setAttribute("stroke-linecap",t.lineCap),e.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?e.setAttribute("stroke-dasharray",t.dashArray):e.removeAttribute("stroke-dasharray"),t.dashOffset?e.setAttribute("stroke-dashoffset",t.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),t.fill?(e.setAttribute("fill",t.fillColor||t.color),e.setAttribute("fill-opacity",t.fillOpacity),e.setAttribute("fill-rule",t.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,q(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n="a"+i+","+(Math.max(Math.round(t._radiusY),1)||i)+" 0 1,0 ";e=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+n+2*i+",0 "+n+2*-i+",0 ",this._setPath(t,e)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){re(t._path)},_bringToBack:function(t){oe(t._path)}});function ji(t){return Lt.svg||Lt.vml?new Wi(t):null}Lt.vml&&Wi.include(dt),Fe.include({getRenderer:function(t){return t=(t=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer()),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(t){var e;return"overlayPane"!==t&&void 0!==t&&(void 0===(e=this._paneRenderers[t])&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e)},_createRenderer:function(t){return this.options.preferCanvas&&Gi(t)||ji(t)}});var Xi=yi.extend({initialize:function(t,e){yi.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=B(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Wi.create=Ui,Wi.pointsToPath=q,_i.geometryToLayer=xi,_i.coordsToLatLng=wi,_i.coordsToLatLngs=Si,_i.latLngToCoords=Ti,_i.latLngsToCoords=Mi,_i.getFeature=Ci,_i.asFeature=Ai,Fe.mergeOptions({boxZoom:!0}),K=$.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){we(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Te(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ie(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),jt(),me(),this._startPoint=this._map.mouseEventToContainerPoint(t),we(document,{contextmenu:ke,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=ee("div","leaflet-zoom-box",this._container),se(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=(t=new N(this._point,this._startPoint)).getSize();fe(this._box,t.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ie(this._box),le(this._container,"leaflet-crosshair")),Xt(),ve(),Te(document,{contextmenu:ke,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0),t=new z(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})))},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}}),Fe.addInitHook("addHandler","boxZoom",K),Fe.mergeOptions({doubleClickZoom:!0}),pt=$.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom(),n=e.options.zoomDelta;i=t.originalEvent.shiftKey?i-n:i+n,"center"===e.options.doubleClickZoom?e.setZoom(i):e.setZoomAround(t.containerPoint,i)}});var Yi=(Fe.addInitHook("addHandler","doubleClickZoom",pt),Fe.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0}),$.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new qe(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),se(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){le(this._map._container,"leaflet-grab"),le(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 t,e=this._map;e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=B(this._map.options.maxBounds),this._offsetLimit=R(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var e,i;this._map.options.inertia&&(e=this._lastTime=+new Date,i=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(i),this._times.push(e),this._prunePositions(e)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=((r=this._draggable._newPos.x)-e+i)%t+e-i,r=(r+e+i)%t-e-i;t=Math.abs(n+i)e.getMaxZoom()&&1{"use strict";var e=[];function i(t){for(var i=-1,n=0;n{"use strict";var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},9216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},3565:(t,e,i)=>{"use strict";t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},7795:t=>{"use strict";t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var r=void 0!==i.layer;r&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,r&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var o=i.sourceMap;o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},4589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},2528:(t,e,i)=>{"use strict";i.d(e,{ZP:()=>o});var n=function(t){this.value=t},r=function(){function t(){this._len=0}return t.prototype.insert=function(t){var e=new n(t);return this.insertEntry(e),e},t.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++},t.prototype.remove=function(t){var e=t.prev,i=t.next;e?e.next=i:this.head=i,i?i.prev=e:this.tail=e,t.next=t.prev=null,this._len--},t.prototype.len=function(){return this._len},t.prototype.clear=function(){this.head=this.tail=null,this._len=0},t}();const o=function(){function t(t){this._list=new r,this._maxSize=10,this._map={},this._maxSize=t}return t.prototype.put=function(t,e){var i=this._list,r=this._map,o=null;if(null==r[t]){var a=i.len(),s=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var l=i.head;i.remove(l),delete r[l.key],o=l.value,this._lastRemovedEntry=l}s?s.value=e:s=new n(e),s.key=t,i.insertEntry(s),r[t]=s}return o},t.prototype.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},t.prototype.clear=function(){this._list.clear(),this._map={}},t.prototype.len=function(){return this._list.len()},t}()},6387:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>o});var n=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},r=new function(){this.browser=new n,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(r.wxa=!0,r.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?r.worker=!0:"undefined"==typeof navigator?(r.node=!0,r.svgSupported=!0):function(t,e){var i=e.browser,n=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);n&&(i.firefox=!0,i.version=n[1]);r&&(i.ie=!0,i.version=r[1]);o&&(i.edge=!0,i.version=o[1],i.newEdge=+o[1].split(".")[0]>18);a&&(i.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!i.ie&&!i.edge,e.pointerEventsSupported="onpointerdown"in window&&(i.edge||i.ie&&+i.version>=11),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(i.ie&&"transition"in s||i.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||i.ie&&+i.version>=9}(navigator.userAgent,r);const o=r},3132:(t,e,i)=>{"use strict";i.d(e,{Uo:()=>o,n5:()=>n,qW:()=>u,rk:()=>r});var n=12,r="sans-serif",o=n+"px "+r;var a,s,l=function(t){var e={};if("undefined"==typeof JSON)return e;for(var i=0;i=0)c=h*t.length;else for(var d=0;d{"use strict";i.r(e),i.d(e,{HashMap:()=>st,RADIAN_TO_DEGREE:()=>ft,assert:()=>tt,bind:()=>E,clone:()=>y,concatArray:()=>ut,createCanvas:()=>S,createHashMap:()=>lt,createObject:()=>ht,curry:()=>N,defaults:()=>w,disableUserSelect:()=>ct,each:()=>L,eqNaN:()=>Y,extend:()=>b,filter:()=>P,find:()=>O,guid:()=>m,hasOwn:()=>dt,indexOf:()=>T,inherits:()=>M,isArray:()=>R,isArrayLike:()=>A,isBuiltInObject:()=>G,isDom:()=>U,isFunction:()=>z,isGradientObject:()=>W,isImagePatternObject:()=>j,isNumber:()=>F,isObject:()=>V,isPrimitive:()=>rt,isRegExp:()=>X,isString:()=>B,isStringSafe:()=>Z,isTypedArray:()=>H,keys:()=>k,logError:()=>v,map:()=>I,merge:()=>_,mergeAll:()=>x,mixin:()=>C,noop:()=>pt,normalizeCssArray:()=>$,reduce:()=>D,retrieve:()=>q,retrieve2:()=>K,retrieve3:()=>J,setAsPrimitive:()=>nt,slice:()=>Q,trim:()=>et});var n=i(3132),r=D(["Function","RegExp","Date","Error","CanvasGradient","CanvasPattern","Image","Canvas"],(function(t,e){return t["[object "+e+"]"]=!0,t}),{}),o=D(["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],(function(t,e){return t["[object "+e+"Array]"]=!0,t}),{}),a=Object.prototype.toString,s=Array.prototype,l=s.forEach,u=s.filter,h=s.slice,c=s.map,d=function(){}.constructor,p=d?d.prototype:null,f="__proto__",g=2311;function m(){return g++}function v(){for(var t=[],e=0;e{"use strict";i.r(e),i.d(e,{fastLerp:()=>x,fastMapToColor:()=>b,lerp:()=>w,lift:()=>y,lum:()=>A,mapToColor:()=>S,modifyAlpha:()=>M,modifyHSL:()=>T,parse:()=>m,random:()=>L,stringify:()=>C,toHex:()=>_});var n=i(2528),r={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 o(t){return(t=Math.round(t))<0?0:t>255?255:t}function a(t){return t<0?0:t>1?1:t}function s(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?o(parseFloat(e)/100*255):o(parseInt(e,10))}function l(t){var e=t;return e.length&&"%"===e.charAt(e.length-1)?a(parseFloat(e)/100):a(parseFloat(e))}function u(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function h(t,e,i){return t+(e-t)*i}function c(t,e,i,n,r){return t[0]=e,t[1]=i,t[2]=n,t[3]=r,t}function d(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}var p=new n.ZP(20),f=null;function g(t,e){f&&d(f,e),f=p.put(t,f||e.slice())}function m(t,e){if(t){e=e||[];var i=p.get(t);if(i)return d(e,i);var n=(t+="").replace(/ /g,"").toLowerCase();if(n in r)return d(e,r[n]),g(t,e),e;var o,a=n.length;if("#"===n.charAt(0))return 4===a||5===a?(o=parseInt(n.slice(1,4),16))>=0&&o<=4095?(c(e,(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,5===a?parseInt(n.slice(4),16)/15:1),g(t,e),e):void c(e,0,0,0,1):7===a||9===a?(o=parseInt(n.slice(1,7),16))>=0&&o<=16777215?(c(e,(16711680&o)>>16,(65280&o)>>8,255&o,9===a?parseInt(n.slice(7),16)/255:1),g(t,e),e):void c(e,0,0,0,1):void 0;var u=n.indexOf("("),h=n.indexOf(")");if(-1!==u&&h+1===a){var f=n.substr(0,u),m=n.substr(u+1,h-(u+1)).split(","),y=1;switch(f){case"rgba":if(4!==m.length)return 3===m.length?c(e,+m[0],+m[1],+m[2],1):c(e,0,0,0,1);y=l(m.pop());case"rgb":return m.length>=3?(c(e,s(m[0]),s(m[1]),s(m[2]),3===m.length?y:l(m[3])),g(t,e),e):void c(e,0,0,0,1);case"hsla":return 4!==m.length?void c(e,0,0,0,1):(m[3]=l(m[3]),v(m,e),g(t,e),e);case"hsl":return 3!==m.length?void c(e,0,0,0,1):(v(m,e),g(t,e),e);default:return}}c(e,0,0,0,1)}}function v(t,e){var i=(parseFloat(t[0])%360+360)%360/360,n=l(t[1]),r=l(t[2]),a=r<=.5?r*(n+1):r+n-r*n,s=2*r-a;return c(e=e||[],o(255*u(s,a,i+1/3)),o(255*u(s,a,i)),o(255*u(s,a,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}function y(t,e){var i=m(t);if(i){for(var n=0;n<3;n++)i[n]=e<0?i[n]*(1-e)|0:(255-i[n])*e+i[n]|0,i[n]>255?i[n]=255:i[n]<0&&(i[n]=0);return C(i,4===i.length?"rgba":"rgb")}}function _(t){var e=m(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function x(t,e,i){if(e&&e.length&&t>=0&&t<=1){i=i||[];var n=t*(e.length-1),r=Math.floor(n),s=Math.ceil(n),l=e[r],u=e[s],c=n-r;return i[0]=o(h(l[0],u[0],c)),i[1]=o(h(l[1],u[1],c)),i[2]=o(h(l[2],u[2],c)),i[3]=a(h(l[3],u[3],c)),i}}var b=x;function w(t,e,i){if(e&&e.length&&t>=0&&t<=1){var n=t*(e.length-1),r=Math.floor(n),s=Math.ceil(n),l=m(e[r]),u=m(e[s]),c=n-r,d=C([o(h(l[0],u[0],c)),o(h(l[1],u[1],c)),o(h(l[2],u[2],c)),a(h(l[3],u[3],c))],"rgba");return i?{color:d,leftIndex:r,rightIndex:s,value:n}:d}}var S=w;function T(t,e,i,n){var r,o=m(t);if(t)return o=function(t){if(t){var e,i,n=t[0]/255,r=t[1]/255,o=t[2]/255,a=Math.min(n,r,o),s=Math.max(n,r,o),l=s-a,u=(s+a)/2;if(0===l)e=0,i=0;else{i=u<.5?l/(s+a):l/(2-s-a);var h=((s-n)/6+l/2)/l,c=((s-r)/6+l/2)/l,d=((s-o)/6+l/2)/l;n===s?e=d-c:r===s?e=1/3+h-d:o===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var p=[360*e,i,u];return null!=t[3]&&p.push(t[3]),p}}(o),null!=e&&(o[0]=(r=e,(r=Math.round(r))<0?0:r>360?360:r)),null!=i&&(o[1]=l(i)),null!=n&&(o[2]=l(n)),C(v(o),"rgba")}function M(t,e){var i=m(t);if(i&&null!=e)return i[3]=a(e),C(i,"rgba")}function C(t,e){if(t&&t.length){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}}function A(t,e){var i=m(t);return i?(.299*i[0]+.587*i[1]+.114*i[2])*i[3]/255+(1-i[3])*e:0}function L(){return C([Math.round(255*Math.random()),Math.round(255*Math.random()),Math.round(255*Math.random())],"rgb")}}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={id:n,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nc=void 0,(()=>{"use strict";var t={};i.r(t),i.d(t,{Axis:()=>f.RD,ChartView:()=>f.TA,ComponentModel:()=>f.tF,ComponentView:()=>f.Ir,List:()=>f.aV,Model:()=>f.Hn,PRIORITY:()=>f.Hr,SeriesModel:()=>f.wJ,color:()=>f.$_,connect:()=>f.$j,dataTool:()=>f.Ok,default:()=>x,dependencies:()=>f.HO,disConnect:()=>f.eU,disconnect:()=>f.zP,dispose:()=>f.B9,env:()=>f.OB,extendChartView:()=>f.Zy,extendComponentModel:()=>f.tv,extendComponentView:()=>f.Sp,extendSeriesModel:()=>f.Zr,format:()=>f.WU,getCoordinateSystemDimensions:()=>f.wL,getInstanceByDom:()=>f.JE,getInstanceById:()=>f.rp,getMap:()=>f.FU,graphic:()=>f.Q,helper:()=>f._y,init:()=>f.S1,innerDrawElementOnCanvas:()=>f.z$,matrix:()=>f.pI,number:()=>f.Rx,parseGeoJSON:()=>f.Nu,parseGeoJson:()=>f.pQ,registerAction:()=>f.zl,registerCoordinateSystem:()=>f.RS,registerLayout:()=>f.qR,registerLoading:()=>f.yn,registerLocale:()=>f.I2,registerMap:()=>f.je,registerPostInit:()=>f.sq,registerPostUpdate:()=>f.Br,registerPreprocessor:()=>f.ds,registerProcessor:()=>f.Pu,registerTheme:()=>f.aW,registerTransform:()=>f.rV,registerUpdateLifecycle:()=>f.YK,registerVisual:()=>f.Og,setCanvasCreator:()=>f.jQ,setPlatformAPI:()=>f.g2,throttle:()=>f.P2,time:()=>f.XV,use:()=>f.D$,util:()=>f.D5,vector:()=>f.xr,version:()=>f.i8,zrUtil:()=>f.gf,zrender:()=>f.x_});const e={...{metadata:!0,svgRender:!1,switchMode:!1,maxPointsFetched:1e4,loadMoreAtZoomLevel:9,clustering:!1,clusteringThreshold:100,disableClusteringAtLevel:8,clusterRadius:80,showMetaOnNarrowScreens:!1,showLabelsAtZoomLevel:7,echartsOption:{aria:{show:!0,description:"This is a force-oriented graph chart that depicts the relationship between ip nodes."},toolbox:{show:!0,iconStyle:{borderColor:"#fff"},feature:{restore:{show:!0,title:"Restore view"},saveAsImage:{show:!0,title:"Save image"}}}},graphConfig:{series:{layout:"force",label:{show:!0,color:"#fff",position:"top"},labelLayout:{hideOverlap:!0},force:{gravity:.1,edgeLength:[20,60],repulsion:120},roam:!0,draggable:!0,legendHoverLink:!0,emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}},nodeStyle:{color:"#ffebc4"},linkStyle:{width:6,color:"#1ba619"},nodeSize:"15"},baseOptions:{backgroundColor:"#282222",media:[{query:{minWidth:320,maxWidth:500},option:{series:[{zoom:.7}],toolbox:{itemSize:18}}},{query:{minWidth:501},option:{series:[{zoom:1}],toolbox:{itemSize:15}}},{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapOptions:{roam:!0,zoomAnimation:!1,nodeConfig:{type:"scatter",label:{show:!0,color:"#000000",position:"top",formatter:"{b}"},nodeStyle:{color:"#1566a9"},nodeSize:"17"},linkConfig:{linkStyle:{width:5,color:"#1ba619"},emphasis:{focus:"none",lineStyle:{color:"#3acc38",opacity:1}}},clusterConfig:{symbolSize:30,itemStyle:{color:"#1566a9"},tooltip:{show:!1},label:{show:!0,position:"inside",color:"#fff",offset:[0,0]}},baseOptions:{toolbox:{show:!1},media:[{query:{minWidth:320,maxWidth:850},option:{tooltip:{show:!1}}},{query:{minWidth:851},option:{tooltip:{show:!0}}}]}},mapTileConfig:[{urlTemplate:"MISSING_ENV_VAR".MAPBOX_URL_TEMPLATE||"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",options:{minZoom:3,maxZoom:32,attribution:'© OpenStreetMap contributors,\n tiles offered by Mapbox'}}],geoOptions:{style:{fillColor:"#1566a9",weight:0,fillOpacity:.8,radius:8}},nodeCategories:[],linkCategories:[],prepareData(t){},onClickElement(t,e){let i;"netjson"===this.type?(i="node"===t?this.utils.nodeInfo(e):this.utils.linkInfo(e),(this.config.showMetaOnNarrowScreens||this.el.clientWidth>850)&&(this.gui.metaInfoContainer.style.display="flex")):i=e,this.gui.getNodeLinkInfo(t,i),this.gui.sideBar.classList.remove("hidden")},onReady(){}}};function n(t,e,i,o,a,s){if(a-o<=i)return;const l=o+a>>1;r(t,e,l,o,a,s%2),n(t,e,i,o,l-1,s+1),n(t,e,i,l+1,a,s+1)}function r(t,e,i,n,a,s){for(;a>n;){if(a-n>600){const o=a-n+1,l=i-n+1,u=Math.log(o),h=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*h*(o-h)/o)*(l-o/2<0?-1:1);r(t,e,i,Math.max(n,Math.floor(i-l*h/o+c)),Math.min(a,Math.floor(i+(o-l)*h/o+c)),s)}const l=e[2*i+s];let u=n,h=a;for(o(t,e,n,i),e[2*a+s]>l&&o(t,e,n,a);ul;)h--}e[2*n+s]===l?o(t,e,n,h):(h++,o(t,e,h,a)),h<=i&&(n=h+1),i<=h&&(a=h-1)}}function o(t,e,i,n){a(t,i,n),a(e,2*i,2*n),a(e,2*i+1,2*n+1)}function a(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function s(t,e,i,n){const r=t-i,o=e-n;return r*r+o*o}const l=t=>t[0],u=t=>t[1];class h{constructor(t,e=l,i=u,r=64,o=Float64Array){this.nodeSize=r,this.points=t;const a=t.length<65536?Uint16Array:Uint32Array,s=this.ids=new a(t.length),h=this.coords=new o(2*t.length);for(let n=0;n=i&&u<=r&&h>=n&&h<=o&&l.push(t[a]);continue}const f=Math.floor((p+d)/2);u=e[2*f],h=e[2*f+1],u>=i&&u<=r&&h>=n&&h<=o&&l.push(t[f]);const g=(c+1)%2;(0===c?i<=u:n<=h)&&(s.push(p),s.push(f-1),s.push(g)),(0===c?r>=u:o>=h)&&(s.push(f+1),s.push(d),s.push(g))}return l}(this.ids,this.coords,t,e,i,n,this.nodeSize)}within(t,e,i){return function(t,e,i,n,r,o){const a=[0,t.length-1,0],l=[],u=r*r;for(;a.length;){const h=a.pop(),c=a.pop(),d=a.pop();if(c-d<=o){for(let r=d;r<=c;r++)s(e[2*r],e[2*r+1],i,n)<=u&&l.push(t[r]);continue}const p=Math.floor((d+c)/2),f=e[2*p],g=e[2*p+1];s(f,g,i,n)<=u&&l.push(t[p]);const m=(h+1)%2;(0===h?i-r<=f:n-r<=g)&&(a.push(d),a.push(p-1),a.push(m)),(0===h?i+r>=f:n+r>=g)&&(a.push(p+1),a.push(c),a.push(m))}return l}(this.ids,this.coords,t,e,i,this.nodeSize)}}const c=class{JSONParamParse(t){return"string"==typeof t?fetch(t,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"}}).then((t=>t)).catch((t=>{console.error(t)})):Promise.resolve(t)}async paginatedDataParse(t){let e,i;try{let n=await this.utils.JSONParamParse(t);if(n.json)for(e=await n.json(),i=e.results?e.results:e;e.next&&i.nodes.length<=this.config.maxPointsFetched;)n=await this.utils.JSONParamParse(e.next),e=await n.json(),i.nodes=i.nodes.concat(e.results.nodes),i.links=i.links.concat(e.results.links),e.next?this.hasMoreData=!0:this.hasMoreData=!1;else i=n}catch(t){console.error(t)}return i}async getBBoxData(t,e){let i;try{const n=`${t=t[0].split("?")[0]}bbox?swLat=${e._southWest.lat}&swLng=${e._southWest.lng}&neLat=${e._northEast.lat}&neLng=${e._northEast.lng}`,r=await this.utils.JSONParamParse(n);i=await r.json()}catch(t){console.error(t)}return i}dateParse({dateString:t,parseRegular:e=/^([1-9]\d{3})-(\d{1,2})-(\d{1,2})T(\d{1,2}):(\d{1,2}):(\d{1,2})(?:\.(\d{1,3}))?Z$/,hourDiffer:i=(new Date).getTimezoneOffset()/60}){const n=e.exec(t);if(!n||n.length<7)return console.error("Date doesn't meet the specifications."),"";const r=["dateYear","dateMonth","dateDay","dateHour"],o={},a=n[1]%4==0&&n[1]%100!=0||n[1]%400==0,s=new Map([["dateMonth",12],["dateDay",[31,a?29:28,31,30,31,30,31,31,30,31,30,31]],["dateHour",24]]);for(let t=r.length;t>0;t-=1)o[r[t-1]]=parseInt(n[t],10);let l,u=-i;for(let t=r.length;t>0;t-=1){if("dateYear"===r[t-1]){o[r[t-1]]+=u;break}l="dateDay"===r[t-1]?s.get("dateDay")[o.dateMonth-1]:s.get(r[t-1]);let e=o[r[t-1]]+u;u="dateHour"===r[t-1]?e<0?-1:e>=l?1:0:e<=0?-1:e>l?1:0,1===u?e-=l:u<0&&("dateDay"===r[t-1]&&(l=s.get("dateDay")[(o[r[t-1]]+10)%11]),e+=l),o[r[t-1]]=e}return`${o.dateYear}.${this.numberMinDigit(o.dateMonth)}.${this.numberMinDigit(o.dateDay)} ${this.numberMinDigit(o.dateHour)}:${this.numberMinDigit(n[5])}:${this.numberMinDigit(n[6])}${n[7]?`.${this.numberMinDigit(n[7],3)}`:""}`}numberMinDigit(t,e=2,i="0"){return(Array(e).join(i)+t).slice(-e)}isObject(t){return"Object"===Object.prototype.toString.call(t).slice(8,14)}isArray(t){return"Array"===Object.prototype.toString.call(t).slice(8,13)}isElement(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName}isNetJSON(t){return!(!t.nodes||!t.links)&&(this.isObject(t)&&this.isArray(t.nodes)&&this.isArray(t.links))}isGeoJSON(t){return t.type&&"FeatureCollection"===t.type?this.isObject(t)&&this.isArray(t.features):!(!t.type||"Feature"!==t.type)&&(this.isObject(t)&&this.isArray(t.geometry))}deepMergeObj(...t){const e=[...t].reverse(),i=e.length;for(let t=0;t{n[t]&&this.isObject(n[t])&&this.isObject(i[t])?this.deepMergeObj(n[t],i[t]):n[t]=i[t]})):n||(e[t+1]=i)}return e[i-1]}makeCluster(t){const{nodes:e,links:i}=t.data,n=[],r=[],o=[],a=new Map;let s=0;e.forEach((e=>{e.y=t.leaflet.latLngToContainerPoint([e.location.lat,e.location.lng]).y,e.x=t.leaflet.latLngToContainerPoint([e.location.lat,e.location.lng]).x,e.visited=!1,e.cluster=null}));const l=new h(e,(t=>t.x),(t=>t.y));return e.forEach((i=>{let r,u=[0,0];const h=t=>{t.visited=!0,t.cluster=s,a.set(t.id,t.cluster),u[0]+=t.location.lng,u[1]+=t.location.lat};if(!i.visited){const c=l.within(i.x,i.y,t.config.clusterRadius).map((t=>e[t])).filter((e=>t.config.clusteringAttribute?e.properties[t.config.clusteringAttribute]===i.properties[t.config.clusteringAttribute]&&null===e.cluster&&(h(e),!0):null===e.cluster&&(h(e),!0)));if(c.length>1){if(u=[u[0]/c.length,u[1]/c.length],r={id:s,cluster:!0,name:c.length,value:u,childNodes:c,...t.config.mapOptions.clusterConfig},t.config.clusteringAttribute){const{color:e}=t.config.nodeCategories.find((e=>e.name===i.properties[t.config.clusteringAttribute])).nodeStyle;r.itemStyle={...r.itemStyle,color:e}}o.push(r)}else 1===c.length&&(a.set(c[0].id,null),n.push(c[0]));s+=1}})),i.forEach((t=>{null===a.get(t.source)&&null===a.get(t.target)&&r.push(t)})),{clusters:o,nonClusterNodes:n,nonClusterLinks:r}}updateMetadata(){if(this.config.metadata){const t=this.utils.getMetadata(this.data),e=document.querySelector(".njg-metaData"),i=document.querySelectorAll(".njg-metaDataItems");for(let t=0;t{const n=document.createElement("div");n.classList.add("njg-metaDataItems");const r=document.createElement("span");r.setAttribute("class","njg-keyLabel");const o=document.createElement("span");o.setAttribute("class","njg-valueLabel"),r.innerHTML=i,o.innerHTML=t[i],n.appendChild(r),n.appendChild(o),e.appendChild(n)}))}}getMetadata(t){const e=t,i={};return e.label&&(i.label=e.label),["protocol","version","revision","metric","router_id","topology_id"].forEach((t=>{e[t]&&(i[t]=e[t])})),i.nodes=e.nodes.length,i.links=e.links.length,i}nodeInfo(t){const e={};return e.id=t.id,t.label&&"string"==typeof t.label&&(e.label=t.label),t.name&&(e.name=t.name),t.location&&(e.location=t.location),t.properties&&Object.keys(t.properties).forEach((i=>{if("location"===i)e[i]={lat:t.properties.location.lat,lng:t.properties.location.lng};else if("time"===i){const n=this.dateParse({dateString:t.properties[i]});e[i]=n}else e[i.replace(/_/g," ")]=t.properties[i]})),t.linkCount&&(e.links=t.linkCount),t.local_addresses&&(e.localAddresses=t.local_addresses),e}createTooltipItem(t,e){const i=document.createElement("div");i.classList.add("njg-tooltip-item");const n=document.createElement("span");n.setAttribute("class","njg-tooltip-key");const r=document.createElement("span");return r.setAttribute("class","njg-tooltip-value"),n.innerHTML=t,r.innerHTML=e,i.appendChild(n),i.appendChild(r),i}getNodeTooltipInfo(t){const e=document.createElement("div");return e.classList.add("njg-tooltip-inner"),t.id&&e.appendChild(this.createTooltipItem("id",t.id)),t.label&&"string"==typeof t.label&&e.appendChild(this.createTooltipItem("label",t.label)),t.properties&&Object.keys(t.properties).forEach((i=>{if("location"===i)e.appendChild(this.createTooltipItem("location",`${Math.round(1e3*t.properties.location.lat)/1e3}, ${Math.round(1e3*t.properties.location.lng)/1e3}`));else if("time"===i){const n=this.dateParse({dateString:t.properties[i]});e.appendChild(this.createTooltipItem("time",n))}else e.appendChild(this.createTooltipItem(`${i.replace(/_/g," ")}`,t.properties[i]))})),t.linkCount&&e.appendChild(this.createTooltipItem("Links",t.linkCount)),t.local_addresses&&e.appendChild(this.createTooltipItem("Local Addresses",t.local_addresses.join("
    "))),e}getLinkTooltipInfo(t){const e=document.createElement("div");return e.classList.add("njg-tooltip-inner"),e.appendChild(this.createTooltipItem("source",t.source)),e.appendChild(this.createTooltipItem("target",t.target)),e.appendChild(this.createTooltipItem("cost",t.cost)),t.properties&&Object.keys(t.properties).forEach((i=>{if("time"===i){const n=this.dateParse({dateString:t.properties[i]});e.appendChild(this.createTooltipItem("time",n))}else e.appendChild(this.createTooltipItem(`${i.replace(/_/g," ")}`,t.properties[i]))})),e}linkInfo(t){const e={};return e.source=t.source,e.target=t.target,e.cost=t.cost,t.properties&&Object.keys(t.properties).forEach((i=>{if("time"===i){const n=this.dateParse({dateString:t.properties[i]});e[i]=n}else e[i.replace(/_/g," ")]=t.properties[i]})),e}generateStyle(t,e){return"function"==typeof t?t(e):t}getNodeStyle(t,e,i){let n,r={},o={};if(t.category&&e.nodeCategories.length){const i=e.nodeCategories.find((e=>e.name===t.category));n=this.generateStyle(i.nodeStyle||{},t),r=this.generateStyle(i.nodeSize||{},t),o={...o,nodeStyle:i.emphasis?this.generateStyle(i.emphasis.nodeStyle||{},t):{}},o={...o,nodeSize:i.empahsis?this.generateStyle(i.emphasis.nodeSize||{},t):{}}}else"map"===i?(n=this.generateStyle(e.mapOptions.nodeConfig.nodeStyle,t),r=this.generateStyle(e.mapOptions.nodeConfig.nodeSize,t)):(n=this.generateStyle(e.graphConfig.series.nodeStyle,t),r=this.generateStyle(e.graphConfig.series.nodeSize,t));return{nodeStyleConfig:n,nodeSizeConfig:r,nodeEmphasisConfig:o}}getLinkStyle(t,e,i){let n,r={};if(t.category&&e.linkCategories.length){const i=e.linkCategories.find((e=>e.name===t.category));n=this.generateStyle(i.linkStyle||{},t),r={...r,linkStyle:i.emphasis?this.generateStyle(i.emphasis.linkStyle||{},t):{}}}else n="map"===i?this.generateStyle(e.mapOptions.linkConfig.linkStyle,t):this.generateStyle(e.graphConfig.series.linkStyle,t);return{linkStyleConfig:n,linkEmphasisConfig:r}}showLoading(){let t=document.getElementById("loadingContainer");return t?t.style.visibility="visible":(t=document.createElement("div"),t.setAttribute("id","loadingContainer"),t.innerHTML='\n
    \n
    \n

    Loading...

    \n
    \n ',this.el.appendChild(t)),t}hideLoading(){const t=document.getElementById("loadingContainer");return t&&(t.style.visibility="hidden"),t}createEvent(){const t=new Map,e=new Map;return{on(e,...i){t.set(e,[...t.get(e)||[],...i])},once(t,...i){e.set(t,[...e.get(t)||[],...i])},emit(i){const n=t.get(i)||[],r=e.get(i)||[],o=n.map((t=>t())),a=r.map((t=>t()));return e.delete(i),[...o,...a]},delete(i){t.delete(i),e.delete(i)}}}};const d=class extends c{searchElements(t){const e=this,i={"":{data:{...e.data},param:[...e.JSONParam]}};return window.history.pushState({searchValue:""},""),window.onpopstate=n=>{i[n.state.searchValue]?e.utils.JSONDataUpdate.call(e,i[n.state.searchValue].data).then((()=>{e.JSONParam=i[n.state.searchValue].param})):e.utils.JSONDataUpdate.call(e,t+n.state.searchValue)},function(n,r=!0,o=!0){const a=n.trim();if(!window.history.state||window.history.state&&window.history.state.searchValue!==a)return window.history.pushState({searchValue:a},""),e.utils.JSONDataUpdate.call(e,t+a,r,o).then((()=>{i[a]={data:{...e.data},param:[...e.JSONParam]}}))}}JSONDataUpdate(t,e=!0,i=!0){const n=this;return n.config.onUpdate.call(n),n.utils.paginatedDataParse.call(n,t).then((r=>{function o(){e?(n.JSONParam=[t],n.utils.overrideData(r,n)):(n.JSONParam.push(t),n.config.render===n.utils.mapRender?n.utils.appendData(r,n):n.utils.addData(r,n)),"netjson"===n.type&&n.utils.updateMetadata.call(n)}return i?("netjson"===n.type&&n.config.prepareData.call(n,r),n.config.dealDataByWorker?n.utils.dealDataByWorker.call(n,r,n.config.dealDataByWorker,o):o()):o(),r})).catch((t=>{console.error(t)}))}dealDataByWorker(t,e,i){const n=new Worker(e),r=this;n.postMessage(t),n.addEventListener("error",(t=>{console.error(t),console.error("Error in dealing JSONData!")})),n.addEventListener("message",(t=>{i?i():(r.utils.overrideData(t.data,r),"netjson"===r.type&&r.utils.updateMetadata.call(r))}))}overrideData(t,e){e.data=t,"geojson"===e.type&&e.leaflet.geoJSON.removeFrom(e.leaflet),e.utils.render(),e.config.afterUpdate.call(e)}};const p=class{constructor(t){this.utils=new d,this.config={...e},this.JSONParam=this.utils.isArray(t)?t:[t]}setConfig(t){return this.utils.deepMergeObj(this.config,t),this.el?t&&t.el&&console.error("Can't change el again!"):(this.config.el?this.utils.isElement(this.config.el)?this.el=this.config.el:this.el=document.querySelector(this.config.el):this.el=document.body,this.el===document.body&&(this.el.classList.add("njg-relativePosition"),this.el.setAttribute("id","graphChartContainer"))),this.config}render(){const[t,...e]=this.JSONParam;if(this.config.onRender.call(this),this.event.once("onReady",this.config.onReady.bind(this)),this.event.once("onLoad",this.config.onLoad.bind(this)),this.utils.paginatedDataParse.call(this,t).then((t=>{if(this.utils.isNetJSON(t))this.type="netjson";else{if(!this.utils.isGeoJSON(t))throw new Error("Invalid data format!");this.type="geojson"}if("netjson"===this.type){t.nodes.length>this.config.maxPointsFetched&&(this.hasMoreData=!0),t.nodes.splice(this.config.maxPointsFetched-1,t.nodes.length-this.config.maxPointsFetched);const e=new Set(t.nodes.map((t=>t.id)));t.links=t.links.filter((t=>!(!e.has(t.source)||!e.has(t.target))||(e.has(t.source)?console.warn(`Node ${t.target} does not exist!`):console.warn(`Node ${t.source} does not exist!`),!1))),this.config.prepareData.call(this,t)}this.data=t,this.config.dealDataByWorker?this.utils.dealDataByWorker.call(this,t,this.config.dealDataByWorker):(this.data=t,this.utils.render())})).catch((t=>{console.error(t)})),e.length){const i=function(){e.map((t=>this.utils.JSONDataUpdate.call(this,t,!1)))};this.JSONParam=[t],this.event.once("renderArray",i.bind(this))}}setUtils(t={}){const e=this;return e.utils=Object.assign(e.utils,{...t},{render(){if(!e.config.render)throw new Error("No render function!");e.config.render(e.data,e)}}),e.utils}};var f=i(9060),g=i(8023),m=i(1615),v=i(2488),y=i(7240),_=i(7164);(0,g.D)([v.N,y.N]);const x={init:function(){return m.S1.apply(null,arguments)}};(0,g.D)(_.T);var b=i(6026);(0,g.D)(b.N);var w=i(9517);(0,g.D)(w.N);var S=i(241);(0,g.D)(S.N);var T=i(7813);(0,g.D)(T.N);var M=i(8690);(0,g.D)(M.N);var C=i(5045);(0,g.D)(C.N);var A=i(3450);(0,g.D)(A.N);var L=i(531),I=i.n(L),D=(i(5732),i(3379)),P=i.n(D),O=i(7795),k=i.n(O),E=i(569),N=i.n(E),R=i(3565),z=i.n(R),B=i(9216),Z=i.n(B),F=i(4589),V=i.n(F),G=i(7785),H={};H.styleTagTransform=V(),H.setAttributes=z(),H.insert=N().bind(null,"head"),H.domAPI=k(),H.insertStyleElement=Z();P()(G.Z,H);G.Z&&G.Z.locals&&G.Z.locals;var U=i(9827),W={};W.styleTagTransform=V(),W.setAttributes=z(),W.insert=N().bind(null,"head"),W.domAPI=k(),W.insertStyleElement=Z();P()(U.Z,W);U.Z&&U.Z.locals&&U.Z.locals;var j=i(6387),X=i(3051),Y=function(t,e){return Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},Y(t,e)};function q(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}Y(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}Object.create;Object.create;function K(t,e){return null==t&&(t=0),null==e&&(e=0),[t,e]}var J=function(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))};var Q=function(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])};function $(t,e,i){var n=e[0],r=e[1];return t[0]=i[0]*n+i[2]*r+i[4],t[1]=i[1]*n+i[3]*r+i[5],t}function tt(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t}function et(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t}var it=function(t,e){this.target=t,this.topTarget=e&&e.topTarget};const nt=function(){function t(t){this.handler=t,t.on("mousedown",this._dragStart,this),t.on("mousemove",this._drag,this),t.on("mouseup",this._dragEnd,this)}return t.prototype._dragStart=function(t){for(var e=t.target;e&&!e.draggable;)e=e.parent||e.__hostTarget;e&&(this._draggingTarget=e,e.dragging=!0,this._x=t.offsetX,this._y=t.offsetY,this.handler.dispatchToElement(new it(e,t),"dragstart",t.event))},t.prototype._drag=function(t){var e=this._draggingTarget;if(e){var i=t.offsetX,n=t.offsetY,r=i-this._x,o=n-this._y;this._x=i,this._y=n,e.drift(r,o,t),this.handler.dispatchToElement(new it(e,t),"drag",t.event);var a=this.handler.findHover(i,n,e).target,s=this._dropTarget;this._dropTarget=a,e!==a&&(s&&a!==s&&this.handler.dispatchToElement(new it(s,t),"dragleave",t.event),a&&a!==s&&this.handler.dispatchToElement(new it(a,t),"dragenter",t.event))}},t.prototype._dragEnd=function(t){var e=this._draggingTarget;e&&(e.dragging=!1),this.handler.dispatchToElement(new it(e,t),"dragend",t.event),this._dropTarget&&this.handler.dispatchToElement(new it(this._dropTarget,t),"drop",t.event),this._draggingTarget=null,this._dropTarget=null},t}();var rt=function(){function t(t){t&&(this._$eventProcessor=t)}return t.prototype.on=function(t,e,i,n){this._$handlers||(this._$handlers={});var r=this._$handlers;if("function"==typeof e&&(n=i,i=e,e=null),!i||!t)return this;var o=this._$eventProcessor;null!=e&&o&&o.normalizeQuery&&(e=o.normalizeQuery(e)),r[t]||(r[t]=[]);for(var a=0;a>1)%2;a.style.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",n[s]+":0",r[l]+":0",n[1-s]+":auto",r[1-l]+":auto",""].join("!important;"),t.appendChild(a),i.push(a)}return i}(e,o),s=function(t,e,i){for(var n=i?"invTrans":"trans",r=e[n],o=e.srcCoords,a=[],s=[],l=!0,u=0;u<4;u++){var h=t[u].getBoundingClientRect(),c=2*u,d=h.left,p=h.top;a.push(d,p),l=l&&o&&d===o[c]&&p===o[c+1],s.push(t[u].offsetLeft,t[u].offsetTop)}return l&&r?r:(e.srcCoords=a,e[n]=i?lt(s,a):lt(a,s))}(a,o,r);if(s)return s(t,i,n),!0}return!1}function ct(t){return"CANVAS"===t.nodeName.toUpperCase()}var dt=/([&<>"'])/g,pt={"&":"&","<":"<",">":">",'"':""","'":"'"};var ft=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,gt=[],mt=j.default.browser.firefox&&+j.default.browser.version.split(".")[0]<39;function vt(t,e,i,n){return i=i||{},n?yt(t,e,i):mt&&null!=e.layerX&&e.layerX!==e.offsetX?(i.zrX=e.layerX,i.zrY=e.layerY):null!=e.offsetX?(i.zrX=e.offsetX,i.zrY=e.offsetY):yt(t,e,i),i}function yt(t,e,i){if(j.default.domSupported&&t.getBoundingClientRect){var n=e.clientX,r=e.clientY;if(ct(t)){var o=t.getBoundingClientRect();return i.zrX=n-o.left,void(i.zrY=r-o.top)}if(ht(gt,t,n,r))return i.zrX=gt[0],void(i.zrY=gt[1])}i.zrX=i.zrY=0}function _t(t){return t||window.event}function xt(t,e,i){if(null!=(e=_t(e)).zrX)return e;var n=e.type;if(n&&n.indexOf("touch")>=0){var r="touchend"!==n?e.targetTouches[0]:e.changedTouches[0];r&&vt(t,r,e,i)}else{vt(t,e,e,i);var o=function(t){var e=t.wheelDelta;if(e)return e;var i=t.deltaX,n=t.deltaY;if(null==i||null==n)return e;return 3*(0!==n?Math.abs(n):Math.abs(i))*(n>0?-1:n<0?1:i>0?-1:1)}(e);e.zrDelta=o?o/120:-(e.detail||0)/3}var a=e.button;return null==e.which&&void 0!==a&&ft.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}var bt=function(){function t(){this._track=[]}return t.prototype.recognize=function(t,e,i){return this._doTrack(t,e,i),this._recognize(t)},t.prototype.clear=function(){return this._track.length=0,this},t.prototype._doTrack=function(t,e,i){var n=t.touches;if(n){for(var r={points:[],touches:[],target:e,event:t},o=0,a=n.length;o1&&r&&r.length>1){var a=wt(r)/wt(o);!isFinite(a)&&(a=1),e.pinchScale=a;var s=[((n=r)[0][0]+n[1][0])/2,(n[0][1]+n[1][1])/2];return e.pinchX=s[0],e.pinchY=s[1],{type:"pinch",target:t[0].target,event:e}}}}};function Tt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function Mt(t,e,i){var n=e[0]*i[0]+e[2]*i[1],r=e[1]*i[0]+e[3]*i[1],o=e[0]*i[2]+e[2]*i[3],a=e[1]*i[2]+e[3]*i[3],s=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return t[0]=n,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t}function Ct(t,e,i){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+i[0],t[5]=e[5]+i[1],t}var At=function(){function t(t,e){this.x=t||0,this.y=e||0}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.equal=function(t){return t.x===this.x&&t.y===this.y},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this},t.prototype.scale=function(t){this.x*=t,this.y*=t},t.prototype.scaleAndAdd=function(t,e){this.x+=t.x*e,this.y+=t.y*e},t.prototype.sub=function(t){return this.x-=t.x,this.y-=t.y,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.len=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lenSquare=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var t=this.len();return this.x/=t,this.y/=t,this},t.prototype.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},t.prototype.distanceSquare=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.transform=function(t){if(t){var e=this.x,i=this.y;return this.x=t[0]*e+t[2]*i+t[4],this.y=t[1]*e+t[3]*i+t[5],this}},t.prototype.toArray=function(t){return t[0]=this.x,t[1]=this.y,t},t.prototype.fromArray=function(t){this.x=t[0],this.y=t[1]},t.set=function(t,e,i){t.x=e,t.y=i},t.copy=function(t,e){t.x=e.x,t.y=e.y},t.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.lenSquare=function(t){return t.x*t.x+t.y*t.y},t.dot=function(t,e){return t.x*e.x+t.y*e.y},t.add=function(t,e,i){t.x=e.x+i.x,t.y=e.y+i.y},t.sub=function(t,e,i){t.x=e.x-i.x,t.y=e.y-i.y},t.scale=function(t,e,i){t.x=e.x*i,t.y=e.y*i},t.scaleAndAdd=function(t,e,i,n){t.x=e.x+i.x*n,t.y=e.y+i.y*n},t.lerp=function(t,e,i,n){var r=1-n;t.x=r*e.x+n*i.x,t.y=r*e.y+n*i.y},t}();const Lt=At;var It=Math.min,Dt=Math.max,Pt=new Lt,Ot=new Lt,kt=new Lt,Et=new Lt,Nt=new Lt,Rt=new Lt;const zt=function(){function t(t,e,i,n){i<0&&(t+=i,i=-i),n<0&&(e+=n,n=-n),this.x=t,this.y=e,this.width=i,this.height=n}return t.prototype.union=function(t){var e=It(t.x,this.x),i=It(t.y,this.y);isFinite(this.x)&&isFinite(this.width)?this.width=Dt(t.x+t.width,this.x+this.width)-e:this.width=t.width,isFinite(this.y)&&isFinite(this.height)?this.height=Dt(t.y+t.height,this.y+this.height)-i:this.height=t.height,this.x=e,this.y=i},t.prototype.applyTransform=function(e){t.applyTransform(this,this,e)},t.prototype.calculateTransform=function(t){var e=this,i=t.width/e.width,n=t.height/e.height,r=[1,0,0,1,0,0];return Ct(r,r,[-e.x,-e.y]),function(t,e,i){var n=i[0],r=i[1];t[0]=e[0]*n,t[1]=e[1]*r,t[2]=e[2]*n,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*r}(r,r,[i,n]),Ct(r,r,[t.x,t.y]),r},t.prototype.intersect=function(e,i){if(!e)return!1;e instanceof t||(e=t.create(e));var n=this,r=n.x,o=n.x+n.width,a=n.y,s=n.y+n.height,l=e.x,u=e.x+e.width,h=e.y,c=e.y+e.height,d=!(of&&(f=_,gf&&(f=x,v=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},t.prototype.clone=function(){return new t(this.x,this.y,this.width,this.height)},t.prototype.copy=function(e){t.copy(this,e)},t.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},t.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},t.prototype.isZero=function(){return 0===this.width||0===this.height},t.create=function(e){return new t(e.x,e.y,e.width,e.height)},t.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},t.applyTransform=function(e,i,n){if(n){if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],o=n[3],a=n[4],s=n[5];return e.x=i.x*r+a,e.y=i.y*o+s,e.width=i.width*r,e.height=i.height*o,e.width<0&&(e.x+=e.width,e.width=-e.width),void(e.height<0&&(e.y+=e.height,e.height=-e.height))}Pt.x=kt.x=i.x,Pt.y=Et.y=i.y,Ot.x=Et.x=i.x+i.width,Ot.y=kt.y=i.y+i.height,Pt.transform(n),Et.transform(n),Ot.transform(n),kt.transform(n),e.x=It(Pt.x,Ot.x,kt.x,Et.x),e.y=It(Pt.y,Ot.y,kt.y,Et.y);var l=Dt(Pt.x,Ot.x,kt.x,Et.x),u=Dt(Pt.y,Ot.y,kt.y,Et.y);e.width=l-e.x,e.height=u-e.y}else e!==i&&t.copy(e,i)},t}();var Bt="silent";function Zt(){var t;(t=this.event).preventDefault(),t.stopPropagation(),t.cancelBubble=!0}var Ft=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.handler=null,e}return q(e,t),e.prototype.dispose=function(){},e.prototype.setCursor=function(){},e}(ot),Vt=function(t,e){this.x=t,this.y=e},Gt=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],Ht=new zt(0,0,0,0),Ut=function(t){function e(e,i,n,r,o){var a=t.call(this)||this;return a._hovered=new Vt(0,0),a.storage=e,a.painter=i,a.painterRoot=r,a._pointerSize=o,n=n||new Ft,a.proxy=null,a.setHandlerProxy(n),a._draggingMgr=new nt(a),a}return q(e,t),e.prototype.setHandlerProxy=function(t){this.proxy&&this.proxy.dispose(),t&&(X.each(Gt,(function(e){t.on&&t.on(e,this[e],this)}),this),t.handler=this),this.proxy=t},e.prototype.mousemove=function(t){var e=t.zrX,i=t.zrY,n=Xt(this,e,i),r=this._hovered,o=r.target;o&&!o.__zr&&(o=(r=this.findHover(r.x,r.y)).target);var a=this._hovered=n?new Vt(e,i):this.findHover(e,i),s=a.target,l=this.proxy;l.setCursor&&l.setCursor(s?s.cursor:"default"),o&&s!==o&&this.dispatchToElement(r,"mouseout",t),this.dispatchToElement(a,"mousemove",t),s&&s!==o&&this.dispatchToElement(a,"mouseover",t)},e.prototype.mouseout=function(t){var e=t.zrEventControl;"only_globalout"!==e&&this.dispatchToElement(this._hovered,"mouseout",t),"no_globalout"!==e&&this.trigger("globalout",{type:"globalout",event:t})},e.prototype.resize=function(){this._hovered=new Vt(0,0)},e.prototype.dispatch=function(t,e){var i=this[t];i&&i.call(this,e)},e.prototype.dispose=function(){this.proxy.dispose(),this.storage=null,this.proxy=null,this.painter=null},e.prototype.setCursorStyle=function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},e.prototype.dispatchToElement=function(t,e,i){var n=(t=t||{}).target;if(!n||!n.silent){for(var r="on"+e,o=function(t,e,i){return{type:t,event:i,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:i.zrX,offsetY:i.zrY,gestureEvent:i.gestureEvent,pinchX:i.pinchX,pinchY:i.pinchY,pinchScale:i.pinchScale,wheelDelta:i.zrDelta,zrByTouch:i.zrByTouch,which:i.which,stop:Zt}}(e,t,i);n&&(n[r]&&(o.cancelBubble=!!n[r].call(n,o)),n.trigger(e,o),n=n.__hostTarget?n.__hostTarget:n.parent,!o.cancelBubble););o.cancelBubble||(this.trigger(e,o),this.painter&&this.painter.eachOtherLayer&&this.painter.eachOtherLayer((function(t){"function"==typeof t[r]&&t[r].call(t,o),t.trigger&&t.trigger(e,o)})))}},e.prototype.findHover=function(t,e,i){var n=this.storage.getDisplayList(),r=new Vt(t,e);if(jt(n,r,t,e,i),this._pointerSize&&!r.target){for(var o=[],a=this._pointerSize,s=a/2,l=new zt(t-s,e-s,a,a),u=n.length-1;u>=0;u--){var h=n[u];h===i||h.ignore||h.ignoreCoarsePointer||h.parent&&h.parent.ignoreCoarsePointer||(Ht.copy(h.getBoundingRect()),h.transform&&Ht.applyTransform(h.transform),Ht.intersect(l)&&o.push(h))}if(o.length)for(var c=Math.PI/12,d=2*Math.PI,p=0;p=0;o--){var a=t[o],s=void 0;if(a!==r&&!a.ignore&&(s=Wt(a,i,n))&&(!e.topTarget&&(e.topTarget=a),s!==Bt)){e.target=a;break}}}function Xt(t,e,i){var n=t.painter;return e<0||e>n.getWidth()||i<0||i>n.getHeight()}X.each(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],(function(t){Ut.prototype[t]=function(e){var i,n,r=e.zrX,o=e.zrY,a=Xt(this,r,o);if("mouseup"===t&&a||(n=(i=this.findHover(r,o)).target),"mousedown"===t)this._downEl=n,this._downPoint=[e.zrX,e.zrY],this._upEl=n;else if("mouseup"===t)this._upEl=n;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||J(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(i,t,e)}}));const Yt=Ut;function qt(t,e,i,n){var r=e+1;if(r===i)return 1;if(n(t[r++],t[e])<0){for(;r=0;)r++;return r-e}function Kt(t,e,i,n,r){for(n===e&&n++;n>>1])<0?l=o:s=o+1;var u=n-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=a}}function Jt(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])>0){for(s=n-r;l0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}else{for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}for(a++;a>>1);o(t,e[i+h])>0?a=h+1:l=h}return l}function Qt(t,e,i,n,r,o){var a=0,s=0,l=1;if(o(t,e[i+r])<0){for(s=r+1;ls&&(l=s);var u=a;a=r-l,l=r-u}else{for(s=n-r;l=0;)a=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),a+=r,l+=r}for(a++;a>>1);o(t,e[i+h])<0?l=h:a=h+1}return l}function $t(t,e){var i,n,r,o=7,a=0;i=t.length;var s=[];function l(i){var l=n[i],u=r[i],h=n[i+1],c=r[i+1];r[i]=u+c,i===a-3&&(n[i+1]=n[i+2],r[i+1]=r[i+2]),a--;var d=Qt(t[h],t,l,u,0,e);l+=d,0!==(u-=d)&&0!==(c=Jt(t[l+u-1],t,h,c,c-1,e))&&(u<=c?function(i,n,r,a){var l=0;for(l=0;l=7||p>=7);if(f)break;g<0&&(g=0),g+=2}if((o=g)<1&&(o=1),1===n){for(l=0;l=0;l--)t[p+l]=t[d+l];return void(t[c]=s[h])}var f=o;for(;;){var g=0,m=0,v=!1;do{if(e(s[h],t[u])<0){if(t[c--]=t[u--],g++,m=0,0==--n){v=!0;break}}else if(t[c--]=s[h--],m++,g=0,1==--a){v=!0;break}}while((g|m)=0;l--)t[p+l]=t[d+l];if(0===n){v=!0;break}}if(t[c--]=s[h--],1==--a){v=!0;break}if(0!==(m=a-Jt(t[u],s,0,a,a-1,e))){for(a-=m,p=(c-=m)+1,d=(h-=m)+1,l=0;l=7||m>=7);if(v)break;f<0&&(f=0),f+=2}(o=f)<1&&(o=1);if(1===a){for(p=(c-=n)+1,d=(u-=n)+1,l=n-1;l>=0;l--)t[p+l]=t[d+l];t[c]=s[h]}else{if(0===a)throw new Error;for(d=c-(a-1),l=0;l1;){var t=a-2;if(t>=1&&r[t-1]<=r[t]+r[t+1]||t>=2&&r[t-2]<=r[t]+r[t-1])r[t-1]r[t+1])break;l(t)}},forceMergeRuns:function(){for(;a>1;){var t=a-2;t>0&&r[t-1]=32;)e|=1&t,t>>=1;return t+e}(r);do{if((o=qt(t,i,n,e))s&&(l=s),Kt(t,i,i+l,i+o,e),o=l}a.pushRun(i,o),a.mergeRuns(),r-=o,i+=o}while(0!==r);a.forceMergeRuns()}}}(i,ie)},t.prototype._updateAndAddDisplayable=function(t,e,i){if(!t.ignore||i){t.beforeUpdate(),t.update(),t.afterUpdate();var n=t.getClipPath();if(t.ignoreClip)e=null;else if(n){e=e?e.slice():[];for(var r=n,o=t;r;)r.parent=o,r.updateTransform(),e.push(r),o=r,r=r.getClipPath()}if(t.childrenRef){for(var a=t.childrenRef(),s=0;s0&&(u.__clipPaths=[]),isNaN(u.z)&&(ee(),u.z=0),isNaN(u.z2)&&(ee(),u.z2=0),isNaN(u.zlevel)&&(ee(),u.zlevel=0),this._displayList[this._displayListLen++]=u}var h=t.getDecalElement&&t.getDecalElement();h&&this._updateAndAddDisplayable(h,e,i);var c=t.getTextGuideLine();c&&this._updateAndAddDisplayable(c,e,i);var d=t.getTextContent();d&&this._updateAndAddDisplayable(d,e,i)}},t.prototype.addRoot=function(t){t.__zr&&t.__zr.storage===this||this._roots.push(t)},t.prototype.delRoot=function(t){if(t instanceof Array)for(var e=0,i=t.length;e=0&&this._roots.splice(n,1)}},t.prototype.delAllRoots=function(){this._roots=[],this._displayList=[],this._displayListLen=0},t.prototype.getRoots=function(){return this._roots},t.prototype.dispose=function(){this._displayList=null,this._roots=null},t}();const re=ne;const oe=j.default.hasGlobalWindow&&(window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||window.msRequestAnimationFrame&&window.msRequestAnimationFrame.bind(window)||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame)||function(t){return setTimeout(t,16)};var ae={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,i=.1,n=.4;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=n*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-ae.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*ae.bounceIn(2*t):.5*ae.bounceOut(2*t-1)+.5}};const se=ae;var le=Math.pow,ue=Math.sqrt,he=1e-8,ce=1e-4,de=ue(3),pe=1/3,fe=K(),ge=K(),me=K();function ve(t){return t>-1e-8&&the||t<-1e-8}function _e(t,e,i,n,r){var o=1-r;return o*o*(o*t+3*r*e)+r*r*(r*n+3*o*i)}function xe(t,e,i,n,r,o){var a=n+3*(e-i)-t,s=3*(i-2*e+t),l=3*(e-t),u=t-r,h=s*s-3*a*l,c=s*l-9*a*u,d=l*l-3*s*u,p=0;if(ve(h)&&ve(c)){if(ve(s))o[0]=0;else(T=-l/s)>=0&&T<=1&&(o[p++]=T)}else{var f=c*c-4*h*d;if(ve(f)){var g=c/h,m=-g/2;(T=-s/a+g)>=0&&T<=1&&(o[p++]=T),m>=0&&m<=1&&(o[p++]=m)}else if(f>0){var v=ue(f),y=h*s+1.5*a*(-c+v),_=h*s+1.5*a*(-c-v);(T=(-s-((y=y<0?-le(-y,pe):le(y,pe))+(_=_<0?-le(-_,pe):le(_,pe))))/(3*a))>=0&&T<=1&&(o[p++]=T)}else{var x=(2*h*s-3*a*c)/(2*ue(h*h*h)),b=Math.acos(x)/3,w=ue(h),S=Math.cos(b),T=(-s-2*w*S)/(3*a),M=(m=(-s+w*(S+de*Math.sin(b)))/(3*a),(-s+w*(S-de*Math.sin(b)))/(3*a));T>=0&&T<=1&&(o[p++]=T),m>=0&&m<=1&&(o[p++]=m),M>=0&&M<=1&&(o[p++]=M)}}return p}function be(t,e,i,n,r){var o=6*i-12*e+6*t,a=9*e+3*n-3*t-9*i,s=3*e-3*t,l=0;if(ve(a)){if(ye(o))(h=-s/o)>=0&&h<=1&&(r[l++]=h)}else{var u=o*o-4*a*s;if(ve(u))r[0]=-o/(2*a);else if(u>0){var h,c=ue(u),d=(-o-c)/(2*a);(h=(-o+c)/(2*a))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}function we(t,e,i,n,r,o){var a=(e-t)*r+t,s=(i-e)*r+e,l=(n-i)*r+i,u=(s-a)*r+a,h=(l-s)*r+s,c=(h-u)*r+u;o[0]=t,o[1]=a,o[2]=u,o[3]=c,o[4]=c,o[5]=h,o[6]=l,o[7]=n}function Se(t,e,i,n,r,o,a,s,l){for(var u=t,h=e,c=0,d=1/l,p=1;p<=l;p++){var f=p*d,g=_e(t,i,r,a,f),m=_e(e,n,o,s,f),v=g-u,y=m-h;c+=Math.sqrt(v*v+y*y),u=g,h=m}return c}function Te(t,e,i,n){var r=1-n;return r*(r*t+2*n*e)+n*n*i}function Me(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function Ce(t,e,i,n,r){var o=(e-t)*n+t,a=(i-e)*n+e,s=(a-o)*n+o;r[0]=t,r[1]=o,r[2]=s,r[3]=s,r[4]=a,r[5]=i}function Ae(t,e,i,n,r,o,a){for(var s=t,l=e,u=0,h=1/a,c=1;c<=a;c++){var d=c*h,p=Te(t,i,r,d),f=Te(e,n,o,d),g=p-s,m=f-l;u+=Math.sqrt(g*g+m*m),s=p,l=f}return u}var Le=/cubic-bezier\(([0-9,\.e ]+)\)/;function Ie(t){var e=t&&Le.exec(t);if(e){var i=e[1].split(","),n=+(0,X.trim)(i[0]),r=+(0,X.trim)(i[1]),o=+(0,X.trim)(i[2]),a=+(0,X.trim)(i[3]);if(isNaN(n+r+o+a))return;var s=[];return function(t){return t<=0?0:t>=1?1:xe(0,n,o,1,t,s)&&_e(0,r,a,1,s[0])}}}const De=function(){function t(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||X.noop,this.ondestroy=t.ondestroy||X.noop,this.onrestart=t.onrestart||X.noop,t.easing&&this.setEasing(t.easing)}return t.prototype.step=function(t,e){if(this._inited||(this._startTime=t+this._delay,this._inited=!0),!this._paused){var i=this._life,n=t-this._startTime-this._pausedTime,r=n/i;r<0&&(r=0),r=Math.min(r,1);var o=this.easingFunc,a=o?o(r):r;if(this.onframe(a),1===r){if(!this.loop)return!0;var s=n%i;this._startTime=t-s,this._pausedTime=0,this.onrestart()}return!1}this._pausedTime+=e},t.prototype.pause=function(){this._paused=!0},t.prototype.resume=function(){this._paused=!1},t.prototype.setEasing=function(t){this.easing=t,this.easingFunc=(0,X.isFunction)(t)?t:se[t]||Ie(t)},t}();var Pe=i(1092),Oe=Math.round;function ke(t){var e;if(t&&"transparent"!==t){if("string"==typeof t&&t.indexOf("rgba")>-1){var i=(0,Pe.parse)(t);i&&(t="rgb("+i[0]+","+i[1]+","+i[2]+")",e=i[3])}}else t="none";return{color:t,opacity:null==e?1:e}}var Ee=1e-4;function Ne(t){return t-1e-4}function Re(t){return Oe(1e3*t)/1e3}function ze(t){return Oe(1e4*t)/1e4}var Be={left:"start",right:"end",center:"middle",middle:"middle"};function Ze(t){return t&&!!t.image}function Fe(t){return Ze(t)||function(t){return t&&!!t.svgElement}(t)}function Ve(t){return"linear"===t.type}function Ge(t){return"radial"===t.type}function He(t){return t&&("linear"===t.type||"radial"===t.type)}function Ue(t){return"url(#"+t+")"}function We(t){var e=t.getGlobalScale(),i=Math.max(e[0],e[1]);return Math.max(Math.ceil(Math.log(i)/Math.log(10)),1)}function je(t){var e=t.x||0,i=t.y||0,n=(t.rotation||0)*X.RADIAN_TO_DEGREE,r=(0,X.retrieve2)(t.scaleX,1),o=(0,X.retrieve2)(t.scaleY,1),a=t.skewX||0,s=t.skewY||0,l=[];return(e||i)&&l.push("translate("+e+"px,"+i+"px)"),n&&l.push("rotate("+n+")"),1===r&&1===o||l.push("scale("+r+","+o+")"),(a||s)&&l.push("skew("+Oe(a*X.RADIAN_TO_DEGREE)+"deg, "+Oe(s*X.RADIAN_TO_DEGREE)+"deg)"),l.join(" ")}var Xe=j.default.hasGlobalWindow&&(0,X.isFunction)(window.btoa)?function(t){return window.btoa(unescape(encodeURIComponent(t)))}:"undefined"!=typeof Buffer?function(t){return Buffer.from(t).toString("base64")}:function(t){return null},Ye=Array.prototype.slice;function qe(t,e,i){return(e-t)*i+t}function Ke(t,e,i,n){for(var r=e.length,o=0;on?e:t,o=Math.min(i,n),a=r[o-1]||{color:[0,0,0,0],offset:0},s=o;sa)n.length=a;else for(var s=o;s=1},t.prototype.getAdditiveTrack=function(){return this._additiveTrack},t.prototype.addKeyframe=function(t,e,i){this._needsSort=!0;var n=this.keyframes,r=n.length,o=!1,a=6,s=e;if((0,X.isArrayLike)(e)){var l=function(t){return(0,X.isArrayLike)(t&&t[0])?2:1}(e);a=l,(1===l&&!(0,X.isNumber)(e[0])||2===l&&!(0,X.isNumber)(e[0][0]))&&(o=!0)}else if((0,X.isNumber)(e)&&!(0,X.eqNaN)(e))a=0;else if((0,X.isString)(e))if(isNaN(+e)){var u=Pe.parse(e);u&&(s=u,a=3)}else a=0;else if((0,X.isGradientObject)(e)){var h=(0,X.extend)({},s);h.colorStops=(0,X.map)(e.colorStops,(function(t){return{offset:t.offset,color:Pe.parse(t.color)}})),Ve(e)?a=4:Ge(e)&&(a=5),s=h}0===r?this.valType=a:a===this.valType&&6!==a||(o=!0),this.discrete=this.discrete||o;var c={time:t,value:s,rawValue:e,percent:0};return i&&(c.easing=i,c.easingFunc=(0,X.isFunction)(i)?i:se[i]||Ie(i)),n.push(c),c},t.prototype.prepare=function(t,e){var i=this.keyframes;this._needsSort&&i.sort((function(t,e){return t.time-e.time}));for(var n=this.valType,r=i.length,o=i[r-1],a=this.discrete,s=ri(n),l=ni(n),u=0;u=0&&!(l[i].percent<=e);i--);i=p(i,u-2)}else{for(i=d;ie);i++);i=p(i-1,u-2)}r=l[i+1],n=l[i]}if(n&&r){this._lastFr=i,this._lastFrP=e;var f=r.percent-n.percent,g=0===f?1:p((e-n.percent)/f,1);r.easingFunc&&(g=r.easingFunc(g));var m=o?this._additiveValue:c?oi:t[h];if(!ri(s)&&!c||m||(m=this._additiveValue=[]),this.discrete)t[h]=g<1?n.rawValue:r.rawValue;else if(ri(s))1===s?Ke(m,n[a],r[a],g):function(t,e,i,n){for(var r=e.length,o=r&&e[0].length,a=0;a0&&s.addKeyframe(0,ei(l),n),this._trackKeys.push(a)}s.addKeyframe(t,ei(e[a]),n)}return this._maxTime=Math.max(this._maxTime,t),this},t.prototype.pause=function(){this._clip.pause(),this._paused=!0},t.prototype.resume=function(){this._clip.resume(),this._paused=!1},t.prototype.isPaused=function(){return!!this._paused},t.prototype.duration=function(t){return this._maxTime=t,this._force=!0,this},t.prototype._doneCallback=function(){this._setTracksFinished(),this._clip=null;var t=this._doneCbs;if(t)for(var e=t.length,i=0;i0)){this._started=1;for(var e=this,i=[],n=this._maxTime||0,r=0;r1){var a=o.pop();r.addKeyframe(a.time,t[n]),r.prepare(this._maxTime,r.getAdditiveTrack())}}}},t}();const li=si;function ui(){return(new Date).getTime()}var hi=function(t){function e(e){var i=t.call(this)||this;return i._running=!1,i._time=0,i._pausedTime=0,i._pauseStart=0,i._paused=!1,e=e||{},i.stage=e.stage||{},i}return q(e,t),e.prototype.addClip=function(t){t.animation&&this.removeClip(t),this._head?(this._tail.next=t,t.prev=this._tail,t.next=null,this._tail=t):this._head=this._tail=t,t.animation=this},e.prototype.addAnimator=function(t){t.animation=this;var e=t.getClip();e&&this.addClip(e)},e.prototype.removeClip=function(t){if(t.animation){var e=t.prev,i=t.next;e?e.next=i:this._head=i,i?i.prev=e:this._tail=e,t.next=t.prev=t.animation=null}},e.prototype.removeAnimator=function(t){var e=t.getClip();e&&this.removeClip(e),t.animation=null},e.prototype.update=function(t){for(var e=ui()-this._pausedTime,i=e-this._time,n=this._head;n;){var r=n.next;n.step(e,i)?(n.ondestroy(),this.removeClip(n),n=r):n=r}this._time=e,t||(this.trigger("frame",i),this.stage.update&&this.stage.update())},e.prototype._startLoop=function(){var t=this;this._running=!0,oe((function e(){t._running&&(oe(e),!t._paused&&t.update())}))},e.prototype.start=function(){this._running||(this._time=ui(),this._pausedTime=0,this._startLoop())},e.prototype.stop=function(){this._running=!1},e.prototype.pause=function(){this._paused||(this._pauseStart=ui(),this._paused=!0)},e.prototype.resume=function(){this._paused&&(this._pausedTime+=ui()-this._pauseStart,this._paused=!1)},e.prototype.clear=function(){for(var t=this._head;t;){var e=t.next;t.prev=t.next=t.animation=null,t=e}this._head=this._tail=null},e.prototype.isFinished=function(){return null==this._head},e.prototype.animate=function(t,e){e=e||{},this.start();var i=new li(t,e.loop);return this.addAnimator(i),i},e}(ot);const ci=hi;var di,pi,fi=j.default.domSupported,gi=(pi={pointerdown:1,pointerup:1,pointermove:1,pointerout:1},{mouse:di=["click","dblclick","mousewheel","wheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],touch:["touchstart","touchend","touchmove"],pointer:X.map(di,(function(t){var e=t.replace("mouse","pointer");return pi.hasOwnProperty(e)?e:t}))}),mi=["mousemove","mouseup"],vi=["pointermove","pointerup"],yi=!1;function _i(t){var e=t.pointerType;return"pen"===e||"touch"===e}function xi(t){t&&(t.zrByTouch=!0)}function bi(t,e){for(var i=e,n=!1;i&&9!==i.nodeType&&!(n=i.domBelongToZr||i!==e&&i===t.painterRoot);)i=i.parentNode;return n}var wi=function(t,e){this.stopPropagation=X.noop,this.stopImmediatePropagation=X.noop,this.preventDefault=X.noop,this.type=e.type,this.target=this.currentTarget=t.dom,this.pointerType=e.pointerType,this.clientX=e.clientX,this.clientY=e.clientY},Si={mousedown:function(t){t=xt(this.dom,t),this.__mayPointerCapture=[t.zrX,t.zrY],this.trigger("mousedown",t)},mousemove:function(t){t=xt(this.dom,t);var e=this.__mayPointerCapture;!e||t.zrX===e[0]&&t.zrY===e[1]||this.__togglePointerCapture(!0),this.trigger("mousemove",t)},mouseup:function(t){t=xt(this.dom,t),this.__togglePointerCapture(!1),this.trigger("mouseup",t)},mouseout:function(t){bi(this,(t=xt(this.dom,t)).toElement||t.relatedTarget)||(this.__pointerCapturing&&(t.zrEventControl="no_globalout"),this.trigger("mouseout",t))},wheel:function(t){yi=!0,t=xt(this.dom,t),this.trigger("mousewheel",t)},mousewheel:function(t){yi||(t=xt(this.dom,t),this.trigger("mousewheel",t))},touchstart:function(t){xi(t=xt(this.dom,t)),this.__lastTouchMoment=new Date,this.handler.processGesture(t,"start"),Si.mousemove.call(this,t),Si.mousedown.call(this,t)},touchmove:function(t){xi(t=xt(this.dom,t)),this.handler.processGesture(t,"change"),Si.mousemove.call(this,t)},touchend:function(t){xi(t=xt(this.dom,t)),this.handler.processGesture(t,"end"),Si.mouseup.call(this,t),+new Date-+this.__lastTouchMoment<300&&Si.click.call(this,t)},pointerdown:function(t){Si.mousedown.call(this,t)},pointermove:function(t){_i(t)||Si.mousemove.call(this,t)},pointerup:function(t){Si.mouseup.call(this,t)},pointerout:function(t){_i(t)||Si.mouseout.call(this,t)}};X.each(["click","dblclick","contextmenu"],(function(t){Si[t]=function(e){e=xt(this.dom,e),this.trigger(t,e)}}));var Ti={pointermove:function(t){_i(t)||Ti.mousemove.call(this,t)},pointerup:function(t){Ti.mouseup.call(this,t)},mousemove:function(t){this.trigger("mousemove",t)},mouseup:function(t){var e=this.__pointerCapturing;this.__togglePointerCapture(!1),this.trigger("mouseup",t),e&&(t.zrEventControl="only_globalout",this.trigger("mouseout",t))}};function Mi(t,e){var i=e.domHandlers;j.default.pointerEventsSupported?X.each(gi.pointer,(function(n){Ai(e,n,(function(e){i[n].call(t,e)}))})):(j.default.touchEventsSupported&&X.each(gi.touch,(function(n){Ai(e,n,(function(r){i[n].call(t,r),function(t){t.touching=!0,null!=t.touchTimer&&(clearTimeout(t.touchTimer),t.touchTimer=null),t.touchTimer=setTimeout((function(){t.touching=!1,t.touchTimer=null}),700)}(e)}))})),X.each(gi.mouse,(function(n){Ai(e,n,(function(r){r=_t(r),e.touching||i[n].call(t,r)}))})))}function Ci(t,e){function i(i){Ai(e,i,(function(n){n=_t(n),bi(t,n.target)||(n=function(t,e){return xt(t.dom,new wi(t,e),!0)}(t,n),e.domHandlers[i].call(t,n))}),{capture:!0})}j.default.pointerEventsSupported?X.each(vi,i):j.default.touchEventsSupported||X.each(mi,i)}function Ai(t,e,i,n){t.mounted[e]=i,t.listenerOpts[e]=n,function(t,e,i,n){t.addEventListener(e,i,n)}(t.domTarget,e,i,n)}function Li(t){var e,i,n,r,o=t.mounted;for(var a in o)o.hasOwnProperty(a)&&(e=t.domTarget,i=a,n=o[a],r=t.listenerOpts[a],e.removeEventListener(i,n,r));t.mounted={}}var Ii=function(t,e){this.mounted={},this.listenerOpts={},this.touching=!1,this.domTarget=t,this.domHandlers=e};const Di=function(t){function e(e,i){var n=t.call(this)||this;return n.__pointerCapturing=!1,n.dom=e,n.painterRoot=i,n._localHandlerScope=new Ii(e,Si),fi&&(n._globalHandlerScope=new Ii(document,Ti)),Mi(n,n._localHandlerScope),n}return q(e,t),e.prototype.dispose=function(){Li(this._localHandlerScope),fi&&Li(this._globalHandlerScope)},e.prototype.setCursor=function(t){this.dom.style&&(this.dom.style.cursor=t||"default")},e.prototype.__togglePointerCapture=function(t){if(this.__mayPointerCapture=null,fi&&+this.__pointerCapturing^+t){this.__pointerCapturing=t;var e=this._globalHandlerScope;t?Ci(this,e):Li(e)}},e}(ot);var Pi=1;j.default.hasGlobalWindow&&(Pi=Math.max(window.devicePixelRatio||window.screen&&window.screen.deviceXDPI/window.screen.logicalXDPI||1,1));var Oi=Pi,ki="#333",Ei="#ccc",Ni=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},Ri=5e-5;function zi(t){return t>Ri||t<-5e-5}var Bi=[],Zi=[],Fi=[1,0,0,1,0,0],Vi=Math.abs,Gi=function(){function t(){}var e;return t.prototype.getLocalTransform=function(e){return t.getLocalTransform(this,e)},t.prototype.setPosition=function(t){this.x=t[0],this.y=t[1]},t.prototype.setScale=function(t){this.scaleX=t[0],this.scaleY=t[1]},t.prototype.setSkew=function(t){this.skewX=t[0],this.skewY=t[1]},t.prototype.setOrigin=function(t){this.originX=t[0],this.originY=t[1]},t.prototype.needLocalTransform=function(){return zi(this.rotation)||zi(this.x)||zi(this.y)||zi(this.scaleX-1)||zi(this.scaleY-1)||zi(this.skewX)||zi(this.skewY)},t.prototype.updateTransform=function(){var t=this.parent&&this.parent.transform,e=this.needLocalTransform(),i=this.transform;e||t?(i=i||[1,0,0,1,0,0],e?this.getLocalTransform(i):Ni(i),t&&(e?Mt(i,t,i):Tt(i,t)),this.transform=i,this._resolveGlobalScaleRatio(i)):i&&Ni(i)},t.prototype._resolveGlobalScaleRatio=function(t){var e,i,n,r,o,a,s,l,u,h=this.globalScaleRatio;if(null!=h&&1!==h){this.getGlobalScale(Bi);var c=Bi[0]<0?-1:1,d=Bi[1]<0?-1:1,p=((Bi[0]-c)*h+c)/Bi[0]||0,f=((Bi[1]-d)*h+d)/Bi[1]||0;t[0]*=p,t[1]*=p,t[2]*=f,t[3]*=f}this.invTransform=this.invTransform||[1,0,0,1,0,0],e=this.invTransform,n=(i=t)[0],r=i[2],o=i[4],a=i[1],s=i[3],l=i[5],(u=n*s-a*r)&&(u=1/u,e[0]=s*u,e[1]=-a*u,e[2]=-r*u,e[3]=n*u,e[4]=(r*l-s*o)*u,e[5]=(a*o-n*l)*u)},t.prototype.getComputedTransform=function(){for(var t=this,e=[];t;)e.push(t),t=t.parent;for(;t=e.pop();)t.updateTransform();return this.transform},t.prototype.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],i=t[2]*t[2]+t[3]*t[3],n=Math.atan2(t[1],t[0]),r=Math.PI/2+n-Math.atan2(t[3],t[2]);i=Math.sqrt(i)*Math.cos(r),e=Math.sqrt(e),this.skewX=r,this.skewY=0,this.rotation=-n,this.x=+t[4],this.y=+t[5],this.scaleX=e,this.scaleY=i,this.originX=0,this.originY=0}},t.prototype.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(Mt(Zi,t.invTransform,e),e=Zi);var i=this.originX,n=this.originY;(i||n)&&(Fi[4]=i,Fi[5]=n,Mt(Zi,e,Fi),Zi[4]-=i,Zi[5]-=n,e=Zi),this.setLocalTransform(e)}},t.prototype.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},t.prototype.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&$(i,i,n),i},t.prototype.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&$(i,i,n),i},t.prototype.getLineScale=function(){var t=this.transform;return t&&Vi(t[0]-1)>1e-10&&Vi(t[3]-1)>1e-10?Math.sqrt(Vi(t[0]*t[3]-t[2]*t[1])):1},t.prototype.copyTransform=function(t){Ui(this,t)},t.getLocalTransform=function(t,e){e=e||[];var i,n,r,o,a,s,l,u,h,c,d,p=t.originX||0,f=t.originY||0,g=t.scaleX,m=t.scaleY,v=t.anchorX,y=t.anchorY,_=t.rotation||0,x=t.x,b=t.y,w=t.skewX?Math.tan(t.skewX):0,S=t.skewY?Math.tan(-t.skewY):0;if(p||f||v||y){var T=p+v,M=f+y;e[4]=-T*g-w*M*m,e[5]=-M*m-S*T*g}else e[4]=e[5]=0;return e[0]=g,e[3]=m,e[1]=S*g,e[2]=w*m,_&&(i=e,r=_,o=(n=e)[0],a=n[2],s=n[4],l=n[1],u=n[3],h=n[5],c=Math.sin(r),d=Math.cos(r),i[0]=o*d+l*c,i[1]=-o*c+l*d,i[2]=a*d+u*c,i[3]=-a*c+d*u,i[4]=d*s+c*h,i[5]=d*h-c*s),e[4]+=p+x,e[5]+=f+b,e},t.initDefaultProps=((e=t.prototype).scaleX=e.scaleY=e.globalScaleRatio=1,void(e.x=e.y=e.originX=e.originY=e.skewX=e.skewY=e.rotation=e.anchorX=e.anchorY=0)),t}(),Hi=["x","y","originX","originY","anchorX","anchorY","rotation","scaleX","scaleY","skewX","skewY"];function Ui(t,e){for(var i=0;i=0?parseFloat(t)/100*e:parseFloat(t):t}var en="__zr_normal__",nn=Hi.concat(["ignore"]),rn=(0,X.reduce)(Hi,(function(t,e){return t[e]=!0,t}),{ignore:!1}),on={},an=new zt(0,0,0,0),sn=function(){function t(t){this.id=(0,X.guid)(),this.animators=[],this.currentStates=[],this.states={},this._init(t)}return t.prototype._init=function(t){this.attr(t)},t.prototype.drift=function(t,e,i){switch(this.draggable){case"horizontal":e=0;break;case"vertical":t=0}var n=this.transform;n||(n=this.transform=[1,0,0,1,0,0]),n[4]+=t,n[5]+=e,this.decomposeTransform(),this.markRedraw()},t.prototype.beforeUpdate=function(){},t.prototype.afterUpdate=function(){},t.prototype.update=function(){this.updateTransform(),this.__dirty&&this.updateInnerText()},t.prototype.updateInnerText=function(t){var e=this._textContent;if(e&&(!e.ignore||t)){this.textConfig||(this.textConfig={});var i=this.textConfig,n=i.local,r=e.innerTransformable,o=void 0,a=void 0,s=!1;r.parent=n?this:null;var l=!1;if(r.copyTransform(e),null!=i.position){var u=an;i.layoutRect?u.copy(i.layoutRect):u.copy(this.getBoundingRect()),n||u.applyTransform(this.transform),this.calculateTextPosition?this.calculateTextPosition(on,i,u):function(t,e,i){var n=e.position||"inside",r=null!=e.distance?e.distance:5,o=i.height,a=i.width,s=o/2,l=i.x,u=i.y,h="left",c="top";if(n instanceof Array)l+=tn(n[0],i.width),u+=tn(n[1],i.height),h=null,c=null;else switch(n){case"left":l-=r,u+=s,h="right",c="middle";break;case"right":l+=r+a,u+=s,c="middle";break;case"top":l+=a/2,u-=r,h="center",c="bottom";break;case"bottom":l+=a/2,u+=o+r,h="center";break;case"inside":l+=a/2,u+=s,h="center",c="middle";break;case"insideLeft":l+=r,u+=s,c="middle";break;case"insideRight":l+=a-r,u+=s,h="right",c="middle";break;case"insideTop":l+=a/2,u+=r,h="center";break;case"insideBottom":l+=a/2,u+=o-r,h="center",c="bottom";break;case"insideTopLeft":l+=r,u+=r;break;case"insideTopRight":l+=a-r,u+=r,h="right";break;case"insideBottomLeft":l+=r,u+=o-r,c="bottom";break;case"insideBottomRight":l+=a-r,u+=o-r,h="right",c="bottom"}(t=t||{}).x=l,t.y=u,t.align=h,t.verticalAlign=c}(on,i,u),r.x=on.x,r.y=on.y,o=on.align,a=on.verticalAlign;var h=i.origin;if(h&&null!=i.rotation){var c=void 0,d=void 0;"center"===h?(c=.5*u.width,d=.5*u.height):(c=tn(h[0],u.width),d=tn(h[1],u.height)),l=!0,r.originX=-r.x+c+(n?0:u.x),r.originY=-r.y+d+(n?0:u.y)}}null!=i.rotation&&(r.rotation=i.rotation);var p=i.offset;p&&(r.x+=p[0],r.y+=p[1],l||(r.originX=-p[0],r.originY=-p[1]));var f=null==i.inside?"string"==typeof i.position&&i.position.indexOf("inside")>=0:i.inside,g=this._innerTextDefaultStyle||(this._innerTextDefaultStyle={}),m=void 0,v=void 0,y=void 0;f&&this.canBeInsideText()?(m=i.insideFill,v=i.insideStroke,null!=m&&"auto"!==m||(m=this.getInsideTextFill()),null!=v&&"auto"!==v||(v=this.getInsideTextStroke(m),y=!0)):(m=i.outsideFill,v=i.outsideStroke,null!=m&&"auto"!==m||(m=this.getOutsideFill()),null!=v&&"auto"!==v||(v=this.getOutsideStroke(m),y=!0)),(m=m||"#000")===g.fill&&v===g.stroke&&y===g.autoStroke&&o===g.align&&a===g.verticalAlign||(s=!0,g.fill=m,g.stroke=v,g.autoStroke=y,g.align=o,g.verticalAlign=a,e.setDefaultTextStyle(g)),e.__dirty|=1,s&&e.dirtyStyle(!0)}},t.prototype.canBeInsideText=function(){return!0},t.prototype.getInsideTextFill=function(){return"#fff"},t.prototype.getInsideTextStroke=function(t){return"#000"},t.prototype.getOutsideFill=function(){return this.__zr&&this.__zr.isDarkMode()?Ei:ki},t.prototype.getOutsideStroke=function(t){var e=this.__zr&&this.__zr.getBackgroundColor(),i="string"==typeof e&&(0,Pe.parse)(e);i||(i=[255,255,255,1]);for(var n=i[3],r=this.__zr.isDarkMode(),o=0;o<3;o++)i[o]=i[o]*n+(r?0:255)*(1-n);return i[3]=1,(0,Pe.stringify)(i,"rgba")},t.prototype.traverse=function(t,e){},t.prototype.attrKV=function(t,e){"textConfig"===t?this.setTextConfig(e):"textContent"===t?this.setTextContent(e):"clipPath"===t?this.setClipPath(e):"extra"===t?(this.extra=this.extra||{},(0,X.extend)(this.extra,e)):this[t]=e},t.prototype.hide=function(){this.ignore=!0,this.markRedraw()},t.prototype.show=function(){this.ignore=!1,this.markRedraw()},t.prototype.attr=function(t,e){if("string"==typeof t)this.attrKV(t,e);else if((0,X.isObject)(t))for(var i=t,n=(0,X.keys)(i),r=0;r0},t.prototype.getState=function(t){return this.states[t]},t.prototype.ensureState=function(t){var e=this.states;return e[t]||(e[t]={}),e[t]},t.prototype.clearStates=function(t){this.useState(en,!1,t)},t.prototype.useState=function(t,e,i,n){var r=t===en;if(this.hasState()||!r){var o=this.currentStates,a=this.stateTransition;if(!((0,X.indexOf)(o,t)>=0)||!e&&1!==o.length){var s;if(this.stateProxy&&!r&&(s=this.stateProxy(t)),s||(s=this.states&&this.states[t]),s||r){r||this.saveCurrentToNormalState(s);var l=!!(s&&s.hoverLayer||n);l&&this._toggleHoverLayerFlag(!0),this._applyStateObj(t,s,this._normalState,e,!i&&!this.__inHover&&a&&a.duration>0,a);var u=this._textContent,h=this._textGuide;return u&&u.useState(t,e,i,l),h&&h.useState(t,e,i,l),r?(this.currentStates=[],this._normalState={}):e?this.currentStates.push(t):this.currentStates=[t],this._updateAnimationTargets(),this.markRedraw(),!l&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2),s}(0,X.logError)("State "+t+" not exists.")}}},t.prototype.useStates=function(t,e,i){if(t.length){var n=[],r=this.currentStates,o=t.length,a=o===r.length;if(a)for(var s=0;s0,p);var f=this._textContent,g=this._textGuide;f&&f.useStates(t,e,c),g&&g.useStates(t,e,c),this._updateAnimationTargets(),this.currentStates=t.slice(),this.markRedraw(),!c&&this.__inHover&&(this._toggleHoverLayerFlag(!1),this.__dirty&=-2)}else this.clearStates()},t.prototype._updateAnimationTargets=function(){for(var t=0;t=0){var i=this.currentStates.slice();i.splice(e,1),this.useStates(i)}},t.prototype.replaceState=function(t,e,i){var n=this.currentStates.slice(),r=(0,X.indexOf)(n,t),o=(0,X.indexOf)(n,e)>=0;r>=0?o?n.splice(r,1):n[r]=e:i&&!o&&n.push(e),this.useStates(n)},t.prototype.toggleState=function(t,e){e?this.useState(t,!0):this.removeState(t)},t.prototype._mergeStates=function(t){for(var e,i={},n=0;n=0&&e.splice(i,1)})),this.animators.push(t),i&&i.animation.addAnimator(t),i&&i.wakeUp()},t.prototype.updateDuringAnimation=function(t){this.markRedraw()},t.prototype.stopAnimation=function(t,e){for(var i=this.animators,n=i.length,r=[],o=0;o0&&i.during&&o[0].during((function(t,e){i.during(e)}));for(var d=0;d0||r.force&&!a.length){var w,S=void 0,T=void 0,M=void 0;if(s){T={},d&&(S={});for(x=0;x<_;x++){T[v=g[x]]=i[v],d?S[v]=n[v]:i[v]=n[v]}}else if(d){M={};for(x=0;x<_;x++){M[v=g[x]]=ei(i[v]),hn(i,n,v)}}(w=new li(i,!1,!1,c?(0,X.filter)(f,(function(t){return t.targetName===e})):null)).targetName=e,r.scope&&(w.scope=r.scope),d&&S&&w.whenWithKeys(0,S,g),M&&w.whenWithKeys(0,M,g),w.whenWithKeys(null==u?500:u,s?T:n,g).delay(h||0),t.addAnimator(w,e),a.push(w)}}(0,X.mixin)(sn,ot),(0,X.mixin)(sn,Wi);const dn=sn;var pn=function(t){function e(e){var i=t.call(this)||this;return i.isGroup=!0,i._children=[],i.attr(e),i}return q(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.children=function(){return this._children.slice()},e.prototype.childAt=function(t){return this._children[t]},e.prototype.childOfName=function(t){for(var e=this._children,i=0;i=0&&(i.splice(n,0,t),this._doAdd(t))}return this},e.prototype.replace=function(t,e){var i=X.indexOf(this._children,t);return i>=0&&this.replaceAt(e,i),this},e.prototype.replaceAt=function(t,e){var i=this._children,n=i[e];if(t&&t!==this&&t.parent!==this&&t!==n){i[e]=t,n.parent=null;var r=this.__zr;r&&n.removeSelfFromZr(r),this._doAdd(t)}return this},e.prototype._doAdd=function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__zr;e&&e!==t.__zr&&t.addSelfToZr(e),e&&e.refresh()},e.prototype.remove=function(t){var e=this.__zr,i=this._children,n=X.indexOf(i,t);return n<0||(i.splice(n,1),t.parent=null,e&&t.removeSelfFromZr(e),e&&e.refresh()),this},e.prototype.removeAll=function(){for(var t=this._children,e=this.__zr,i=0;i0&&(this._stillFrameAccum++,this._stillFrameAccum>this._sleepAfterStill&&this.animation.stop())},t.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},t.prototype.wakeUp=function(){this.animation.start(),this._stillFrameAccum=0},t.prototype.refreshHover=function(){this._needsRefreshHover=!0},t.prototype.refreshHoverImmediately=function(){this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover()},t.prototype.resize=function(t){t=t||{},this.painter.resize(t.width,t.height),this.handler.resize()},t.prototype.clearAnimation=function(){this.animation.clear()},t.prototype.getWidth=function(){return this.painter.getWidth()},t.prototype.getHeight=function(){return this.painter.getHeight()},t.prototype.setCursorStyle=function(t){this.handler.setCursorStyle(t)},t.prototype.findHover=function(t,e){return this.handler.findHover(t,e)},t.prototype.on=function(t,e,i){return this.handler.on(t,e,i),this},t.prototype.off=function(t,e){this.handler.off(t,e)},t.prototype.trigger=function(t,e){this.handler.trigger(t,e)},t.prototype.clear=function(){for(var t=this.storage.getRoots(),e=0;e1e-4)return s[0]=t-i,s[1]=e-n,l[0]=t+i,void(l[1]=e+n);if(Pn[0]=In(r)*i+t,Pn[1]=Ln(r)*n+e,On[0]=In(o)*i+t,On[1]=Ln(o)*n+e,u(s,Pn,On),h(l,Pn,On),(r%=Dn)<0&&(r+=Dn),(o%=Dn)<0&&(o+=Dn),r>o&&!a?o+=Dn:rr&&(kn[0]=In(p)*i+t,kn[1]=Ln(p)*n+e,u(s,kn,s),h(l,kn,l))}var Fn={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},Vn=[],Gn=[],Hn=[],Un=[],Wn=[],jn=[],Xn=Math.min,Yn=Math.max,qn=Math.cos,Kn=Math.sin,Jn=Math.abs,Qn=Math.PI,$n=2*Qn,tr="undefined"!=typeof Float32Array,er=[];function ir(t){return Math.round(t/Qn*1e8)/1e8%2*Qn}var nr=function(){function t(t){this.dpr=1,this._xi=0,this._yi=0,this._x0=0,this._y0=0,this._len=0,t&&(this._saveData=!1),this._saveData&&(this.data=[])}var e;return t.prototype.increaseVersion=function(){this._version++},t.prototype.getVersion=function(){return this._version},t.prototype.setScale=function(t,e,i){(i=i||0)>0&&(this._ux=Jn(i/Oi/t)||0,this._uy=Jn(i/Oi/e)||0)},t.prototype.setDPR=function(t){this.dpr=t},t.prototype.setContext=function(t){this._ctx=t},t.prototype.getContext=function(){return this._ctx},t.prototype.beginPath=function(){return this._ctx&&this._ctx.beginPath(),this.reset(),this},t.prototype.reset=function(){this._saveData&&(this._len=0),this._pathSegLen&&(this._pathSegLen=null,this._pathLen=0),this._version++},t.prototype.moveTo=function(t,e){return this._drawPendingPt(),this.addData(Fn.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},t.prototype.lineTo=function(t,e){var i=Jn(t-this._xi),n=Jn(e-this._yi),r=i>this._ux||n>this._uy;if(this.addData(Fn.L,t,e),this._ctx&&r&&this._ctx.lineTo(t,e),r)this._xi=t,this._yi=e,this._pendingPtDist=0;else{var o=i*i+n*n;o>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=o)}return this},t.prototype.bezierCurveTo=function(t,e,i,n,r,o){return this._drawPendingPt(),this.addData(Fn.C,t,e,i,n,r,o),this._ctx&&this._ctx.bezierCurveTo(t,e,i,n,r,o),this._xi=r,this._yi=o,this},t.prototype.quadraticCurveTo=function(t,e,i,n){return this._drawPendingPt(),this.addData(Fn.Q,t,e,i,n),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,n),this._xi=i,this._yi=n,this},t.prototype.arc=function(t,e,i,n,r,o){this._drawPendingPt(),er[0]=n,er[1]=r,function(t,e){var i=ir(t[0]);i<0&&(i+=$n);var n=i-t[0],r=t[1];r+=n,!e&&r-i>=$n?r=i+$n:e&&i-r>=$n?r=i-$n:!e&&i>r?r=i+($n-ir(i-r)):e&&iu.length&&(this._expandData(),u=this.data);for(var h=0;h0&&(this._ctx&&this._ctx.lineTo(this._pendingPtX,this._pendingPtY),this._pendingPtDist=0)},t.prototype._expandData=function(){if(!(this.data instanceof Array)){for(var t=[],e=0;e11&&(this.data=new Float32Array(t)))}},t.prototype.getBoundingRect=function(){Hn[0]=Hn[1]=Wn[0]=Wn[1]=Number.MAX_VALUE,Un[0]=Un[1]=jn[0]=jn[1]=-Number.MAX_VALUE;var t,e=this.data,i=0,n=0,r=0,o=0;for(t=0;ti||Jn(m)>n||c===e-1)&&(f=Math.sqrt(I*I+m*m),r=g,o=_);break;case Fn.C:var v=t[c++],y=t[c++],_=(g=t[c++],t[c++]),x=t[c++],b=t[c++];f=Se(r,o,v,y,g,_,x,b,10),r=x,o=b;break;case Fn.Q:f=Ae(r,o,v=t[c++],y=t[c++],g=t[c++],_=t[c++],10),r=g,o=_;break;case Fn.A:var w=t[c++],S=t[c++],T=t[c++],M=t[c++],C=t[c++],A=t[c++],L=A+C;c+=1;t[c++];p&&(a=qn(C)*T+w,s=Kn(C)*M+S),f=Yn(T,M)*Xn($n,Math.abs(A)),r=qn(L)*T+w,o=Kn(L)*M+S;break;case Fn.R:a=r=t[c++],s=o=t[c++],f=2*t[c++]+2*t[c++];break;case Fn.Z:var I=a-r;m=s-o;f=Math.sqrt(I*I+m*m),r=a,o=s}f>=0&&(l[h++]=f,u+=f)}return this._pathLen=u,u},t.prototype.rebuildPath=function(t,e){var i,n,r,o,a,s,l,u,h,c,d=this.data,p=this._ux,f=this._uy,g=this._len,m=e<1,v=0,y=0,_=0;if(!m||(this._pathSegLen||this._calculateLength(),l=this._pathSegLen,u=e*this._pathLen))t:for(var x=0;x0&&(t.lineTo(h,c),_=0),b){case Fn.M:i=r=d[x++],n=o=d[x++],t.moveTo(r,o);break;case Fn.L:a=d[x++],s=d[x++];var S=Jn(a-r),T=Jn(s-o);if(S>p||T>f){if(m){if(v+(Y=l[y++])>u){var M=(u-v)/Y;t.lineTo(r*(1-M)+a*M,o*(1-M)+s*M);break t}v+=Y}t.lineTo(a,s),r=a,o=s,_=0}else{var C=S*S+T*T;C>_&&(h=a,c=s,_=C)}break;case Fn.C:var A=d[x++],L=d[x++],I=d[x++],D=d[x++],P=d[x++],O=d[x++];if(m){if(v+(Y=l[y++])>u){we(r,A,I,P,M=(u-v)/Y,Vn),we(o,L,D,O,M,Gn),t.bezierCurveTo(Vn[1],Gn[1],Vn[2],Gn[2],Vn[3],Gn[3]);break t}v+=Y}t.bezierCurveTo(A,L,I,D,P,O),r=P,o=O;break;case Fn.Q:A=d[x++],L=d[x++],I=d[x++],D=d[x++];if(m){if(v+(Y=l[y++])>u){Ce(r,A,I,M=(u-v)/Y,Vn),Ce(o,L,D,M,Gn),t.quadraticCurveTo(Vn[1],Gn[1],Vn[2],Gn[2]);break t}v+=Y}t.quadraticCurveTo(A,L,I,D),r=I,o=D;break;case Fn.A:var k=d[x++],E=d[x++],N=d[x++],R=d[x++],z=d[x++],B=d[x++],Z=d[x++],F=!d[x++],V=N>R?N:R,G=Jn(N-R)>.001,H=z+B,U=!1;if(m)v+(Y=l[y++])>u&&(H=z+B*(u-v)/Y,U=!0),v+=Y;if(G&&t.ellipse?t.ellipse(k,E,N,R,Z,z,H,F):t.arc(k,E,V,z,H,F),U)break t;w&&(i=qn(z)*N+k,n=Kn(z)*R+E),r=qn(H)*N+k,o=Kn(H)*R+E;break;case Fn.R:i=r=d[x],n=o=d[x+1],a=d[x++],s=d[x++];var W=d[x++],j=d[x++];if(m){if(v+(Y=l[y++])>u){var X=u-v;t.moveTo(a,s),t.lineTo(a+Xn(X,W),s),(X-=W)>0&&t.lineTo(a+W,s+Xn(X,j)),(X-=j)>0&&t.lineTo(a+Yn(W-X,0),s+j),(X-=W)>0&&t.lineTo(a,s+Yn(j-X,0));break t}v+=Y}t.rect(a,s,W,j);break;case Fn.Z:if(m){var Y;if(v+(Y=l[y++])>u){M=(u-v)/Y;t.lineTo(r*(1-M)+i*M,o*(1-M)+n*M);break t}v+=Y}t.closePath(),r=i,o=n}}},t.prototype.clone=function(){var e=new t,i=this.data;return e.data=i.slice?i.slice():Array.prototype.slice.call(i),e._len=this._len,e},t.CMD=Fn,t.initDefaultProps=((e=t.prototype)._saveData=!0,e._ux=0,e._uy=0,e._pendingPtDist=0,void(e._version=0)),t}();const rr=nr;function or(t,e,i,n,r,o,a){if(0===r)return!1;var s=r,l=0;if(a>e+s&&a>n+s||at+s&&o>i+s||oe+c&&h>n+c&&h>o+c&&h>s+c||ht+c&&u>i+c&&u>r+c&&u>a+c||u=0&&fe+u&&l>n+u&&l>o+u||lt+u&&s>i+u&&s>r+u||s=0&&mi||h+ur&&(r+=hr);var d=Math.atan2(l,s);return d<0&&(d+=hr),d>=n&&d<=r||d+hr>=n&&d+hr<=r}function dr(t,e,i,n,r,o){if(o>e&&o>n||or?s:0}var pr=rr.CMD,fr=2*Math.PI;var gr=[-1,-1,-1],mr=[-1,-1];function vr(t,e,i,n,r,o,a,s,l,u){if(u>e&&u>n&&u>o&&u>s||u1&&(h=void 0,h=mr[0],mr[0]=mr[1],mr[1]=h),f=_e(e,n,o,s,mr[0]),p>1&&(g=_e(e,n,o,s,mr[1]))),2===p?ve&&s>n&&s>o||s=0&&h<=1&&(r[l++]=h);else{var u=a*a-4*o*s;if(ve(u))(h=-a/(2*o))>=0&&h<=1&&(r[l++]=h);else if(u>0){var h,c=ue(u),d=(-a-c)/(2*o);(h=(-a+c)/(2*o))>=0&&h<=1&&(r[l++]=h),d>=0&&d<=1&&(r[l++]=d)}}return l}(e,n,o,s,gr);if(0===l)return 0;var u=Me(e,n,o);if(u>=0&&u<=1){for(var h=0,c=Te(e,n,o,u),d=0;di||s<-i)return 0;var l=Math.sqrt(i*i-s*s);gr[0]=-l,gr[1]=l;var u=Math.abs(n-r);if(u<1e-4)return 0;if(u>=fr-1e-4){n=0,r=fr;var h=o?1:-1;return a>=gr[0]+t&&a<=gr[1]+t?h:0}if(n>r){var c=n;n=r,r=c}n<0&&(n+=fr,r+=fr);for(var d=0,p=0;p<2;p++){var f=gr[p];if(f+t>a){var g=Math.atan2(s,f);h=o?1:-1;g<0&&(g=fr+g),(g>=n&&g<=r||g+fr>=n&&g+fr<=r)&&(g>Math.PI/2&&g<1.5*Math.PI&&(h=-h),d+=h)}}return d}function xr(t,e,i,n,r){for(var o,a,s,l,u=t.data,h=t.len(),c=0,d=0,p=0,f=0,g=0,m=0;m1&&(i||(c+=dr(d,p,f,g,n,r))),y&&(f=d=u[m],g=p=u[m+1]),v){case pr.M:d=f=u[m++],p=g=u[m++];break;case pr.L:if(i){if(or(d,p,u[m],u[m+1],e,n,r))return!0}else c+=dr(d,p,u[m],u[m+1],n,r)||0;d=u[m++],p=u[m++];break;case pr.C:if(i){if(ar(d,p,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],e,n,r))return!0}else c+=vr(d,p,u[m++],u[m++],u[m++],u[m++],u[m],u[m+1],n,r)||0;d=u[m++],p=u[m++];break;case pr.Q:if(i){if(sr(d,p,u[m++],u[m++],u[m],u[m+1],e,n,r))return!0}else c+=yr(d,p,u[m++],u[m++],u[m],u[m+1],n,r)||0;d=u[m++],p=u[m++];break;case pr.A:var _=u[m++],x=u[m++],b=u[m++],w=u[m++],S=u[m++],T=u[m++];m+=1;var M=!!(1-u[m++]);o=Math.cos(S)*b+_,a=Math.sin(S)*w+x,y?(f=o,g=a):c+=dr(d,p,o,a,n,r);var C=(n-_)*w/b+_;if(i){if(cr(_,x,w,S,S+T,M,e,C,r))return!0}else c+=_r(_,x,w,S,S+T,M,C,r);d=Math.cos(S+T)*b+_,p=Math.sin(S+T)*w+x;break;case pr.R:if(f=d=u[m++],g=p=u[m++],o=f+u[m++],a=g+u[m++],i){if(or(f,g,o,g,e,n,r)||or(o,g,o,a,e,n,r)||or(o,a,f,a,e,n,r)||or(f,a,f,g,e,n,r))return!0}else c+=dr(o,g,o,a,n,r),c+=dr(f,a,f,g,n,r);break;case pr.Z:if(i){if(or(d,p,f,g,e,n,r))return!0}else c+=dr(d,p,f,g,n,r);d=f,p=g}}return i||(s=p,l=g,Math.abs(s-l)<1e-4)||(c+=dr(d,p,f,g,n,r)||0),0!==c}var br=(0,X.defaults)({fill:"#000",stroke:null,strokePercent:1,fillOpacity:1,strokeOpacity:1,lineDashOffset:0,lineWidth:1,lineCap:"butt",miterLimit:10,strokeNoScale:!1,strokeFirst:!1},yn),wr={style:(0,X.defaults)({fill:!0,stroke:!0,strokePercent:!0,fillOpacity:!0,strokeOpacity:!0,lineDashOffset:!0,lineWidth:!0,miterLimit:!0},_n.style)},Sr=Hi.concat(["invisible","culling","z","z2","zlevel","parent"]);const Tr=function(t){function e(e){return t.call(this,e)||this}var i;return q(e,t),e.prototype.update=function(){var i=this;t.prototype.update.call(this);var n=this.style;if(n.decal){var r=this._decalEl=this._decalEl||new e;r.buildPath===e.prototype.buildPath&&(r.buildPath=function(t){i.buildPath(t,i.shape)}),r.silent=!0;var o=r.style;for(var a in n)o[a]!==n[a]&&(o[a]=n[a]);o.fill=n.fill?n.decal:null,o.decal=null,o.shadowColor=null,n.strokeFirst&&(o.stroke=null);for(var s=0;s.5?ki:e>.2?"#eee":Ei}if(t)return Ei}return ki},e.prototype.getInsideTextStroke=function(t){var e=this.style.fill;if((0,X.isString)(e)){var i=this.__zr;if(!(!i||!i.isDarkMode())===(0,Pe.lum)(t,0)<.4)return e}},e.prototype.buildPath=function(t,e,i){},e.prototype.pathUpdated=function(){this.__dirty&=-5},e.prototype.getUpdatedPathProxy=function(t){return!this.path&&this.createPathProxy(),this.path.beginPath(),this.buildPath(this.path,this.shape,t),this.path},e.prototype.createPathProxy=function(){this.path=new rr(!1)},e.prototype.hasStroke=function(){var t=this.style,e=t.stroke;return!(null==e||"none"===e||!(t.lineWidth>0))},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.getBoundingRect=function(){var t=this._rect,e=this.style,i=!t;if(i){var n=!1;this.path||(n=!0,this.createPathProxy());var r=this.path;(n||4&this.__dirty)&&(r.beginPath(),this.buildPath(r,this.shape,!1),this.pathUpdated()),t=r.getBoundingRect()}if(this._rect=t,this.hasStroke()&&this.path&&this.path.len()>0){var o=this._rectStroke||(this._rectStroke=t.clone());if(this.__dirty||i){o.copy(t);var a=e.strokeNoScale?this.getLineScale():1,s=e.lineWidth;if(!this.hasFill()){var l=this.strokeContainThreshold;s=Math.max(s,null==l?4:l)}a>1e-10&&(o.width+=s/a,o.height+=s/a,o.x-=s/a/2,o.y-=s/a/2)}return o}return t},e.prototype.contain=function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),r=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var o=this.path;if(this.hasStroke()){var a=r.lineWidth,s=r.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(this.hasFill()||(a=Math.max(a,this.strokeContainThreshold)),function(t,e,i,n){return xr(t,e,!0,i,n)}(o,a/s,t,e)))return!0}if(this.hasFill())return function(t,e,i){return xr(t,0,!1,e,i)}(o,t,e)}return!1},e.prototype.dirtyShape=function(){this.__dirty|=4,this._rect&&(this._rect=null),this._decalEl&&this._decalEl.dirtyShape(),this.markRedraw()},e.prototype.dirty=function(){this.dirtyStyle(),this.dirtyShape()},e.prototype.animateShape=function(t){return this.animate("shape",t)},e.prototype.updateDuringAnimation=function(t){"style"===t?this.dirtyStyle():"shape"===t?this.dirtyShape():this.markRedraw()},e.prototype.attrKV=function(e,i){"shape"===e?this.setShape(i):t.prototype.attrKV.call(this,e,i)},e.prototype.setShape=function(t,e){var i=this.shape;return i||(i=this.shape={}),"string"==typeof t?i[t]=e:(0,X.extend)(i,t),this.dirtyShape(),this},e.prototype.shapeChanged=function(){return!!(4&this.__dirty)},e.prototype.createStyle=function(t){return(0,X.createObject)(br,t)},e.prototype._innerSaveToNormal=function(e){t.prototype._innerSaveToNormal.call(this,e);var i=this._normalState;e.shape&&!i.shape&&(i.shape=(0,X.extend)({},this.shape))},e.prototype._applyStateObj=function(e,i,n,r,o,a){t.prototype._applyStateObj.call(this,e,i,n,r,o,a);var s,l=!(i&&r);if(i&&i.shape?o?r?s=i.shape:(s=(0,X.extend)({},n.shape),(0,X.extend)(s,i.shape)):(s=(0,X.extend)({},r?this.shape:n.shape),(0,X.extend)(s,i.shape)):l&&(s=n.shape),s)if(o){this.shape=(0,X.extend)({},this.shape);for(var u={},h=(0,X.keys)(s),c=0;c0},e.prototype.hasFill=function(){var t=this.style.fill;return null!=t&&"none"!==t},e.prototype.createStyle=function(t){return(0,X.createObject)(Ir,t)},e.prototype.setBoundingRect=function(t){this._rect=t},e.prototype.getBoundingRect=function(){var t=this.style;if(!this._rect){var e=t.text;null!=e?e+="":e="";var i=function(t,e,i,n){var r=((t||"")+"").split("\n");if(1===r.length)return Ki(r[0],e,i,n);for(var o=new zt(0,0,0,0),a=0;a=Nr:-l>=Nr),d=l>0?l%Nr:l%Nr+Nr,p=!1;p=!!c||!Ne(h)&&d>=Er==!!u;var f=t+i*kr(o),g=e+n*Or(o);this._start&&this._add("M",f,g);var m=Math.round(r*Rr);if(c){var v=1/this._p,y=(u?1:-1)*(Nr-v);this._add("A",i,n,m,1,+u,t+i*kr(o+y),e+n*Or(o+y)),v>.01&&this._add("A",i,n,m,0,+u,f,g)}else{var _=t+i*kr(a),x=e+n*Or(a);this._add("A",i,n,m,+p,+u,_,x)}},t.prototype.rect=function(t,e,i,n){this._add("M",t,e),this._add("l",i,0),this._add("l",0,n),this._add("l",-i,0),this._add("Z")},t.prototype.closePath=function(){this._d.length>0&&this._add("Z")},t.prototype._add=function(t,e,i,n,r,o,a,s,l){for(var u=[],h=this._p,c=1;c0&&(e=n.lineDash,i=n.lineWidth,e&&"solid"!==e&&i>0?"dashed"===e?[4*i,2*i]:"dotted"===e?[i]:(0,X.isNumber)(e)?[e]:(0,X.isArray)(e)?e:null:null),o=n.lineDashOffset;if(r){var a=n.strokeNoScale&&t.getLineScale?t.getLineScale():1;a&&1!==a&&(r=(0,X.map)(r,(function(t){return t/a})),o/=a)}return[r,o]}var Zr="none",Fr=Math.round;var Vr=["lineCap","miterLimit","lineJoin"],Gr=(0,X.map)(Vr,(function(t){return"stroke-"+t.toLowerCase()}));function Hr(t,e,i,n){var r=null==e.opacity?1:e.opacity;if(i instanceof Lr)t("opacity",r);else{if(function(t){var e=t.fill;return null!=e&&e!==Zr}(e)){var o=ke(e.fill);t("fill",o.color);var a=null!=e.fillOpacity?e.fillOpacity*o.opacity*r:o.opacity*r;(n||a<1)&&t("fill-opacity",a)}else t("fill",Zr);if(function(t){var e=t.stroke;return null!=e&&e!==Zr}(e)){var s=ke(e.stroke);t("stroke",s.color);var l=e.strokeNoScale?i.getLineScale():1,u=l?(e.lineWidth||0)/l:0,h=null!=e.strokeOpacity?e.strokeOpacity*s.opacity*r:s.opacity*r,c=e.strokeFirst;if((n||1!==u)&&t("stroke-width",u),(n||c)&&t("paint-order",c?"stroke":"fill"),(n||h<1)&&t("stroke-opacity",h),e.lineDash){var d=Br(i),p=d[0],f=d[1];p&&(f=Fr(f||0),t("stroke-dasharray",p.join(",")),(f||n)&&t("stroke-dashoffset",f))}else n&&t("stroke-dasharray",Zr);for(var g=0;g"}(o,e.attrs)+(null==(n=e.text)?"":(n+"").replace(dt,(function(t,e){return pt[e]})))+(r?""+i+(0,X.map)(r,(function(e){return t(e)})).join(i)+i:"")+("")}(t)}function qr(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssClassIdx:0,cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function Kr(t,e,i,n){return Xr("svg","root",{width:t,height:e,xmlns:Ur,"xmlns:xlink":Wr,version:"1.1",baseProfile:"full",viewBox:!!n&&"0 0 "+t+" "+e},i)}var Jr=new ji.ZP(50);function Qr(t){if("string"==typeof t){var e=Jr.get(t);return e&&e.image}return t}function $r(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;e=0&&(n=f)}}})),n){e.d=!1;var s=lo(a,i);return n.replace(r,s)}}(t,e,i);if(s)a.push(s);else if(!o)return}else if(!o)return;for(var l={},u=0;u0})).length)return lo(h,i)+" "+r[0]+" both"}for(var m in l){(s=g(l[m]))&&a.push(s)}if(a.length){var v=i.zrId+"-cls-"+i.cssClassIdx++;i.cssNodes["."+v]={animation:a.join(",")},e.class=v}}var co=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function po(t,e,i,n,r){if(!e)return"";var o=(t+"").split("\n");r=fo(e,i,n,r);for(var a=0,s=o.length;a=a;l++)s-=a;var u=qi(i,e);return u>s&&(i="",u=0),s=t-u,r.ellipsis=i,r.ellipsisWidth=u,r.contentWidth=s,r.containerWidth=t,r}function go(t,e){var i=e.containerWidth,n=e.font,r=e.contentWidth;if(!i)return"";var o=qi(t,n);if(o<=i)return t;for(var a=0;;a++){if(o<=r||a>=e.maxIterations){t+=e.ellipsis;break}var s=0===a?mo(t,r,e.ascCharWidth,e.cnCharWidth):o>0?Math.floor(t.length*r/o):0;o=qi(t=t.substr(0,s),n)}return""===t&&(t=e.placeholder),t}function mo(t,e,i,n){for(var r=0,o=0,a=t.length;o0&&f+n.accumWidth>n.width&&(o=e.split("\n"),c=!0),n.accumWidth=f}else{var g=So(e,h,n.width,n.breakAll,n.accumWidth);n.accumWidth=g.accumWidth+p,a=g.linesWidths,o=g.lines}}else o=e.split("\n");for(var m=0;m=33&&e<=383}(t)||!!bo[t]}function So(t,e,i,n,r){for(var o=[],a=[],s="",l="",u=0,h=0,c=0;ci:r+h+p>i)?h?(s||l)&&(f?(s||(s=l,l="",h=u=0),o.push(s),a.push(h-u),l+=d,s="",h=u+=p):(l&&(s+=l,l="",u=0),o.push(s),a.push(h),s=d,h=p)):f?(o.push(l),a.push(u),l=d,u=p):(o.push(d),a.push(p)):(h+=p,f?(l+=d,u+=p):(l&&(s+=l,l="",u=0),s+=d))}else l&&(s+=l,h+=u),o.push(s),a.push(h),s="",l="",u=0,h=0}return o.length||s||(s=t,l="",u=0),l&&(s+=l),s&&(o.push(s),a.push(h)),1===o.length&&(h+=r),{accumWidth:h,lines:o,linesWidths:a}}var To=Math.round;function Mo(t,e,i){if(!e)return t;var n=To(2*t);return(n+To(e))%2==0?n/2:(n+(i?1:-1))/2}var Co=function(){this.x=0,this.y=0,this.width=0,this.height=0},Ao={},Lo=function(t){function e(e){return t.call(this,e)||this}return q(e,t),e.prototype.getDefaultShape=function(){return new Co},e.prototype.buildPath=function(t,e){var i,n,r,o;if(this.subPixelOptimize){var a=function(t,e,i){if(e){var n=e.x,r=e.y,o=e.width,a=e.height;t.x=n,t.y=r,t.width=o,t.height=a;var s=i&&i.lineWidth;return s?(t.x=Mo(n,s,!0),t.y=Mo(r,s,!0),t.width=Math.max(Mo(n+o,s,!1)-t.x,0===o?0:1),t.height=Math.max(Mo(r+a,s,!1)-t.y,0===a?0:1),t):t}}(Ao,e,this.style);i=a.x,n=a.y,r=a.width,o=a.height,a.r=e.r,e=a}else i=e.x,n=e.y,r=e.width,o=e.height;e.r?function(t,e){var i,n,r,o,a,s=e.x,l=e.y,u=e.width,h=e.height,c=e.r;u<0&&(s+=u,u=-u),h<0&&(l+=h,h=-h),"number"==typeof c?i=n=r=o=c:c instanceof Array?1===c.length?i=n=r=o=c[0]:2===c.length?(i=r=c[0],n=o=c[1]):3===c.length?(i=c[0],n=o=c[1],r=c[2]):(i=c[0],n=c[1],r=c[2],o=c[3]):i=n=r=o=0,i+n>u&&(i*=u/(a=i+n),n*=u/a),r+o>u&&(r*=u/(a=r+o),o*=u/a),n+r>h&&(n*=h/(a=n+r),r*=h/a),i+o>h&&(i*=h/(a=i+o),o*=h/a),t.moveTo(s+i,l),t.lineTo(s+u-n,l),0!==n&&t.arc(s+u-n,l+n,n,-Math.PI/2,0),t.lineTo(s+u,l+h-r),0!==r&&t.arc(s+u-r,l+h-r,r,0,Math.PI/2),t.lineTo(s+o,l+h),0!==o&&t.arc(s+o,l+h-o,o,Math.PI/2,Math.PI),t.lineTo(s,l+i),0!==i&&t.arc(s+i,l+i,i,Math.PI,1.5*Math.PI)}(t,e):t.rect(i,n,r,o)},e.prototype.isZeroArea=function(){return!this.shape.width||!this.shape.height},e}(Tr);Lo.prototype.type="rect";const Io=Lo;var Do={fill:"#000"},Po={style:(0,X.defaults)({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},_n.style)},Oo=function(t){function e(e){var i=t.call(this)||this;return i.type="text",i._children=[],i._defaultStyle=Do,i.attr(e),i}return q(e,t),e.prototype.childrenRef=function(){return this._children},e.prototype.update=function(){t.prototype.update.call(this),this.styleChanged()&&this._updateSubTexts();for(var e=0;ep&&h){var f=Math.floor(p/l);i=i.slice(0,f)}if(t&&a&&null!=c)for(var g=fo(c,o,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),m=0;m0,M=null!=t.width&&("truncate"===t.overflow||"break"===t.overflow||"breakAll"===t.overflow),C=n.calculatedLineHeight,A=0;Al&&xo(i,t.substring(l,u),e,s),xo(i,n[2],e,s,n[1]),l=co.lastIndex}lo){b>0?(y.tokens=y.tokens.slice(0,b),m(y,x,_),i.lines=i.lines.slice(0,v+1)):i.lines=i.lines.slice(0,v);break t}var A=w.width,L=null==A||"auto"===A;if("string"==typeof A&&"%"===A.charAt(A.length-1))O.percentWidth=A,h.push(O),O.contentWidth=qi(O.text,M);else{if(L){var I=w.backgroundColor,D=I&&I.image;D&&to(D=Qr(D))&&(O.width=Math.max(O.width,D.width*C/D.height))}var P=f&&null!=r?r-x:null;null!=P&&P=0&&"right"===(A=_[C]).align;)this._placeToken(A,t,b,f,M,"right",m),w-=A.width,M-=A.width,C--;for(T+=(i-(T-p)-(g-M)-w)/2;S<=C;)A=_[S],this._placeToken(A,t,b,f,T+A.width/2,"center",m),T+=A.width,S++;f+=b}},e.prototype._placeToken=function(t,e,i,n,r,o,a){var s=e.rich[t.styleName]||{};s.text=t.text;var l=t.verticalAlign,u=n+i/2;"top"===l?u=n+t.height/2:"bottom"===l&&(u=n+i-t.height/2),!t.isLineHolder&&Uo(s)&&this._renderBackground(s,e,"right"===o?r-t.width:"center"===o?r-t.width/2:r,u-t.height/2,t.width,t.height);var h=!!s.backgroundColor,c=t.textPadding;c&&(r=Go(r,o,c),u-=t.height/2-c[0]-t.innerHeight/2);var d=this._getOrCreateChild(Pr),p=d.createStyle();d.useStyle(p);var f=this._defaultStyle,g=!1,m=0,v=Vo("fill"in s?s.fill:"fill"in e?e.fill:(g=!0,f.fill)),y=Fo("stroke"in s?s.stroke:"stroke"in e?e.stroke:h||a||f.autoStroke&&!g?null:(m=2,f.stroke)),_=s.textShadowBlur>0||e.textShadowBlur>0;p.text=t.text,p.x=r,p.y=u,_&&(p.shadowBlur=s.textShadowBlur||e.textShadowBlur||0,p.shadowColor=s.textShadowColor||e.textShadowColor||"transparent",p.shadowOffsetX=s.textShadowOffsetX||e.textShadowOffsetX||0,p.shadowOffsetY=s.textShadowOffsetY||e.textShadowOffsetY||0),p.textAlign=o,p.textBaseline="middle",p.font=t.font||Xi.Uo,p.opacity=(0,X.retrieve3)(s.opacity,e.opacity,1),zo(p,s),y&&(p.lineWidth=(0,X.retrieve3)(s.lineWidth,e.lineWidth,m),p.lineDash=(0,X.retrieve2)(s.lineDash,e.lineDash),p.lineDashOffset=e.lineDashOffset||0,p.stroke=y),v&&(p.fill=v);var x=t.contentWidth,b=t.contentHeight;d.setBoundingRect(new zt(Ji(p.x,x,p.textAlign),Qi(p.y,b,p.textBaseline),x,b))},e.prototype._renderBackground=function(t,e,i,n,r,o){var a,s,l,u=t.backgroundColor,h=t.borderWidth,c=t.borderColor,d=u&&u.image,p=u&&!d,f=t.borderRadius,g=this;if(p||t.lineHeight||h&&c){(a=this._getOrCreateChild(Io)).useStyle(a.createStyle()),a.style.fill=null;var m=a.shape;m.x=i,m.y=n,m.width=r,m.height=o,m.r=f,a.dirtyShape()}if(p)(l=a.style).fill=u||null,l.fillOpacity=(0,X.retrieve2)(t.fillOpacity,1);else if(d){(s=this._getOrCreateChild(Lr)).onload=function(){g.dirtyStyle()};var v=s.style;v.image=u.image,v.x=i,v.y=n,v.width=r,v.height=o}h&&c&&((l=a.style).lineWidth=h,l.stroke=c,l.strokeOpacity=(0,X.retrieve2)(t.strokeOpacity,1),l.lineDash=t.borderDash,l.lineDashOffset=t.borderDashOffset||0,a.strokeContainThreshold=0,a.hasFill()&&a.hasStroke()&&(l.strokeFirst=!0,l.lineWidth*=2));var y=(a||s).style;y.shadowBlur=t.shadowBlur||0,y.shadowColor=t.shadowColor||"transparent",y.shadowOffsetX=t.shadowOffsetX||0,y.shadowOffsetY=t.shadowOffsetY||0,y.opacity=(0,X.retrieve3)(t.opacity,e.opacity,1)},e.makeFont=function(t){var e="";return Bo(t)&&(e=[t.fontStyle,t.fontWeight,Ro(t.fontSize),t.fontFamily||"sans-serif"].join(" ")),e&&(0,X.trim)(e)||t.textFont||t.font},e}(Mn),ko={left:!0,right:1,center:1},Eo={top:1,bottom:1,middle:1},No=["fontStyle","fontWeight","fontSize","fontFamily"];function Ro(t){return"string"!=typeof t||-1===t.indexOf("px")&&-1===t.indexOf("rem")&&-1===t.indexOf("em")?isNaN(+t)?Xi.n5+"px":t+"px":t}function zo(t,e){for(var i=0;il?xa(t,null==i[c+1]?null:i[c+1].elm,i,s,c):ba(t,e,a,l))}(i,n,r):ma(r)?(ma(t.text)&&pa(i,""),xa(i,null,r,0,r.length-1)):ma(n)?ba(i,n,0,n.length-1):ma(t.text)&&pa(i,""):t.text!==e.text&&(ma(n)&&ba(i,n,0,n.length-1),pa(i,e.text)))}function Ta(t){return parseInt(t,10)}function Ma(t,e,i){var n=["width","height"][e],r=["clientWidth","clientHeight"][e],o=["paddingLeft","paddingTop"][e],a=["paddingRight","paddingBottom"][e];if(null!=i[n]&&"auto"!==i[n])return parseFloat(i[n]);var s=document.defaultView.getComputedStyle(t);return(t[r]||Ta(s[n])||Ta(t.style[n]))-(Ta(s[o])||0)-(Ta(s[a])||0)|0}var Ca=0,Aa=function(){function t(t,e,i){if(this.type="svg",this.refreshHover=function(){0},this.configLayer=function(){0},this.storage=e,this._opts=i=(0,X.extend)({},i),this.root=t,this._id="zr"+Ca++,this._oldVNode=Kr(i.width,i.height),t&&!i.ssr){var n=this._viewport=document.createElement("div");n.style.cssText="position:relative;overflow:hidden";var r=this._svgDom=this._oldVNode.elm=jr("svg");wa(null,this._oldVNode),n.appendChild(r),t.appendChild(n)}this.resize(i.width,i.height)}return t.prototype.getType=function(){return this.type},t.prototype.getViewportRoot=function(){return this._viewport},t.prototype.getViewportRootOffset=function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},t.prototype.getSvgDom=function(){return this._svgDom},t.prototype.refresh=function(){if(this.root){var t=this.renderToVNode({willUpdate:!0});t.attrs.style="position:absolute;left:0;top:0;user-select:none",function(t,e){if(ya(t,e))Sa(t,e);else{var i=t.elm,n=ca(i);_a(e),null!==n&&(la(n,e.elm,da(i)),ba(n,[t],0,0))}}(this._oldVNode,t),this._oldVNode=t}},t.prototype.renderOneToVNode=function(t){return na(t,qr(this._id))},t.prototype.renderToVNode=function(t){t=t||{};var e=this.storage.getDisplayList(!0),i=this._width,n=this._height,r=qr(this._id);r.animation=t.animation,r.willUpdate=t.willUpdate,r.compress=t.compress;var o=[],a=this._bgVNode=function(t,e,i,n){var r;if(i&&"none"!==i)if(r=Xr("rect","bg",{width:t,height:e,x:"0",y:"0",id:"0"}),He(i))ra({fill:i},r.attrs,"fill",n);else if(Fe(i))oa({style:{fill:i},dirty:X.noop,getBoundingRect:function(){return{width:t,height:e}}},r.attrs,"fill",n);else{var o=ke(i),a=o.color,s=o.opacity;r.attrs.fill=a,s<1&&(r.attrs["fill-opacity"]=s)}return r}(i,n,this._backgroundColor,r);a&&o.push(a);var s=t.compress?null:this._mainVNode=Xr("g","main",{},[]);this._paintList(e,r,s?s.children:o),s&&o.push(s);var l=(0,X.map)((0,X.keys)(r.defs),(function(t){return r.defs[t]}));if(l.length&&o.push(Xr("defs","defs",{},l)),t.animation){var u=function(t,e,i){var n=(i=i||{}).newline?"\n":"",r=" {"+n,o=n+"}",a=(0,X.map)((0,X.keys)(t),(function(e){return e+r+(0,X.map)((0,X.keys)(t[e]),(function(i){return i+":"+t[e][i]+";"})).join(n)+o})).join(n),s=(0,X.map)((0,X.keys)(e),(function(t){return"@keyframes "+t+r+(0,X.map)((0,X.keys)(e[t]),(function(i){return i+r+(0,X.map)((0,X.keys)(e[t][i]),(function(n){var r=e[t][i][n];return"d"===n&&(r='path("'+r+'")'),n+":"+r+";"})).join(n)+o})).join(n)+o})).join(n);return a||s?[""].join(n):""}(r.cssNodes,r.cssAnims,{newline:!0});if(u){var h=Xr("style","stl",{},[],u);o.push(h)}}return Kr(i,n,o,t.useViewBox)},t.prototype.renderToString=function(t){return t=t||{},Yr(this.renderToVNode({animation:(0,X.retrieve2)(t.cssAnimation,!0),willUpdate:!1,compress:!0,useViewBox:(0,X.retrieve2)(t.useViewBox,!0)}),{newline:!0})},t.prototype.setBackgroundColor=function(t){this._backgroundColor=t},t.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},t.prototype._paintList=function(t,e,i){for(var n,r,o=t.length,a=[],s=0,l=0,u=0;u=0&&(!c||!r||c[f]!==r[f]);f--);for(var g=p-1;g>f;g--)n=a[--s-1];for(var m=f+1;m{let o="right";return r.viewSize[0]-t[0]"graph"===t.componentSubType?"edge"===t.dataType?e.utils.getLinkTooltipInfo(t.data):e.utils.getNodeTooltipInfo(t.data):"graphGL"===t.componentSubType?e.utils.getNodeTooltipInfo(t.data):"lines"===t.componentSubType?e.utils.getLinkTooltipInfo(t.data.link):e.utils.getNodeTooltipInfo(t.data.node)}},i.echartsOption);return n.setOption(e.utils.deepMergeObj(r,t)),n.on("click",(t=>{const n=i.onClickElement.bind(e);return"graph"===t.componentSubType?n("edge"===t.dataType?"link":"node",t.data):"graphGL"===t.componentSubType?n("node",t.data):"lines"===t.componentSubType?n("link",t.data.link):!t.data.cluster&&n("node",t.data.node)}),{passive:!0}),n}generateGraphOption(t,e){const i=[],n=e.config,r=t.nodes.map((t=>{const i=JSON.parse(JSON.stringify(t)),{nodeStyleConfig:r,nodeSizeConfig:o,nodeEmphasisConfig:a}=e.utils.getNodeStyle(t,n,"graph");return i.itemStyle=r,i.symbolSize=o,i.emphasis={itemStyle:a.nodeStyle,symbolSize:a.nodeSize},i.name="string"==typeof t.label?t.label:t.id,i})),o=t.links.map((t=>{const i=JSON.parse(JSON.stringify(t)),{linkStyleConfig:r,linkEmphasisConfig:o}=e.utils.getLinkStyle(t,n,"graph");return i.lineStyle=r,i.emphasis={lineStyle:o.linkStyle},i})),a=[Object.assign(n.graphConfig.series,{type:"graphGL"===n.graphConfig.series.type?"graphGL":"graph",layout:"graphGL"===n.graphConfig.series.type?"forceAtlas2":n.graphConfig.series.layout,nodes:r,links:o})];return{legend:i.length?{data:i}:void 0,series:a,...n.graphConfig.baseOptions}}generateMapOption(t,e,i=[]){const n=e.config,{nodes:r,links:o}=t,a=t.flatNodes||{},s=[];let l=[];r.forEach((i=>{if(i.properties){const{location:r}=i.properties;if(r&&r.lng&&r.lat){const{nodeStyleConfig:o,nodeSizeConfig:s,nodeEmphasisConfig:u}=e.utils.getNodeStyle(i,n,"map");l.push({name:"string"==typeof i.label?i.label:i.id,value:[r.lng,r.lat],symbolSize:s,itemStyle:o,emphasis:{itemStyle:u.nodeStyle,symbolSize:u.nodeSize},node:i}),t.flatNodes||(a[i.id]=JSON.parse(JSON.stringify(i)))}else console.error(`Node ${i.id} position is undefined!`)}else console.error(`Node ${i.id} position is undefined!`)})),o.forEach((t=>{if(a[t.source])if(a[t.target]){const{linkStyleConfig:i,linkEmphasisConfig:r}=e.utils.getLinkStyle(t,n,"map");s.push({coords:[[a[t.source].properties.location.lng,a[t.source].properties.location.lat],[a[t.target].properties.location.lng,a[t.target].properties.location.lat]],lineStyle:i,emphasis:{lineStyle:r.linkStyle},link:t})}else console.warn(`Node ${t.target} does not exist!`);else console.warn(`Node ${t.source} does not exist!`)})),l=l.concat(i);const u=[Object.assign(n.mapOptions.nodeConfig,{type:"effectScatter"===n.mapOptions.nodeConfig.type?"effectScatter":"scatter",coordinateSystem:"leaflet",data:l,animationDuration:1e3}),Object.assign(n.mapOptions.linkConfig,{type:"lines",coordinateSystem:"leaflet",data:s})];return{leaflet:{tiles:n.mapTileConfig,mapOptions:n.mapOptions},series:u,...n.mapOptions.baseOptions}}graphRender(t,e){e.utils.echartsSetOption(e.utils.generateGraphOption(t,e),e),window.onresize=()=>{e.echarts.resize()},e.event.emit("onLoad"),e.event.emit("onReady"),e.event.emit("renderArray")}mapRender(t,e){if(!e.config.mapTileConfig[0])throw new Error('You must add the tiles via the "mapTileConfig" param!');if("netjson"===e.type)e.utils.echartsSetOption(e.utils.generateMapOption(t,e),e),e.bboxData={nodes:[],links:[]};else if("geojson"===e.type){const{nodeConfig:t,linkConfig:i,baseOptions:n,...r}=e.config.mapOptions;e.echarts.setOption({leaflet:{tiles:e.config.mapTileConfig,mapOptions:r}}),e.bboxData={features:[]}}if(e.leaflet=e.echarts._api.getCoordinateSystems()[0].getLeaflet(),e.leaflet._zoomAnimated=!1,e.config.geoOptions=e.utils.deepMergeObj({pointToLayer:(t,i)=>I().circleMarker(i,e.config.geoOptions.style),onEachFeature:(t,i)=>{i.on("click",(()=>{const i={...t.properties};e.config.onClickElement.call(e,"Feature",i)}))}},e.config.geoOptions),"geojson"===e.type)if(e.leaflet.geoJSON=I().geoJSON(e.data,e.config.geoOptions),e.config.clustering){const t={showCoverageOnHover:!1,spiderfyOnMaxZoom:!1,maxClusterRadius:e.config.clusterRadius,disableClusteringAtZoom:e.config.disableClusteringAtLevel-1};if(e.config.clusteringAttribute){const i=new Set;e.data.features.forEach((t=>{i.add(t.properties[e.config.clusteringAttribute]||"default"),t.properties[e.config.clusteringAttribute]||(t.properties[e.config.clusteringAttribute]="default")}));const n=Array.from(i),r=[];n.forEach((i=>{const n=e.data.features.filter((t=>t.properties[e.config.clusteringAttribute]===i)),o=I().geoJSON({...e.data,features:n},e.config.geoOptions),a=I().markerClusterGroup({...t,iconCreateFunction:t=>{const e=t.getChildCount();return I().divIcon({html:`
    ${e}
    `,className:`marker-cluster ${i}`,iconSize:I().point(40,40)})}}).addTo(e.leaflet);r.push(a),a.addLayer(o)})),e.leaflet.clusterGroup=r}else e.leaflet.markerClusterGroup=I().markerClusterGroup(t).addTo(e.leaflet),e.leaflet.markerClusterGroup.addLayer(e.leaflet.geoJSON)}else e.leaflet.geoJSON.addTo(e.leaflet);if(e.leaflet.getZoom(){e.leaflet.getZoom()>=e.config.showLabelsAtZoomLevel?e.echarts.setOption({series:[{label:{show:!0}}]}):e.echarts.setOption({series:[{label:{show:!1}}]})})),e.leaflet.on("moveend",(async()=>{const i=e.leaflet.getBounds();if(e.leaflet.getZoom()>=e.config.loadMoreAtZoomLevel&&e.hasMoreData){const n=await e.utils.getBBoxData.call(e,e.JSONParam,i);if("netjson"===e.type){e.config.prepareData.call(this,n);const i=new Set(e.data.nodes.map((t=>t.id))),r=new Set(e.data.links.map((t=>t.source))),o=new Set(e.data.links.map((t=>t.target))),a=n.nodes.filter((t=>!i.has(t.id))),s=n.links.filter((t=>!r.has(t.source)&&!o.has(t.target))),l=new Set(n.nodes.map((t=>t.id))),u=e.bboxData.nodes.filter((t=>!l.has(t.id))),h=new Set(u.map((t=>t.id)));t.nodes=t.nodes.filter((t=>!h.has(t.id))),e.bboxData.nodes=e.bboxData.nodes.concat(a),e.bboxData.links=e.bboxData.links.concat(s),t={...t,nodes:t.nodes.concat(a),links:t.links.concat(s)},e.echarts.setOption(e.utils.generateMapOption(t,e)),e.data=t}else{const i=new Set(e.data.features),r=n.features.filter((t=>!i.has(t))),o=new Set(n.features),a=e.bboxData.features.filter((t=>!o.has(t))),s=new Set(a);t.features=t.features.filter((t=>!s.has(t))),e.bboxData.features=e.bboxData.features.concat(r),e.utils.appendData(r,e)}}else e.hasMoreData&&e.bboxData.nodes.length>0&&(()=>{if("netjson"===e.type){const i=new Set(e.bboxData.nodes),n=new Set(e.bboxData.links),r=t.nodes.filter((t=>!i.has(t))),o=t.links.filter((t=>!n.has(t)));t={...t,nodes:r,links:o},e.data=t,e.echarts.setOption(e.utils.generateMapOption(t,e)),e.bboxData.nodes=[],e.bboxData.links=[]}else{const i=new Set(e.bboxData.features),n=t.features.filter((t=>!i.has(t)));t={...t,features:n},e.utils.overrideData(t,e),e.bboxData.features=[]}})()})),"netjson"===e.type&&e.config.clustering&&e.config.clusteringThreshold{"scatter"!==r.componentSubType&&"effectScatter"!==r.componentSubType||!r.data.cluster||(n=n.concat(r.data.childNodes),i=i.filter((t=>t.id!==r.data.id)),e.echarts.setOption(e.utils.generateMapOption({...t,nodes:n},e,i)),e.leaflet.setView([r.data.value[1],r.data.value[0]]))})),e.leaflet.on("zoomend",(()=>{if(e.leaflet.getZoom(){e.echarts.appendData({seriesIndex:i,data:t.data})})),e.utils.mergeData(t,e)}"geojson"===e.type&&(e.data={...e.data,features:e.data.features.concat(t.features)},e.utils.render()),e.config.afterUpdate.call(e)}addData(t,e){e.utils.mergeData(t,e),e.utils.render(),e.config.afterUpdate.call(e)}mergeData(t,e){const i=e.data.nodes.concat(t.nodes),n=e.data.links.concat(t.links);Object.assign(e.data,t,{nodes:i,links:n})}}const Da=function(t,e){const{util:i,graphic:n,matrix:r}=t,o=e.Layer.extend({initialize(t){this._container=t},onAdd(t){t.getPane(this.options.pane).appendChild(this._container),t.zoomControl.setPosition("topright")},onRemove(){e.DomUtil.remove(this._container)},_update(){}});function a(t,i){this._map=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=i,this._projection=e.Projection.Mercator}function s(t,e,i,n){const{leafletModel:r,seriesModel:o}=i,a=r?r.coordinateSystem:o?o.coordinateSystem||(o.getReferringComponents("leaflet")[0]||{}).coordinateSystem:null;return a===this?a[t](n):null}return a.dimensions=["lng","lat"],a.prototype.dimensions=["lng","lat"],a.prototype.setZoom=function(t){this._zoom=t},a.prototype.setCenter=function(t){this._center=this._projection.project(new e.LatLng(t[1],t[0]))},a.prototype.setMapOffset=function(t){this._mapOffset=t},a.prototype.getLeaflet=function(){return this._map},a.prototype.getViewRect=function(){const t=this._api;return new n.BoundingRect(0,0,t.getWidth(),t.getHeight())},a.prototype.getRoamTransform=function(){return r.create()},a.prototype.dataToPoint=function(t){const i=new e.LatLng(t[1],t[0]),n=this._map.latLngToLayerPoint(i),r=this._mapOffset;return[n.x-r[0],n.y-r[1]]},a.prototype.pointToData=function(t){const e=this._mapOffset,i=this._map.layerPointToLatLng({x:t[0]+e[0],y:t[1]+e[1]});return[i.lng,i.lat]},a.prototype.convertToPixel=i.curry(s,"dataToPoint"),a.prototype.convertFromPixel=i.curry(s,"pointToData"),a.create=function(t,i){let n;const r=[],s=i.getDom();return t.eachComponent("leaflet",(t=>{const l=i.getZr().painter.getViewportRoot();if(void 0===e)throw new Error("Leaflet api is not loaded");if(n)throw new Error("Only one leaflet component can exist");if(!t.__map){let i=s.querySelector(".ec-extension-leaflet");i&&(l.style.left="0px",l.style.top="0px",s.removeChild(i)),i=document.createElement("div"),i.style.cssText="width:100%;height:100%",i.classList.add("ec-extension-leaflet"),s.appendChild(i),t.__map=e.map(i,t.get("mapOptions"));const n=t.__map,r=t.get("tiles"),a={};let u=!1;if(r.forEach((t=>{const i=e.tileLayer(t.urlTemplate,t.options);t.label?(u||(i.addTo(n),u=!0),a[t.label]=i):i.addTo(n)})),r.length>1){const i=t.get("layerControl");e.control.layers(a,{},i).addTo(n)}const h=document.createElement("div");h.style="position: absolute;left: 0;top: 0;z-index: 100",h.appendChild(l),new o(h).addTo(n)}const u=t.__map;n=new a(u,i),r.push(n),n.setMapOffset(t.__mapOffset||[0,0]);const{center:h,zoom:c}=t.get("mapOptions");h&&c&&(n.setZoom(c),n.setCenter(h)),t.coordinateSystem=n})),t.eachSeries((t=>{"leaflet"===t.get("coordinateSystem")&&(t.coordinateSystem=n)})),r},a};function Pa(t,e,i){!function(t){t.extendComponentModel({type:"leaflet",getLeaflet(){return this.__map},setCenterAndZoom(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged(t,e){const{option:i}=this;return n=t,r=i.center,!(n&&r&&n[0]===r[0]&&n[1]===r[1]&&e===i.zoom);var n,r},defaultOption:{mapOptions:{},tiles:[{urlTemplate:"http://{s}.tile.osm.org/{z}/{x}/{y}.png",options:{attribution:'© OpenStreetMap contributors'}}],layerControl:{}}})}(t),function(t,e){t.extendComponentView({type:"leaflet",render(e,i,n){let r=!0;const o=e.getLeaflet(),a=n.getZr().painter.getViewportRoot().parentNode,s=e.coordinateSystem,{roam:l}=e.get("mapOptions");function u(t){if(r)return;const i=o._mapPane;let l=i.style.transform,u=0,h=0;if(l){l=l.replace("translate3d(","");let t=l.split(",");u=-parseInt(t[0],10),h=-parseInt(t[1],10)}else u=-parseInt(i.style.left,10),h=-parseInt(i.style.top,10);let c=[u,h];a.style.left=`${c[0]}px`,a.style.top=`${c[1]}px`,s.setMapOffset(c),e.__mapOffset=c,n.dispatchAction({type:"leafletRoam",animation:{duration:0}})}function h(){r||n.dispatchAction({type:"leafletRoam"})}function c(){u()}function d(){t.getInstanceByDom(n.getDom()).resize()}l&&"scale"!==l?o.dragging.enable():o.dragging.disable(),l&&"move"!==l?(o.scrollWheelZoom.enable(),o.doubleClickZoom.enable(),o.touchZoom.enable()):(o.scrollWheelZoom.disable(),o.doubleClickZoom.disable(),o.touchZoom.disable()),this._oldMoveHandler&&o.off("move",this._oldMoveHandler),this._oldZoomHandler&&o.off("zoom",this._oldZoomHandler),this._oldZoomEndHandler&&o.off("zoomend",this._oldZoomEndHandler),this._oldResizeHandler&&o.off("resize",this._oldResizeHandler),o.on("move",u),o.on("zoom",c),o.on("zoomend",h),o.on("resize",d),this._oldMoveHandler=u,this._oldZoomHandler=c,this._oldZoomEndHandler=h,this._oldResizeHandler=d,r=!1}})}(t),t.registerCoordinateSystem("leaflet",Da(t,e)),t.registerAction({type:"leafletRoam",event:"leafletRoam",update:"updateLayout"},((t,e)=>{e.eachComponent("leaflet",(t=>{const e=t.getLeaflet(),i=e.getCenter();t.setCenterAndZoom([i.lng,i.lat],e.getZoom())}))}))}Pa.version="1.0.0";const Oa=Pa;const ka=class{constructor(t){this.self=t,this.renderModeSelector=null,this.controls=null,this.sideBar=null,this.metaInfoContainer=null,this.nodeLinkInfoContainer=null}createControls(){const t=document.createElement("div");return t.setAttribute("class","njg-controls"),this.self.el.appendChild(t),t}createRenderModeSelector(){const t=document.createElement("div"),e=document.createElement("span");return e.setAttribute("class","iconfont icon-eye"),t.setAttribute("class","njg-selectIcon"),t.appendChild(e),this.controls.appendChild(t),t}createSideBar(){const t=document.createElement("div");t.setAttribute("class","njg-sideBar"),t.classList.add("hidden");const e=document.createElement("button");return t.appendChild(e),e.classList.add("sideBarHandle"),e.onclick=()=>{t.classList.toggle("hidden");const e=document.querySelector(".njg-metaInfoContainer");(this.self.config.showMetaOnNarrowScreens||this.self.el.clientWidth>850)&&e&&(e.style.display="flex")},this.self.el.appendChild(t),t}hideInfoOnNarrowScreen(){!this.self.config.showMetaOnNarrowScreens&&this.self.el.clientWidth<850&&(this.metaInfoContainer.style.display="none"),"none"===this.metaInfoContainer.style.display&&"none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")}createMetaInfoContainer(){const t=document.createElement("div"),e=document.createElement("h2"),i=document.createElement("div");i.classList.add("njg-metaData"),t.classList.add("njg-metaInfoContainer");const n=document.createElement("span");return n.setAttribute("id","closeButton"),e.innerHTML="Info",n.innerHTML=" ✕",e.appendChild(n),t.appendChild(e),t.appendChild(i),this.metaInfoContainer=t,this.sideBar.appendChild(t),this.nodeLinkInfoContainer=this.createNodeLinkInfoContainer(),this.hideInfoOnNarrowScreen(),window.addEventListener("resize",this.hideInfoOnNarrowScreen.bind(this)),n.onclick=()=>{this.metaInfoContainer.style.display="none","none"===this.nodeLinkInfoContainer.style.display&&this.sideBar.classList.add("hidden")},t}createNodeLinkInfoContainer(){const t=document.createElement("div");return t.classList.add("njg-nodeLinkInfoContainer"),t.style.display="none",this.sideBar.appendChild(t),t}getNodeLinkInfo(t,e){const i=document.querySelectorAll(".njg-infoContainer"),n=document.querySelectorAll(".njg-headerContainer");for(let t=0;t{const i=document.createElement("div");i.classList.add("njg-infoItems");const n=document.createElement("span");n.setAttribute("class","njg-keyLabel");const r=document.createElement("span");r.setAttribute("class","njg-valueLabel"),"location"===t?(n.innerHTML="Location",r.innerHTML=`${Math.round(1e3*e[t].lat)/1e3}, ${Math.round(1e3*e[t].lng)/1e3}`):"localAddresses"===t?(n.innerHTML="Local Addresses",r.innerHTML=e[t].join("
    ")):(n.innerHTML=t,r.innerHTML=e[t]),i.appendChild(n),i.appendChild(r),o.appendChild(i)})),r.appendChild(a),r.appendChild(s),this.nodeLinkInfoContainer.appendChild(r),this.nodeLinkInfoContainer.appendChild(o),s.onclick=()=>{this.nodeLinkInfoContainer.style.display="none",null!==this.metaInfoContainer&&"none"!==this.metaInfoContainer.style.display||this.sideBar.classList.add("hidden")}}init(){this.sideBar=this.createSideBar(),this.self.config.switchMode&&(this.controls=this.createControls(),this.renderModeSelector=this.createRenderModeSelector())}},Ea=i(1092),{each:Na}=i(3051),Ra=i(6387);Oa(t,I(),{colorTool:Ea,each:Na,env:Ra}),window.NetJSONGraph=class{constructor(t,e){e&&"map"===e.render?e.render=Ia.prototype.mapRender:e&&e.render&&"graph"!==e.render||((e=e||{}).render=Ia.prototype.graphRender);const i=new p(t);return Object.setPrototypeOf(Ia.prototype,i.utils),i.gui=new ka(i),i.utils=new Ia,i.setUtils(),i.event=i.utils.createEvent(),i.setConfig({onInit(){return this.config},onRender(){return this.utils.showLoading.call(this),this.gui.init(),this.config},onUpdate(){return this.config},afterUpdate(){return this.config},onLoad(){return this.config.metadata&&"netjson"===this.type?(this.gui.createMetaInfoContainer(i),this.utils.updateMetadata.call(this)):this.gui.nodeLinkInfoContainer=this.gui.createNodeLinkInfoContainer(),this.config.switchMode&&"netjson"===this.type&&(this.gui.renderModeSelector.onclick=()=>{if(this.config.render===this.utils.mapRender){this.config.render=this.utils.graphRender;const t=this.echarts.getZr().painter.getViewportRoot().parentNode;this.echarts.clear(),this.utils.graphRender(this.data,this),t.style.background=this.echarts.getZr()._backgroundColor,document.querySelector(".leaflet-control-attribution").style.display="none",document.querySelector(".leaflet-control-zoom").style.display="none"}else this.echarts.clear(),this.config.render=this.utils.mapRender,this.utils.mapRender(this.data,this),document.querySelector(".leaflet-control-attribution").style.display="block",document.querySelector(".leaflet-control-zoom").style.display="block"}),this.utils.hideLoading.call(this),this.config},...e}),i.echarts=f.S1(i.el,null,{renderer:i.config.svgRender?"svg":"canvas"}),i.config.onInit.call(i),i}},window.echarts=t,window.L=I()})()})(); diff --git a/openwisp_monitoring/device/static/monitoring/js/percircle.min.js b/openwisp_monitoring/device/static/monitoring/js/lib/percircle.min.js similarity index 100% rename from openwisp_monitoring/device/static/monitoring/js/percircle.min.js rename to openwisp_monitoring/device/static/monitoring/js/lib/percircle.min.js diff --git a/openwisp_monitoring/device/static/monitoring/js/wifi-session-inline.js b/openwisp_monitoring/device/static/monitoring/js/wifi-session-inline.js index af51281a4..add627ed5 100644 --- a/openwisp_monitoring/device/static/monitoring/js/wifi-session-inline.js +++ b/openwisp_monitoring/device/static/monitoring/js/wifi-session-inline.js @@ -27,7 +27,7 @@ if (typeof gettext === 'undefined') { wifiSessionLinkElement; wifiSessionUrl = `${wifiSessionUrl}?device=${getObjectIdFromUrl()}`; wifiSessionLinkElement = ` -