commit debeb8773ca202e070f1b27ba120ca437445eb7a Author: yusups Date: Thu Oct 1 15:50:43 2026 +0700 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76be542 --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +# Python bytecode & cache +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python + +# Virtual Environment +venv/ +env/ +ENV/ +.env +.venv +env_kwh + +# Database lokal +*.sqlite3 +*.db +*.db-shm +*.db-wal + +# File Pengaturan Lokal / Rahasia +local_settings.py +db.sqlite3-journal + +# Media dan File Unggahan User +media/ +staticfiles/ +static_cdn/ + +# Log files +*.log +pip-log.txt + +# IDE & Editor (VS Code, PyCharm) +.vscode/ +.idea/ +*.swp +*.swo + +# OS generated files +.DS_Store +Thumbs.db + +settings.py + diff --git a/accounts/__init__.py b/accounts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/accounts/admin.py b/accounts/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/accounts/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/accounts/apps.py b/accounts/apps.py new file mode 100644 index 0000000..7e0ef53 --- /dev/null +++ b/accounts/apps.py @@ -0,0 +1,9 @@ +from django.apps import AppConfig + +class AccountsConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'accounts' + + def ready(self): + # Mendaftarkan file signals saat aplikasi Django siap dijalankan + import accounts.signals diff --git a/accounts/migrations/__init__.py b/accounts/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/accounts/models.py b/accounts/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/accounts/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/accounts/signals.py b/accounts/signals.py new file mode 100644 index 0000000..5241c86 --- /dev/null +++ b/accounts/signals.py @@ -0,0 +1,13 @@ +from django.db.models.signals import post_save +from django.dispatch import receiver +from django.contrib.auth.models import User + +@receiver(post_save, sender=User) +def deactivate_new_ldap_user(sender, instance, created, **kwargs): + # Jika user baru saja dibuat di database lokal dan dia adalah akun LDAP + # (ditandai dengan tidak adanya password lokal/usable password) + if created and not instance.has_usable_password(): + # Otomatis matikan keaktifannya agar statusnya menjadi "Menunggu Persetujuan" + instance.is_active = False + instance.save() + diff --git a/accounts/templates/accounts/login.html b/accounts/templates/accounts/login.html new file mode 100644 index 0000000..678bd01 --- /dev/null +++ b/accounts/templates/accounts/login.html @@ -0,0 +1,251 @@ +{% load static %} + + + + + + Login - MONITORING ENERGY PT PRIMA LESTARI NUSANTARA + + + + + + +
+ + +
+ +
+ PT. FRINA LESTARI NUSANTARA +

MONITORING ENERGY

+

Sistem Informasi Pengawasan Distribusi Daya & Monitoring Real-time parameter listrik berbasis Web.

+
+
+ + +
+

Sign In

+ + + {% if messages %} +
+ {% for message in messages %} +
• {{ message }}
+ {% endfor %} +
+ {% endif %} + +
+ {% csrf_token %} +
+ + +
+
+ + +
+ +
+
+ +
+ + + diff --git a/accounts/tests.py b/accounts/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/accounts/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/accounts/urls.py b/accounts/urls.py new file mode 100644 index 0000000..b75a112 --- /dev/null +++ b/accounts/urls.py @@ -0,0 +1,13 @@ +from django.urls import path +from .views import login_view, logout_view, user_management_view, toggle_user_role + +urlpatterns = [ + # UBAH BARIS INI (Hapus 'login/' menjadi '') + path('', login_view, name='login'), + + path('logout/', logout_view, name='logout'), + + # Route baru untuk User Accounts + path('users/', user_management_view, name='user_management'), + path('users/toggle-role//', toggle_user_role, name='toggle_user_role'), +] diff --git a/accounts/views.py b/accounts/views.py new file mode 100644 index 0000000..50cf6bd --- /dev/null +++ b/accounts/views.py @@ -0,0 +1,87 @@ +from django.shortcuts import render, redirect, get_object_or_404 +from django.contrib.auth import authenticate, login, logout +from django.contrib.auth.models import User +from django.contrib.auth.decorators import login_required, user_passes_test +from django.views.decorators.csrf import csrf_exempt +from django.contrib import messages + +def login_view(request): + # Jika user sudah login, langsung lempar ke dashboard + if request.user.is_authenticated: + return redirect('dashboard') + + if request.method == 'POST': + username_input = request.POST.get('username') + password_input = request.POST.get('password') + + # authenticate() akan mencoba LDAP Backend dulu, jika gagal/error akan dilanjutkan ke ModelBackend Lokal + user = authenticate(request, username=username_input, password=password_input) + + if user is not None: + # 📌 VALIDASI BARU: Cek apakah user berstatus aktif (Sudah di-accept oleh Admin) + if not user.is_active: + messages.error(request, "Akun Anda berhasil terdaftar. Harap tunggu persetujuan dari Departmen IT sebelum dapat masuk.") + return render(request, 'accounts/login.html') + + login(request, user) + return redirect('dashboard') + else: + messages.error(request, "Username atau Password salah, atau akun LDAP Anda kedaluwarsa.") + + return render(request, 'accounts/login.html') + +@csrf_exempt +def logout_view(request): + logout(request) + return redirect('login') + +# ------------------------------------------------------------------- +# KODE UNTUK HALAMAN USER ACCOUNTS +# ------------------------------------------------------------------- + +def is_admin(user): + return user.is_superuser or user.is_staff + +@login_required +@user_passes_test(is_admin) +def user_management_view(request): + users = User.objects.all().order_by('-date_joined') + + for user in users: + # Cek tipe akun: User LDAP tidak memiliki password terenkripsi usable di DB Django + if not user.has_usable_password(): + user.account_type = "LDAP" + else: + user.account_type = "Lokal" + + return render(request, 'dashboard/user_accounts.html', {'users_list': users}) + +@login_required +@user_passes_test(is_admin) +def toggle_user_role(request, user_id): + if request.method == "POST": + target_user = get_object_or_404(User, id=user_id) + + # Mencegah pengguna mengubah role dirinya sendiri + if target_user == request.user: + messages.error(request, "Anda tidak bisa mengubah role akun Anda sendiri!") + return redirect('user_management') + + role = request.POST.get('role') + + # 📌 AKSI BARU: Menerima/Mengaktifkan User LDAP Baru + if role == 'accept': + target_user.is_active = True + messages.success(request, f"Akun {target_user.username} telah disetujui dan berhasil diaktifkan.") + elif role == 'admin': + target_user.is_staff = True + target_user.is_superuser = True + messages.success(request, f"Role {target_user.username} berhasil diubah menjadi Administrator.") + else: + target_user.is_staff = False + target_user.is_superuser = False + messages.success(request, f"Role {target_user.username} berhasil diubah menjadi User Biasa.") + + target_user.save() + + return redirect('user_management') \ No newline at end of file diff --git a/collector.py b/collector.py new file mode 100644 index 0000000..ba78fee --- /dev/null +++ b/collector.py @@ -0,0 +1,44 @@ +import os +import django +import time +from pymodbus.client import ModbusTcpClient + +# Setup Environment Django +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') +django.setup() + +from dashboard.models import KwhReadings + +# Sesuaikan dengan IP ESP32 Anda +ESP32_IP = '192.168.1.100' +PORT = 502 + +def fetch_data(): + client = ModbusTcpClient(ESP32_IP, port=PORT) + if client.connect(): + # Membaca 4 register dari ESP32 + result = client.read_holding_registers(address=0, count=4, slave=1) + if not result.isError(): + v = result.registers[0] / 10.0 + i = result.registers[1] / 100.0 + p = result.registers[2] / 1000.0 + kwh = result.registers[3] / 10.0 + + KwhReadings.objects.create( + voltage=v, + current=i, + active_power=p, + total_energy=kwh + ) + print(f"[BERHASIL SIMPAN] V: {v}V | I: {i}A | P: {p}kW | Energy: {kwh}kWh") + else: + print("[ERROR] Gagal membaca register Modbus") + client.close() + else: + print(f"[ERROR] Tidak dapat terhubung ke ESP32 di IP: {ESP32_IP}") + +if __name__ == '__main__': + print("Menjalankan Modbus Collector...") + while True: + fetch_data() + time.sleep(5) \ No newline at end of file diff --git a/config/__init__.py b/config/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/config/asgi.py b/config/asgi.py new file mode 100644 index 0000000..787b362 --- /dev/null +++ b/config/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for config project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') + +application = get_asgi_application() diff --git a/config/urls.py b/config/urls.py new file mode 100644 index 0000000..c3ea487 --- /dev/null +++ b/config/urls.py @@ -0,0 +1,52 @@ +from django.contrib import admin +from django.urls import path, include +from dashboard import views as dashboard_views + + +urlpatterns = [ + path('admin/', admin.site.urls), + + # ─── DASHBOARD UTAMA ─── + path('', dashboard_views.dashboard_view, name='dashboard'), + + # ─── API DATA KWH (ESP32 & Realtime) ─── + path('api/data/', dashboard_views.api_latest_data, name='api_data'), + path('api/kwh/push/', dashboard_views.receive_kwh_data, name='receive_kwh_data'), + + # ─── LOG KWH & EXPORT ─── + path('log-kwh/', dashboard_views.log_kwh_view, name='log_kwh'), + path('api/log-data/', dashboard_views.api_log_data, name='api_log_data'), + path('api/export-excel/', dashboard_views.export_kwh_excel, name='export_kwh_excel'), + + # ─── ANALISIS GRAFIK ─── + path('analisis-grafik/', dashboard_views.analisis_grafik_view, name='analisis_grafik'), + path('api/analysis-data/', dashboard_views.api_analysis_data, name='api_analysis_data'), + path('api/export-analysis-excel/', dashboard_views.export_analysis_excel, name='export_analysis_excel'), + + # ─── AUTENTIKASI / ACCOUNTS ─── + path('accounts/', include('accounts.urls')), + path('login/', include('accounts.urls')), + + # ─── MANAJEMEN MESIN & AREA ─── + path('manajemen-mesin/', dashboard_views.manajemen_mesin_view, name='manajemen_mesin'), + path('api/mesin/add/', dashboard_views.add_mesin_api, name='add_mesin_api'), + path('api/area/add/', dashboard_views.add_area_api, name='add_area_api'), + path('dashboard/mesin/update-keterangan//', dashboard_views.update_keterangan_view, name='update_keterangan'), + + # ─── REPORT PER AREA ─── + path('report-per-area/', dashboard_views.report_per_area_view, name='report_per_area'), + path('api/report-area-data/', dashboard_views.api_report_per_area, name='api_report_area_data'), + path('api/export-excel-area/', dashboard_views.export_report_area_excel, name='export_report_area_excel'), + + # ─── REPORT ALL (SELURUH AREA) ─── + path('report-all/', dashboard_views.report_all_view, name='report_all'), + path('api/report-all-data/', dashboard_views.api_report_all_data, name='api_report_all_data'), + + # Jalur routing baru untuk update status mesin + path('dashboard/mesin/update-status//', dashboard_views.update_status_view, name='update_status_mesin'), + + + + + +] diff --git a/config/wsgi.py b/config/wsgi.py new file mode 100644 index 0000000..8ae71e3 --- /dev/null +++ b/config/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for config project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') + +application = get_wsgi_application() diff --git a/dashboard/__init__.py b/dashboard/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dashboard/admin.py b/dashboard/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/dashboard/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/dashboard/apps.py b/dashboard/apps.py new file mode 100644 index 0000000..7b1cc05 --- /dev/null +++ b/dashboard/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DashboardConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'dashboard' diff --git a/dashboard/context_processors.py b/dashboard/context_processors.py new file mode 100644 index 0000000..b9ea0cf --- /dev/null +++ b/dashboard/context_processors.py @@ -0,0 +1,8 @@ +# dashboard/context_processors.py +from .models import Mesin + +def daftar_mesin_global(request): + # Mengambil semua mesin beserta data area-nya + return { + 'mesin_global_list': Mesin.objects.select_related('area').all().order_by('nama_mesin') + } \ No newline at end of file diff --git a/dashboard/middleware.py b/dashboard/middleware.py new file mode 100644 index 0000000..cab0bc1 --- /dev/null +++ b/dashboard/middleware.py @@ -0,0 +1,32 @@ +from django.shortcuts import redirect +from django.urls import reverse + +class LoginRequiredMiddleware: + def __init__(self, get_response): + self.get_response = get_response + + def __call__(self, request): + # 1. Ambil nama jalur URL yang sedang diakses saat ini + # Contoh: jika akses '/login/', request.path adalah '/login/' + current_path = request.path + + # 2. Bikin daftar "Pengecualian" (Alamat yang bebas diakses tanpa login) + # Kita bebaskan halaman login, logout, dan jalur data ESP32 + exempt_urls = [ + reverse('login'), # Alamat halaman login Anda + '/accounts/logout/', # Alamat logout + '/api/kwh/push/', # 📌 PENTING: Jalur ESP32 kirim data agar tidak diblokir + ] + + # 3. Jalankan logika pemeriksaan satpam + # Jika user BELUM login, DAN alamat yang dituju TIDAK ADA di daftar bebas masuk + if not request.user.is_authenticated: + # Pengecekan tambahan: pastikan path saat ini tidak diawali dengan alamat exempt_urls + if not any(current_path.startswith(url) for url in exempt_urls): + # Paksa pindahkan halaman browser ke halaman login + return redirect('login') + + # Jika lolos pemeriksaan di atas, izinkan request berlanjut ke halaman tujuan + response = self.get_response(request) + return response + diff --git a/dashboard/migrations/0001_initial.py b/dashboard/migrations/0001_initial.py new file mode 100644 index 0000000..482d72d --- /dev/null +++ b/dashboard/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 4.2.30 on 2026-08-20 02:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='KwhReadings', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('timestamp', models.DateTimeField(auto_now_add=True)), + ('voltage', models.FloatField(help_text='Tegangan (V)')), + ('current', models.FloatField(help_text='Arus (A)')), + ('active_power', models.FloatField(help_text='Daya Aktif (kW)')), + ('total_energy', models.FloatField(help_text='Total kWh')), + ], + options={ + 'ordering': ['-timestamp'], + }, + ), + ] diff --git a/dashboard/migrations/0002_alter_kwhreadings_options_and_more.py b/dashboard/migrations/0002_alter_kwhreadings_options_and_more.py new file mode 100644 index 0000000..53306d2 --- /dev/null +++ b/dashboard/migrations/0002_alter_kwhreadings_options_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.30 on 2026-08-31 08:21 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='kwhreadings', + options={}, + ), + migrations.AddIndex( + model_name='kwhreadings', + index=models.Index(fields=['-id'], name='dashboard_k_id_6c2fc9_idx'), + ), + migrations.AddIndex( + model_name='kwhreadings', + index=models.Index(fields=['-timestamp'], name='dashboard_k_timesta_992091_idx'), + ), + ] diff --git a/dashboard/migrations/0003_remove_kwhreadings_active_power_and_more.py b/dashboard/migrations/0003_remove_kwhreadings_active_power_and_more.py new file mode 100644 index 0000000..c4af2e1 --- /dev/null +++ b/dashboard/migrations/0003_remove_kwhreadings_active_power_and_more.py @@ -0,0 +1,59 @@ +# Generated by Django 4.2.30 on 2026-09-01 15:09 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0002_alter_kwhreadings_options_and_more'), + ] + + operations = [ + migrations.RemoveField( + model_name='kwhreadings', + name='active_power', + ), + migrations.RemoveField( + model_name='kwhreadings', + name='current', + ), + migrations.RemoveField( + model_name='kwhreadings', + name='total_energy', + ), + migrations.RemoveField( + model_name='kwhreadings', + name='voltage', + ), + migrations.AddField( + model_name='kwhreadings', + name='active_power_kwh', + field=models.FloatField(default=0, help_text='Total kWh Accumulation'), + preserve_default=False, + ), + migrations.AddField( + model_name='kwhreadings', + name='apparent_power_va', + field=models.FloatField(default=0, help_text='Apparent Power / Voltage (VA)'), + preserve_default=False, + ), + migrations.AddField( + model_name='kwhreadings', + name='power_factor', + field=models.FloatField(default=0, help_text='Power Factor'), + preserve_default=False, + ), + migrations.AddField( + model_name='kwhreadings', + name='real_active_power_kw', + field=models.FloatField(default=0, help_text='Calculated Active Power (kW)'), + preserve_default=False, + ), + migrations.AddField( + model_name='kwhreadings', + name='total_current_a', + field=models.FloatField(default=0, help_text='Total Current (A)'), + preserve_default=False, + ), + ] diff --git a/dashboard/migrations/0004_mesin.py b/dashboard/migrations/0004_mesin.py new file mode 100644 index 0000000..54f4d04 --- /dev/null +++ b/dashboard/migrations/0004_mesin.py @@ -0,0 +1,22 @@ +# Generated by Django 4.2.30 on 2026-09-04 15:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0003_remove_kwhreadings_active_power_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='Mesin', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nama_mesin', models.CharField(max_length=100)), + ('keterangan', models.TextField(blank=True, null=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + ] diff --git a/dashboard/migrations/0005_mesin_token.py b/dashboard/migrations/0005_mesin_token.py new file mode 100644 index 0000000..7d8f1cd --- /dev/null +++ b/dashboard/migrations/0005_mesin_token.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.30 on 2026-09-08 16:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0004_mesin'), + ] + + operations = [ + migrations.AddField( + model_name='mesin', + name='token', + field=models.CharField(blank=True, max_length=64, null=True, unique=True), + ), + ] diff --git a/dashboard/migrations/0006_area_mesin_area.py b/dashboard/migrations/0006_area_mesin_area.py new file mode 100644 index 0000000..4c6d488 --- /dev/null +++ b/dashboard/migrations/0006_area_mesin_area.py @@ -0,0 +1,28 @@ +# Generated by Django 4.2.30 on 2026-09-09 14:09 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0005_mesin_token'), + ] + + operations = [ + migrations.CreateModel( + name='Area', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nama_area', models.CharField(max_length=100, unique=True)), + ('keterangan', models.TextField(blank=True, null=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.AddField( + model_name='mesin', + name='area', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mesin_list', to='dashboard.area'), + ), + ] diff --git a/dashboard/migrations/0007_kwhreadings_mesin.py b/dashboard/migrations/0007_kwhreadings_mesin.py new file mode 100644 index 0000000..0ef4958 --- /dev/null +++ b/dashboard/migrations/0007_kwhreadings_mesin.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.30 on 2026-09-15 15:17 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0006_area_mesin_area'), + ] + + operations = [ + migrations.AddField( + model_name='kwhreadings', + name='mesin', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='readings', to='dashboard.mesin'), + ), + ] diff --git a/dashboard/migrations/0008_kwhreadings_dashboard_k_mesin_i_2c713b_idx.py b/dashboard/migrations/0008_kwhreadings_dashboard_k_mesin_i_2c713b_idx.py new file mode 100644 index 0000000..65f551f --- /dev/null +++ b/dashboard/migrations/0008_kwhreadings_dashboard_k_mesin_i_2c713b_idx.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.30 on 2026-09-16 09:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0007_kwhreadings_mesin'), + ] + + operations = [ + migrations.AddIndex( + model_name='kwhreadings', + index=models.Index(fields=['mesin', '-id'], name='dashboard_k_mesin_i_2c713b_idx'), + ), + ] diff --git a/dashboard/migrations/0009_mesin_status.py b/dashboard/migrations/0009_mesin_status.py new file mode 100644 index 0000000..b2a5c62 --- /dev/null +++ b/dashboard/migrations/0009_mesin_status.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.30 on 2026-09-28 10:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0008_kwhreadings_dashboard_k_mesin_i_2c713b_idx'), + ] + + operations = [ + migrations.AddField( + model_name='mesin', + name='status', + field=models.CharField(blank=True, default='normal', max_length=20, null=True), + ), + ] diff --git a/dashboard/migrations/__init__.py b/dashboard/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dashboard/models.py b/dashboard/models.py new file mode 100644 index 0000000..8763508 --- /dev/null +++ b/dashboard/models.py @@ -0,0 +1,66 @@ +from django.db import models + +# 1. MODEL AREA (Lokasi penempatan mesin-mesin) +class Area(models.Model): + nama_area = models.CharField(max_length=100, unique=True) + keterangan = models.TextField(blank=True, null=True) + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.nama_area + + +# 2. MODEL MESIN (Identitas perangkat web & hardware ESP32) +class Mesin(models.Model): + nama_mesin = models.CharField(max_length=100) + area = models.ForeignKey( + Area, + on_delete=models.SET_NULL, + null=True, + blank=True, + related_name='mesin_list', + ) + keterangan = models.TextField(blank=True, null=True) + token = models.CharField(max_length=64, unique=True, blank=True, null=True) + created_at = models.DateTimeField(auto_now_add=True) + + # KONDISI STATUS MESIN: Aman untuk data lama karena mengizinkan NULL + status = models.CharField(max_length=20, null=True, blank=True, default='normal') + + def __str__(self): + return self.nama_mesin + + +# 3. MODEL KWH READINGS (Penyimpanan data log sensor dari ESP32) +class KwhReadings(models.Model): + # RELASI: Menghubungkan log data secara otomatis ke ID Mesin terkait + mesin = models.ForeignKey( + Mesin, + on_delete=models.CASCADE, # Jika mesin dihapus, log datanya otomatis bersih + related_name='readings', + null=True, + blank=True + ) + timestamp = models.DateTimeField(auto_now_add=True) + + # ─── PENAMAAN SESUAI PENGIRIMAN ESP32 (BAHASA INGGRIS) ─── + apparent_power_va = models.FloatField(help_text="Apparent Power / Voltage (VA)") + total_current_a = models.FloatField(help_text="Total Current (A)") + power_factor = models.FloatField(help_text="Power Factor") + active_power_kwh = models.FloatField(help_text="Total kWh Accumulation") + + # Kolom hasil kalkulasi matematika backend Django (Daya Aktif Sesaat) + real_active_power_kw = models.FloatField(help_text="Calculated Active Power (kW)") + + class Meta: + # Indexing tingkat lanjut agar database tetap kencang dan query instan + indexes = [ + models.Index(fields=['mesin', '-id']), + models.Index(fields=['-id']), + models.Index(fields=['-timestamp']), + ] + + def __str__(self): + nama_perangkat = self.mesin.nama_mesin if self.mesin else "Tanpa Perangkat" + waktu = self.timestamp.strftime('%Y-%m-%d %H:%M:%S') + return f"{nama_perangkat} | {waktu} - {self.real_active_power_kw} kW" diff --git a/dashboard/static/css/flatpickr.min.css b/dashboard/static/css/flatpickr.min.css new file mode 100644 index 0000000..a10acc6 --- /dev/null +++ b/dashboard/static/css/flatpickr.min.css @@ -0,0 +1,13 @@ +.flatpickr-calendar{background:transparent;opacity:0;display:none;text-align:center;visibility:hidden;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08)}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;max-height:640px;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px)}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none !important;box-shadow:none !important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.arrowRight:before,.flatpickr-calendar.rightMost:after,.flatpickr-calendar.arrowRight:after{left:auto;right:22px}.flatpickr-calendar.arrowCenter:before,.flatpickr-calendar.arrowCenter:after{left:50%;right:50%}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-months{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-months .flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:34px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;cursor:pointer;position:absolute;top:0;height:34px;padding:10px;z-index:3;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9)}.flatpickr-months .flatpickr-prev-month.flatpickr-disabled,.flatpickr-months .flatpickr-next-month.flatpickr-disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{/* + /*rtl:begin:ignore*/left:0/* + /*rtl:end:ignore*/}/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,.flatpickr-months .flatpickr-next-month.flatpickr-next-month{/* + /*rtl:begin:ignore*/right:0/* + /*rtl:end:ignore*/}/* + /*rtl:begin:ignore*/ +/* + /*rtl:end:ignore*/ +.flatpickr-months .flatpickr-prev-month:hover,.flatpickr-months .flatpickr-next-month:hover{color:#959ea9}.flatpickr-months .flatpickr-prev-month:hover svg,.flatpickr-months .flatpickr-next-month:hover svg{fill:#f64747}.flatpickr-months .flatpickr-prev-month svg,.flatpickr-months .flatpickr-next-month svg{width:14px;height:14px}.flatpickr-months .flatpickr-prev-month svg path,.flatpickr-months .flatpickr-next-month svg path{-webkit-transition:fill .1s;transition:fill .1s;fill:inherit}.numInputWrapper{position:relative;height:auto}.numInputWrapper input,.numInputWrapper span{display:inline-block}.numInputWrapper input{width:100%}.numInputWrapper input::-ms-clear{display:none}.numInputWrapper input::-webkit-outer-spin-button,.numInputWrapper input::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}.numInputWrapper span{position:absolute;right:0;width:14px;padding:0 4px 0 2px;height:50%;line-height:50%;opacity:0;cursor:pointer;border:1px solid rgba(57,57,57,0.15);-webkit-box-sizing:border-box;box-sizing:border-box}.numInputWrapper span:hover{background:rgba(0,0,0,0.1)}.numInputWrapper span:active{background:rgba(0,0,0,0.2)}.numInputWrapper span:after{display:block;content:"";position:absolute}.numInputWrapper span.arrowUp{top:0;border-bottom:0}.numInputWrapper span.arrowUp:after{border-left:4px solid transparent;border-right:4px solid transparent;border-bottom:4px solid rgba(57,57,57,0.6);top:26%}.numInputWrapper span.arrowDown{top:50%}.numInputWrapper span.arrowDown:after{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid rgba(57,57,57,0.6);top:40%}.numInputWrapper span svg{width:inherit;height:auto}.numInputWrapper span svg path{fill:rgba(0,0,0,0.5)}.numInputWrapper:hover{background:rgba(0,0,0,0.05)}.numInputWrapper:hover span{opacity:1}.flatpickr-current-month{font-size:135%;line-height:inherit;font-weight:300;color:inherit;position:absolute;width:75%;left:12.5%;padding:7.48px 0 0 0;line-height:1;height:34px;display:inline-block;text-align:center;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.flatpickr-current-month span.cur-month{font-family:inherit;font-weight:700;color:inherit;display:inline-block;margin-left:.5ch;padding:0}.flatpickr-current-month span.cur-month:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .numInputWrapper{width:6ch;width:7ch\0;display:inline-block}.flatpickr-current-month .numInputWrapper span.arrowUp:after{border-bottom-color:rgba(0,0,0,0.9)}.flatpickr-current-month .numInputWrapper span.arrowDown:after{border-top-color:rgba(0,0,0,0.9)}.flatpickr-current-month input.cur-year{background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;color:inherit;cursor:text;padding:0 0 0 .5ch;margin:0;display:inline-block;font-size:inherit;font-family:inherit;font-weight:300;line-height:inherit;height:auto;border:0;border-radius:0;vertical-align:initial;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-current-month input.cur-year:focus{outline:0}.flatpickr-current-month input.cur-year[disabled],.flatpickr-current-month input.cur-year[disabled]:hover{font-size:100%;color:rgba(0,0,0,0.5);background:transparent;pointer-events:none}.flatpickr-current-month .flatpickr-monthDropdown-months{appearance:menulist;background:transparent;border:none;border-radius:0;box-sizing:border-box;color:inherit;cursor:pointer;font-size:inherit;font-family:inherit;font-weight:300;height:auto;line-height:inherit;margin:-1px 0 0 0;outline:none;padding:0 0 0 .5ch;position:relative;vertical-align:initial;-webkit-box-sizing:border-box;-webkit-appearance:menulist;-moz-appearance:menulist;width:auto}.flatpickr-current-month .flatpickr-monthDropdown-months:focus,.flatpickr-current-month .flatpickr-monthDropdown-months:active{outline:none}.flatpickr-current-month .flatpickr-monthDropdown-months:hover{background:rgba(0,0,0,0.05)}.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month{background-color:transparent;outline:none;padding:0}.flatpickr-weekdays{background:transparent;text-align:center;overflow:hidden;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:28px}.flatpickr-weekdays .flatpickr-weekdaycontainer{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}span.flatpickr-weekday{cursor:default;font-size:90%;background:transparent;color:rgba(0,0,0,0.54);line-height:1;margin:0;text-align:center;display:block;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;font-weight:bolder}.dayContainer,.flatpickr-weeks{padding:1px 0 0 0}.flatpickr-days{position:relative;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;width:307.875px}.flatpickr-days:focus{outline:0}.dayContainer{padding:0;outline:0;text-align:left;width:307.875px;min-width:307.875px;max-width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;display:-ms-flexbox;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-wrap:wrap;-ms-flex-pack:justify;-webkit-justify-content:space-around;justify-content:space-around;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);opacity:1}.dayContainer + .dayContainer{-webkit-box-shadow:-1px 0 0 #e6e6e6;box-shadow:-1px 0 0 #e6e6e6}.flatpickr-day{background:none;border:1px solid transparent;border-radius:150px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#393939;cursor:pointer;font-weight:400;width:14.2857143%;-webkit-flex-basis:14.2857143%;-ms-flex-preferred-size:14.2857143%;flex-basis:14.2857143%;max-width:39px;height:39px;line-height:39px;margin:0;display:inline-block;position:relative;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center}.flatpickr-day.inRange,.flatpickr-day.prevMonthDay.inRange,.flatpickr-day.nextMonthDay.inRange,.flatpickr-day.today.inRange,.flatpickr-day.prevMonthDay.today.inRange,.flatpickr-day.nextMonthDay.today.inRange,.flatpickr-day:hover,.flatpickr-day.prevMonthDay:hover,.flatpickr-day.nextMonthDay:hover,.flatpickr-day:focus,.flatpickr-day.prevMonthDay:focus,.flatpickr-day.nextMonthDay:focus{cursor:pointer;outline:0;background:#e6e6e6;border-color:#e6e6e6}.flatpickr-day.today{border-color:#959ea9}.flatpickr-day.today:hover,.flatpickr-day.today:focus{border-color:#959ea9;background:#959ea9;color:#fff}.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange,.flatpickr-day.selected.inRange,.flatpickr-day.startRange.inRange,.flatpickr-day.endRange.inRange,.flatpickr-day.selected:focus,.flatpickr-day.startRange:focus,.flatpickr-day.endRange:focus,.flatpickr-day.selected:hover,.flatpickr-day.startRange:hover,.flatpickr-day.endRange:hover,.flatpickr-day.selected.prevMonthDay,.flatpickr-day.startRange.prevMonthDay,.flatpickr-day.endRange.prevMonthDay,.flatpickr-day.selected.nextMonthDay,.flatpickr-day.startRange.nextMonthDay,.flatpickr-day.endRange.nextMonthDay{background:#569ff7;-webkit-box-shadow:none;box-shadow:none;color:#fff;border-color:#569ff7}.flatpickr-day.selected.startRange,.flatpickr-day.startRange.startRange,.flatpickr-day.endRange.startRange{border-radius:50px 0 0 50px}.flatpickr-day.selected.endRange,.flatpickr-day.startRange.endRange,.flatpickr-day.endRange.endRange{border-radius:0 50px 50px 0}.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)){-webkit-box-shadow:-10px 0 0 #569ff7;box-shadow:-10px 0 0 #569ff7}.flatpickr-day.selected.startRange.endRange,.flatpickr-day.startRange.startRange.endRange,.flatpickr-day.endRange.startRange.endRange{border-radius:50px}.flatpickr-day.inRange{border-radius:0;-webkit-box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-5px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover,.flatpickr-day.prevMonthDay,.flatpickr-day.nextMonthDay,.flatpickr-day.notAllowed,.flatpickr-day.notAllowed.prevMonthDay,.flatpickr-day.notAllowed.nextMonthDay{color:rgba(57,57,57,0.3);background:transparent;border-color:transparent;cursor:default}.flatpickr-day.flatpickr-disabled,.flatpickr-day.flatpickr-disabled:hover{cursor:not-allowed;color:rgba(57,57,57,0.1)}.flatpickr-day.week.selected{border-radius:0;-webkit-box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7;box-shadow:-5px 0 0 #569ff7,5px 0 0 #569ff7}.flatpickr-day.hidden{visibility:hidden}.rangeMode .flatpickr-day{margin-top:1px}.flatpickr-weekwrapper{float:left}.flatpickr-weekwrapper .flatpickr-weeks{padding:0 12px;-webkit-box-shadow:1px 0 0 #e6e6e6;box-shadow:1px 0 0 #e6e6e6}.flatpickr-weekwrapper .flatpickr-weekday{float:none;width:100%;line-height:28px}.flatpickr-weekwrapper span.flatpickr-day,.flatpickr-weekwrapper span.flatpickr-day:hover{display:block;width:100%;max-width:none;color:rgba(57,57,57,0.3);background:transparent;cursor:default;border:none}.flatpickr-innerContainer{display:block;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}.flatpickr-rContainer{display:inline-block;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.flatpickr-time{text-align:center;outline:0;display:block;height:0;line-height:40px;max-height:40px;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-time:after{content:"";display:table;clear:both}.flatpickr-time .numInputWrapper{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:40%;height:40px;float:left}.flatpickr-time .numInputWrapper span.arrowUp:after{border-bottom-color:#393939}.flatpickr-time .numInputWrapper span.arrowDown:after{border-top-color:#393939}.flatpickr-time.hasSeconds .numInputWrapper{width:26%}.flatpickr-time.time24hr .numInputWrapper{width:49%}.flatpickr-time input{background:transparent;-webkit-box-shadow:none;box-shadow:none;border:0;border-radius:0;text-align:center;margin:0;padding:0;height:inherit;line-height:inherit;color:#393939;font-size:14px;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.flatpickr-time input.flatpickr-hour{font-weight:bold}.flatpickr-time input.flatpickr-minute,.flatpickr-time input.flatpickr-second{font-weight:400}.flatpickr-time input:focus{outline:0;border:0}.flatpickr-time .flatpickr-time-separator,.flatpickr-time .flatpickr-am-pm{height:inherit;float:left;line-height:inherit;color:#393939;font-weight:bold;width:2%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.flatpickr-time .flatpickr-am-pm{outline:0;width:18%;cursor:pointer;text-align:center;font-weight:400}.flatpickr-time input:hover,.flatpickr-time .flatpickr-am-pm:hover,.flatpickr-time input:focus,.flatpickr-time .flatpickr-am-pm:focus{background:#eee}.flatpickr-input[readonly]{cursor:pointer}@-webkit-keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}@keyframes fpFadeInDown{from{opacity:0;-webkit-transform:translate3d(0,-20px,0);transform:translate3d(0,-20px,0)}to{opacity:1;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}} \ No newline at end of file diff --git a/dashboard/static/images/FLN.png b/dashboard/static/images/FLN.png new file mode 100755 index 0000000..288b906 Binary files /dev/null and b/dashboard/static/images/FLN.png differ diff --git a/dashboard/static/js/chart.js b/dashboard/static/js/chart.js new file mode 100644 index 0000000..4cfce5c --- /dev/null +++ b/dashboard/static/js/chart.js @@ -0,0 +1,14 @@ +/*! + * Chart.js v4.5.1 + * https://www.chartjs.org + * (c) 2025 Chart.js Contributors + * Released under the MIT License + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";var t=Object.freeze({__proto__:null,get Colors(){return Jo},get Decimation(){return ta},get Filler(){return ba},get Legend(){return Ma},get SubTitle(){return Pa},get Title(){return ka},get Tooltip(){return Na}});function e(){}const i=(()=>{let t=0;return()=>t++})();function s(t){return null==t}function n(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function o(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function r(t,e){return a(t)?t:e}function l(t,e){return void 0===t?e:t}const h=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,c=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function d(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function u(t,e,i,s){let a,r,l;if(n(t))if(r=t.length,s)for(a=r-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;at,x:t=>t.x,y:t=>t.y};function v(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function M(t,e){const i=y[e]||(y[e]=function(t){const e=v(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function w(t){return t.charAt(0).toUpperCase()+t.slice(1)}const k=t=>void 0!==t,S=t=>"function"==typeof t,P=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function D(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const C=Math.PI,O=2*C,A=O+C,T=Number.POSITIVE_INFINITY,L=C/180,E=C/2,R=C/4,I=2*C/3,z=Math.log10,F=Math.sign;function V(t,e,i){return Math.abs(t-e)t-e)).pop(),e}function N(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function H(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function j(t,e,i){let s,n,o;for(s=0,n=t.length;sl&&h=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function et(t,e,i){i=i||(i=>t[i]1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const it=(t,e,i,s)=>et(t,i,s?s=>{const n=t[s][e];return nt[s][e]et(t,i,(s=>t[s][e]>=i));function nt(t,e,i){let s=0,n=t.length;for(;ss&&t[n-1]>i;)n--;return s>0||n{const i="_onData"+w(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),n}})})))}function rt(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(ot.forEach((e=>{delete t[e]})),delete t._chartjs)}function lt(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const ht="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function ct(t,e){let i=[],s=!1;return function(...n){i=n,s||(s=!0,ht.call(window,(()=>{s=!1,t.apply(e,i)})))}}function dt(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const ut=t=>"start"===t?"left":"end"===t?"right":"center",ft=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,gt=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;function pt(t,e,i){const n=e.length;let o=0,a=n;if(t._sorted){const{iScale:r,vScale:l,_parsed:h}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,d=r.axis,{min:u,max:f,minDefined:g,maxDefined:p}=r.getUserBounds();if(g){if(o=Math.min(it(h,d,u).lo,i?n:it(e,d,r.getPixelForValue(u)).lo),c){const t=h.slice(0,o+1).reverse().findIndex((t=>!s(t[l.axis])));o-=Math.max(0,t)}o=Z(o,0,n-1)}if(p){let t=Math.max(it(h,r.axis,f,!0).hi+1,i?0:it(e,d,r.getPixelForValue(f),!0).hi+1);if(c){const e=h.slice(t-1).findIndex((t=>!s(t[l.axis])));t+=Math.max(0,e)}a=Z(t,o,n)-o}else a=n-o}return{start:o,count:a}}function mt(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}class xt{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=ht.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var bt=new xt; +/*! + * @kurkle/color v0.3.2 + * https://github.com/kurkle/color#readme + * (c) 2023 Jukka Kurkela + * Released under the MIT License + */function _t(t){return t+.5|0}const yt=(t,e,i)=>Math.max(Math.min(t,i),e);function vt(t){return yt(_t(2.55*t),0,255)}function Mt(t){return yt(_t(255*t),0,255)}function wt(t){return yt(_t(t/2.55)/100,0,1)}function kt(t){return yt(_t(100*t),0,100)}const St={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pt=[..."0123456789ABCDEF"],Dt=t=>Pt[15&t],Ct=t=>Pt[(240&t)>>4]+Pt[15&t],Ot=t=>(240&t)>>4==(15&t);function At(t){var e=(t=>Ot(t.r)&&Ot(t.g)&&Ot(t.b)&&Ot(t.a))(t)?Dt:Ct;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Tt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Lt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Et(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function Rt(t,e,i){const s=Lt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function It(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e>16&255,o>>8&255,255&o]}return t}(),Ht.transparent=[0,0,0,0]);const e=Ht[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const $t=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Yt=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Ut=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Xt(t,e,i){if(t){let s=It(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=Ft(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function qt(t,e){return t?Object.assign(e||{},t):t}function Kt(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=Mt(t[3]))):(e=qt(t,{r:0,g:0,b:0,a:1})).a=Mt(e.a),e}function Gt(t){return"r"===t.charAt(0)?function(t){const e=$t.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?vt(t):yt(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?vt(i):yt(i,0,255)),s=255&(e[4]?vt(s):yt(s,0,255)),n=255&(e[6]?vt(n):yt(n,0,255)),{r:i,g:s,b:n,a:o}}}(t):Bt(t)}class Jt{constructor(t){if(t instanceof Jt)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=Kt(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*St[s[1]],g:255&17*St[s[2]],b:255&17*St[s[3]],a:5===o?17*St[s[4]]:255}:7!==o&&9!==o||(n={r:St[s[1]]<<4|St[s[2]],g:St[s[3]]<<4|St[s[4]],b:St[s[5]]<<4|St[s[6]],a:9===o?St[s[7]]<<4|St[s[8]]:255})),i=n||jt(t)||Gt(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=qt(this._rgb);return t&&(t.a=wt(t.a)),t}set rgb(t){this._rgb=Kt(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${wt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?At(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=It(t),i=e[0],s=kt(e[1]),n=kt(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${wt(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const o=e===n?.5:e,a=2*o-1,r=i.a-s.a,l=((a*r==-1?a:(a+r)/(1+a*r))+1)/2;n=1-l,i.r=255&l*i.r+n*s.r+.5,i.g=255&l*i.g+n*s.g+.5,i.b=255&l*i.b+n*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const s=Ut(wt(t.r)),n=Ut(wt(t.g)),o=Ut(wt(t.b));return{r:Mt(Yt(s+i*(Ut(wt(e.r))-s))),g:Mt(Yt(n+i*(Ut(wt(e.g))-n))),b:Mt(Yt(o+i*(Ut(wt(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Jt(this.rgb)}alpha(t){return this._rgb.a=Mt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=_t(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Xt(this._rgb,2,t),this}darken(t){return Xt(this._rgb,2,-t),this}saturate(t){return Xt(this._rgb,1,t),this}desaturate(t){return Xt(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=It(t);i[0]=Vt(i[0]+e),i=Ft(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Zt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Qt(t){return Zt(t)?t:new Jt(t)}function te(t){return Zt(t)?t:new Jt(t).saturate(.5).darken(.1).hexString()}const ee=["x","y","borderWidth","radius","tension"],ie=["color","borderColor","backgroundColor"];const se=new Map;function ne(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=se.get(i);return s||(s=new Intl.NumberFormat(t,e),se.set(i,s)),s}(e,i).format(t)}const oe={values:t=>n(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const a=z(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),ne(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=i[e].significand||t/Math.pow(10,Math.floor(z(t)));return[1,2,3,5,10,15].includes(s)||e>.8*i.length?oe.numeric.call(this,t,e,i):""}};var ae={formatters:oe};const re=Object.create(null),le=Object.create(null);function he(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;et.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>te(e.backgroundColor),this.hoverBorderColor=(t,e)=>te(e.borderColor),this.hoverColor=(t,e)=>te(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ce(this,t,e)}get(t){return he(this,t)}describe(t,e){return ce(le,t,e)}override(t,e){return ce(re,t,e)}route(t,e,i,s){const n=he(this,t),a=he(this,i),r="_"+e;Object.defineProperties(n,{[r]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=a[s];return o(t)?Object.assign({},e,t):l(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var ue=new de({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:ie},numbers:{type:"number",properties:ee}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ae.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function fe(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ge(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function pe(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const me=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function xe(t,e){return me(t).getPropertyValue(e)}const be=["top","right","bottom","left"];function _e(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=be[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const ye=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function ve(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=me(i),o="border-box"===n.boxSizing,a=_e(n,"padding"),r=_e(n,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let a,r,l=!1;if(ye(n,o,t.target))a=n,r=o;else{const t=e.getBoundingClientRect();a=s.clientX-t.left,r=s.clientY-t.top,l=!0}return{x:a,y:r,box:l}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((h-u)/g*i.height/s)}}const Me=t=>Math.round(10*t)/10;function we(t,e,i,s){const n=me(t),o=_e(n,"margin"),a=pe(n.maxWidth,t,"clientWidth")||T,r=pe(n.maxHeight,t,"clientHeight")||T,l=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=t&&ge(t);if(o){const t=o.getBoundingClientRect(),a=me(o),r=_e(a,"border","width"),l=_e(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=pe(a.maxWidth,o,"clientWidth"),n=pe(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||T,maxHeight:n||T}}(t,e,i);let{width:h,height:c}=l;if("content-box"===n.boxSizing){const t=_e(n,"border","width"),e=_e(n,"padding");h-=e.width+t.width,c-=e.height+t.height}h=Math.max(0,h-o.width),c=Math.max(0,s?h/s:c-o.height),h=Me(Math.min(h,a,l.maxWidth)),c=Me(Math.min(c,r,l.maxHeight)),h&&!c&&(c=Me(h/2));return(void 0!==e||void 0!==i)&&s&&l.height&&c>l.height&&(c=l.height,h=Me(Math.floor(c*s))),{width:h,height:c}}function ke(t,e,i){const s=e||1,n=Me(t.height*s),o=Me(t.width*s);t.height=Me(t.height),t.width=Me(t.width);const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const Se=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};fe()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function Pe(t,e){const i=xe(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function De(t){return!t||s(t.size)||s(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Ce(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function Oe(t,e,i,s){let o=(s=s||{}).data=s.data||{},a=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(o=s.data={},a=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let r=0;const l=i.length;let h,c,d,u,f;for(h=0;hi.length){for(h=0;h0&&t.stroke()}}function Re(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.xe.top-i&&t.y0&&""!==r.strokeColor;let c,d;for(t.save(),t.font=a.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),s(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,r),c=0;ct[0])){const o=i||t;void 0===s&&(s=ti("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:s,_getTarget:n,override:i=>je([i,...t],e,o,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>qe(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=ti(Ue(o,t),i),void 0!==n)return Xe(t,n)?Ze(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>ei(t).includes(e),ownKeys:t=>ei(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function $e(t,e,i,s){const a={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Ye(t,s),setContext:e=>$e(t,e,i,s),override:n=>$e(t.override(n),e,i,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>qe(t,e,(()=>function(t,e,i){const{_proxy:s,_context:a,_subProxy:r,_descriptors:l}=t;let h=s[e];S(h)&&l.isScriptable(e)&&(h=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||s);r.delete(t),Xe(t,l)&&(l=Ze(n._scopes,n,t,l));return l}(e,h,t,i));n(h)&&h.length&&(h=function(t,e,i,s){const{_proxy:n,_context:a,_subProxy:r,_descriptors:l}=i;if(void 0!==a.index&&s(t))return e[a.index%e.length];if(o(e[0])){const i=e,s=n._scopes.filter((t=>t!==i));e=[];for(const o of i){const i=Ze(s,n,t,o);e.push($e(i,a,r&&r[t],l))}}return e}(e,h,t,l.isIndexable));Xe(e,h)&&(h=$e(h,a,r&&r[e],l));return h}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function Ye(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:S(i)?i:()=>i,isIndexable:S(s)?s:()=>s}}const Ue=(t,e)=>t?t+w(e):e,Xe=(t,e)=>o(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function qe(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const s=i();return t[e]=s,s}function Ke(t,e,i){return S(t)?t(e,i):t}const Ge=(t,e)=>!0===t?e:"string"==typeof t?M(e,t):void 0;function Je(t,e,i,s,n){for(const o of e){const e=Ge(i,o);if(e){t.add(e);const o=Ke(e._fallback,i,n);if(void 0!==o&&o!==i&&o!==s)return o}else if(!1===e&&void 0!==s&&i!==s)return null}return!1}function Ze(t,e,i,s){const a=e._rootScopes,r=Ke(e._fallback,i,s),l=[...t,...a],h=new Set;h.add(s);let c=Qe(h,l,i,r||i,s);return null!==c&&((void 0===r||r===i||(c=Qe(h,l,r,c,s),null!==c))&&je(Array.from(h),[""],a,r,(()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const a=s[e];if(n(a)&&o(i))return i;return a||{}}(e,i,s))))}function Qe(t,e,i,s,n){for(;i;)i=Je(t,e,i,s,n);return i}function ti(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function ei(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function ii(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,a=new Array(s);let r,l,h,c;for(r=0,l=s;re"x"===t?"y":"x";function ai(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=q(o,n),l=q(a,o);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function ri(t,e="x"){const i=oi(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,l,h=ni(t,0);for(a=0;a!t.skip))),"monotone"===e.cubicInterpolationMode)ri(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o0===t||1===t,di=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*O/i),ui=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*O/i)+1,fi={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*E),easeOutSine:t=>Math.sin(t*E),easeInOutSine:t=>-.5*(Math.cos(C*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>ci(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>ci(t)?t:di(t,.075,.3),easeOutElastic:t=>ci(t)?t:ui(t,.075,.3),easeInOutElastic(t){const e=.1125;return ci(t)?t:t<.5?.5*di(2*t,e,.45):.5+.5*ui(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-fi.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*fi.easeInBounce(2*t):.5*fi.easeOutBounce(2*t-1)+.5};function gi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function pi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function mi(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=gi(t,n,i),r=gi(n,o,i),l=gi(o,e,i),h=gi(a,r,i),c=gi(r,l,i);return gi(h,c,i)}const xi=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,bi=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _i(t,e){const i=(""+t).match(xi);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const yi=t=>+t||0;function vi(t,e){const i={},s=o(e),n=s?Object.keys(e):e,a=o(t)?s?i=>l(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=yi(a(t));return i}function Mi(t){return vi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function wi(t){return vi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ki(t){const e=Mi(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Si(t,e){t=t||{},e=e||ue.font;let i=l(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=l(t.style,e.style);s&&!(""+s).match(bi)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:l(t.family,e.family),lineHeight:_i(l(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:l(t.weight,e.weight),string:""};return n.string=De(n),n}function Pi(t,e,i,s){let o,a,r,l=!0;for(o=0,a=t.length;oi&&0===t?0:t+e;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function Ci(t,e){return Object.assign(Object.create(t),e)}function Oi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Ai(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function Ti(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Li(t){return"angle"===t?{between:J,compare:K,normalize:G}:{between:tt,compare:(t,e)=>t-e,normalize:t=>t}}function Ei({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function Ri(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:l,normalize:h}=Li(s),{start:c,end:d,loop:u,style:f}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=Li(s),l=e.length;let h,c,{start:d,end:u,loop:f}=t;if(f){for(d+=l,u+=l,h=0,c=l;hb||l(n,x,p)&&0!==r(n,x),v=()=>!b||0===r(o,p)||l(o,x,p);for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=h(m[s]),p!==x&&(b=l(p,n,o),null===_&&y()&&(_=0===r(p,n)?t:i),null!==_&&v()&&(g.push(Ei({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,x=p));return null!==_&&g.push(Ei({start:_,end:d,loop:u,count:a,style:f})),g}function Ii(t,e){const i=[],s=t.segments;for(let n=0;nn&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);if(!0===s)return Fi(t,[{start:a,end:r,loop:o}],i,e);return Fi(t,function(t,e,i,s){const n=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%n];i.skip||i.stop?l.skip||(s=!1,o.push({start:e%n,end:(a-1)%n,loop:s}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&o.push({start:e%n,end:r%n,loop:s}),o}(i,a,r!s(t[e.axis])));n.lo-=Math.max(0,a);const r=i.slice(n.hi).findIndex((t=>!s(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=a[0],s="function"==typeof t.getRange&&t.getRange(e);if(s){const t=r(a,e,i-s),n=r(a,e,i+s);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:a.length-1}}function $i(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=o.length;t{t[a]&&t[a](e[i],n)&&(o.push({element:t,datasetIndex:s,index:l}),r=r||t.inRange(e.x,e.y,n))})),s&&!r?[]:o}var Ki={evaluateInteractionItems:$i,modes:{index(t,e,i,s){const n=ve(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?Yi(t,n,o,s,a):Xi(t,n,o,!1,s,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,s){const n=ve(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let r=i.intersect?Yi(t,n,o,s,a):Xi(t,n,o,!1,s,a);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;tYi(t,ve(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=ve(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return Xi(t,n,o,i.intersect,s,a)},x:(t,e,i,s)=>qi(t,ve(e,t),"x",i.intersect,s),y:(t,e,i,s)=>qi(t,ve(e,t),"y",i.intersect,s)}};const Gi=["left","top","right","bottom"];function Ji(t,e){return t.filter((t=>t.pos===e))}function Zi(t,e){return t.filter((t=>-1===Gi.indexOf(t.pos)&&t.box.axis===e))}function Qi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function ts(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Gi.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function os(t,e,i,s){const n=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;ot.box.fullSize)),!0),s=Qi(Ji(e,"left"),!0),n=Qi(Ji(e,"right")),o=Qi(Ji(e,"top"),!0),a=Qi(Ji(e,"bottom")),r=Zi(e,"x"),l=Zi(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Ji(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;u(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),f=Object.assign({},n);is(f,ki(s));const g=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),p=ts(l.concat(h),d);os(r.fullSize,g,d,p),os(l,g,d,p),os(h,g,d,p)&&os(l,g,d,p),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(g),rs(r.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,rs(r.rightAndBottom,g,d,p),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},u(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})}))}};class hs{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class cs extends hs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ds="$chartjs",us={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},fs=t=>null===t||""===t;const gs=!!Se&&{passive:!0};function ps(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,gs)}function ms(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function xs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ms(i.addedNodes,s),e=e&&!ms(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function bs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ms(i.removedNodes,s),e=e&&!ms(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const _s=new Map;let ys=0;function vs(){const t=window.devicePixelRatio;t!==ys&&(ys=t,_s.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function Ms(t,e,i){const s=t.canvas,n=s&&ge(s);if(!n)return;const o=ct(((t,e)=>{const s=n.clientWidth;i(t,e),s{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||o(i,s)}));return a.observe(n),function(t,e){_s.size||window.addEventListener("resize",vs),_s.set(t,e)}(t,o),a}function ws(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){_s.delete(t),_s.size||window.removeEventListener("resize",vs)}(t)}function ks(t,e,i){const s=t.canvas,n=ct((e=>{null!==t.ctx&&i(function(t,e){const i=us[t.type]||t.type,{x:s,y:n}=ve(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,gs)}(s,e,n),n}class Ss extends hs{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[ds]={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",fs(n)){const e=Pe(t,"width");void 0!==e&&(t.width=e)}if(fs(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Pe(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[ds])return!1;const i=e[ds].initial;["height","width"].forEach((t=>{const n=i[t];s(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[ds],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:xs,detach:bs,resize:Ms}[e]||ks;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:ws,detach:ws,resize:ws}[e]||ps)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return we(t,e,i,s)}isAttached(t){const e=t&&ge(t);return!(!e||!e.isConnected)}}function Ps(t){return!fe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?cs:Ss}var Ds=Object.freeze({__proto__:null,BasePlatform:hs,BasicPlatform:cs,DomPlatform:Ss,_detectPlatform:Ps});const Cs="transparent",Os={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=Qt(t||Cs),n=s.valid&&Qt(e||Cs);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class As{constructor(t,e,i,s){const n=e[i];s=Pi([t.to,s,n,t.from]);const o=Pi([t.from,n,s]);this._active=!0,this._fn=t.fn||Os[t.type||typeof o],this._easing=fi[t.easing]||fi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Pi([t.to,e,s,t.from]),this._from=Pi([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t{const a=t[s];if(!o(a))return;const r={};for(const t of e)r[t]=a[t];(n(a.properties)&&a.properties||[s]).forEach((t=>{t!==s&&i.has(t)||i.set(t,r)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=n[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,a);continue}c.cancel()}d&&d.duration?(n[l]=c=new As(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(bt.add(this._chart,i),!0):void 0}}function Ls(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function Es(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n0||!i&&e<0)return n.index}return null}function Vs(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let t=0;ti[t].axis===e)).shift()}function Ws(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i],void 0!==e[s]._visualValues&&void 0!==e[s]._visualValues[i]&&delete e[s]._visualValues[i]}}}const Ns=t=>"reset"===t||"none"===t,Hs=(t,e)=>e?t:Object.assign({},t);class js{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Is(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ws(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=l(i.xAxisID,Bs(t,"x")),o=e.yAxisID=l(i.yAxisID,Bs(t,"y")),a=e.rAxisID=l(i.rAxisID,Bs(t,"r")),r=e.indexAxis,h=e.iAxisID=s(r,n,o,a),c=e.vAxisID=s(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(h),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&rt(this._data,this),t._stacked&&Ws(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(o(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:s}=e,n="x"===i.axis?"x":"y",o="x"===s.axis?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,h,c;for(l=0,h=a.length;l0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,d=s;else{d=n(s[t])?this.parseArrayData(i,s,t,e):o(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const a=()=>null===c[l]||f&&c[l]t&&!e.hidden&&e._stacked&&{keys:Es(i,!0),values:null})(e,i,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(r);let u,f;function g(){f=s[u];const e=f[r.axis];return!a(f[t.axis])||c>e||d=0;--u)if(!g()){this.updateRangeFromParsed(h,t,f,l);break}return h}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,o;for(s=0,n=e.length;s=0&&tthis.getContext(i,s,e)),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(Hs(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const l=new Ts(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ns(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),o=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:o}}updateElement(t,e,i,s){Ns(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ns(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}function Ys(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),o=Math.min(i.maxTicksLimit||n,n),a=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;io)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;nn)return e}return Math.max(n,1)}(a,e,o);if(r>0){let t,i;const n=r>1?Math.round((h-l)/(r-1)):null;for(Us(e,c,d,s(n)?0:l-n,l),t=0,i=r-1;t"top"===e||"left"===e?t[e]+i:t[e]-i,qs=(t,e)=>Math.min(e||t,t);function Ks(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;oa+r)))return h}function Js(t){return t.drawTicks?t.tickLength:0}function Zs(t,e){if(!t.display)return 0;const i=Si(t.font,e),s=ki(t.padding);return(n(t.text)?t.text.length:1)*i.lineHeight+s.height}function Qs(t,e,i){let s=ut(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class tn extends $s{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=r(t,Number.POSITIVE_INFINITY),e=r(e,Number.NEGATIVE_INFINITY),i=r(i,Number.POSITIVE_INFINITY),s=r(s,Number.NEGATIVE_INFINITY),{min:r(t,i),max:r(e,s),minDefined:a(t),maxDefined:a(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,l=a.length;rs?s:i,s=n&&i>s?i:s,{min:r(i,r(s,i)),max:r(s,r(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){d(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Di(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=Z(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),a=this.maxHeight-Js(t.grid)-e.padding-Zs(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=Y(Math.min(Math.asin(Z((h.highest.height+6)/o,-1,1)),Math.asin(Z(a/r,-1,1))-Math.asin(Z(d/r,-1,1)))),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){d(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){d(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=Zs(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Js(n)+o):(t.height=this.maxHeight,t.width=Js(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),r=2*i.padding,l=$(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*n.width+h*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-h+o)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){d(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n({width:r[t]||0,height:l[t]||0});return{first:P(0),last:P(e-1),widest:P(k),highest:P(S),widths:r,heights:l}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Q(this._alignToPixels?Ae(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:r/s:r*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:a,border:r}=s,h=n.offset,c=this.isHorizontal(),d=this.ticks.length+(h?1:0),u=Js(n),f=[],g=r.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,x=function(t){return Ae(i,t,p)};let b,_,y,v,M,w,k,S,P,D,C,O;if("top"===a)b=x(this.bottom),w=this.bottom-u,S=b-m,D=x(t.top)+m,O=t.bottom;else if("bottom"===a)b=x(this.top),D=t.top,O=x(t.bottom)-m,w=b+m,S=this.top+u;else if("left"===a)b=x(this.right),M=this.right-u,k=b-m,P=x(t.left)+m,C=t.right;else if("right"===a)b=x(this.left),P=t.left,C=x(t.right)-m,M=b+m,k=this.left+u;else if("x"===e){if("center"===a)b=x((t.top+t.bottom)/2+.5);else if(o(a)){const t=Object.keys(a)[0],e=a[t];b=x(this.chart.scales[t].getPixelForValue(e))}D=t.top,O=t.bottom,w=b+m,S=w+u}else if("y"===e){if("center"===a)b=x((t.left+t.right)/2);else if(o(a)){const t=Object.keys(a)[0],e=a[t];b=x(this.chart.scales[t].getPixelForValue(e))}M=b-m,k=M-u,P=t.left,C=t.right}const A=l(s.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/A));for(_=0;_0&&(o-=s/2)}d={left:o,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}x.push({label:v,font:P,textOffset:O,options:{rotation:m,color:i,strokeColor:o,strokeWidth:h,textAlign:f,textBaseline:A,translation:[M,w],backdrop:d}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-$(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:n}}=this.options,o=t+n,a=this._getLabelSizes().widest.width;let r,l;return"left"===e?s?(l=this.right+n,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l+=a)):(l=this.right-o,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l=this.left)):"right"===e?s?(l=this.left+n,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l-=a)):(l=this.left+o,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:n,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,n,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");ue.route(o,n,l,r)}))}(e,t.defaultRoutes);t.descriptors&&ue.describe(e,t.descriptors)}(t,o,i),this.override&&ue.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in ue[s]&&(delete ue[s][i],this.override&&delete re[i])}}class sn{constructor(){this.controllers=new en(js,"datasets",!0),this.elements=new en($s,"elements"),this.plugins=new en(Object,"plugins"),this.scales=new en(tn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):u(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=w(t);d(i["before"+s],[],i),e[t](i),d(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;et.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function an(t,e){return e||!1!==t?!0===t?{}:t:null}function rn(t,{plugin:e,local:i},s,n){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(s,o);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ln(t,e){const i=ue.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function hn(t){if("x"===t||"y"===t||"r"===t)return t}function cn(t,...e){if(hn(t))return t;for(const s of e){const e=s.axis||("top"===(i=s.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&hn(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function dn(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function un(t,e){const i=re[t.type]||{scales:{}},s=e.scales||{},n=ln(t.type,e),a=Object.create(null);return Object.keys(s).forEach((e=>{const r=s[e];if(!o(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const l=cn(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return dn(t,"x",i[0])||dn(t,"y",i[0])}return{}}(e,t),ue.scales[r.type]),h=function(t,e){return t===e?"_index_":"_value_"}(l,n),c=i.scales||{};a[e]=b(Object.create(null),[{axis:l},r,c[l],c[h]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,o=i.indexAxis||ln(n,e),r=(re[n]||{}).scales||{};Object.keys(r).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,o),n=i[e+"AxisID"]||e;a[n]=a[n]||Object.create(null),b(a[n],[{axis:e},s[n],r[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];b(e,[ue.scales[e.type],ue.scale])})),a}function fn(t){const e=t.options||(t.options={});e.plugins=l(e.plugins,{}),e.scales=un(t,e)}function gn(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const pn=new Map,mn=new Set;function xn(t,e){let i=pn.get(t);return i||(i=e(),pn.set(t,i),mn.add(i)),i}const bn=(t,e,i)=>{const s=M(e,i);void 0!==s&&t.add(s)};class _n{constructor(t){this._config=function(t){return(t=t||{}).data=gn(t.data),fn(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=gn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),fn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return xn(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return xn(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return xn(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return xn(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>bn(r,t,e)))),e.forEach((t=>bn(r,s,t))),e.forEach((t=>bn(r,re[n]||{},t))),e.forEach((t=>bn(r,ue,t))),e.forEach((t=>bn(r,le,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),mn.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,re[e]||{},ue.datasets[e]||{},{type:e},ue,le]}resolveNamedOptions(t,e,i,s=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=yn(this._resolverCache,t,s);let l=a;if(function(t,e){const{isScriptable:i,isIndexable:s}=Ye(t);for(const o of e){const e=i(o),a=s(o),r=(a||e)&&t[o];if(e&&(S(r)||vn(r))||a&&n(r))return!0}return!1}(a,e)){o.$shared=!1;l=$e(a,i=S(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=l[t];return o}createResolver(t,e,i=[""],s){const{resolver:n}=yn(this._resolverCache,t,i);return o(e)?$e(n,e,void 0,s):n}}function yn(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);if(!o){o={resolver:je(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)}return o}const vn=t=>o(t)&&Object.getOwnPropertyNames(t).some((e=>S(t[e])));const Mn=["top","bottom","left","right","chartArea"];function wn(t,e){return"top"===t||"bottom"===t||-1===Mn.indexOf(t)&&"x"===e}function kn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function Sn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),d(i&&i.onComplete,[t],e)}function Pn(t){const e=t.chart,i=e.options.animation;d(i&&i.onProgress,[t],e)}function Dn(t){return fe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Cn={},On=t=>{const e=Dn(t);return Object.values(Cn).filter((t=>t.canvas===e)).pop()};function An(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class Tn{static defaults=ue;static instances=Cn;static overrides=re;static registry=nn;static version="4.5.1";static getChart=On;static register(...t){nn.add(...t),Ln()}static unregister(...t){nn.remove(...t),Ln()}constructor(t,e){const s=this.config=new _n(e),n=Dn(t),o=On(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Ps(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,h=l&&l.height,c=l&&l.width;this.id=i(),this.ctx=r,this.canvas=l,this.width=c,this.height=h,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new on,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=dt((t=>this.update(t)),a.resizeDelay||0),this._dataChanges=[],Cn[this.id]=this,r&&l?(bt.listen(this,"complete",Sn),bt.listen(this,"progress",Pn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return s(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return nn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ke(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Te(this.canvas,this.ctx),this}stop(){return bt.stop(this),this}resize(t,e){bt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ke(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),d(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){u(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=cn(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),u(n,(e=>{const n=e.options,o=n.id,a=cn(o,n),r=l(n.type,e.dtype);void 0!==n.position&&wn(n.position,a)===wn(e.dposition)||(n.position=e.dposition),s[o]=!0;let h=null;if(o in i&&i[o].type===r)h=i[o];else{h=new(nn.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(n,t)})),u(s,((t,e)=>{t||delete i[e]})),u(i,(t=>{ls.configure(this,t,t.options),ls.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;te.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(kn("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){u(this.scales,(t=>{ls.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);P(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e){An(t,s,"_removeElements"===i?-n:n)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=i(0);for(let t=1;tt.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;ls.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],u(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Ni(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(s&&Ie(e,s),t.controller.draw(),s&&ze(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Re(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Ki.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Ci(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);k(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),bt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};u(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){u(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},u(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!f(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,a=this._getActiveElements(t,s,i,o),r=D(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,d(n.onHover,[t,a,this],this),r&&d(n.onClick,[t,a,this],this));const h=!f(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function Ln(){return u(Tn.instances,(t=>t._plugins.invalidate()))}function En(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Rn{static override(t){Object.assign(Rn.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return En()}parse(){return En()}format(){return En()}add(){return En()}diff(){return En()}startOf(){return En()}endOf(){return En()}}var In={_date:Rn};function zn(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;et-e)))}return t._cache.$bar}(e,t.type);let s,n,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(k(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(s=0,n=i.length;sMath.abs(r)&&(l=r,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:n,end:o,min:a,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function Vn(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let h,c,d,u;for(h=i,c=i+s;ht.x,i="left",s="right"):(e=t.base"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data,{labels:{pointStyle:i,textAlign:s,color:n,useBorderRadius:o,borderRadius:a}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map(((e,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:e,fillStyle:l.backgroundColor,fontColor:n,hidden:!t.getDataVisibility(r),lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:l.borderWidth,strokeStyle:l.borderColor,textAlign:s,pointStyle:i,borderRadius:o&&(a||l.borderRadius),index:r}})):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let n,a,r=t=>+i[t];if(o(i[t])){const{key:t="value"}=this._parsing;r=e=>+M(i[e],t)}for(n=t,a=t+e;nJ(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>J(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,h,d),m=f(E,c,u),x=g(C,h,d),b=g(C+E,c,u);s=(p-x)/2,n=(m-b)/2,o=-(p+x)/2,a=-(m+b)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(u,d,r),x=(i.width-o)/f,b=(i.height-o)/g,_=Math.max(Math.min(x,b)/2,0),y=c(this.options.radius,_),v=(y-Math.max(y*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*y,this.offsetY=m*y,s.total=this.calculateTotal(),this.outerRadius=y-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*l,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/O)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,h=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:f,includeOptions:g}=this._getSharedOptions(e,s);let p,m=this._getRotation();for(p=0;p0&&!isNaN(t)?O*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;s{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(se.max&&(e.max=s))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.options.animation,r=this._cachedMeta.rScale,l=r.xCenter,h=r.yCenter,c=r.getIndexAngle(0)-.5*C;let d,u=c;const f=360/this.countVisibleElements();for(d=0;d{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?$(this.resolveDataElementOptions(t,e).angle||i):0}}var Un=Object.freeze({__proto__:null,BarController:class extends js{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return Vn(t,e,i,s)}parseArrayData(t,e,i,s){return Vn(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===n.axis?a:r,h="x"===o.axis?a:r,c=[];let d,u,f,g;for(d=i,u=i+s;dt.controller.options.grouped)),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],h=t=>{const e=t._parsed.find((t=>t[i.axis]===l)),n=e&&e[t.vScale.axis];if(s(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!h(i))&&((!1===o||-1===a.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&a.push(i.stack),i.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter((i=>t[i].axis===e)).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[l("x"===this.chart.options.indexAxis?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n=i?1:-1)}(u,e,r)*a,f===r&&(x-=u/2);const t=e.getPixelForDecimal(0),s=e.getPixelForDecimal(1),o=Math.min(t,s),h=Math.max(t,s);x=Math.max(Math.min(x,h),o),d=x+u,i&&!c&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(d)-e.getValueForPixel(x))}if(x===e.getPixelForValue(r)){const t=F(u)*e.getLineWidthForValue(r)/2;x+=t,u-=t}return{size:u,base:x,head:d,center:d+u/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,a=l(n.maxBarThickness,1/0);let r,h;const c=this._getAxisCount();if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,d="flex"===n.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y),l=o._custom;return{label:i[t]||"",value:"("+a+", "+r+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:r,includeOptions:l}=this._getSharedOptions(e,s),h=o.axis,c=a.axis;for(let d=e;d0&&this.getParsed(e-1);for(let i=0;i<_;++i){const g=t[i],_=x?g:{};if(i=b){_.skip=!0;continue}const v=this.getParsed(i),M=s(v[f]),w=_[u]=a.getPixelForValue(v[u],i),k=_[f]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,v,l):v[f],i);_.skip=isNaN(w)||isNaN(k)||M,_.stop=i>0&&Math.abs(v[u]-y[u])>m,p&&(_.parsed=v,_.raw=h.data[i]),d&&(_.options=c||this.resolveDataElementOptions(i,g.active?"active":n)),x||this.updateElement(g,i,_,n),y=v}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends $n{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:Yn,RadarController:class extends js{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o="reset"===s;for(let a=e;a0&&this.getParsed(e-1);for(let c=e;c0&&Math.abs(i[f]-_[f])>x,m&&(p.parsed=i,p.raw=h.data[c]),u&&(p.options=d||this.resolveDataElementOptions(c,e.active?"active":n)),b||this.updateElement(e,c,p,n),_=i}this.updateSharedOptions(d,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,o)/2}}});function Xn(t,e,i,s){const n=vi(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const o=(i-e)/2,a=Math.min(o,s*e/2),r=t=>{const e=(i-Math.min(o,t))*s/2;return Z(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:Z(n.innerStart,0,a),innerEnd:Z(n.innerEnd,0,a)}}function qn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Kn(t,e,i,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:h,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-h,0),u=c>0?c+s+i+h:0;let f=0;const g=n-l;if(s){const t=((c>0?c-s:0)+(d>0?d-s:0))/2;f=(g-(0!==t?g*t/(t+s):g))/2}const p=(g-Math.max(.001,g*d-i/C)/d)/2,m=l+p+f,x=n-p-f,{outerStart:b,outerEnd:_,innerStart:y,innerEnd:v}=Xn(e,u,d,x-m),M=d-b,w=d-_,k=m+b/M,S=x-_/w,P=u+y,D=u+v,O=m+y/P,A=x-v/D;if(t.beginPath(),o){const e=(k+S)/2;if(t.arc(a,r,d,k,e),t.arc(a,r,d,e,S),_>0){const e=qn(w,S,a,r);t.arc(e.x,e.y,_,S,x+E)}const i=qn(D,x,a,r);if(t.lineTo(i.x,i.y),v>0){const e=qn(D,A,a,r);t.arc(e.x,e.y,v,x+E,A+Math.PI)}const s=(x-v/u+(m+y/u))/2;if(t.arc(a,r,u,x-v/u,s,!0),t.arc(a,r,u,s,m+y/u,!0),y>0){const e=qn(P,O,a,r);t.arc(e.x,e.y,y,O+Math.PI,m-E)}const n=qn(M,m,a,r);if(t.lineTo(n.x,n.y),b>0){const e=qn(M,k,a,r);t.arc(e.x,e.y,b,m-E,k)}}else{t.moveTo(a,r);const e=Math.cos(k)*d+a,i=Math.sin(k)*d+r;t.lineTo(e,i);const s=Math.cos(S)*d+a,n=Math.sin(S)*d+r;t.lineTo(s,n)}t.closePath()}function Gn(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:h,borderJoinStyle:c,borderDash:d,borderDashOffset:u,borderRadius:f}=l,g="inner"===l.borderAlign;if(!h)return;t.setLineDash(d||[]),t.lineDashOffset=u,g?(t.lineWidth=2*h,t.lineJoin=c||"round"):(t.lineWidth=h,t.lineJoin=c||"bevel");let p=e.endAngle;if(o){Kn(t,e,i,s,p,n);for(let e=0;en?(h=n/l,t.arc(o,a,l,i+h,s-h,!0)):t.arc(o,a,n,i+E,s-E),t.closePath(),t.clip()}(t,e,p),l.selfJoin&&p-a>=C&&0===f&&"miter"!==c&&function(t,e,i){const{startAngle:s,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=e,{borderWidth:h,borderJoinStyle:c}=l,d=Math.min(h/a,G(s-i));if(t.beginPath(),t.arc(n,o,a-h/2,s+d/2,i-d/2),r>0){const e=Math.min(h/r,G(s-i));t.arc(n,o,r+h/2,i-e/2,s+e/2,!0)}else{const e=Math.min(h/2,a*G(s-i));if("round"===c)t.arc(n,o,e,i-C/2,s+C/2,!0);else if("bevel"===c){const a=2*e*e,r=-a*Math.cos(i+C/2)+n,l=-a*Math.sin(i+C/2)+o,h=a*Math.cos(s+C/2)+n,c=a*Math.sin(s+C/2)+o;t.lineTo(r,l),t.lineTo(h,c)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}(t,e,p),o||(Kn(t,e,i,s,p,n),t.stroke())}function Jn(t,e,i=e){t.lineCap=l(i.borderCapStyle,e.borderCapStyle),t.setLineDash(l(i.borderDash,e.borderDash)),t.lineDashOffset=l(i.borderDashOffset,e.borderDashOffset),t.lineJoin=l(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=l(i.borderWidth,e.borderWidth),t.strokeStyle=l(i.borderColor,e.borderColor)}function Zn(t,e,i){t.lineTo(i.x,i.y)}function Qn(t,e,i={}){const s=t.length,{start:n=0,end:o=s-1}=i,{start:a,end:r}=e,l=Math.max(n,a),h=Math.min(o,r),c=nr&&o>r;return{count:s,start:l,loop:e.loop,ilen:h(a+(h?r-t:t))%o,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=n[b(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[b(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(ig&&(g=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),u=s,x=0,f=g=i),p=i}_()}function io(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?eo:to}const so="function"==typeof Path2D;function no(t,e,i,s){so&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),Jn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=io(e);for(const r of n)Jn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}class oo extends $s{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;hi(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=zi(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=Ii(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=function(t){return t.stepped?pi:t.tension||"monotone"===t.cubicInterpolationMode?mi:gi}(i);let l,h;for(l=0,h=o.length;l"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:n,distance:o}=X(s,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:h,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,f=l(d,r-a),g=J(n,a,r)&&a!==r,p=f>=O||g,m=tt(o,h+u,c+u);return p&&m}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:r,spacing:l}=this.options,h=(s+n)/2,c=(o+a+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/4,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>O?Math.floor(i/O):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const r=s*(1-Math.sin(Math.min(C,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){Kn(t,e,i,s,l,n);for(let e=0;e("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s);return n!==t.lastIndexOf(e)?i:n}function mo(t){const e=this.getLabels();return t>=0&&ts=e?s:t,a=t=>n=i?n:t;if(t){const t=F(s),e=F(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(s===n){let e=0===n?1:Math.abs(.05*n);a(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=function(t,e){const i=[],{bounds:n,step:o,min:a,max:r,precision:l,count:h,maxTicks:c,maxDigits:d,includeBounds:u}=t,f=o||1,g=c-1,{min:p,max:m}=e,x=!s(a),b=!s(r),_=!s(h),y=(m-p)/(d+1);let v,M,w,k,S=B((m-p)/g/f)*f;if(S<1e-14&&!x&&!b)return[{value:p},{value:m}];k=Math.ceil(m/S)-Math.floor(p/S),k>g&&(S=B(k*S/g/f)*f),s(l)||(v=Math.pow(10,l),S=Math.ceil(S*v)/v),"ticks"===n?(M=Math.floor(p/S)*S,w=Math.ceil(m/S)*S):(M=p,w=m),x&&b&&o&&H((r-a)/o,S/1e3)?(k=Math.round(Math.min((r-a)/S,c)),S=(r-a)/k,M=a,w=r):_?(M=x?a:M,w=b?r:w,k=h-1,S=(w-M)/k):(k=(w-M)/S,k=V(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const P=Math.max(U(S),U(M));v=Math.pow(10,s(l)?P:l),M=Math.round(M*v)/v,w=Math.round(w*v)/v;let D=0;for(x&&(u&&M!==a?(i.push({value:a}),Mr)break;i.push({value:t})}return b&&u&&w!==r?i.length&&V(i[i.length-1].value,r,xo(r,y,t))?i[i.length-1].value=r:i.push({value:r}):b&&w!==r||i.push({value:w}),i}({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&j(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ne(t,this.chart.options.locale,this.options.ticks.format)}}class _o extends bo{static id="linear";static defaults={ticks:{callback:ae.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=a(t)?t:0,this.max=a(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=$(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const yo=t=>Math.floor(z(t)),vo=(t,e)=>Math.pow(10,yo(t)+e);function Mo(t){return 1===t/Math.pow(10,yo(t))}function wo(t,e,i){const s=Math.pow(10,i),n=Math.floor(t/s);return Math.ceil(e/s)-n}function ko(t,{min:e,max:i}){e=r(t.min,e);const s=[],n=yo(e);let o=function(t,e){let i=yo(e-t);for(;wo(t,e,i)>10;)i++;for(;wo(t,e,i)<10;)i--;return Math.min(i,yo(t))}(e,i),a=o<0?Math.pow(10,Math.abs(o)):1;const l=Math.pow(10,o),h=n>o?Math.pow(10,n):0,c=Math.round((e-h)*a)/a,d=Math.floor((e-h)/l/10)*l*10;let u=Math.floor((c-d)/Math.pow(10,o)),f=r(t.min,Math.round((h+d+u*Math.pow(10,o))*a)/a);for(;f=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,a=o>=0?1:a),f=Math.round((h+d+u*Math.pow(10,o))*a)/a;const g=r(t.max,f);return s.push({value:g,major:Mo(g),significand:u}),s}class So extends tn{static id="logarithmic";static defaults={ticks:{callback:ae.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=bo.prototype.parse.apply(this,[t,e]);if(0!==i)return a(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=a(t)?Math.max(0,t):null,this.max=a(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!a(this._userMin)&&(this.min=t===vo(this.min,0)?vo(this.min,-1):vo(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t;i===s&&(i<=0?(n(1),o(10)):(n(vo(i,-1)),o(vo(s,1)))),i<=0&&n(vo(s,-1)),s<=0&&o(vo(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=ko({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&j(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":ne(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=z(t),this._valueRange=z(this.max)-z(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(z(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Po(t){const e=t.ticks;if(e.display&&t.display){const t=ki(e.backdropPadding);return l(e.font&&e.font.size,ue.font.size)+t.height}return 0}function Do(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:tn?{start:e-i,end:e}:{start:e,end:e+i}}function Co(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),s=[],o=[],a=t._pointLabels.length,r=t.options.pointLabels,l=r.centerPointLabels?C/a:0;for(let u=0;ue.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.starte.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function Ao(t,e,i){const s=t.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=i,l=t.getPointPosition(e,s+n+a,o),h=Math.round(Y(G(l.angle+E))),c=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,r.h,h),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(h),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,r.w,d);return{visible:!0,x:l.x,y:c,textAlign:d,left:u,top:c,right:u+r.w,bottom:c+r.h}}function To(t,e){if(!e)return!0;const{left:i,top:s,right:n,bottom:o}=t;return!(Re({x:i,y:s},e)||Re({x:i,y:o},e)||Re({x:n,y:s},e)||Re({x:n,y:o},e))}function Lo(t,e,i){const{left:n,top:o,right:a,bottom:r}=i,{backdropColor:l}=e;if(!s(l)){const i=wi(e.borderRadius),s=ki(e.backdropPadding);t.fillStyle=l;const h=n-s.left,c=o-s.top,d=a-n+s.width,u=r-o+s.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),He(t,{x:h,y:c,w:d,h:u,radius:i}),t.fill()):t.fillRect(h,c,d,u)}}function Eo(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,O);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;ot,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=ki(Po(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=a(t)&&!isNaN(t)?t:0,this.max=a(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Po(this.options))}generateTickLabels(t){bo.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=d(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?Co(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return G(t*(O/(this._pointLabels.length||1))+$(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(s(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(s(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const o=s.setContext(t.getPointLabelContext(n));Lo(i,o,e);const a=Si(o.font),{x:r,y:l,textAlign:h}=e;Ne(i,t._pointLabels[n],r,l+a.lineHeight/2,a,{color:o.color,textAlign:h,textBaseline:"middle"})}}(this,o),s.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){r=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),a=s.setContext(i),l=n.setContext(i);!function(t,e,i,s,n){const o=t.ctx,a=e.circular,{color:r,lineWidth:l}=e;!a&&!s||!r||!l||i<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Eo(t,i,a,s),o.closePath(),o.stroke(),o.restore())}(this,a,r,o,l)}})),i.display){for(t.save(),a=o-1;a>=0;a--){const s=i.setContext(this.getPointLabelContext(a)),{color:n,lineWidth:o}=s;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,r=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(a,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,a)=>{if(0===a&&this.min>=0&&!e.reverse)return;const r=i.setContext(this.getContext(a)),l=Si(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=l.string,o=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=ki(r.backdropPadding);t.fillRect(-o/2-e.left,-n-l.size/2-e.top,o+e.width,l.size+e.height)}Ne(t,s.label,0,-n,l,{color:r.color,strokeColor:r.textStrokeColor,strokeWidth:r.textStrokeWidth})})),t.restore()}drawTitle(){}}const Io={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},zo=Object.keys(Io);function Fo(t,e){return t-e}function Vo(t,e){if(s(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:r}=t._parseOpts;let l=e;return"function"==typeof n&&(l=n(l)),a(l)||(l="string"==typeof n?i.parse(l,n):i.parse(l)),null===l?null:(o&&(l="week"!==o||!N(r)&&!0!==r?i.startOf(l,o):i.startOf(l,"isoWeek",r)),+l)}function Bo(t,e,i,s){const n=zo.length;for(let o=zo.indexOf(t);o=e?i[s]:i[n]]=!0}}else t[e]=!0}function No(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a=0&&(e[l].major=!0);return e}(t,s,n,i):s}class Ho extends tn{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new In._date(t.adapters.date);s.init(e),b(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:Vo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:o,maxDefined:r}=this.getUserBounds();function l(t){o||isNaN(t.min)||(s=Math.min(s,t.min)),r||isNaN(t.max)||(n=Math.max(n,t.max))}o&&r||(l(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||l(this.getMinMax(!1))),s=a(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=a(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=nt(s,n,this.max);return this._unit=e.unit||(i.autoSkip?Bo(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=zo.length-1;o>=zo.indexOf(i);o--){const i=zo[o];if(Io[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return zo[i?zo.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=zo.indexOf(t)+1,i=zo.length;e+t.value)))}initOffsets(t=[]){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=Z(s,0,o),n=Z(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||Bo(n.minUnit,e,i,this._getLabelCapacity(e)),a=l(s.ticks.stepSize,1),r="week"===o&&n.isoWeekday,h=N(r)||!0===r,c={};let d,u,f=e;if(h&&(f=+t.startOf(f,"isoWeek",r)),f=+t.startOf(f,h?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g="data"===s.ticks.source&&this.getDataTimestamps();for(d=f,u=0;d+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,s=this._unit,n=e||i[s];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.ticks.callback;if(o)return d(o,[t,e,i],this);const a=n.time.displayFormats,r=this._unit,l=this._majorUnit,h=r&&a[r],c=l&&a[l],u=i[e],f=l&&c&&u&&u.major;return this._adapter.format(t,s||(f?c:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=it(t,"pos",e)),({pos:s,time:o}=t[r]),({pos:n,time:a}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=it(t,"time",e)),({time:s,pos:o}=t[r]),({time:n,pos:a}=t[l]));const h=n-s;return h?o+(a-o)*(e-s)/h:o}var $o=Object.freeze({__proto__:null,CategoryScale:class extends tn{static id="category";static defaults={ticks:{callback:mo}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(s(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Z(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:po(i,t,l(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){return mo.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:_o,LogarithmicScale:So,RadialLinearScale:Ro,TimeScale:Ho,TimeSeriesScale:class extends Ho{static id="timeseries";static defaults=Ho.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=jo(e,this.min),this._tableRange=jo(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,l,h;for(o=0,a=t.length;o=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;ot-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(jo(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return jo(this._table,i*this._tableRange+this._minPos,!0)}}});const Yo=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Uo=Yo.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function Xo(t){return Yo[t%Yo.length]}function qo(t){return Uo[t%Uo.length]}function Ko(t){let e=0;return(i,s)=>{const n=t.getDatasetMeta(s).controller;n instanceof $n?e=function(t,e){return t.backgroundColor=t.data.map((()=>Xo(e++))),e}(i,e):n instanceof Yn?e=function(t,e){return t.backgroundColor=t.data.map((()=>qo(e++))),e}(i,e):n&&(e=function(t,e){return t.borderColor=Xo(e),t.backgroundColor=qo(e),++e}(i,e))}}function Go(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var Jo={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:s},options:n}=t.config,{elements:o}=n,a=Go(s)||(r=n)&&(r.borderColor||r.backgroundColor)||o&&Go(o)||"rgba(0,0,0,0.1)"!==ue.borderColor||"rgba(0,0,0,0.1)"!==ue.backgroundColor;var r;if(!i.forceOverride&&a)return;const l=Ko(t);s.forEach(l)}};function Zo(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function Qo(t){t.data.datasets.forEach((t=>{Zo(t)}))}var ta={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void Qo(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:a,indexAxis:r}=e,l=t.getDatasetMeta(o),h=a||e.data;if("y"===Pi([r,t.options.indexAxis]))return;if(!l.controller.supportsDecimation)return;const c=t.scales[l.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:d,count:u}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(n=Z(it(e,o.axis,a).lo,0,i-1)),s=h?Z(it(e,o.axis,r).hi+1,n,i)-n:i-n,{start:n,count:s}}(l,h);if(u<=(i.threshold||4*n))return void Zo(e);let f;switch(s(a)&&(e._data=h,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":f=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let l=0;const h=e+i-1;let c,d,u,f,g,p=e;for(a[l++]=t[p],c=0;cu&&(u=f,d=t[s],g=s);a[l++]=d,p=g}return a[l++]=t[h],a}(h,d,u,n,i);break;case"min-max":f=function(t,e,i,n){let o,a,r,l,h,c,d,u,f,g,p=0,m=0;const x=[],b=e+i-1,_=t[e].x,y=t[b].x-_;for(o=e;og&&(g=l,d=o),p=(m*p+a.x)/++m;else{const i=o-1;if(!s(c)&&!s(d)){const e=Math.min(c,d),s=Math.max(c,d);e!==u&&e!==i&&x.push({...t[e],x:p}),s!==u&&s!==i&&x.push({...t[s],x:p})}o>0&&i!==u&&x.push(t[i]),x.push(a),h=e,m=0,f=g=l,c=d=u=o}}return x}(h,d,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=f}))},destroy(t){Qo(t)}};function ea(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=G(n),o=G(o)),{property:t,start:n,end:o}}function ia(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function sa(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function na(t,e){let i=[],s=!1;return n(t)?(s=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach((({start:t,end:e})=>{e=ia(t,e,n);const a=n[t],r=n[e];null!==s?(o.push({x:a.x,y:s}),o.push({x:r.x,y:s})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:r.y}))})),o}(t,e),i.length?new oo({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function oa(t){return t&&!1!==t.fill}function aa(t,e,i){let s=t[e].fill;const n=[e];let o;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!a(s))return s;if(o=t[s],!o)return!1;if(o.visible)return s;n.push(s),s=o.fill}return!1}function ra(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=l(i&&i.target,i);void 0===s&&(s=!!e.backgroundColor);if(!1===s||null===s)return!1;if(!0===s)return"origin";return s}(t);if(o(s))return!isNaN(s.value)&&s;let n=parseFloat(s);return a(n)&&Math.floor(n)===n?function(t,e,i,s){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=s)return!1;return i}(s[0],e,n,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function la(t,e,i){const s=[];for(let n=0;n=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&i.fill&&ua(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;oa(i)&&ua(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;oa(s)&&"beforeDatasetDraw"===i.drawTime&&ua(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const _a=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class ya extends $s{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=d(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=Si(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=_a(i,n);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(o,n,a,r)+10):(h=this.maxHeight,l=this._fitCols(o,s,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+a;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach(((t,f)=>{const g=i+e/2+n.measureText(t.text).width;(0===f||l[l.length-1]+g+2*a>o)&&(c+=h,l[l.length-(f>0?0:1)]=0,u+=h,d++),r[f]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+a})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=o-t;let c=a,d=0,u=0,f=0,g=0;return this.legendItems.forEach(((t,o)=>{const{itemWidth:p,itemHeight:m}=function(t,e,i,s,n){const o=function(t,e,i,s){let n=t.text;n&&"string"!=typeof n&&(n=n.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+s.measureText(n).width}(s,t,e,i),a=function(t,e,i){let s=t;"string"!=typeof e.text&&(s=va(e,i));return s}(n,s,e.lineHeight);return{itemWidth:o,itemHeight:a}}(i,e,n,t,s);o>0&&u+m+2*a>h&&(c+=d+a,l.push({width:d,height:u}),f+=d+a,g++,d=u=0),r[o]={left:f,top:u,col:g,width:p,height:m},d=Math.max(d,p),u+=m+a})),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,o=Oi(n,this.left,this.width);if(this.isHorizontal()){let n=0,a=ft(i,this.left+s,this.right-this.lineWidths[n]);for(const r of e)n!==r.row&&(n=r.row,a=ft(i,this.left+s,this.right-this.lineWidths[n])),r.top+=this.top+t+s,r.left=o.leftForLtr(o.x(a),r.width),a+=r.width+s}else{let n=0,a=ft(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const r of e)r.col!==n&&(n=r.col,a=ft(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),r.top=a,r.left+=this.left+s,r.left=o.leftForLtr(o.x(r.left),r.width),a+=r.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Ie(t,this),this._draw(),ze(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:o}=t,a=ue.color,r=Oi(t.rtl,this.left,this.width),h=Si(o.font),{padding:c}=o,d=h.size,u=d/2;let f;this.drawTitle(),s.textAlign=r.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=h.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=_a(o,d),x=this.isHorizontal(),b=this._computeTitleHeight();f=x?{x:ft(n,this.left+c,this.right-i[0]),y:this.top+c+b,line:0}:{x:this.left+c,y:ft(n,this.top+b+c,this.bottom-e[0].height),line:0},Ai(this.ctx,t.textDirection);const _=m+c;this.legendItems.forEach(((y,v)=>{s.strokeStyle=y.fontColor,s.fillStyle=y.fontColor;const M=s.measureText(y.text).width,w=r.textAlign(y.textAlign||(y.textAlign=o.textAlign)),k=g+u+M;let S=f.x,P=f.y;r.setWidth(this.width),x?v>0&&S+k+c>this.right&&(P=f.y+=_,f.line++,S=f.x=ft(n,this.left+c,this.right-i[f.line])):v>0&&P+_>this.bottom&&(S=f.x=S+e[f.line].width+c,f.line++,P=f.y=ft(n,this.top+b+c,this.bottom-e[f.line].height));if(function(t,e,i){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const n=l(i.lineWidth,1);if(s.fillStyle=l(i.fillStyle,a),s.lineCap=l(i.lineCap,"butt"),s.lineDashOffset=l(i.lineDashOffset,0),s.lineJoin=l(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=l(i.strokeStyle,a),s.setLineDash(l(i.lineDash,[])),o.usePointStyle){const a={radius:p*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},l=r.xPlus(t,g/2);Ee(s,a,l,e+u,o.pointStyleWidth&&g)}else{const o=e+Math.max((d-p)/2,0),a=r.leftForLtr(t,g),l=wi(i.borderRadius);s.beginPath(),Object.values(l).some((t=>0!==t))?He(s,{x:a,y:o,w:g,h:p,radius:l}):s.rect(a,o,g,p),s.fill(),0!==n&&s.stroke()}s.restore()}(r.x(S),P,y),S=gt(w,S+g+u,x?S+k:this.right,t.rtl),function(t,e,i){Ne(s,i.text,t,e+m/2,h,{strikethrough:i.hidden,textAlign:r.textAlign(i.textAlign)})}(r.x(S),P,y),x)f.x+=k+c;else if("string"!=typeof y.text){const t=h.lineHeight;f.y+=va(y,t)+c}else f.y+=_})),Ti(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Si(e.font),s=ki(e.padding);if(!e.display)return;const n=Oi(t.rtl,this.left,this.width),o=this.ctx,a=e.position,r=i.size/2,l=s.top+r;let h,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+l,c=ft(t.align,c,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);h=l+ft(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=ft(a,c,c+d);o.textAlign=n.textAlign(ut(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,Ne(o,e.text,u,h,i)}_computeTitleHeight(){const t=this.options.title,e=Si(t.font),i=ki(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(tt(t,this.left,this.right)&&tt(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;it.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),h=ki(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:l.borderColor,pointStyle:s||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:a&&(r||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class wa extends $s{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const s=n(i.text)?i.text.length:1;this._padding=ki(i.padding);const o=s*Si(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:n,options:o}=this,a=o.align;let r,l,h,c=0;return this.isHorizontal()?(l=ft(a,i,n),h=e+t,r=n-i):("left"===o.position?(l=i+t,h=ft(a,s,e),c=-.5*C):(l=n-t,h=ft(a,e,s),c=.5*C),r=s-e),{titleX:l,titleY:h,maxWidth:r,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Si(e.font),s=i.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:a,rotation:r}=this._drawArgs(s);Ne(t,e.text,0,0,i,{color:e.color,maxWidth:a,rotation:r,textAlign:ut(e.align),textBaseline:"middle",translation:[n,o]})}}var ka={id:"title",_element:wa,start(t,e,i){!function(t,e){const i=new wa({ctx:t.ctx,options:e,chart:t});ls.configure(t,i,e),ls.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;ls.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;ls.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Sa=new WeakMap;var Pa={id:"subtitle",start(t,e,i){const s=new wa({ctx:t.ctx,options:i,chart:t});ls.configure(t,s,i),ls.addBox(t,s),Sa.set(t,s)},stop(t){ls.removeBox(t,Sa.get(t)),Sa.delete(t)},beforeUpdate(t,e,i){const s=Sa.get(t);ls.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Da={average(t){if(!t.length)return!1;let e,i,s=new Set,n=0,o=0;for(e=0,i=t.length;et+e))/s.size,y:n/o}},nearest(t,e){if(!t.length)return!1;let i,s,n,o=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i-1?t.split("\n"):t}function Aa(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Ta(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=Si(e.bodyFont),h=Si(e.titleFont),c=Si(e.footerFont),d=o.length,f=n.length,g=s.length,p=ki(e.padding);let m=p.height,x=0,b=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(b+=t.beforeBody.length+t.afterBody.length,d&&(m+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b){m+=g*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(b-g)*l.lineHeight+(b-1)*e.bodySpacing}f&&(m+=e.footerMarginTop+f*c.lineHeight+(f-1)*e.footerSpacing);let _=0;const y=function(t){x=Math.max(x,i.measureText(t).width+_)};return i.save(),i.font=h.string,u(t.title,y),i.font=l.string,u(t.beforeBody.concat(t.afterBody),y),_=e.displayColors?a+2+e.boxPadding:0,u(s,(t=>{u(t.before,y),u(t.lines,y),u(t.after,y)})),_=0,i.font=c.string,u(t.footer,y),i.restore(),x+=p.width,{width:x,height:m}}function La(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=n<=(r+l)/2?"left":"right":n<=o/2?h="left":n>=a-o/2&&(h="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(h,t,e,i)&&(h="center"),h}function Ea(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||La(t,e,i,s),yAlign:s}}function Ra(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,h=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=wi(a);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,h);return"center"===l?"left"===r?g+=h:"right"===r&&(g-=h):"left"===r?g-=Math.max(c,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:Z(g,0,s.width-e.width),y:Z(p,0,s.height-e.height)}}function Ia(t,e,i){const s=ki(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function za(t){return Ca([],Oa(t))}function Fa(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const Va={beforeTitle:e,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex{const e={before:[],lines:[],after:[]},n=Fa(i,t);Ca(e.before,Oa(Ba(n,"beforeLabel",this,t))),Ca(e.lines,Ba(n,"label",this,t)),Ca(e.after,Oa(Ba(n,"afterLabel",this,t))),s.push(e)})),s}getAfterBody(t,e){return za(Ba(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Ba(i,"beforeFooter",this,t),n=Ba(i,"footer",this,t),o=Ba(i,"afterFooter",this,t);let a=[];return a=Ca(a,Oa(s)),a=Ca(a,Oa(n)),a=Ca(a,Oa(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let a,r,l=[];for(a=0,r=e.length;at.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),u(l,(e=>{const i=Fa(t.callbacks,e);s.push(Ba(i,"labelColor",this,e)),n.push(Ba(i,"labelPointStyle",this,e)),o.push(Ba(i,"labelTextColor",this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=Da[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Ta(this,i),a=Object.assign({},t,e),r=Ea(this.chart,i,a),l=Ra(i,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=wi(a),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,x,b,_,y;return"center"===n?(_=u+g/2,"left"===s?(p=d,m=p-o,b=_+o,y=_-o):(p=d+f,m=p+o,b=_-o,y=_+o),x=p):(m="left"===s?d+Math.max(r,h)+o:"right"===s?d+f-Math.max(l,c)-o:this.caretX,"top"===n?(b=u,_=b-o,p=m-o,x=m+o):(b=u+g,_=b+o,p=m+o,x=m-o),y=b),{x1:p,x2:m,x3:x,y1:b,y2:_,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const l=Oi(i.rtl,this.x,this.width);for(t.x=Ia(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=Si(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,He(t,{x:e,y:g,w:h,h:l,radius:r}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),He(t,{x:i,y:g+1,w:h-2,h:l-2,radius:r}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,g,h,l),t.strokeRect(e,g,h,l),t.fillStyle=a.backgroundColor,t.fillRect(i,g+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=Si(i.bodyFont);let d=c.lineHeight,f=0;const g=Oi(i.rtl,this.x,this.width),p=function(i){e.fillText(i,g.x(t.x+f),t.y+d/2),t.y+=d+n},m=g.textAlign(o);let x,b,_,y,v,M,w;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Ia(this,m,i),e.fillStyle=i.bodyColor,u(this.beforeBody,p),f=a&&"right"!==m?"center"===o?l/2+h:l+2+h:0,y=0,M=s.length;y0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Da[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Ta(this,t),a=Object.assign({},i,this._size),r=Ea(e,t,a),l=Ra(t,a,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ki(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),Ai(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Ti(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!f(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),a=this._positionChanged(o,t),r=e||!f(o,n)||a;return r&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Da[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}var Na={id:"tooltip",_element:Wa,positioners:Da,afterInit(t,e,i){i&&(t.tooltip=new Wa({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Va},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};return Tn.register(Un,$o,go,t),Tn.helpers={...Hi},Tn._adapters=In,Tn.Animation=As,Tn.Animations=Ts,Tn.animator=bt,Tn.controllers=nn.controllers.items,Tn.DatasetController=js,Tn.Element=$s,Tn.elements=go,Tn.Interaction=Ki,Tn.layouts=ls,Tn.platforms=Ds,Tn.Scale=tn,Tn.Ticks=ae,Object.assign(Tn,Un,$o,go,t,Ds),Tn.Chart=Tn,"undefined"!=typeof window&&(window.Chart=Tn),Tn})); +//# sourceMappingURL=chart.umd.js.map diff --git a/dashboard/static/js/flatpickr.js b/dashboard/static/js/flatpickr.js new file mode 100644 index 0000000..2bcc9f3 --- /dev/null +++ b/dashboard/static/js/flatpickr.js @@ -0,0 +1,2719 @@ +/* flatpickr v4.6.13, @license MIT */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.flatpickr = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + 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 __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + + function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + } + + var HOOKS = [ + "onChange", + "onClose", + "onDayCreate", + "onDestroy", + "onKeyDown", + "onMonthChange", + "onOpen", + "onParseConfig", + "onReady", + "onValueUpdate", + "onYearChange", + "onPreCalendarPosition", + ]; + var defaults = { + _disable: [], + allowInput: false, + allowInvalidPreload: false, + altFormat: "F j, Y", + altInput: false, + altInputClass: "form-control input", + animate: typeof window === "object" && + window.navigator.userAgent.indexOf("MSIE") === -1, + ariaDateFormat: "F j, Y", + autoFillDefaultTime: true, + clickOpens: true, + closeOnSelect: true, + conjunction: ", ", + dateFormat: "Y-m-d", + defaultHour: 12, + defaultMinute: 0, + defaultSeconds: 0, + disable: [], + disableMobile: false, + enableSeconds: false, + enableTime: false, + errorHandler: function (err) { + return typeof console !== "undefined" && console.warn(err); + }, + getWeek: function (givenDate) { + var date = new Date(givenDate.getTime()); + date.setHours(0, 0, 0, 0); + // Thursday in current week decides the year. + date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7)); + // January 4 is always in week 1. + var week1 = new Date(date.getFullYear(), 0, 4); + // Adjust to Thursday in week 1 and count number of weeks from date to week1. + return (1 + + Math.round(((date.getTime() - week1.getTime()) / 86400000 - + 3 + + ((week1.getDay() + 6) % 7)) / + 7)); + }, + hourIncrement: 1, + ignoredFocusElements: [], + inline: false, + locale: "default", + minuteIncrement: 5, + mode: "single", + monthSelectorType: "dropdown", + nextArrow: "", + noCalendar: false, + now: new Date(), + onChange: [], + onClose: [], + onDayCreate: [], + onDestroy: [], + onKeyDown: [], + onMonthChange: [], + onOpen: [], + onParseConfig: [], + onReady: [], + onValueUpdate: [], + onYearChange: [], + onPreCalendarPosition: [], + plugins: [], + position: "auto", + positionElement: undefined, + prevArrow: "", + shorthandCurrentMonth: false, + showMonths: 1, + static: false, + time_24hr: false, + weekNumbers: false, + wrap: false, + }; + + var english = { + weekdays: { + shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + longhand: [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday", + ], + }, + months: { + shorthand: [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec", + ], + longhand: [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", + ], + }, + daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + firstDayOfWeek: 0, + ordinal: function (nth) { + var s = nth % 100; + if (s > 3 && s < 21) + return "th"; + switch (s % 10) { + case 1: + return "st"; + case 2: + return "nd"; + case 3: + return "rd"; + default: + return "th"; + } + }, + rangeSeparator: " to ", + weekAbbreviation: "Wk", + scrollTitle: "Scroll to increment", + toggleTitle: "Click to toggle", + amPM: ["AM", "PM"], + yearAriaLabel: "Year", + monthAriaLabel: "Month", + hourAriaLabel: "Hour", + minuteAriaLabel: "Minute", + time_24hr: false, + }; + + var pad = function (number, length) { + if (length === void 0) { length = 2; } + return ("000" + number).slice(length * -1); + }; + var int = function (bool) { return (bool === true ? 1 : 0); }; + /* istanbul ignore next */ + function debounce(fn, wait) { + var t; + return function () { + var _this = this; + var args = arguments; + clearTimeout(t); + t = setTimeout(function () { return fn.apply(_this, args); }, wait); + }; + } + var arrayify = function (obj) { + return obj instanceof Array ? obj : [obj]; + }; + + function toggleClass(elem, className, bool) { + if (bool === true) + return elem.classList.add(className); + elem.classList.remove(className); + } + function createElement(tag, className, content) { + var e = window.document.createElement(tag); + className = className || ""; + content = content || ""; + e.className = className; + if (content !== undefined) + e.textContent = content; + return e; + } + function clearNode(node) { + while (node.firstChild) + node.removeChild(node.firstChild); + } + function findParent(node, condition) { + if (condition(node)) + return node; + else if (node.parentNode) + return findParent(node.parentNode, condition); + return undefined; // nothing found + } + function createNumberInput(inputClassName, opts) { + var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown"); + if (navigator.userAgent.indexOf("MSIE 9.0") === -1) { + numInput.type = "number"; + } + else { + numInput.type = "text"; + numInput.pattern = "\\d*"; + } + if (opts !== undefined) + for (var key in opts) + numInput.setAttribute(key, opts[key]); + wrapper.appendChild(numInput); + wrapper.appendChild(arrowUp); + wrapper.appendChild(arrowDown); + return wrapper; + } + function getEventTarget(event) { + try { + if (typeof event.composedPath === "function") { + var path = event.composedPath(); + return path[0]; + } + return event.target; + } + catch (error) { + return event.target; + } + } + + var doNothing = function () { return undefined; }; + var monthToStr = function (monthNumber, shorthand, locale) { return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; }; + var revFormat = { + D: doNothing, + F: function (dateObj, monthName, locale) { + dateObj.setMonth(locale.months.longhand.indexOf(monthName)); + }, + G: function (dateObj, hour) { + dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour)); + }, + H: function (dateObj, hour) { + dateObj.setHours(parseFloat(hour)); + }, + J: function (dateObj, day) { + dateObj.setDate(parseFloat(day)); + }, + K: function (dateObj, amPM, locale) { + dateObj.setHours((dateObj.getHours() % 12) + + 12 * int(new RegExp(locale.amPM[1], "i").test(amPM))); + }, + M: function (dateObj, shortMonth, locale) { + dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth)); + }, + S: function (dateObj, seconds) { + dateObj.setSeconds(parseFloat(seconds)); + }, + U: function (_, unixSeconds) { return new Date(parseFloat(unixSeconds) * 1000); }, + W: function (dateObj, weekNum, locale) { + var weekNumber = parseInt(weekNum); + var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0); + date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek); + return date; + }, + Y: function (dateObj, year) { + dateObj.setFullYear(parseFloat(year)); + }, + Z: function (_, ISODate) { return new Date(ISODate); }, + d: function (dateObj, day) { + dateObj.setDate(parseFloat(day)); + }, + h: function (dateObj, hour) { + dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour)); + }, + i: function (dateObj, minutes) { + dateObj.setMinutes(parseFloat(minutes)); + }, + j: function (dateObj, day) { + dateObj.setDate(parseFloat(day)); + }, + l: doNothing, + m: function (dateObj, month) { + dateObj.setMonth(parseFloat(month) - 1); + }, + n: function (dateObj, month) { + dateObj.setMonth(parseFloat(month) - 1); + }, + s: function (dateObj, seconds) { + dateObj.setSeconds(parseFloat(seconds)); + }, + u: function (_, unixMillSeconds) { + return new Date(parseFloat(unixMillSeconds)); + }, + w: doNothing, + y: function (dateObj, year) { + dateObj.setFullYear(2000 + parseFloat(year)); + }, + }; + var tokenRegex = { + D: "", + F: "", + G: "(\\d\\d|\\d)", + H: "(\\d\\d|\\d)", + J: "(\\d\\d|\\d)\\w+", + K: "", + M: "", + S: "(\\d\\d|\\d)", + U: "(.+)", + W: "(\\d\\d|\\d)", + Y: "(\\d{4})", + Z: "(.+)", + d: "(\\d\\d|\\d)", + h: "(\\d\\d|\\d)", + i: "(\\d\\d|\\d)", + j: "(\\d\\d|\\d)", + l: "", + m: "(\\d\\d|\\d)", + n: "(\\d\\d|\\d)", + s: "(\\d\\d|\\d)", + u: "(.+)", + w: "(\\d\\d|\\d)", + y: "(\\d{2})", + }; + var formats = { + // get the date in UTC + Z: function (date) { return date.toISOString(); }, + // weekday name, short, e.g. Thu + D: function (date, locale, options) { + return locale.weekdays.shorthand[formats.w(date, locale, options)]; + }, + // full month name e.g. January + F: function (date, locale, options) { + return monthToStr(formats.n(date, locale, options) - 1, false, locale); + }, + // padded hour 1-12 + G: function (date, locale, options) { + return pad(formats.h(date, locale, options)); + }, + // hours with leading zero e.g. 03 + H: function (date) { return pad(date.getHours()); }, + // day (1-30) with ordinal suffix e.g. 1st, 2nd + J: function (date, locale) { + return locale.ordinal !== undefined + ? date.getDate() + locale.ordinal(date.getDate()) + : date.getDate(); + }, + // AM/PM + K: function (date, locale) { return locale.amPM[int(date.getHours() > 11)]; }, + // shorthand month e.g. Jan, Sep, Oct, etc + M: function (date, locale) { + return monthToStr(date.getMonth(), true, locale); + }, + // seconds 00-59 + S: function (date) { return pad(date.getSeconds()); }, + // unix timestamp + U: function (date) { return date.getTime() / 1000; }, + W: function (date, _, options) { + return options.getWeek(date); + }, + // full year e.g. 2016, padded (0001-9999) + Y: function (date) { return pad(date.getFullYear(), 4); }, + // day in month, padded (01-30) + d: function (date) { return pad(date.getDate()); }, + // hour from 1-12 (am/pm) + h: function (date) { return (date.getHours() % 12 ? date.getHours() % 12 : 12); }, + // minutes, padded with leading zero e.g. 09 + i: function (date) { return pad(date.getMinutes()); }, + // day in month (1-30) + j: function (date) { return date.getDate(); }, + // weekday name, full, e.g. Thursday + l: function (date, locale) { + return locale.weekdays.longhand[date.getDay()]; + }, + // padded month number (01-12) + m: function (date) { return pad(date.getMonth() + 1); }, + // the month number (1-12) + n: function (date) { return date.getMonth() + 1; }, + // seconds 0-59 + s: function (date) { return date.getSeconds(); }, + // Unix Milliseconds + u: function (date) { return date.getTime(); }, + // number of the day of the week + w: function (date) { return date.getDay(); }, + // last two digits of year e.g. 16 for 2016 + y: function (date) { return String(date.getFullYear()).substring(2); }, + }; + + var createDateFormatter = function (_a) { + var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d; + return function (dateObj, frmt, overrideLocale) { + var locale = overrideLocale || l10n; + if (config.formatDate !== undefined && !isMobile) { + return config.formatDate(dateObj, frmt, locale); + } + return frmt + .split("") + .map(function (c, i, arr) { + return formats[c] && arr[i - 1] !== "\\" + ? formats[c](dateObj, locale, config) + : c !== "\\" + ? c + : ""; + }) + .join(""); + }; + }; + var createDateParser = function (_a) { + var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c; + return function (date, givenFormat, timeless, customLocale) { + if (date !== 0 && !date) + return undefined; + var locale = customLocale || l10n; + var parsedDate; + var dateOrig = date; + if (date instanceof Date) + parsedDate = new Date(date.getTime()); + else if (typeof date !== "string" && + date.toFixed !== undefined // timestamp + ) + // create a copy + parsedDate = new Date(date); + else if (typeof date === "string") { + // date string + var format = givenFormat || (config || defaults).dateFormat; + var datestr = String(date).trim(); + if (datestr === "today") { + parsedDate = new Date(); + timeless = true; + } + else if (config && config.parseDate) { + parsedDate = config.parseDate(date, format); + } + else if (/Z$/.test(datestr) || + /GMT$/.test(datestr) // datestrings w/ timezone + ) { + parsedDate = new Date(date); + } + else { + var matched = void 0, ops = []; + for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) { + var token_1 = format[i]; + var isBackSlash = token_1 === "\\"; + var escaped = format[i - 1] === "\\" || isBackSlash; + if (tokenRegex[token_1] && !escaped) { + regexStr += tokenRegex[token_1]; + var match = new RegExp(regexStr).exec(date); + if (match && (matched = true)) { + ops[token_1 !== "Y" ? "push" : "unshift"]({ + fn: revFormat[token_1], + val: match[++matchIndex], + }); + } + } + else if (!isBackSlash) + regexStr += "."; // don't really care + } + parsedDate = + !config || !config.noCalendar + ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) + : new Date(new Date().setHours(0, 0, 0, 0)); + ops.forEach(function (_a) { + var fn = _a.fn, val = _a.val; + return (parsedDate = fn(parsedDate, val, locale) || parsedDate); + }); + parsedDate = matched ? parsedDate : undefined; + } + } + /* istanbul ignore next */ + if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) { + config.errorHandler(new Error("Invalid date provided: " + dateOrig)); + return undefined; + } + if (timeless === true) + parsedDate.setHours(0, 0, 0, 0); + return parsedDate; + }; + }; + /** + * Compute the difference in dates, measured in ms + */ + function compareDates(date1, date2, timeless) { + if (timeless === void 0) { timeless = true; } + if (timeless !== false) { + return (new Date(date1.getTime()).setHours(0, 0, 0, 0) - + new Date(date2.getTime()).setHours(0, 0, 0, 0)); + } + return date1.getTime() - date2.getTime(); + } + var isBetween = function (ts, ts1, ts2) { + return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2); + }; + var calculateSecondsSinceMidnight = function (hours, minutes, seconds) { + return hours * 3600 + minutes * 60 + seconds; + }; + var parseSeconds = function (secondsSinceMidnight) { + var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60; + return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60]; + }; + var duration = { + DAY: 86400000, + }; + function getDefaultHours(config) { + var hours = config.defaultHour; + var minutes = config.defaultMinute; + var seconds = config.defaultSeconds; + if (config.minDate !== undefined) { + var minHour = config.minDate.getHours(); + var minMinutes = config.minDate.getMinutes(); + var minSeconds = config.minDate.getSeconds(); + if (hours < minHour) { + hours = minHour; + } + if (hours === minHour && minutes < minMinutes) { + minutes = minMinutes; + } + if (hours === minHour && minutes === minMinutes && seconds < minSeconds) + seconds = config.minDate.getSeconds(); + } + if (config.maxDate !== undefined) { + var maxHr = config.maxDate.getHours(); + var maxMinutes = config.maxDate.getMinutes(); + hours = Math.min(hours, maxHr); + if (hours === maxHr) + minutes = Math.min(maxMinutes, minutes); + if (hours === maxHr && minutes === maxMinutes) + seconds = config.maxDate.getSeconds(); + } + return { hours: hours, minutes: minutes, seconds: seconds }; + } + + if (typeof Object.assign !== "function") { + Object.assign = function (target) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (!target) { + throw TypeError("Cannot convert undefined or null to object"); + } + var _loop_1 = function (source) { + if (source) { + Object.keys(source).forEach(function (key) { return (target[key] = source[key]); }); + } + }; + for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { + var source = args_1[_a]; + _loop_1(source); + } + return target; + }; + } + + var DEBOUNCED_CHANGE_MS = 300; + function FlatpickrInstance(element, instanceConfig) { + var self = { + config: __assign(__assign({}, defaults), flatpickr.defaultConfig), + l10n: english, + }; + self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); + self._handlers = []; + self.pluginElements = []; + self.loadedPlugins = []; + self._bind = bind; + self._setHoursFromDate = setHoursFromDate; + self._positionCalendar = positionCalendar; + self.changeMonth = changeMonth; + self.changeYear = changeYear; + self.clear = clear; + self.close = close; + self.onMouseOver = onMouseOver; + self._createElement = createElement; + self.createDay = createDay; + self.destroy = destroy; + self.isEnabled = isEnabled; + self.jumpToDate = jumpToDate; + self.updateValue = updateValue; + self.open = open; + self.redraw = redraw; + self.set = set; + self.setDate = setDate; + self.toggle = toggle; + function setupHelperFunctions() { + self.utils = { + getDaysInMonth: function (month, yr) { + if (month === void 0) { month = self.currentMonth; } + if (yr === void 0) { yr = self.currentYear; } + if (month === 1 && ((yr % 4 === 0 && yr % 100 !== 0) || yr % 400 === 0)) + return 29; + return self.l10n.daysInMonth[month]; + }, + }; + } + function init() { + self.element = self.input = element; + self.isOpen = false; + parseConfig(); + setupLocale(); + setupInputs(); + setupDates(); + setupHelperFunctions(); + if (!self.isMobile) + build(); + bindEvents(); + if (self.selectedDates.length || self.config.noCalendar) { + if (self.config.enableTime) { + setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined); + } + updateValue(false); + } + setCalendarWidth(); + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + /* TODO: investigate this further + + Currently, there is weird positioning behavior in safari causing pages + to scroll up. https://github.com/chmln/flatpickr/issues/563 + + However, most browsers are not Safari and positioning is expensive when used + in scale. https://github.com/chmln/flatpickr/issues/1096 + */ + if (!self.isMobile && isSafari) { + positionCalendar(); + } + triggerEvent("onReady"); + } + function getClosestActiveElement() { + var _a; + return (((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode()) + .activeElement || document.activeElement); + } + function bindToInstance(fn) { + return fn.bind(self); + } + function setCalendarWidth() { + var config = self.config; + if (config.weekNumbers === false && config.showMonths === 1) { + return; + } + else if (config.noCalendar !== true) { + window.requestAnimationFrame(function () { + if (self.calendarContainer !== undefined) { + self.calendarContainer.style.visibility = "hidden"; + self.calendarContainer.style.display = "block"; + } + if (self.daysContainer !== undefined) { + var daysWidth = (self.days.offsetWidth + 1) * config.showMonths; + self.daysContainer.style.width = daysWidth + "px"; + self.calendarContainer.style.width = + daysWidth + + (self.weekWrapper !== undefined + ? self.weekWrapper.offsetWidth + : 0) + + "px"; + self.calendarContainer.style.removeProperty("visibility"); + self.calendarContainer.style.removeProperty("display"); + } + }); + } + } + /** + * The handler for all events targeting the time inputs + */ + function updateTime(e) { + if (self.selectedDates.length === 0) { + var defaultDate = self.config.minDate === undefined || + compareDates(new Date(), self.config.minDate) >= 0 + ? new Date() + : new Date(self.config.minDate.getTime()); + var defaults = getDefaultHours(self.config); + defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds()); + self.selectedDates = [defaultDate]; + self.latestSelectedDateObj = defaultDate; + } + if (e !== undefined && e.type !== "blur") { + timeWrapper(e); + } + var prevValue = self._input.value; + setHoursFromInputs(); + updateValue(); + if (self._input.value !== prevValue) { + self._debouncedChange(); + } + } + function ampm2military(hour, amPM) { + return (hour % 12) + 12 * int(amPM === self.l10n.amPM[1]); + } + function military2ampm(hour) { + switch (hour % 24) { + case 0: + case 12: + return 12; + default: + return hour % 12; + } + } + /** + * Syncs the selected date object time with user's time input + */ + function setHoursFromInputs() { + if (self.hourElement === undefined || self.minuteElement === undefined) + return; + var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined + ? (parseInt(self.secondElement.value, 10) || 0) % 60 + : 0; + if (self.amPM !== undefined) { + hours = ampm2military(hours, self.amPM.textContent); + } + var limitMinHours = self.config.minTime !== undefined || + (self.config.minDate && + self.minDateHasTime && + self.latestSelectedDateObj && + compareDates(self.latestSelectedDateObj, self.config.minDate, true) === + 0); + var limitMaxHours = self.config.maxTime !== undefined || + (self.config.maxDate && + self.maxDateHasTime && + self.latestSelectedDateObj && + compareDates(self.latestSelectedDateObj, self.config.maxDate, true) === + 0); + if (self.config.maxTime !== undefined && + self.config.minTime !== undefined && + self.config.minTime > self.config.maxTime) { + var minBound = calculateSecondsSinceMidnight(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds()); + var maxBound = calculateSecondsSinceMidnight(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds()); + var currentTime = calculateSecondsSinceMidnight(hours, minutes, seconds); + if (currentTime > maxBound && currentTime < minBound) { + var result = parseSeconds(minBound); + hours = result[0]; + minutes = result[1]; + seconds = result[2]; + } + } + else { + if (limitMaxHours) { + var maxTime = self.config.maxTime !== undefined + ? self.config.maxTime + : self.config.maxDate; + hours = Math.min(hours, maxTime.getHours()); + if (hours === maxTime.getHours()) + minutes = Math.min(minutes, maxTime.getMinutes()); + if (minutes === maxTime.getMinutes()) + seconds = Math.min(seconds, maxTime.getSeconds()); + } + if (limitMinHours) { + var minTime = self.config.minTime !== undefined + ? self.config.minTime + : self.config.minDate; + hours = Math.max(hours, minTime.getHours()); + if (hours === minTime.getHours() && minutes < minTime.getMinutes()) + minutes = minTime.getMinutes(); + if (minutes === minTime.getMinutes()) + seconds = Math.max(seconds, minTime.getSeconds()); + } + } + setHours(hours, minutes, seconds); + } + /** + * Syncs time input values with a date + */ + function setHoursFromDate(dateObj) { + var date = dateObj || self.latestSelectedDateObj; + if (date && date instanceof Date) { + setHours(date.getHours(), date.getMinutes(), date.getSeconds()); + } + } + /** + * Sets the hours, minutes, and optionally seconds + * of the latest selected date object and the + * corresponding time inputs + * @param {Number} hours the hour. whether its military + * or am-pm gets inferred from config + * @param {Number} minutes the minutes + * @param {Number} seconds the seconds (optional) + */ + function setHours(hours, minutes, seconds) { + if (self.latestSelectedDateObj !== undefined) { + self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0); + } + if (!self.hourElement || !self.minuteElement || self.isMobile) + return; + self.hourElement.value = pad(!self.config.time_24hr + ? ((12 + hours) % 12) + 12 * int(hours % 12 === 0) + : hours); + self.minuteElement.value = pad(minutes); + if (self.amPM !== undefined) + self.amPM.textContent = self.l10n.amPM[int(hours >= 12)]; + if (self.secondElement !== undefined) + self.secondElement.value = pad(seconds); + } + /** + * Handles the year input and incrementing events + * @param {Event} event the keyup or increment event + */ + function onYearInput(event) { + var eventTarget = getEventTarget(event); + var year = parseInt(eventTarget.value) + (event.delta || 0); + if (year / 1000 > 1 || + (event.key === "Enter" && !/[^\d]/.test(year.toString()))) { + changeYear(year); + } + } + /** + * Essentially addEventListener + tracking + * @param {Element} element the element to addEventListener to + * @param {String} event the event name + * @param {Function} handler the event handler + */ + function bind(element, event, handler, options) { + if (event instanceof Array) + return event.forEach(function (ev) { return bind(element, ev, handler, options); }); + if (element instanceof Array) + return element.forEach(function (el) { return bind(el, event, handler, options); }); + element.addEventListener(event, handler, options); + self._handlers.push({ + remove: function () { return element.removeEventListener(event, handler, options); }, + }); + } + function triggerChange() { + triggerEvent("onChange"); + } + /** + * Adds all the necessary event listeners + */ + function bindEvents() { + if (self.config.wrap) { + ["open", "close", "toggle", "clear"].forEach(function (evt) { + Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function (el) { + return bind(el, "click", self[evt]); + }); + }); + } + if (self.isMobile) { + setupMobile(); + return; + } + var debouncedResize = debounce(onResize, 50); + self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS); + if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) + bind(self.daysContainer, "mouseover", function (e) { + if (self.config.mode === "range") + onMouseOver(getEventTarget(e)); + }); + bind(self._input, "keydown", onKeyDown); + if (self.calendarContainer !== undefined) { + bind(self.calendarContainer, "keydown", onKeyDown); + } + if (!self.config.inline && !self.config.static) + bind(window, "resize", debouncedResize); + if (window.ontouchstart !== undefined) + bind(window.document, "touchstart", documentClick); + else + bind(window.document, "mousedown", documentClick); + bind(window.document, "focus", documentClick, { capture: true }); + if (self.config.clickOpens === true) { + bind(self._input, "focus", self.open); + bind(self._input, "click", self.open); + } + if (self.daysContainer !== undefined) { + bind(self.monthNav, "click", onMonthNavClick); + bind(self.monthNav, ["keyup", "increment"], onYearInput); + bind(self.daysContainer, "click", selectDate); + } + if (self.timeContainer !== undefined && + self.minuteElement !== undefined && + self.hourElement !== undefined) { + var selText = function (e) { + return getEventTarget(e).select(); + }; + bind(self.timeContainer, ["increment"], updateTime); + bind(self.timeContainer, "blur", updateTime, { capture: true }); + bind(self.timeContainer, "click", timeIncrement); + bind([self.hourElement, self.minuteElement], ["focus", "click"], selText); + if (self.secondElement !== undefined) + bind(self.secondElement, "focus", function () { return self.secondElement && self.secondElement.select(); }); + if (self.amPM !== undefined) { + bind(self.amPM, "click", function (e) { + updateTime(e); + }); + } + } + if (self.config.allowInput) { + bind(self._input, "blur", onBlur); + } + } + /** + * Set the calendar view to a particular date. + * @param {Date} jumpDate the date to set the view to + * @param {boolean} triggerChange if change events should be triggered + */ + function jumpToDate(jumpDate, triggerChange) { + var jumpTo = jumpDate !== undefined + ? self.parseDate(jumpDate) + : self.latestSelectedDateObj || + (self.config.minDate && self.config.minDate > self.now + ? self.config.minDate + : self.config.maxDate && self.config.maxDate < self.now + ? self.config.maxDate + : self.now); + var oldYear = self.currentYear; + var oldMonth = self.currentMonth; + try { + if (jumpTo !== undefined) { + self.currentYear = jumpTo.getFullYear(); + self.currentMonth = jumpTo.getMonth(); + } + } + catch (e) { + /* istanbul ignore next */ + e.message = "Invalid date supplied: " + jumpTo; + self.config.errorHandler(e); + } + if (triggerChange && self.currentYear !== oldYear) { + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + if (triggerChange && + (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) { + triggerEvent("onMonthChange"); + } + self.redraw(); + } + /** + * The up/down arrow handler for time inputs + * @param {Event} e the click event + */ + function timeIncrement(e) { + var eventTarget = getEventTarget(e); + if (~eventTarget.className.indexOf("arrow")) + incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1); + } + /** + * Increments/decrements the value of input associ- + * ated with the up/down arrow by dispatching an + * "increment" event on the input. + * + * @param {Event} e the click event + * @param {Number} delta the diff (usually 1 or -1) + * @param {Element} inputElem the input element + */ + function incrementNumInput(e, delta, inputElem) { + var target = e && getEventTarget(e); + var input = inputElem || + (target && target.parentNode && target.parentNode.firstChild); + var event = createEvent("increment"); + event.delta = delta; + input && input.dispatchEvent(event); + } + function build() { + var fragment = window.document.createDocumentFragment(); + self.calendarContainer = createElement("div", "flatpickr-calendar"); + self.calendarContainer.tabIndex = -1; + if (!self.config.noCalendar) { + fragment.appendChild(buildMonthNav()); + self.innerContainer = createElement("div", "flatpickr-innerContainer"); + if (self.config.weekNumbers) { + var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers; + self.innerContainer.appendChild(weekWrapper); + self.weekNumbers = weekNumbers; + self.weekWrapper = weekWrapper; + } + self.rContainer = createElement("div", "flatpickr-rContainer"); + self.rContainer.appendChild(buildWeekdays()); + if (!self.daysContainer) { + self.daysContainer = createElement("div", "flatpickr-days"); + self.daysContainer.tabIndex = -1; + } + buildDays(); + self.rContainer.appendChild(self.daysContainer); + self.innerContainer.appendChild(self.rContainer); + fragment.appendChild(self.innerContainer); + } + if (self.config.enableTime) { + fragment.appendChild(buildTime()); + } + toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range"); + toggleClass(self.calendarContainer, "animate", self.config.animate === true); + toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1); + self.calendarContainer.appendChild(fragment); + var customAppend = self.config.appendTo !== undefined && + self.config.appendTo.nodeType !== undefined; + if (self.config.inline || self.config.static) { + self.calendarContainer.classList.add(self.config.inline ? "inline" : "static"); + if (self.config.inline) { + if (!customAppend && self.element.parentNode) + self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling); + else if (self.config.appendTo !== undefined) + self.config.appendTo.appendChild(self.calendarContainer); + } + if (self.config.static) { + var wrapper = createElement("div", "flatpickr-wrapper"); + if (self.element.parentNode) + self.element.parentNode.insertBefore(wrapper, self.element); + wrapper.appendChild(self.element); + if (self.altInput) + wrapper.appendChild(self.altInput); + wrapper.appendChild(self.calendarContainer); + } + } + if (!self.config.static && !self.config.inline) + (self.config.appendTo !== undefined + ? self.config.appendTo + : window.document.body).appendChild(self.calendarContainer); + } + function createDay(className, date, _dayNumber, i) { + var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", className, date.getDate().toString()); + dayElement.dateObj = date; + dayElement.$i = i; + dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat)); + if (className.indexOf("hidden") === -1 && + compareDates(date, self.now) === 0) { + self.todayDateElem = dayElement; + dayElement.classList.add("today"); + dayElement.setAttribute("aria-current", "date"); + } + if (dateIsEnabled) { + dayElement.tabIndex = -1; + if (isDateSelected(date)) { + dayElement.classList.add("selected"); + self.selectedDateElem = dayElement; + if (self.config.mode === "range") { + toggleClass(dayElement, "startRange", self.selectedDates[0] && + compareDates(date, self.selectedDates[0], true) === 0); + toggleClass(dayElement, "endRange", self.selectedDates[1] && + compareDates(date, self.selectedDates[1], true) === 0); + if (className === "nextMonthDay") + dayElement.classList.add("inRange"); + } + } + } + else { + dayElement.classList.add("flatpickr-disabled"); + } + if (self.config.mode === "range") { + if (isDateInRange(date) && !isDateSelected(date)) + dayElement.classList.add("inRange"); + } + if (self.weekNumbers && + self.config.showMonths === 1 && + className !== "prevMonthDay" && + i % 7 === 6) { + self.weekNumbers.insertAdjacentHTML("beforeend", "" + self.config.getWeek(date) + ""); + } + triggerEvent("onDayCreate", dayElement); + return dayElement; + } + function focusOnDayElem(targetNode) { + targetNode.focus(); + if (self.config.mode === "range") + onMouseOver(targetNode); + } + function getFirstAvailableDay(delta) { + var startMonth = delta > 0 ? 0 : self.config.showMonths - 1; + var endMonth = delta > 0 ? self.config.showMonths : -1; + for (var m = startMonth; m != endMonth; m += delta) { + var month = self.daysContainer.children[m]; + var startIndex = delta > 0 ? 0 : month.children.length - 1; + var endIndex = delta > 0 ? month.children.length : -1; + for (var i = startIndex; i != endIndex; i += delta) { + var c = month.children[i]; + if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj)) + return c; + } + } + return undefined; + } + function getNextAvailableDay(current, delta) { + var givenMonth = current.className.indexOf("Month") === -1 + ? current.dateObj.getMonth() + : self.currentMonth; + var endMonth = delta > 0 ? self.config.showMonths : -1; + var loopDelta = delta > 0 ? 1 : -1; + for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) { + var month = self.daysContainer.children[m]; + var startIndex = givenMonth - self.currentMonth === m + ? current.$i + delta + : delta < 0 + ? month.children.length - 1 + : 0; + var numMonthDays = month.children.length; + for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) { + var c = month.children[i]; + if (c.className.indexOf("hidden") === -1 && + isEnabled(c.dateObj) && + Math.abs(current.$i - i) >= Math.abs(delta)) + return focusOnDayElem(c); + } + } + self.changeMonth(loopDelta); + focusOnDay(getFirstAvailableDay(loopDelta), 0); + return undefined; + } + function focusOnDay(current, offset) { + var activeElement = getClosestActiveElement(); + var dayFocused = isInView(activeElement || document.body); + var startElem = current !== undefined + ? current + : dayFocused + ? activeElement + : self.selectedDateElem !== undefined && isInView(self.selectedDateElem) + ? self.selectedDateElem + : self.todayDateElem !== undefined && isInView(self.todayDateElem) + ? self.todayDateElem + : getFirstAvailableDay(offset > 0 ? 1 : -1); + if (startElem === undefined) { + self._input.focus(); + } + else if (!dayFocused) { + focusOnDayElem(startElem); + } + else { + getNextAvailableDay(startElem, offset); + } + } + function buildMonthDays(year, month) { + var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7; + var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year); + var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay"; + var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0; + // prepend days from the ending of previous month + for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) { + days.appendChild(createDay("flatpickr-day " + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex)); + } + // Start at 1 since there is no 0th day + for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) { + days.appendChild(createDay("flatpickr-day", new Date(year, month, dayNumber), dayNumber, dayIndex)); + } + // append days from the next month + for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && + (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) { + days.appendChild(createDay("flatpickr-day " + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex)); + } + //updateNavigationCurrentMonth(); + var dayContainer = createElement("div", "dayContainer"); + dayContainer.appendChild(days); + return dayContainer; + } + function buildDays() { + if (self.daysContainer === undefined) { + return; + } + clearNode(self.daysContainer); + // TODO: week numbers for each month + if (self.weekNumbers) + clearNode(self.weekNumbers); + var frag = document.createDocumentFragment(); + for (var i = 0; i < self.config.showMonths; i++) { + var d = new Date(self.currentYear, self.currentMonth, 1); + d.setMonth(self.currentMonth + i); + frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth())); + } + self.daysContainer.appendChild(frag); + self.days = self.daysContainer.firstChild; + if (self.config.mode === "range" && self.selectedDates.length === 1) { + onMouseOver(); + } + } + function buildMonthSwitch() { + if (self.config.showMonths > 1 || + self.config.monthSelectorType !== "dropdown") + return; + var shouldBuildMonth = function (month) { + if (self.config.minDate !== undefined && + self.currentYear === self.config.minDate.getFullYear() && + month < self.config.minDate.getMonth()) { + return false; + } + return !(self.config.maxDate !== undefined && + self.currentYear === self.config.maxDate.getFullYear() && + month > self.config.maxDate.getMonth()); + }; + self.monthsDropdownContainer.tabIndex = -1; + self.monthsDropdownContainer.innerHTML = ""; + for (var i = 0; i < 12; i++) { + if (!shouldBuildMonth(i)) + continue; + var month = createElement("option", "flatpickr-monthDropdown-month"); + month.value = new Date(self.currentYear, i).getMonth().toString(); + month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n); + month.tabIndex = -1; + if (self.currentMonth === i) { + month.selected = true; + } + self.monthsDropdownContainer.appendChild(month); + } + } + function buildMonth() { + var container = createElement("div", "flatpickr-month"); + var monthNavFragment = window.document.createDocumentFragment(); + var monthElement; + if (self.config.showMonths > 1 || + self.config.monthSelectorType === "static") { + monthElement = createElement("span", "cur-month"); + } + else { + self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months"); + self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel); + bind(self.monthsDropdownContainer, "change", function (e) { + var target = getEventTarget(e); + var selectedMonth = parseInt(target.value, 10); + self.changeMonth(selectedMonth - self.currentMonth); + triggerEvent("onMonthChange"); + }); + buildMonthSwitch(); + monthElement = self.monthsDropdownContainer; + } + var yearInput = createNumberInput("cur-year", { tabindex: "-1" }); + var yearElement = yearInput.getElementsByTagName("input")[0]; + yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel); + if (self.config.minDate) { + yearElement.setAttribute("min", self.config.minDate.getFullYear().toString()); + } + if (self.config.maxDate) { + yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString()); + yearElement.disabled = + !!self.config.minDate && + self.config.minDate.getFullYear() === self.config.maxDate.getFullYear(); + } + var currentMonth = createElement("div", "flatpickr-current-month"); + currentMonth.appendChild(monthElement); + currentMonth.appendChild(yearInput); + monthNavFragment.appendChild(currentMonth); + container.appendChild(monthNavFragment); + return { + container: container, + yearElement: yearElement, + monthElement: monthElement, + }; + } + function buildMonths() { + clearNode(self.monthNav); + self.monthNav.appendChild(self.prevMonthNav); + if (self.config.showMonths) { + self.yearElements = []; + self.monthElements = []; + } + for (var m = self.config.showMonths; m--;) { + var month = buildMonth(); + self.yearElements.push(month.yearElement); + self.monthElements.push(month.monthElement); + self.monthNav.appendChild(month.container); + } + self.monthNav.appendChild(self.nextMonthNav); + } + function buildMonthNav() { + self.monthNav = createElement("div", "flatpickr-months"); + self.yearElements = []; + self.monthElements = []; + self.prevMonthNav = createElement("span", "flatpickr-prev-month"); + self.prevMonthNav.innerHTML = self.config.prevArrow; + self.nextMonthNav = createElement("span", "flatpickr-next-month"); + self.nextMonthNav.innerHTML = self.config.nextArrow; + buildMonths(); + Object.defineProperty(self, "_hidePrevMonthArrow", { + get: function () { return self.__hidePrevMonthArrow; }, + set: function (bool) { + if (self.__hidePrevMonthArrow !== bool) { + toggleClass(self.prevMonthNav, "flatpickr-disabled", bool); + self.__hidePrevMonthArrow = bool; + } + }, + }); + Object.defineProperty(self, "_hideNextMonthArrow", { + get: function () { return self.__hideNextMonthArrow; }, + set: function (bool) { + if (self.__hideNextMonthArrow !== bool) { + toggleClass(self.nextMonthNav, "flatpickr-disabled", bool); + self.__hideNextMonthArrow = bool; + } + }, + }); + self.currentYearElement = self.yearElements[0]; + updateNavigationCurrentMonth(); + return self.monthNav; + } + function buildTime() { + self.calendarContainer.classList.add("hasTime"); + if (self.config.noCalendar) + self.calendarContainer.classList.add("noCalendar"); + var defaults = getDefaultHours(self.config); + self.timeContainer = createElement("div", "flatpickr-time"); + self.timeContainer.tabIndex = -1; + var separator = createElement("span", "flatpickr-time-separator", ":"); + var hourInput = createNumberInput("flatpickr-hour", { + "aria-label": self.l10n.hourAriaLabel, + }); + self.hourElement = hourInput.getElementsByTagName("input")[0]; + var minuteInput = createNumberInput("flatpickr-minute", { + "aria-label": self.l10n.minuteAriaLabel, + }); + self.minuteElement = minuteInput.getElementsByTagName("input")[0]; + self.hourElement.tabIndex = self.minuteElement.tabIndex = -1; + self.hourElement.value = pad(self.latestSelectedDateObj + ? self.latestSelectedDateObj.getHours() + : self.config.time_24hr + ? defaults.hours + : military2ampm(defaults.hours)); + self.minuteElement.value = pad(self.latestSelectedDateObj + ? self.latestSelectedDateObj.getMinutes() + : defaults.minutes); + self.hourElement.setAttribute("step", self.config.hourIncrement.toString()); + self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString()); + self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1"); + self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12"); + self.hourElement.setAttribute("maxlength", "2"); + self.minuteElement.setAttribute("min", "0"); + self.minuteElement.setAttribute("max", "59"); + self.minuteElement.setAttribute("maxlength", "2"); + self.timeContainer.appendChild(hourInput); + self.timeContainer.appendChild(separator); + self.timeContainer.appendChild(minuteInput); + if (self.config.time_24hr) + self.timeContainer.classList.add("time24hr"); + if (self.config.enableSeconds) { + self.timeContainer.classList.add("hasSeconds"); + var secondInput = createNumberInput("flatpickr-second"); + self.secondElement = secondInput.getElementsByTagName("input")[0]; + self.secondElement.value = pad(self.latestSelectedDateObj + ? self.latestSelectedDateObj.getSeconds() + : defaults.seconds); + self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step")); + self.secondElement.setAttribute("min", "0"); + self.secondElement.setAttribute("max", "59"); + self.secondElement.setAttribute("maxlength", "2"); + self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":")); + self.timeContainer.appendChild(secondInput); + } + if (!self.config.time_24hr) { + // add self.amPM if appropriate + self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj + ? self.hourElement.value + : self.config.defaultHour) > 11)]); + self.amPM.title = self.l10n.toggleTitle; + self.amPM.tabIndex = -1; + self.timeContainer.appendChild(self.amPM); + } + return self.timeContainer; + } + function buildWeekdays() { + if (!self.weekdayContainer) + self.weekdayContainer = createElement("div", "flatpickr-weekdays"); + else + clearNode(self.weekdayContainer); + for (var i = self.config.showMonths; i--;) { + var container = createElement("div", "flatpickr-weekdaycontainer"); + self.weekdayContainer.appendChild(container); + } + updateWeekdays(); + return self.weekdayContainer; + } + function updateWeekdays() { + if (!self.weekdayContainer) { + return; + } + var firstDayOfWeek = self.l10n.firstDayOfWeek; + var weekdays = __spreadArrays(self.l10n.weekdays.shorthand); + if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) { + weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek)); + } + for (var i = self.config.showMonths; i--;) { + self.weekdayContainer.children[i].innerHTML = "\n \n " + weekdays.join("") + "\n \n "; + } + } + /* istanbul ignore next */ + function buildWeeks() { + self.calendarContainer.classList.add("hasWeeks"); + var weekWrapper = createElement("div", "flatpickr-weekwrapper"); + weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation)); + var weekNumbers = createElement("div", "flatpickr-weeks"); + weekWrapper.appendChild(weekNumbers); + return { + weekWrapper: weekWrapper, + weekNumbers: weekNumbers, + }; + } + function changeMonth(value, isOffset) { + if (isOffset === void 0) { isOffset = true; } + var delta = isOffset ? value : value - self.currentMonth; + if ((delta < 0 && self._hidePrevMonthArrow === true) || + (delta > 0 && self._hideNextMonthArrow === true)) + return; + self.currentMonth += delta; + if (self.currentMonth < 0 || self.currentMonth > 11) { + self.currentYear += self.currentMonth > 11 ? 1 : -1; + self.currentMonth = (self.currentMonth + 12) % 12; + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + buildDays(); + triggerEvent("onMonthChange"); + updateNavigationCurrentMonth(); + } + function clear(triggerChangeEvent, toInitial) { + if (triggerChangeEvent === void 0) { triggerChangeEvent = true; } + if (toInitial === void 0) { toInitial = true; } + self.input.value = ""; + if (self.altInput !== undefined) + self.altInput.value = ""; + if (self.mobileInput !== undefined) + self.mobileInput.value = ""; + self.selectedDates = []; + self.latestSelectedDateObj = undefined; + if (toInitial === true) { + self.currentYear = self._initialDate.getFullYear(); + self.currentMonth = self._initialDate.getMonth(); + } + if (self.config.enableTime === true) { + var _a = getDefaultHours(self.config), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds; + setHours(hours, minutes, seconds); + } + self.redraw(); + if (triggerChangeEvent) + // triggerChangeEvent is true (default) or an Event + triggerEvent("onChange"); + } + function close() { + self.isOpen = false; + if (!self.isMobile) { + if (self.calendarContainer !== undefined) { + self.calendarContainer.classList.remove("open"); + } + if (self._input !== undefined) { + self._input.classList.remove("active"); + } + } + triggerEvent("onClose"); + } + function destroy() { + if (self.config !== undefined) + triggerEvent("onDestroy"); + for (var i = self._handlers.length; i--;) { + self._handlers[i].remove(); + } + self._handlers = []; + if (self.mobileInput) { + if (self.mobileInput.parentNode) + self.mobileInput.parentNode.removeChild(self.mobileInput); + self.mobileInput = undefined; + } + else if (self.calendarContainer && self.calendarContainer.parentNode) { + if (self.config.static && self.calendarContainer.parentNode) { + var wrapper = self.calendarContainer.parentNode; + wrapper.lastChild && wrapper.removeChild(wrapper.lastChild); + if (wrapper.parentNode) { + while (wrapper.firstChild) + wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper); + wrapper.parentNode.removeChild(wrapper); + } + } + else + self.calendarContainer.parentNode.removeChild(self.calendarContainer); + } + if (self.altInput) { + self.input.type = "text"; + if (self.altInput.parentNode) + self.altInput.parentNode.removeChild(self.altInput); + delete self.altInput; + } + if (self.input) { + self.input.type = self.input._type; + self.input.classList.remove("flatpickr-input"); + self.input.removeAttribute("readonly"); + } + [ + "_showTimeInput", + "latestSelectedDateObj", + "_hideNextMonthArrow", + "_hidePrevMonthArrow", + "__hideNextMonthArrow", + "__hidePrevMonthArrow", + "isMobile", + "isOpen", + "selectedDateElem", + "minDateHasTime", + "maxDateHasTime", + "days", + "daysContainer", + "_input", + "_positionElement", + "innerContainer", + "rContainer", + "monthNav", + "todayDateElem", + "calendarContainer", + "weekdayContainer", + "prevMonthNav", + "nextMonthNav", + "monthsDropdownContainer", + "currentMonthElement", + "currentYearElement", + "navigationCurrentMonth", + "selectedDateElem", + "config", + ].forEach(function (k) { + try { + delete self[k]; + } + catch (_) { } + }); + } + function isCalendarElem(elem) { + return self.calendarContainer.contains(elem); + } + function documentClick(e) { + if (self.isOpen && !self.config.inline) { + var eventTarget_1 = getEventTarget(e); + var isCalendarElement = isCalendarElem(eventTarget_1); + var isInput = eventTarget_1 === self.input || + eventTarget_1 === self.altInput || + self.element.contains(eventTarget_1) || + // web components + // e.path is not present in all browsers. circumventing typechecks + (e.path && + e.path.indexOf && + (~e.path.indexOf(self.input) || + ~e.path.indexOf(self.altInput))); + var lostFocus = !isInput && + !isCalendarElement && + !isCalendarElem(e.relatedTarget); + var isIgnored = !self.config.ignoredFocusElements.some(function (elem) { + return elem.contains(eventTarget_1); + }); + if (lostFocus && isIgnored) { + if (self.config.allowInput) { + self.setDate(self._input.value, false, self.config.altInput + ? self.config.altFormat + : self.config.dateFormat); + } + if (self.timeContainer !== undefined && + self.minuteElement !== undefined && + self.hourElement !== undefined && + self.input.value !== "" && + self.input.value !== undefined) { + updateTime(); + } + self.close(); + if (self.config && + self.config.mode === "range" && + self.selectedDates.length === 1) + self.clear(false); + } + } + } + function changeYear(newYear) { + if (!newYear || + (self.config.minDate && newYear < self.config.minDate.getFullYear()) || + (self.config.maxDate && newYear > self.config.maxDate.getFullYear())) + return; + var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum; + self.currentYear = newYearNum || self.currentYear; + if (self.config.maxDate && + self.currentYear === self.config.maxDate.getFullYear()) { + self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth); + } + else if (self.config.minDate && + self.currentYear === self.config.minDate.getFullYear()) { + self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth); + } + if (isNewYear) { + self.redraw(); + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + } + function isEnabled(date, timeless) { + var _a; + if (timeless === void 0) { timeless = true; } + var dateToCheck = self.parseDate(date, undefined, timeless); // timeless + if ((self.config.minDate && + dateToCheck && + compareDates(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0) || + (self.config.maxDate && + dateToCheck && + compareDates(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0)) + return false; + if (!self.config.enable && self.config.disable.length === 0) + return true; + if (dateToCheck === undefined) + return false; + var bool = !!self.config.enable, array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable; + for (var i = 0, d = void 0; i < array.length; i++) { + d = array[i]; + if (typeof d === "function" && + d(dateToCheck) // disabled by function + ) + return bool; + else if (d instanceof Date && + dateToCheck !== undefined && + d.getTime() === dateToCheck.getTime()) + // disabled by date + return bool; + else if (typeof d === "string") { + // disabled by date string + var parsed = self.parseDate(d, undefined, true); + return parsed && parsed.getTime() === dateToCheck.getTime() + ? bool + : !bool; + } + else if ( + // disabled by range + typeof d === "object" && + dateToCheck !== undefined && + d.from && + d.to && + dateToCheck.getTime() >= d.from.getTime() && + dateToCheck.getTime() <= d.to.getTime()) + return bool; + } + return !bool; + } + function isInView(elem) { + if (self.daysContainer !== undefined) + return (elem.className.indexOf("hidden") === -1 && + elem.className.indexOf("flatpickr-disabled") === -1 && + self.daysContainer.contains(elem)); + return false; + } + function onBlur(e) { + var isInput = e.target === self._input; + var valueChanged = self._input.value.trimEnd() !== getDateStr(); + if (isInput && + valueChanged && + !(e.relatedTarget && isCalendarElem(e.relatedTarget))) { + self.setDate(self._input.value, true, e.target === self.altInput + ? self.config.altFormat + : self.config.dateFormat); + } + } + function onKeyDown(e) { + // e.key e.keyCode + // "Backspace" 8 + // "Tab" 9 + // "Enter" 13 + // "Escape" (IE "Esc") 27 + // "ArrowLeft" (IE "Left") 37 + // "ArrowUp" (IE "Up") 38 + // "ArrowRight" (IE "Right") 39 + // "ArrowDown" (IE "Down") 40 + // "Delete" (IE "Del") 46 + var eventTarget = getEventTarget(e); + var isInput = self.config.wrap + ? element.contains(eventTarget) + : eventTarget === self._input; + var allowInput = self.config.allowInput; + var allowKeydown = self.isOpen && (!allowInput || !isInput); + var allowInlineKeydown = self.config.inline && isInput && !allowInput; + if (e.keyCode === 13 && isInput) { + if (allowInput) { + self.setDate(self._input.value, true, eventTarget === self.altInput + ? self.config.altFormat + : self.config.dateFormat); + self.close(); + return eventTarget.blur(); + } + else { + self.open(); + } + } + else if (isCalendarElem(eventTarget) || + allowKeydown || + allowInlineKeydown) { + var isTimeObj = !!self.timeContainer && + self.timeContainer.contains(eventTarget); + switch (e.keyCode) { + case 13: + if (isTimeObj) { + e.preventDefault(); + updateTime(); + focusAndClose(); + } + else + selectDate(e); + break; + case 27: // escape + e.preventDefault(); + focusAndClose(); + break; + case 8: + case 46: + if (isInput && !self.config.allowInput) { + e.preventDefault(); + self.clear(); + } + break; + case 37: + case 39: + if (!isTimeObj && !isInput) { + e.preventDefault(); + var activeElement = getClosestActiveElement(); + if (self.daysContainer !== undefined && + (allowInput === false || + (activeElement && isInView(activeElement)))) { + var delta_1 = e.keyCode === 39 ? 1 : -1; + if (!e.ctrlKey) + focusOnDay(undefined, delta_1); + else { + e.stopPropagation(); + changeMonth(delta_1); + focusOnDay(getFirstAvailableDay(1), 0); + } + } + } + else if (self.hourElement) + self.hourElement.focus(); + break; + case 38: + case 40: + e.preventDefault(); + var delta = e.keyCode === 40 ? 1 : -1; + if ((self.daysContainer && + eventTarget.$i !== undefined) || + eventTarget === self.input || + eventTarget === self.altInput) { + if (e.ctrlKey) { + e.stopPropagation(); + changeYear(self.currentYear - delta); + focusOnDay(getFirstAvailableDay(1), 0); + } + else if (!isTimeObj) + focusOnDay(undefined, delta * 7); + } + else if (eventTarget === self.currentYearElement) { + changeYear(self.currentYear - delta); + } + else if (self.config.enableTime) { + if (!isTimeObj && self.hourElement) + self.hourElement.focus(); + updateTime(e); + self._debouncedChange(); + } + break; + case 9: + if (isTimeObj) { + var elems = [ + self.hourElement, + self.minuteElement, + self.secondElement, + self.amPM, + ] + .concat(self.pluginElements) + .filter(function (x) { return x; }); + var i = elems.indexOf(eventTarget); + if (i !== -1) { + var target = elems[i + (e.shiftKey ? -1 : 1)]; + e.preventDefault(); + (target || self._input).focus(); + } + } + else if (!self.config.noCalendar && + self.daysContainer && + self.daysContainer.contains(eventTarget) && + e.shiftKey) { + e.preventDefault(); + self._input.focus(); + } + break; + } + } + if (self.amPM !== undefined && eventTarget === self.amPM) { + switch (e.key) { + case self.l10n.amPM[0].charAt(0): + case self.l10n.amPM[0].charAt(0).toLowerCase(): + self.amPM.textContent = self.l10n.amPM[0]; + setHoursFromInputs(); + updateValue(); + break; + case self.l10n.amPM[1].charAt(0): + case self.l10n.amPM[1].charAt(0).toLowerCase(): + self.amPM.textContent = self.l10n.amPM[1]; + setHoursFromInputs(); + updateValue(); + break; + } + } + if (isInput || isCalendarElem(eventTarget)) { + triggerEvent("onKeyDown", e); + } + } + function onMouseOver(elem, cellClass) { + if (cellClass === void 0) { cellClass = "flatpickr-day"; } + if (self.selectedDates.length !== 1 || + (elem && + (!elem.classList.contains(cellClass) || + elem.classList.contains("flatpickr-disabled")))) + return; + var hoverDate = elem + ? elem.dateObj.getTime() + : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime()); + var containsDisabled = false; + var minRange = 0, maxRange = 0; + for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) { + if (!isEnabled(new Date(t), true)) { + containsDisabled = + containsDisabled || (t > rangeStartDate && t < rangeEndDate); + if (t < initialDate && (!minRange || t > minRange)) + minRange = t; + else if (t > initialDate && (!maxRange || t < maxRange)) + maxRange = t; + } + } + var hoverableCells = Array.from(self.rContainer.querySelectorAll("*:nth-child(-n+" + self.config.showMonths + ") > ." + cellClass)); + hoverableCells.forEach(function (dayElem) { + var date = dayElem.dateObj; + var timestamp = date.getTime(); + var outOfRange = (minRange > 0 && timestamp < minRange) || + (maxRange > 0 && timestamp > maxRange); + if (outOfRange) { + dayElem.classList.add("notAllowed"); + ["inRange", "startRange", "endRange"].forEach(function (c) { + dayElem.classList.remove(c); + }); + return; + } + else if (containsDisabled && !outOfRange) + return; + ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) { + dayElem.classList.remove(c); + }); + if (elem !== undefined) { + elem.classList.add(hoverDate <= self.selectedDates[0].getTime() + ? "startRange" + : "endRange"); + if (initialDate < hoverDate && timestamp === initialDate) + dayElem.classList.add("startRange"); + else if (initialDate > hoverDate && timestamp === initialDate) + dayElem.classList.add("endRange"); + if (timestamp >= minRange && + (maxRange === 0 || timestamp <= maxRange) && + isBetween(timestamp, initialDate, hoverDate)) + dayElem.classList.add("inRange"); + } + }); + } + function onResize() { + if (self.isOpen && !self.config.static && !self.config.inline) + positionCalendar(); + } + function open(e, positionElement) { + if (positionElement === void 0) { positionElement = self._positionElement; } + if (self.isMobile === true) { + if (e) { + e.preventDefault(); + var eventTarget = getEventTarget(e); + if (eventTarget) { + eventTarget.blur(); + } + } + if (self.mobileInput !== undefined) { + self.mobileInput.focus(); + self.mobileInput.click(); + } + triggerEvent("onOpen"); + return; + } + else if (self._input.disabled || self.config.inline) { + return; + } + var wasOpen = self.isOpen; + self.isOpen = true; + if (!wasOpen) { + self.calendarContainer.classList.add("open"); + self._input.classList.add("active"); + triggerEvent("onOpen"); + positionCalendar(positionElement); + } + if (self.config.enableTime === true && self.config.noCalendar === true) { + if (self.config.allowInput === false && + (e === undefined || + !self.timeContainer.contains(e.relatedTarget))) { + setTimeout(function () { return self.hourElement.select(); }, 50); + } + } + } + function minMaxDateSetter(type) { + return function (date) { + var dateObj = (self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat)); + var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"]; + if (dateObj !== undefined) { + self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] = + dateObj.getHours() > 0 || + dateObj.getMinutes() > 0 || + dateObj.getSeconds() > 0; + } + if (self.selectedDates) { + self.selectedDates = self.selectedDates.filter(function (d) { return isEnabled(d); }); + if (!self.selectedDates.length && type === "min") + setHoursFromDate(dateObj); + updateValue(); + } + if (self.daysContainer) { + redraw(); + if (dateObj !== undefined) + self.currentYearElement[type] = dateObj.getFullYear().toString(); + else + self.currentYearElement.removeAttribute(type); + self.currentYearElement.disabled = + !!inverseDateObj && + dateObj !== undefined && + inverseDateObj.getFullYear() === dateObj.getFullYear(); + } + }; + } + function parseConfig() { + var boolOpts = [ + "wrap", + "weekNumbers", + "allowInput", + "allowInvalidPreload", + "clickOpens", + "time_24hr", + "enableTime", + "noCalendar", + "altInput", + "shorthandCurrentMonth", + "inline", + "static", + "enableSeconds", + "disableMobile", + ]; + var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig); + var formats = {}; + self.config.parseDate = userConfig.parseDate; + self.config.formatDate = userConfig.formatDate; + Object.defineProperty(self.config, "enable", { + get: function () { return self.config._enable; }, + set: function (dates) { + self.config._enable = parseDateRules(dates); + }, + }); + Object.defineProperty(self.config, "disable", { + get: function () { return self.config._disable; }, + set: function (dates) { + self.config._disable = parseDateRules(dates); + }, + }); + var timeMode = userConfig.mode === "time"; + if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) { + var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat; + formats.dateFormat = + userConfig.noCalendar || timeMode + ? "H:i" + (userConfig.enableSeconds ? ":S" : "") + : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : ""); + } + if (userConfig.altInput && + (userConfig.enableTime || timeMode) && + !userConfig.altFormat) { + var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat; + formats.altFormat = + userConfig.noCalendar || timeMode + ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K") + : defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K"); + } + Object.defineProperty(self.config, "minDate", { + get: function () { return self.config._minDate; }, + set: minMaxDateSetter("min"), + }); + Object.defineProperty(self.config, "maxDate", { + get: function () { return self.config._maxDate; }, + set: minMaxDateSetter("max"), + }); + var minMaxTimeSetter = function (type) { return function (val) { + self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S"); + }; }; + Object.defineProperty(self.config, "minTime", { + get: function () { return self.config._minTime; }, + set: minMaxTimeSetter("min"), + }); + Object.defineProperty(self.config, "maxTime", { + get: function () { return self.config._maxTime; }, + set: minMaxTimeSetter("max"), + }); + if (userConfig.mode === "time") { + self.config.noCalendar = true; + self.config.enableTime = true; + } + Object.assign(self.config, formats, userConfig); + for (var i = 0; i < boolOpts.length; i++) + // https://github.com/microsoft/TypeScript/issues/31663 + self.config[boolOpts[i]] = + self.config[boolOpts[i]] === true || + self.config[boolOpts[i]] === "true"; + HOOKS.filter(function (hook) { return self.config[hook] !== undefined; }).forEach(function (hook) { + self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance); + }); + self.isMobile = + !self.config.disableMobile && + !self.config.inline && + self.config.mode === "single" && + !self.config.disable.length && + !self.config.enable && + !self.config.weekNumbers && + /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); + for (var i = 0; i < self.config.plugins.length; i++) { + var pluginConf = self.config.plugins[i](self) || {}; + for (var key in pluginConf) { + if (HOOKS.indexOf(key) > -1) { + self.config[key] = arrayify(pluginConf[key]) + .map(bindToInstance) + .concat(self.config[key]); + } + else if (typeof userConfig[key] === "undefined") + self.config[key] = pluginConf[key]; + } + } + if (!userConfig.altInputClass) { + self.config.altInputClass = + getInputElem().className + " " + self.config.altInputClass; + } + triggerEvent("onParseConfig"); + } + function getInputElem() { + return self.config.wrap + ? element.querySelector("[data-input]") + : element; + } + function setupLocale() { + if (typeof self.config.locale !== "object" && + typeof flatpickr.l10ns[self.config.locale] === "undefined") + self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale)); + self.l10n = __assign(__assign({}, flatpickr.l10ns.default), (typeof self.config.locale === "object" + ? self.config.locale + : self.config.locale !== "default" + ? flatpickr.l10ns[self.config.locale] + : undefined)); + tokenRegex.D = "(" + self.l10n.weekdays.shorthand.join("|") + ")"; + tokenRegex.l = "(" + self.l10n.weekdays.longhand.join("|") + ")"; + tokenRegex.M = "(" + self.l10n.months.shorthand.join("|") + ")"; + tokenRegex.F = "(" + self.l10n.months.longhand.join("|") + ")"; + tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")"; + var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {}))); + if (userConfig.time_24hr === undefined && + flatpickr.defaultConfig.time_24hr === undefined) { + self.config.time_24hr = self.l10n.time_24hr; + } + self.formatDate = createDateFormatter(self); + self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); + } + function positionCalendar(customPositionElement) { + if (typeof self.config.position === "function") { + return void self.config.position(self, customPositionElement); + } + if (self.calendarContainer === undefined) + return; + triggerEvent("onPreCalendarPosition"); + var positionElement = customPositionElement || self._positionElement; + var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, (function (acc, child) { return acc + child.offsetHeight; }), 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" || + (configPosVertical !== "below" && + distanceFromBottom < calendarHeight && + inputBounds.top > calendarHeight); + var top = window.pageYOffset + + inputBounds.top + + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2); + toggleClass(self.calendarContainer, "arrowTop", !showOnTop); + toggleClass(self.calendarContainer, "arrowBottom", showOnTop); + if (self.config.inline) + return; + var left = window.pageXOffset + inputBounds.left; + var isCenter = false; + var isRight = false; + if (configPosHorizontal === "center") { + left -= (calendarWidth - inputBounds.width) / 2; + isCenter = true; + } + else if (configPosHorizontal === "right") { + left -= calendarWidth - inputBounds.width; + isRight = true; + } + toggleClass(self.calendarContainer, "arrowLeft", !isCenter && !isRight); + toggleClass(self.calendarContainer, "arrowCenter", isCenter); + toggleClass(self.calendarContainer, "arrowRight", isRight); + var right = window.document.body.offsetWidth - + (window.pageXOffset + inputBounds.right); + var rightMost = left + calendarWidth > window.document.body.offsetWidth; + var centerMost = right + calendarWidth > window.document.body.offsetWidth; + toggleClass(self.calendarContainer, "rightMost", rightMost); + if (self.config.static) + return; + self.calendarContainer.style.top = top + "px"; + if (!rightMost) { + self.calendarContainer.style.left = left + "px"; + self.calendarContainer.style.right = "auto"; + } + else if (!centerMost) { + self.calendarContainer.style.left = "auto"; + self.calendarContainer.style.right = right + "px"; + } + else { + var doc = getDocumentStyleSheet(); + // some testing environments don't have css support + if (doc === undefined) + return; + var bodyWidth = window.document.body.offsetWidth; + var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2); + var centerBefore = ".flatpickr-calendar.centerMost:before"; + var centerAfter = ".flatpickr-calendar.centerMost:after"; + var centerIndex = doc.cssRules.length; + var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}"; + toggleClass(self.calendarContainer, "rightMost", false); + toggleClass(self.calendarContainer, "centerMost", true); + doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex); + self.calendarContainer.style.left = centerLeft + "px"; + self.calendarContainer.style.right = "auto"; + } + } + function getDocumentStyleSheet() { + var editableSheet = null; + for (var i = 0; i < document.styleSheets.length; i++) { + var sheet = document.styleSheets[i]; + if (!sheet.cssRules) + continue; + try { + sheet.cssRules; + } + catch (err) { + continue; + } + editableSheet = sheet; + break; + } + return editableSheet != null ? editableSheet : createStyleSheet(); + } + function createStyleSheet() { + var style = document.createElement("style"); + document.head.appendChild(style); + return style.sheet; + } + function redraw() { + if (self.config.noCalendar || self.isMobile) + return; + buildMonthSwitch(); + updateNavigationCurrentMonth(); + buildDays(); + } + function focusAndClose() { + self._input.focus(); + if (window.navigator.userAgent.indexOf("MSIE") !== -1 || + navigator.msMaxTouchPoints !== undefined) { + // hack - bugs in the way IE handles focus keeps the calendar open + setTimeout(self.close, 0); + } + else { + self.close(); + } + } + function selectDate(e) { + e.preventDefault(); + e.stopPropagation(); + var isSelectable = function (day) { + return day.classList && + day.classList.contains("flatpickr-day") && + !day.classList.contains("flatpickr-disabled") && + !day.classList.contains("notAllowed"); + }; + var t = findParent(getEventTarget(e), isSelectable); + if (t === undefined) + return; + var target = t; + var selectedDate = (self.latestSelectedDateObj = new Date(target.dateObj.getTime())); + var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || + selectedDate.getMonth() > + self.currentMonth + self.config.showMonths - 1) && + self.config.mode !== "range"; + self.selectedDateElem = target; + if (self.config.mode === "single") + self.selectedDates = [selectedDate]; + else if (self.config.mode === "multiple") { + var selectedIndex = isDateSelected(selectedDate); + if (selectedIndex) + self.selectedDates.splice(parseInt(selectedIndex), 1); + else + self.selectedDates.push(selectedDate); + } + else if (self.config.mode === "range") { + if (self.selectedDates.length === 2) { + self.clear(false, false); + } + self.latestSelectedDateObj = selectedDate; + self.selectedDates.push(selectedDate); + // unless selecting same date twice, sort ascendingly + if (compareDates(selectedDate, self.selectedDates[0], true) !== 0) + self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); }); + } + setHoursFromInputs(); + if (shouldChangeMonth) { + var isNewYear = self.currentYear !== selectedDate.getFullYear(); + self.currentYear = selectedDate.getFullYear(); + self.currentMonth = selectedDate.getMonth(); + if (isNewYear) { + triggerEvent("onYearChange"); + buildMonthSwitch(); + } + triggerEvent("onMonthChange"); + } + updateNavigationCurrentMonth(); + buildDays(); + updateValue(); + // maintain focus + if (!shouldChangeMonth && + self.config.mode !== "range" && + self.config.showMonths === 1) + focusOnDayElem(target); + else if (self.selectedDateElem !== undefined && + self.hourElement === undefined) { + self.selectedDateElem && self.selectedDateElem.focus(); + } + if (self.hourElement !== undefined) + self.hourElement !== undefined && self.hourElement.focus(); + if (self.config.closeOnSelect) { + var single = self.config.mode === "single" && !self.config.enableTime; + var range = self.config.mode === "range" && + self.selectedDates.length === 2 && + !self.config.enableTime; + if (single || range) { + focusAndClose(); + } + } + triggerChange(); + } + var CALLBACKS = { + locale: [setupLocale, updateWeekdays], + showMonths: [buildMonths, setCalendarWidth, buildWeekdays], + minDate: [jumpToDate], + maxDate: [jumpToDate], + positionElement: [updatePositionElement], + clickOpens: [ + function () { + if (self.config.clickOpens === true) { + bind(self._input, "focus", self.open); + bind(self._input, "click", self.open); + } + else { + self._input.removeEventListener("focus", self.open); + self._input.removeEventListener("click", self.open); + } + }, + ], + }; + function set(option, value) { + if (option !== null && typeof option === "object") { + Object.assign(self.config, option); + for (var key in option) { + if (CALLBACKS[key] !== undefined) + CALLBACKS[key].forEach(function (x) { return x(); }); + } + } + else { + self.config[option] = value; + if (CALLBACKS[option] !== undefined) + CALLBACKS[option].forEach(function (x) { return x(); }); + else if (HOOKS.indexOf(option) > -1) + self.config[option] = arrayify(value); + } + self.redraw(); + updateValue(true); + } + function setSelectedDate(inputDate, format) { + var dates = []; + if (inputDate instanceof Array) + dates = inputDate.map(function (d) { return self.parseDate(d, format); }); + else if (inputDate instanceof Date || typeof inputDate === "number") + dates = [self.parseDate(inputDate, format)]; + else if (typeof inputDate === "string") { + switch (self.config.mode) { + case "single": + case "time": + dates = [self.parseDate(inputDate, format)]; + break; + case "multiple": + dates = inputDate + .split(self.config.conjunction) + .map(function (date) { return self.parseDate(date, format); }); + break; + case "range": + dates = inputDate + .split(self.l10n.rangeSeparator) + .map(function (date) { return self.parseDate(date, format); }); + break; + } + } + else + self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate))); + self.selectedDates = (self.config.allowInvalidPreload + ? dates + : dates.filter(function (d) { return d instanceof Date && isEnabled(d, false); })); + if (self.config.mode === "range") + self.selectedDates.sort(function (a, b) { return a.getTime() - b.getTime(); }); + } + function setDate(date, triggerChange, format) { + if (triggerChange === void 0) { triggerChange = false; } + if (format === void 0) { format = self.config.dateFormat; } + if ((date !== 0 && !date) || (date instanceof Array && date.length === 0)) + return self.clear(triggerChange); + setSelectedDate(date, format); + self.latestSelectedDateObj = + self.selectedDates[self.selectedDates.length - 1]; + self.redraw(); + jumpToDate(undefined, triggerChange); + setHoursFromDate(); + if (self.selectedDates.length === 0) { + self.clear(false); + } + updateValue(triggerChange); + if (triggerChange) + triggerEvent("onChange"); + } + function parseDateRules(arr) { + return arr + .slice() + .map(function (rule) { + if (typeof rule === "string" || + typeof rule === "number" || + rule instanceof Date) { + return self.parseDate(rule, undefined, true); + } + else if (rule && + typeof rule === "object" && + rule.from && + rule.to) + return { + from: self.parseDate(rule.from, undefined), + to: self.parseDate(rule.to, undefined), + }; + return rule; + }) + .filter(function (x) { return x; }); // remove falsy values + } + function setupDates() { + self.selectedDates = []; + self.now = self.parseDate(self.config.now) || new Date(); + // Workaround IE11 setting placeholder as the input's value + var preloadedDate = self.config.defaultDate || + ((self.input.nodeName === "INPUT" || + self.input.nodeName === "TEXTAREA") && + self.input.placeholder && + self.input.value === self.input.placeholder + ? null + : self.input.value); + if (preloadedDate) + setSelectedDate(preloadedDate, self.config.dateFormat); + self._initialDate = + self.selectedDates.length > 0 + ? self.selectedDates[0] + : self.config.minDate && + self.config.minDate.getTime() > self.now.getTime() + ? self.config.minDate + : self.config.maxDate && + self.config.maxDate.getTime() < self.now.getTime() + ? self.config.maxDate + : self.now; + self.currentYear = self._initialDate.getFullYear(); + self.currentMonth = self._initialDate.getMonth(); + if (self.selectedDates.length > 0) + self.latestSelectedDateObj = self.selectedDates[0]; + if (self.config.minTime !== undefined) + self.config.minTime = self.parseDate(self.config.minTime, "H:i"); + if (self.config.maxTime !== undefined) + self.config.maxTime = self.parseDate(self.config.maxTime, "H:i"); + self.minDateHasTime = + !!self.config.minDate && + (self.config.minDate.getHours() > 0 || + self.config.minDate.getMinutes() > 0 || + self.config.minDate.getSeconds() > 0); + self.maxDateHasTime = + !!self.config.maxDate && + (self.config.maxDate.getHours() > 0 || + self.config.maxDate.getMinutes() > 0 || + self.config.maxDate.getSeconds() > 0); + } + function setupInputs() { + self.input = getInputElem(); + /* istanbul ignore next */ + if (!self.input) { + self.config.errorHandler(new Error("Invalid input element specified")); + return; + } + // hack: store previous type to restore it after destroy() + self.input._type = self.input.type; + self.input.type = "text"; + self.input.classList.add("flatpickr-input"); + self._input = self.input; + if (self.config.altInput) { + // replicate self.element + self.altInput = createElement(self.input.nodeName, self.config.altInputClass); + self._input = self.altInput; + self.altInput.placeholder = self.input.placeholder; + self.altInput.disabled = self.input.disabled; + self.altInput.required = self.input.required; + self.altInput.tabIndex = self.input.tabIndex; + self.altInput.type = "text"; + self.input.setAttribute("type", "hidden"); + if (!self.config.static && self.input.parentNode) + self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling); + } + if (!self.config.allowInput) + self._input.setAttribute("readonly", "readonly"); + updatePositionElement(); + } + function updatePositionElement() { + self._positionElement = self.config.positionElement || self._input; + } + function setupMobile() { + var inputType = self.config.enableTime + ? self.config.noCalendar + ? "time" + : "datetime-local" + : "date"; + self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile"); + self.mobileInput.tabIndex = 1; + self.mobileInput.type = inputType; + self.mobileInput.disabled = self.input.disabled; + self.mobileInput.required = self.input.required; + self.mobileInput.placeholder = self.input.placeholder; + self.mobileFormatStr = + inputType === "datetime-local" + ? "Y-m-d\\TH:i:S" + : inputType === "date" + ? "Y-m-d" + : "H:i:S"; + if (self.selectedDates.length > 0) { + self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr); + } + if (self.config.minDate) + self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d"); + if (self.config.maxDate) + self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d"); + if (self.input.getAttribute("step")) + self.mobileInput.step = String(self.input.getAttribute("step")); + self.input.type = "hidden"; + if (self.altInput !== undefined) + self.altInput.type = "hidden"; + try { + if (self.input.parentNode) + self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling); + } + catch (_a) { } + bind(self.mobileInput, "change", function (e) { + self.setDate(getEventTarget(e).value, false, self.mobileFormatStr); + triggerEvent("onChange"); + triggerEvent("onClose"); + }); + } + function toggle(e) { + if (self.isOpen === true) + return self.close(); + self.open(e); + } + function triggerEvent(event, data) { + // If the instance has been destroyed already, all hooks have been removed + if (self.config === undefined) + return; + var hooks = self.config[event]; + if (hooks !== undefined && hooks.length > 0) { + for (var i = 0; hooks[i] && i < hooks.length; i++) + hooks[i](self.selectedDates, self.input.value, self, data); + } + if (event === "onChange") { + self.input.dispatchEvent(createEvent("change")); + // many front-end frameworks bind to the input event + self.input.dispatchEvent(createEvent("input")); + } + } + function createEvent(name) { + var e = document.createEvent("Event"); + e.initEvent(name, true, true); + return e; + } + function isDateSelected(date) { + for (var i = 0; i < self.selectedDates.length; i++) { + var selectedDate = self.selectedDates[i]; + if (selectedDate instanceof Date && + compareDates(selectedDate, date) === 0) + return "" + i; + } + return false; + } + function isDateInRange(date) { + if (self.config.mode !== "range" || self.selectedDates.length < 2) + return false; + return (compareDates(date, self.selectedDates[0]) >= 0 && + compareDates(date, self.selectedDates[1]) <= 0); + } + function updateNavigationCurrentMonth() { + if (self.config.noCalendar || self.isMobile || !self.monthNav) + return; + self.yearElements.forEach(function (yearElement, i) { + var d = new Date(self.currentYear, self.currentMonth, 1); + d.setMonth(self.currentMonth + i); + if (self.config.showMonths > 1 || + self.config.monthSelectorType === "static") { + self.monthElements[i].textContent = + monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " "; + } + else { + self.monthsDropdownContainer.value = d.getMonth().toString(); + } + yearElement.value = d.getFullYear().toString(); + }); + self._hidePrevMonthArrow = + self.config.minDate !== undefined && + (self.currentYear === self.config.minDate.getFullYear() + ? self.currentMonth <= self.config.minDate.getMonth() + : self.currentYear < self.config.minDate.getFullYear()); + self._hideNextMonthArrow = + self.config.maxDate !== undefined && + (self.currentYear === self.config.maxDate.getFullYear() + ? self.currentMonth + 1 > self.config.maxDate.getMonth() + : self.currentYear > self.config.maxDate.getFullYear()); + } + function getDateStr(specificFormat) { + var format = specificFormat || + (self.config.altInput ? self.config.altFormat : self.config.dateFormat); + return self.selectedDates + .map(function (dObj) { return self.formatDate(dObj, format); }) + .filter(function (d, i, arr) { + return self.config.mode !== "range" || + self.config.enableTime || + arr.indexOf(d) === i; + }) + .join(self.config.mode !== "range" + ? self.config.conjunction + : self.l10n.rangeSeparator); + } + /** + * Updates the values of inputs associated with the calendar + */ + function updateValue(triggerChange) { + if (triggerChange === void 0) { triggerChange = true; } + if (self.mobileInput !== undefined && self.mobileFormatStr) { + self.mobileInput.value = + self.latestSelectedDateObj !== undefined + ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) + : ""; + } + self.input.value = getDateStr(self.config.dateFormat); + if (self.altInput !== undefined) { + self.altInput.value = getDateStr(self.config.altFormat); + } + if (triggerChange !== false) + triggerEvent("onValueUpdate"); + } + function onMonthNavClick(e) { + var eventTarget = getEventTarget(e); + var isPrevMonth = self.prevMonthNav.contains(eventTarget); + var isNextMonth = self.nextMonthNav.contains(eventTarget); + if (isPrevMonth || isNextMonth) { + changeMonth(isPrevMonth ? -1 : 1); + } + else if (self.yearElements.indexOf(eventTarget) >= 0) { + eventTarget.select(); + } + else if (eventTarget.classList.contains("arrowUp")) { + self.changeYear(self.currentYear + 1); + } + else if (eventTarget.classList.contains("arrowDown")) { + self.changeYear(self.currentYear - 1); + } + } + function timeWrapper(e) { + e.preventDefault(); + var isKeyDown = e.type === "keydown", eventTarget = getEventTarget(e), input = eventTarget; + if (self.amPM !== undefined && eventTarget === self.amPM) { + self.amPM.textContent = + self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; + } + var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta || + (isKeyDown ? (e.which === 38 ? 1 : -1) : 0); + var newValue = curValue + step * delta; + if (typeof input.value !== "undefined" && input.value.length === 2) { + var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement; + if (newValue < min) { + newValue = + max + + newValue + + int(!isHourElem) + + (int(isHourElem) && int(!self.amPM)); + if (isMinuteElem) + incrementNumInput(undefined, -1, self.hourElement); + } + else if (newValue > max) { + newValue = + input === self.hourElement ? newValue - max - int(!self.amPM) : min; + if (isMinuteElem) + incrementNumInput(undefined, 1, self.hourElement); + } + if (self.amPM && + isHourElem && + (step === 1 + ? newValue + curValue === 23 + : Math.abs(newValue - curValue) > step)) { + self.amPM.textContent = + self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; + } + input.value = pad(newValue); + } + } + init(); + return self; + } + /* istanbul ignore next */ + function _flatpickr(nodeList, config) { + // static list + var nodes = Array.prototype.slice + .call(nodeList) + .filter(function (x) { return x instanceof HTMLElement; }); + var instances = []; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + try { + if (node.getAttribute("data-fp-omit") !== null) + continue; + if (node._flatpickr !== undefined) { + node._flatpickr.destroy(); + node._flatpickr = undefined; + } + node._flatpickr = FlatpickrInstance(node, config || {}); + instances.push(node._flatpickr); + } + catch (e) { + console.error(e); + } + } + return instances.length === 1 ? instances[0] : instances; + } + /* istanbul ignore next */ + if (typeof HTMLElement !== "undefined" && + typeof HTMLCollection !== "undefined" && + typeof NodeList !== "undefined") { + // browser env + HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) { + return _flatpickr(this, config); + }; + HTMLElement.prototype.flatpickr = function (config) { + return _flatpickr([this], config); + }; + } + /* istanbul ignore next */ + var flatpickr = function (selector, config) { + if (typeof selector === "string") { + return _flatpickr(window.document.querySelectorAll(selector), config); + } + else if (selector instanceof Node) { + return _flatpickr([selector], config); + } + else { + return _flatpickr(selector, config); + } + }; + /* istanbul ignore next */ + flatpickr.defaultConfig = {}; + flatpickr.l10ns = { + en: __assign({}, english), + default: __assign({}, english), + }; + flatpickr.localize = function (l10n) { + flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n); + }; + flatpickr.setDefaults = function (config) { + flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config); + }; + flatpickr.parseDate = createDateParser({}); + flatpickr.formatDate = createDateFormatter({}); + flatpickr.compareDates = compareDates; + /* istanbul ignore next */ + if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") { + jQuery.fn.flatpickr = function (config) { + return _flatpickr(this, config); + }; + } + Date.prototype.fp_incr = function (days) { + return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days)); + }; + if (typeof window !== "undefined") { + window.flatpickr = flatpickr; + } + + return flatpickr; + +}))); diff --git a/dashboard/static/js/html2pdf.bundle.min.js b/dashboard/static/js/html2pdf.bundle.min.js new file mode 100644 index 0000000..7d16368 --- /dev/null +++ b/dashboard/static/js/html2pdf.bundle.min.js @@ -0,0 +1,3 @@ +/*! For license information please see html2pdf.bundle.min.js.LICENSE.txt */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("html2pdf",[],t):"object"==typeof exports?exports.html2pdf=t():e.html2pdf=t()}(self,function(){return function(){var e,t,A={"./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js":function(e,t,A){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var A=0,r=Array(t);A0&&void 0!==arguments[0]?arguments[0]:{},t={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:e,createCanvas(e,t){return new OffscreenCanvas(e,t)},createImage(e){return(0,r.default)(function*(){var t=yield fetch(e),A=yield t.blob();return yield createImageBitmap(A)})()}};return"undefined"==typeof DOMParser&&void 0!==e||Reflect.deleteProperty(t,"DOMParser"),t},node:function(e){var{DOMParser:t,canvas:A,fetch:r}=e;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:t,fetch:r,createCanvas:A.createCanvas,createImage:A.loadImage}}});function c(e){return e.replace(/(?!\u3000)\s+/gm," ")}function u(e){return e.replace(/^[\n \t]+/,"")}function h(e){return e.replace(/[\n \t]+$/,"")}function d(e){return((e||"").match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm)||[]).map(parseFloat)}var f=/^[A-Z-]+$/;function p(e){return f.test(e)?e.toLowerCase():e}function g(e){var t=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(e)||[];return t[2]||t[3]||t[4]}function m(e){if(!e.startsWith("rgb"))return e;var t=3;return e.replace(/\d+(\.\d+)?/g,(e,A)=>t--&&A?String(Math.round(parseFloat(e))):e)}var w=/(\[[^\]]+\])/g,B=/(#[^\s+>~.[:]+)/g,y=/(\.[^\s+>~.[:]+)/g,v=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,b=/(:[\w-]+\([^)]*\))/gi,C=/(:[^\s+>~.[:]+)/g,_=/([^\s+>~.[:]+)/g;function j(e,t){var A=t.exec(e);return A?[e.replace(t," "),A.length]:[e,0]}function x(e){var t=[0,0,0],A=e.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),r=0;return[A,r]=j(A,w),t[1]+=r,[A,r]=j(A,B),t[0]+=r,[A,r]=j(A,y),t[1]+=r,[A,r]=j(A,v),t[2]+=r,[A,r]=j(A,b),t[1]+=r,[A,r]=j(A,C),t[1]+=r,A=A.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[A,r]=j(A,_),t[2]+=r,t.join("")}var F=1e-8;function Q(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2))}function U(e,t){return(e[0]*t[0]+e[1]*t[1])/(Q(e)*Q(t))}function E(e,t){return(e[0]*t[1]0&&void 0!==arguments[0]?arguments[0]:" ",{document:t,name:A}=this;return c(this.getString()).trim().split(e).map(e=>new T(t,A,e))}hasValue(e){var{value:t}=this;return null!==t&&""!==t&&(e||0!==t)&&void 0!==t}isString(e){var{value:t}=this,A="string"==typeof t;return A&&e?e.test(t):A}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;var e=this.getString();switch(!0){case e.endsWith("px"):case/^[0-9]+$/.test(e):return!0;default:return!1}}setValue(e){return this.value=e,this}getValue(e){return void 0===e||this.hasValue()?this.value:e}getNumber(e){if(!this.hasValue())return void 0===e?0:parseFloat(e);var{value:t}=this,A=parseFloat(t);return this.isString(/%$/)&&(A/=100),A}getString(e){return void 0===e||this.hasValue()?void 0===this.value?"":String(this.value):String(e)}getColor(e){var t=this.getString(e);return this.isNormalizedColor||(this.isNormalizedColor=!0,t=m(t),this.value=t),t}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.hasValue())return 0;var[A,r]="boolean"==typeof e?[void 0,e]:[e],{viewPort:n}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(n.computeSize("x"),n.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(n.computeSize("x"),n.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*n.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*n.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return 15*this.getNumber();case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case this.isString(/%$/)&&r:return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*n.computeSize(A);default:var s=this.getNumber();return t&&s<1?s*n.computeSize(A):s}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():1e3*this.getNumber():0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){var e=this.getString(),t=/#([^)'"]+)/.exec(e);return t&&(t=t[1]),t||(t=e),this.document.definitions[t]}getFillStyleDefinition(e,t){var A=this.getDefinition();if(!A)return null;if("function"==typeof A.createGradient)return A.createGradient(this.document.ctx,e,t);if("function"==typeof A.createPattern){if(A.getHrefAttribute().hasValue()){var r=A.getAttribute("patternTransform");A=A.getHrefAttribute().getDefinition(),r.hasValue()&&A.getAttribute("patternTransform",!0).setValue(r.value)}return A.createPattern(this.document.ctx,e,t)}return null}getTextBaseline(){return this.hasValue()?T.textBaselineMapping[this.getString()]:null}addOpacity(e){for(var t=this.getColor(),A=t.length,r=0,n=0;n1&&void 0!==arguments[1]?arguments[1]:0,[A=t,r=t]=d(e);return new M(A,r)}static parseScale(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,[A=t,r=A]=d(e);return new M(A,r)}static parsePath(e){for(var t=d(e),A=t.length,r=[],n=0;n0}runEvents(){if(this.working){var{screen:e,events:t,eventElements:A}=this,{style:r}=e.ctx.canvas;r&&(r.cursor=""),t.forEach((e,t)=>{for(var{run:r}=e,n=A[t];n;)r(n),n=n.parent}),this.events=[],this.eventElements=[]}}checkPath(e,t){if(this.working&&t){var{events:A,eventElements:r}=this;A.forEach((A,n)=>{var{x:s,y:i}=A;!r[n]&&t.isPointInPath&&t.isPointInPath(s,i)&&(r[n]=e)})}}checkBoundingBox(e,t){if(this.working&&t){var{events:A,eventElements:r}=this;A.forEach((A,n)=>{var{x:s,y:i}=A;!r[n]&&t.isPointInBox(s,i)&&(r[n]=e)})}}mapXY(e,t){for(var{window:A,ctx:r}=this.screen,n=new M(e,t),s=r.canvas;s;)n.x-=s.offsetLeft,n.y-=s.offsetTop,s=s.offsetParent;return A.scrollX&&(n.x+=A.scrollX),A.scrollY&&(n.y+=A.scrollY),n}onClick(e){var{x:t,y:A}=this.mapXY(e.clientX,e.clientY);this.events.push({type:"onclick",x:t,y:A,run(e){e.onClick&&e.onClick()}})}onMouseMove(e){var{x:t,y:A}=this.mapXY(e.clientX,e.clientY);this.events.push({type:"onmousemove",x:t,y:A,run(e){e.onMouseMove&&e.onMouseMove()}})}}var R="undefined"!=typeof window?window:null,K="undefined"!=typeof fetch?fetch.bind(void 0):null;class V{constructor(e){var{fetch:t=K,window:A=R}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.ctx=e,this.FRAMERATE=30,this.MAX_VIRTUAL_PIXELS=3e4,this.CLIENT_WIDTH=800,this.CLIENT_HEIGHT=600,this.viewPort=new O,this.mouse=new D(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=A,this.fetch=t}wait(e){this.waits.push(e)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;var e=this.waits.every(e=>e());return e&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=e,e}setDefaults(e){e.strokeStyle="rgba(0,0,0,0)",e.lineCap="butt",e.lineJoin="miter",e.miterLimit=4}setViewBox(e){var{document:t,ctx:A,aspectRatio:r,width:n,desiredWidth:s,height:i,desiredHeight:o,minX:a=0,minY:l=0,refX:u,refY:h,clip:d=!1,clipX:f=0,clipY:p=0}=e,g=c(r).replace(/^defer\s/,""),[m,w]=g.split(" "),B=m||"xMidYMid",y=w||"meet",v=n/s,b=i/o,C=Math.min(v,b),_=Math.max(v,b),j=s,x=o;"meet"===y&&(j*=C,x*=C),"slice"===y&&(j*=_,x*=_);var F=new T(t,"refX",u),Q=new T(t,"refY",h),U=F.hasValue()&&Q.hasValue();if(U&&A.translate(-C*F.getPixels("x"),-C*Q.getPixels("y")),d){var E=C*f,S=C*p;A.beginPath(),A.moveTo(E,S),A.lineTo(n,S),A.lineTo(n,i),A.lineTo(E,i),A.closePath(),A.clip()}if(!U){var L="meet"===y&&C===b,I="slice"===y&&_===b,N="meet"===y&&C===v,k="slice"===y&&_===v;B.startsWith("xMid")&&(L||I)&&A.translate(n/2-j/2,0),B.endsWith("YMid")&&(N||k)&&A.translate(0,i/2-x/2),B.startsWith("xMax")&&(L||I)&&A.translate(n-j,0),B.endsWith("YMax")&&(N||k)&&A.translate(0,i-x)}switch(!0){case"none"===B:A.scale(v,b);break;case"meet"===y:A.scale(C,C);break;case"slice"===y:A.scale(_,_)}A.translate(-a,-l)}start(e){var{enableRedraw:t=!1,ignoreMouse:A=!1,ignoreAnimation:r=!1,ignoreDimensions:n=!1,ignoreClear:i=!1,forceRedraw:o,scaleWidth:a,scaleHeight:l,offsetX:c,offsetY:u}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{FRAMERATE:h,mouse:d}=this,f=1e3/h;if(this.frameDuration=f,this.readyPromise=new Promise(e=>{this.resolveReady=e}),this.isReady()&&this.render(e,n,i,a,l,c,u),t){var p=Date.now(),g=p,m=0,w=()=>{p=Date.now(),(m=p-g)>=f&&(g=p-m%f,this.shouldUpdate(r,o)&&(this.render(e,n,i,a,l,c,u),d.runEvents())),this.intervalId=s(w)};A||d.start(),this.intervalId=s(w)}}stop(){this.intervalId&&(s.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(e,t){if(!e){var{frameDuration:A}=this;if(this.animations.reduce((e,t)=>t.update(A)||e,!1))return!0}return!("function"!=typeof t||!t())||!(this.isReadyLock||!this.isReady())||!!this.mouse.hasEvents()}render(e,t,A,r,n,s,i){var{CLIENT_WIDTH:o,CLIENT_HEIGHT:a,viewPort:l,ctx:c,isFirstRender:u}=this,h=c.canvas;l.clear(),h.width&&h.height?l.setCurrent(h.width,h.height):l.setCurrent(o,a);var f=e.getStyle("width"),p=e.getStyle("height");!t&&(u||"number"!=typeof r&&"number"!=typeof n)&&(f.hasValue()&&(h.width=f.getPixels("x"),h.style&&(h.style.width="".concat(h.width,"px"))),p.hasValue()&&(h.height=p.getPixels("y"),h.style&&(h.style.height="".concat(h.height,"px"))));var g=h.clientWidth||h.width,m=h.clientHeight||h.height;if(t&&f.hasValue()&&p.hasValue()&&(g=f.getPixels("x"),m=p.getPixels("y")),l.setCurrent(g,m),"number"==typeof s&&e.getAttribute("x",!0).setValue(s),"number"==typeof i&&e.getAttribute("y",!0).setValue(i),"number"==typeof r||"number"==typeof n){var w=d(e.getAttribute("viewBox").getString()),B=0,y=0;if("number"==typeof r){var v=e.getStyle("width");v.hasValue()?B=v.getPixels("x")/r:isNaN(w[2])||(B=w[2]/r)}if("number"==typeof n){var b=e.getStyle("height");b.hasValue()?y=b.getPixels("y")/n:isNaN(w[3])||(y=w[3]/n)}B||(B=y),y||(y=B),e.getAttribute("width",!0).setValue(r),e.getAttribute("height",!0).setValue(n);var C=e.getStyle("transform",!0,!0);C.setValue("".concat(C.getString()," scale(").concat(1/B,", ").concat(1/y,")"))}A||c.clearRect(0,0,g,m),e.render(c),u&&(this.isFirstRender=!1)}}V.defaultWindow=R,V.defaultFetch=K;var{defaultFetch:G}=V,z="undefined"!=typeof DOMParser?DOMParser:null;class q{constructor(){var{fetch:e=G,DOMParser:t=z}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fetch=e,this.DOMParser=t}parse(e){var t=this;return(0,r.default)(function*(){return e.startsWith("<")?t.parseFromString(e):t.load(e)})()}parseFromString(e){var t=new this.DOMParser;try{return this.checkDocument(t.parseFromString(e,"image/svg+xml"))}catch(A){return this.checkDocument(t.parseFromString(e,"text/xml"))}}checkDocument(e){var t=e.getElementsByTagName("parsererror")[0];if(t)throw new Error(t.textContent);return e}load(e){var t=this;return(0,r.default)(function*(){var A=yield t.fetch(e),r=yield A.text();return t.parseFromString(r)})()}}class W{constructor(e,t){this.type="translate",this.point=null,this.point=M.parse(t)}apply(e){var{x:t,y:A}=this.point;e.translate(t||0,A||0)}unapply(e){var{x:t,y:A}=this.point;e.translate(-1*t||0,-1*A||0)}applyToPoint(e){var{x:t,y:A}=this.point;e.applyTransform([1,0,0,1,t||0,A||0])}}class X{constructor(e,t,A){this.type="rotate",this.angle=null,this.originX=null,this.originY=null,this.cx=0,this.cy=0;var r=d(t);this.angle=new T(e,"angle",r[0]),this.originX=A[0],this.originY=A[1],this.cx=r[1]||0,this.cy=r[2]||0}apply(e){var{cx:t,cy:A,originX:r,originY:n,angle:s}=this,i=t+r.getPixels("x"),o=A+n.getPixels("y");e.translate(i,o),e.rotate(s.getRadians()),e.translate(-i,-o)}unapply(e){var{cx:t,cy:A,originX:r,originY:n,angle:s}=this,i=t+r.getPixels("x"),o=A+n.getPixels("y");e.translate(i,o),e.rotate(-1*s.getRadians()),e.translate(-i,-o)}applyToPoint(e){var{cx:t,cy:A,angle:r}=this,n=r.getRadians();e.applyTransform([1,0,0,1,t||0,A||0]),e.applyTransform([Math.cos(n),Math.sin(n),-Math.sin(n),Math.cos(n),0,0]),e.applyTransform([1,0,0,1,-t||0,-A||0])}}class Y{constructor(e,t,A){this.type="scale",this.scale=null,this.originX=null,this.originY=null;var r=M.parseScale(t);0!==r.x&&0!==r.y||(r.x=F,r.y=F),this.scale=r,this.originX=A[0],this.originY=A[1]}apply(e){var{scale:{x:t,y:A},originX:r,originY:n}=this,s=r.getPixels("x"),i=n.getPixels("y");e.translate(s,i),e.scale(t,A||t),e.translate(-s,-i)}unapply(e){var{scale:{x:t,y:A},originX:r,originY:n}=this,s=r.getPixels("x"),i=n.getPixels("y");e.translate(s,i),e.scale(1/t,1/A||t),e.translate(-s,-i)}applyToPoint(e){var{x:t,y:A}=this.scale;e.applyTransform([t||0,0,0,A||0,0,0])}}class J{constructor(e,t,A){this.type="matrix",this.matrix=[],this.originX=null,this.originY=null,this.matrix=d(t),this.originX=A[0],this.originY=A[1]}apply(e){var{originX:t,originY:A,matrix:r}=this,n=t.getPixels("x"),s=A.getPixels("y");e.translate(n,s),e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),e.translate(-n,-s)}unapply(e){var{originX:t,originY:A,matrix:r}=this,n=r[0],s=r[2],i=r[4],o=r[1],a=r[3],l=r[5],c=1/(n*(1*a-0*l)-s*(1*o-0*l)+i*(0*o-0*a)),u=t.getPixels("x"),h=A.getPixels("y");e.translate(u,h),e.transform(c*(1*a-0*l),c*(0*l-1*o),c*(0*i-1*s),c*(1*n-0*i),c*(s*l-i*a),c*(i*o-n*l)),e.translate(-u,-h)}applyToPoint(e){e.applyTransform(this.matrix)}}class Z extends J{constructor(e,t,A){super(e,t,A),this.type="skew",this.angle=null,this.angle=new T(e,"angle",t)}}class $ extends Z{constructor(e,t,A){super(e,t,A),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class ee extends Z{constructor(e,t,A){super(e,t,A),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}class te{constructor(e,t,A){this.document=e,this.transforms=[];var r=function(e){return c(e).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}(t);r.forEach(e=>{if("none"!==e){var[t,r]=function(e){var[t,A]=e.split("(");return[t.trim(),A.trim().replace(")","")]}(e),n=te.transformTypes[t];void 0!==n&&this.transforms.push(new n(this.document,r,A))}})}static fromElement(e,t){var A=t.getStyle("transform",!1,!0),[r,n=r]=t.getStyle("transform-origin",!1,!0).split(),s=[r,n];return A.hasValue()?new te(e,A.getString(),s):null}apply(e){for(var{transforms:t}=this,A=t.length,r=0;r=0;A--)t[A].unapply(e)}applyToPoint(e){for(var{transforms:t}=this,A=t.length,r=0;r2&&void 0!==arguments[2]&&arguments[2];if(this.document=e,this.node=t,this.captureTextNodes=A,this.attributes=Object.create(null),this.styles=Object.create(null),this.stylesSpecificity=Object.create(null),this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],t&&1===t.nodeType){Array.from(t.attributes).forEach(t=>{var A=p(t.nodeName);this.attributes[A]=new T(e,A,t.value)}),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()&&this.getAttribute("style").getString().split(";").map(e=>e.trim()).forEach(t=>{if(t){var[A,r]=t.split(":").map(e=>e.trim());this.styles[A]=new T(e,A,r)}});var{definitions:r}=e,n=this.getAttribute("id");n.hasValue()&&(r[n.getString()]||(r[n.getString()]=this)),Array.from(t.childNodes).forEach(t=>{if(1===t.nodeType)this.addChild(t);else if(A&&(3===t.nodeType||4===t.nodeType)){var r=e.createTextNode(t);r.getText().length>0&&this.addChild(r)}})}}getAttribute(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],A=this.attributes[e];if(!A&&t){var r=new T(this.document,e,"");return this.attributes[e]=r,r}return A||T.empty(this.document)}getHrefAttribute(){for(var e in this.attributes)if("href"===e||e.endsWith(":href"))return this.attributes[e];return T.empty(this.document)}getStyle(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],A=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.styles[e];if(r)return r;var n=this.getAttribute(e);if(null!=n&&n.hasValue())return this.styles[e]=n,n;if(!A){var{parent:s}=this;if(s){var i=s.getStyle(e);if(null!=i&&i.hasValue())return i}}if(t){var o=new T(this.document,e,"");return this.styles[e]=o,o}return r||T.empty(this.document)}render(e){if("none"!==this.getStyle("display").getString()&&"hidden"!==this.getStyle("visibility").getString()){if(e.save(),this.getStyle("mask").hasValue()){var t=this.getStyle("mask").getDefinition();t&&(this.applyEffects(e),t.apply(e,this))}else if("none"!==this.getStyle("filter").getValue("none")){var A=this.getStyle("filter").getDefinition();A&&(this.applyEffects(e),A.apply(e,this))}else this.setContext(e),this.renderChildren(e),this.clearContext(e);e.restore()}}setContext(e){}applyEffects(e){var t=te.fromElement(this.document,this);t&&t.apply(e);var A=this.getStyle("clip-path",!1,!0);if(A.hasValue()){var r=A.getDefinition();r&&r.apply(e)}}clearContext(e){}renderChildren(e){this.children.forEach(t=>{t.render(e)})}addChild(e){var t=e instanceof Ae?e:this.document.createElement(e);t.parent=this,Ae.ignoreChildTypes.includes(t.type)||this.children.push(t)}matchesSelector(e){var t,{node:A}=this;if("function"==typeof A.matches)return A.matches(e);var r=null===(t=A.getAttribute)||void 0===t?void 0:t.call(A,"class");return!(!r||""===r)&&r.split(" ").some(t=>".".concat(t)===e)}addStylesFromStyleDefinition(){var{styles:e,stylesSpecificity:t}=this.document;for(var A in e)if(!A.startsWith("@")&&this.matchesSelector(A)){var r=e[A],n=t[A];if(r)for(var s in r){var i=this.stylesSpecificity[s];void 0===i&&(i="000"),n>=i&&(this.styles[s]=r[s],this.stylesSpecificity[s]=n)}}}removeStyles(e,t){return t.reduce((t,A)=>{var r=e.getStyle(A);if(!r.hasValue())return t;var n=r.getString();return r.setValue(""),[...t,[A,n]]},[])}restoreStyles(e,t){t.forEach(t=>{var[A,r]=t;e.getStyle(A,!0).setValue(r)})}isFirstChild(){var e;return 0===(null===(e=this.parent)||void 0===e?void 0:e.children.indexOf(this))}}Ae.ignoreChildTypes=["title"];class re extends Ae{constructor(e,t,A){super(e,t,A)}}function ne(e){var t=e.trim();return/^('|")/.test(t)?t:'"'.concat(t,'"')}function se(e){if(!e)return"";var t=e.trim().toLowerCase();switch(t){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return t;default:return/^oblique\s+(-|)\d+deg$/.test(t)?t:""}}function ie(e){if(!e)return"";var t=e.trim().toLowerCase();switch(t){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return t;default:return/^[\d.]+$/.test(t)?t:""}}class oe{constructor(e,t,A,r,n,s){var i=s?"string"==typeof s?oe.parse(s):s:{};this.fontFamily=n||i.fontFamily,this.fontSize=r||i.fontSize,this.fontStyle=e||i.fontStyle,this.fontWeight=A||i.fontWeight,this.fontVariant=t||i.fontVariant}static parse(){var e=arguments.length>1?arguments[1]:void 0,t="",A="",r="",n="",s="",i=c(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").trim().split(" "),o={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return i.forEach(e=>{switch(!0){case!o.fontStyle&&oe.styles.includes(e):"inherit"!==e&&(t=e),o.fontStyle=!0;break;case!o.fontVariant&&oe.variants.includes(e):"inherit"!==e&&(A=e),o.fontStyle=!0,o.fontVariant=!0;break;case!o.fontWeight&&oe.weights.includes(e):"inherit"!==e&&(r=e),o.fontStyle=!0,o.fontVariant=!0,o.fontWeight=!0;break;case!o.fontSize:"inherit"!==e&&([n]=e.split("/")),o.fontStyle=!0,o.fontVariant=!0,o.fontWeight=!0,o.fontSize=!0;break;default:"inherit"!==e&&(s+=e)}}),new oe(t,A,r,n,s,e)}toString(){return[se(this.fontStyle),this.fontVariant,ie(this.fontWeight),this.fontSize,(e=this.fontFamily,"undefined"==typeof process?e:e.trim().split(",").map(ne).join(","))].join(" ").trim();var e}}oe.styles="normal|italic|oblique|inherit",oe.variants="normal|small-caps|inherit",oe.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class ae{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.NaN,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.NaN,A=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.NaN,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.NaN;this.x1=e,this.y1=t,this.x2=A,this.y2=r,this.addPoint(e,t),this.addPoint(A,r)}get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(e,t){void 0!==e&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),ethis.x2&&(this.x2=e)),void 0!==t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),tthis.y2&&(this.y2=t))}addX(e){this.addPoint(e,null)}addY(e){this.addPoint(null,e)}addBoundingBox(e){if(e){var{x1:t,y1:A,x2:r,y2:n}=e;this.addPoint(t,A),this.addPoint(r,n)}}sumCubic(e,t,A,r,n){return Math.pow(1-e,3)*t+3*Math.pow(1-e,2)*e*A+3*(1-e)*Math.pow(e,2)*r+Math.pow(e,3)*n}bezierCurveAdd(e,t,A,r,n){var s=6*t-12*A+6*r,i=-3*t+9*A-9*r+3*n,o=3*A-3*t;if(0!==i){var a=Math.pow(s,2)-4*o*i;if(!(a<0)){var l=(-s+Math.sqrt(a))/(2*i);0=t.length-1}next(){var e=this.commands[++this.i];return this.previousCommand=this.command,this.command=e,e}getPoint(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"x",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y",A=new M(this.command[e],this.command[t]);return this.makeAbsolute(A)}getAsControlPoint(e,t){var A=this.getPoint(e,t);return this.control=A,A}getAsCurrentPoint(e,t){var A=this.getPoint(e,t);return this.current=A,A}getReflectedControlPoint(){var e=this.previousCommand.type;if(e!==o.SVGPathData.CURVE_TO&&e!==o.SVGPathData.SMOOTH_CURVE_TO&&e!==o.SVGPathData.QUAD_TO&&e!==o.SVGPathData.SMOOTH_QUAD_TO)return this.current;var{current:{x:t,y:A},control:{x:r,y:n}}=this;return new M(2*t-r,2*A-n)}makeAbsolute(e){if(this.command.relative){var{x:t,y:A}=this.current;e.x+=t,e.y+=A}return e}addMarker(e,t,A){var{points:r,angles:n}=this;A&&n.length>0&&!n[n.length-1]&&(n[n.length-1]=r[r.length-1].angleTo(A)),this.addMarkerAngle(e,t?t.angleTo(e):null)}addMarkerAngle(e,t){this.points.push(e),this.angles.push(t)}getMarkerPoints(){return this.points}getMarkerAngles(){for(var{angles:e}=this,t=e.length,A=0;A1&&void 0!==arguments[1]&&arguments[1];if(!t){var A=this.getStyle("fill"),r=this.getStyle("fill-opacity"),n=this.getStyle("stroke"),s=this.getStyle("stroke-opacity");if(A.isUrlDefinition()){var i=A.getFillStyleDefinition(this,r);i&&(e.fillStyle=i)}else if(A.hasValue()){"currentColor"===A.getString()&&A.setValue(this.getStyle("color").getColor());var o=A.getColor();"inherit"!==o&&(e.fillStyle="none"===o?"rgba(0,0,0,0)":o)}if(r.hasValue()){var a=new T(this.document,"fill",e.fillStyle).addOpacity(r).getColor();e.fillStyle=a}if(n.isUrlDefinition()){var l=n.getFillStyleDefinition(this,s);l&&(e.strokeStyle=l)}else if(n.hasValue()){"currentColor"===n.getString()&&n.setValue(this.getStyle("color").getColor());var c=n.getString();"inherit"!==c&&(e.strokeStyle="none"===c?"rgba(0,0,0,0)":c)}if(s.hasValue()){var u=new T(this.document,"stroke",e.strokeStyle).addOpacity(s).getString();e.strokeStyle=u}var h=this.getStyle("stroke-width");if(h.hasValue()){var f=h.getPixels();e.lineWidth=f||F}var p=this.getStyle("stroke-linecap"),g=this.getStyle("stroke-linejoin"),m=this.getStyle("stroke-miterlimit"),w=this.getStyle("stroke-dasharray"),B=this.getStyle("stroke-dashoffset");if(p.hasValue()&&(e.lineCap=p.getString()),g.hasValue()&&(e.lineJoin=g.getString()),m.hasValue()&&(e.miterLimit=m.getNumber()),w.hasValue()&&"none"!==w.getString()){var y=d(w.getString());void 0!==e.setLineDash?e.setLineDash(y):void 0!==e.webkitLineDash?e.webkitLineDash=y:void 0===e.mozDash||1===y.length&&0===y[0]||(e.mozDash=y);var v=B.getPixels();void 0!==e.lineDashOffset?e.lineDashOffset=v:void 0!==e.webkitLineDashOffset?e.webkitLineDashOffset=v:void 0!==e.mozDashOffset&&(e.mozDashOffset=v)}}if(this.modifiedEmSizeStack=!1,void 0!==e.font){var b=this.getStyle("font"),C=this.getStyle("font-style"),_=this.getStyle("font-variant"),j=this.getStyle("font-weight"),x=this.getStyle("font-size"),Q=this.getStyle("font-family"),U=new oe(C.getString(),_.getString(),j.getString(),x.hasValue()?"".concat(x.getPixels(!0),"px"):"",Q.getString(),oe.parse(b.getString(),e.font));C.setValue(U.fontStyle),_.setValue(U.fontVariant),j.setValue(U.fontWeight),x.setValue(U.fontSize),Q.setValue(U.fontFamily),e.font=U.toString(),x.isPixels()&&(this.document.emSize=x.getPixels(),this.modifiedEmSizeStack=!0)}t||(this.applyEffects(e),e.globalAlpha=this.calculateOpacity())}clearContext(e){super.clearContext(e),this.modifiedEmSizeStack&&this.document.popEmSize()}}class ue extends ce{constructor(e,t,A){super(e,t,A),this.type="path",this.pathParser=null,this.pathParser=new le(this.getAttribute("d").getString())}path(e){var{pathParser:t}=this,A=new ae;for(t.reset(),e&&e.beginPath();!t.isEnd();)switch(t.next().type){case le.MOVE_TO:this.pathM(e,A);break;case le.LINE_TO:this.pathL(e,A);break;case le.HORIZ_LINE_TO:this.pathH(e,A);break;case le.VERT_LINE_TO:this.pathV(e,A);break;case le.CURVE_TO:this.pathC(e,A);break;case le.SMOOTH_CURVE_TO:this.pathS(e,A);break;case le.QUAD_TO:this.pathQ(e,A);break;case le.SMOOTH_QUAD_TO:this.pathT(e,A);break;case le.ARC:this.pathA(e,A);break;case le.CLOSE_PATH:this.pathZ(e,A)}return A}getBoundingBox(e){return this.path()}getMarkers(){var{pathParser:e}=this,t=e.getMarkerPoints(),A=e.getMarkerAngles();return t.map((e,t)=>[e,A[t]])}renderChildren(e){this.path(e),this.document.screen.mouse.checkPath(this,e);var t=this.getStyle("fill-rule");""!==e.fillStyle&&("inherit"!==t.getString("inherit")?e.fill(t.getString()):e.fill()),""!==e.strokeStyle&&("non-scaling-stroke"===this.getAttribute("vector-effect").getString()?(e.save(),e.setTransform(1,0,0,1,0,0),e.stroke(),e.restore()):e.stroke());var A=this.getMarkers();if(A){var r=A.length-1,n=this.getStyle("marker-start"),s=this.getStyle("marker-mid"),i=this.getStyle("marker-end");if(n.isUrlDefinition()){var o=n.getDefinition(),[a,l]=A[0];o.render(e,a,l)}if(s.isUrlDefinition())for(var c=s.getDefinition(),u=1;u1&&(r*=Math.sqrt(u),n*=Math.sqrt(u));var h=(i===o?-1:1)*Math.sqrt((Math.pow(r,2)*Math.pow(n,2)-Math.pow(r,2)*Math.pow(c.y,2)-Math.pow(n,2)*Math.pow(c.x,2))/(Math.pow(r,2)*Math.pow(c.y,2)+Math.pow(n,2)*Math.pow(c.x,2)));isNaN(h)&&(h=0);var d=new M(h*r*c.y/n,h*-n*c.x/r),f=new M((t.x+l.x)/2+Math.cos(a)*d.x-Math.sin(a)*d.y,(t.y+l.y)/2+Math.sin(a)*d.x+Math.cos(a)*d.y),p=E([1,0],[(c.x-d.x)/r,(c.y-d.y)/n]),g=[(c.x-d.x)/r,(c.y-d.y)/n],m=[(-c.x-d.x)/r,(-c.y-d.y)/n],w=E(g,m);return U(g,m)<=-1&&(w=Math.PI),U(g,m)>=1&&(w=0),{currentPoint:l,rX:r,rY:n,sweepFlag:o,xAxisRotation:a,centp:f,a1:p,ad:w}}pathA(e,t){var{pathParser:A}=this,{currentPoint:r,rX:n,rY:s,sweepFlag:i,xAxisRotation:o,centp:a,a1:l,ad:c}=ue.pathA(A),u=1-i?1:-1,h=l+u*(c/2),d=new M(a.x+n*Math.cos(h),a.y+s*Math.sin(h));if(A.addMarkerAngle(d,h-u*Math.PI/2),A.addMarkerAngle(r,h-u*Math.PI),t.addPoint(r.x,r.y),e&&!isNaN(l)&&!isNaN(c)){var f=n>s?n:s,p=n>s?1:n/s,g=n>s?s/n:1;e.translate(a.x,a.y),e.rotate(o),e.scale(p,g),e.arc(0,0,f,l,l+c,Boolean(1-i)),e.scale(1/p,1/g),e.rotate(-o),e.translate(-a.x,-a.y)}}static pathZ(e){e.current=e.start}pathZ(e,t){ue.pathZ(this.pathParser),e&&t.x1!==t.x2&&t.y1!==t.y2&&e.closePath()}}class he extends ue{constructor(e,t,A){super(e,t,A),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class de extends ce{constructor(e,t,A){super(e,t,new.target===de||A),this.type="text",this.x=0,this.y=0,this.measureCache=-1}setContext(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.setContext(e,t);var A=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();A&&(e.textBaseline=A)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(e){if("text"!==this.type)return this.getTElementBoundingBox(e);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(e);var t=null;return this.children.forEach((A,r)=>{var n=this.getChildBoundingBox(e,this,this,r);t?t.addBoundingBox(n):t=n}),t}getFontSize(){var{document:e,parent:t}=this,A=oe.parse(e.ctx.font).fontSize;return t.getStyle("font-size").getNumber(A)}getTElementBoundingBox(e){var t=this.getFontSize();return new ae(this.x,this.y-t,this.x+this.measureText(e),this.y)}getGlyph(e,t,A){var r=t[A],n=null;if(e.isArabic){var s=t.length,i=t[A-1],o=t[A+1],a="isolated";if((0===A||" "===i)&&A0&&" "!==i&&A0&&" "!==i&&(A===s-1||" "===o)&&(a="initial"),void 0!==e.glyphs[r]){var l=e.glyphs[r];n=l instanceof he?l:l[a]}}else n=e.glyphs[r];return n||(n=e.missingGlyph),n}getText(){return""}getTextFromNode(e){var t=e||this.node,A=Array.from(t.parentNode.childNodes),r=A.indexOf(t),n=A.length-1,s=c(t.textContent||"");return 0===r&&(s=u(s)),r===n&&(s=h(s)),s}renderChildren(e){if("text"===this.type){this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(e),this.children.forEach((t,A)=>{this.renderChild(e,this,this,A)});var{mouse:t}=this.document.screen;t.isWorking()&&t.checkBoundingBox(this,this.getBoundingBox(e))}else this.renderTElementChildren(e)}renderTElementChildren(e){var{document:t,parent:A}=this,r=this.getText(),n=A.getStyle("font-family").getDefinition();if(n)for(var{unitsPerEm:s}=n.fontFace,i=oe.parse(t.ctx.font),o=A.getStyle("font-size").getNumber(i.fontSize),a=A.getStyle("font-style").getString(i.fontStyle),l=o/s,c=n.isRTL?r.split("").reverse().join(""):r,u=d(A.getAttribute("dx").getString()),h=c.length,f=0;f=this.leafTexts.length)){var e,t=this.leafTexts[this.textChunkStart],A=t.getStyle("text-anchor").getString("start");e="start"===A?t.x-this.minX:"end"===A?t.x-this.maxX:t.x-(this.minX+this.maxX)/2;for(var r=this.textChunkStart;r{this.adjustChildCoordinatesRecursiveCore(e,this,this,A)}),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(e,t,A,r){var n=A.children[r];n.children.length>0?n.children.forEach((A,r)=>{t.adjustChildCoordinatesRecursiveCore(e,t,n,r)}):this.adjustChildCoordinates(e,t,A,r)}adjustChildCoordinates(e,t,A,r){var n=A.children[r];if("function"!=typeof n.measureText)return n;e.save(),n.setContext(e,!0);var s=n.getAttribute("x"),i=n.getAttribute("y"),o=n.getAttribute("dx"),a=n.getAttribute("dy"),l=n.getStyle("font-family").getDefinition(),c=Boolean(l)&&l.isRTL;0===r&&(s.hasValue()||s.setValue(n.getInheritedAttribute("x")),i.hasValue()||i.setValue(n.getInheritedAttribute("y")),o.hasValue()||o.setValue(n.getInheritedAttribute("dx")),a.hasValue()||a.setValue(n.getInheritedAttribute("dy")));var u=n.measureText(e);return c&&(t.x-=u),s.hasValue()?(t.applyAnchoring(),n.x=s.getPixels("x"),o.hasValue()&&(n.x+=o.getPixels("x"))):(o.hasValue()&&(t.x+=o.getPixels("x")),n.x=t.x),t.x=n.x,c||(t.x+=u),i.hasValue()?(n.y=i.getPixels("y"),a.hasValue()&&(n.y+=a.getPixels("y"))):(a.hasValue()&&(t.y+=a.getPixels("y")),n.y=t.y),t.y=n.y,t.leafTexts.push(n),t.minX=Math.min(t.minX,n.x,n.x+u),t.maxX=Math.max(t.maxX,n.x,n.x+u),n.clearContext(e),e.restore(),n}getChildBoundingBox(e,t,A,r){var n=A.children[r];if("function"!=typeof n.getBoundingBox)return null;var s=n.getBoundingBox(e);return s?(n.children.forEach((A,r)=>{var i=t.getChildBoundingBox(e,t,n,r);s.addBoundingBox(i)}),s):null}renderChild(e,t,A,r){var n=A.children[r];n.render(e),n.children.forEach((A,r)=>{t.renderChild(e,t,n,r)})}measureText(e){var{measureCache:t}=this;if(~t)return t;var A=this.getText(),r=this.measureTargetText(e,A);return this.measureCache=r,r}measureTargetText(e,t){if(!t.length)return 0;var{parent:A}=this,r=A.getStyle("font-family").getDefinition();if(r){for(var n=this.getFontSize(),s=r.isRTL?t.split("").reverse().join(""):t,i=d(A.getAttribute("dx").getString()),o=s.length,a=0,l=0;l0?"":this.getTextFromNode()}getText(){return this.text}}class pe extends fe{constructor(){super(...arguments),this.type="textNode"}}class ge extends ce{constructor(){super(...arguments),this.type="svg",this.root=!1}setContext(e){var t,{document:A}=this,{screen:r,window:n}=A,s=e.canvas;if(r.setDefaults(e),s.style&&void 0!==e.font&&n&&void 0!==n.getComputedStyle){e.font=n.getComputedStyle(s).getPropertyValue("font");var i=new T(A,"fontSize",oe.parse(e.font).fontSize);i.hasValue()&&(A.rootEmSize=i.getPixels("y"),A.emSize=A.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);var{width:o,height:a}=r.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");var l=this.getAttribute("refX"),c=this.getAttribute("refY"),u=this.getAttribute("viewBox"),h=u.hasValue()?d(u.getString()):null,f=!this.root&&"visible"!==this.getStyle("overflow").getValue("hidden"),p=0,g=0,m=0,w=0;h&&(p=h[0],g=h[1]),this.root||(o=this.getStyle("width").getPixels("x"),a=this.getStyle("height").getPixels("y"),"marker"===this.type&&(m=p,w=g,p=0,g=0)),r.viewPort.setCurrent(o,a),!this.node||this.parent&&"foreignObject"!==(null===(t=this.node.parentNode)||void 0===t?void 0:t.nodeName)||!this.getStyle("transform",!1,!0).hasValue()||this.getStyle("transform-origin",!1,!0).hasValue()||this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(e),e.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),h&&(o=h[2],a=h[3]),A.setViewBox({ctx:e,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:r.viewPort.width,desiredWidth:o,height:r.viewPort.height,desiredHeight:a,minX:p,minY:g,refX:l.getValue(),refY:c.getValue(),clip:f,clipX:m,clipY:w}),h&&(r.viewPort.removeCurrent(),r.viewPort.setCurrent(o,a))}clearContext(e){super.clearContext(e),this.document.screen.viewPort.removeCurrent()}resize(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,A=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.getAttribute("width",!0),n=this.getAttribute("height",!0),s=this.getAttribute("viewBox"),i=this.getAttribute("style"),o=r.getNumber(0),a=n.getNumber(0);if(A)if("string"==typeof A)this.getAttribute("preserveAspectRatio",!0).setValue(A);else{var l=this.getAttribute("preserveAspectRatio");l.hasValue()&&l.setValue(l.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(r.setValue(e),n.setValue(t),s.hasValue()||s.setValue("0 0 ".concat(o||e," ").concat(a||t)),i.hasValue()){var c=this.getStyle("width"),u=this.getStyle("height");c.hasValue()&&c.setValue("".concat(e,"px")),u.hasValue()&&u.setValue("".concat(t,"px"))}}}class me extends ue{constructor(){super(...arguments),this.type="rect"}path(e){var t=this.getAttribute("x").getPixels("x"),A=this.getAttribute("y").getPixels("y"),r=this.getStyle("width",!1,!0).getPixels("x"),n=this.getStyle("height",!1,!0).getPixels("y"),s=this.getAttribute("rx"),i=this.getAttribute("ry"),o=s.getPixels("x"),a=i.getPixels("y");if(s.hasValue()&&!i.hasValue()&&(a=o),i.hasValue()&&!s.hasValue()&&(o=a),o=Math.min(o,r/2),a=Math.min(a,n/2),e){var l=(Math.sqrt(2)-1)/3*4;e.beginPath(),n>0&&r>0&&(e.moveTo(t+o,A),e.lineTo(t+r-o,A),e.bezierCurveTo(t+r-o+l*o,A,t+r,A+a-l*a,t+r,A+a),e.lineTo(t+r,A+n-a),e.bezierCurveTo(t+r,A+n-a+l*a,t+r-o+l*o,A+n,t+r-o,A+n),e.lineTo(t+o,A+n),e.bezierCurveTo(t+o-l*o,A+n,t,A+n-a+l*a,t,A+n-a),e.lineTo(t,A+a),e.bezierCurveTo(t,A+a-l*a,t+o-l*o,A,t+o,A),e.closePath())}return new ae(t,A,t+r,A+n)}getMarkers(){return null}}class we extends ue{constructor(){super(...arguments),this.type="circle"}path(e){var t=this.getAttribute("cx").getPixels("x"),A=this.getAttribute("cy").getPixels("y"),r=this.getAttribute("r").getPixels();return e&&r>0&&(e.beginPath(),e.arc(t,A,r,0,2*Math.PI,!1),e.closePath()),new ae(t-r,A-r,t+r,A+r)}getMarkers(){return null}}class Be extends ue{constructor(){super(...arguments),this.type="ellipse"}path(e){var t=(Math.sqrt(2)-1)/3*4,A=this.getAttribute("rx").getPixels("x"),r=this.getAttribute("ry").getPixels("y"),n=this.getAttribute("cx").getPixels("x"),s=this.getAttribute("cy").getPixels("y");return e&&A>0&&r>0&&(e.beginPath(),e.moveTo(n+A,s),e.bezierCurveTo(n+A,s+t*r,n+t*A,s+r,n,s+r),e.bezierCurveTo(n-t*A,s+r,n-A,s+t*r,n-A,s),e.bezierCurveTo(n-A,s-t*r,n-t*A,s-r,n,s-r),e.bezierCurveTo(n+t*A,s-r,n+A,s-t*r,n+A,s),e.closePath()),new ae(n-A,s-r,n+A,s+r)}getMarkers(){return null}}class ye extends ue{constructor(){super(...arguments),this.type="line"}getPoints(){return[new M(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new M(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(e){var[{x:t,y:A},{x:r,y:n}]=this.getPoints();return e&&(e.beginPath(),e.moveTo(t,A),e.lineTo(r,n)),new ae(t,A,r,n)}getMarkers(){var[e,t]=this.getPoints(),A=e.angleTo(t);return[[e,A],[t,A]]}}class ve extends ue{constructor(e,t,A){super(e,t,A),this.type="polyline",this.points=[],this.points=M.parsePath(this.getAttribute("points").getString())}path(e){var{points:t}=this,[{x:A,y:r}]=t,n=new ae(A,r);return e&&(e.beginPath(),e.moveTo(A,r)),t.forEach(t=>{var{x:A,y:r}=t;n.addPoint(A,r),e&&e.lineTo(A,r)}),n}getMarkers(){var{points:e}=this,t=e.length-1,A=[];return e.forEach((r,n)=>{n!==t&&A.push([r,r.angleTo(e[n+1])])}),A.length>0&&A.push([e[e.length-1],A[A.length-1][1]]),A}}class be extends ve{constructor(){super(...arguments),this.type="polygon"}path(e){var t=super.path(e),[{x:A,y:r}]=this.points;return e&&(e.lineTo(A,r),e.closePath()),t}}class Ce extends Ae{constructor(){super(...arguments),this.type="pattern"}createPattern(e,t,A){var r=this.getStyle("width").getPixels("x",!0),n=this.getStyle("height").getPixels("y",!0),s=new ge(this.document,null);s.attributes.viewBox=new T(this.document,"viewBox",this.getAttribute("viewBox").getValue()),s.attributes.width=new T(this.document,"width","".concat(r,"px")),s.attributes.height=new T(this.document,"height","".concat(n,"px")),s.attributes.transform=new T(this.document,"transform",this.getAttribute("patternTransform").getValue()),s.children=this.children;var i=this.document.createCanvas(r,n),o=i.getContext("2d"),a=this.getAttribute("x"),l=this.getAttribute("y");a.hasValue()&&l.hasValue()&&o.translate(a.getPixels("x",!0),l.getPixels("y",!0)),A.hasValue()?this.styles["fill-opacity"]=A:Reflect.deleteProperty(this.styles,"fill-opacity");for(var c=-1;c<=1;c++)for(var u=-1;u<=1;u++)o.save(),s.attributes.x=new T(this.document,"x",c*i.width),s.attributes.y=new T(this.document,"y",u*i.height),s.render(o),o.restore();return e.createPattern(i,"repeat")}}class _e extends Ae{constructor(){super(...arguments),this.type="marker"}render(e,t,A){if(t){var{x:r,y:n}=t,s=this.getAttribute("orient").getString("auto"),i=this.getAttribute("markerUnits").getString("strokeWidth");e.translate(r,n),"auto"===s&&e.rotate(A),"strokeWidth"===i&&e.scale(e.lineWidth,e.lineWidth),e.save();var o=new ge(this.document,null);o.type=this.type,o.attributes.viewBox=new T(this.document,"viewBox",this.getAttribute("viewBox").getValue()),o.attributes.refX=new T(this.document,"refX",this.getAttribute("refX").getValue()),o.attributes.refY=new T(this.document,"refY",this.getAttribute("refY").getValue()),o.attributes.width=new T(this.document,"width",this.getAttribute("markerWidth").getValue()),o.attributes.height=new T(this.document,"height",this.getAttribute("markerHeight").getValue()),o.attributes.overflow=new T(this.document,"overflow",this.getAttribute("overflow").getValue()),o.attributes.fill=new T(this.document,"fill",this.getAttribute("fill").getColor("black")),o.attributes.stroke=new T(this.document,"stroke",this.getAttribute("stroke").getValue("none")),o.children=this.children,o.render(e),e.restore(),"strokeWidth"===i&&e.scale(1/e.lineWidth,1/e.lineWidth),"auto"===s&&e.rotate(-A),e.translate(-r,-n)}}}class je extends Ae{constructor(){super(...arguments),this.type="defs"}render(){}}class xe extends ce{constructor(){super(...arguments),this.type="g"}getBoundingBox(e){var t=new ae;return this.children.forEach(A=>{t.addBoundingBox(A.getBoundingBox(e))}),t}}class Fe extends Ae{constructor(e,t,A){super(e,t,A),this.attributesToInherit=["gradientUnits"],this.stops=[];var{stops:r,children:n}=this;n.forEach(e=>{"stop"===e.type&&r.push(e)})}getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(e,t,A){var r=this;this.getHrefAttribute().hasValue()&&(r=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(r));var{stops:n}=r,s=this.getGradient(e,t);if(!s)return this.addParentOpacity(A,n[n.length-1].color);if(n.forEach(e=>{s.addColorStop(e.offset,this.addParentOpacity(A,e.color))}),this.getAttribute("gradientTransform").hasValue()){var{document:i}=this,{MAX_VIRTUAL_PIXELS:o,viewPort:a}=i.screen,[l]=a.viewPorts,c=new me(i,null);c.attributes.x=new T(i,"x",-o/3),c.attributes.y=new T(i,"y",-o/3),c.attributes.width=new T(i,"width",o),c.attributes.height=new T(i,"height",o);var u=new xe(i,null);u.attributes.transform=new T(i,"transform",this.getAttribute("gradientTransform").getValue()),u.children=[c];var h=new ge(i,null);h.attributes.x=new T(i,"x",0),h.attributes.y=new T(i,"y",0),h.attributes.width=new T(i,"width",l.width),h.attributes.height=new T(i,"height",l.height),h.children=[u];var d=i.createCanvas(l.width,l.height),f=d.getContext("2d");return f.fillStyle=s,h.render(f),f.createPattern(d,"no-repeat")}return s}inheritStopContainer(e){this.attributesToInherit.forEach(t=>{!this.getAttribute(t).hasValue()&&e.getAttribute(t).hasValue()&&this.getAttribute(t,!0).setValue(e.getAttribute(t).getValue())})}addParentOpacity(e,t){return e.hasValue()?new T(this.document,"color",t).addOpacity(e).getColor():t}}class Qe extends Fe{constructor(e,t,A){super(e,t,A),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}getGradient(e,t){var A="objectBoundingBox"===this.getGradientUnits(),r=A?t.getBoundingBox(e):null;if(A&&!r)return null;this.getAttribute("x1").hasValue()||this.getAttribute("y1").hasValue()||this.getAttribute("x2").hasValue()||this.getAttribute("y2").hasValue()||(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));var n=A?r.x+r.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),s=A?r.y+r.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),i=A?r.x+r.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),o=A?r.y+r.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return n===i&&s===o?null:e.createLinearGradient(n,s,i,o)}}class Ue extends Fe{constructor(e,t,A){super(e,t,A),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}getGradient(e,t){var A="objectBoundingBox"===this.getGradientUnits(),r=t.getBoundingBox(e);if(A&&!r)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");var n=A?r.x+r.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),s=A?r.y+r.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y"),i=n,o=s;this.getAttribute("fx").hasValue()&&(i=A?r.x+r.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(o=A?r.y+r.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));var a=A?(r.width+r.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),l=this.getAttribute("fr").getPixels();return e.createRadialGradient(i,o,l,n,s,a)}}class Ee extends Ae{constructor(e,t,A){super(e,t,A),this.type="stop";var r=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),n=this.getStyle("stop-opacity"),s=this.getStyle("stop-color",!0);""===s.getString()&&s.setValue("#000"),n.hasValue()&&(s=s.addOpacity(n)),this.offset=r,this.color=s.getColor()}}class Se extends Ae{constructor(e,t,A){super(e,t,A),this.type="animate",this.duration=0,this.initialValue=null,this.initialUnits="",this.removed=!1,this.frozen=!1,e.screen.animations.push(this),this.begin=this.getAttribute("begin").getMilliseconds(),this.maxDuration=this.begin+this.getAttribute("dur").getMilliseconds(),this.from=this.getAttribute("from"),this.to=this.getAttribute("to"),this.values=new T(e,"values",null);var r=this.getAttribute("values");r.hasValue()&&this.values.setValue(r.getString().split(";"))}getProperty(){var e=this.getAttribute("attributeType").getString(),t=this.getAttribute("attributeName").getString();return"CSS"===e?this.parent.getStyle(t,!0):this.parent.getAttribute(t,!0)}calcValue(){var{initialUnits:e}=this,{progress:t,from:A,to:r}=this.getProgress(),n=A.getNumber()+(r.getNumber()-A.getNumber())*t;return"%"===e&&(n*=100),"".concat(n).concat(e)}update(e){var{parent:t}=this,A=this.getProperty();if(this.initialValue||(this.initialValue=A.getString(),this.initialUnits=A.getUnits()),this.duration>this.maxDuration){var r=this.getAttribute("fill").getString("remove");if("indefinite"===this.getAttribute("repeatCount").getString()||"indefinite"===this.getAttribute("repeatDur").getString())this.duration=0;else if("freeze"!==r||this.frozen){if("remove"===r&&!this.removed)return this.removed=!0,A.setValue(t.animationFrozen?t.animationFrozenValue:this.initialValue),!0}else this.frozen=!0,t.animationFrozen=!0,t.animationFrozenValue=A.getString();return!1}this.duration+=e;var n=!1;if(this.begint+(n[A]-t)*e).join(" ");return s}}class Ne extends Ae{constructor(e,t,A){super(e,t,A),this.type="font",this.glyphs=Object.create(null),this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();var{definitions:r}=e,{children:n}=this;for(var s of n)switch(s.type){case"font-face":this.fontFace=s;var i=s.getStyle("font-family");i.hasValue()&&(r[i.getString()]=this);break;case"missing-glyph":this.missingGlyph=s;break;case"glyph":var o=s;o.arabicForm?(this.isRTL=!0,this.isArabic=!0,void 0===this.glyphs[o.unicode]&&(this.glyphs[o.unicode]=Object.create(null)),this.glyphs[o.unicode][o.arabicForm]=o):this.glyphs[o.unicode]=o}}render(){}}class ke extends Ae{constructor(e,t,A){super(e,t,A),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class He extends ue{constructor(){super(...arguments),this.type="missing-glyph",this.horizAdvX=0}}class Pe extends de{constructor(){super(...arguments),this.type="tref"}getText(){var e=this.getHrefAttribute().getDefinition();if(e){var t=e.children[0];if(t)return t.getText()}return""}}class Te extends de{constructor(e,t,A){super(e,t,A),this.type="a";var{childNodes:r}=t,n=r[0],s=r.length>0&&Array.from(r).every(e=>3===e.nodeType);this.hasText=s,this.text=s?this.getTextFromNode(n):""}getText(){return this.text}renderChildren(e){if(this.hasText){super.renderChildren(e);var{document:t,x:A,y:r}=this,{mouse:n}=t.screen,s=new T(t,"fontSize",oe.parse(t.ctx.font).fontSize);n.isWorking()&&n.checkBoundingBox(this,new ae(A,r-s.getPixels("y"),A+this.measureText(e),r))}else if(this.children.length>0){var i=new xe(this.document,null);i.children=this.children,i.parent=this,i.render(e)}}onClick(){var{window:e}=this.document;e&&e.open(this.getHrefAttribute().getString())}onMouseMove(){this.document.ctx.canvas.style.cursor="pointer"}}function Oe(e,t){var A=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),A.push.apply(A,r)}return A}function Me(e){for(var t=1;t{var{type:A,points:r}=t;switch(A){case le.LINE_TO:e&&e.lineTo(r[0],r[1]);break;case le.MOVE_TO:e&&e.moveTo(r[0],r[1]);break;case le.CURVE_TO:e&&e.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case le.QUAD_TO:e&&e.quadraticCurveTo(r[0],r[1],r[2],r[3]);break;case le.ARC:var[n,s,i,o,a,l,c,u]=r,h=i>o?i:o,d=i>o?1:i/o,f=i>o?o/i:1;e&&(e.translate(n,s),e.rotate(c),e.scale(d,f),e.arc(0,0,h,a,a+l,Boolean(1-u)),e.scale(1/d,1/f),e.rotate(-c),e.translate(-n,-s));break;case le.CLOSE_PATH:e&&e.closePath()}})}renderChildren(e){this.setTextData(e),e.save();var t=this.parent.getStyle("text-decoration").getString(),A=this.getFontSize(),{glyphInfo:r}=this,n=e.fillStyle;"underline"===t&&e.beginPath(),r.forEach((r,n)=>{var{p0:s,p1:i,rotation:o,text:a}=r;e.save(),e.translate(s.x,s.y),e.rotate(o),e.fillStyle&&e.fillText(a,0,0),e.strokeStyle&&e.strokeText(a,0,0),e.restore(),"underline"===t&&(0===n&&e.moveTo(s.x,s.y+A/8),e.lineTo(i.x,i.y+A/5))}),"underline"===t&&(e.lineWidth=A/20,e.strokeStyle=n,e.stroke(),e.closePath()),e.restore()}getLetterSpacingAt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.letterSpacingCache[e]||0}findSegmentToFitChar(e,t,A,r,n,s,i,o,a){var l=s,c=this.measureText(e,o);" "===o&&"justify"===t&&A-1&&(l+=this.getLetterSpacingAt(a));var u=this.textHeight/20,h=this.getEquidistantPointOnPath(l,u,0),d=this.getEquidistantPointOnPath(l+c,u,0),f={p0:h,p1:d},p=h&&d?Math.atan2(d.y-h.y,d.x-h.x):0;if(i){var g=Math.cos(Math.PI/2+p)*i,m=Math.cos(-p)*i;f.p0=Me(Me({},h),{},{x:h.x+g,y:h.y+m}),f.p1=Me(Me({},d),{},{x:d.x+g,y:d.y+m})}return{offset:l+=c,segment:f,rotation:p}}measureText(e,t){var{measuresCache:A}=this,r=t||this.getText();if(A.has(r))return A.get(r);var n=this.measureTargetText(e,r);return A.set(r,n),n}setTextData(e){if(!this.glyphInfo){var t=this.getText(),A=t.split(""),r=t.split(" ").length-1,n=this.parent.getAttribute("dx").split().map(e=>e.getPixels("x")),s=this.parent.getAttribute("dy").getPixels("y"),i=this.parent.getStyle("text-anchor").getString("start"),o=this.getStyle("letter-spacing"),a=this.parent.getStyle("letter-spacing"),l=0;o.hasValue()&&"inherit"!==o.getValue()?o.hasValue()&&"initial"!==o.getValue()&&"unset"!==o.getValue()&&(l=o.getPixels()):l=a.getPixels();var c=[],u=t.length;this.letterSpacingCache=c;for(var h=0;h0===A?0:e+t||0,0),f=this.measureText(e),p=Math.max(f+d,0);this.textWidth=f,this.textHeight=this.getFontSize(),this.glyphInfo=[];var g=this.getPathLength(),m=this.getStyle("startOffset").getNumber(0)*g,w=0;"middle"!==i&&"center"!==i||(w=-p/2),"end"!==i&&"right"!==i||(w=-p),w+=m,A.forEach((t,n)=>{var{offset:o,segment:a,rotation:l}=this.findSegmentToFitChar(e,i,p,g,r,w,s,t,n);w=o,a.p0&&a.p1&&this.glyphInfo.push({text:A[n],p0:a.p0,p1:a.p1,rotation:l})})}}parsePathData(e){if(this.pathLength=-1,!e)return[];var t=[],{pathParser:A}=e;for(A.reset();!A.isEnd();){var{current:r}=A,n=r?r.x:0,s=r?r.y:0,i=A.next(),o=i.type,a=[];switch(i.type){case le.MOVE_TO:this.pathM(A,a);break;case le.LINE_TO:o=this.pathL(A,a);break;case le.HORIZ_LINE_TO:o=this.pathH(A,a);break;case le.VERT_LINE_TO:o=this.pathV(A,a);break;case le.CURVE_TO:this.pathC(A,a);break;case le.SMOOTH_CURVE_TO:o=this.pathS(A,a);break;case le.QUAD_TO:this.pathQ(A,a);break;case le.SMOOTH_QUAD_TO:o=this.pathT(A,a);break;case le.ARC:a=this.pathA(A);break;case le.CLOSE_PATH:ue.pathZ(A)}i.type!==le.CLOSE_PATH?t.push({type:o,points:a,start:{x:n,y:s},pathLength:this.calcLength(n,s,o,a)}):t.push({type:le.CLOSE_PATH,points:[],pathLength:0})}return t}pathM(e,t){var{x:A,y:r}=ue.pathM(e).point;t.push(A,r)}pathL(e,t){var{x:A,y:r}=ue.pathL(e).point;return t.push(A,r),le.LINE_TO}pathH(e,t){var{x:A,y:r}=ue.pathH(e).point;return t.push(A,r),le.LINE_TO}pathV(e,t){var{x:A,y:r}=ue.pathV(e).point;return t.push(A,r),le.LINE_TO}pathC(e,t){var{point:A,controlPoint:r,currentPoint:n}=ue.pathC(e);t.push(A.x,A.y,r.x,r.y,n.x,n.y)}pathS(e,t){var{point:A,controlPoint:r,currentPoint:n}=ue.pathS(e);return t.push(A.x,A.y,r.x,r.y,n.x,n.y),le.CURVE_TO}pathQ(e,t){var{controlPoint:A,currentPoint:r}=ue.pathQ(e);t.push(A.x,A.y,r.x,r.y)}pathT(e,t){var{controlPoint:A,currentPoint:r}=ue.pathT(e);return t.push(A.x,A.y,r.x,r.y),le.QUAD_TO}pathA(e){var{rX:t,rY:A,sweepFlag:r,xAxisRotation:n,centp:s,a1:i,ad:o}=ue.pathA(e);return 0===r&&o>0&&(o-=2*Math.PI),1===r&&o<0&&(o+=2*Math.PI),[s.x,s.y,t,A,i,o,n,r]}calcLength(e,t,A,r){var n=0,s=null,i=null,o=0;switch(A){case le.LINE_TO:return this.getLineLength(e,t,r[0],r[1]);case le.CURVE_TO:for(n=0,s=this.getPointOnCubicBezier(0,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),o=.01;o<=1;o+=.01)i=this.getPointOnCubicBezier(o,e,t,r[0],r[1],r[2],r[3],r[4],r[5]),n+=this.getLineLength(s.x,s.y,i.x,i.y),s=i;return n;case le.QUAD_TO:for(n=0,s=this.getPointOnQuadraticBezier(0,e,t,r[0],r[1],r[2],r[3]),o=.01;o<=1;o+=.01)i=this.getPointOnQuadraticBezier(o,e,t,r[0],r[1],r[2],r[3]),n+=this.getLineLength(s.x,s.y,i.x,i.y),s=i;return n;case le.ARC:n=0;var a=r[4],l=r[5],c=r[4]+l,u=Math.PI/180;if(Math.abs(a-c)c;o-=u)i=this.getPointOnEllipticalArc(r[0],r[1],r[2],r[3],o,0),n+=this.getLineLength(s.x,s.y,i.x,i.y),s=i;else for(o=a+u;o5&&void 0!==arguments[5]?arguments[5]:t,i=arguments.length>6&&void 0!==arguments[6]?arguments[6]:A,o=(n-A)/(r-t+F),a=Math.sqrt(e*e/(1+o*o));rt)return null;var{dataArray:n}=this;for(var s of n){if(!s||!(s.pathLength<5e-5||A+s.pathLength+5e-5=0&&o>c)break;r=this.getPointOnEllipticalArc(s.points[0],s.points[1],s.points[2],s.points[3],o,s.points[6]);break;case le.CURVE_TO:(o=i/s.pathLength)>1&&(o=1),r=this.getPointOnCubicBezier(o,s.start.x,s.start.y,s.points[0],s.points[1],s.points[2],s.points[3],s.points[4],s.points[5]);break;case le.QUAD_TO:(o=i/s.pathLength)>1&&(o=1),r=this.getPointOnQuadraticBezier(o,s.start.x,s.start.y,s.points[0],s.points[1],s.points[2],s.points[3])}if(r)return r;break}A+=s.pathLength}return null}getLineLength(e,t,A,r){return Math.sqrt((A-e)*(A-e)+(r-t)*(r-t))}getPathLength(){return-1===this.pathLength&&(this.pathLength=this.dataArray.reduce((e,t)=>t.pathLength>0?e+t.pathLength:e,0)),this.pathLength}getPointOnCubicBezier(e,t,A,r,n,s,i,o,a){return{x:o*S(e)+s*L(e)+r*I(e)+t*N(e),y:a*S(e)+i*L(e)+n*I(e)+A*N(e)}}getPointOnQuadraticBezier(e,t,A,r,n,s,i){return{x:s*k(e)+r*H(e)+t*P(e),y:i*k(e)+n*H(e)+A*P(e)}}getPointOnEllipticalArc(e,t,A,r,n,s){var i=Math.cos(s),o=Math.sin(s),a=A*Math.cos(n),l=r*Math.sin(n);return{x:e+(a*i-l*o),y:t+(a*o+l*i)}}buildEquidistantCache(e,t){var A=this.getPathLength(),r=t||.25,n=e||A/100;if(!this.equidistantCache||this.equidistantCache.step!==n||this.equidistantCache.precision!==r){this.equidistantCache={step:n,precision:r,points:[]};for(var s=0,i=0;i<=A;i+=r){var o=this.getPointOnPath(i),a=this.getPointOnPath(i+r);o&&a&&(s+=this.getLineLength(o.x,o.y,a.x,a.y))>=n&&(this.equidistantCache.points.push({x:o.x,y:o.y,distance:i}),s-=n)}}}getEquidistantPointOnPath(e,t,A){if(this.buildEquidistantCache(t,A),e<0||e-this.getPathLength()>5e-5)return null;var r=Math.round(e/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[r]||null}}var Re=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class Ke extends ce{constructor(e,t,A){super(e,t,A),this.type="image",this.loaded=!1;var r=this.getHrefAttribute().getString();if(r){var n=r.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(r);e.images.push(this),n?this.loadSvg(r):this.loadImage(r),this.isSvg=n}}loadImage(e){var t=this;return(0,r.default)(function*(){try{var A=yield t.document.createImage(e);t.image=A}catch(t){console.error('Error while loading image "'.concat(e,'":'),t)}t.loaded=!0})()}loadSvg(e){var t=this;return(0,r.default)(function*(){var A=Re.exec(e);if(A){var r=A[5];"base64"===A[4]?t.image=atob(r):t.image=decodeURIComponent(r)}else try{var n=yield t.document.fetch(e),s=yield n.text();t.image=s}catch(t){console.error('Error while loading image "'.concat(e,'":'),t)}t.loaded=!0})()}renderChildren(e){var{document:t,image:A,loaded:r}=this,n=this.getAttribute("x").getPixels("x"),s=this.getAttribute("y").getPixels("y"),i=this.getStyle("width").getPixels("x"),o=this.getStyle("height").getPixels("y");if(r&&A&&i&&o){if(e.save(),e.translate(n,s),this.isSvg){var a=t.canvg.forkString(e,this.image,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:i,scaleHeight:o});a.document.documentElement.parent=this,a.render()}else{var l=this.image;t.setViewBox({ctx:e,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:i,desiredWidth:l.width,height:o,desiredHeight:l.height}),this.loaded&&(void 0===l.complete||l.complete)&&e.drawImage(l,0,0)}e.restore()}}getBoundingBox(){var e=this.getAttribute("x").getPixels("x"),t=this.getAttribute("y").getPixels("y"),A=this.getStyle("width").getPixels("x"),r=this.getStyle("height").getPixels("y");return new ae(e,t,e+A,t+r)}}class Ve extends ce{constructor(){super(...arguments),this.type="symbol"}render(e){}}class Ge{constructor(e){this.document=e,this.loaded=!1,e.fonts.push(this)}load(e,t){var A=this;return(0,r.default)(function*(){try{var{document:r}=A,n=(yield r.canvg.parser.load(t)).getElementsByTagName("font");Array.from(n).forEach(t=>{var A=r.createElement(t);r.definitions[e]=A})}catch(e){console.error('Error while loading font "'.concat(t,'":'),e)}A.loaded=!0})()}}class ze extends Ae{constructor(e,t,A){super(e,t,A),this.type="style",c(Array.from(t.childNodes).map(e=>e.textContent).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach(t=>{var A=t.trim();if(A){var r=A.split("{"),n=r[0].split(","),s=r[1].split(";");n.forEach(t=>{var A=t.trim();if(A){var r=e.styles[A]||{};if(s.forEach(t=>{var A=t.indexOf(":"),n=t.substr(0,A).trim(),s=t.substr(A+1,t.length-A).trim();n&&s&&(r[n]=new T(e,n,s))}),e.styles[A]=r,e.stylesSpecificity[A]=x(A),"@font-face"===A){var n=r["font-family"].getString().replace(/"|'/g,"");r.src.getString().split(",").forEach(t=>{if(t.indexOf('format("svg")')>0){var A=g(t);A&&new Ge(e).load(n,A)}})}}})}})}}ze.parseExternalUrl=g;class qe extends ce{constructor(){super(...arguments),this.type="use"}setContext(e){super.setContext(e);var t=this.getAttribute("x"),A=this.getAttribute("y");t.hasValue()&&e.translate(t.getPixels("x"),0),A.hasValue()&&e.translate(0,A.getPixels("y"))}path(e){var{element:t}=this;t&&t.path(e)}renderChildren(e){var{document:t,element:A}=this;if(A){var r=A;if("symbol"===A.type&&((r=new ge(t,null)).attributes.viewBox=new T(t,"viewBox",A.getAttribute("viewBox").getString()),r.attributes.preserveAspectRatio=new T(t,"preserveAspectRatio",A.getAttribute("preserveAspectRatio").getString()),r.attributes.overflow=new T(t,"overflow",A.getAttribute("overflow").getString()),r.children=A.children,A.styles.opacity=new T(t,"opacity",this.calculateOpacity())),"svg"===r.type){var n=this.getStyle("width",!1,!0),s=this.getStyle("height",!1,!0);n.hasValue()&&(r.attributes.width=new T(t,"width",n.getString())),s.hasValue()&&(r.attributes.height=new T(t,"height",s.getString()))}var i=r.parent;r.parent=this,r.render(e),r.parent=i}}getBoundingBox(e){var{element:t}=this;return t?t.getBoundingBox(e):null}elementTransform(){var{document:e,element:t}=this;return te.fromElement(e,t)}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}}function We(e,t,A,r,n,s){return e[A*r*4+4*t+s]}function Xe(e,t,A,r,n,s,i){e[A*r*4+4*t+s]=i}function Ye(e,t,A){return e[t]*A}function Je(e,t,A,r){return t+Math.cos(e)*A+Math.sin(e)*r}class Ze extends Ae{constructor(e,t,A){super(e,t,A),this.type="feColorMatrix";var r=d(this.getAttribute("values").getString());switch(this.getAttribute("type").getString("matrix")){case"saturate":var n=r[0];r=[.213+.787*n,.715-.715*n,.072-.072*n,0,0,.213-.213*n,.715+.285*n,.072-.072*n,0,0,.213-.213*n,.715-.715*n,.072+.928*n,0,0,0,0,0,1,0,0,0,0,0,1];break;case"hueRotate":var s=r[0]*Math.PI/180;r=[Je(s,.213,.787,-.213),Je(s,.715,-.715,-.715),Je(s,.072,-.072,.928),0,0,Je(s,.213,-.213,.143),Je(s,.715,.285,.14),Je(s,.072,-.072,-.283),0,0,Je(s,.213,-.213,-.787),Je(s,.715,-.715,.715),Je(s,.072,.928,.072),0,0,0,0,0,1,0,0,0,0,0,1];break;case"luminanceToAlpha":r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0,0,0,0,0,0,1]}this.matrix=r,this.includeOpacity=this.getAttribute("includeOpacity").hasValue()}apply(e,t,A,r,n){for(var{includeOpacity:s,matrix:i}=this,o=e.getImageData(0,0,r,n),a=0;a{o.addBoundingBox(t.getBoundingBox(e))}),r=Math.floor(o.x1),n=Math.floor(o.y1),s=Math.floor(o.width),i=Math.floor(o.height)}var a=this.removeStyles(t,$e.ignoreStyles),l=A.createCanvas(r+s,n+i),c=l.getContext("2d");A.screen.setDefaults(c),this.renderChildren(c),new Ze(A,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(c,0,0,r+s,n+i);var u=A.createCanvas(r+s,n+i),h=u.getContext("2d");A.screen.setDefaults(h),t.render(h),h.globalCompositeOperation="destination-in",h.fillStyle=c.createPattern(l,"no-repeat"),h.fillRect(0,0,r+s,n+i),e.fillStyle=h.createPattern(u,"no-repeat"),e.fillRect(0,0,r+s,n+i),this.restoreStyles(t,a)}render(e){}}$e.ignoreStyles=["mask","transform","clip-path"];var et=()=>{};class tt extends Ae{constructor(){super(...arguments),this.type="clipPath"}apply(e){var{document:t}=this,A=Reflect.getPrototypeOf(e),{beginPath:r,closePath:n}=e;A&&(A.beginPath=et,A.closePath=et),Reflect.apply(r,e,[]),this.children.forEach(r=>{if(void 0!==r.path){var s=void 0!==r.elementTransform?r.elementTransform():null;s||(s=te.fromElement(t,r)),s&&s.apply(e),r.path(e),A&&(A.closePath=n),s&&s.unapply(e)}}),Reflect.apply(n,e,[]),e.clip(),A&&(A.beginPath=r,A.closePath=n)}render(e){}}class At extends Ae{constructor(){super(...arguments),this.type="filter"}apply(e,t){var{document:A,children:r}=this,n=t.getBoundingBox(e);if(n){var s=0,i=0;r.forEach(e=>{var t=e.extraFilterDistance||0;s=Math.max(s,t),i=Math.max(i,t)});var o=Math.floor(n.width),a=Math.floor(n.height),l=o+2*s,c=a+2*i;if(!(l<1||c<1)){var u=Math.floor(n.x),h=Math.floor(n.y),d=this.removeStyles(t,At.ignoreStyles),f=A.createCanvas(l,c),p=f.getContext("2d");A.screen.setDefaults(p),p.translate(-u+s,-h+i),t.render(p),r.forEach(e=>{"function"==typeof e.apply&&e.apply(p,0,0,l,c)}),e.drawImage(f,0,0,l,c,u-s,h-i,l,c),this.restoreStyles(t,d)}}}render(e){}}At.ignoreStyles=["filter","transform","clip-path"];class rt extends Ae{constructor(e,t,A){super(e,t,A),this.type="feDropShadow",this.addStylesFromStyleDefinition()}apply(e,t,A,r,n){}}class nt extends Ae{constructor(){super(...arguments),this.type="feMorphology"}apply(e,t,A,r,n){}}class st extends Ae{constructor(){super(...arguments),this.type="feComposite"}apply(e,t,A,r,n){}}class it extends Ae{constructor(e,t,A){super(e,t,A),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}apply(e,t,A,r,n){var{document:s,blurRadius:i}=this,o=s.window?s.window.document.body:null,l=e.canvas;l.id=s.getUniqueId(),o&&(l.style.display="none",o.appendChild(l)),(0,a.canvasRGBA)(l,t,A,r,n,i),o&&o.removeChild(l)}}class ot extends Ae{constructor(){super(...arguments),this.type="title"}}class at extends Ae{constructor(){super(...arguments),this.type="desc"}}var lt={svg:ge,rect:me,circle:we,ellipse:Be,line:ye,polyline:ve,polygon:be,path:ue,pattern:Ce,marker:_e,defs:je,linearGradient:Qe,radialGradient:Ue,stop:Ee,animate:Se,animateColor:Le,animateTransform:Ie,font:Ne,"font-face":ke,"missing-glyph":He,glyph:he,text:de,tspan:fe,tref:Pe,a:Te,textPath:De,image:Ke,g:xe,symbol:Ve,style:ze,use:qe,mask:$e,clipPath:tt,filter:At,feDropShadow:rt,feMorphology:nt,feComposite:st,feColorMatrix:Ze,feGaussianBlur:it,title:ot,desc:at};function ct(e,t){var A=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),A.push.apply(A,r)}return A}function ut(){return ut=(0,r.default)(function*(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],A=document.createElement("img");return t&&(A.crossOrigin="Anonymous"),new Promise((t,r)=>{A.onload=()=>{t(A)},A.onerror=(e,t,A,n,s)=>{r(s)},A.src=e})}),ut.apply(this,arguments)}class ht{constructor(e){var{rootEmSize:t=12,emSize:A=12,createCanvas:r=ht.createCanvas,createImage:n=ht.createImage,anonymousCrossOrigin:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.canvg=e,this.definitions=Object.create(null),this.styles=Object.create(null),this.stylesSpecificity=Object.create(null),this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=e.screen,this.rootEmSize=t,this.emSize=A,this.createCanvas=r,this.createImage=this.bindCreateImage(n,s),this.screen.wait(this.isImagesLoaded.bind(this)),this.screen.wait(this.isFontsLoaded.bind(this))}bindCreateImage(e,t){return"boolean"==typeof t?(A,r)=>e(A,"boolean"==typeof r?r:t):e}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){var{emSizeStack:e}=this;return e[e.length-1]}set emSize(e){var{emSizeStack:t}=this;t.push(e)}popEmSize(){var{emSizeStack:e}=this;e.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every(e=>e.loaded)}isFontsLoaded(){return this.fonts.every(e=>e.loaded)}createDocumentElement(e){var t=this.createElement(e.documentElement);return t.root=!0,t.addStylesFromStyleDefinition(),this.documentElement=t,t}createElement(e){var t=e.nodeName.replace(/^[^:]+:/,""),A=ht.elementTypes[t];return void 0!==A?new A(this,e):new re(this,e)}createTextNode(e){return new pe(this,e)}setViewBox(e){this.screen.setViewBox(function(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{};this.parser=new q(A),this.screen=new V(e,A),this.options=A;var r=new ht(this,A),n=r.createDocumentElement(t);this.document=r,this.documentElement=n}static from(e,t){var A=arguments;return(0,r.default)(function*(){var r=A.length>2&&void 0!==A[2]?A[2]:{},n=new q(r),s=yield n.parse(t);return new pt(e,s,r)})()}static fromString(e,t){var A=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=new q(A).parseFromString(t);return new pt(e,r,A)}fork(e,t){var A=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return pt.from(e,t,ft(ft({},this.options),A))}forkString(e,t){var A=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return pt.fromString(e,t,ft(ft({},this.options),A))}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}render(){var e=arguments,t=this;return(0,r.default)(function*(){var A=e.length>0&&void 0!==e[0]?e[0]:{};t.start(ft({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0},A)),yield t.ready(),t.stop()})()}start(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{documentElement:t,screen:A,options:r}=this;A.start(t,ft(ft({enableRedraw:!0},r),e))}stop(){this.screen.stop()}resize(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,A=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.documentElement.resize(e,t,A)}}},"./node_modules/core-js/internals/a-callable.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/is-callable.js"),n=A("./node_modules/core-js/internals/try-to-string.js"),s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(n(e)+" is not a function")}},"./node_modules/core-js/internals/a-constructor.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/is-constructor.js"),n=A("./node_modules/core-js/internals/try-to-string.js"),s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(n(e)+" is not a constructor")}},"./node_modules/core-js/internals/a-possible-prototype.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/is-possible-prototype.js"),n=String,s=TypeError;e.exports=function(e){if(r(e))return e;throw new s("Can't set "+n(e)+" as a prototype")}},"./node_modules/core-js/internals/a-set.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/set-helpers.js").has;e.exports=function(e){return r(e),e}},"./node_modules/core-js/internals/add-to-unscopables.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/well-known-symbol.js"),n=A("./node_modules/core-js/internals/object-create.js"),s=A("./node_modules/core-js/internals/object-define-property.js").f,i=r("unscopables"),o=Array.prototype;void 0===o[i]&&s(o,i,{configurable:!0,value:n(null)}),e.exports=function(e){o[i][e]=!0}},"./node_modules/core-js/internals/advance-string-index.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/string-multibyte.js").charAt;e.exports=function(e,t,A){return t+(A?r(e,t).length:1)}},"./node_modules/core-js/internals/an-instance.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/object-is-prototype-of.js"),n=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new n("Incorrect invocation")}},"./node_modules/core-js/internals/an-object.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/is-object.js"),n=String,s=TypeError;e.exports=function(e){if(r(e))return e;throw new s(n(e)+" is not an object")}},"./node_modules/core-js/internals/array-buffer-non-extensible.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/fails.js");e.exports=r(function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})},"./node_modules/core-js/internals/array-for-each.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/array-iteration.js").forEach,n=A("./node_modules/core-js/internals/array-method-is-strict.js")("forEach");e.exports=n?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},"./node_modules/core-js/internals/array-from.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-bind-context.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/to-object.js"),i=A("./node_modules/core-js/internals/call-with-safe-iteration-closing.js"),o=A("./node_modules/core-js/internals/is-array-iterator-method.js"),a=A("./node_modules/core-js/internals/is-constructor.js"),l=A("./node_modules/core-js/internals/length-of-array-like.js"),c=A("./node_modules/core-js/internals/create-property.js"),u=A("./node_modules/core-js/internals/get-iterator.js"),h=A("./node_modules/core-js/internals/get-iterator-method.js"),d=Array;e.exports=function(e){var t=s(e),A=a(this),f=arguments.length,p=f>1?arguments[1]:void 0,g=void 0!==p;g&&(p=r(p,f>2?arguments[2]:void 0));var m,w,B,y,v,b,C=h(t),_=0;if(!C||this===d&&o(C))for(m=l(t),w=A?new this(m):d(m);m>_;_++)b=g?p(t[_],_):t[_],c(w,_,b);else for(w=A?new this:[],v=(y=u(t,C)).next;!(B=n(v,y)).done;_++)b=g?i(y,p,[B.value,_],!0):B.value,c(w,_,b);return w.length=_,w}},"./node_modules/core-js/internals/array-includes.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/to-indexed-object.js"),n=A("./node_modules/core-js/internals/to-absolute-index.js"),s=A("./node_modules/core-js/internals/length-of-array-like.js"),i=function(e){return function(t,A,i){var o=r(t),a=s(o);if(0===a)return!e&&-1;var l,c=n(i,a);if(e&&A!=A){for(;a>c;)if((l=o[c++])!=l)return!0}else for(;a>c;c++)if((e||c in o)&&o[c]===A)return e||c||0;return!e&&-1}};e.exports={includes:i(!0),indexOf:i(!1)}},"./node_modules/core-js/internals/array-iteration.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-bind-context.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/indexed-object.js"),i=A("./node_modules/core-js/internals/to-object.js"),o=A("./node_modules/core-js/internals/length-of-array-like.js"),a=A("./node_modules/core-js/internals/array-species-create.js"),l=n([].push),c=function(e){var t=1===e,A=2===e,n=3===e,c=4===e,u=6===e,h=7===e,d=5===e||u;return function(f,p,g,m){for(var w,B,y=i(f),v=s(y),b=o(v),C=r(p,g),_=0,j=m||a,x=t?j(f,b):A||h?j(f,0):void 0;b>_;_++)if((d||_ in v)&&(B=C(w=v[_],_,y),e))if(t)x[_]=B;else if(B)switch(e){case 3:return!0;case 5:return w;case 6:return _;case 2:l(x,w)}else switch(e){case 4:return!1;case 7:l(x,w)}return u?-1:n||c?c:x}};e.exports={forEach:c(0),map:c(1),filter:c(2),some:c(3),every:c(4),find:c(5),findIndex:c(6),filterReject:c(7)}},"./node_modules/core-js/internals/array-method-has-species-support.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/fails.js"),n=A("./node_modules/core-js/internals/well-known-symbol.js"),s=A("./node_modules/core-js/internals/environment-v8-version.js"),i=n("species");e.exports=function(e){return s>=51||!r(function(){var t=[];return(t.constructor={})[i]=function(){return{foo:1}},1!==t[e](Boolean).foo})}},"./node_modules/core-js/internals/array-method-is-strict.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/fails.js");e.exports=function(e,t){var A=[][e];return!!A&&r(function(){A.call(null,t||function(){return 1},1)})}},"./node_modules/core-js/internals/array-reduce.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/a-callable.js"),n=A("./node_modules/core-js/internals/to-object.js"),s=A("./node_modules/core-js/internals/indexed-object.js"),i=A("./node_modules/core-js/internals/length-of-array-like.js"),o=TypeError,a="Reduce of empty array with no initial value",l=function(e){return function(t,A,l,c){var u=n(t),h=s(u),d=i(u);if(r(A),0===d&&l<2)throw new o(a);var f=e?d-1:0,p=e?-1:1;if(l<2)for(;;){if(f in h){c=h[f],f+=p;break}if(f+=p,e?f<0:d<=f)throw new o(a)}for(;e?f>=0:d>f;f+=p)f in h&&(c=A(c,h[f],f,u));return c}};e.exports={left:l(!1),right:l(!0)}},"./node_modules/core-js/internals/array-slice.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js");e.exports=r([].slice)},"./node_modules/core-js/internals/array-species-constructor.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/is-array.js"),n=A("./node_modules/core-js/internals/is-constructor.js"),s=A("./node_modules/core-js/internals/is-object.js"),i=A("./node_modules/core-js/internals/well-known-symbol.js")("species"),o=Array;e.exports=function(e){var t;return r(e)&&(t=e.constructor,(n(t)&&(t===o||r(t.prototype))||s(t)&&null===(t=t[i]))&&(t=void 0)),void 0===t?o:t}},"./node_modules/core-js/internals/array-species-create.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/array-species-constructor.js");e.exports=function(e,t){return new(r(e))(0===t?0:t)}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/an-object.js"),n=A("./node_modules/core-js/internals/iterator-close.js");e.exports=function(e,t,A,s){try{return s?t(r(A)[0],A[1]):t(A)}catch(t){n(e,"throw",t)}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/well-known-symbol.js")("iterator"),n=!1;try{var s=0,i={next:function(){return{done:!!s++}},return:function(){n=!0}};i[r]=function(){return this},Array.from(i,function(){throw 2})}catch(e){}e.exports=function(e,t){try{if(!t&&!n)return!1}catch(e){return!1}var A=!1;try{var s={};s[r]=function(){return{next:function(){return{done:A=!0}}}},e(s)}catch(e){}return A}},"./node_modules/core-js/internals/classof-raw.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=r({}.toString),s=r("".slice);e.exports=function(e){return s(n(e),8,-1)}},"./node_modules/core-js/internals/classof.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/to-string-tag-support.js"),n=A("./node_modules/core-js/internals/is-callable.js"),s=A("./node_modules/core-js/internals/classof-raw.js"),i=A("./node_modules/core-js/internals/well-known-symbol.js")("toStringTag"),o=Object,a="Arguments"===s(function(){return arguments}());e.exports=r?s:function(e){var t,A,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(A=function(e,t){try{return e[t]}catch(e){}}(t=o(e),i))?A:a?s(t):"Object"===(r=s(t))&&n(t.callee)?"Arguments":r}},"./node_modules/core-js/internals/collection-strong.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/object-create.js"),n=A("./node_modules/core-js/internals/define-built-in-accessor.js"),s=A("./node_modules/core-js/internals/define-built-ins.js"),i=A("./node_modules/core-js/internals/function-bind-context.js"),o=A("./node_modules/core-js/internals/an-instance.js"),a=A("./node_modules/core-js/internals/is-null-or-undefined.js"),l=A("./node_modules/core-js/internals/iterate.js"),c=A("./node_modules/core-js/internals/iterator-define.js"),u=A("./node_modules/core-js/internals/create-iter-result-object.js"),h=A("./node_modules/core-js/internals/set-species.js"),d=A("./node_modules/core-js/internals/descriptors.js"),f=A("./node_modules/core-js/internals/internal-metadata.js").fastKey,p=A("./node_modules/core-js/internals/internal-state.js"),g=p.set,m=p.getterFor;e.exports={getConstructor:function(e,t,A,c){var u=e(function(e,n){o(e,h),g(e,{type:t,index:r(null),first:null,last:null,size:0}),d||(e.size=0),a(n)||l(n,e[c],{that:e,AS_ENTRIES:A})}),h=u.prototype,p=m(t),w=function(e,t,A){var r,n,s=p(e),i=B(e,t);return i?i.value=A:(s.last=i={index:n=f(t,!0),key:t,value:A,previous:r=s.last,next:null,removed:!1},s.first||(s.first=i),r&&(r.next=i),d?s.size++:e.size++,"F"!==n&&(s.index[n]=i)),e},B=function(e,t){var A,r=p(e),n=f(t);if("F"!==n)return r.index[n];for(A=r.first;A;A=A.next)if(A.key===t)return A};return s(h,{clear:function(){for(var e=p(this),t=e.first;t;)t.removed=!0,t.previous&&(t.previous=t.previous.next=null),t=t.next;e.first=e.last=null,e.index=r(null),d?e.size=0:this.size=0},delete:function(e){var t=this,A=p(t),r=B(t,e);if(r){var n=r.next,s=r.previous;delete A.index[r.index],r.removed=!0,s&&(s.next=n),n&&(n.previous=s),A.first===r&&(A.first=n),A.last===r&&(A.last=s),d?A.size--:t.size--}return!!r},forEach:function(e){for(var t,A=p(this),r=i(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:A.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!B(this,e)}}),s(h,A?{get:function(e){var t=B(this,e);return t&&t.value},set:function(e,t){return w(this,0===e?0:e,t)}}:{add:function(e){return w(this,e=0===e?0:e,e)}}),d&&n(h,"size",{configurable:!0,get:function(){return p(this).size}}),u},setStrong:function(e,t,A){var r=t+" Iterator",n=m(t),s=m(r);c(e,t,function(e,t){g(this,{type:r,target:e,state:n(e),kind:t,last:null})},function(){for(var e=s(this),t=e.kind,A=e.last;A&&A.removed;)A=A.previous;return e.target&&(e.last=A=A?A.next:e.state.first)?u("keys"===t?A.key:"values"===t?A.value:[A.key,A.value],!1):(e.target=null,u(void 0,!0))},A?"entries":"values",!A,!0),h(t)}}},"./node_modules/core-js/internals/collection.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/global-this.js"),s=A("./node_modules/core-js/internals/function-uncurry-this.js"),i=A("./node_modules/core-js/internals/is-forced.js"),o=A("./node_modules/core-js/internals/define-built-in.js"),a=A("./node_modules/core-js/internals/internal-metadata.js"),l=A("./node_modules/core-js/internals/iterate.js"),c=A("./node_modules/core-js/internals/an-instance.js"),u=A("./node_modules/core-js/internals/is-callable.js"),h=A("./node_modules/core-js/internals/is-null-or-undefined.js"),d=A("./node_modules/core-js/internals/is-object.js"),f=A("./node_modules/core-js/internals/fails.js"),p=A("./node_modules/core-js/internals/check-correctness-of-iteration.js"),g=A("./node_modules/core-js/internals/set-to-string-tag.js"),m=A("./node_modules/core-js/internals/inherit-if-required.js");e.exports=function(e,t,A){var w=-1!==e.indexOf("Map"),B=-1!==e.indexOf("Weak"),y=w?"set":"add",v=n[e],b=v&&v.prototype,C=v,_={},j=function(e){var t=s(b[e]);o(b,e,"add"===e?function(e){return t(this,0===e?0:e),this}:"delete"===e?function(e){return!(B&&!d(e))&&t(this,0===e?0:e)}:"get"===e?function(e){return B&&!d(e)?void 0:t(this,0===e?0:e)}:"has"===e?function(e){return!(B&&!d(e))&&t(this,0===e?0:e)}:function(e,A){return t(this,0===e?0:e,A),this})};if(i(e,!u(v)||!(B||b.forEach&&!f(function(){(new v).entries().next()}))))C=A.getConstructor(t,e,w,y),a.enable();else if(i(e,!0)){var x=new C,F=x[y](B?{}:-0,1)!==x,Q=f(function(){x.has(1)}),U=p(function(e){new v(e)}),E=!B&&f(function(){for(var e=new v,t=5;t--;)e[y](t,t);return!e.has(-0)});U||((C=t(function(e,t){c(e,b);var A=m(new v,e,C);return h(t)||l(t,A[y],{that:A,AS_ENTRIES:w}),A})).prototype=b,b.constructor=C),(Q||E)&&(j("delete"),j("has"),w&&j("get")),(E||F)&&j(y),B&&b.clear&&delete b.clear}return _[e]=C,r({global:!0,constructor:!0,forced:C!==v},_),g(C,e),B||A.setStrong(C,e,w),C}},"./node_modules/core-js/internals/copy-constructor-properties.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/has-own-property.js"),n=A("./node_modules/core-js/internals/own-keys.js"),s=A("./node_modules/core-js/internals/object-get-own-property-descriptor.js"),i=A("./node_modules/core-js/internals/object-define-property.js");e.exports=function(e,t,A){for(var o=n(t),a=i.f,l=s.f,c=0;c"+a+""}},"./node_modules/core-js/internals/create-iter-result-object.js":function(e){"use strict";e.exports=function(e,t){return{value:e,done:t}}},"./node_modules/core-js/internals/create-non-enumerable-property.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/descriptors.js"),n=A("./node_modules/core-js/internals/object-define-property.js"),s=A("./node_modules/core-js/internals/create-property-descriptor.js");e.exports=r?function(e,t,A){return n.f(e,t,s(1,A))}:function(e,t,A){return e[t]=A,e}},"./node_modules/core-js/internals/create-property-descriptor.js":function(e){"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},"./node_modules/core-js/internals/create-property.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/descriptors.js"),n=A("./node_modules/core-js/internals/object-define-property.js"),s=A("./node_modules/core-js/internals/create-property-descriptor.js");e.exports=function(e,t,A){r?n.f(e,t,s(0,A)):e[t]=A}},"./node_modules/core-js/internals/define-built-in-accessor.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/make-built-in.js"),n=A("./node_modules/core-js/internals/object-define-property.js");e.exports=function(e,t,A){return A.get&&r(A.get,t,{getter:!0}),A.set&&r(A.set,t,{setter:!0}),n.f(e,t,A)}},"./node_modules/core-js/internals/define-built-in.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/is-callable.js"),n=A("./node_modules/core-js/internals/object-define-property.js"),s=A("./node_modules/core-js/internals/make-built-in.js"),i=A("./node_modules/core-js/internals/define-global-property.js");e.exports=function(e,t,A,o){o||(o={});var a=o.enumerable,l=void 0!==o.name?o.name:t;if(r(A)&&s(A,l,o),o.global)a?e[t]=A:i(t,A);else{try{o.unsafe?e[t]&&(a=!0):delete e[t]}catch(e){}a?e[t]=A:n.f(e,t,{value:A,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e}},"./node_modules/core-js/internals/define-built-ins.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/define-built-in.js");e.exports=function(e,t,A){for(var n in t)r(e,n,t[n],A);return e}},"./node_modules/core-js/internals/define-global-property.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js"),n=Object.defineProperty;e.exports=function(e,t){try{n(r,e,{value:t,configurable:!0,writable:!0})}catch(A){r[e]=t}return t}},"./node_modules/core-js/internals/descriptors.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/fails.js");e.exports=!r(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},"./node_modules/core-js/internals/document-create-element.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js"),n=A("./node_modules/core-js/internals/is-object.js"),s=r.document,i=n(s)&&n(s.createElement);e.exports=function(e){return i?s.createElement(e):{}}},"./node_modules/core-js/internals/does-not-exceed-safe-integer.js":function(e){"use strict";var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},"./node_modules/core-js/internals/dom-iterables.js":function(e){"use strict";e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},"./node_modules/core-js/internals/dom-token-list-prototype.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/document-create-element.js")("span").classList,n=r&&r.constructor&&r.constructor.prototype;e.exports=n===Object.prototype?void 0:n},"./node_modules/core-js/internals/enum-bug-keys.js":function(e){"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},"./node_modules/core-js/internals/environment-is-ios-pebble.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/environment-user-agent.js");e.exports=/ipad|iphone|ipod/i.test(r)&&"undefined"!=typeof Pebble},"./node_modules/core-js/internals/environment-is-ios.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/environment-user-agent.js");e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},"./node_modules/core-js/internals/environment-is-node.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/environment.js");e.exports="NODE"===r},"./node_modules/core-js/internals/environment-is-webos-webkit.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/environment-user-agent.js");e.exports=/web0s(?!.*chrome)/i.test(r)},"./node_modules/core-js/internals/environment-user-agent.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js").navigator,n=r&&r.userAgent;e.exports=n?String(n):""},"./node_modules/core-js/internals/environment-v8-version.js":function(e,t,A){"use strict";var r,n,s=A("./node_modules/core-js/internals/global-this.js"),i=A("./node_modules/core-js/internals/environment-user-agent.js"),o=s.process,a=s.Deno,l=o&&o.versions||a&&a.version,c=l&&l.v8;c&&(n=(r=c.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!n&&i&&(!(r=i.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=i.match(/Chrome\/(\d+)/))&&(n=+r[1]),e.exports=n},"./node_modules/core-js/internals/environment.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js"),n=A("./node_modules/core-js/internals/environment-user-agent.js"),s=A("./node_modules/core-js/internals/classof-raw.js"),i=function(e){return n.slice(0,e.length)===e};e.exports=i("Bun/")?"BUN":i("Cloudflare-Workers")?"CLOUDFLARE":i("Deno/")?"DENO":i("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===s(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},"./node_modules/core-js/internals/export.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js"),n=A("./node_modules/core-js/internals/object-get-own-property-descriptor.js").f,s=A("./node_modules/core-js/internals/create-non-enumerable-property.js"),i=A("./node_modules/core-js/internals/define-built-in.js"),o=A("./node_modules/core-js/internals/define-global-property.js"),a=A("./node_modules/core-js/internals/copy-constructor-properties.js"),l=A("./node_modules/core-js/internals/is-forced.js");e.exports=function(e,t){var A,c,u,h,d,f=e.target,p=e.global,g=e.stat;if(A=p?r:g?r[f]||o(f,{}):r[f]&&r[f].prototype)for(c in t){if(h=t[c],u=e.dontCallGetSet?(d=n(A,c))&&d.value:A[c],!l(p?c:f+(g?".":"#")+c,e.forced)&&void 0!==u){if(typeof h==typeof u)continue;a(h,u)}(e.sham||u&&u.sham)&&s(h,"sham",!0),i(A,c,h,e)}}},"./node_modules/core-js/internals/fails.js":function(e){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},"./node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js":function(e,t,A){"use strict";A("./node_modules/core-js/modules/es.regexp.exec.js");var r=A("./node_modules/core-js/internals/function-call.js"),n=A("./node_modules/core-js/internals/define-built-in.js"),s=A("./node_modules/core-js/internals/regexp-exec.js"),i=A("./node_modules/core-js/internals/fails.js"),o=A("./node_modules/core-js/internals/well-known-symbol.js"),a=A("./node_modules/core-js/internals/create-non-enumerable-property.js"),l=o("species"),c=RegExp.prototype;e.exports=function(e,t,A,u){var h=o(e),d=!i(function(){var t={};return t[h]=function(){return 7},7!==""[e](t)}),f=d&&!i(function(){var t=!1,A=/a/;if("split"===e){var r={};r[l]=function(){return A},(A={constructor:r,flags:""})[h]=/./[h]}return A.exec=function(){return t=!0,null},A[h](""),!t});if(!d||!f||A){var p=/./[h],g=t(h,""[e],function(e,t,A,n,i){var o=t.exec;return o===s||o===c.exec?d&&!i?{done:!0,value:r(p,t,A,n)}:{done:!0,value:r(e,A,t,n)}:{done:!1}});n(String.prototype,e,g[0]),n(c,h,g[1])}u&&a(c[h],"sham",!0)}},"./node_modules/core-js/internals/freezing.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/fails.js");e.exports=!r(function(){return Object.isExtensible(Object.preventExtensions({}))})},"./node_modules/core-js/internals/function-apply.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-bind-native.js"),n=Function.prototype,s=n.apply,i=n.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?i.bind(s):function(){return i.apply(s,arguments)})},"./node_modules/core-js/internals/function-bind-context.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this-clause.js"),n=A("./node_modules/core-js/internals/a-callable.js"),s=A("./node_modules/core-js/internals/function-bind-native.js"),i=r(r.bind);e.exports=function(e,t){return n(e),void 0===t?e:s?i(e,t):function(){return e.apply(t,arguments)}}},"./node_modules/core-js/internals/function-bind-native.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/fails.js");e.exports=!r(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},"./node_modules/core-js/internals/function-call.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-bind-native.js"),n=Function.prototype.call;e.exports=r?n.bind(n):function(){return n.apply(n,arguments)}},"./node_modules/core-js/internals/function-name.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/descriptors.js"),n=A("./node_modules/core-js/internals/has-own-property.js"),s=Function.prototype,i=r&&Object.getOwnPropertyDescriptor,o=n(s,"name"),a=o&&"something"===function(){}.name,l=o&&(!r||r&&i(s,"name").configurable);e.exports={EXISTS:o,PROPER:a,CONFIGURABLE:l}},"./node_modules/core-js/internals/function-uncurry-this-accessor.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/a-callable.js");e.exports=function(e,t,A){try{return r(n(Object.getOwnPropertyDescriptor(e,t)[A]))}catch(e){}}},"./node_modules/core-js/internals/function-uncurry-this-clause.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/classof-raw.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js");e.exports=function(e){if("Function"===r(e))return n(e)}},"./node_modules/core-js/internals/function-uncurry-this.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-bind-native.js"),n=Function.prototype,s=n.call,i=r&&n.bind.bind(s,s);e.exports=r?i:function(e){return function(){return s.apply(e,arguments)}}},"./node_modules/core-js/internals/get-built-in.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js"),n=A("./node_modules/core-js/internals/is-callable.js");e.exports=function(e,t){return arguments.length<2?(A=r[e],n(A)?A:void 0):r[e]&&r[e][t];var A}},"./node_modules/core-js/internals/get-iterator-direct.js":function(e){"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},"./node_modules/core-js/internals/get-iterator-method.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/classof.js"),n=A("./node_modules/core-js/internals/get-method.js"),s=A("./node_modules/core-js/internals/is-null-or-undefined.js"),i=A("./node_modules/core-js/internals/iterators.js"),o=A("./node_modules/core-js/internals/well-known-symbol.js")("iterator");e.exports=function(e){if(!s(e))return n(e,o)||n(e,"@@iterator")||i[r(e)]}},"./node_modules/core-js/internals/get-iterator.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-call.js"),n=A("./node_modules/core-js/internals/a-callable.js"),s=A("./node_modules/core-js/internals/an-object.js"),i=A("./node_modules/core-js/internals/try-to-string.js"),o=A("./node_modules/core-js/internals/get-iterator-method.js"),a=TypeError;e.exports=function(e,t){var A=arguments.length<2?o(e):t;if(n(A))return s(r(A,e));throw new a(i(e)+" is not iterable")}},"./node_modules/core-js/internals/get-method.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/a-callable.js"),n=A("./node_modules/core-js/internals/is-null-or-undefined.js");e.exports=function(e,t){var A=e[t];return n(A)?void 0:r(A)}},"./node_modules/core-js/internals/get-set-record.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/a-callable.js"),n=A("./node_modules/core-js/internals/an-object.js"),s=A("./node_modules/core-js/internals/function-call.js"),i=A("./node_modules/core-js/internals/to-integer-or-infinity.js"),o=A("./node_modules/core-js/internals/get-iterator-direct.js"),a="Invalid size",l=RangeError,c=TypeError,u=Math.max,h=function(e,t){this.set=e,this.size=u(t,0),this.has=r(e.has),this.keys=r(e.keys)};h.prototype={getIterator:function(){return o(n(s(this.keys,this.set)))},includes:function(e){return s(this.has,this.set,e)}},e.exports=function(e){n(e);var t=+e.size;if(t!=t)throw new c(a);var A=i(t);if(A<0)throw new l(a);return new h(e,A)}},"./node_modules/core-js/internals/get-substitution.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/to-object.js"),s=Math.floor,i=r("".charAt),o=r("".replace),a=r("".slice),l=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,c=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,A,r,u,h){var d=A+e.length,f=r.length,p=c;return void 0!==u&&(u=n(u),p=l),o(h,p,function(n,o){var l;switch(i(o,0)){case"$":return"$";case"&":return e;case"`":return a(t,0,A);case"'":return a(t,d);case"<":l=u[a(o,1,-1)];break;default:var c=+o;if(0===c)return n;if(c>f){var h=s(c/10);return 0===h?n:h<=f?void 0===r[h-1]?i(o,1):r[h-1]+i(o,1):n}l=r[c-1]}return void 0===l?"":l})}},"./node_modules/core-js/internals/global-this.js":function(e){"use strict";var t=function(e){return e&&e.Math===Math&&e};e.exports=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof global&&global)||t("object"==typeof this&&this)||function(){return this}()||Function("return this")()},"./node_modules/core-js/internals/has-own-property.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/to-object.js"),s=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return s(n(e),t)}},"./node_modules/core-js/internals/hidden-keys.js":function(e){"use strict";e.exports={}},"./node_modules/core-js/internals/host-report-errors.js":function(e){"use strict";e.exports=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}}},"./node_modules/core-js/internals/html.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/get-built-in.js");e.exports=r("document","documentElement")},"./node_modules/core-js/internals/ie8-dom-define.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/descriptors.js"),n=A("./node_modules/core-js/internals/fails.js"),s=A("./node_modules/core-js/internals/document-create-element.js");e.exports=!r&&!n(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},"./node_modules/core-js/internals/indexed-object.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/fails.js"),s=A("./node_modules/core-js/internals/classof-raw.js"),i=Object,o=r("".split);e.exports=n(function(){return!i("z").propertyIsEnumerable(0)})?function(e){return"String"===s(e)?o(e,""):i(e)}:i},"./node_modules/core-js/internals/inherit-if-required.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/is-callable.js"),n=A("./node_modules/core-js/internals/is-object.js"),s=A("./node_modules/core-js/internals/object-set-prototype-of.js");e.exports=function(e,t,A){var i,o;return s&&r(i=t.constructor)&&i!==A&&n(o=i.prototype)&&o!==A.prototype&&s(e,o),e}},"./node_modules/core-js/internals/inspect-source.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/is-callable.js"),s=A("./node_modules/core-js/internals/shared-store.js"),i=r(Function.toString);n(s.inspectSource)||(s.inspectSource=function(e){return i(e)}),e.exports=s.inspectSource},"./node_modules/core-js/internals/internal-metadata.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/hidden-keys.js"),i=A("./node_modules/core-js/internals/is-object.js"),o=A("./node_modules/core-js/internals/has-own-property.js"),a=A("./node_modules/core-js/internals/object-define-property.js").f,l=A("./node_modules/core-js/internals/object-get-own-property-names.js"),c=A("./node_modules/core-js/internals/object-get-own-property-names-external.js"),u=A("./node_modules/core-js/internals/object-is-extensible.js"),h=A("./node_modules/core-js/internals/uid.js"),d=A("./node_modules/core-js/internals/freezing.js"),f=!1,p=h("meta"),g=0,m=function(e){a(e,p,{value:{objectID:"O"+g++,weakData:{}}})},w=e.exports={enable:function(){w.enable=function(){},f=!0;var e=l.f,t=n([].splice),A={};A[p]=1,e(A).length&&(l.f=function(A){for(var r=e(A),n=0,s=r.length;nw;w++)if((y=E(e[w]))&&l(p,y))return y;return new f(!1)}g=c(e,m)}for(v=j?e.next:g.next;!(b=n(v,g)).done;){try{y=E(b.value)}catch(e){h(g,"throw",e)}if("object"==typeof y&&y&&l(p,y))return y}return new f(!1)}},"./node_modules/core-js/internals/iterator-close-all.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/iterator-close.js");e.exports=function(e,t,A){for(var n=e.length-1;n>=0;n--)if(void 0!==e[n])try{A=r(e[n].iterator,t,A)}catch(e){t="throw",A=e}if("throw"===t)throw A;return A}},"./node_modules/core-js/internals/iterator-close.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-call.js"),n=A("./node_modules/core-js/internals/an-object.js"),s=A("./node_modules/core-js/internals/get-method.js");e.exports=function(e,t,A){var i,o;n(e);try{if(!(i=s(e,"return"))){if("throw"===t)throw A;return A}i=r(i,e)}catch(e){o=!0,i=e}if("throw"===t)throw A;if(o)throw i;return n(i),A}},"./node_modules/core-js/internals/iterator-create-constructor.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/iterators-core.js").IteratorPrototype,n=A("./node_modules/core-js/internals/object-create.js"),s=A("./node_modules/core-js/internals/create-property-descriptor.js"),i=A("./node_modules/core-js/internals/set-to-string-tag.js"),o=A("./node_modules/core-js/internals/iterators.js"),a=function(){return this};e.exports=function(e,t,A,l){var c=t+" Iterator";return e.prototype=n(r,{next:s(+!l,A)}),i(e,c,!1,!0),o[c]=a,e}},"./node_modules/core-js/internals/iterator-create-proxy.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-call.js"),n=A("./node_modules/core-js/internals/object-create.js"),s=A("./node_modules/core-js/internals/create-non-enumerable-property.js"),i=A("./node_modules/core-js/internals/define-built-ins.js"),o=A("./node_modules/core-js/internals/well-known-symbol.js"),a=A("./node_modules/core-js/internals/internal-state.js"),l=A("./node_modules/core-js/internals/get-method.js"),c=A("./node_modules/core-js/internals/iterators-core.js").IteratorPrototype,u=A("./node_modules/core-js/internals/create-iter-result-object.js"),h=A("./node_modules/core-js/internals/iterator-close.js"),d=A("./node_modules/core-js/internals/iterator-close-all.js"),f=o("toStringTag"),p="IteratorHelper",g="WrapForValidIterator",m="normal",w="throw",B=a.set,y=function(e){var t=a.getterFor(e?g:p);return i(n(c),{next:function(){var A=t(this);if(e)return A.nextHandler();if(A.done)return u(void 0,!0);try{var r=A.nextHandler();return A.returnHandlerResult?r:u(r,A.done)}catch(e){throw A.done=!0,e}},return:function(){var A=t(this),n=A.iterator;if(A.done=!0,e){var s=l(n,"return");return s?r(s,n):u(void 0,!0)}if(A.inner)try{h(A.inner.iterator,m)}catch(e){return h(n,w,e)}if(A.openIters)try{d(A.openIters,m)}catch(e){return h(n,w,e)}return n&&h(n,m),u(void 0,!0)}})},v=y(!0),b=y(!1);s(b,f,"Iterator Helper"),e.exports=function(e,t,A){var r=function(r,n){n?(n.iterator=r.iterator,n.next=r.next):n=r,n.type=t?g:p,n.returnHandlerResult=!!A,n.nextHandler=e,n.counter=0,n.done=!1,B(this,n)};return r.prototype=t?v:b,r}},"./node_modules/core-js/internals/iterator-define.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/is-pure.js"),i=A("./node_modules/core-js/internals/function-name.js"),o=A("./node_modules/core-js/internals/is-callable.js"),a=A("./node_modules/core-js/internals/iterator-create-constructor.js"),l=A("./node_modules/core-js/internals/object-get-prototype-of.js"),c=A("./node_modules/core-js/internals/object-set-prototype-of.js"),u=A("./node_modules/core-js/internals/set-to-string-tag.js"),h=A("./node_modules/core-js/internals/create-non-enumerable-property.js"),d=A("./node_modules/core-js/internals/define-built-in.js"),f=A("./node_modules/core-js/internals/well-known-symbol.js"),p=A("./node_modules/core-js/internals/iterators.js"),g=A("./node_modules/core-js/internals/iterators-core.js"),m=i.PROPER,w=i.CONFIGURABLE,B=g.IteratorPrototype,y=g.BUGGY_SAFARI_ITERATORS,v=f("iterator"),b="keys",C="values",_="entries",j=function(){return this};e.exports=function(e,t,A,i,f,g,x){a(A,t,i);var F,Q,U,E=function(e){if(e===f&&k)return k;if(!y&&e&&e in I)return I[e];switch(e){case b:case C:case _:return function(){return new A(this,e)}}return function(){return new A(this)}},S=t+" Iterator",L=!1,I=e.prototype,N=I[v]||I["@@iterator"]||f&&I[f],k=!y&&N||E(f),H="Array"===t&&I.entries||N;if(H&&(F=l(H.call(new e)))!==Object.prototype&&F.next&&(s||l(F)===B||(c?c(F,B):o(F[v])||d(F,v,j)),u(F,S,!0,!0),s&&(p[S]=j)),m&&f===C&&N&&N.name!==C&&(!s&&w?h(I,"name",C):(L=!0,k=function(){return n(N,this)})),f)if(Q={values:E(C),keys:g?k:E(b),entries:E(_)},x)for(U in Q)(y||L||!(U in I))&&d(I,U,Q[U]);else r({target:t,proto:!0,forced:y||L},Q);return s&&!x||I[v]===k||d(I,v,k,{name:f}),p[t]=k,Q}},"./node_modules/core-js/internals/iterator-helper-throws-on-invalid-iterator.js":function(e){"use strict";e.exports=function(e,t){var A="function"==typeof Iterator&&Iterator.prototype[e];if(A)try{A.call({next:null},t).next()}catch(e){return!0}}},"./node_modules/core-js/internals/iterator-helper-without-closing-on-early-error.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js");e.exports=function(e,t){var A=r.Iterator,n=A&&A.prototype,s=n&&n[e],i=!1;if(s)try{s.call({next:function(){return{done:!0}},return:function(){i=!0}},-1)}catch(e){e instanceof t||(i=!1)}if(!i)return s}},"./node_modules/core-js/internals/iterators-core.js":function(e,t,A){"use strict";var r,n,s,i=A("./node_modules/core-js/internals/fails.js"),o=A("./node_modules/core-js/internals/is-callable.js"),a=A("./node_modules/core-js/internals/is-object.js"),l=A("./node_modules/core-js/internals/object-create.js"),c=A("./node_modules/core-js/internals/object-get-prototype-of.js"),u=A("./node_modules/core-js/internals/define-built-in.js"),h=A("./node_modules/core-js/internals/well-known-symbol.js"),d=A("./node_modules/core-js/internals/is-pure.js"),f=h("iterator"),p=!1;[].keys&&("next"in(s=[].keys())?(n=c(c(s)))!==Object.prototype&&(r=n):p=!0),!a(r)||i(function(){var e={};return r[f].call(e)!==e})?r={}:d&&(r=l(r)),o(r[f])||u(r,f,function(){return this}),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},"./node_modules/core-js/internals/iterators.js":function(e){"use strict";e.exports={}},"./node_modules/core-js/internals/length-of-array-like.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/to-length.js");e.exports=function(e){return r(e.length)}},"./node_modules/core-js/internals/make-built-in.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/fails.js"),s=A("./node_modules/core-js/internals/is-callable.js"),i=A("./node_modules/core-js/internals/has-own-property.js"),o=A("./node_modules/core-js/internals/descriptors.js"),a=A("./node_modules/core-js/internals/function-name.js").CONFIGURABLE,l=A("./node_modules/core-js/internals/inspect-source.js"),c=A("./node_modules/core-js/internals/internal-state.js"),u=c.enforce,h=c.get,d=String,f=Object.defineProperty,p=r("".slice),g=r("".replace),m=r([].join),w=o&&!n(function(){return 8!==f(function(){},"length",{value:8}).length}),B=String(String).split("String"),y=e.exports=function(e,t,A){"Symbol("===p(d(t),0,7)&&(t="["+g(d(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),A&&A.getter&&(t="get "+t),A&&A.setter&&(t="set "+t),(!i(e,"name")||a&&e.name!==t)&&(o?f(e,"name",{value:t,configurable:!0}):e.name=t),w&&A&&i(A,"arity")&&e.length!==A.arity&&f(e,"length",{value:A.arity});try{A&&i(A,"constructor")&&A.constructor?o&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=u(e);return i(r,"source")||(r.source=m(B,"string"==typeof t?t:"")),e};Function.prototype.toString=y(function(){return s(this)&&h(this).source||l(this)},"toString")},"./node_modules/core-js/internals/math-trunc.js":function(e){"use strict";var t=Math.ceil,A=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?A:t)(r)}},"./node_modules/core-js/internals/microtask.js":function(e,t,A){"use strict";var r,n,s,i,o,a=A("./node_modules/core-js/internals/global-this.js"),l=A("./node_modules/core-js/internals/safe-get-built-in.js"),c=A("./node_modules/core-js/internals/function-bind-context.js"),u=A("./node_modules/core-js/internals/task.js").set,h=A("./node_modules/core-js/internals/queue.js"),d=A("./node_modules/core-js/internals/environment-is-ios.js"),f=A("./node_modules/core-js/internals/environment-is-ios-pebble.js"),p=A("./node_modules/core-js/internals/environment-is-webos-webkit.js"),g=A("./node_modules/core-js/internals/environment-is-node.js"),m=a.MutationObserver||a.WebKitMutationObserver,w=a.document,B=a.process,y=a.Promise,v=l("queueMicrotask");if(!v){var b=new h,C=function(){var e,t;for(g&&(e=B.domain)&&e.exit();t=b.get();)try{t()}catch(e){throw b.head&&r(),e}e&&e.enter()};d||g||p||!m||!w?!f&&y&&y.resolve?((i=y.resolve(void 0)).constructor=y,o=c(i.then,i),r=function(){o(C)}):g?r=function(){B.nextTick(C)}:(u=c(u,a),r=function(){u(C)}):(n=!0,s=w.createTextNode(""),new m(C).observe(s,{characterData:!0}),r=function(){s.data=n=!n}),v=function(e){b.head||r(),b.add(e)}}e.exports=v},"./node_modules/core-js/internals/native-raw-json.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/fails.js");e.exports=!r(function(){var e="9007199254740993",t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})},"./node_modules/core-js/internals/new-promise-capability.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/a-callable.js"),n=TypeError,s=function(e){var t,A;this.promise=new e(function(e,r){if(void 0!==t||void 0!==A)throw new n("Bad Promise constructor");t=e,A=r}),this.resolve=r(t),this.reject=r(A)};e.exports.f=function(e){return new s(e)}},"./node_modules/core-js/internals/not-a-regexp.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/is-regexp.js"),n=TypeError;e.exports=function(e){if(r(e))throw new n("The method doesn't accept regular expressions");return e}},"./node_modules/core-js/internals/object-assign.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/descriptors.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/function-call.js"),i=A("./node_modules/core-js/internals/fails.js"),o=A("./node_modules/core-js/internals/object-keys.js"),a=A("./node_modules/core-js/internals/object-get-own-property-symbols.js"),l=A("./node_modules/core-js/internals/object-property-is-enumerable.js"),c=A("./node_modules/core-js/internals/to-object.js"),u=A("./node_modules/core-js/internals/indexed-object.js"),h=Object.assign,d=Object.defineProperty,f=n([].concat);e.exports=!h||i(function(){if(r&&1!==h({b:1},h(d({},"a",{enumerable:!0,get:function(){d(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},A=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[A]=7,n.split("").forEach(function(e){t[e]=e}),7!==h({},e)[A]||o(h({},t)).join("")!==n})?function(e,t){for(var A=c(e),n=arguments.length,i=1,h=a.f,d=l.f;n>i;)for(var p,g=u(arguments[i++]),m=h?f(o(g),h(g)):o(g),w=m.length,B=0;w>B;)p=m[B++],r&&!s(d,g,p)||(A[p]=g[p]);return A}:h},"./node_modules/core-js/internals/object-create.js":function(e,t,A){"use strict";var r,n=A("./node_modules/core-js/internals/an-object.js"),s=A("./node_modules/core-js/internals/object-define-properties.js"),i=A("./node_modules/core-js/internals/enum-bug-keys.js"),o=A("./node_modules/core-js/internals/hidden-keys.js"),a=A("./node_modules/core-js/internals/html.js"),l=A("./node_modules/core-js/internals/document-create-element.js"),c=A("./node_modules/core-js/internals/shared-key.js"),u="prototype",h="script",d=c("IE_PROTO"),f=function(){},p=function(e){return"<"+h+">"+e+""},g=function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t},m=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,A;m="undefined"!=typeof document?document.domain&&r?g(r):(t=l("iframe"),A="java"+h+":",t.style.display="none",a.appendChild(t),t.src=String(A),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F):g(r);for(var n=i.length;n--;)delete m[u][i[n]];return m()};o[d]=!0,e.exports=Object.create||function(e,t){var A;return null!==e?(f[u]=n(e),A=new f,f[u]=null,A[d]=e):A=m(),void 0===t?A:s.f(A,t)}},"./node_modules/core-js/internals/object-define-properties.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/descriptors.js"),n=A("./node_modules/core-js/internals/v8-prototype-define-bug.js"),s=A("./node_modules/core-js/internals/object-define-property.js"),i=A("./node_modules/core-js/internals/an-object.js"),o=A("./node_modules/core-js/internals/to-indexed-object.js"),a=A("./node_modules/core-js/internals/object-keys.js");t.f=r&&!n?Object.defineProperties:function(e,t){i(e);for(var A,r=o(t),n=a(t),l=n.length,c=0;l>c;)s.f(e,A=n[c++],r[A]);return e}},"./node_modules/core-js/internals/object-define-property.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/descriptors.js"),n=A("./node_modules/core-js/internals/ie8-dom-define.js"),s=A("./node_modules/core-js/internals/v8-prototype-define-bug.js"),i=A("./node_modules/core-js/internals/an-object.js"),o=A("./node_modules/core-js/internals/to-property-key.js"),a=TypeError,l=Object.defineProperty,c=Object.getOwnPropertyDescriptor,u="enumerable",h="configurable",d="writable";t.f=r?s?function(e,t,A){if(i(e),t=o(t),i(A),"function"==typeof e&&"prototype"===t&&"value"in A&&d in A&&!A[d]){var r=c(e,t);r&&r[d]&&(e[t]=A.value,A={configurable:h in A?A[h]:r[h],enumerable:u in A?A[u]:r[u],writable:!1})}return l(e,t,A)}:l:function(e,t,A){if(i(e),t=o(t),i(A),n)try{return l(e,t,A)}catch(e){}if("get"in A||"set"in A)throw new a("Accessors not supported");return"value"in A&&(e[t]=A.value),e}},"./node_modules/core-js/internals/object-get-own-property-descriptor.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/descriptors.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/object-property-is-enumerable.js"),i=A("./node_modules/core-js/internals/create-property-descriptor.js"),o=A("./node_modules/core-js/internals/to-indexed-object.js"),a=A("./node_modules/core-js/internals/to-property-key.js"),l=A("./node_modules/core-js/internals/has-own-property.js"),c=A("./node_modules/core-js/internals/ie8-dom-define.js"),u=Object.getOwnPropertyDescriptor;t.f=r?u:function(e,t){if(e=o(e),t=a(t),c)try{return u(e,t)}catch(e){}if(l(e,t))return i(!n(s.f,e,t),e[t])}},"./node_modules/core-js/internals/object-get-own-property-names-external.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/classof-raw.js"),n=A("./node_modules/core-js/internals/to-indexed-object.js"),s=A("./node_modules/core-js/internals/object-get-own-property-names.js").f,i=A("./node_modules/core-js/internals/array-slice.js"),o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return o&&"Window"===r(e)?function(e){try{return s(e)}catch(e){return i(o)}}(e):s(n(e))}},"./node_modules/core-js/internals/object-get-own-property-names.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/object-keys-internal.js"),n=A("./node_modules/core-js/internals/enum-bug-keys.js").concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,n)}},"./node_modules/core-js/internals/object-get-own-property-symbols.js":function(e,t){"use strict";t.f=Object.getOwnPropertySymbols},"./node_modules/core-js/internals/object-get-prototype-of.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/has-own-property.js"),n=A("./node_modules/core-js/internals/is-callable.js"),s=A("./node_modules/core-js/internals/to-object.js"),i=A("./node_modules/core-js/internals/shared-key.js"),o=A("./node_modules/core-js/internals/correct-prototype-getter.js"),a=i("IE_PROTO"),l=Object,c=l.prototype;e.exports=o?l.getPrototypeOf:function(e){var t=s(e);if(r(t,a))return t[a];var A=t.constructor;return n(A)&&t instanceof A?A.prototype:t instanceof l?c:null}},"./node_modules/core-js/internals/object-is-extensible.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/fails.js"),n=A("./node_modules/core-js/internals/is-object.js"),s=A("./node_modules/core-js/internals/classof-raw.js"),i=A("./node_modules/core-js/internals/array-buffer-non-extensible.js"),o=Object.isExtensible,a=r(function(){o(1)});e.exports=a||i?function(e){return!!n(e)&&(!i||"ArrayBuffer"!==s(e))&&(!o||o(e))}:o},"./node_modules/core-js/internals/object-is-prototype-of.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js");e.exports=r({}.isPrototypeOf)},"./node_modules/core-js/internals/object-keys-internal.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/has-own-property.js"),s=A("./node_modules/core-js/internals/to-indexed-object.js"),i=A("./node_modules/core-js/internals/array-includes.js").indexOf,o=A("./node_modules/core-js/internals/hidden-keys.js"),a=r([].push);e.exports=function(e,t){var A,r=s(e),l=0,c=[];for(A in r)!n(o,A)&&n(r,A)&&a(c,A);for(;t.length>l;)n(r,A=t[l++])&&(~i(c,A)||a(c,A));return c}},"./node_modules/core-js/internals/object-keys.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/object-keys-internal.js"),n=A("./node_modules/core-js/internals/enum-bug-keys.js");e.exports=Object.keys||function(e){return r(e,n)}},"./node_modules/core-js/internals/object-property-is-enumerable.js":function(e,t){"use strict";var A={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,n=r&&!A.call({1:2},1);t.f=n?function(e){var t=r(this,e);return!!t&&t.enumerable}:A},"./node_modules/core-js/internals/object-set-prototype-of.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this-accessor.js"),n=A("./node_modules/core-js/internals/is-object.js"),s=A("./node_modules/core-js/internals/require-object-coercible.js"),i=A("./node_modules/core-js/internals/a-possible-prototype.js");e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,A={};try{(e=r(Object.prototype,"__proto__","set"))(A,[]),t=A instanceof Array}catch(e){}return function(A,r){return s(A),i(r),n(A)?(t?e(A,r):A.__proto__=r,A):A}}():void 0)},"./node_modules/core-js/internals/object-to-string.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/to-string-tag-support.js"),n=A("./node_modules/core-js/internals/classof.js");e.exports=r?{}.toString:function(){return"[object "+n(this)+"]"}},"./node_modules/core-js/internals/ordinary-to-primitive.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-call.js"),n=A("./node_modules/core-js/internals/is-callable.js"),s=A("./node_modules/core-js/internals/is-object.js"),i=TypeError;e.exports=function(e,t){var A,o;if("string"===t&&n(A=e.toString)&&!s(o=r(A,e)))return o;if(n(A=e.valueOf)&&!s(o=r(A,e)))return o;if("string"!==t&&n(A=e.toString)&&!s(o=r(A,e)))return o;throw new i("Can't convert object to primitive value")}},"./node_modules/core-js/internals/own-keys.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/get-built-in.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/object-get-own-property-names.js"),i=A("./node_modules/core-js/internals/object-get-own-property-symbols.js"),o=A("./node_modules/core-js/internals/an-object.js"),a=n([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=s.f(o(e)),A=i.f;return A?a(t,A(e)):t}},"./node_modules/core-js/internals/parse-json-string.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/has-own-property.js"),s=SyntaxError,i=parseInt,o=String.fromCharCode,a=r("".charAt),l=r("".slice),c=r(/./.exec),u={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},h=/^[\da-f]{4}$/i,d=/^[\u0000-\u001F]$/;e.exports=function(e,t){for(var A=!0,r="";t0&&(!d.multiline||d.multiline&&"\n"!==w(j,d.lastIndex-1))&&(E="(?: "+E+")",L=" "+L,S++),A=new RegExp("^(?:"+E+")",U)),_&&(A=new RegExp("^"+E+"$(?!\\s)",U)),b&&(r=d.lastIndex),n=s(g,Q?A:d,L),Q?n?(n.input=v(n.input,S),n[0]=v(n[0],S),n.index=d.lastIndex,d.lastIndex+=n[0].length):d.lastIndex=0:b&&n&&(d.lastIndex=d.global?n.index+n[0].length:r),_&&n&&n.length>1&&s(p,n[0],A,function(){for(i=1;ib)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$c")})},"./node_modules/core-js/internals/require-object-coercible.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/is-null-or-undefined.js"),n=TypeError;e.exports=function(e){if(r(e))throw new n("Can't call method on "+e);return e}},"./node_modules/core-js/internals/safe-get-built-in.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js"),n=A("./node_modules/core-js/internals/descriptors.js"),s=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!n)return r[e];var t=s(r,e);return t&&t.value}},"./node_modules/core-js/internals/schedulers-fix.js":function(e,t,A){"use strict";var r,n=A("./node_modules/core-js/internals/global-this.js"),s=A("./node_modules/core-js/internals/function-apply.js"),i=A("./node_modules/core-js/internals/is-callable.js"),o=A("./node_modules/core-js/internals/environment.js"),a=A("./node_modules/core-js/internals/environment-user-agent.js"),l=A("./node_modules/core-js/internals/array-slice.js"),c=A("./node_modules/core-js/internals/validate-arguments-length.js"),u=n.Function,h=/MSIE .\./.test(a)||"BUN"===o&&((r=n.Bun.version.split(".")).length<3||"0"===r[0]&&(r[1]<3||"3"===r[1]&&"0"===r[2]));e.exports=function(e,t){var A=t?2:1;return h?function(r,n){var o=c(arguments.length,1)>A,a=i(r)?r:u(r),h=o?l(arguments,A):[],d=o?function(){s(a,this,h)}:a;return t?e(d,n):e(d)}:e}},"./node_modules/core-js/internals/set-clone.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/set-helpers.js"),n=A("./node_modules/core-js/internals/set-iterate.js"),s=r.Set,i=r.add;e.exports=function(e){var t=new s;return n(e,function(e){i(t,e)}),t}},"./node_modules/core-js/internals/set-difference.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/a-set.js"),n=A("./node_modules/core-js/internals/set-helpers.js"),s=A("./node_modules/core-js/internals/set-clone.js"),i=A("./node_modules/core-js/internals/set-size.js"),o=A("./node_modules/core-js/internals/get-set-record.js"),a=A("./node_modules/core-js/internals/set-iterate.js"),l=A("./node_modules/core-js/internals/iterate-simple.js"),c=n.has,u=n.remove;e.exports=function(e){var t=r(this),A=o(e),n=s(t);return i(t)<=A.size?a(t,function(e){A.includes(e)&&u(n,e)}):l(A.getIterator(),function(e){c(n,e)&&u(n,e)}),n}},"./node_modules/core-js/internals/set-helpers.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=Set.prototype;e.exports={Set:Set,add:r(n.add),has:r(n.has),remove:r(n.delete),proto:n}},"./node_modules/core-js/internals/set-intersection.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/a-set.js"),n=A("./node_modules/core-js/internals/set-helpers.js"),s=A("./node_modules/core-js/internals/set-size.js"),i=A("./node_modules/core-js/internals/get-set-record.js"),o=A("./node_modules/core-js/internals/set-iterate.js"),a=A("./node_modules/core-js/internals/iterate-simple.js"),l=n.Set,c=n.add,u=n.has;e.exports=function(e){var t=r(this),A=i(e),n=new l;return s(t)>A.size?a(A.getIterator(),function(e){u(t,e)&&c(n,e)}):o(t,function(e){A.includes(e)&&c(n,e)}),n}},"./node_modules/core-js/internals/set-is-disjoint-from.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/a-set.js"),n=A("./node_modules/core-js/internals/set-helpers.js").has,s=A("./node_modules/core-js/internals/set-size.js"),i=A("./node_modules/core-js/internals/get-set-record.js"),o=A("./node_modules/core-js/internals/set-iterate.js"),a=A("./node_modules/core-js/internals/iterate-simple.js"),l=A("./node_modules/core-js/internals/iterator-close.js");e.exports=function(e){var t=r(this),A=i(e);if(s(t)<=A.size)return!1!==o(t,function(e){if(A.includes(e))return!1},!0);var c=A.getIterator();return!1!==a(c,function(e){if(n(t,e))return l(c,"normal",!1)})}},"./node_modules/core-js/internals/set-is-subset-of.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/a-set.js"),n=A("./node_modules/core-js/internals/set-size.js"),s=A("./node_modules/core-js/internals/set-iterate.js"),i=A("./node_modules/core-js/internals/get-set-record.js");e.exports=function(e){var t=r(this),A=i(e);return!(n(t)>A.size)&&!1!==s(t,function(e){if(!A.includes(e))return!1},!0)}},"./node_modules/core-js/internals/set-is-superset-of.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/a-set.js"),n=A("./node_modules/core-js/internals/set-helpers.js").has,s=A("./node_modules/core-js/internals/set-size.js"),i=A("./node_modules/core-js/internals/get-set-record.js"),o=A("./node_modules/core-js/internals/iterate-simple.js"),a=A("./node_modules/core-js/internals/iterator-close.js");e.exports=function(e){var t=r(this),A=i(e);if(s(t)3})}},"./node_modules/core-js/internals/string-multibyte.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/to-integer-or-infinity.js"),s=A("./node_modules/core-js/internals/to-string.js"),i=A("./node_modules/core-js/internals/require-object-coercible.js"),o=r("".charAt),a=r("".charCodeAt),l=r("".slice),c=function(e){return function(t,A){var r,c,u=s(i(t)),h=n(A),d=u.length;return h<0||h>=d?e?"":void 0:(r=a(u,h))<55296||r>56319||h+1===d||(c=a(u,h+1))<56320||c>57343?e?o(u,h):r:e?l(u,h,h+2):c-56320+(r-55296<<10)+65536}};e.exports={codeAt:c(!1),charAt:c(!0)}},"./node_modules/core-js/internals/string-trim-forced.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-name.js").PROPER,n=A("./node_modules/core-js/internals/fails.js"),s=A("./node_modules/core-js/internals/whitespaces.js");e.exports=function(e){return n(function(){return!!s[e]()||"​…᠎"!=="​…᠎"[e]()||r&&s[e].name!==e})}},"./node_modules/core-js/internals/string-trim.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=A("./node_modules/core-js/internals/require-object-coercible.js"),s=A("./node_modules/core-js/internals/to-string.js"),i=A("./node_modules/core-js/internals/whitespaces.js"),o=r("".replace),a=RegExp("^["+i+"]+"),l=RegExp("(^|[^"+i+"])["+i+"]+$"),c=function(e){return function(t){var A=s(n(t));return 1&e&&(A=o(A,a,"")),2&e&&(A=o(A,l,"$1")),A}};e.exports={start:c(1),end:c(2),trim:c(3)}},"./node_modules/core-js/internals/symbol-constructor-detection.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/environment-v8-version.js"),n=A("./node_modules/core-js/internals/fails.js"),s=A("./node_modules/core-js/internals/global-this.js").String;e.exports=!!Object.getOwnPropertySymbols&&!n(function(){var e=Symbol("symbol detection");return!s(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41})},"./node_modules/core-js/internals/symbol-define-to-primitive.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-call.js"),n=A("./node_modules/core-js/internals/get-built-in.js"),s=A("./node_modules/core-js/internals/well-known-symbol.js"),i=A("./node_modules/core-js/internals/define-built-in.js");e.exports=function(){var e=n("Symbol"),t=e&&e.prototype,A=t&&t.valueOf,o=s("toPrimitive");t&&!t[o]&&i(t,o,function(e){return r(A,this)},{arity:1})}},"./node_modules/core-js/internals/symbol-registry-detection.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/symbol-constructor-detection.js");e.exports=r&&!!Symbol.for&&!!Symbol.keyFor},"./node_modules/core-js/internals/task.js":function(e,t,A){"use strict";var r,n,s,i,o=A("./node_modules/core-js/internals/global-this.js"),a=A("./node_modules/core-js/internals/function-apply.js"),l=A("./node_modules/core-js/internals/function-bind-context.js"),c=A("./node_modules/core-js/internals/is-callable.js"),u=A("./node_modules/core-js/internals/has-own-property.js"),h=A("./node_modules/core-js/internals/fails.js"),d=A("./node_modules/core-js/internals/html.js"),f=A("./node_modules/core-js/internals/array-slice.js"),p=A("./node_modules/core-js/internals/document-create-element.js"),g=A("./node_modules/core-js/internals/validate-arguments-length.js"),m=A("./node_modules/core-js/internals/environment-is-ios.js"),w=A("./node_modules/core-js/internals/environment-is-node.js"),B=o.setImmediate,y=o.clearImmediate,v=o.process,b=o.Dispatch,C=o.Function,_=o.MessageChannel,j=o.String,x=0,F={},Q="onreadystatechange";h(function(){r=o.location});var U=function(e){if(u(F,e)){var t=F[e];delete F[e],t()}},E=function(e){return function(){U(e)}},S=function(e){U(e.data)},L=function(e){o.postMessage(j(e),r.protocol+"//"+r.host)};B&&y||(B=function(e){g(arguments.length,1);var t=c(e)?e:C(e),A=f(arguments,1);return F[++x]=function(){a(t,void 0,A)},n(x),x},y=function(e){delete F[e]},w?n=function(e){v.nextTick(E(e))}:b&&b.now?n=function(e){b.now(E(e))}:_&&!m?(i=(s=new _).port2,s.port1.onmessage=S,n=l(i.postMessage,i)):o.addEventListener&&c(o.postMessage)&&!o.importScripts&&r&&"file:"!==r.protocol&&!h(L)?(n=L,o.addEventListener("message",S,!1)):n=Q in p("script")?function(e){d.appendChild(p("script"))[Q]=function(){d.removeChild(this),U(e)}}:function(e){setTimeout(E(e),0)}),e.exports={set:B,clear:y}},"./node_modules/core-js/internals/this-number-value.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js");e.exports=r(1.1.valueOf)},"./node_modules/core-js/internals/to-absolute-index.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/to-integer-or-infinity.js"),n=Math.max,s=Math.min;e.exports=function(e,t){var A=r(e);return A<0?n(A+t,0):s(A,t)}},"./node_modules/core-js/internals/to-indexed-object.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/indexed-object.js"),n=A("./node_modules/core-js/internals/require-object-coercible.js");e.exports=function(e){return r(n(e))}},"./node_modules/core-js/internals/to-integer-or-infinity.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/math-trunc.js");e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},"./node_modules/core-js/internals/to-length.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/to-integer-or-infinity.js"),n=Math.min;e.exports=function(e){var t=r(e);return t>0?n(t,9007199254740991):0}},"./node_modules/core-js/internals/to-object.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/require-object-coercible.js"),n=Object;e.exports=function(e){return n(r(e))}},"./node_modules/core-js/internals/to-primitive.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-call.js"),n=A("./node_modules/core-js/internals/is-object.js"),s=A("./node_modules/core-js/internals/is-symbol.js"),i=A("./node_modules/core-js/internals/get-method.js"),o=A("./node_modules/core-js/internals/ordinary-to-primitive.js"),a=A("./node_modules/core-js/internals/well-known-symbol.js"),l=TypeError,c=a("toPrimitive");e.exports=function(e,t){if(!n(e)||s(e))return e;var A,a=i(e,c);if(a){if(void 0===t&&(t="default"),A=r(a,e,t),!n(A)||s(A))return A;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),o(e,t)}},"./node_modules/core-js/internals/to-property-key.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/to-primitive.js"),n=A("./node_modules/core-js/internals/is-symbol.js");e.exports=function(e){var t=r(e,"string");return n(t)?t:t+""}},"./node_modules/core-js/internals/to-set-like.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/get-built-in.js"),n=A("./node_modules/core-js/internals/is-callable.js"),s=A("./node_modules/core-js/internals/is-iterable.js"),i=A("./node_modules/core-js/internals/is-object.js"),o=r("Set");e.exports=function(e){return function(e){return i(e)&&"number"==typeof e.size&&n(e.has)&&n(e.keys)}(e)?e:s(e)?new o(e):e}},"./node_modules/core-js/internals/to-string-tag-support.js":function(e,t,A){"use strict";var r={};r[A("./node_modules/core-js/internals/well-known-symbol.js")("toStringTag")]="z",e.exports="[object z]"===String(r)},"./node_modules/core-js/internals/to-string.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/classof.js"),n=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return n(e)}},"./node_modules/core-js/internals/try-to-string.js":function(e){"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},"./node_modules/core-js/internals/uid.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-uncurry-this.js"),n=0,s=Math.random(),i=r(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+i(++n+s,36)}},"./node_modules/core-js/internals/use-symbol-as-uid.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/symbol-constructor-detection.js");e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},"./node_modules/core-js/internals/v8-prototype-define-bug.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/descriptors.js"),n=A("./node_modules/core-js/internals/fails.js");e.exports=r&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},"./node_modules/core-js/internals/validate-arguments-length.js":function(e){"use strict";var t=TypeError;e.exports=function(e,A){if(e=51||!n(function(){var e=[];return e[p]=!1,e.concat()[0]!==e}),m=function(e){if(!i(e))return!1;var t=e[p];return void 0!==t?!!t:s(e)};r({target:"Array",proto:!0,arity:1,forced:!g||!h("concat")},{concat:function(e){var t,A,r,n,s,i=o(this),h=u(i,0),d=0;for(t=-1,r=arguments.length;t1?arguments[1]:void 0;return a?o(this,e,t)||0:s(this,e,t)}})},"./node_modules/core-js/modules/es.array.iterator.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/to-indexed-object.js"),n=A("./node_modules/core-js/internals/add-to-unscopables.js"),s=A("./node_modules/core-js/internals/iterators.js"),i=A("./node_modules/core-js/internals/internal-state.js"),o=A("./node_modules/core-js/internals/object-define-property.js").f,a=A("./node_modules/core-js/internals/iterator-define.js"),l=A("./node_modules/core-js/internals/create-iter-result-object.js"),c=A("./node_modules/core-js/internals/is-pure.js"),u=A("./node_modules/core-js/internals/descriptors.js"),h="Array Iterator",d=i.set,f=i.getterFor(h);e.exports=a(Array,"Array",function(e,t){d(this,{type:h,target:r(e),index:0,kind:t})},function(){var e=f(this),t=e.target,A=e.index++;if(!t||A>=t.length)return e.target=null,l(void 0,!0);switch(e.kind){case"keys":return l(A,!1);case"values":return l(t[A],!1)}return l([A,t[A]],!1)},"values");var p=s.Arguments=s.Array;if(n("keys"),n("values"),n("entries"),!c&&u&&"values"!==p.name)try{o(p,"name",{value:"values"})}catch(e){}},"./node_modules/core-js/modules/es.array.join.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/indexed-object.js"),i=A("./node_modules/core-js/internals/to-indexed-object.js"),o=A("./node_modules/core-js/internals/array-method-is-strict.js"),a=n([].join);r({target:"Array",proto:!0,forced:s!==Object||!o("join",",")},{join:function(e){return a(i(this),void 0===e?",":e)}})},"./node_modules/core-js/modules/es.array.map.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/array-iteration.js").map;r({target:"Array",proto:!0,forced:!A("./node_modules/core-js/internals/array-method-has-species-support.js")("map")},{map:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}})},"./node_modules/core-js/modules/es.array.reduce.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/array-reduce.js").left,s=A("./node_modules/core-js/internals/array-method-is-strict.js"),i=A("./node_modules/core-js/internals/environment-v8-version.js");r({target:"Array",proto:!0,forced:!A("./node_modules/core-js/internals/environment-is-node.js")&&i>79&&i<83||!s("reduce")},{reduce:function(e){var t=arguments.length;return n(this,e,t,t>1?arguments[1]:void 0)}})},"./node_modules/core-js/modules/es.array.reverse.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/is-array.js"),i=n([].reverse),o=[1,2];r({target:"Array",proto:!0,forced:String(o)===String(o.reverse())},{reverse:function(){return s(this)&&(this.length=this.length),i(this)}})},"./node_modules/core-js/modules/es.array.slice.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/is-array.js"),s=A("./node_modules/core-js/internals/is-constructor.js"),i=A("./node_modules/core-js/internals/is-object.js"),o=A("./node_modules/core-js/internals/to-absolute-index.js"),a=A("./node_modules/core-js/internals/length-of-array-like.js"),l=A("./node_modules/core-js/internals/to-indexed-object.js"),c=A("./node_modules/core-js/internals/create-property.js"),u=A("./node_modules/core-js/internals/well-known-symbol.js"),h=A("./node_modules/core-js/internals/array-method-has-species-support.js"),d=A("./node_modules/core-js/internals/array-slice.js"),f=h("slice"),p=u("species"),g=Array,m=Math.max;r({target:"Array",proto:!0,forced:!f},{slice:function(e,t){var A,r,u,h=l(this),f=a(h),w=o(e,f),B=o(void 0===t?f:t,f);if(n(h)&&(A=h.constructor,(s(A)&&(A===g||n(A.prototype))||i(A)&&null===(A=A[p]))&&(A=void 0),A===g||void 0===A))return d(h,w,B);for(r=new(void 0===A?g:A)(m(B-w,0)),u=0;w2)if(l=y(l),43===(t=F(l,0))||45===t){if(88===(A=F(l,2))||120===A)return NaN}else if(48===t){switch(F(l,1)){case 66:case 98:r=2,n=49;break;case 79:case 111:r=8,n=55;break;default:return+l}for(i=(s=x(l,2)).length,o=0;on)return NaN;return parseInt(s,r)}return+l}(t)}(e));return h(_,t=this)&&p(function(){B(t)})?u(Object(A),this,U):A};U.prototype=_,Q&&!n&&(_.constructor=U),r({global:!0,constructor:!0,wrap:!0,forced:Q},{Number:U});var E=function(e,t){for(var A,r=s?g(t):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),n=0;r.length>n;n++)c(t,A=r[n])&&!c(e,A)&&w(e,A,m(t,A))};n&&C&&E(o[v],C),(Q||n)&&E(o[v],b)},"./node_modules/core-js/modules/es.object.assign.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/object-assign.js");r({target:"Object",stat:!0,arity:2,forced:Object.assign!==n},{assign:n})},"./node_modules/core-js/modules/es.object.get-own-property-symbols.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/symbol-constructor-detection.js"),s=A("./node_modules/core-js/internals/fails.js"),i=A("./node_modules/core-js/internals/object-get-own-property-symbols.js"),o=A("./node_modules/core-js/internals/to-object.js");r({target:"Object",stat:!0,forced:!n||s(function(){i.f(1)})},{getOwnPropertySymbols:function(e){var t=i.f;return t?t(o(e)):[]}})},"./node_modules/core-js/modules/es.object.keys.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/to-object.js"),s=A("./node_modules/core-js/internals/object-keys.js");r({target:"Object",stat:!0,forced:A("./node_modules/core-js/internals/fails.js")(function(){s(1)})},{keys:function(e){return s(n(e))}})},"./node_modules/core-js/modules/es.object.to-string.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/to-string-tag-support.js"),n=A("./node_modules/core-js/internals/define-built-in.js"),s=A("./node_modules/core-js/internals/object-to-string.js");r||n(Object.prototype,"toString",s,{unsafe:!0})},"./node_modules/core-js/modules/es.promise.all.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/a-callable.js"),i=A("./node_modules/core-js/internals/new-promise-capability.js"),o=A("./node_modules/core-js/internals/perform.js"),a=A("./node_modules/core-js/internals/iterate.js");r({target:"Promise",stat:!0,forced:A("./node_modules/core-js/internals/promise-statics-incorrect-iteration.js")},{all:function(e){var t=this,A=i.f(t),r=A.resolve,l=A.reject,c=o(function(){var A=s(t.resolve),i=[],o=0,c=1;a(e,function(e){var s=o++,a=!1;c++,n(A,t,e).then(function(e){a||(a=!0,i[s]=e,--c||r(i))},l)}),--c||r(i)});return c.error&&l(c.value),A.promise}})},"./node_modules/core-js/modules/es.promise.catch.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/is-pure.js"),s=A("./node_modules/core-js/internals/promise-constructor-detection.js").CONSTRUCTOR,i=A("./node_modules/core-js/internals/promise-native-constructor.js"),o=A("./node_modules/core-js/internals/get-built-in.js"),a=A("./node_modules/core-js/internals/is-callable.js"),l=A("./node_modules/core-js/internals/define-built-in.js"),c=i&&i.prototype;if(r({target:"Promise",proto:!0,forced:s,real:!0},{catch:function(e){return this.then(void 0,e)}}),!n&&a(i)){var u=o("Promise").prototype.catch;c.catch!==u&&l(c,"catch",u,{unsafe:!0})}},"./node_modules/core-js/modules/es.promise.constructor.js":function(e,t,A){"use strict";var r,n,s,i,o=A("./node_modules/core-js/internals/export.js"),a=A("./node_modules/core-js/internals/is-pure.js"),l=A("./node_modules/core-js/internals/environment-is-node.js"),c=A("./node_modules/core-js/internals/global-this.js"),u=A("./node_modules/core-js/internals/path.js"),h=A("./node_modules/core-js/internals/function-call.js"),d=A("./node_modules/core-js/internals/define-built-in.js"),f=A("./node_modules/core-js/internals/object-set-prototype-of.js"),p=A("./node_modules/core-js/internals/set-to-string-tag.js"),g=A("./node_modules/core-js/internals/set-species.js"),m=A("./node_modules/core-js/internals/a-callable.js"),w=A("./node_modules/core-js/internals/is-callable.js"),B=A("./node_modules/core-js/internals/is-object.js"),y=A("./node_modules/core-js/internals/an-instance.js"),v=A("./node_modules/core-js/internals/species-constructor.js"),b=A("./node_modules/core-js/internals/task.js").set,C=A("./node_modules/core-js/internals/microtask.js"),_=A("./node_modules/core-js/internals/host-report-errors.js"),j=A("./node_modules/core-js/internals/perform.js"),x=A("./node_modules/core-js/internals/queue.js"),F=A("./node_modules/core-js/internals/internal-state.js"),Q=A("./node_modules/core-js/internals/promise-native-constructor.js"),U=A("./node_modules/core-js/internals/promise-constructor-detection.js"),E=A("./node_modules/core-js/internals/new-promise-capability.js"),S="Promise",L=U.CONSTRUCTOR,I=U.REJECTION_EVENT,N=U.SUBCLASSING,k=F.getterFor(S),H=F.set,P=Q&&Q.prototype,T=Q,O=P,M=c.TypeError,D=c.document,R=c.process,K=E.f,V=K,G=!!(D&&D.createEvent&&c.dispatchEvent),z="unhandledrejection",q=function(e){var t;return!(!B(e)||!w(t=e.then))&&t},W=function(e,t){var A,r,n,s=t.value,i=1===t.state,o=i?e.ok:e.fail,a=e.resolve,l=e.reject,c=e.domain;try{o?(i||(2===t.rejection&&$(t),t.rejection=1),!0===o?A=s:(c&&c.enter(),A=o(s),c&&(c.exit(),n=!0)),A===e.promise?l(new M("Promise-chain cycle")):(r=q(A))?h(r,A,a,l):a(A)):l(s)}catch(e){c&&!n&&c.exit(),l(e)}},X=function(e,t){e.notified||(e.notified=!0,C(function(){for(var A,r=e.reactions;A=r.get();)W(A,e);e.notified=!1,t&&!e.rejection&&J(e)}))},Y=function(e,t,A){var r,n;G?((r=D.createEvent("Event")).promise=t,r.reason=A,r.initEvent(e,!1,!0),c.dispatchEvent(r)):r={promise:t,reason:A},!I&&(n=c["on"+e])?n(r):e===z&&_("Unhandled promise rejection",A)},J=function(e){h(b,c,function(){var t,A=e.facade,r=e.value;if(Z(e)&&(t=j(function(){l?R.emit("unhandledRejection",r,A):Y(z,A,r)}),e.rejection=l||Z(e)?2:1,t.error))throw t.value})},Z=function(e){return 1!==e.rejection&&!e.parent},$=function(e){h(b,c,function(){var t=e.facade;l?R.emit("rejectionHandled",t):Y("rejectionhandled",t,e.value)})},ee=function(e,t,A){return function(r){e(t,r,A)}},te=function(e,t,A){e.done||(e.done=!0,A&&(e=A),e.value=t,e.state=2,X(e,!0))},Ae=function(e,t,A){if(!e.done){e.done=!0,A&&(e=A);try{if(e.facade===t)throw new M("Promise can't be resolved itself");var r=q(t);r?C(function(){var A={done:!1};try{h(r,t,ee(Ae,A,e),ee(te,A,e))}catch(t){te(A,t,e)}}):(e.value=t,e.state=1,X(e,!1))}catch(t){te({done:!1},t,e)}}};if(L&&(O=(T=function(e){y(this,O),m(e),h(r,this);var t=k(this);try{e(ee(Ae,t),ee(te,t))}catch(e){te(t,e)}}).prototype,(r=function(e){H(this,{type:S,done:!1,notified:!1,parent:!1,reactions:new x,rejection:!1,state:0,value:null})}).prototype=d(O,"then",function(e,t){var A=k(this),r=K(v(this,T));return A.parent=!0,r.ok=!w(e)||e,r.fail=w(t)&&t,r.domain=l?R.domain:void 0,0===A.state?A.reactions.add(r):C(function(){W(r,A)}),r.promise}),n=function(){var e=new r,t=k(e);this.promise=e,this.resolve=ee(Ae,t),this.reject=ee(te,t)},E.f=K=function(e){return e===T||e===s?new n(e):V(e)},!a&&w(Q)&&P!==Object.prototype)){i=P.then,N||d(P,"then",function(e,t){var A=this;return new T(function(e,t){h(i,A,e,t)}).then(e,t)},{unsafe:!0});try{delete P.constructor}catch(e){}f&&f(P,O)}o({global:!0,constructor:!0,wrap:!0,forced:L},{Promise:T}),s=u.Promise,p(T,S,!1,!0),g(S)},"./node_modules/core-js/modules/es.promise.js":function(e,t,A){"use strict";A("./node_modules/core-js/modules/es.promise.constructor.js"),A("./node_modules/core-js/modules/es.promise.all.js"),A("./node_modules/core-js/modules/es.promise.catch.js"),A("./node_modules/core-js/modules/es.promise.race.js"),A("./node_modules/core-js/modules/es.promise.reject.js"),A("./node_modules/core-js/modules/es.promise.resolve.js")},"./node_modules/core-js/modules/es.promise.race.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/a-callable.js"),i=A("./node_modules/core-js/internals/new-promise-capability.js"),o=A("./node_modules/core-js/internals/perform.js"),a=A("./node_modules/core-js/internals/iterate.js");r({target:"Promise",stat:!0,forced:A("./node_modules/core-js/internals/promise-statics-incorrect-iteration.js")},{race:function(e){var t=this,A=i.f(t),r=A.reject,l=o(function(){var i=s(t.resolve);a(e,function(e){n(i,t,e).then(A.resolve,r)})});return l.error&&r(l.value),A.promise}})},"./node_modules/core-js/modules/es.promise.reject.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/new-promise-capability.js");r({target:"Promise",stat:!0,forced:A("./node_modules/core-js/internals/promise-constructor-detection.js").CONSTRUCTOR},{reject:function(e){var t=n.f(this);return(0,t.reject)(e),t.promise}})},"./node_modules/core-js/modules/es.promise.resolve.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/get-built-in.js"),s=A("./node_modules/core-js/internals/is-pure.js"),i=A("./node_modules/core-js/internals/promise-native-constructor.js"),o=A("./node_modules/core-js/internals/promise-constructor-detection.js").CONSTRUCTOR,a=A("./node_modules/core-js/internals/promise-resolve.js"),l=n("Promise"),c=s&&!o;r({target:"Promise",stat:!0,forced:s||o},{resolve:function(e){return a(c&&this===l?i:this,e)}})},"./node_modules/core-js/modules/es.regexp.exec.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/regexp-exec.js");r({target:"RegExp",proto:!0,forced:/./.exec!==n},{exec:n})},"./node_modules/core-js/modules/es.regexp.test.js":function(e,t,A){"use strict";A("./node_modules/core-js/modules/es.regexp.exec.js");var r,n,s=A("./node_modules/core-js/internals/export.js"),i=A("./node_modules/core-js/internals/function-call.js"),o=A("./node_modules/core-js/internals/is-callable.js"),a=A("./node_modules/core-js/internals/an-object.js"),l=A("./node_modules/core-js/internals/to-string.js"),c=(r=!1,(n=/[ac]/).exec=function(){return r=!0,/./.exec.apply(this,arguments)},!0===n.test("abc")&&r),u=/./.test;s({target:"RegExp",proto:!0,forced:!c},{test:function(e){var t=a(this),A=l(e),r=t.exec;if(!o(r))return i(u,t,A);var n=i(r,t,A);return null!==n&&(a(n),!0)}})},"./node_modules/core-js/modules/es.regexp.to-string.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-name.js").PROPER,n=A("./node_modules/core-js/internals/define-built-in.js"),s=A("./node_modules/core-js/internals/an-object.js"),i=A("./node_modules/core-js/internals/to-string.js"),o=A("./node_modules/core-js/internals/fails.js"),a=A("./node_modules/core-js/internals/regexp-get-flags.js"),l="toString",c=RegExp.prototype,u=c[l],h=o(function(){return"/a/b"!==u.call({source:"a",flags:"b"})}),d=r&&u.name!==l;(h||d)&&n(c,l,function(){var e=s(this);return"/"+i(e.source)+"/"+i(a(e))},{unsafe:!0})},"./node_modules/core-js/modules/es.set.constructor.js":function(e,t,A){"use strict";A("./node_modules/core-js/internals/collection.js")("Set",function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},A("./node_modules/core-js/internals/collection-strong.js"))},"./node_modules/core-js/modules/es.set.js":function(e,t,A){"use strict";A("./node_modules/core-js/modules/es.set.constructor.js")},"./node_modules/core-js/modules/es.string.ends-with.js":function(e,t,A){"use strict";var r,n=A("./node_modules/core-js/internals/export.js"),s=A("./node_modules/core-js/internals/function-uncurry-this-clause.js"),i=A("./node_modules/core-js/internals/object-get-own-property-descriptor.js").f,o=A("./node_modules/core-js/internals/to-length.js"),a=A("./node_modules/core-js/internals/to-string.js"),l=A("./node_modules/core-js/internals/not-a-regexp.js"),c=A("./node_modules/core-js/internals/require-object-coercible.js"),u=A("./node_modules/core-js/internals/correct-is-regexp-logic.js"),h=A("./node_modules/core-js/internals/is-pure.js"),d=s("".slice),f=Math.min,p=u("endsWith");n({target:"String",proto:!0,forced:!(!h&&!p&&(r=i(String.prototype,"endsWith"),r&&!r.writable)||p)},{endsWith:function(e){var t=a(c(this));l(e);var A=arguments.length>1?arguments[1]:void 0,r=t.length,n=void 0===A?r:f(o(A),r),s=a(e);return d(t,n-s.length,n)===s}})},"./node_modules/core-js/modules/es.string.includes.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/not-a-regexp.js"),i=A("./node_modules/core-js/internals/require-object-coercible.js"),o=A("./node_modules/core-js/internals/to-string.js"),a=A("./node_modules/core-js/internals/correct-is-regexp-logic.js"),l=n("".indexOf);r({target:"String",proto:!0,forced:!a("includes")},{includes:function(e){return!!~l(o(i(this)),o(s(e)),arguments.length>1?arguments[1]:void 0)}})},"./node_modules/core-js/modules/es.string.iterator.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/string-multibyte.js").charAt,n=A("./node_modules/core-js/internals/to-string.js"),s=A("./node_modules/core-js/internals/internal-state.js"),i=A("./node_modules/core-js/internals/iterator-define.js"),o=A("./node_modules/core-js/internals/create-iter-result-object.js"),a="String Iterator",l=s.set,c=s.getterFor(a);i(String,"String",function(e){l(this,{type:a,string:n(e),index:0})},function(){var e,t=c(this),A=t.string,n=t.index;return n>=A.length?o(void 0,!0):(e=r(A,n),t.index+=e.length,o(e,!1))})},"./node_modules/core-js/modules/es.string.link.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/create-html.js");r({target:"String",proto:!0,forced:A("./node_modules/core-js/internals/string-html-forced.js")("link")},{link:function(e){return n(this,"a","href",e)}})},"./node_modules/core-js/modules/es.string.match.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-call.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js"),i=A("./node_modules/core-js/internals/an-object.js"),o=A("./node_modules/core-js/internals/is-object.js"),a=A("./node_modules/core-js/internals/to-length.js"),l=A("./node_modules/core-js/internals/to-string.js"),c=A("./node_modules/core-js/internals/require-object-coercible.js"),u=A("./node_modules/core-js/internals/get-method.js"),h=A("./node_modules/core-js/internals/advance-string-index.js"),d=A("./node_modules/core-js/internals/regexp-get-flags.js"),f=A("./node_modules/core-js/internals/regexp-exec-abstract.js"),p=n("".indexOf);s("match",function(e,t,A){return[function(t){var A=c(this),n=o(t)?u(t,e):void 0;return n?r(n,t,A):new RegExp(t)[e](l(A))},function(e){var r=i(this),n=l(e),s=A(t,r,n);if(s.done)return s.value;var o=l(d(r));if(-1===p(o,"g"))return f(r,n);var c=-1!==p(o,"u");r.lastIndex=0;for(var u,g=[],m=0;null!==(u=f(r,n));){var w=l(u[0]);g[m]=w,""===w&&(r.lastIndex=h(n,a(r.lastIndex),c)),m++}return 0===m?null:g}]})},"./node_modules/core-js/modules/es.string.replace.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-apply.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/function-uncurry-this.js"),i=A("./node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js"),o=A("./node_modules/core-js/internals/fails.js"),a=A("./node_modules/core-js/internals/an-object.js"),l=A("./node_modules/core-js/internals/is-callable.js"),c=A("./node_modules/core-js/internals/is-object.js"),u=A("./node_modules/core-js/internals/to-integer-or-infinity.js"),h=A("./node_modules/core-js/internals/to-length.js"),d=A("./node_modules/core-js/internals/to-string.js"),f=A("./node_modules/core-js/internals/require-object-coercible.js"),p=A("./node_modules/core-js/internals/advance-string-index.js"),g=A("./node_modules/core-js/internals/get-method.js"),m=A("./node_modules/core-js/internals/get-substitution.js"),w=A("./node_modules/core-js/internals/regexp-get-flags.js"),B=A("./node_modules/core-js/internals/regexp-exec-abstract.js"),y=A("./node_modules/core-js/internals/well-known-symbol.js")("replace"),v=Math.max,b=Math.min,C=s([].concat),_=s([].push),j=s("".indexOf),x=s("".slice),F=function(e){return void 0===e?e:String(e)},Q="$0"==="a".replace(/./,"$0"),U=!!/./[y]&&""===/./[y]("a","$0");i("replace",function(e,t,A){var s=U?"$":"$0";return[function(e,A){var r=f(this),s=c(e)?g(e,y):void 0;return s?n(s,e,r,A):n(t,d(r),e,A)},function(e,n){var i=a(this),o=d(e);if("string"==typeof n&&-1===j(n,s)&&-1===j(n,"$<")){var c=A(t,i,o,n);if(c.done)return c.value}var f=l(n);f||(n=d(n));var g,y=d(w(i)),Q=-1!==j(y,"g");Q&&(g=-1!==j(y,"u"),i.lastIndex=0);for(var U,E=[];null!==(U=B(i,o))&&(_(E,U),Q);)""===d(U[0])&&(i.lastIndex=p(o,h(i.lastIndex),g));for(var S="",L=0,I=0;I=L&&(S+=x(o,L,H)+N,L=H+k.length)}return S+x(o,L)}]},!!o(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")})||!Q||U)},"./node_modules/core-js/modules/es.string.split.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/function-call.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js"),i=A("./node_modules/core-js/internals/an-object.js"),o=A("./node_modules/core-js/internals/is-object.js"),a=A("./node_modules/core-js/internals/require-object-coercible.js"),l=A("./node_modules/core-js/internals/species-constructor.js"),c=A("./node_modules/core-js/internals/advance-string-index.js"),u=A("./node_modules/core-js/internals/to-length.js"),h=A("./node_modules/core-js/internals/to-string.js"),d=A("./node_modules/core-js/internals/get-method.js"),f=A("./node_modules/core-js/internals/regexp-exec-abstract.js"),p=A("./node_modules/core-js/internals/regexp-sticky-helpers.js"),g=A("./node_modules/core-js/internals/fails.js"),m=p.UNSUPPORTED_Y,w=Math.min,B=n([].push),y=n("".slice),v=!g(function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var A="ab".split(e);return 2!==A.length||"a"!==A[0]||"b"!==A[1]}),b="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length;s("split",function(e,t,A){var n="0".split(void 0,0).length?function(e,A){return void 0===e&&0===A?[]:r(t,this,e,A)}:t;return[function(t,A){var s=a(this),i=o(t)?d(t,e):void 0;return i?r(i,t,s,A):r(n,h(s),t,A)},function(e,r){var s=i(this),o=h(e);if(!b){var a=A(n,s,o,r,n!==t);if(a.done)return a.value}var d=l(s,RegExp),p=s.unicode,g=(s.ignoreCase?"i":"")+(s.multiline?"m":"")+(s.unicode?"u":"")+(m?"g":"y"),v=new d(m?"^(?:"+s.source+")":s,g),C=void 0===r?4294967295:r>>>0;if(0===C)return[];if(0===o.length)return null===f(v,o)?[o]:[];for(var _=0,j=0,x=[];j1?arguments[1]:void 0,t.length)),r=a(e);return d(t,A,A+r.length)===r}})},"./node_modules/core-js/modules/es.string.trim.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/string-trim.js").trim;r({target:"String",proto:!0,forced:A("./node_modules/core-js/internals/string-trim-forced.js")("trim")},{trim:function(){return n(this)}})},"./node_modules/core-js/modules/es.symbol.constructor.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/global-this.js"),s=A("./node_modules/core-js/internals/function-call.js"),i=A("./node_modules/core-js/internals/function-uncurry-this.js"),o=A("./node_modules/core-js/internals/is-pure.js"),a=A("./node_modules/core-js/internals/descriptors.js"),l=A("./node_modules/core-js/internals/symbol-constructor-detection.js"),c=A("./node_modules/core-js/internals/fails.js"),u=A("./node_modules/core-js/internals/has-own-property.js"),h=A("./node_modules/core-js/internals/object-is-prototype-of.js"),d=A("./node_modules/core-js/internals/an-object.js"),f=A("./node_modules/core-js/internals/to-indexed-object.js"),p=A("./node_modules/core-js/internals/to-property-key.js"),g=A("./node_modules/core-js/internals/to-string.js"),m=A("./node_modules/core-js/internals/create-property-descriptor.js"),w=A("./node_modules/core-js/internals/object-create.js"),B=A("./node_modules/core-js/internals/object-keys.js"),y=A("./node_modules/core-js/internals/object-get-own-property-names.js"),v=A("./node_modules/core-js/internals/object-get-own-property-names-external.js"),b=A("./node_modules/core-js/internals/object-get-own-property-symbols.js"),C=A("./node_modules/core-js/internals/object-get-own-property-descriptor.js"),_=A("./node_modules/core-js/internals/object-define-property.js"),j=A("./node_modules/core-js/internals/object-define-properties.js"),x=A("./node_modules/core-js/internals/object-property-is-enumerable.js"),F=A("./node_modules/core-js/internals/define-built-in.js"),Q=A("./node_modules/core-js/internals/define-built-in-accessor.js"),U=A("./node_modules/core-js/internals/shared.js"),E=A("./node_modules/core-js/internals/shared-key.js"),S=A("./node_modules/core-js/internals/hidden-keys.js"),L=A("./node_modules/core-js/internals/uid.js"),I=A("./node_modules/core-js/internals/well-known-symbol.js"),N=A("./node_modules/core-js/internals/well-known-symbol-wrapped.js"),k=A("./node_modules/core-js/internals/well-known-symbol-define.js"),H=A("./node_modules/core-js/internals/symbol-define-to-primitive.js"),P=A("./node_modules/core-js/internals/set-to-string-tag.js"),T=A("./node_modules/core-js/internals/internal-state.js"),O=A("./node_modules/core-js/internals/array-iteration.js").forEach,M=E("hidden"),D="Symbol",R="prototype",K=T.set,V=T.getterFor(D),G=Object[R],z=n.Symbol,q=z&&z[R],W=n.RangeError,X=n.TypeError,Y=n.QObject,J=C.f,Z=_.f,$=v.f,ee=x.f,te=i([].push),Ae=U("symbols"),re=U("op-symbols"),ne=U("wks"),se=!Y||!Y[R]||!Y[R].findChild,ie=function(e,t,A){var r=J(G,t);r&&delete G[t],Z(e,t,A),r&&e!==G&&Z(G,t,r)},oe=a&&c(function(){return 7!==w(Z({},"a",{get:function(){return Z(this,"a",{value:7}).a}})).a})?ie:Z,ae=function(e,t){var A=Ae[e]=w(q);return K(A,{type:D,tag:e,description:t}),a||(A.description=t),A},le=function(e,t,A){e===G&&le(re,t,A),d(e);var r=p(t);return d(A),u(Ae,r)?(A.enumerable?(u(e,M)&&e[M][r]&&(e[M][r]=!1),A=w(A,{enumerable:m(0,!1)})):(u(e,M)||Z(e,M,m(1,w(null))),e[M][r]=!0),oe(e,r,A)):Z(e,r,A)},ce=function(e,t){d(e);var A=f(t),r=B(A).concat(fe(A));return O(r,function(t){a&&!s(ue,A,t)||le(e,t,A[t])}),e},ue=function(e){var t=p(e),A=s(ee,this,t);return!(this===G&&u(Ae,t)&&!u(re,t))&&(!(A||!u(this,t)||!u(Ae,t)||u(this,M)&&this[M][t])||A)},he=function(e,t){var A=f(e),r=p(t);if(A!==G||!u(Ae,r)||u(re,r)){var n=J(A,r);return!n||!u(Ae,r)||u(A,M)&&A[M][r]||(n.enumerable=!0),n}},de=function(e){var t=$(f(e)),A=[];return O(t,function(e){u(Ae,e)||u(S,e)||te(A,e)}),A},fe=function(e){var t=e===G,A=$(t?re:f(e)),r=[];return O(A,function(e){!u(Ae,e)||t&&!u(G,e)||te(r,Ae[e])}),r};l||(z=function(){if(h(q,this))throw new X("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?g(arguments[0]):void 0,t=L(e),A=function(e){var r=void 0===this?n:this;r===G&&s(A,re,e),u(r,M)&&u(r[M],t)&&(r[M][t]=!1);var i=m(1,e);try{oe(r,t,i)}catch(e){if(!(e instanceof W))throw e;ie(r,t,i)}};return a&&se&&oe(G,t,{configurable:!0,set:A}),ae(t,e)},F(q=z[R],"toString",function(){return V(this).tag}),F(z,"withoutSetter",function(e){return ae(L(e),e)}),x.f=ue,_.f=le,j.f=ce,C.f=he,y.f=v.f=de,b.f=fe,N.f=function(e){return ae(I(e),e)},a&&(Q(q,"description",{configurable:!0,get:function(){return V(this).description}}),o||F(G,"propertyIsEnumerable",ue,{unsafe:!0}))),r({global:!0,constructor:!0,wrap:!0,forced:!l,sham:!l},{Symbol:z}),O(B(ne),function(e){k(e)}),r({target:D,stat:!0,forced:!l},{useSetter:function(){se=!0},useSimple:function(){se=!1}}),r({target:"Object",stat:!0,forced:!l,sham:!a},{create:function(e,t){return void 0===t?w(e):ce(w(e),t)},defineProperty:le,defineProperties:ce,getOwnPropertyDescriptor:he}),r({target:"Object",stat:!0,forced:!l},{getOwnPropertyNames:de}),H(),P(z,D),S[M]=!0},"./node_modules/core-js/modules/es.symbol.description.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/descriptors.js"),s=A("./node_modules/core-js/internals/global-this.js"),i=A("./node_modules/core-js/internals/function-uncurry-this.js"),o=A("./node_modules/core-js/internals/has-own-property.js"),a=A("./node_modules/core-js/internals/is-callable.js"),l=A("./node_modules/core-js/internals/object-is-prototype-of.js"),c=A("./node_modules/core-js/internals/to-string.js"),u=A("./node_modules/core-js/internals/define-built-in-accessor.js"),h=A("./node_modules/core-js/internals/copy-constructor-properties.js"),d=s.Symbol,f=d&&d.prototype;if(n&&a(d)&&(!("description"in f)||void 0!==d().description)){var p={},g=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:c(arguments[0]),t=l(f,this)?new d(e):void 0===e?d():d(e);return""===e&&(p[t]=!0),t};h(g,d),g.prototype=f,f.constructor=g;var m="Symbol(description detection)"===String(d("description detection")),w=i(f.valueOf),B=i(f.toString),y=/^Symbol\((.*)\)[^)]+$/,v=i("".replace),b=i("".slice);u(f,"description",{configurable:!0,get:function(){var e=w(this);if(o(p,e))return"";var t=B(e),A=m?b(t,7,-1):v(t,y,"$1");return""===A?void 0:A}}),r({global:!0,constructor:!0,forced:!0},{Symbol:g})}},"./node_modules/core-js/modules/es.symbol.for.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/get-built-in.js"),s=A("./node_modules/core-js/internals/has-own-property.js"),i=A("./node_modules/core-js/internals/to-string.js"),o=A("./node_modules/core-js/internals/shared.js"),a=A("./node_modules/core-js/internals/symbol-registry-detection.js"),l=o("string-to-symbol-registry"),c=o("symbol-to-string-registry");r({target:"Symbol",stat:!0,forced:!a},{for:function(e){var t=i(e);if(s(l,t))return l[t];var A=n("Symbol")(t);return l[t]=A,c[A]=t,A}})},"./node_modules/core-js/modules/es.symbol.iterator.js":function(e,t,A){"use strict";A("./node_modules/core-js/internals/well-known-symbol-define.js")("iterator")},"./node_modules/core-js/modules/es.symbol.js":function(e,t,A){"use strict";A("./node_modules/core-js/modules/es.symbol.constructor.js"),A("./node_modules/core-js/modules/es.symbol.for.js"),A("./node_modules/core-js/modules/es.symbol.key-for.js"),A("./node_modules/core-js/modules/es.json.stringify.js"),A("./node_modules/core-js/modules/es.object.get-own-property-symbols.js")},"./node_modules/core-js/modules/es.symbol.key-for.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/has-own-property.js"),s=A("./node_modules/core-js/internals/is-symbol.js"),i=A("./node_modules/core-js/internals/try-to-string.js"),o=A("./node_modules/core-js/internals/shared.js"),a=A("./node_modules/core-js/internals/symbol-registry-detection.js"),l=o("symbol-to-string-registry");r({target:"Symbol",stat:!0,forced:!a},{keyFor:function(e){if(!s(e))throw new TypeError(i(e)+" is not a symbol");if(n(l,e))return l[e]}})},"./node_modules/core-js/modules/esnext.iterator.constructor.js":function(e,t,A){"use strict";A("./node_modules/core-js/modules/es.iterator.constructor.js")},"./node_modules/core-js/modules/esnext.iterator.for-each.js":function(e,t,A){"use strict";A("./node_modules/core-js/modules/es.iterator.for-each.js")},"./node_modules/core-js/modules/esnext.iterator.map.js":function(e,t,A){"use strict";A("./node_modules/core-js/modules/es.iterator.map.js")},"./node_modules/core-js/modules/esnext.set.add-all.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/a-set.js"),s=A("./node_modules/core-js/internals/set-helpers.js").add;r({target:"Set",proto:!0,real:!0,forced:!0},{addAll:function(){for(var e=n(this),t=0,A=arguments.length;t1?arguments[1]:void 0);return!1!==i(t,function(e){if(!A(e,e,t))return!1},!0)}})},"./node_modules/core-js/modules/esnext.set.filter.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-bind-context.js"),s=A("./node_modules/core-js/internals/a-set.js"),i=A("./node_modules/core-js/internals/set-helpers.js"),o=A("./node_modules/core-js/internals/set-iterate.js"),a=i.Set,l=i.add;r({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=s(this),A=n(e,arguments.length>1?arguments[1]:void 0),r=new a;return o(t,function(e){A(e,e,t)&&l(r,e)}),r}})},"./node_modules/core-js/modules/esnext.set.find.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-bind-context.js"),s=A("./node_modules/core-js/internals/a-set.js"),i=A("./node_modules/core-js/internals/set-iterate.js");r({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=s(this),A=n(e,arguments.length>1?arguments[1]:void 0),r=i(t,function(e){if(A(e,e,t))return{value:e}},!0);return r&&r.value}})},"./node_modules/core-js/modules/esnext.set.intersection.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/to-set-like.js"),i=A("./node_modules/core-js/internals/set-intersection.js");r({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){return n(i,this,s(e))}})},"./node_modules/core-js/modules/esnext.set.is-disjoint-from.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/to-set-like.js"),i=A("./node_modules/core-js/internals/set-is-disjoint-from.js");r({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){return n(i,this,s(e))}})},"./node_modules/core-js/modules/esnext.set.is-subset-of.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/to-set-like.js"),i=A("./node_modules/core-js/internals/set-is-subset-of.js");r({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){return n(i,this,s(e))}})},"./node_modules/core-js/modules/esnext.set.is-superset-of.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/to-set-like.js"),i=A("./node_modules/core-js/internals/set-is-superset-of.js");r({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){return n(i,this,s(e))}})},"./node_modules/core-js/modules/esnext.set.join.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-uncurry-this.js"),s=A("./node_modules/core-js/internals/a-set.js"),i=A("./node_modules/core-js/internals/set-iterate.js"),o=A("./node_modules/core-js/internals/to-string.js"),a=n([].join),l=n([].push);r({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=s(this),A=void 0===e?",":o(e),r=[];return i(t,function(e){l(r,e)}),a(r,A)}})},"./node_modules/core-js/modules/esnext.set.map.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-bind-context.js"),s=A("./node_modules/core-js/internals/a-set.js"),i=A("./node_modules/core-js/internals/set-helpers.js"),o=A("./node_modules/core-js/internals/set-iterate.js"),a=i.Set,l=i.add;r({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=s(this),A=n(e,arguments.length>1?arguments[1]:void 0),r=new a;return o(t,function(e){l(r,A(e,e,t))}),r}})},"./node_modules/core-js/modules/esnext.set.reduce.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/a-callable.js"),s=A("./node_modules/core-js/internals/a-set.js"),i=A("./node_modules/core-js/internals/set-iterate.js"),o=TypeError;r({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=s(this),A=arguments.length<2,r=A?void 0:arguments[1];if(n(e),i(t,function(n){A?(A=!1,r=n):r=e(r,n,n,t)}),A)throw new o("Reduce of empty set with no initial value");return r}})},"./node_modules/core-js/modules/esnext.set.some.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-bind-context.js"),s=A("./node_modules/core-js/internals/a-set.js"),i=A("./node_modules/core-js/internals/set-iterate.js");r({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=s(this),A=n(e,arguments.length>1?arguments[1]:void 0);return!0===i(t,function(e){if(A(e,e,t))return!0},!0)}})},"./node_modules/core-js/modules/esnext.set.symmetric-difference.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/to-set-like.js"),i=A("./node_modules/core-js/internals/set-symmetric-difference.js");r({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){return n(i,this,s(e))}})},"./node_modules/core-js/modules/esnext.set.union.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/function-call.js"),s=A("./node_modules/core-js/internals/to-set-like.js"),i=A("./node_modules/core-js/internals/set-union.js");r({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){return n(i,this,s(e))}})},"./node_modules/core-js/modules/web.dom-collections.for-each.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js"),n=A("./node_modules/core-js/internals/dom-iterables.js"),s=A("./node_modules/core-js/internals/dom-token-list-prototype.js"),i=A("./node_modules/core-js/internals/array-for-each.js"),o=A("./node_modules/core-js/internals/create-non-enumerable-property.js"),a=function(e){if(e&&e.forEach!==i)try{o(e,"forEach",i)}catch(t){e.forEach=i}};for(var l in n)n[l]&&a(r[l]&&r[l].prototype);a(s)},"./node_modules/core-js/modules/web.dom-collections.iterator.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/global-this.js"),n=A("./node_modules/core-js/internals/dom-iterables.js"),s=A("./node_modules/core-js/internals/dom-token-list-prototype.js"),i=A("./node_modules/core-js/modules/es.array.iterator.js"),o=A("./node_modules/core-js/internals/create-non-enumerable-property.js"),a=A("./node_modules/core-js/internals/set-to-string-tag.js"),l=A("./node_modules/core-js/internals/well-known-symbol.js")("iterator"),c=i.values,u=function(e,t){if(e){if(e[l]!==c)try{o(e,l,c)}catch(t){e[l]=c}if(a(e,t,!0),n[t])for(var A in i)if(e[A]!==i[A])try{o(e,A,i[A])}catch(t){e[A]=i[A]}}};for(var h in n)u(r[h]&&r[h].prototype,h);u(s,"DOMTokenList")},"./node_modules/core-js/modules/web.set-interval.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/global-this.js"),s=A("./node_modules/core-js/internals/schedulers-fix.js")(n.setInterval,!0);r({global:!0,bind:!0,forced:n.setInterval!==s},{setInterval:s})},"./node_modules/core-js/modules/web.set-timeout.js":function(e,t,A){"use strict";var r=A("./node_modules/core-js/internals/export.js"),n=A("./node_modules/core-js/internals/global-this.js"),s=A("./node_modules/core-js/internals/schedulers-fix.js")(n.setTimeout,!0);r({global:!0,bind:!0,forced:n.setTimeout!==s},{setTimeout:s})},"./node_modules/core-js/modules/web.timers.js":function(e,t,A){"use strict";A("./node_modules/core-js/modules/web.set-interval.js"),A("./node_modules/core-js/modules/web.set-timeout.js")},"./node_modules/dompurify/dist/purify.es.mjs":function(e,t,A){"use strict";A.r(t),A.d(t,{default:function(){return Ae}});const{entries:r,setPrototypeOf:n,isFrozen:s,getPrototypeOf:i,getOwnPropertyDescriptor:o}=Object;let{freeze:a,seal:l,create:c}=Object,{apply:u,construct:h}="undefined"!=typeof Reflect&&Reflect;a||(a=function(e){return e}),l||(l=function(e){return e}),u||(u=function(e,t){for(var A=arguments.length,r=new Array(A>2?A-2:0),n=2;n1?t-1:0),r=1;r1?A-1:0),n=1;n2&&void 0!==arguments[2]?arguments[2]:w;n&&n(e,null);let r=t.length;for(;r--;){let n=t[r];if("string"==typeof n){const e=A(n);e!==n&&(s(t)||(t[r]=e),n=e)}e[n]=!0}return e}function E(e){for(let t=0;t/gm),z=l(/\$\{[\w\W]*/gm),q=l(/^data-[\-\w.\u00B7-\uFFFF]+$/),W=l(/^aria-[\-\w]+$/),X=l(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Y=l(/^(?:\w+script|data):/i),J=l(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Z=l(/^html$/i),$=l(/^[a-z][.\w]*(-[.\w]+)+$/i);var ee=Object.freeze({__proto__:null,ARIA_ATTR:W,ATTR_WHITESPACE:J,CUSTOM_ELEMENT:$,DATA_ATTR:q,DOCTYPE_NAME:Z,ERB_EXPR:G,IS_ALLOWED_URI:X,IS_SCRIPT_OR_DATA:Y,MUSTACHE_EXPR:V,TMPLIT_EXPR:z});const te=function(){return"undefined"==typeof window?null:window};var Ae=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:te();const A=t=>e(t);if(A.version="3.3.1",A.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return A.isSupported=!1,A;let{document:n}=t;const s=n,i=s.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:u,Element:h,NodeFilter:F,NamedNodeMap:Q=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:E,DOMParser:V,trustedTypes:G}=t,z=h.prototype,q=L(z,"cloneNode"),W=L(z,"remove"),Y=L(z,"nextSibling"),J=L(z,"childNodes"),$=L(z,"parentNode");if("function"==typeof l){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let Ae,re="";const{implementation:ne,createNodeIterator:se,createDocumentFragment:ie,getElementsByTagName:oe}=n,{importNode:ae}=s;let le={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};A.isSupported="function"==typeof r&&"function"==typeof $&&ne&&void 0!==ne.createHTMLDocument;const{MUSTACHE_EXPR:ce,ERB_EXPR:ue,TMPLIT_EXPR:he,DATA_ATTR:de,ARIA_ATTR:fe,IS_SCRIPT_OR_DATA:pe,ATTR_WHITESPACE:ge,CUSTOM_ELEMENT:me}=ee;let{IS_ALLOWED_URI:we}=ee,Be=null;const ye=U({},[...I,...N,...k,...P,...O]);let ve=null;const be=U({},[...M,...D,...R,...K]);let Ce=Object.seal(c(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),_e=null,je=null;const xe=Object.seal(c(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,Qe=!0,Ue=!1,Ee=!0,Se=!1,Le=!0,Ie=!1,Ne=!1,ke=!1,He=!1,Pe=!1,Te=!1,Oe=!0,Me=!1,De=!0,Re=!1,Ke={},Ve=null;const Ge=U({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ze=null;const qe=U({},["audio","video","img","source","image","track"]);let We=null;const Xe=U({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ye="http://www.w3.org/1998/Math/MathML",Je="http://www.w3.org/2000/svg",Ze="http://www.w3.org/1999/xhtml";let $e=Ze,et=!1,tt=null;const At=U({},[Ye,Je,Ze],B);let rt=U({},["mi","mo","mn","ms","mtext"]),nt=U({},["annotation-xml"]);const st=U({},["title","style","font","a","script"]);let it=null;const ot=["application/xhtml+xml","text/html"];let at=null,lt=null;const ct=n.createElement("form"),ut=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!lt||lt!==e){if(e&&"object"==typeof e||(e={}),e=S(e),it=-1===ot.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,at="application/xhtml+xml"===it?B:w,Be=_(e,"ALLOWED_TAGS")?U({},e.ALLOWED_TAGS,at):ye,ve=_(e,"ALLOWED_ATTR")?U({},e.ALLOWED_ATTR,at):be,tt=_(e,"ALLOWED_NAMESPACES")?U({},e.ALLOWED_NAMESPACES,B):At,We=_(e,"ADD_URI_SAFE_ATTR")?U(S(Xe),e.ADD_URI_SAFE_ATTR,at):Xe,ze=_(e,"ADD_DATA_URI_TAGS")?U(S(qe),e.ADD_DATA_URI_TAGS,at):qe,Ve=_(e,"FORBID_CONTENTS")?U({},e.FORBID_CONTENTS,at):Ge,_e=_(e,"FORBID_TAGS")?U({},e.FORBID_TAGS,at):S({}),je=_(e,"FORBID_ATTR")?U({},e.FORBID_ATTR,at):S({}),Ke=!!_(e,"USE_PROFILES")&&e.USE_PROFILES,Fe=!1!==e.ALLOW_ARIA_ATTR,Qe=!1!==e.ALLOW_DATA_ATTR,Ue=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ee=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Se=e.SAFE_FOR_TEMPLATES||!1,Le=!1!==e.SAFE_FOR_XML,Ie=e.WHOLE_DOCUMENT||!1,He=e.RETURN_DOM||!1,Pe=e.RETURN_DOM_FRAGMENT||!1,Te=e.RETURN_TRUSTED_TYPE||!1,ke=e.FORCE_BODY||!1,Oe=!1!==e.SANITIZE_DOM,Me=e.SANITIZE_NAMED_PROPS||!1,De=!1!==e.KEEP_CONTENT,Re=e.IN_PLACE||!1,we=e.ALLOWED_URI_REGEXP||X,$e=e.NAMESPACE||Ze,rt=e.MATHML_TEXT_INTEGRATION_POINTS||rt,nt=e.HTML_INTEGRATION_POINTS||nt,Ce=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ut(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ce.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ut(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ce.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ce.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Se&&(Qe=!1),Pe&&(He=!0),Ke&&(Be=U({},O),ve=[],!0===Ke.html&&(U(Be,I),U(ve,M)),!0===Ke.svg&&(U(Be,N),U(ve,D),U(ve,K)),!0===Ke.svgFilters&&(U(Be,k),U(ve,D),U(ve,K)),!0===Ke.mathMl&&(U(Be,P),U(ve,R),U(ve,K))),e.ADD_TAGS&&("function"==typeof e.ADD_TAGS?xe.tagCheck=e.ADD_TAGS:(Be===ye&&(Be=S(Be)),U(Be,e.ADD_TAGS,at))),e.ADD_ATTR&&("function"==typeof e.ADD_ATTR?xe.attributeCheck=e.ADD_ATTR:(ve===be&&(ve=S(ve)),U(ve,e.ADD_ATTR,at))),e.ADD_URI_SAFE_ATTR&&U(We,e.ADD_URI_SAFE_ATTR,at),e.FORBID_CONTENTS&&(Ve===Ge&&(Ve=S(Ve)),U(Ve,e.FORBID_CONTENTS,at)),e.ADD_FORBID_CONTENTS&&(Ve===Ge&&(Ve=S(Ve)),U(Ve,e.ADD_FORBID_CONTENTS,at)),De&&(Be["#text"]=!0),Ie&&U(Be,["html","head","body"]),Be.table&&(U(Be,["tbody"]),delete _e.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw x('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw x('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');Ae=e.TRUSTED_TYPES_POLICY,re=Ae.createHTML("")}else void 0===Ae&&(Ae=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let A=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(A=t.getAttribute(r));const n="dompurify"+(A?"#"+A:"");try{return e.createPolicy(n,{createHTML(e){return e},createScriptURL(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(G,i)),null!==Ae&&"string"==typeof re&&(re=Ae.createHTML(""));a&&a(e),lt=e}},dt=U({},[...N,...k,...H]),ft=U({},[...P,...T]),pt=function(e){g(A.removed,{element:e});try{$(e).removeChild(e)}catch(t){W(e)}},gt=function(e,t){try{g(A.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){g(A.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(He||Pe)try{pt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},mt=function(e){let t=null,A=null;if(ke)e=""+e;else{const t=y(e,/^[\r\n\t ]+/);A=t&&t[0]}"application/xhtml+xml"===it&&$e===Ze&&(e=''+e+"");const r=Ae?Ae.createHTML(e):e;if($e===Ze)try{t=(new V).parseFromString(r,it)}catch(e){}if(!t||!t.documentElement){t=ne.createDocument($e,"template",null);try{t.documentElement.innerHTML=et?re:r}catch(e){}}const s=t.body||t.documentElement;return e&&A&&s.insertBefore(n.createTextNode(A),s.childNodes[0]||null),$e===Ze?oe.call(t,Ie?"html":"body")[0]:Ie?t.documentElement:s},wt=function(e){return se.call(e.ownerDocument||e,e,F.SHOW_ELEMENT|F.SHOW_COMMENT|F.SHOW_TEXT|F.SHOW_PROCESSING_INSTRUCTION|F.SHOW_CDATA_SECTION,null)},Bt=function(e){return e instanceof E&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof Q)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},yt=function(e){return"function"==typeof u&&e instanceof u};function vt(e,t,r){d(e,e=>{e.call(A,t,r,lt)})}const bt=function(e){let t=null;if(vt(le.beforeSanitizeElements,e,null),Bt(e))return pt(e),!0;const r=at(e.nodeName);if(vt(le.uponSanitizeElement,e,{tagName:r,allowedTags:Be}),Le&&e.hasChildNodes()&&!yt(e.firstElementChild)&&j(/<[/\w!]/g,e.innerHTML)&&j(/<[/\w!]/g,e.textContent))return pt(e),!0;if(7===e.nodeType)return pt(e),!0;if(Le&&8===e.nodeType&&j(/<[/\w]/g,e.data))return pt(e),!0;if(!(xe.tagCheck instanceof Function&&xe.tagCheck(r))&&(!Be[r]||_e[r])){if(!_e[r]&&_t(r)){if(Ce.tagNameCheck instanceof RegExp&&j(Ce.tagNameCheck,r))return!1;if(Ce.tagNameCheck instanceof Function&&Ce.tagNameCheck(r))return!1}if(De&&!Ve[r]){const t=$(e)||e.parentNode,A=J(e)||e.childNodes;if(A&&t)for(let r=A.length-1;r>=0;--r){const n=q(A[r],!0);n.__removalCount=(e.__removalCount||0)+1,t.insertBefore(n,Y(e))}}return pt(e),!0}return e instanceof h&&!function(e){let t=$(e);t&&t.tagName||(t={namespaceURI:$e,tagName:"template"});const A=w(e.tagName),r=w(t.tagName);return!!tt[e.namespaceURI]&&(e.namespaceURI===Je?t.namespaceURI===Ze?"svg"===A:t.namespaceURI===Ye?"svg"===A&&("annotation-xml"===r||rt[r]):Boolean(dt[A]):e.namespaceURI===Ye?t.namespaceURI===Ze?"math"===A:t.namespaceURI===Je?"math"===A&&nt[r]:Boolean(ft[A]):e.namespaceURI===Ze?!(t.namespaceURI===Je&&!nt[r])&&!(t.namespaceURI===Ye&&!rt[r])&&!ft[A]&&(st[A]||!dt[A]):!("application/xhtml+xml"!==it||!tt[e.namespaceURI]))}(e)?(pt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!j(/<\/no(script|embed|frames)/i,e.innerHTML)?(Se&&3===e.nodeType&&(t=e.textContent,d([ce,ue,he],e=>{t=v(t,e," ")}),e.textContent!==t&&(g(A.removed,{element:e.cloneNode()}),e.textContent=t)),vt(le.afterSanitizeElements,e,null),!1):(pt(e),!0)},Ct=function(e,t,A){if(Oe&&("id"===t||"name"===t)&&(A in n||A in ct))return!1;if(Qe&&!je[t]&&j(de,t));else if(Fe&&j(fe,t));else if(xe.attributeCheck instanceof Function&&xe.attributeCheck(t,e));else if(!ve[t]||je[t]){if(!(_t(e)&&(Ce.tagNameCheck instanceof RegExp&&j(Ce.tagNameCheck,e)||Ce.tagNameCheck instanceof Function&&Ce.tagNameCheck(e))&&(Ce.attributeNameCheck instanceof RegExp&&j(Ce.attributeNameCheck,t)||Ce.attributeNameCheck instanceof Function&&Ce.attributeNameCheck(t,e))||"is"===t&&Ce.allowCustomizedBuiltInElements&&(Ce.tagNameCheck instanceof RegExp&&j(Ce.tagNameCheck,A)||Ce.tagNameCheck instanceof Function&&Ce.tagNameCheck(A))))return!1}else if(We[t]);else if(j(we,v(A,ge,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==b(A,"data:")||!ze[e])if(Ue&&!j(pe,v(A,ge,"")));else if(A)return!1;return!0},_t=function(e){return"annotation-xml"!==e&&y(e,me)},jt=function(e){vt(le.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Bt(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ve,forceKeepAttr:void 0};let n=t.length;for(;n--;){const s=t[n],{name:i,namespaceURI:o,value:a}=s,l=at(i),c=a;let u="value"===i?c:C(c);if(r.attrName=l,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,vt(le.uponSanitizeAttribute,e,r),u=r.attrValue,!Me||"id"!==l&&"name"!==l||(gt(i,e),u="user-content-"+u),Le&&j(/((--!?|])>)|<\/(style|title|textarea)/i,u)){gt(i,e);continue}if("attributename"===l&&y(u,"href")){gt(i,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){gt(i,e);continue}if(!Ee&&j(/\/>/i,u)){gt(i,e);continue}Se&&d([ce,ue,he],e=>{u=v(u,e," ")});const h=at(e.nodeName);if(Ct(h,l,u)){if(Ae&&"object"==typeof G&&"function"==typeof G.getAttributeType)if(o);else switch(G.getAttributeType(h,l)){case"TrustedHTML":u=Ae.createHTML(u);break;case"TrustedScriptURL":u=Ae.createScriptURL(u)}if(u!==c)try{o?e.setAttributeNS(o,i,u):e.setAttribute(i,u),Bt(e)?pt(e):p(A.removed)}catch(t){gt(i,e)}}else gt(i,e)}vt(le.afterSanitizeAttributes,e,null)},xt=function e(t){let A=null;const r=wt(t);for(vt(le.beforeSanitizeShadowDOM,t,null);A=r.nextNode();)vt(le.uponSanitizeShadowNode,A,null),bt(A),jt(A),A.content instanceof o&&e(A.content);vt(le.afterSanitizeShadowDOM,t,null)};return A.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,n=null,i=null,a=null;if(et=!e,et&&(e="\x3c!--\x3e"),"string"!=typeof e&&!yt(e)){if("function"!=typeof e.toString)throw x("toString is not a function");if("string"!=typeof(e=e.toString()))throw x("dirty is not a string, aborting")}if(!A.isSupported)return e;if(Ne||ht(t),A.removed=[],"string"==typeof e&&(Re=!1),Re){if(e.nodeName){const t=at(e.nodeName);if(!Be[t]||_e[t])throw x("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof u)r=mt("\x3c!----\x3e"),n=r.ownerDocument.importNode(e,!0),1===n.nodeType&&"BODY"===n.nodeName||"HTML"===n.nodeName?r=n:r.appendChild(n);else{if(!He&&!Se&&!Ie&&-1===e.indexOf("<"))return Ae&&Te?Ae.createHTML(e):e;if(r=mt(e),!r)return He?null:Te?re:""}r&&ke&&pt(r.firstChild);const l=wt(Re?e:r);for(;i=l.nextNode();)bt(i),jt(i),i.content instanceof o&&xt(i.content);if(Re)return e;if(He){if(Pe)for(a=ie.call(r.ownerDocument);r.firstChild;)a.appendChild(r.firstChild);else a=r;return(ve.shadowroot||ve.shadowrootmode)&&(a=ae.call(s,a,!0)),a}let c=Ie?r.outerHTML:r.innerHTML;return Ie&&Be["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&j(Z,r.ownerDocument.doctype.name)&&(c="\n"+c),Se&&d([ce,ue,he],e=>{c=v(c,e," ")}),Ae&&Te?Ae.createHTML(c):c},A.setConfig=function(){ht(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),Ne=!0},A.clearConfig=function(){lt=null,Ne=!1},A.isValidAttribute=function(e,t,A){lt||ht({});const r=at(e),n=at(t);return Ct(r,n,A)},A.addHook=function(e,t){"function"==typeof t&&g(le[e],t)},A.removeHook=function(e,t){if(void 0!==t){const A=f(le[e],t);return-1===A?void 0:m(le[e],A,1)[0]}return p(le[e])},A.removeHooks=function(e){le[e]=[]},A.removeAllHooks=function(){le={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},A}()},"./node_modules/fast-png/lib-esm/PngDecoder.js":function(e,t,A){"use strict";A.r(t),A.d(t,{default:function(){return u}});var r=A("./node_modules/iobuffer/lib-esm/IOBuffer.js"),n=A("./node_modules/pako/dist/pako.esm.mjs"),s=A("./node_modules/fast-png/lib-esm/helpers/crc.js"),i=A("./node_modules/fast-png/lib-esm/helpers/decodeInterlaceAdam7.js"),o=A("./node_modules/fast-png/lib-esm/helpers/decodeInterlaceNull.js"),a=A("./node_modules/fast-png/lib-esm/helpers/signature.js"),l=A("./node_modules/fast-png/lib-esm/helpers/text.js"),c=A("./node_modules/fast-png/lib-esm/internalTypes.js");class u extends r.IOBuffer{_checkCrc;_inflator;_png;_apng;_end;_hasPalette;_palette;_hasTransparency;_transparency;_compressionMethod;_filterMethod;_interlaceMethod;_colorType;_isAnimated;_numberOfFrames;_numberOfPlays;_frames;_writingDataChunks;constructor(e,t={}){super(e);const{checkCrc:A=!1}=t;this._checkCrc=A,this._inflator=new n.Inflate,this._png={width:-1,height:-1,channels:-1,data:new Uint8Array(0),depth:1,text:{}},this._apng={width:-1,height:-1,channels:-1,depth:1,numberOfFrames:1,numberOfPlays:0,text:{},frames:[]},this._end=!1,this._hasPalette=!1,this._palette=[],this._hasTransparency=!1,this._transparency=new Uint16Array(0),this._compressionMethod=c.CompressionMethod.UNKNOWN,this._filterMethod=c.FilterMethod.UNKNOWN,this._interlaceMethod=c.InterlaceMethod.UNKNOWN,this._colorType=c.ColorType.UNKNOWN,this._isAnimated=!1,this._numberOfFrames=1,this._numberOfPlays=0,this._frames=[],this._writingDataChunks=!1,this.setBigEndian()}decode(){for((0,a.checkSignature)(this);!this._end;){const e=this.readUint32(),t=this.readChars(4);this.decodeChunk(e,t)}return this.decodeImage(),this._png}decodeApng(){for((0,a.checkSignature)(this);!this._end;){const e=this.readUint32(),t=this.readChars(4);this.decodeApngChunk(e,t)}return this.decodeApngImage(),this._apng}decodeChunk(e,t){const A=this.offset;switch(t){case"IHDR":this.decodeIHDR();break;case"PLTE":this.decodePLTE(e);break;case"IDAT":this.decodeIDAT(e);break;case"IEND":this._end=!0;break;case"tRNS":this.decodetRNS(e);break;case"iCCP":this.decodeiCCP(e);break;case l.textChunkName:(0,l.decodetEXt)(this._png.text,this,e);break;case"pHYs":this.decodepHYs();break;default:this.skip(e)}if(this.offset-A!==e)throw new Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?(0,s.checkCrc)(this,e+4,t):this.skip(4)}decodeApngChunk(e,t){const A=this.offset;switch("fdAT"!==t&&"IDAT"!==t&&this._writingDataChunks&&this.pushDataToFrame(),t){case"acTL":this.decodeACTL();break;case"fcTL":this.decodeFCTL();break;case"fdAT":this.decodeFDAT(e);break;default:this.decodeChunk(e,t),this.offset=A+e}if(this.offset-A!==e)throw new Error(`Length mismatch while decoding chunk ${t}`);this._checkCrc?(0,s.checkCrc)(this,e+4,t):this.skip(4)}decodeIHDR(){const e=this._png;e.width=this.readUint32(),e.height=this.readUint32(),e.depth=function(e){if(1!==e&&2!==e&&4!==e&&8!==e&&16!==e)throw new Error(`invalid bit depth: ${e}`);return e}(this.readUint8());const t=this.readUint8();let A;switch(this._colorType=t,t){case c.ColorType.GREYSCALE:A=1;break;case c.ColorType.TRUECOLOUR:A=3;break;case c.ColorType.INDEXED_COLOUR:A=1;break;case c.ColorType.GREYSCALE_ALPHA:A=2;break;case c.ColorType.TRUECOLOUR_ALPHA:A=4;break;case c.ColorType.UNKNOWN:default:throw new Error(`Unknown color type: ${t}`)}if(this._png.channels=A,this._compressionMethod=this.readUint8(),this._compressionMethod!==c.CompressionMethod.DEFLATE)throw new Error(`Unsupported compression method: ${this._compressionMethod}`);this._filterMethod=this.readUint8(),this._interlaceMethod=this.readUint8()}decodeACTL(){this._numberOfFrames=this.readUint32(),this._numberOfPlays=this.readUint32(),this._isAnimated=!0}decodeFCTL(){const e={sequenceNumber:this.readUint32(),width:this.readUint32(),height:this.readUint32(),xOffset:this.readUint32(),yOffset:this.readUint32(),delayNumber:this.readUint16(),delayDenominator:this.readUint16(),disposeOp:this.readUint8(),blendOp:this.readUint8(),data:new Uint8Array(0)};this._frames.push(e)}decodePLTE(e){if(e%3!=0)throw new RangeError(`PLTE field length must be a multiple of 3. Got ${e}`);const t=e/3;this._hasPalette=!0;const A=[];this._palette=A;for(let e=0;ethis._png.width*this._png.height)throw new Error(`tRNS chunk contains more alpha values than there are pixels (${e/2} vs ${this._png.width*this._png.height})`);this._hasTransparency=!0,this._transparency=new Uint16Array(e/2);for(let t=0;tthis._palette.length)throw new Error(`tRNS chunk contains more alpha values than there are palette colors (${e} vs ${this._palette.length})`);let t=0;for(;t({index:((e+t.yOffset)*this._png.width+t.xOffset+A)*this._png.channels,frameIndex:(e*t.width+A)*this._png.channels});switch(t.blendOp){case c.BlendOpType.SOURCE:for(let A=0;A255!==e.at(-1));this.writeUint32(e.length),this.writeChars("tRNS");for(const t of e)this.writeByte(t.at(-1));(0,s.writeCrc)(this,4+e.length)}encodeIDAT(e){this.writeUint32(e.length),this.writeChars("IDAT"),this.writeBytes(e),(0,s.writeCrc)(this,e.length+4)}encodeData(){const{width:e,height:t,channels:A,depth:s,data:i}=this._png,o=s<=8?Math.ceil(e*s/8)*A:Math.ceil(e*s/8*A/2),l=(new r.IOBuffer).setBigEndian();let c=0;if(this._interlaceMethod===a.InterlaceMethod.NO_INTERLACE)for(let e=0;e>8&255),A.writeByte(255&e)}}return r}(this._png,i,l,c));const u=l.toArray(),f=(0,n.deflate)(u,this._zlibOptions);this.encodeIDAT(f)}_checkData(e){const{colorType:t,channels:A,depth:r}=function(e,t){const{channels:A=4,depth:r=8}=e;if(4!==A&&3!==A&&2!==A&&1!==A)throw new RangeError(`unsupported number of channels: ${A}`);const n={channels:A,depth:r,colorType:a.ColorType.UNKNOWN};switch(A){case 4:n.colorType=a.ColorType.TRUECOLOUR_ALPHA;break;case 3:n.colorType=a.ColorType.TRUECOLOUR;break;case 1:n.colorType=t?a.ColorType.INDEXED_COLOUR:a.ColorType.GREYSCALE;break;case 2:n.colorType=a.ColorType.GREYSCALE_ALPHA;break;default:throw new Error("unsupported number of channels")}return n}(e,e.palette),n={width:u(e.width,"width"),height:u(e.height,"height"),channels:A,data:e.data,depth:r,text:e.text,palette:e.palette};this._colorType=t;const s=r<8?Math.ceil(n.width*r/8)*n.height*A:n.width*n.height*A;if(n.data.length!==s)throw new RangeError(`wrong data size. Found ${n.data.length}, expected ${s}`);return n}}function u(e,t){if(Number.isInteger(e)&&e>0)return e;throw new TypeError(`${t} must be a positive integer`)}function h(e,t,A,r){for(let n=0;n>n,r>>=A,i%e.width!==0););}if(e.palette)for(const t of a){const A=e.palette.at(t);if(!A)throw new Error("Incorrect index of palette color");s.set(A,o),o+=A.length}return s}A.r(t),A.d(t,{convertIndexedToRgb:function(){return r}})},"./node_modules/fast-png/lib-esm/helpers/applyUnfilter.js":function(e,t,A){"use strict";A.r(t),A.d(t,{applyUnfilter:function(){return n}});var r=A("./node_modules/fast-png/lib-esm/helpers/unfilter.js");function n(e,t,A,n,s,i){switch(e){case 0:(0,r.unfilterNone)(t,A,s);break;case 1:(0,r.unfilterSub)(t,A,s,i);break;case 2:(0,r.unfilterUp)(t,A,n,s);break;case 3:(0,r.unfilterAverage)(t,A,n,s,i);break;case 4:(0,r.unfilterPaeth)(t,A,n,s,i);break;default:throw new Error(`Unsupported filter: ${e}`)}}},"./node_modules/fast-png/lib-esm/helpers/crc.js":function(e,t,A){"use strict";A.r(t),A.d(t,{checkCrc:function(){return i},writeCrc:function(){return o}});const r=[];for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)1&t?t=3988292384^t>>>1:t>>>=1;r[e]=t}const n=4294967295;function s(e,t){return(function(e,t,A){let n=e;for(let e=0;e>>8;return n}(n,e,t)^n)>>>0}function i(e,t,A){const r=e.readUint32(),n=s(new Uint8Array(e.buffer,e.byteOffset+e.offset-t-4,t),t);if(n!==r)throw new Error(`CRC mismatch for chunk ${A}. Expected ${r}, found ${n}`)}function o(e,t){e.writeUint32(s(new Uint8Array(e.buffer,e.byteOffset+e.offset-t,t),t))}},"./node_modules/fast-png/lib-esm/helpers/decodeInterlaceAdam7.js":function(e,t,A){"use strict";A.r(t),A.d(t,{decodeInterlaceAdam7:function(){return i}});var r=A("./node_modules/fast-png/lib-esm/helpers/applyUnfilter.js");const n=new Uint16Array([255]),s=255===new Uint8Array(n.buffer)[0];function i(e){const{data:t,width:A,height:n,channels:i,depth:a}=e,l=[{x:0,y:0,xStep:8,yStep:8},{x:4,y:0,xStep:8,yStep:8},{x:0,y:4,xStep:4,yStep:8},{x:2,y:0,xStep:4,yStep:4},{x:0,y:2,xStep:2,yStep:4},{x:1,y:0,xStep:2,yStep:2},{x:0,y:1,xStep:1,yStep:2}],c=Math.ceil(a/8)*i,u=new Uint8Array(n*A*c);let h=0;for(let e=0;e<7;e++){const s=l[e],i=Math.ceil((A-s.x)/s.xStep),o=Math.ceil((n-s.y)/s.yStep);if(i<=0||o<=0)continue;const a=i*c,d=new Uint8Array(a);for(let e=0;e=A||i>=n))for(let e=0;e>8&255}},"./node_modules/fast-png/lib-esm/helpers/decodeInterlaceNull.js":function(e,t,A){"use strict";A.r(t),A.d(t,{decodeInterlaceNull:function(){return o}});var r=A("./node_modules/fast-png/lib-esm/helpers/unfilter.js");const n=new Uint16Array([255]),s=255===new Uint8Array(n.buffer)[0],i=new Uint8Array(0);function o(e){const{data:t,width:A,height:n,channels:o,depth:l}=e,c=Math.ceil(l/8)*o,u=Math.ceil(l/8*o*A),h=new Uint8Array(n*u);let d,f,p=i,g=0;for(let e=0;e>8&255}},"./node_modules/fast-png/lib-esm/helpers/signature.js":function(e,t,A){"use strict";A.r(t),A.d(t,{checkSignature:function(){return s},hasPngSignature:function(){return i},writeSignature:function(){return n}});const r=Uint8Array.of(137,80,78,71,13,10,26,10);function n(e){e.writeBytes(r)}function s(e){if(!i(e.readBytes(r.length)))throw new Error("wrong PNG signature")}function i(e){if(e.length79)throw new Error("keyword length must be between 1 and 79")}const a=/^[\u0000-\u00FF]*$/;function l(e){if(!a.test(e))throw new Error("invalid latin1 text")}function c(e,t,A){const r=h(t);e[r]=d(t,A-r.length-1)}function u(e,t,A){o(t),l(A);const i=t.length+1+A.length;e.writeUint32(i),e.writeChars(n),e.writeChars(t),e.writeByte(s),e.writeChars(A),(0,r.writeCrc)(e,i+4)}function h(e){for(e.mark();e.readByte()!==s;);const t=e.offset;e.reset();const A=i.decode(e.readBytes(t-e.offset-1));return e.skip(1),o(A),A}function d(e,t){return i.decode(e.readBytes(t))}},"./node_modules/fast-png/lib-esm/helpers/unfilter.js":function(e,t,A){"use strict";function r(e,t,A){for(let r=0;r>1)&255}else{for(;s>1)&255;for(;s>1)&255}}function o(e,t,A,r,n){let s=0;if(0===A.length){for(;s>1|(21845&w)<<1;B=(61680&(B=(52428&B)>>2|(13107&B)<<2))>>4|(3855&B)<<4,m[w]=((65280&B)>>8|(255&B)<<8)>>1}var y=function(e,t,A){for(var r=e.length,n=0,i=new s(t);n>l]=c}else for(o=new s(r),n=0;n>15-e[n]);return o},v=new n(288);for(w=0;w<144;++w)v[w]=8;for(w=144;w<256;++w)v[w]=9;for(w=256;w<280;++w)v[w]=7;for(w=280;w<288;++w)v[w]=8;var b=new n(32);for(w=0;w<32;++w)b[w]=5;var C=y(v,9,0),_=y(v,9,1),j=y(b,5,0),x=y(b,5,1),F=function(e){for(var t=e[0],A=1;At&&(t=e[A]);return t},Q=function(e,t,A){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&A},U=function(e,t){var A=t/8|0;return(e[A]|e[A+1]<<8|e[A+2]<<16)>>(7&t)},E=function(e){return(e+7)/8|0},S=function(e,t,A){return(null==t||t<0)&&(t=0),(null==A||A>e.length)&&(A=e.length),new n(e.subarray(t,A))},L={UnexpectedEOF:0,InvalidBlockType:1,InvalidLengthLiteral:2,InvalidDistance:3,StreamFinished:4,NoStreamHandler:5,InvalidHeader:6,NoCallback:7,InvalidUTF8:8,ExtraFieldTooLong:9,InvalidDate:10,FilenameTooLong:11,StreamFinishing:12,InvalidZipData:13,UnknownCompressionMethod:14},I=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],N=function(e,t,A){var r=new Error(t||I[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,N),!A)throw r;return r},k=function(e,t,A,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return A||new n(0);var c=!A,u=c||2!=t.i,d=t.i;c&&(A=new n(3*s));var f=function(e){var t=A.length;if(e>t){var r=new n(Math.max(2*t,e));r.set(A),A=r}},g=t.f||0,m=t.p||0,w=t.b||0,B=t.l,v=t.d,b=t.m,C=t.n,j=8*s;do{if(!B){g=Q(e,m,1);var L=Q(e,m+1,3);if(m+=3,!L){var I=e[(G=E(m)+4)-4]|e[G-3]<<8,k=G+I;if(k>s){d&&N(0);break}u&&f(w+I),A.set(e.subarray(G,k),w),t.b=w+=I,t.p=m=8*k,t.f=g;continue}if(1==L)B=_,v=x,b=9,C=5;else if(2==L){var H=Q(e,m,31)+257,P=Q(e,m+10,15)+4,T=H+Q(e,m+5,31)+1;m+=14;for(var O=new n(T),M=new n(19),D=0;D>4)<16)O[D++]=G;else{var q=0,W=0;for(16==G?(W=3+Q(e,m,3),m+=2,q=O[D-1]):17==G?(W=3+Q(e,m,7),m+=3):18==G&&(W=11+Q(e,m,127),m+=7);W--;)O[D++]=q}}var X=O.subarray(0,H),Y=O.subarray(H);b=F(X),C=F(Y),B=y(X,b,1),v=y(Y,C,1)}else N(1);if(m>j){d&&N(0);break}}u&&f(w+131072);for(var J=(1<>4;if((m+=15&q)>j){d&&N(0);break}if(q||N(2),ee<256)A[w++]=ee;else{if(256==ee){$=m,B=null;break}var te=ee-254;if(ee>264){var Ae=o[D=ee-257];te=Q(e,m,(1<>4;if(re||N(3),m+=15&re,Y=p[ne],ne>3&&(Ae=a[ne],Y+=U(e,m)&(1<j){d&&N(0);break}u&&f(w+131072);var se=w+te;if(w>8},P=function(e,t,A){A<<=7&t;var r=t/8|0;e[r]|=A,e[r+1]|=A>>8,e[r+2]|=A>>16},T=function(e,t){for(var A=[],r=0;rf&&(f=o[r].s);var p=new s(f+1),g=O(A[h-1],p,0);if(g>t){r=0;var m=0,w=g-t,B=1<t))break;m+=B-(1<>=w;m>0;){var v=o[r].s;p[v]=0&&m;--r){var b=o[r].s;p[b]==t&&(--p[b],++m)}g=t}return{t:new n(p),l:g}},O=function(e,t,A){return-1==e.s?Math.max(O(e.l,t,A+1),O(e.r,t,A+1)):t[e.s]=A},M=function(e){for(var t=e.length;t&&!e[--t];);for(var A=new s(++t),r=0,n=e[0],i=1,o=function(e){A[r++]=e},a=1;a<=t;++a)if(e[a]==n&&a!=t)++i;else{if(!n&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(n),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(n);i=1,n=e[a]}return{c:A.subarray(0,r),n:t}},D=function(e,t){for(var A=0,r=0;r>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var s=0;s4&&!k[l[K-1]];--K);var V,G,z,q,W=d+5<<3,X=D(n,v)+D(i,b)+c,Y=D(n,g)+D(i,B)+c+14+3*K+D(L,k)+2*L[16]+3*L[17]+7*L[18];if(h>=0&&W<=X&&W<=Y)return R(t,f,e.subarray(h,h+d));if(H(t,f,1+(Y15&&(H(t,f,ee[I]>>5&127),f+=ee[I]>>12)}}}else V=C,G=v,z=j,q=b;for(I=0;I255){P(t,f,V[257+(te=Ae>>18&31)]),f+=G[te+257],te>7&&(H(t,f,Ae>>23&31),f+=o[te]);var re=31&Ae;P(t,f,z[re]),f+=q[re],re>3&&(P(t,f,Ae>>5&8191),f+=a[re])}else P(t,f,V[Ae]),f+=G[Ae]}return P(t,f,V[256]),f+G[256]},V=new i([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),G=new n(0),z=function(e,t,A,r,l,c){var u=c.z||e.length,h=new n(r+u+5*(1+Math.ceil(u/7e3))+l),f=h.subarray(r,h.length-l),p=c.l,m=7&(c.r||0);if(t){m&&(f[0]=c.r>>3);for(var w=V[t-1],B=w>>13,y=8191&w,v=(1<7e3||k>24576)&&(D>423||!p)){m=K(e,f,0,F,Q,U,I,k,P,N-P,m),k=L=I=0,P=N;for(var G=0;G<286;++G)Q[G]=0;for(G=0;G<30;++G)U[G]=0}var z=2,q=0,W=y,X=O-M&32767;if(D>2&&T==x(N-X))for(var Y=Math.min(B,D)-1,J=Math.min(32767,N),Z=Math.min(258,D);X<=J&&--W&&O!=M;){if(e[N+z]==e[N+z-X]){for(var $=0;$z){if(z=$,q=X,$>Y)break;var ee=Math.min(X,$-2),te=0;for(G=0;Gte&&(te=re,M=Ae)}}}X+=(O=M)-(M=b[O])&32767}if(q){F[k++]=268435456|d[z]<<18|g[q];var ne=31&d[z],se=31&g[q];I+=o[ne]+a[se],++Q[257+ne],++U[se],H=N+z,++L}else F[k++]=e[N],++Q[e[N]]}}for(N=Math.max(N,H);N=u&&(f[m/8|0]=p,ie=u),m=R(f,m+1,e.subarray(N,ie))}c.i=u}return S(h,0,r+E(m)+l)},q=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var A=t,r=9;--r;)A=(1&A&&-306674912)^A>>>1;e[t]=A}return e}(),W=function(){var e=-1;return{p:function(t){for(var A=e,r=0;r>>8;e=A},d:function(){return~e}}},X=function(){var e=1,t=0;return{p:function(A){for(var r=e,n=t,s=0|A.length,i=0;i!=s;){for(var o=Math.min(i+2655,s);i>16),n=(65535&n)+15*(n>>16)}e=r,t=n},d:function(){return(255&(e%=65521))<<24|(65280&e)<<8|(255&(t%=65521))<<8|t>>8}}},Y=function(e,t,A,r,s){if(!s&&(s={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new n(i.length+e.length);o.set(i),o.set(e,i.length),e=o,s.w=i.length}return z(e,null==t.level?6:t.level,null==t.mem?s.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,A,r,s)},J=function(e,t){var A={};for(var r in e)A[r]=e[r];for(var r in t)A[r]=t[r];return A},Z=function(e,t,A){for(var r=e(),n=e.toString(),s=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/\s+/g,"").split(","),i=0;i>>0},fe=function(e,t){return de(e,t)+4294967296*de(e,t+4)},pe=function(e,t,A){for(;A;++t)e[t]=A,A>>>=8},ge=function(e,t){var A=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&pe(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),A){e[3]=8;for(var r=0;r<=A.length;++r)e[r+10]=A.charCodeAt(r)}},me=function(e){31==e[0]&&139==e[1]&&8==e[2]||N(6,"invalid gzip data");var t=e[3],A=10;4&t&&(A+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[A++]);return A+(2&t)},we=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Be=function(e){return 10+(e.filename?e.filename.length+1:0)},ye=function(e,t){var A=t.level,r=0==A?0:A<6?1:9==A?3:2;if(e[0]=120,e[1]=r<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var n=X();n.p(t.dictionary),pe(e,2,n.d())}},ve=function(e,t){return(8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31)&&N(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&N(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),2+(e[1]>>3&4)};function be(e,t){return"function"==typeof e&&(t=e,e={}),this.ondata=t,e}var Ce=function(){function e(e,t){if("function"==typeof e&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new n(98304),this.o.dictionary){var A=this.o.dictionary.subarray(-32768);this.b.set(A,32768-A.length),this.s.i=32768-A.length}}return e.prototype.p=function(e,t){this.ondata(Y(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||N(5),this.s.l&&N(4);var A=e.length+this.s.z;if(A>this.b.length){if(A>2*this.b.length-32768){var r=new n(-32768&A);r.set(this.b.subarray(0,this.s.z)),this.b=r}var s=this.b.length-this.s.z;this.b.set(e.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(s),32768),this.s.z=e.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=1&t,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||N(5),this.s.l&&N(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),_e=function(){return function(e,t){ue([Ae,function(){return[ce,Ce]}],this,be.call(this,e,t),function(e){var t=new Ce(e.data);onmessage=ce(t)},6,1)}}();function je(e,t,A){return A||(A=t,t={}),"function"!=typeof A&&N(7),le(e,t,[Ae],function(e){return oe(xe(e.data[0],e.data[1]))},0,A)}function xe(e,t){return Y(e,t||{},0,0)}var Fe=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var A=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:A?A.length:0},this.o=new n(32768),this.p=new n(0),A&&this.o.set(A)}return e.prototype.e=function(e){if(this.ondata||N(5),this.d&&N(4),this.p.length){if(e.length){var t=new n(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}}else this.p=e},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,A=k(this.p,this.s,this.o);this.ondata(S(A,t,this.s.b),this.d),this.o=S(A,this.s.b-32768),this.s.b=this.o.length,this.p=S(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Qe=function(){return function(e,t){ue([te,function(){return[ce,Fe]}],this,be.call(this,e,t),function(e){var t=new Fe(e.data);onmessage=ce(t)},7,0)}}();function Ue(e,t,A){return A||(A=t,t={}),"function"!=typeof A&&N(7),le(e,t,[te],function(e){return oe(Ee(e.data[0],ae(e.data[1])))},1,A)}function Ee(e,t){return k(e,{i:2},t&&t.out,t&&t.dictionary)}var Se=function(){function e(e,t){this.c=W(),this.l=0,this.v=1,Ce.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,Ce.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var A=Y(e,this.o,this.v&&Be(this.o),t&&8,this.s);this.v&&(ge(A,this.o),this.v=0),t&&(pe(A,A.length-8,this.c.d()),pe(A,A.length-4,this.l)),this.ondata(A,t)},e.prototype.flush=function(){Ce.prototype.flush.call(this)},e}(),Le=function(){return function(e,t){ue([Ae,re,function(){return[ce,Ce,Se]}],this,be.call(this,e,t),function(e){var t=new Se(e.data);onmessage=ce(t)},8,1)}}();function Ie(e,t,A){return A||(A=t,t={}),"function"!=typeof A&&N(7),le(e,t,[Ae,re,function(){return[Ne]}],function(e){return oe(Ne(e.data[0],e.data[1]))},2,A)}function Ne(e,t){t||(t={});var A=W(),r=e.length;A.p(e);var n=Y(e,t,Be(t),8),s=n.length;return ge(n,t),pe(n,s-8,A.d()),pe(n,s-4,r),n}var ke=function(){function e(e,t){this.v=1,this.r=0,Fe.call(this,e,t)}return e.prototype.push=function(e,t){if(Fe.prototype.e.call(this,e),this.r+=e.length,this.v){var A=this.p.subarray(this.v-1),r=A.length>3?me(A):4;if(r>A.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-A.length);this.p=A.subarray(r),this.v=0}Fe.prototype.c.call(this,t),!this.s.f||this.s.l||t||(this.v=E(this.s.p)+9,this.s={i:0},this.o=new n(0),this.push(new n(0),t))},e}(),He=function(){return function(e,t){var A=this;ue([te,ne,function(){return[ce,Fe,ke]}],this,be.call(this,e,t),function(e){var t=new ke(e.data);t.onmember=function(e){return postMessage(e)},onmessage=ce(t)},9,0,function(e){return A.onmember&&A.onmember(e)})}}();function Pe(e,t,A){return A||(A=t,t={}),"function"!=typeof A&&N(7),le(e,t,[te,ne,function(){return[Te]}],function(e){return oe(Te(e.data[0],e.data[1]))},3,A)}function Te(e,t){var A=me(e);return A+8>e.length&&N(6,"invalid gzip data"),k(e.subarray(A,-8),{i:2},t&&t.out||new n(we(e)),t&&t.dictionary)}var Oe=function(){function e(e,t){this.c=X(),this.v=1,Ce.call(this,e,t)}return e.prototype.push=function(e,t){this.c.p(e),Ce.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var A=Y(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(ye(A,this.o),this.v=0),t&&pe(A,A.length-4,this.c.d()),this.ondata(A,t)},e.prototype.flush=function(){Ce.prototype.flush.call(this)},e}(),Me=function(){return function(e,t){ue([Ae,se,function(){return[ce,Ce,Oe]}],this,be.call(this,e,t),function(e){var t=new Oe(e.data);onmessage=ce(t)},10,1)}}();function De(e,t,A){return A||(A=t,t={}),"function"!=typeof A&&N(7),le(e,t,[Ae,se,function(){return[Re]}],function(e){return oe(Re(e.data[0],e.data[1]))},4,A)}function Re(e,t){t||(t={});var A=X();A.p(e);var r=Y(e,t,t.dictionary?6:2,4);return ye(r,t),pe(r,r.length-4,A.d()),r}var Ke=function(){function e(e,t){Fe.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(Fe.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(ve(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&N(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),Fe.prototype.c.call(this,t)},e}(),Ve=function(){return function(e,t){ue([te,ie,function(){return[ce,Fe,Ke]}],this,be.call(this,e,t),function(e){var t=new Ke(e.data);onmessage=ce(t)},11,0)}}();function Ge(e,t,A){return A||(A=t,t={}),"function"!=typeof A&&N(7),le(e,t,[te,ie,function(){return[ze]}],function(e){return oe(ze(e.data[0],ae(e.data[1])))},5,A)}function ze(e,t){return k(e.subarray(ve(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}var qe=function(){function e(e,t){this.o=be.call(this,e,t)||{},this.G=ke,this.I=Fe,this.Z=Ke}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,A){e.ondata(t,A)}},e.prototype.push=function(e,t){if(this.ondata||N(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var A=new n(this.p.length+e.length);A.set(this.p),A.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):8!=(15&this.p[0])||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}(),We=function(){function e(e,t){qe.call(this,e,t),this.queuedSize=0,this.G=He,this.I=Qe,this.Z=Ve}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,A,r){e.ondata(t,A,r)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},e.prototype.push=function(e,t){this.queuedSize+=e.length,qe.prototype.push.call(this,e,t)},e}();function Xe(e,t,A){return A||(A=t,t={}),"function"!=typeof A&&N(7),31==e[0]&&139==e[1]&&8==e[2]?Pe(e,t,A):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?Ue(e,t,A):Ge(e,t,A)}function Ye(e,t){return 31==e[0]&&139==e[1]&&8==e[2]?Te(e,t):8!=(15&e[0])||e[0]>>4>7||(e[0]<<8|e[1])%31?Ee(e,t):ze(e,t)}var Je=function(e,t,A,r){for(var s in e){var i=e[s],o=t+s,a=r;Array.isArray(i)&&(a=J(r,i[1]),i=i[0]),i instanceof n?A[o]=[i,a]:(A[o+="/"]=[new n(0),a],Je(i,o,A,r))}},Ze="undefined"!=typeof TextEncoder&&new TextEncoder,$e="undefined"!=typeof TextDecoder&&new TextDecoder,et=0;try{$e.decode(G,{stream:!0}),et=1}catch(e){}var tt=function(e){for(var t="",A=0;;){var r=e[A++],n=(r>127)+(r>223)+(r>239);if(A+n>e.length)return{s:t,r:S(e,A-1)};n?3==n?(r=((15&r)<<18|(63&e[A++])<<12|(63&e[A++])<<6|63&e[A++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&n?String.fromCharCode((31&r)<<6|63&e[A++]):String.fromCharCode((15&r)<<12|(63&e[A++])<<6|63&e[A++]):t+=String.fromCharCode(r)}},At=function(){function e(e){this.ondata=e,et?this.t=new TextDecoder:this.p=G}return e.prototype.push=function(e,t){if(this.ondata||N(5),t=!!t,this.t)return this.ondata(this.t.decode(e,{stream:!0}),t),void(t&&(this.t.decode().length&&N(8),this.t=null));this.p||N(4);var A=new n(this.p.length+e.length);A.set(this.p),A.set(e,this.p.length);var r=tt(A),s=r.s,i=r.r;t?(i.length&&N(8),this.p=null):this.p=i,this.ondata(s,t)},e}(),rt=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){this.ondata||N(5),this.d&&N(4),this.ondata(nt(e),this.d=t||!1)},e}();function nt(e,t){if(t){for(var A=new n(e.length),r=0;r>1)),o=0,a=function(e){i[o++]=e};for(r=0;ri.length){var l=new n(o+8+(s-r<<1));l.set(i),i=l}var c=e.charCodeAt(r);c<128||t?a(c):c<2048?(a(192|c>>6),a(128|63&c)):c>55295&&c<57344?(a(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++r))>>18),a(128|c>>12&63),a(128|c>>6&63),a(128|63&c)):(a(224|c>>12),a(128|c>>6&63),a(128|63&c))}return S(i,0,o)}function st(e,t){if(t){for(var A="",r=0;r65535&&N(9),t+=r+4}return t},ut=function(e,t,A,r,n,s,i,o){var a=r.length,l=A.extra,c=o&&o.length,u=ct(l);pe(e,t,null!=i?33639248:67324752),t+=4,null!=i&&(e[t++]=20,e[t++]=A.os),e[t]=20,t+=2,e[t++]=A.flag<<1|(s<0&&8),e[t++]=n&&8,e[t++]=255&A.compression,e[t++]=A.compression>>8;var h=new Date(null==A.mtime?Date.now():A.mtime),d=h.getFullYear()-1980;if((d<0||d>119)&&N(10),pe(e,t,d<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,-1!=s&&(pe(e,t,A.crc),pe(e,t+4,s<0?-s-2:s),pe(e,t+8,A.size)),pe(e,t+12,a),pe(e,t+14,u),t+=16,null!=i&&(pe(e,t,c),pe(e,t+6,A.attrs),pe(e,t+10,i),t+=14),e.set(r,t),t+=a,u)for(var f in l){var p=l[f],g=p.length;pe(e,t,+f),pe(e,t+2,g),e.set(p,t+4),t+=4+g}return c&&(e.set(o,t),t+=c),t},ht=function(e,t,A,r,n){pe(e,t,101010256),pe(e,t+8,A),pe(e,t+10,A),pe(e,t+12,r),pe(e,t+16,n)},dt=function(){function e(e){this.filename=e,this.c=W(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||N(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),ft=function(){function e(e,t){var A=this;t||(t={}),dt.call(this,e),this.d=new Ce(t,function(e,t){A.ondata(null,e,t)}),this.compression=8,this.flag=it(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){dt.prototype.push.call(this,e,t)},e}(),pt=function(){function e(e,t){var A=this;t||(t={}),dt.call(this,e),this.d=new _e(t,function(e,t,r){A.ondata(e,t,r)}),this.compression=8,this.flag=it(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){dt.prototype.push.call(this,e,t)},e}(),gt=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||N(5),2&this.d)this.ondata(N(4+8*(1&this.d),0,1),null,!1);else{var A=nt(e.filename),r=A.length,s=e.comment,i=s&&nt(s),o=r!=e.filename.length||i&&s.length!=i.length,a=r+ct(e.extra)+30;r>65535&&this.ondata(N(11,0,1),null,!1);var l=new n(a);ut(l,0,e,A,o,-1);var c=[l],u=function(){for(var e=0,A=c;e65535&&_(N(11,0,1),null),C)if(g<16e4)try{_(null,xe(n,l))}catch(e){_(e,null)}else u.push(je(n,l,_));else _(null,n)},g=0;g65535&&N(11);var m=u?xe(l,c):l,w=m.length,B=W();B.p(l),r.push(J(c,{size:l.length,crc:B.d(),c:m,f:_,m:f,u:h!=o.length||f&&d.length!=p,o:s,compression:u})),s+=30+h+g+w,i+=76+2*(h+g)+(p||0)+w}for(var y=new n(i+22),v=s,b=i-s,C=0;C0){var r=Math.min(this.c,e.length),s=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(s,!this.c):this.k[0].push(s),(e=e.subarray(r)).length)return this.push(e,t)}else{var i=0,o=0,a=void 0,l=void 0;this.p.length?e.length?((l=new n(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var c=l.length,u=this.c,h=u&&this.d,d=function(){var e,t=de(l,o);if(67324752==t){i=1,a=o,f.d=null,f.c=0;var r=he(l,o+6),n=he(l,o+8),s=2048&r,h=8&r,d=he(l,o+26),p=he(l,o+28);if(c>o+30+d+p){var g=[];f.k.unshift(g),i=2;var m,w=de(l,o+18),B=de(l,o+22),y=st(l.subarray(o+30,o+=30+d),!s);4294967295==w?(e=h?[-2]:lt(l,o),w=e[0],B=e[1]):h&&(w=-1),o+=p,f.c=w;var v={name:y,compression:n,start:function(){if(v.ondata||N(5),w){var e=A.o[n];e||v.ondata(N(14,"unknown compression type "+n,1),null,!1),(m=w<0?new e(y):new e(y,w,B)).ondata=function(e,t,A){v.ondata(e,t,A)};for(var t=0,r=g;t=0&&(v.size=w,v.originalSize=B),f.onfile(v)}return"break"}if(u){if(134695760==t)return a=o+=12+(-2==u&&8),i=3,f.c=0,"break";if(33639248==t)return a=o-=4,i=3,f.c=0,"break"}},f=this;o65558)return o(N(13,0,1),null),s;var l=he(e,a+8);if(l){var c=l,u=de(e,a+16),h=4294967295==u||65535==c;if(h){var d=de(e,a-12);(h=101075792==de(e,d))&&(c=l=de(e,d+32),u=de(e,d+48))}for(var f=t&&t.filter,p=function(t){var A=at(e,u,h),a=A[0],c=A[1],d=A[2],p=A[3],g=A[4],m=A[5],w=ot(e,m);u=g;var B=function(e,t){e?(s(),o(e,null)):(t&&(i[p]=t),--l||o(null,i))};if(!f||f({name:p,size:c,originalSize:d,compression:a}))if(a)if(8==a){var y=e.subarray(w,w+c);if(d<524288||c>.8*d)try{B(null,Ee(y,{out:new n(d)}))}catch(e){B(e,null)}else r.push(Ue(y,{size:d},B))}else B(N(14,"unknown compression type "+a,1),null);else B(null,S(e,w,w+c));else B(null,null)},g=0;g65558)&&N(13);var s=he(e,r+8);if(!s)return{};var i=de(e,r+16),o=4294967295==i||65535==s;if(o){var a=de(e,r-12);(o=101075792==de(e,a))&&(s=de(e,a+32),i=de(e,a+48))}for(var l=t&&t.filter,c=0;c0&&n[n.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=55296&&n<=56319&&A>10),i%1024+56320)),(n+1===A||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u="undefined"==typeof Uint8Array?[]:new Uint8Array(256),h=0;h<64;h++)u[c.charCodeAt(h)]=h;for(var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f="undefined"==typeof Uint8Array?[]:new Uint8Array(256),p=0;p<64;p++)f[d.charCodeAt(p)]=p;for(var g=function(e,t,A){return e.slice?e.slice(t,A):new Uint16Array(Array.prototype.slice.call(e,t,A))},m=function(){function e(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return e.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",B="undefined"==typeof Uint8Array?[]:new Uint8Array(256),y=0;y<64;y++)B[w.charCodeAt(y)]=y;var v=10,b=13,C=15,_=17,j=18,x=19,F=20,Q=21,U=22,E=24,S=25,L=26,I=27,N=28,k=30,H=32,P=33,T=34,O=35,M=37,D=38,R=39,K=40,V=42,G=[9001,65288],z="×",q="÷",W=function(e){var t,A,r,n=function(e){var t,A,r,n,s,i=.75*e.length,o=e.length,a=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);var l="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(i):new Array(i),c=Array.isArray(l)?l:new Uint8Array(l);for(t=0;t>4,c[a++]=(15&r)<<4|n>>2,c[a++]=(3&n)<<6|63&s;return l}(e),s=Array.isArray(n)?function(e){for(var t=e.length,A=[],r=0;r0;){var i=r[--s];if(Array.isArray(e)?-1!==e.indexOf(i):e===i)for(var o=A;o<=r.length;){var a;if((a=r[++o])===t)return!0;if(a!==v)break}if(i!==v)break}return!1},re=function(e,t){for(var A=e;A>=0;){var r=t[A];if(r!==v)return r;A--}return 0},ne=function(e,t,A,r,n){if(0===A[r])return z;var s=r-1;if(Array.isArray(n)&&!0===n[s])return z;var i=s-1,o=s+1,a=t[s],l=i>=0?t[i]:0,c=t[o];if(2===a&&3===c)return z;if(-1!==Y.indexOf(a))return"!";if(-1!==Y.indexOf(c))return z;if(-1!==J.indexOf(c))return z;if(8===re(s,t))return q;if(11===W.get(e[s]))return z;if((a===H||a===P)&&11===W.get(e[o]))return z;if(7===a||7===c)return z;if(9===a)return z;if(-1===[v,b,C].indexOf(a)&&9===c)return z;if(-1!==[_,j,x,E,N].indexOf(c))return z;if(re(s,t)===U)return z;if(Ae(23,U,s,t))return z;if(Ae([_,j],Q,s,t))return z;if(Ae(12,12,s,t))return z;if(a===v)return q;if(23===a||23===c)return z;if(16===c||16===a)return q;if(-1!==[b,C,Q].indexOf(c)||14===a)return z;if(36===l&&-1!==te.indexOf(a))return z;if(a===N&&36===c)return z;if(c===F)return z;if(-1!==X.indexOf(c)&&a===S||-1!==X.indexOf(a)&&c===S)return z;if(a===I&&-1!==[M,H,P].indexOf(c)||-1!==[M,H,P].indexOf(a)&&c===L)return z;if(-1!==X.indexOf(a)&&-1!==Z.indexOf(c)||-1!==Z.indexOf(a)&&-1!==X.indexOf(c))return z;if(-1!==[I,L].indexOf(a)&&(c===S||-1!==[U,C].indexOf(c)&&t[o+1]===S)||-1!==[U,C].indexOf(a)&&c===S||a===S&&-1!==[S,N,E].indexOf(c))return z;if(-1!==[S,N,E,_,j].indexOf(c))for(var u=s;u>=0;){if((h=t[u])===S)return z;if(-1===[N,E].indexOf(h))break;u--}if(-1!==[I,L].indexOf(c))for(u=-1!==[_,j].indexOf(a)?i:s;u>=0;){var h;if((h=t[u])===S)return z;if(-1===[N,E].indexOf(h))break;u--}if(D===a&&-1!==[D,R,T,O].indexOf(c)||-1!==[R,T].indexOf(a)&&-1!==[R,K].indexOf(c)||-1!==[K,O].indexOf(a)&&c===K)return z;if(-1!==ee.indexOf(a)&&-1!==[F,L].indexOf(c)||-1!==ee.indexOf(c)&&a===I)return z;if(-1!==X.indexOf(a)&&-1!==X.indexOf(c))return z;if(a===E&&-1!==X.indexOf(c))return z;if(-1!==X.concat(S).indexOf(a)&&c===U&&-1===G.indexOf(e[o])||-1!==X.concat(S).indexOf(c)&&a===j)return z;if(41===a&&41===c){for(var d=A[s],f=1;d>0&&41===t[--d];)f++;if(f%2!=0)return z}return a===H&&c===P?z:q},se=function(e,t){t||(t={lineBreak:"normal",wordBreak:"normal"});var A=function(e,t){void 0===t&&(t="strict");var A=[],r=[],n=[];return e.forEach(function(e,s){var i=W.get(e);if(i>50?(n.push(!0),i-=50):n.push(!1),-1!==["normal","auto","loose"].indexOf(t)&&-1!==[8208,8211,12316,12448].indexOf(e))return r.push(s),A.push(16);if(4===i||11===i){if(0===s)return r.push(s),A.push(k);var o=A[s-1];return-1===$.indexOf(o)?(r.push(r[s-1]),A.push(o)):(r.push(s),A.push(k))}return r.push(s),31===i?A.push("strict"===t?Q:M):i===V||29===i?A.push(k):43===i?e>=131072&&e<=196605||e>=196608&&e<=262141?A.push(M):A.push(k):void A.push(i)}),[r,A,n]}(e,t.lineBreak),r=A[0],n=A[1],s=A[2];"break-all"!==t.wordBreak&&"break-word"!==t.wordBreak||(n=n.map(function(e){return-1!==[S,k,V].indexOf(e)?M:e}));var i="keep-all"===t.wordBreak?s.map(function(t,A){return t&&e[A]>=19968&&e[A]<=40959}):void 0;return[r,n,i]},ie=function(){function e(e,t,A,r){this.codePoints=e,this.required="!"===t,this.start=A,this.end=r}return e.prototype.slice=function(){return l.apply(void 0,this.codePoints.slice(this.start,this.end))},e}(),oe=45,ae=43,le=-1,ce=function(e){return e>=48&&e<=57},ue=function(e){return ce(e)||e>=65&&e<=70||e>=97&&e<=102},he=function(e){return 10===e||9===e||32===e},de=function(e){return function(e){return function(e){return e>=97&&e<=122}(e)||function(e){return e>=65&&e<=90}(e)}(e)||function(e){return e>=128}(e)||95===e},fe=function(e){return de(e)||ce(e)||e===oe},pe=function(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e},ge=function(e,t){return 92===e&&10!==t},me=function(e,t,A){return e===oe?de(t)||ge(t,A):!!de(e)||!(92!==e||!ge(e,t))},we=function(e,t,A){return e===ae||e===oe?!!ce(t)||46===t&&ce(A):ce(46===e?t:e)},Be=function(e){var t=0,A=1;e[t]!==ae&&e[t]!==oe||(e[t]===oe&&(A=-1),t++);for(var r=[];ce(e[t]);)r.push(e[t++]);var n=r.length?parseInt(l.apply(void 0,r),10):0;46===e[t]&&t++;for(var s=[];ce(e[t]);)s.push(e[t++]);var i=s.length,o=i?parseInt(l.apply(void 0,s),10):0;69!==e[t]&&101!==e[t]||t++;var a=1;e[t]!==ae&&e[t]!==oe||(e[t]===oe&&(a=-1),t++);for(var c=[];ce(e[t]);)c.push(e[t++]);var u=c.length?parseInt(l.apply(void 0,c),10):0;return A*(n+o*Math.pow(10,-i))*Math.pow(10,a*u)},ye={type:2},ve={type:3},be={type:4},Ce={type:13},_e={type:8},je={type:21},xe={type:9},Fe={type:10},Qe={type:11},Ue={type:12},Ee={type:14},Se={type:23},Le={type:1},Ie={type:25},Ne={type:24},ke={type:26},He={type:27},Pe={type:28},Te={type:29},Oe={type:31},Me={type:32},De=function(){function e(){this._value=[]}return e.prototype.write=function(e){this._value=this._value.concat(a(e))},e.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==Me;)e.push(t),t=this.consumeToken();return e},e.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case 34:return this.consumeStringToken(34);case 35:var t=this.peekCodePoint(0),A=this.peekCodePoint(1),r=this.peekCodePoint(2);if(fe(t)||ge(A,r)){var n=me(t,A,r)?2:1;return{type:5,value:this.consumeName(),flags:n}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Ce;break;case 39:return this.consumeStringToken(39);case 40:return ye;case 41:return ve;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Ee;break;case ae:if(we(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 44:return be;case oe:var s=e,i=this.peekCodePoint(0),o=this.peekCodePoint(1);if(we(s,i,o))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(me(s,i,o))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(i===oe&&62===o)return this.consumeCodePoint(),this.consumeCodePoint(),Ne;break;case 46:if(we(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var a=this.consumeCodePoint();if(42===a&&47===(a=this.consumeCodePoint()))return this.consumeToken();if(a===le)return this.consumeToken()}break;case 58:return ke;case 59:return He;case 60:if(33===this.peekCodePoint(0)&&this.peekCodePoint(1)===oe&&this.peekCodePoint(2)===oe)return this.consumeCodePoint(),this.consumeCodePoint(),Ie;break;case 64:var c=this.peekCodePoint(0),u=this.peekCodePoint(1),h=this.peekCodePoint(2);if(me(c,u,h))return{type:7,value:this.consumeName()};break;case 91:return Pe;case 92:if(ge(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case 93:return Te;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),_e;break;case 123:return Qe;case 125:return Ue;case 117:case 85:var d=this.peekCodePoint(0),f=this.peekCodePoint(1);return d!==ae||!ue(f)&&63!==f||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),xe;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),je;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),Fe;break;case le:return Me}return he(e)?(this.consumeWhiteSpace(),Oe):ce(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):de(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:l(e)}},e.prototype.consumeCodePoint=function(){var e=this._value.shift();return void 0===e?-1:e},e.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},e.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},e.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();ue(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var A=!1;63===t&&e.length<6;)e.push(t),t=this.consumeCodePoint(),A=!0;if(A)return{type:30,start:parseInt(l.apply(void 0,e.map(function(e){return 63===e?48:e})),16),end:parseInt(l.apply(void 0,e.map(function(e){return 63===e?70:e})),16)};var r=parseInt(l.apply(void 0,e),16);if(this.peekCodePoint(0)===oe&&ue(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var n=[];ue(t)&&n.length<6;)n.push(t),t=this.consumeCodePoint();return{type:30,start:r,end:parseInt(l.apply(void 0,n),16)}}return{type:30,start:r,end:r}},e.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return"url"===e.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},e.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===le)return{type:22,value:""};var t=this.peekCodePoint(0);if(39===t||34===t){var A=this.consumeStringToken(this.consumeCodePoint());return 0===A.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===le||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:A.value}):(this.consumeBadUrlRemnants(),Se)}for(;;){var r=this.consumeCodePoint();if(r===le||41===r)return{type:22,value:l.apply(void 0,e)};if(he(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===le||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:l.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Se);if(34===r||39===r||40===r||pe(r))return this.consumeBadUrlRemnants(),Se;if(92===r){if(!ge(r,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),Se;e.push(this.consumeEscapedCodePoint())}else e.push(r)}},e.prototype.consumeWhiteSpace=function(){for(;he(this.peekCodePoint(0));)this.consumeCodePoint()},e.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(41===e||e===le)return;ge(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},e.prototype.consumeStringSlice=function(e){for(var t="";e>0;){var A=Math.min(5e4,e);t+=l.apply(void 0,this._value.splice(0,A)),e-=A}return this._value.shift(),t},e.prototype.consumeStringToken=function(e){for(var t="",A=0;;){var r=this._value[A];if(r===le||void 0===r||r===e)return{type:0,value:t+=this.consumeStringSlice(A)};if(10===r)return this._value.splice(0,A),Le;if(92===r){var n=this._value[A+1];n!==le&&void 0!==n&&(10===n?(t+=this.consumeStringSlice(A),A=-1,this._value.shift()):ge(r,n)&&(t+=this.consumeStringSlice(A),t+=l(this.consumeEscapedCodePoint()),A=-1))}A++}},e.prototype.consumeNumber=function(){var e=[],t=4,A=this.peekCodePoint(0);for(A!==ae&&A!==oe||e.push(this.consumeCodePoint());ce(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(46===A&&ce(r))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;ce(this.peekCodePoint(0));)e.push(this.consumeCodePoint());A=this.peekCodePoint(0),r=this.peekCodePoint(1);var n=this.peekCodePoint(2);if((69===A||101===A)&&((r===ae||r===oe)&&ce(n)||ce(r)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=8;ce(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Be(e),t]},e.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],A=e[1],r=this.peekCodePoint(0),n=this.peekCodePoint(1),s=this.peekCodePoint(2);return me(r,n,s)?{type:15,number:t,flags:A,unit:this.consumeName()}:37===r?(this.consumeCodePoint(),{type:16,number:t,flags:A}):{type:17,number:t,flags:A}},e.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(ue(e)){for(var t=l(e);ue(this.peekCodePoint(0))&&t.length<6;)t+=l(this.consumeCodePoint());he(this.peekCodePoint(0))&&this.consumeCodePoint();var A=parseInt(t,16);return 0===A||function(e){return e>=55296&&e<=57343}(A)||A>1114111?65533:A}return e===le?65533:e},e.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(fe(t))e+=l(t);else{if(!ge(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),e;e+=l(this.consumeEscapedCodePoint())}}},e}(),Re=function(){function e(e){this._tokens=e}return e.create=function(t){var A=new De;return A.write(t),new e(A.read())},e.parseValue=function(t){return e.create(t).parseComponentValue()},e.parseValues=function(t){return e.create(t).parseComponentValues()},e.prototype.parseComponentValue=function(){for(var e=this.consumeToken();31===e.type;)e=this.consumeToken();if(32===e.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do{e=this.consumeToken()}while(31===e.type);if(32===e.type)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},e.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(32===t.type)return e;e.push(t),e.push()}},e.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},e.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},A=this.consumeToken();;){if(32===A.type||Je(A,e))return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue()),A=this.consumeToken()}},e.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var A=this.consumeToken();if(32===A.type||3===A.type)return t;this.reconsumeToken(A),t.values.push(this.consumeComponentValue())}},e.prototype.consumeToken=function(){var e=this._tokens.shift();return void 0===e?Me:e},e.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},e}(),Ke=function(e){return 15===e.type},Ve=function(e){return 17===e.type},Ge=function(e){return 20===e.type},ze=function(e){return 0===e.type},qe=function(e,t){return Ge(e)&&e.value===t},We=function(e){return 31!==e.type},Xe=function(e){return 31!==e.type&&4!==e.type},Ye=function(e){var t=[],A=[];return e.forEach(function(e){if(4===e.type){if(0===A.length)throw new Error("Error parsing function args, zero tokens for arg");return t.push(A),void(A=[])}31!==e.type&&A.push(e)}),A.length&&t.push(A),t},Je=function(e,t){return 11===t&&12===e.type||28===t&&29===e.type||2===t&&3===e.type},Ze=function(e){return 17===e.type||15===e.type},$e=function(e){return 16===e.type||Ze(e)},et=function(e){return e.length>1?[e[0],e[1]]:[e[0]]},tt={type:17,number:0,flags:4},At={type:16,number:50,flags:4},rt={type:16,number:100,flags:4},nt=function(e,t,A){var r=e[0],n=e[1];return[st(r,t),st(void 0!==n?n:r,A)]},st=function(e,t){if(16===e.type)return e.number/100*t;if(Ke(e))switch(e.unit){case"rem":case"em":return 16*e.number;default:return e.number}return e.number},it="grad",ot="turn",at=function(e,t){if(15===t.type)switch(t.unit){case"deg":return Math.PI*t.number/180;case it:return Math.PI/200*t.number;case"rad":return t.number;case ot:return 2*Math.PI*t.number}throw new Error("Unsupported angle type")},lt=function(e){return 15===e.type&&("deg"===e.unit||e.unit===it||"rad"===e.unit||e.unit===ot)},ct=function(e){switch(e.filter(Ge).map(function(e){return e.value}).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[tt,tt];case"to top":case"bottom":return ut(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[tt,rt];case"to right":case"left":return ut(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[rt,rt];case"to bottom":case"top":return ut(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[rt,tt];case"to left":case"right":return ut(270)}return 0},ut=function(e){return Math.PI*e/180},ht=function(e,t){if(18===t.type){var A=yt[t.name];if(void 0===A)throw new Error('Attempting to parse an unsupported color function "'+t.name+'"');return A(e,t.values)}if(5===t.type){if(3===t.value.length){var r=t.value.substring(0,1),n=t.value.substring(1,2),s=t.value.substring(2,3);return pt(parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16),1)}if(4===t.value.length){r=t.value.substring(0,1),n=t.value.substring(1,2),s=t.value.substring(2,3);var i=t.value.substring(3,4);return pt(parseInt(r+r,16),parseInt(n+n,16),parseInt(s+s,16),parseInt(i+i,16)/255)}if(6===t.value.length)return r=t.value.substring(0,2),n=t.value.substring(2,4),s=t.value.substring(4,6),pt(parseInt(r,16),parseInt(n,16),parseInt(s,16),1);if(8===t.value.length)return r=t.value.substring(0,2),n=t.value.substring(2,4),s=t.value.substring(4,6),i=t.value.substring(6,8),pt(parseInt(r,16),parseInt(n,16),parseInt(s,16),parseInt(i,16)/255)}if(20===t.type){var o=bt[t.value.toUpperCase()];if(void 0!==o)return o}return bt.TRANSPARENT},dt=function(e){return!(255&e)},ft=function(e){var t=255&e,A=255&e>>8,r=255&e>>16,n=255&e>>24;return t<255?"rgba("+n+","+r+","+A+","+t/255+")":"rgb("+n+","+r+","+A+")"},pt=function(e,t,A,r){return(e<<24|t<<16|A<<8|Math.round(255*r))>>>0},gt=function(e,t){if(17===e.type)return e.number;if(16===e.type){var A=3===t?1:255;return 3===t?e.number/100*A:Math.round(e.number/100*A)}return 0},mt=function(e,t){var A=t.filter(Xe);if(3===A.length){var r=A.map(gt),n=r[0],s=r[1],i=r[2];return pt(n,s,i,1)}if(4===A.length){var o=A.map(gt),a=(n=o[0],s=o[1],i=o[2],o[3]);return pt(n,s,i,a)}return 0};function wt(e,t,A){return A<0&&(A+=1),A>=1&&(A-=1),A<1/6?(t-e)*A*6+e:A<.5?t:A<2/3?6*(t-e)*(2/3-A)+e:e}var Bt=function(e,t){var A=t.filter(Xe),r=A[0],n=A[1],s=A[2],i=A[3],o=(17===r.type?ut(r.number):at(e,r))/(2*Math.PI),a=$e(n)?n.number/100:0,l=$e(s)?s.number/100:0,c=void 0!==i&&$e(i)?st(i,1):1;if(0===a)return pt(255*l,255*l,255*l,1);var u=l<=.5?l*(a+1):l+a-l*a,h=2*l-u,d=wt(h,u,o+1/3),f=wt(h,u,o),p=wt(h,u,o-1/3);return pt(255*d,255*f,255*p,c)},yt={hsl:Bt,hsla:Bt,rgb:mt,rgba:mt},vt=function(e,t){return ht(e,Re.create(t).parseComponentValue())},bt={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Ct={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(Ge(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},_t={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},jt=function(e,t){var A=ht(e,t[0]),r=t[1];return r&&$e(r)?{color:A,stop:r}:{color:A,stop:null}},xt=function(e,t){var A=e[0],r=e[e.length-1];null===A.stop&&(A.stop=tt),null===r.stop&&(r.stop=rt);for(var n=[],s=0,i=0;is?n.push(a):n.push(s),s=a}else n.push(null)}var l=null;for(i=0;ie.optimumDistance)?{optimumCorner:t,optimumDistance:o}:e},{optimumDistance:n?1/0:-1/0,optimumCorner:null}).optimumCorner},Et=function(e,t){var A=ut(180),r=[];return Ye(t).forEach(function(t,n){if(0===n){var s=t[0];if(20===s.type&&-1!==["top","left","right","bottom"].indexOf(s.value))return void(A=ct(t));if(lt(s))return void(A=(at(e,s)+ut(270))%ut(360))}var i=jt(e,t);r.push(i)}),{angle:A,stops:r,type:1}},St="closest-side",Lt="farthest-side",It="closest-corner",Nt="farthest-corner",kt="circle",Ht="ellipse",Pt="cover",Tt="contain",Ot=function(e,t){var A=0,r=3,n=[],s=[];return Ye(t).forEach(function(t,i){var o=!0;if(0===i?o=t.reduce(function(e,t){if(Ge(t))switch(t.value){case"center":return s.push(At),!1;case"top":case"left":return s.push(tt),!1;case"right":case"bottom":return s.push(rt),!1}else if($e(t)||Ze(t))return s.push(t),!1;return e},o):1===i&&(o=t.reduce(function(e,t){if(Ge(t))switch(t.value){case kt:return A=0,!1;case Ht:return A=1,!1;case Tt:case St:return r=0,!1;case Lt:return r=1,!1;case It:return r=2,!1;case Pt:case Nt:return r=3,!1}else if(Ze(t)||$e(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},o)),o){var a=jt(e,t);n.push(a)}}),{size:r,shape:A,stops:n,position:s,type:2}},Mt=function(e,t){if(22===t.type){var A={url:t.value,type:0};return e.cache.addImage(t.value),A}if(18===t.type){var r=Rt[t.name];if(void 0===r)throw new Error('Attempting to parse an unsupported image function "'+t.name+'"');return r(e,t.values)}throw new Error("Unsupported image type "+t.type)};var Dt,Rt={"linear-gradient":function(e,t){var A=ut(180),r=[];return Ye(t).forEach(function(t,n){if(0===n){var s=t[0];if(20===s.type&&"to"===s.value)return void(A=ct(t));if(lt(s))return void(A=at(e,s))}var i=jt(e,t);r.push(i)}),{angle:A,stops:r,type:1}},"-moz-linear-gradient":Et,"-ms-linear-gradient":Et,"-o-linear-gradient":Et,"-webkit-linear-gradient":Et,"radial-gradient":function(e,t){var A=0,r=3,n=[],s=[];return Ye(t).forEach(function(t,i){var o=!0;if(0===i){var a=!1;o=t.reduce(function(e,t){if(a)if(Ge(t))switch(t.value){case"center":return s.push(At),e;case"top":case"left":return s.push(tt),e;case"right":case"bottom":return s.push(rt),e}else($e(t)||Ze(t))&&s.push(t);else if(Ge(t))switch(t.value){case kt:return A=0,!1;case Ht:return A=1,!1;case"at":return a=!0,!1;case St:return r=0,!1;case Pt:case Lt:return r=1,!1;case Tt:case It:return r=2,!1;case Nt:return r=3,!1}else if(Ze(t)||$e(t))return Array.isArray(r)||(r=[]),r.push(t),!1;return e},o)}if(o){var l=jt(e,t);n.push(l)}}),{size:r,shape:A,stops:n,position:s,type:2}},"-moz-radial-gradient":Ot,"-ms-radial-gradient":Ot,"-o-radial-gradient":Ot,"-webkit-radial-gradient":Ot,"-webkit-gradient":function(e,t){var A=ut(180),r=[],n=1;return Ye(t).forEach(function(t,A){var s=t[0];if(0===A){if(Ge(s)&&"linear"===s.value)return void(n=1);if(Ge(s)&&"radial"===s.value)return void(n=2)}if(18===s.type)if("from"===s.name){var i=ht(e,s.values[0]);r.push({stop:tt,color:i})}else if("to"===s.name)i=ht(e,s.values[0]),r.push({stop:rt,color:i});else if("color-stop"===s.name){var o=s.values.filter(Xe);if(2===o.length){i=ht(e,o[1]);var a=o[0];Ve(a)&&r.push({stop:{type:16,number:100*a.number,flags:a.flags},color:i})}}}),1===n?{angle:(A+ut(180))%ut(360),stops:r,type:n}:{size:3,shape:0,stops:r,position:[],type:n}}},Kt={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(e,t){if(0===t.length)return[];var A=t[0];return 20===A.type&&"none"===A.value?[]:t.filter(function(e){return Xe(e)&&function(e){return!(20===e.type&&"none"===e.value||18===e.type&&!Rt[e.name])}(e)}).map(function(t){return Mt(e,t)})}},Vt={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(e,t){return t.map(function(e){if(Ge(e))switch(e.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Gt={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(e,t){return Ye(t).map(function(e){return e.filter($e)}).map(et)}},zt={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(e,t){return Ye(t).map(function(e){return e.filter(Ge).map(function(e){return e.value}).join(" ")}).map(qt)}},qt=function(e){switch(e){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(e){e.AUTO="auto",e.CONTAIN="contain",e.COVER="cover"}(Dt||(Dt={}));var Wt,Xt={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(e,t){return Ye(t).map(function(e){return e.filter(Yt)})}},Yt=function(e){return Ge(e)||$e(e)},Jt=function(e){return{name:"border-"+e+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Zt=Jt("top"),$t=Jt("right"),eA=Jt("bottom"),tA=Jt("left"),AA=function(e){return{name:"border-radius-"+e,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return et(t.filter($e))}}},rA=AA("top-left"),nA=AA("top-right"),sA=AA("bottom-right"),iA=AA("bottom-left"),oA=function(e){return{name:"border-"+e+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},aA=oA("top"),lA=oA("right"),cA=oA("bottom"),uA=oA("left"),hA=function(e){return{name:"border-"+e+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Ke(t)?t.number:0}}},dA=hA("top"),fA=hA("right"),pA=hA("bottom"),gA=hA("left"),mA={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},wA={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(e,t){return"rtl"===t?1:0}},BA={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(e,t){return t.filter(Ge).reduce(function(e,t){return e|yA(t.value)},0)}},yA=function(e){switch(e){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},vA={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},bA={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(e,t){return 20===t.type&&"normal"===t.value?0:17===t.type||15===t.type?t.number:0}};!function(e){e.NORMAL="normal",e.STRICT="strict"}(Wt||(Wt={}));var CA,_A={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"strict"===t?Wt.STRICT:Wt.NORMAL}},jA={name:"line-height",initialValue:"normal",prefix:!1,type:4},xA=function(e,t){return Ge(e)&&"normal"===e.value?1.2*t:17===e.type?t*e.number:$e(e)?st(e,t):t},FA={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(e,t){return 20===t.type&&"none"===t.value?null:Mt(e,t)}},QA={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(e,t){return"inside"===t?0:1}},UA={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(e,t){switch(t){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},EA=function(e){return{name:"margin-"+e,initialValue:"0",prefix:!1,type:4}},SA=EA("top"),LA=EA("right"),IA=EA("bottom"),NA=EA("left"),kA={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(e,t){return t.filter(Ge).map(function(e){switch(e.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},HA={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(e,t){return"break-word"===t?"break-word":"normal"}},PA=function(e){return{name:"padding-"+e,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},TA=PA("top"),OA=PA("right"),MA=PA("bottom"),DA=PA("left"),RA={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(e,t){switch(t){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},KA={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(e,t){switch(t){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},VA={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(e,t){return 1===t.length&&qe(t[0],"none")?[]:Ye(t).map(function(t){for(var A={color:bt.TRANSPARENT,offsetX:tt,offsetY:tt,blur:tt},r=0,n=0;n1?1:0],this.overflowWrap=Cr(e,HA,t.overflowWrap),this.paddingTop=Cr(e,TA,t.paddingTop),this.paddingRight=Cr(e,OA,t.paddingRight),this.paddingBottom=Cr(e,MA,t.paddingBottom),this.paddingLeft=Cr(e,DA,t.paddingLeft),this.paintOrder=Cr(e,mr,t.paintOrder),this.position=Cr(e,KA,t.position),this.textAlign=Cr(e,RA,t.textAlign),this.textDecorationColor=Cr(e,Ar,null!==(A=t.textDecorationColor)&&void 0!==A?A:t.color),this.textDecorationLine=Cr(e,rr,null!==(r=t.textDecorationLine)&&void 0!==r?r:t.textDecoration),this.textShadow=Cr(e,VA,t.textShadow),this.textTransform=Cr(e,GA,t.textTransform),this.transform=Cr(e,zA,t.transform),this.transformOrigin=Cr(e,YA,t.transformOrigin),this.visibility=Cr(e,JA,t.visibility),this.webkitTextStrokeColor=Cr(e,wr,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Cr(e,Br,t.webkitTextStrokeWidth),this.wordBreak=Cr(e,ZA,t.wordBreak),this.zIndex=Cr(e,$A,t.zIndex)}return e.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},e.prototype.isTransparent=function(){return dt(this.backgroundColor)},e.prototype.isTransformed=function(){return null!==this.transform},e.prototype.isPositioned=function(){return 0!==this.position},e.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},e.prototype.isFloating=function(){return 0!==this.float},e.prototype.isInlineLevel=function(){return lr(this.display,4)||lr(this.display,33554432)||lr(this.display,268435456)||lr(this.display,536870912)||lr(this.display,67108864)||lr(this.display,134217728)},e}(),vr=function(e,t){this.content=Cr(e,cr,t.content),this.quotes=Cr(e,fr,t.quotes)},br=function(e,t){this.counterIncrement=Cr(e,ur,t.counterIncrement),this.counterReset=Cr(e,hr,t.counterReset)},Cr=function(e,t,A){var r=new De,n=null!=A?A.toString():t.initialValue;r.write(n);var s=new Re(r.read());switch(t.type){case 2:var i=s.parseComponentValue();return t.parse(e,Ge(i)?i.value:t.initialValue);case 0:return t.parse(e,s.parseComponentValue());case 1:return t.parse(e,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(t.format){case"angle":return at(e,s.parseComponentValue());case"color":return ht(e,s.parseComponentValue());case"image":return Mt(e,s.parseComponentValue());case"length":var o=s.parseComponentValue();return Ze(o)?o:tt;case"length-percentage":var a=s.parseComponentValue();return $e(a)?a:tt;case"time":return er.parse(e,s.parseComponentValue())}}},_r=function(e,t){var A=function(e){switch(e.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}}(e);return 1===A||t===A},jr=function(e,t){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,_r(t,3),this.styles=new yr(e,window.getComputedStyle(t,null)),En(t)&&(this.styles.animationDuration.some(function(e){return e>0})&&(t.style.animationDuration="0s"),null!==this.styles.transform&&(t.style.transform="none")),this.bounds=o(this.context,t),_r(t,4)&&(this.flags|=16)},xr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fr="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Qr=0;Qr<64;Qr++)Fr[xr.charCodeAt(Qr)]=Qr;for(var Ur=function(e,t,A){return e.slice?e.slice(t,A):new Uint16Array(Array.prototype.slice.call(e,t,A))},Er=function(){function e(e,t,A,r,n,s){this.initialValue=e,this.errorValue=t,this.highStart=A,this.highValueIndex=r,this.index=n,this.data=s}return e.prototype.get=function(e){var t;if(e>=0){if(e<55296||e>56319&&e<=65535)return t=((t=this.index[e>>5])<<2)+(31&e),this.data[t];if(e<=65535)return t=((t=this.index[2048+(e-55296>>5)])<<2)+(31&e),this.data[t];if(e>11),t=this.index[t],t+=e>>5&63,t=((t=this.index[t])<<2)+(31&e),this.data[t];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},e}(),Sr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lr="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ir=0;Ir<64;Ir++)Lr[Sr.charCodeAt(Ir)]=Ir;var Nr,kr=8,Hr=9,Pr=11,Tr=12,Or=function(){for(var e=[],t=0;t>10),i%1024+56320)),(n+1===A||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},Mr=function(e){var t,A,r,n=function(e){var t,A,r,n,s,i=.75*e.length,o=e.length,a=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);var l="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(i):new Array(i),c=Array.isArray(l)?l:new Uint8Array(l);for(t=0;t>4,c[a++]=(15&r)<<4|n>>2,c[a++]=(3&n)<<6|63&s;return l}(e),s=Array.isArray(n)?function(e){for(var t=e.length,A=[],r=0;r=55296&&n<=56319&&A=A)return{done:!0,value:null};for(var e=Dr;ri.x||n.y>i.y;return i=n,0===t||o});return e.body.removeChild(t),o}(document);return Object.defineProperty(Wr,"SUPPORT_WORD_BREAKING",{value:e}),e},get SUPPORT_SVG_DRAWING(){var e=function(e){var t=new Image,A=e.createElement("canvas"),r=A.getContext("2d");if(!r)return!1;t.src="data:image/svg+xml,";try{r.drawImage(t,0,0),A.toDataURL()}catch(e){return!1}return!0}(document);return Object.defineProperty(Wr,"SUPPORT_SVG_DRAWING",{value:e}),e},get SUPPORT_FOREIGNOBJECT_DRAWING(){var e="function"==typeof Array.from&&"function"==typeof window.fetch?function(e){var t=e.createElement("canvas"),A=100;t.width=A,t.height=A;var r=t.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,A,A);var n=new Image,s=t.toDataURL();n.src=s;var i=zr(A,A,0,0,n);return r.fillStyle="red",r.fillRect(0,0,A,A),qr(i).then(function(t){r.drawImage(t,0,0);var n=r.getImageData(0,0,A,A).data;r.fillStyle="red",r.fillRect(0,0,A,A);var i=e.createElement("div");return i.style.backgroundImage="url("+s+")",i.style.height=A+"px",Gr(n)?qr(zr(A,A,0,0,i)):Promise.reject(!1)}).then(function(e){return r.drawImage(e,0,0),Gr(r.getImageData(0,0,A,A).data)}).catch(function(){return!1})}(document):Promise.resolve(!1);return Object.defineProperty(Wr,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:e}),e},get SUPPORT_CORS_IMAGES(){var e=void 0!==(new Image).crossOrigin;return Object.defineProperty(Wr,"SUPPORT_CORS_IMAGES",{value:e}),e},get SUPPORT_RESPONSE_TYPE(){var e="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(Wr,"SUPPORT_RESPONSE_TYPE",{value:e}),e},get SUPPORT_CORS_XHR(){var e="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Wr,"SUPPORT_CORS_XHR",{value:e}),e},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var e=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(Wr,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:e}),e}},Xr=function(e,t){this.text=e,this.bounds=t},Yr=function(e,t){var A=t.ownerDocument;if(A){var r=A.createElement("html2canvaswrapper");r.appendChild(t.cloneNode(!0));var n=t.parentNode;if(n){n.replaceChild(r,t);var s=o(e,r);return r.firstChild&&n.replaceChild(r.firstChild,r),s}}return i.EMPTY},Jr=function(e,t,A){var r=e.ownerDocument;if(!r)throw new Error("Node has no owner document");var n=r.createRange();return n.setStart(e,t),n.setEnd(e,t+A),n},Zr=function(e){if(Wr.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(t.segment(e)).map(function(e){return e.segment})}return function(e){for(var t,A=Vr(e),r=[];!(t=A.next()).done;)t.value&&r.push(t.value.slice());return r}(e)},$r=function(e,t){return 0!==t.letterSpacing?Zr(e):function(e,t){if(Wr.SUPPORT_NATIVE_TEXT_SEGMENTATION){var A=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(A.segment(e)).map(function(e){return e.segment})}return tn(e,t)}(e,t)},en=[32,160,4961,65792,65793,4153,4241],tn=function(e,t){for(var A,r=function(e,t){var A=a(e),r=se(A,t),n=r[0],s=r[1],i=r[2],o=A.length,l=0,c=0;return{next:function(){if(c>=o)return{done:!0,value:null};for(var e=z;c0)if(Wr.SUPPORT_RANGE_BOUNDS){var n=Jr(r,o,t.length).getClientRects();if(n.length>1){var a=Zr(t),l=0;a.forEach(function(t){s.push(new Xr(t,i.fromDOMRectList(e,Jr(r,l+o,t.length).getClientRects()))),l+=t.length})}else s.push(new Xr(t,i.fromDOMRectList(e,n)))}else{var c=r.splitText(t.length);s.push(new Xr(t,Yr(e,r))),r=c}else Wr.SUPPORT_RANGE_BOUNDS||(r=r.splitText(t.length));o+=t.length}),s}(e,this.text,A,t)},rn=function(e,t){switch(t){case 1:return e.toLowerCase();case 3:return e.replace(nn,sn);case 2:return e.toUpperCase();default:return e}},nn=/(^|\s|:|-|\(|\))([a-z])/g,sn=function(e,t,A){return e.length>0?t+A.toUpperCase():e},on=function(e){function A(t,A){var r=e.call(this,t,A)||this;return r.src=A.currentSrc||A.src,r.intrinsicWidth=A.naturalWidth,r.intrinsicHeight=A.naturalHeight,r.context.cache.addImage(r.src),r}return t(A,e),A}(jr),an=function(e){function A(t,A){var r=e.call(this,t,A)||this;return r.canvas=A,r.intrinsicWidth=A.width,r.intrinsicHeight=A.height,r}return t(A,e),A}(jr),ln=function(e){function A(t,A){var r=e.call(this,t,A)||this,n=new XMLSerializer,s=o(t,A);return A.setAttribute("width",s.width+"px"),A.setAttribute("height",s.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(n.serializeToString(A)),r.intrinsicWidth=A.width.baseVal.value,r.intrinsicHeight=A.height.baseVal.value,r.context.cache.addImage(r.svg),r}return t(A,e),A}(jr),cn=function(e){function A(t,A){var r=e.call(this,t,A)||this;return r.value=A.value,r}return t(A,e),A}(jr),un=function(e){function A(t,A){var r=e.call(this,t,A)||this;return r.start=A.start,r.reversed="boolean"==typeof A.reversed&&!0===A.reversed,r}return t(A,e),A}(jr),hn=[{type:15,flags:0,unit:"px",number:3}],dn=[{type:16,flags:0,number:50}],fn="checkbox",pn="radio",gn="password",mn=707406591,wn=function(e){function A(t,A){var r,n,s,o=e.call(this,t,A)||this;switch(o.type=A.type.toLowerCase(),o.checked=A.checked,o.value=0===(s=(n=A).type===gn?new Array(n.value.length+1).join("•"):n.value).length?n.placeholder||"":s,o.type!==fn&&o.type!==pn||(o.styles.backgroundColor=3739148031,o.styles.borderTopColor=o.styles.borderRightColor=o.styles.borderBottomColor=o.styles.borderLeftColor=2779096575,o.styles.borderTopWidth=o.styles.borderRightWidth=o.styles.borderBottomWidth=o.styles.borderLeftWidth=1,o.styles.borderTopStyle=o.styles.borderRightStyle=o.styles.borderBottomStyle=o.styles.borderLeftStyle=1,o.styles.backgroundClip=[0],o.styles.backgroundOrigin=[0],o.bounds=(r=o.bounds).width>r.height?new i(r.left+(r.width-r.height)/2,r.top,r.height,r.height):r.width0)A.textNodes.push(new An(e,n,A.styles));else if(Un(n))if(Vn(n)&&n.assignedNodes)n.assignedNodes().forEach(function(t){return Cn(e,t,A,r)});else{var i=_n(e,n);i.styles.isVisible()&&(xn(n,i,r)?i.flags|=4:Fn(i.styles)&&(i.flags|=2),-1!==bn.indexOf(n.tagName)&&(i.flags|=8),A.elements.push(i),n.slot,n.shadowRoot?Cn(e,n.shadowRoot,i,r):Rn(n)||kn(n)||Kn(n)||Cn(e,n,i,r))}},_n=function(e,t){return On(t)?new on(e,t):Pn(t)?new an(e,t):kn(t)?new ln(e,t):Ln(t)?new cn(e,t):In(t)?new un(e,t):Nn(t)?new wn(e,t):Kn(t)?new Bn(e,t):Rn(t)?new yn(e,t):Mn(t)?new vn(e,t):new jr(e,t)},jn=function(e,t){var A=_n(e,t);return A.flags|=4,Cn(e,t,A,A),A},xn=function(e,t,A){return t.styles.isPositionedWithZIndex()||t.styles.opacity<1||t.styles.isTransformed()||Hn(e)&&A.styles.isTransparent()},Fn=function(e){return e.isPositioned()||e.isFloating()},Qn=function(e){return e.nodeType===Node.TEXT_NODE},Un=function(e){return e.nodeType===Node.ELEMENT_NODE},En=function(e){return Un(e)&&void 0!==e.style&&!Sn(e)},Sn=function(e){return"object"==typeof e.className},Ln=function(e){return"LI"===e.tagName},In=function(e){return"OL"===e.tagName},Nn=function(e){return"INPUT"===e.tagName},kn=function(e){return"svg"===e.tagName},Hn=function(e){return"BODY"===e.tagName},Pn=function(e){return"CANVAS"===e.tagName},Tn=function(e){return"VIDEO"===e.tagName},On=function(e){return"IMG"===e.tagName},Mn=function(e){return"IFRAME"===e.tagName},Dn=function(e){return"STYLE"===e.tagName},Rn=function(e){return"TEXTAREA"===e.tagName},Kn=function(e){return"SELECT"===e.tagName},Vn=function(e){return"SLOT"===e.tagName},Gn=function(e){return e.tagName.indexOf("-")>0},zn=function(){function e(){this.counters={}}return e.prototype.getCounterValue=function(e){var t=this.counters[e];return t&&t.length?t[t.length-1]:1},e.prototype.getCounterValues=function(e){return this.counters[e]||[]},e.prototype.pop=function(e){var t=this;e.forEach(function(e){return t.counters[e].pop()})},e.prototype.parse=function(e){var t=this,A=e.counterIncrement,r=e.counterReset,n=!0;null!==A&&A.forEach(function(e){var A=t.counters[e.counter];A&&0!==e.increment&&(n=!1,A.length||A.push(1),A[Math.max(0,A.length-1)]+=e.increment)});var s=[];return n&&r.forEach(function(e){var A=t.counters[e.counter];s.push(e.counter),A||(A=t.counters[e.counter]=[]),A.push(e.reset)}),s},e}(),qn={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Wn={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Xn={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Yn={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Jn=function(e,t,A,r,n,s){return eA?is(e,n,s.length>0):r.integers.reduce(function(t,A,n){for(;e>=A;)e-=A,t+=r.values[n];return t},"")+s},Zn=function(e,t,A,r){var n="";do{A||e--,n=r(e)+n,e/=t}while(e*t>=t);return n},$n=function(e,t,A,r,n){var s=A-t+1;return(e<0?"-":"")+(Zn(Math.abs(e),s,r,function(e){return l(Math.floor(e%s)+t)})+n)},es=function(e,t,A){void 0===A&&(A=". ");var r=t.length;return Zn(Math.abs(e),r,!1,function(e){return t[Math.floor(e%r)]})+A},ts=function(e,t,A,r,n,s){if(e<-9999||e>9999)return is(e,4,n.length>0);var i=Math.abs(e),o=n;if(0===i)return t[0]+o;for(var a=0;i>0&&a<=4;a++){var l=i%10;0===l&&lr(s,1)&&""!==o?o=t[l]+o:l>1||1===l&&0===a||1===l&&1===a&&lr(s,2)||1===l&&1===a&&lr(s,4)&&e>100||1===l&&a>1&&lr(s,8)?o=t[l]+(a>0?A[a-1]:"")+o:1===l&&a>0&&(o=A[a-1]+o),i=Math.floor(i/10)}return(e<0?r:"")+o},As="十百千萬",rs="拾佰仟萬",ns="マイナス",ss="마이너스",is=function(e,t,A){var r=A?". ":"",n=A?"、":"",s=A?", ":"",i=A?" ":"";switch(t){case 0:return"•"+i;case 1:return"◦"+i;case 2:return"◾"+i;case 5:var o=$n(e,48,57,!0,r);return o.length<4?"0"+o:o;case 4:return es(e,"〇一二三四五六七八九",n);case 6:return Jn(e,1,3999,qn,3,r).toLowerCase();case 7:return Jn(e,1,3999,qn,3,r);case 8:return $n(e,945,969,!1,r);case 9:return $n(e,97,122,!1,r);case 10:return $n(e,65,90,!1,r);case 11:return $n(e,1632,1641,!0,r);case 12:case 49:return Jn(e,1,9999,Wn,3,r);case 35:return Jn(e,1,9999,Wn,3,r).toLowerCase();case 13:return $n(e,2534,2543,!0,r);case 14:case 30:return $n(e,6112,6121,!0,r);case 15:return es(e,"子丑寅卯辰巳午未申酉戌亥",n);case 16:return es(e,"甲乙丙丁戊己庚辛壬癸",n);case 17:case 48:return ts(e,"零一二三四五六七八九",As,"負",n,14);case 47:return ts(e,"零壹貳參肆伍陸柒捌玖",rs,"負",n,15);case 42:return ts(e,"零一二三四五六七八九",As,"负",n,14);case 41:return ts(e,"零壹贰叁肆伍陆柒捌玖",rs,"负",n,15);case 26:return ts(e,"〇一二三四五六七八九","十百千万",ns,n,0);case 25:return ts(e,"零壱弐参四伍六七八九","拾百千万",ns,n,7);case 31:return ts(e,"영일이삼사오육칠팔구","십백천만",ss,s,7);case 33:return ts(e,"零一二三四五六七八九","十百千萬",ss,s,0);case 32:return ts(e,"零壹貳參四五六七八九","拾百千",ss,s,7);case 18:return $n(e,2406,2415,!0,r);case 20:return Jn(e,1,19999,Yn,3,r);case 21:return $n(e,2790,2799,!0,r);case 22:return $n(e,2662,2671,!0,r);case 22:return Jn(e,1,10999,Xn,3,r);case 23:return es(e,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return es(e,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return $n(e,3302,3311,!0,r);case 28:return es(e,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",n);case 29:return es(e,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",n);case 34:return $n(e,3792,3801,!0,r);case 37:return $n(e,6160,6169,!0,r);case 38:return $n(e,4160,4169,!0,r);case 39:return $n(e,2918,2927,!0,r);case 40:return $n(e,1776,1785,!0,r);case 43:return $n(e,3046,3055,!0,r);case 44:return $n(e,3174,3183,!0,r);case 45:return $n(e,3664,3673,!0,r);case 46:return $n(e,3872,3881,!0,r);default:return $n(e,48,57,!0,r)}},os="data-html2canvas-ignore",as=function(){function e(e,t,A){if(this.context=e,this.options=A,this.scrolledElements=[],this.referenceElement=t,this.counters=new zn,this.quoteDepth=0,!t.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(t.ownerDocument.documentElement,!1)}return e.prototype.toIFrame=function(e,t){var A=this,s=cs(e,t);if(!s.contentWindow)return Promise.reject("Unable to find iframe window");var i=e.defaultView.pageXOffset,o=e.defaultView.pageYOffset,a=s.contentWindow,l=a.document,c=ds(s).then(function(){return r(A,void 0,void 0,function(){var e,A;return n(this,function(r){switch(r.label){case 0:return this.scrolledElements.forEach(ws),a&&(a.scrollTo(t.left,t.top),!/(iPad|iPhone|iPod)/g.test(navigator.userAgent)||a.scrollY===t.top&&a.scrollX===t.left||(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(a.scrollX-t.left,a.scrollY-t.top,0,0))),e=this.options.onclone,void 0===(A=this.clonedReferenceElement)?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:l.fonts&&l.fonts.ready?[4,l.fonts.ready]:[3,2];case 1:r.sent(),r.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,hs(l)]:[3,4];case 3:r.sent(),r.label=4;case 4:return"function"==typeof e?[2,Promise.resolve().then(function(){return e(l,A)}).then(function(){return s})]:[2,s]}})})});return l.open(),l.write(gs(document.doctype)+""),ms(this.referenceElement.ownerDocument,i,o),l.replaceChild(l.adoptNode(this.documentElement),l.documentElement),l.close(),c},e.prototype.createElementClone=function(e){if(_r(e,2),Pn(e))return this.createCanvasClone(e);if(Tn(e))return this.createVideoClone(e);if(Dn(e))return this.createStyleClone(e);var t=e.cloneNode(!1);return On(t)&&(On(e)&&e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),"lazy"===t.loading&&(t.loading="eager")),Gn(t)?this.createCustomElementClone(t):t},e.prototype.createCustomElementClone=function(e){var t=document.createElement("html2canvascustomelement");return ps(e.style,t),t},e.prototype.createStyleClone=function(e){try{var t=e.sheet;if(t&&t.cssRules){var A=[].slice.call(t.cssRules,0).reduce(function(e,t){return t&&"string"==typeof t.cssText?e+t.cssText:e},""),r=e.cloneNode(!1);return r.textContent=A,r}}catch(e){if(this.context.logger.error("Unable to access cssRules property",e),"SecurityError"!==e.name)throw e}return e.cloneNode(!1)},e.prototype.createCanvasClone=function(e){var t;if(this.options.inlineImages&&e.ownerDocument){var A=e.ownerDocument.createElement("img");try{return A.src=e.toDataURL(),A}catch(t){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var r=e.cloneNode(!1);try{r.width=e.width,r.height=e.height;var n=e.getContext("2d"),s=r.getContext("2d");if(s)if(!this.options.allowTaint&&n)s.putImageData(n.getImageData(0,0,e.width,e.height),0,0);else{var i=null!==(t=e.getContext("webgl2"))&&void 0!==t?t:e.getContext("webgl");if(i){var o=i.getContextAttributes();!1===(null==o?void 0:o.preserveDrawingBuffer)&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return r}catch(t){this.context.logger.info("Unable to clone canvas as it is tainted",e)}return r},e.prototype.createVideoClone=function(e){var t=e.ownerDocument.createElement("canvas");t.width=e.offsetWidth,t.height=e.offsetHeight;var A=t.getContext("2d");try{return A&&(A.drawImage(e,0,0,t.width,t.height),this.options.allowTaint||A.getImageData(0,0,t.width,t.height)),t}catch(t){this.context.logger.info("Unable to clone video as it is tainted",e)}var r=e.ownerDocument.createElement("canvas");return r.width=e.offsetWidth,r.height=e.offsetHeight,r},e.prototype.appendChildNode=function(e,t,A){Un(t)&&("SCRIPT"===t.tagName||t.hasAttribute(os)||"function"==typeof this.options.ignoreElements&&this.options.ignoreElements(t))||this.options.copyStyles&&Un(t)&&Dn(t)||e.appendChild(this.cloneNode(t,A))},e.prototype.cloneChildNodes=function(e,t,A){for(var r=this,n=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;n;n=n.nextSibling)if(Un(n)&&Vn(n)&&"function"==typeof n.assignedNodes){var s=n.assignedNodes();s.length&&s.forEach(function(e){return r.appendChildNode(t,e,A)})}else this.appendChildNode(t,n,A)},e.prototype.cloneNode=function(e,t){if(Qn(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var A=e.ownerDocument.defaultView;if(A&&Un(e)&&(En(e)||Sn(e))){var r=this.createElementClone(e);r.style.transitionProperty="none";var n=A.getComputedStyle(e),s=A.getComputedStyle(e,":before"),i=A.getComputedStyle(e,":after");this.referenceElement===e&&En(r)&&(this.clonedReferenceElement=r),Hn(r)&&bs(r);var o=this.counters.parse(new br(this.context,n)),a=this.resolvePseudoContent(e,r,s,Nr.BEFORE);Gn(e)&&(t=!0),Tn(e)||this.cloneChildNodes(e,r,t),a&&r.insertBefore(a,r.firstChild);var l=this.resolvePseudoContent(e,r,i,Nr.AFTER);return l&&r.appendChild(l),this.counters.pop(o),(n&&(this.options.copyStyles||Sn(e))&&!Mn(e)||t)&&ps(n,r),0===e.scrollTop&&0===e.scrollLeft||this.scrolledElements.push([r,e.scrollLeft,e.scrollTop]),(Rn(e)||Kn(e))&&(Rn(r)||Kn(r))&&(r.value=e.value),r}return e.cloneNode(!1)},e.prototype.resolvePseudoContent=function(e,t,A,r){var n=this;if(A){var s=A.content,i=t.ownerDocument;if(i&&s&&"none"!==s&&"-moz-alt-content"!==s&&"none"!==A.display){this.counters.parse(new br(this.context,A));var o=new vr(this.context,A),a=i.createElement("html2canvaspseudoelement");ps(A,a),o.content.forEach(function(t){if(0===t.type)a.appendChild(i.createTextNode(t.value));else if(22===t.type){var A=i.createElement("img");A.src=t.value,A.style.opacity="1",a.appendChild(A)}else if(18===t.type){if("attr"===t.name){var r=t.values.filter(Ge);r.length&&a.appendChild(i.createTextNode(e.getAttribute(r[0].value)||""))}else if("counter"===t.name){var s=t.values.filter(Xe),l=s[0],c=s[1];if(l&&Ge(l)){var u=n.counters.getCounterValue(l.value),h=c&&Ge(c)?UA.parse(n.context,c.value):3;a.appendChild(i.createTextNode(is(u,h,!1)))}}else if("counters"===t.name){var d=t.values.filter(Xe),f=(l=d[0],d[1]);if(c=d[2],l&&Ge(l)){var p=n.counters.getCounterValues(l.value),g=c&&Ge(c)?UA.parse(n.context,c.value):3,m=f&&0===f.type?f.value:"",w=p.map(function(e){return is(e,g,!1)}).join(m);a.appendChild(i.createTextNode(w))}}}else if(20===t.type)switch(t.value){case"open-quote":a.appendChild(i.createTextNode(pr(o.quotes,n.quoteDepth++,!0)));break;case"close-quote":a.appendChild(i.createTextNode(pr(o.quotes,--n.quoteDepth,!1)));break;default:a.appendChild(i.createTextNode(t.value))}}),a.className=Bs+" "+ys;var l=r===Nr.BEFORE?" "+Bs:" "+ys;return Sn(t)?t.className.baseValue+=l:t.className+=l,a}}},e.destroy=function(e){return!!e.parentNode&&(e.parentNode.removeChild(e),!0)},e}();!function(e){e[e.BEFORE=0]="BEFORE",e[e.AFTER=1]="AFTER"}(Nr||(Nr={}));var ls,cs=function(e,t){var A=e.createElement("iframe");return A.className="html2canvas-container",A.style.visibility="hidden",A.style.position="fixed",A.style.left="-10000px",A.style.top="0px",A.style.border="0",A.width=t.width.toString(),A.height=t.height.toString(),A.scrolling="no",A.setAttribute(os,"true"),e.body.appendChild(A),A},us=function(e){return new Promise(function(t){e.complete?t():e.src?(e.onload=t,e.onerror=t):t()})},hs=function(e){return Promise.all([].slice.call(e.images,0).map(us))},ds=function(e){return new Promise(function(t,A){var r=e.contentWindow;if(!r)return A("No window assigned for iframe");var n=r.document;r.onload=e.onload=function(){r.onload=e.onload=null;var A=setInterval(function(){n.body.childNodes.length>0&&"complete"===n.readyState&&(clearInterval(A),t(e))},50)}})},fs=["all","d","content"],ps=function(e,t){for(var A=e.length-1;A>=0;A--){var r=e.item(A);-1===fs.indexOf(r)&&t.style.setProperty(r,e.getPropertyValue(r))}return t},gs=function(e){var t="";return e&&(t+=""),t},ms=function(e,t,A){e&&e.defaultView&&(t!==e.defaultView.pageXOffset||A!==e.defaultView.pageYOffset)&&e.defaultView.scrollTo(t,A)},ws=function(e){var t=e[0],A=e[1],r=e[2];t.scrollLeft=A,t.scrollTop=r},Bs="___html2canvas___pseudoelement_before",ys="___html2canvas___pseudoelement_after",vs='{\n content: "" !important;\n display: none !important;\n}',bs=function(e){Cs(e,"."+Bs+":before"+vs+"\n ."+ys+":after"+vs)},Cs=function(e,t){var A=e.ownerDocument;if(A){var r=A.createElement("style");r.textContent=t,e.appendChild(r)}},_s=function(){function e(){}return e.getOrigin=function(t){var A=e._link;return A?(A.href=t,A.href=A.href,A.protocol+A.hostname+A.port):"about:blank"},e.isSameOrigin=function(t){return e.getOrigin(t)===e._origin},e.setContext=function(t){e._link=t.document.createElement("a"),e._origin=e.getOrigin(t.location.href)},e._origin="about:blank",e}(),js=function(){function e(e,t){this.context=e,this._options=t,this._cache={}}return e.prototype.addImage=function(e){var t=Promise.resolve();return this.has(e)?t:Ls(e)||Us(e)?((this._cache[e]=this.loadImage(e)).catch(function(){}),t):t},e.prototype.match=function(e){return this._cache[e]},e.prototype.loadImage=function(e){return r(this,void 0,void 0,function(){var t,A,r,s,i=this;return n(this,function(n){switch(n.label){case 0:return t=_s.isSameOrigin(e),A=!Es(e)&&!0===this._options.useCORS&&Wr.SUPPORT_CORS_IMAGES&&!t,r=!Es(e)&&!t&&!Ls(e)&&"string"==typeof this._options.proxy&&Wr.SUPPORT_CORS_XHR&&!A,t||!1!==this._options.allowTaint||Es(e)||Ls(e)||r||A?(s=e,r?[4,this.proxy(s)]:[3,2]):[2];case 1:s=n.sent(),n.label=2;case 2:return this.context.logger.debug("Added image "+e.substring(0,256)),[4,new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,(Ss(s)||A)&&(r.crossOrigin="anonymous"),r.src=s,!0===r.complete&&setTimeout(function(){return e(r)},500),i._options.imageTimeout>0&&setTimeout(function(){return t("Timed out ("+i._options.imageTimeout+"ms) loading image")},i._options.imageTimeout)})];case 3:return[2,n.sent()]}})})},e.prototype.has=function(e){return void 0!==this._cache[e]},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(e){var t=this,A=this._options.proxy;if(!A)throw new Error("No proxy defined");var r=e.substring(0,256);return new Promise(function(n,s){var i=Wr.SUPPORT_RESPONSE_TYPE?"blob":"text",o=new XMLHttpRequest;o.onload=function(){if(200===o.status)if("text"===i)n(o.response);else{var e=new FileReader;e.addEventListener("load",function(){return n(e.result)},!1),e.addEventListener("error",function(e){return s(e)},!1),e.readAsDataURL(o.response)}else s("Failed to proxy resource "+r+" with status code "+o.status)},o.onerror=s;var a=A.indexOf("?")>-1?"&":"?";if(o.open("GET",""+A+a+"url="+encodeURIComponent(e)+"&responseType="+i),"text"!==i&&o instanceof XMLHttpRequest&&(o.responseType=i),t._options.imageTimeout){var l=t._options.imageTimeout;o.timeout=l,o.ontimeout=function(){return s("Timed out ("+l+"ms) proxying "+r)}}o.send()})},e}(),xs=/^data:image\/svg\+xml/i,Fs=/^data:image\/.*;base64,/i,Qs=/^data:image\/.*/i,Us=function(e){return Wr.SUPPORT_SVG_DRAWING||!Is(e)},Es=function(e){return Qs.test(e)},Ss=function(e){return Fs.test(e)},Ls=function(e){return"blob"===e.substr(0,4)},Is=function(e){return"svg"===e.substr(-3).toLowerCase()||xs.test(e)},Ns=function(){function e(e,t){this.type=0,this.x=e,this.y=t}return e.prototype.add=function(t,A){return new e(this.x+t,this.y+A)},e}(),ks=function(e,t,A){return new Ns(e.x+(t.x-e.x)*A,e.y+(t.y-e.y)*A)},Hs=function(){function e(e,t,A,r){this.type=1,this.start=e,this.startControl=t,this.endControl=A,this.end=r}return e.prototype.subdivide=function(t,A){var r=ks(this.start,this.startControl,t),n=ks(this.startControl,this.endControl,t),s=ks(this.endControl,this.end,t),i=ks(r,n,t),o=ks(n,s,t),a=ks(i,o,t);return A?new e(this.start,r,i,a):new e(a,o,s,this.end)},e.prototype.add=function(t,A){return new e(this.start.add(t,A),this.startControl.add(t,A),this.endControl.add(t,A),this.end.add(t,A))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),Ps=function(e){return 1===e.type},Ts=function(e){var t=e.styles,A=e.bounds,r=nt(t.borderTopLeftRadius,A.width,A.height),n=r[0],s=r[1],i=nt(t.borderTopRightRadius,A.width,A.height),o=i[0],a=i[1],l=nt(t.borderBottomRightRadius,A.width,A.height),c=l[0],u=l[1],h=nt(t.borderBottomLeftRadius,A.width,A.height),d=h[0],f=h[1],p=[];p.push((n+o)/A.width),p.push((d+c)/A.width),p.push((s+f)/A.height),p.push((a+u)/A.height);var g=Math.max.apply(Math,p);g>1&&(n/=g,s/=g,o/=g,a/=g,c/=g,u/=g,d/=g,f/=g);var m=A.width-o,w=A.height-u,B=A.width-c,y=A.height-f,v=t.borderTopWidth,b=t.borderRightWidth,C=t.borderBottomWidth,_=t.borderLeftWidth,j=st(t.paddingTop,e.bounds.width),x=st(t.paddingRight,e.bounds.width),F=st(t.paddingBottom,e.bounds.width),Q=st(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=n>0||s>0?Os(A.left+_/3,A.top+v/3,n-_/3,s-v/3,ls.TOP_LEFT):new Ns(A.left+_/3,A.top+v/3),this.topRightBorderDoubleOuterBox=n>0||s>0?Os(A.left+m,A.top+v/3,o-b/3,a-v/3,ls.TOP_RIGHT):new Ns(A.left+A.width-b/3,A.top+v/3),this.bottomRightBorderDoubleOuterBox=c>0||u>0?Os(A.left+B,A.top+w,c-b/3,u-C/3,ls.BOTTOM_RIGHT):new Ns(A.left+A.width-b/3,A.top+A.height-C/3),this.bottomLeftBorderDoubleOuterBox=d>0||f>0?Os(A.left+_/3,A.top+y,d-_/3,f-C/3,ls.BOTTOM_LEFT):new Ns(A.left+_/3,A.top+A.height-C/3),this.topLeftBorderDoubleInnerBox=n>0||s>0?Os(A.left+2*_/3,A.top+2*v/3,n-2*_/3,s-2*v/3,ls.TOP_LEFT):new Ns(A.left+2*_/3,A.top+2*v/3),this.topRightBorderDoubleInnerBox=n>0||s>0?Os(A.left+m,A.top+2*v/3,o-2*b/3,a-2*v/3,ls.TOP_RIGHT):new Ns(A.left+A.width-2*b/3,A.top+2*v/3),this.bottomRightBorderDoubleInnerBox=c>0||u>0?Os(A.left+B,A.top+w,c-2*b/3,u-2*C/3,ls.BOTTOM_RIGHT):new Ns(A.left+A.width-2*b/3,A.top+A.height-2*C/3),this.bottomLeftBorderDoubleInnerBox=d>0||f>0?Os(A.left+2*_/3,A.top+y,d-2*_/3,f-2*C/3,ls.BOTTOM_LEFT):new Ns(A.left+2*_/3,A.top+A.height-2*C/3),this.topLeftBorderStroke=n>0||s>0?Os(A.left+_/2,A.top+v/2,n-_/2,s-v/2,ls.TOP_LEFT):new Ns(A.left+_/2,A.top+v/2),this.topRightBorderStroke=n>0||s>0?Os(A.left+m,A.top+v/2,o-b/2,a-v/2,ls.TOP_RIGHT):new Ns(A.left+A.width-b/2,A.top+v/2),this.bottomRightBorderStroke=c>0||u>0?Os(A.left+B,A.top+w,c-b/2,u-C/2,ls.BOTTOM_RIGHT):new Ns(A.left+A.width-b/2,A.top+A.height-C/2),this.bottomLeftBorderStroke=d>0||f>0?Os(A.left+_/2,A.top+y,d-_/2,f-C/2,ls.BOTTOM_LEFT):new Ns(A.left+_/2,A.top+A.height-C/2),this.topLeftBorderBox=n>0||s>0?Os(A.left,A.top,n,s,ls.TOP_LEFT):new Ns(A.left,A.top),this.topRightBorderBox=o>0||a>0?Os(A.left+m,A.top,o,a,ls.TOP_RIGHT):new Ns(A.left+A.width,A.top),this.bottomRightBorderBox=c>0||u>0?Os(A.left+B,A.top+w,c,u,ls.BOTTOM_RIGHT):new Ns(A.left+A.width,A.top+A.height),this.bottomLeftBorderBox=d>0||f>0?Os(A.left,A.top+y,d,f,ls.BOTTOM_LEFT):new Ns(A.left,A.top+A.height),this.topLeftPaddingBox=n>0||s>0?Os(A.left+_,A.top+v,Math.max(0,n-_),Math.max(0,s-v),ls.TOP_LEFT):new Ns(A.left+_,A.top+v),this.topRightPaddingBox=o>0||a>0?Os(A.left+Math.min(m,A.width-b),A.top+v,m>A.width+b?0:Math.max(0,o-b),Math.max(0,a-v),ls.TOP_RIGHT):new Ns(A.left+A.width-b,A.top+v),this.bottomRightPaddingBox=c>0||u>0?Os(A.left+Math.min(B,A.width-_),A.top+Math.min(w,A.height-C),Math.max(0,c-b),Math.max(0,u-C),ls.BOTTOM_RIGHT):new Ns(A.left+A.width-b,A.top+A.height-C),this.bottomLeftPaddingBox=d>0||f>0?Os(A.left+_,A.top+Math.min(y,A.height-C),Math.max(0,d-_),Math.max(0,f-C),ls.BOTTOM_LEFT):new Ns(A.left+_,A.top+A.height-C),this.topLeftContentBox=n>0||s>0?Os(A.left+_+Q,A.top+v+j,Math.max(0,n-(_+Q)),Math.max(0,s-(v+j)),ls.TOP_LEFT):new Ns(A.left+_+Q,A.top+v+j),this.topRightContentBox=o>0||a>0?Os(A.left+Math.min(m,A.width+_+Q),A.top+v+j,m>A.width+_+Q?0:o-_+Q,a-(v+j),ls.TOP_RIGHT):new Ns(A.left+A.width-(b+x),A.top+v+j),this.bottomRightContentBox=c>0||u>0?Os(A.left+Math.min(B,A.width-(_+Q)),A.top+Math.min(w,A.height+v+j),Math.max(0,c-(b+x)),u-(C+F),ls.BOTTOM_RIGHT):new Ns(A.left+A.width-(b+x),A.top+A.height-(C+F)),this.bottomLeftContentBox=d>0||f>0?Os(A.left+_+Q,A.top+y,Math.max(0,d-(_+Q)),f-(C+F),ls.BOTTOM_LEFT):new Ns(A.left+_+Q,A.top+A.height-(C+F))};!function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(ls||(ls={}));var Os=function(e,t,A,r,n){var s=(Math.sqrt(2)-1)/3*4,i=A*s,o=r*s,a=e+A,l=t+r;switch(n){case ls.TOP_LEFT:return new Hs(new Ns(e,l),new Ns(e,l-o),new Ns(a-i,t),new Ns(a,t));case ls.TOP_RIGHT:return new Hs(new Ns(e,t),new Ns(e+i,t),new Ns(a,l-o),new Ns(a,l));case ls.BOTTOM_RIGHT:return new Hs(new Ns(a,t),new Ns(a,t+o),new Ns(e+i,l),new Ns(e,l));case ls.BOTTOM_LEFT:default:return new Hs(new Ns(a,l),new Ns(a-i,l),new Ns(e,t+o),new Ns(e,t))}},Ms=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Ds=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Rs=function(e,t,A){this.offsetX=e,this.offsetY=t,this.matrix=A,this.type=0,this.target=6},Ks=function(e,t){this.path=e,this.target=t,this.type=1},Vs=function(e){this.opacity=e,this.type=2,this.target=6},Gs=function(e){return 1===e.type},zs=function(e,t){return e.length===t.length&&e.some(function(e,A){return e===t[A]})},qs=function(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},Ws=function(){function e(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Ts(this.container),this.container.styles.opacity<1&&this.effects.push(new Vs(this.container.styles.opacity)),null!==this.container.styles.transform){var A=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,n=this.container.styles.transform;this.effects.push(new Rs(A,r,n))}if(0!==this.container.styles.overflowX){var s=Ms(this.curves),i=Ds(this.curves);zs(s,i)?this.effects.push(new Ks(s,6)):(this.effects.push(new Ks(s,2)),this.effects.push(new Ks(i,4)))}}return e.prototype.getEffects=function(e){for(var t=-1===[2,3].indexOf(this.container.styles.position),A=this.parent,r=this.effects.slice(0);A;){var n=A.effects.filter(function(e){return!Gs(e)});if(t||0!==A.container.styles.position||!A.parent){if(r.unshift.apply(r,n),t=-1===[2,3].indexOf(A.container.styles.position),0!==A.container.styles.overflowX){var s=Ms(A.curves),i=Ds(A.curves);zs(s,i)||r.unshift(new Ks(i,6))}}else r.unshift.apply(r,n);A=A.parent}return r.filter(function(t){return lr(t.target,e)})},e}(),Xs=function(e,t,A,r){e.container.elements.forEach(function(n){var s=lr(n.flags,4),i=lr(n.flags,2),o=new Ws(n,e);lr(n.styles.display,2048)&&r.push(o);var a=lr(n.flags,8)?[]:r;if(s||i){var l=s||n.styles.isPositioned()?A:t,c=new qs(o);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var u=n.styles.zIndex.order;if(u<0){var h=0;l.negativeZIndex.some(function(e,t){return u>e.element.container.styles.zIndex.order?(h=t,!1):h>0}),l.negativeZIndex.splice(h,0,c)}else if(u>0){var d=0;l.positiveZIndex.some(function(e,t){return u>=e.element.container.styles.zIndex.order?(d=t+1,!1):d>0}),l.positiveZIndex.splice(d,0,c)}else l.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else n.styles.isFloating()?l.nonPositionedFloats.push(c):l.nonPositionedInlineLevel.push(c);Xs(o,c,s?c:A,a)}else n.styles.isInlineLevel()?t.inlineLevel.push(o):t.nonInlineLevel.push(o),Xs(o,t,A,a);lr(n.flags,8)&&Ys(n,a)})},Ys=function(e,t){for(var A=e instanceof un?e.start:1,r=e instanceof un&&e.reversed,n=0;n0&&e.intrinsicHeight>0){var r=ti(e),n=Ds(t);this.path(n),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(A,0,0,e.intrinsicWidth,e.intrinsicHeight,r.left,r.top,r.width,r.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(e){return r(this,void 0,void 0,function(){var t,r,s,o,a,l,c,u,h,d,f,p,g,m,w,B,y,v;return n(this,function(n){switch(n.label){case 0:this.applyEffects(e.getEffects(4)),t=e.container,r=e.curves,s=t.styles,o=0,a=t.textNodes,n.label=1;case 1:return o0&&_>0&&(w=r.ctx.createPattern(p,"repeat"),r.renderRepeat(y,w,x,F))):function(e){return 2===e.type}(A)&&(B=Ai(e,t,[null,null,null]),y=B[0],v=B[1],b=B[2],C=B[3],_=B[4],j=0===A.position.length?[At]:A.position,x=st(j[0],C),F=st(j[j.length-1],_),Q=function(e,t,A,r,n){var s=0,i=0;switch(e.size){case 0:0===e.shape?s=i=Math.min(Math.abs(t),Math.abs(t-r),Math.abs(A),Math.abs(A-n)):1===e.shape&&(s=Math.min(Math.abs(t),Math.abs(t-r)),i=Math.min(Math.abs(A),Math.abs(A-n)));break;case 2:if(0===e.shape)s=i=Math.min(Qt(t,A),Qt(t,A-n),Qt(t-r,A),Qt(t-r,A-n));else if(1===e.shape){var o=Math.min(Math.abs(A),Math.abs(A-n))/Math.min(Math.abs(t),Math.abs(t-r)),a=Ut(r,n,t,A,!0),l=a[0],c=a[1];i=o*(s=Qt(l-t,(c-A)/o))}break;case 1:0===e.shape?s=i=Math.max(Math.abs(t),Math.abs(t-r),Math.abs(A),Math.abs(A-n)):1===e.shape&&(s=Math.max(Math.abs(t),Math.abs(t-r)),i=Math.max(Math.abs(A),Math.abs(A-n)));break;case 3:if(0===e.shape)s=i=Math.max(Qt(t,A),Qt(t,A-n),Qt(t-r,A),Qt(t-r,A-n));else if(1===e.shape){o=Math.max(Math.abs(A),Math.abs(A-n))/Math.max(Math.abs(t),Math.abs(t-r));var u=Ut(r,n,t,A,!1);l=u[0],c=u[1],i=o*(s=Qt(l-t,(c-A)/o))}}return Array.isArray(e.size)&&(s=st(e.size[0],r),i=2===e.size.length?st(e.size[1],n):s),[s,i]}(A,x,F,C,_),U=Q[0],E=Q[1],U>0&&E>0&&(S=r.ctx.createRadialGradient(v+x,b+F,0,v+x,b+F,U),xt(A.stops,2*U).forEach(function(e){return S.addColorStop(e.stop,ft(e.color))}),r.path(y),r.ctx.fillStyle=S,U!==E?(L=e.bounds.left+.5*e.bounds.width,I=e.bounds.top+.5*e.bounds.height,k=1/(N=E/U),r.ctx.save(),r.ctx.translate(L,I),r.ctx.transform(1,0,0,N,0,0),r.ctx.translate(-L,-I),r.ctx.fillRect(v,k*(b-I)+I,C,_*k),r.ctx.restore()):r.ctx.fill())),n.label=6;case 6:return t--,[2]}})},r=this,s=0,i=e.styles.backgroundImage.slice(0).reverse(),a.label=1;case 1:return s0?2!==l.style?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,i,e.curves,2)]:[3,11]:[3,13];case 4:return n.sent(),[3,11];case 5:return 3!==l.style?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,i,e.curves,3)];case 6:return n.sent(),[3,11];case 7:return 4!==l.style?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,i,e.curves)];case 8:return n.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,i,e.curves)];case 10:n.sent(),n.label=11;case 11:i++,n.label=12;case 12:return o++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(e,t,A,s,i){return r(this,void 0,void 0,function(){var r,o,a,l,c,u,h,d,f,p,g,m,w,B,y,v;return n(this,function(n){return this.ctx.save(),r=function(e,t){switch(t){case 0:return Zs(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return Zs(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return Zs(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);default:return Zs(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}}(s,A),o=Js(s,A),2===i&&(this.path(o),this.ctx.clip()),Ps(o[0])?(a=o[0].start.x,l=o[0].start.y):(a=o[0].x,l=o[0].y),Ps(o[1])?(c=o[1].end.x,u=o[1].end.y):(c=o[1].x,u=o[1].y),h=0===A||2===A?Math.abs(a-c):Math.abs(l-u),this.ctx.beginPath(),3===i?this.formatPath(r):this.formatPath(o.slice(0,2)),d=t<3?3*t:2*t,f=t<3?2*t:t,3===i&&(d=t,f=t),p=!0,h<=2*d?p=!1:h<=2*d+f?(d*=g=h/(2*d+f),f*=g):(m=Math.floor((h+f)/(d+f)),w=(h-m*d)/(m-1),f=(B=(h-(m+1)*d)/m)<=0||Math.abs(f-w){const e=new Uint8Array(4);return!((new Uint32Array(e.buffer)[0]=1)&e[0])})(),s={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class i{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;constructor(e=8192,t={}){let A=!1;"number"==typeof e?e=new ArrayBuffer(e):(A=!0,this.lastWrittenByte=e.byteLength);const r=t.offset?t.offset>>>0:0,n=e.byteLength-r;let s=r;(ArrayBuffer.isView(e)||e instanceof i)&&(e.byteLength!==e.buffer.byteLength&&(s=e.byteOffset+r),e=e.buffer),this.lastWrittenByte=A?n:0,this.buffer=e,this.length=n,this.byteLength=n,this.byteOffset=s,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,s,n),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const e=this._marks.pop();if(void 0===e)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){const t=2*(this.offset+e),A=new Uint8Array(t);A.set(new Uint8Array(this.buffer)),this.buffer=A.buffer,this.length=t,this.byteLength=t,this._data=new DataView(this.buffer)}return this}readBoolean(){return 0!==this.readUint8()}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,"uint8")}readArray(e,t){const A=s[t].BYTES_PER_ELEMENT*e,r=this.byteOffset+this.offset,i=this.buffer.slice(r,r+A);if(this.littleEndian===n&&"uint8"!==t&&"int8"!==t){const e=new Uint8Array(this.buffer.slice(r,r+A));e.reverse();const n=new s[t](e.buffer);return this.offset+=A,n.reverse(),n}const o=new s[t](i);return this.offset+=A,o}readInt16(){const e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){const e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){const e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){const e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){const e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){const e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){const e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){const e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let t="";for(let A=0;Athis.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}},"./node_modules/iobuffer/lib-esm/text.js":function(e,t,A){"use strict";function r(e,t="utf8"){return new TextDecoder(t).decode(e)}A.r(t),A.d(t,{decode:function(){return r},encode:function(){return s}});const n=new TextEncoder;function s(e){return n.encode(e)}},"./node_modules/jspdf/dist/jspdf.es.min.js":function(e,t,A){"use strict";A.r(t),A.d(t,{AcroForm:function(){return Ue},AcroFormAppearance:function(){return je},AcroFormButton:function(){return we},AcroFormCheckBox:function(){return be},AcroFormChoiceField:function(){return fe},AcroFormComboBox:function(){return ge},AcroFormEditBox:function(){return me},AcroFormListBox:function(){return pe},AcroFormPasswordField:function(){return _e},AcroFormPushButton:function(){return Be},AcroFormRadioButton:function(){return ye},AcroFormTextField:function(){return Ce},GState:function(){return H},ShadingPattern:function(){return T},TilingPattern:function(){return O},default:function(){return M},jsPDF:function(){return M}});var r=A("./node_modules/@babel/runtime/helpers/esm/typeof.js"),n=A("./node_modules/fflate/esm/browser.js"),s=A("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),i=A("./node_modules/fast-png/lib-esm/index.js"),o=function(){return"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this}();function a(){o.console&&"function"==typeof o.console.log&&o.console.log.apply(o.console,arguments)}var l={log:a,warn:function(e){o.console&&("function"==typeof o.console.warn?o.console.warn.apply(o.console,arguments):a.call(null,arguments))},error:function(e){o.console&&("function"==typeof o.console.error?o.console.error.apply(o.console,arguments):a(e))}};function c(e,t,A){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){d(r.response,t,A)},r.onerror=function(){l.error("could not download file")},r.send()}function u(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function h(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(A){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var d=o.saveAs||("object"!==("undefined"==typeof window?"undefined":(0,r.default)(window))||window!==o?function(){}:"undefined"!=typeof HTMLAnchorElement&&"download"in HTMLAnchorElement.prototype?function(e,t,A){var r=o.URL||o.webkitURL,n=document.createElement("a");t=t||e.name||"download",n.download=t,n.rel="noopener","string"==typeof e?(n.href=e,n.origin!==location.origin?u(n.href)?c(e,t,A):h(n,n.target="_blank"):h(n)):(n.href=r.createObjectURL(e),setTimeout(function(){r.revokeObjectURL(n.href)},4e4),setTimeout(function(){h(n)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,A){if(t=t||e.name||"download","string"==typeof e)if(u(e))c(e,t,A);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){h(n)})}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!==(0,r.default)(t)&&(l.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,A),t)}:function(e,t,A,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),"string"==typeof e)return c(e,t,A);var s="application/octet-stream"===e.type,i=/constructor/i.test(o.HTMLElement)||o.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent);if((a||s&&i)&&"object"===("undefined"==typeof FileReader?"undefined":(0,r.default)(FileReader))){var l=new FileReader;l.onloadend=function(){var e=l.result;e=a?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=e:location=e,n=null},l.readAsDataURL(e)}else{var u=o.URL||o.webkitURL,h=u.createObjectURL(e);n?n.location=h:location.href=h,n=null,setTimeout(function(){u.revokeObjectURL(h)},4e4)}});function f(e){var t;e=e||"",this.ok=!1,"#"==e.charAt(0)&&(e=e.substr(1,6)),e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"}[e=(e=e.replace(/ /g,"")).toLowerCase()]||e;for(var A=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],r=0;r255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var e=this.r.toString(16),t=this.g.toString(16),A=this.b.toString(16);return 1==e.length&&(e="0"+e),1==t.length&&(t="0"+t),1==A.length&&(A="0"+A),"#"+e+t+A}}var p=o.atob.bind(o),g=o.btoa.bind(o);function m(e,t){var A=e[0],r=e[1],n=e[2],s=e[3];A=B(A,r,n,s,t[0],7,-680876936),s=B(s,A,r,n,t[1],12,-389564586),n=B(n,s,A,r,t[2],17,606105819),r=B(r,n,s,A,t[3],22,-1044525330),A=B(A,r,n,s,t[4],7,-176418897),s=B(s,A,r,n,t[5],12,1200080426),n=B(n,s,A,r,t[6],17,-1473231341),r=B(r,n,s,A,t[7],22,-45705983),A=B(A,r,n,s,t[8],7,1770035416),s=B(s,A,r,n,t[9],12,-1958414417),n=B(n,s,A,r,t[10],17,-42063),r=B(r,n,s,A,t[11],22,-1990404162),A=B(A,r,n,s,t[12],7,1804603682),s=B(s,A,r,n,t[13],12,-40341101),n=B(n,s,A,r,t[14],17,-1502002290),A=y(A,r=B(r,n,s,A,t[15],22,1236535329),n,s,t[1],5,-165796510),s=y(s,A,r,n,t[6],9,-1069501632),n=y(n,s,A,r,t[11],14,643717713),r=y(r,n,s,A,t[0],20,-373897302),A=y(A,r,n,s,t[5],5,-701558691),s=y(s,A,r,n,t[10],9,38016083),n=y(n,s,A,r,t[15],14,-660478335),r=y(r,n,s,A,t[4],20,-405537848),A=y(A,r,n,s,t[9],5,568446438),s=y(s,A,r,n,t[14],9,-1019803690),n=y(n,s,A,r,t[3],14,-187363961),r=y(r,n,s,A,t[8],20,1163531501),A=y(A,r,n,s,t[13],5,-1444681467),s=y(s,A,r,n,t[2],9,-51403784),n=y(n,s,A,r,t[7],14,1735328473),A=v(A,r=y(r,n,s,A,t[12],20,-1926607734),n,s,t[5],4,-378558),s=v(s,A,r,n,t[8],11,-2022574463),n=v(n,s,A,r,t[11],16,1839030562),r=v(r,n,s,A,t[14],23,-35309556),A=v(A,r,n,s,t[1],4,-1530992060),s=v(s,A,r,n,t[4],11,1272893353),n=v(n,s,A,r,t[7],16,-155497632),r=v(r,n,s,A,t[10],23,-1094730640),A=v(A,r,n,s,t[13],4,681279174),s=v(s,A,r,n,t[0],11,-358537222),n=v(n,s,A,r,t[3],16,-722521979),r=v(r,n,s,A,t[6],23,76029189),A=v(A,r,n,s,t[9],4,-640364487),s=v(s,A,r,n,t[12],11,-421815835),n=v(n,s,A,r,t[15],16,530742520),A=b(A,r=v(r,n,s,A,t[2],23,-995338651),n,s,t[0],6,-198630844),s=b(s,A,r,n,t[7],10,1126891415),n=b(n,s,A,r,t[14],15,-1416354905),r=b(r,n,s,A,t[5],21,-57434055),A=b(A,r,n,s,t[12],6,1700485571),s=b(s,A,r,n,t[3],10,-1894986606),n=b(n,s,A,r,t[10],15,-1051523),r=b(r,n,s,A,t[1],21,-2054922799),A=b(A,r,n,s,t[8],6,1873313359),s=b(s,A,r,n,t[15],10,-30611744),n=b(n,s,A,r,t[6],15,-1560198380),r=b(r,n,s,A,t[13],21,1309151649),A=b(A,r,n,s,t[4],6,-145523070),s=b(s,A,r,n,t[11],10,-1120210379),n=b(n,s,A,r,t[2],15,718787259),r=b(r,n,s,A,t[9],21,-343485551),e[0]=E(A,e[0]),e[1]=E(r,e[1]),e[2]=E(n,e[2]),e[3]=E(s,e[3])}function w(e,t,A,r,n,s){return t=E(E(t,e),E(r,s)),E(t<>>32-n,A)}function B(e,t,A,r,n,s,i){return w(t&A|~t&r,e,t,n,s,i)}function y(e,t,A,r,n,s,i){return w(t&r|A&~r,e,t,n,s,i)}function v(e,t,A,r,n,s,i){return w(t^A^r,e,t,n,s,i)}function b(e,t,A,r,n,s,i){return w(A^(t|~r),e,t,n,s,i)}function C(e){var t,A=e.length,r=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=e.length;t+=64)m(r,_(e.substring(t-64,t)));e=e.substring(t-64);var n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(n[t>>2]|=128<<(t%4<<3),t>55)for(m(r,n),t=0;t<16;t++)n[t]=0;return n[14]=8*A,m(r,n),r}function _(e){var t,A=[];for(t=0;t<64;t+=4)A[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return A}var j="0123456789abcdef".split("");function x(e){for(var t="",A=0;A<4;A++)t+=j[e>>8*A+4&15]+j[e>>8*A&15];return t}function F(e){return String.fromCharCode(255&e,(65280&e)>>8,(16711680&e)>>16,(4278190080&e)>>24)}function Q(e){return C(e).map(F).join("")}var U="5d41402abc4b2a76b9719d911017c592"!=function(e){for(var t=0;t>16)+(t>>16)+(A>>16)<<16|65535&A}return e+t&4294967295}function S(e,t){var A,r,n,s;if(e!==A){for(var i=(n=e,s=1+(256/e.length|0),new Array(s+1).join(n)),o=[],a=0;a<256;a++)o[a]=a;var l=0;for(a=0;a<256;a++){var c=o[a];l=(l+c+i.charCodeAt(a))%256,o[a]=o[l],o[l]=c}A=e,r=o}else o=r;var u=t.length,h=0,d=0,f="";for(a=0;a€/\f©þdSiz";var s=(t+this.padding).substr(0,32),i=(A+this.padding).substr(0,32);this.O=this.processOwnerPassword(s,i),this.P=-(1+(255^n)),this.encryptionKey=Q(s+this.O+this.lsbFirstWord(this.P)+this.hexToBytes(r)).substr(0,5),this.U=S(this.encryptionKey,this.padding)}function N(e){if(/[^\u0000-\u00ff]/.test(e))throw new Error("Invalid PDF Name Object: "+e+", Only accept ASCII characters.");for(var t="",A=e.length,r=0;r126?"#"+("0"+n.toString(16)).slice(-2):e[r]}return t}function k(e){if("object"!==(0,r.default)(e))throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var t={};this.subscribe=function(e,A,r){if(r=r||!1,"string"!=typeof e||"function"!=typeof A||"boolean"!=typeof r)throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");t.hasOwnProperty(e)||(t[e]={});var n=Math.random().toString(35);return t[e][n]=[A,!!r],n},this.unsubscribe=function(e){for(var A in t)if(t[A][e])return delete t[A][e],0===Object.keys(t[A]).length&&delete t[A],!0;return!1},this.publish=function(A){if(t.hasOwnProperty(A)){var r=Array.prototype.slice.call(arguments,1),n=[];for(var s in t[A]){var i=t[A][s];try{i[0].apply(e,r)}catch(e){o.console&&l.error("jsPDF PubSub Error",e.message,e)}i[1]&&n.push(s)}n.length&&n.forEach(this.unsubscribe)}},this.getTopics=function(){return t}}function H(e){if(!(this instanceof H))return new H(e);var t="opacity,stroke-opacity".split(",");for(var A in e)e.hasOwnProperty(A)&&t.indexOf(A)>=0&&(this[A]=e[A]);this.id="",this.objectNumber=-1}function P(e,t){this.gState=e,this.matrix=t,this.id="",this.objectNumber=-1}function T(e,t,A,r,n){if(!(this instanceof T))return new T(e,t,A,r,n);this.type="axial"===e?2:3,this.coords=t,this.colors=A,P.call(this,r,n)}function O(e,t,A,r,n){if(!(this instanceof O))return new O(e,t,A,r,n);this.boundingBox=e,this.xStep=t,this.yStep=A,this.stream="",this.cloneIndex=0,P.call(this,r,n)}function M(e){var t,A="string"==typeof arguments[0]?arguments[0]:"p",n=arguments[1],s=arguments[2],i=arguments[3],a=[],c=1,u=16,h="S",p=null;"object"===(0,r.default)(e=e||{})&&(A=e.orientation,n=e.unit||n,s=e.format||s,i=e.compress||e.compressPdf||i,null!==(p=e.encryption||null)&&(p.userPassword=p.userPassword||"",p.ownerPassword=p.ownerPassword||"",p.userPermissions=p.userPermissions||[]),c="number"==typeof e.userUnit?Math.abs(e.userUnit):1,void 0!==e.precision&&(t=e.precision),void 0!==e.floatPrecision&&(u=e.floatPrecision),h=e.defaultPathOperation||"S"),a=e.filters||(!0===i?["FlateEncode"]:a),n=n||"mm",A=(""+(A||"P")).toLowerCase();var m=e.putOnlyUsedFonts||!1,w={},B={internal:{},__private__:{}};B.__private__.PubSub=k;var y="1.3",v=B.__private__.getPdfVersion=function(){return y};B.__private__.setPdfVersion=function(e){y=e};var b={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]};B.__private__.getPageFormats=function(){return b};var C=B.__private__.getPageFormat=function(e){return b[e]};s=s||"a4";var _="compat",j="advanced",x=_;function F(){this.saveGraphicsState(),ce(new Ve(je,0,0,-je,0,jA()*je).toString()+" cm"),this.setFontSize(this.getFontSize()/je),h="n",x=j}function Q(){this.restoreGraphicsState(),h="S",x=_}var U=B.__private__.combineFontStyleAndFontWeight=function(e,t){if("bold"==e&&"normal"==t||"bold"==e&&400==t||"normal"==e&&"italic"==t||"bold"==e&&"italic"==t)throw new Error("Invalid Combination of fontweight and fontstyle");return t&&(e=400==t||"normal"===t?"italic"===e?"italic":"normal":700!=t&&"bold"!==t||"normal"!==e?(700==t?"bold":t)+""+e:"bold"),e};B.advancedAPI=function(e){var t=x===_;return t&&F.call(this),"function"!=typeof e||(e(this),t&&Q.call(this)),this},B.compatAPI=function(e){var t=x===j;return t&&Q.call(this),"function"!=typeof e||(e(this),t&&F.call(this)),this},B.isAdvancedAPI=function(){return x===j};var E,S=function(e){if(x!==j)throw new Error(e+" is only available in 'advanced' API mode. You need to call advancedAPI() first.")},L=B.roundToPrecision=B.__private__.roundToPrecision=function(e,A){var r=t||A;if(isNaN(e)||isNaN(r))throw new Error("Invalid argument passed to jsPDF.roundToPrecision");return e.toFixed(r).replace(/0+$/,"")};E=B.hpf=B.__private__.hpf="number"==typeof u?function(e){if(isNaN(e))throw new Error("Invalid argument passed to jsPDF.hpf");return L(e,u)}:"smart"===u?function(e){if(isNaN(e))throw new Error("Invalid argument passed to jsPDF.hpf");return L(e,e>-1&&e<1?16:5)}:function(e){if(isNaN(e))throw new Error("Invalid argument passed to jsPDF.hpf");return L(e,16)};var P=B.f2=B.__private__.f2=function(e){if(isNaN(e))throw new Error("Invalid argument passed to jsPDF.f2");return L(e,2)},D=B.__private__.f3=function(e){if(isNaN(e))throw new Error("Invalid argument passed to jsPDF.f3");return L(e,3)},R=B.scale=B.__private__.scale=function(e){if(isNaN(e))throw new Error("Invalid argument passed to jsPDF.scale");return x===_?e*je:x===j?e:void 0},K=function(e){return R(function(e){return x===_?jA()-e:x===j?e:void 0}(e))};B.__private__.setPrecision=B.setPrecision=function(e){"number"==typeof parseInt(e,10)&&(t=parseInt(e,10))};var V,G="00000000000000000000000000000000",z=B.__private__.getFileId=function(){return G},q=B.__private__.setFileId=function(e){return G=void 0!==e&&/^[a-fA-F0-9]{32}$/.test(e)?e.toUpperCase():G.split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),null!==p&&(St=new I(p.userPermissions,p.userPassword,p.ownerPassword,G)),G};B.setFileId=function(e){return q(e),this},B.getFileId=function(){return z()};var W=B.__private__.convertDateToPDFDate=function(e){var t=e.getTimezoneOffset(),A=t<0?"+":"-",r=Math.floor(Math.abs(t/60)),n=Math.abs(t%60),s=[A,$(r),"'",$(n),"'"].join("");return["D:",e.getFullYear(),$(e.getMonth()+1),$(e.getDate()),$(e.getHours()),$(e.getMinutes()),$(e.getSeconds()),s].join("")},X=B.__private__.convertPDFDateToDate=function(e){var t=parseInt(e.substr(2,4),10),A=parseInt(e.substr(6,2),10)-1,r=parseInt(e.substr(8,2),10),n=parseInt(e.substr(10,2),10),s=parseInt(e.substr(12,2),10),i=parseInt(e.substr(14,2),10);return new Date(t,A,r,n,s,i,0)},Y=B.__private__.setCreationDate=function(e){var t;if(void 0===e&&(e=new Date),e instanceof Date)t=W(e);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|-0[0-9]|-1[0-1])'(0[0-9]|[1-5][0-9])'?$/.test(e))throw new Error("Invalid argument passed to jsPDF.setCreationDate");t=e}return V=t},J=B.__private__.getCreationDate=function(e){var t=V;return"jsDate"===e&&(t=X(V)),t};B.setCreationDate=function(e){return Y(e),this},B.getCreationDate=function(e){return J(e)};var Z,$=B.__private__.padd2=function(e){return("0"+parseInt(e)).slice(-2)},ee=B.__private__.padd2Hex=function(e){return("00"+(e=e.toString())).substr(e.length)},te=0,Ae=[],re=[],ne=0,se=[],ie=[],oe=!1,ae=re;B.__private__.setCustomOutputDestination=function(e){oe=!0,ae=e};var le=function(e){oe||(ae=e)};B.__private__.resetCustomOutputDestination=function(){oe=!1,ae=re};var ce=B.__private__.out=function(e){return e=e.toString(),ne+=e.length+1,ae.push(e),ae},ue=B.__private__.write=function(e){return ce(1===arguments.length?e.toString():Array.prototype.join.call(arguments," "))},he=B.__private__.getArrayBuffer=function(e){for(var t=e.length,A=new ArrayBuffer(t),r=new Uint8Array(A);t--;)r[t]=e.charCodeAt(t);return A},de=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]];B.__private__.getStandardFonts=function(){return de};var fe=e.fontSize||16;B.__private__.setFontSize=B.setFontSize=function(e){return fe=x===j?e/je:e,this};var pe,ge=B.__private__.getFontSize=B.getFontSize=function(){return x===_?fe:fe*je},me=e.R2L||!1;B.__private__.setR2L=B.setR2L=function(e){return me=e,this},B.__private__.getR2L=B.getR2L=function(){return me};var we,Be=B.__private__.setZoomMode=function(e){if(/^(?:\d+\.\d*|\d*\.\d+|\d+)%$/.test(e))pe=e;else if(isNaN(e)){if(-1===[void 0,null,"fullwidth","fullheight","fullpage","original"].indexOf(e))throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+e+'" is not recognized.');pe=e}else pe=parseInt(e,10)};B.__private__.getZoomMode=function(){return pe};var ye,ve=B.__private__.setPageMode=function(e){if(-1==[void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(e))throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+e+'" is not recognized.');we=e};B.__private__.getPageMode=function(){return we};var be=B.__private__.setLayoutMode=function(e){if(-1==[void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(e))throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+e+'" is not recognized.');ye=e};B.__private__.getLayoutMode=function(){return ye},B.__private__.setDisplayMode=B.setDisplayMode=function(e,t,A){return Be(e),be(t),ve(A),this};var Ce={title:"",subject:"",author:"",keywords:"",creator:""};B.__private__.getDocumentProperty=function(e){if(-1===Object.keys(Ce).indexOf(e))throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return Ce[e]},B.__private__.getDocumentProperties=function(){return Ce},B.__private__.setDocumentProperties=B.setProperties=B.setDocumentProperties=function(e){for(var t in Ce)Ce.hasOwnProperty(t)&&e[t]&&(Ce[t]=e[t]);return this},B.__private__.setDocumentProperty=function(e,t){if(-1===Object.keys(Ce).indexOf(e))throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return Ce[e]=t};var _e,je,xe,Fe,Qe,Ue={},Ee={},Se=[],Le={},Ie={},Ne={},ke={},He=null,Pe=0,Te=[],Oe=new k(B),Me=e.hotfixes||[],De={},Re={},Ke=[],Ve=function e(t,A,r,n,s,i){if(!(this instanceof e))return new e(t,A,r,n,s,i);isNaN(t)&&(t=1),isNaN(A)&&(A=0),isNaN(r)&&(r=0),isNaN(n)&&(n=1),isNaN(s)&&(s=0),isNaN(i)&&(i=0),this._matrix=[t,A,r,n,s,i]};Object.defineProperty(Ve.prototype,"sx",{get:function(){return this._matrix[0]},set:function(e){this._matrix[0]=e}}),Object.defineProperty(Ve.prototype,"shy",{get:function(){return this._matrix[1]},set:function(e){this._matrix[1]=e}}),Object.defineProperty(Ve.prototype,"shx",{get:function(){return this._matrix[2]},set:function(e){this._matrix[2]=e}}),Object.defineProperty(Ve.prototype,"sy",{get:function(){return this._matrix[3]},set:function(e){this._matrix[3]=e}}),Object.defineProperty(Ve.prototype,"tx",{get:function(){return this._matrix[4]},set:function(e){this._matrix[4]=e}}),Object.defineProperty(Ve.prototype,"ty",{get:function(){return this._matrix[5]},set:function(e){this._matrix[5]=e}}),Object.defineProperty(Ve.prototype,"a",{get:function(){return this._matrix[0]},set:function(e){this._matrix[0]=e}}),Object.defineProperty(Ve.prototype,"b",{get:function(){return this._matrix[1]},set:function(e){this._matrix[1]=e}}),Object.defineProperty(Ve.prototype,"c",{get:function(){return this._matrix[2]},set:function(e){this._matrix[2]=e}}),Object.defineProperty(Ve.prototype,"d",{get:function(){return this._matrix[3]},set:function(e){this._matrix[3]=e}}),Object.defineProperty(Ve.prototype,"e",{get:function(){return this._matrix[4]},set:function(e){this._matrix[4]=e}}),Object.defineProperty(Ve.prototype,"f",{get:function(){return this._matrix[5]},set:function(e){this._matrix[5]=e}}),Object.defineProperty(Ve.prototype,"rotation",{get:function(){return Math.atan2(this.shx,this.sx)}}),Object.defineProperty(Ve.prototype,"scaleX",{get:function(){return this.decompose().scale.sx}}),Object.defineProperty(Ve.prototype,"scaleY",{get:function(){return this.decompose().scale.sy}}),Object.defineProperty(Ve.prototype,"isIdentity",{get:function(){return 1===this.sx&&0===this.shy&&0===this.shx&&1===this.sy&&0===this.tx&&0===this.ty}}),Ve.prototype.join=function(e){return[this.sx,this.shy,this.shx,this.sy,this.tx,this.ty].map(E).join(e)},Ve.prototype.multiply=function(e){var t=e.sx*this.sx+e.shy*this.shx,A=e.sx*this.shy+e.shy*this.sy,r=e.shx*this.sx+e.sy*this.shx,n=e.shx*this.shy+e.sy*this.sy,s=e.tx*this.sx+e.ty*this.shx+this.tx,i=e.tx*this.shy+e.ty*this.sy+this.ty;return new Ve(t,A,r,n,s,i)},Ve.prototype.decompose=function(){var e=this.sx,t=this.shy,A=this.shx,r=this.sy,n=this.tx,s=this.ty,i=Math.sqrt(e*e+t*t),o=(e/=i)*A+(t/=i)*r;A-=e*o,r-=t*o;var a=Math.sqrt(A*A+r*r);return o/=a,e*(r/=a)>16&255,n=l>>8&255,s=255&l}if(void 0===n||void 0===i&&A===n&&n===s)t="string"==typeof A?A+" "+o[0]:2===e.precision?P(A/255)+" "+o[0]:D(A/255)+" "+o[0];else if(void 0===i||"object"===(0,r.default)(i)){if(i&&!isNaN(i.a)&&0===i.a)return["1.","1.","1.",o[1]].join(" ");t="string"==typeof A?[A,n,s,o[1]].join(" "):2===e.precision?[P(A/255),P(n/255),P(s/255),o[1]].join(" "):[D(A/255),D(n/255),D(s/255),o[1]].join(" ")}else t="string"==typeof A?[A,n,s,i,o[2]].join(" "):2===e.precision?[P(A),P(n),P(s),P(i),o[2]].join(" "):[D(A),D(n),D(s),D(i),o[2]].join(" ");return t},rt=B.__private__.getFilters=function(){return a},nt=B.__private__.putStream=function(e){var t=(e=e||{}).data||"",A=e.filters||rt(),r=e.alreadyAppliedFilters||[],n=e.addLength1||!1,s=t.length,i=e.objectId,o=function(e){return e};if(null!==p&&void 0===i)throw new Error("ObjectId must be passed to putStream for file encryption");null!==p&&(o=St.encryptor(i,0));var a={};!0===A&&(A=["FlateEncode"]);var l=e.additionalKeyValues||[],c=(a=void 0!==M.API.processDataByFilters?M.API.processDataByFilters(t,A):{data:t,reverseChain:[]}).reverseChain+(Array.isArray(r)?r.join(" "):r.toString());if(0!==a.data.length&&(l.push({key:"Length",value:a.data.length}),!0===n&&l.push({key:"Length1",value:s})),0!=c.length)if(c.split("/").length-1==1)l.push({key:"Filter",value:c});else{l.push({key:"Filter",value:"["+c+"]"});for(var u=0;u>"),0!==a.data.length&&(ce("stream"),ce(o(a.data)),ce("endstream"))},st=B.__private__.putPage=function(e){var t=e.number,A=e.data,r=e.objId,n=e.contentsObjId;Je(r,!0),ce("<>"),ce("endobj");var s=A.join("\n");return x===j&&(s+="\nQ"),Je(n,!0),nt({data:s,filters:rt(),objectId:n}),ce("endobj"),r},it=B.__private__.putPages=function(){var e,t,A=[];for(e=1;e<=Pe;e++)Te[e].objId=Ye(),Te[e].contentsObjId=Ye();for(e=1;e<=Pe;e++)A.push(st({number:e,data:ie[e],objId:Te[e].objId,contentsObjId:Te[e].contentsObjId,mediaBox:Te[e].mediaBox,cropBox:Te[e].cropBox,bleedBox:Te[e].bleedBox,trimBox:Te[e].trimBox,artBox:Te[e].artBox,userUnit:Te[e].userUnit,rootDictionaryObjId:$e,resourceDictionaryObjId:et}));Je($e,!0),ce("<>"),ce("endobj"),Oe.publish("postPutPages")},ot=function(e){Oe.publish("putFont",{font:e,out:ce,newObject:Xe,putStream:nt}),!0!==e.isAlreadyPutted&&(e.objectNumber=Xe(),ce("<<"),ce("/Type /Font"),ce("/BaseFont /"+N(e.postScriptName)),ce("/Subtype /Type1"),"string"==typeof e.encoding&&ce("/Encoding /"+e.encoding),ce("/FirstChar 32"),ce("/LastChar 255"),ce(">>"),ce("endobj"))},at=function(e){e.objectNumber=Xe();var t=[];t.push({key:"Type",value:"/XObject"}),t.push({key:"Subtype",value:"/Form"}),t.push({key:"BBox",value:"["+[E(e.x),E(e.y),E(e.x+e.width),E(e.y+e.height)].join(" ")+"]"}),t.push({key:"Matrix",value:"["+e.matrix.toString()+"]"});var A=e.pages[1].join("\n");nt({data:A,additionalKeyValues:t,objectId:e.objectNumber}),ce("endobj")},lt=function(e,t){t||(t=21);var A=Xe(),r=function(e,t){var A,r=[],n=1/(t-1);for(A=0;A<1;A+=n)r.push(A);if(r.push(1),0!=e[0].offset){var s={offset:0,color:e[0].color};e.unshift(s)}if(1!=e[e.length-1].offset){var i={offset:1,color:e[e.length-1].color};e.push(i)}for(var o="",a=0,l=0;le[a+1].offset;)a++;var c=e[a].offset,u=(A-c)/(e[a+1].offset-c),h=e[a].color,d=e[a+1].color;o+=ee(Math.round((1-u)*h[0]+u*d[0]).toString(16))+ee(Math.round((1-u)*h[1]+u*d[1]).toString(16))+ee(Math.round((1-u)*h[2]+u*d[2]).toString(16))}return o.trim()}(e.colors,t),n=[];n.push({key:"FunctionType",value:"0"}),n.push({key:"Domain",value:"[0.0 1.0]"}),n.push({key:"Size",value:"["+t+"]"}),n.push({key:"BitsPerSample",value:"8"}),n.push({key:"Range",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),n.push({key:"Decode",value:"[0.0 1.0 0.0 1.0 0.0 1.0]"}),nt({data:r,additionalKeyValues:n,alreadyAppliedFilters:["/ASCIIHexDecode"],objectId:A}),ce("endobj"),e.objectNumber=Xe(),ce("<< /ShadingType "+e.type),ce("/ColorSpace /DeviceRGB");var s="/Coords ["+E(parseFloat(e.coords[0]))+" "+E(parseFloat(e.coords[1]))+" ";2===e.type?s+=E(parseFloat(e.coords[2]))+" "+E(parseFloat(e.coords[3])):s+=E(parseFloat(e.coords[2]))+" "+E(parseFloat(e.coords[3]))+" "+E(parseFloat(e.coords[4]))+" "+E(parseFloat(e.coords[5])),ce(s+="]"),e.matrix&&ce("/Matrix ["+e.matrix.toString()+"]"),ce("/Function "+A+" 0 R"),ce("/Extend [true true]"),ce(">>"),ce("endobj")},ct=function(e,t){var A=Ye(),r=Xe();t.push({resourcesOid:A,objectOid:r}),e.objectNumber=r;var n=[];n.push({key:"Type",value:"/Pattern"}),n.push({key:"PatternType",value:"1"}),n.push({key:"PaintType",value:"1"}),n.push({key:"TilingType",value:"1"}),n.push({key:"BBox",value:"["+e.boundingBox.map(E).join(" ")+"]"}),n.push({key:"XStep",value:E(e.xStep)}),n.push({key:"YStep",value:E(e.yStep)}),n.push({key:"Resources",value:A+" 0 R"}),e.matrix&&n.push({key:"Matrix",value:"["+e.matrix.toString()+"]"}),nt({data:e.stream,additionalKeyValues:n,objectId:e.objectNumber}),ce("endobj")},ut=function(e){for(var t in e.objectNumber=Xe(),ce("<<"),e)switch(t){case"opacity":ce("/ca "+P(e[t]));break;case"stroke-opacity":ce("/CA "+P(e[t]))}ce(">>"),ce("endobj")},ht=function(e){Je(e.resourcesOid,!0),ce("<<"),ce("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),function(){for(var e in ce("/Font <<"),Ue)Ue.hasOwnProperty(e)&&(!1===m||!0===m&&w.hasOwnProperty(e))&&ce("/"+e+" "+Ue[e].objectNumber+" 0 R");ce(">>")}(),function(){if(Object.keys(Le).length>0){for(var e in ce("/Shading <<"),Le)Le.hasOwnProperty(e)&&Le[e]instanceof T&&Le[e].objectNumber>=0&&ce("/"+e+" "+Le[e].objectNumber+" 0 R");Oe.publish("putShadingPatternDict"),ce(">>")}}(),function(e){if(Object.keys(Le).length>0){for(var t in ce("/Pattern <<"),Le)Le.hasOwnProperty(t)&&Le[t]instanceof B.TilingPattern&&Le[t].objectNumber>=0&&Le[t].objectNumber>")}}(e.objectOid),function(){if(Object.keys(Ne).length>0){var e;for(e in ce("/ExtGState <<"),Ne)Ne.hasOwnProperty(e)&&Ne[e].objectNumber>=0&&ce("/"+e+" "+Ne[e].objectNumber+" 0 R");Oe.publish("putGStateDict"),ce(">>")}}(),function(){for(var e in ce("/XObject <<"),De)De.hasOwnProperty(e)&&De[e].objectNumber>=0&&ce("/"+e+" "+De[e].objectNumber+" 0 R");Oe.publish("putXobjectDict"),ce(">>")}(),ce(">>"),ce("endobj")},dt=function(e){Ee[e.fontName]=Ee[e.fontName]||{},Ee[e.fontName][e.fontStyle]=e.id},ft=function(e,t,A,r,n){var s={id:"F"+(Object.keys(Ue).length+1).toString(10),postScriptName:e,fontName:t,fontStyle:A,encoding:r,isStandardFont:n||!1,metadata:{}};return Oe.publish("addFont",{font:s,instance:this}),Ue[s.id]=s,dt(s),s.id},pt=B.__private__.pdfEscape=B.pdfEscape=function(e,t){return function(e,t){var A,r,n,s,i,o,a,l,c;if(n=(t=t||{}).sourceEncoding||"Unicode",i=t.outputEncoding,(t.autoencode||i)&&Ue[_e].metadata&&Ue[_e].metadata[n]&&Ue[_e].metadata[n].encoding&&(s=Ue[_e].metadata[n].encoding,!i&&Ue[_e].encoding&&(i=Ue[_e].encoding),!i&&s.codePages&&(i=s.codePages[0]),"string"==typeof i&&(i=s[i]),i)){for(a=!1,o=[],A=0,r=e.length;A>8&&(a=!0);e=o.join("")}for(A=e.length;void 0===a&&0!==A;)e.charCodeAt(A-1)>>8&&(a=!0),A--;if(!a)return e;for(o=t.noBOM?[]:[254,255],A=0,r=e.length;A>8)>>8)throw new Error("Character at position "+A+" of string '"+e+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");o.push(c),o.push(l-(c<<8))}return String.fromCharCode.apply(void 0,o)}(e,t).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},gt=B.__private__.beginPage=function(e){ie[++Pe]=[],Te[Pe]={objId:0,contentsObjId:0,userUnit:Number(c),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(e[0]),topRightY:Number(e[1])}},Bt(Pe),le(ie[Z])},mt=function(e,t){var r,n,i;switch(A=t||A,"string"==typeof e&&(r=C(e.toLowerCase()),Array.isArray(r)&&(n=r[0],i=r[1])),Array.isArray(e)&&(n=e[0]*je,i=e[1]*je),isNaN(n)&&(n=s[0],i=s[1]),(n>14400||i>14400)&&(l.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),n=Math.min(14400,n),i=Math.min(14400,i)),s=[n,i],A.substr(0,1)){case"l":i>n&&(s=[i,n]);break;case"p":n>i&&(s=[i,n])}gt(s),Jt(Xt),ce(sA),0!==uA&&ce(uA+" J"),0!==hA&&ce(hA+" j"),Oe.publish("addPage",{pageNumber:Pe})},wt=function(e){e>0&&e<=Pe&&(ie.splice(e,1),Te.splice(e,1),Pe--,Z>Pe&&(Z=Pe),this.setPage(Z))},Bt=function(e){e>0&&e<=Pe&&(Z=e)},yt=B.__private__.getNumberOfPages=B.getNumberOfPages=function(){return ie.length-1},vt=function(e,t,A){var r,n=void 0;return A=A||{},e=void 0!==e?e:Ue[_e].fontName,t=void 0!==t?t:Ue[_e].fontStyle,r=e.toLowerCase(),void 0!==Ee[r]&&void 0!==Ee[r][t]?n=Ee[r][t]:void 0!==Ee[e]&&void 0!==Ee[e][t]?n=Ee[e][t]:!1===A.disableWarning&&l.warn("Unable to look up font label for font '"+e+"', '"+t+"'. Refer to getFontList() for available fonts."),n||A.noFallback||null==(n=Ee.times[t])&&(n=Ee.times.normal),n},bt=B.__private__.putInfo=function(){var e=Xe(),t=function(e){return e};for(var A in null!==p&&(t=St.encryptor(e,0)),ce("<<"),ce("/Producer ("+pt(t("jsPDF "+M.version))+")"),Ce)Ce.hasOwnProperty(A)&&Ce[A]&&ce("/"+A.substr(0,1).toUpperCase()+A.substr(1)+" ("+pt(t(Ce[A]))+")");ce("/CreationDate ("+pt(t(V))+")"),ce(">>"),ce("endobj")},Ct=B.__private__.putCatalog=function(e){var t=(e=e||{}).rootDictionaryObjId||$e;switch(Xe(),ce("<<"),ce("/Type /Catalog"),ce("/Pages "+t+" 0 R"),pe||(pe="fullwidth"),pe){case"fullwidth":ce("/OpenAction [3 0 R /FitH null]");break;case"fullheight":ce("/OpenAction [3 0 R /FitV null]");break;case"fullpage":ce("/OpenAction [3 0 R /Fit]");break;case"original":ce("/OpenAction [3 0 R /XYZ null null 1]");break;default:var A=""+pe;"%"===A.substr(A.length-1)&&(pe=parseInt(pe)/100),"number"==typeof pe&&ce("/OpenAction [3 0 R /XYZ null null "+P(pe)+"]")}switch(ye||(ye="continuous"),ye){case"continuous":ce("/PageLayout /OneColumn");break;case"single":ce("/PageLayout /SinglePage");break;case"two":case"twoleft":ce("/PageLayout /TwoColumnLeft");break;case"tworight":ce("/PageLayout /TwoColumnRight")}we&&ce("/PageMode /"+we),Oe.publish("putCatalog"),ce(">>"),ce("endobj")},_t=B.__private__.putTrailer=function(){ce("trailer"),ce("<<"),ce("/Size "+(te+1)),ce("/Root "+te+" 0 R"),ce("/Info "+(te-1)+" 0 R"),null!==p&&ce("/Encrypt "+St.oid+" 0 R"),ce("/ID [ <"+G+"> <"+G+"> ]"),ce(">>")},jt=B.__private__.putHeader=function(){ce("%PDF-"+y),ce("%ºß¬à")},xt=B.__private__.putXRef=function(){var e="0000000000";ce("xref"),ce("0 "+(te+1)),ce("0000000000 65535 f ");for(var t=1;t<=te;t++)"function"==typeof Ae[t]?ce((e+Ae[t]()).slice(-10)+" 00000 n "):void 0!==Ae[t]?ce((e+Ae[t]).slice(-10)+" 00000 n "):ce("0000000000 00000 n ")},Ft=B.__private__.buildDocument=function(){var e;te=0,ne=0,re=[],Ae=[],se=[],$e=Ye(),et=Ye(),le(re),Oe.publish("buildDocument"),jt(),it(),function(){Oe.publish("putAdditionalObjects");for(var e=0;e"),ce("/O <"+St.toHexString(St.O)+">"),ce("/P "+St.P),ce(">>"),ce("endobj")),bt(),Ct();var t=ne;return xt(),_t(),ce("startxref"),ce(""+t),ce("%%EOF"),le(ie[Z]),re.join("\n")},Qt=B.__private__.getBlob=function(e){return new Blob([he(e)],{type:"application/pdf"})},Ut=B.output=B.__private__.output=(We=function(e,t){switch("string"==typeof(t=t||{})?t={filename:t}:t.filename=t.filename||"generated.pdf",e){case void 0:return Ft();case"save":B.save(t.filename);break;case"arraybuffer":return he(Ft());case"blob":return Qt(Ft());case"bloburi":case"bloburl":if(void 0!==o.URL&&"function"==typeof o.URL.createObjectURL)return o.URL&&o.URL.createObjectURL(Qt(Ft()))||void 0;l.warn("bloburl is not supported by your system, because URL.createObjectURL is not supported by your browser.");break;case"datauristring":case"dataurlstring":var A="",r=Ft();try{A=g(r)}catch(e){A=g(unescape(encodeURIComponent(r)))}return"data:application/pdf;filename="+t.filename+";base64,"+A;case"pdfobjectnewwindow":if("[object Window]"===Object.prototype.toString.call(o)){var n="https://cdnjs.cloudflare.com/ajax/libs/pdfobject/2.1.1/pdfobject.min.js",s=' integrity="sha512-4ze/a9/4jqu+tX9dfOqJYSvyYd5M6qum/3HpCLr+/Jqf0whc37VUbkpNGHR7/8pSnCFw47T1fmIpwBV7UySh3g==" crossorigin="anonymous"';t.pdfObjectUrl&&(n=t.pdfObjectUrl,s="");var i=' + + + + + + +

Analisis Grafik Parameter Listrik

+ + +
+
+ + + + + +
+ + + s/d + + +
+
+ + +
+ + +
+
+ +
+
+ + + + +{% endblock content %} diff --git a/dashboard/templates/dashboard/base.html b/dashboard/templates/dashboard/base.html new file mode 100644 index 0000000..58be216 --- /dev/null +++ b/dashboard/templates/dashboard/base.html @@ -0,0 +1,449 @@ +{% load static %} + + + + + + + Monitoring kWh Meter Pro + + + + + + + + +
+ + +
+ + +
+ + +
+ + Logo + + + Sistem Informasi Energi Real-time + + + {% if request.resolver_match.url_name != 'report_per_area' and request.resolver_match.url_name != 'report_all' %} + + + + + +
+ + Area: - + + + Ket: - + +
+ + {% endif %} +
+ + +
+
+ + {{ request.user.get_full_name|default:request.user.username }} +
+ +
+ {% csrf_token %} + +
+
+
+ + +
+ {% block content %} + + {% endblock content %} +
+
+ + + + + + + + \ No newline at end of file diff --git a/dashboard/templates/dashboard/index.html b/dashboard/templates/dashboard/index.html new file mode 100644 index 0000000..a3486ac --- /dev/null +++ b/dashboard/templates/dashboard/index.html @@ -0,0 +1,490 @@ +{% extends 'dashboard/base.html' %} + +{% load static %} + +{% block content %} + + + + + + + + +
+ + +
+

Dashboard Monitoring kWh Meter Real-time

+ + + +
+ + +
+
+

Active Power

+

0.00 kWh

+
+
+

Apparent Power / Voltage

+

0 V / VA

+
+
+

Power Factor

+

0.00

+
+
+

Total Current

+

0.0000 A

+
+
+ + + +
+ + +
+

+ + Grafik Faktor Daya (Power Factor / Cos φ) +

+
+ +
+
+ + +
+

+ + Grafik Arus (Amper) & Daya Semu (VA) +

+
+ +
+
+ +
+ + +
+

+ + Grafik Akumulasi Total Energi (kWh) +

+
+ +
+
+ + + +{% endblock content %} diff --git a/dashboard/templates/dashboard/log_kwh.html b/dashboard/templates/dashboard/log_kwh.html new file mode 100644 index 0000000..d06924c --- /dev/null +++ b/dashboard/templates/dashboard/log_kwh.html @@ -0,0 +1,231 @@ +{% extends 'dashboard/base.html' %} + +{% load static %} + +{% block content %} + + + + + + + +

Log Riwayat Data kWh

+ + +
+ +
+ + + + + +
+ + + s/d + + +
+
+ + + +
+ + +
+
+ + Total Konsumsi Periode Ini: + + + 0.0000 kWh + +
+
+ + +
+
+ +
+
+ + +{% endblock content %} diff --git a/dashboard/templates/dashboard/manajemen_mesin.html b/dashboard/templates/dashboard/manajemen_mesin.html new file mode 100644 index 0000000..8040a70 --- /dev/null +++ b/dashboard/templates/dashboard/manajemen_mesin.html @@ -0,0 +1,600 @@ +{% extends 'dashboard/base.html' %} + +{% block content %} + + + + +
+ + + + + + + + + + + + + + {% for mesin in daftar_mesin %} + + + + + + + + + + + + + + + + {% empty %} + + + + {% endfor %} + + +
NoNama MesinArea / LokasiKeteranganToken Keamanan ESP32Status LaporanTanggal Terdaftar
{{ forloop.counter }}{{ mesin.nama_mesin }} + {% if mesin.area %} + + {{ mesin.area.nama_area }} + + {% else %} + - + {% endif %} + +
+ {{ mesin.keterangan|default:"-" }} + +
+ + +
+
+ + {{ mesin.token|default:"Belum Ada Token" }} + + {% if mesin.token %} + + {% endif %} +
+
+ + {{ mesin.created_at|date:"d M Y H:i" }}
+ Belum ada unit mesin yang terdaftar. +
+
+ + + + + + + +{% endblock %} \ No newline at end of file diff --git a/dashboard/templates/dashboard/report_all.html b/dashboard/templates/dashboard/report_all.html new file mode 100644 index 0000000..76fe723 --- /dev/null +++ b/dashboard/templates/dashboard/report_all.html @@ -0,0 +1,243 @@ +{% extends 'dashboard/base.html' %} +{% load static %} + +{% block content %} + +
+
+
+ + +
+
+ + +
+ + +
+ + + + + +
+
+ + Total Konsumsi Energi Seluruh Pabrik Periode Ini: + + + 0.00 kWh + +
+
+ + +
+

Grafik Distribusi Persentase Konsumsi Energi per Area

+
+ +
+
+ + +
+

Rincian Akumulasi Penggunaan Energi Tiap Wilayah Kerja

+ + + + + + + + + + + + + + +
NoNama Wilayah / AreaJumlah KWH MetterTotal Konsumsi Energi (kWh)
Sedang memproses data dari database...
+
+
+ + + + + + + + + +{% endblock content %} diff --git a/dashboard/templates/dashboard/report_per_area.html b/dashboard/templates/dashboard/report_per_area.html new file mode 100644 index 0000000..d4ec9a0 --- /dev/null +++ b/dashboard/templates/dashboard/report_per_area.html @@ -0,0 +1,206 @@ +{% extends 'dashboard/base.html' %} + +{% block content %} +

Report Konsumsi Energi per Area

+ + +
+
+ +
+ + +
+ + +
+ + +
+
+ + + +
+ + +
+
+ + Total Konsumsi Seluruh Mesin di Area: + + + 0.0000 kWh + +
+
+ + +
+

Grafik Perbandingan Konsumsi Mesin

+
+ +
+
+ + +
+

Rincian Data kWh Mesin

+ + + + + + + + + + + + + + + + +
NoNama MesinKeteranganMin kWh MulaMax kWh AkhirTotal Konsumsi (kWh)
Silakan pilih Area dan Bulan terlebih dahulu.
+
+ + +{% load static %} + + + +{% endblock content %} diff --git a/dashboard/templates/dashboard/user_accounts.html b/dashboard/templates/dashboard/user_accounts.html new file mode 100644 index 0000000..fb19c1f --- /dev/null +++ b/dashboard/templates/dashboard/user_accounts.html @@ -0,0 +1,91 @@ +{% extends 'dashboard/base.html' %} + +{% block content %} +
+

Manajemen Akun User

+ + {% if messages %} + {% for message in messages %} +
+ {{ message }} +
+ {% endfor %} + {% endif %} + +
+ + + + + + + + + + + + + {% for u in users_list %} + + + + + + + + + {% endfor %} + +
UsernameNama LengkapEmailTipe AkunRole WebAction
{{ u.username }}{{ u.get_full_name|default:"-" }}{{ u.email|default:"-" }} + {% if u.account_type == "LDAP" %} + LDAP + {% else %} + Lokal + {% endif %} + + {% if not u.is_active %} + Menunggu Persetujuan + {% elif u.is_superuser or u.is_staff %} + Administrator + {% else %} + User Biasa + {% endif %} + + {% if u != request.user %} + {% if not u.is_active %} + +
+ {% csrf_token %} + + +
+ {% else %} + +
+ {% csrf_token %} + {% if u.is_superuser or u.is_staff %} + + + {% else %} + + + {% endif %} +
+ {% endif %} + {% else %} + (Akun Anda) + {% endif %} +
+
+
+{% endblock content %} + diff --git a/dashboard/tests.py b/dashboard/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/dashboard/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/dashboard/views.py b/dashboard/views.py new file mode 100644 index 0000000..aefb2e6 --- /dev/null +++ b/dashboard/views.py @@ -0,0 +1,1345 @@ +import json +# TAMBAHKAN get_object_or_404 di baris ini +from django.shortcuts import render, get_object_or_404 +from django.http import JsonResponse +from django.views.decorators.csrf import csrf_exempt +from django.utils import timezone +from django.db.models.functions import TruncHour, TruncDay, TruncMonth +from django.db.models import Max, Min, Avg, Sum +from .models import KwhReadings, Mesin + +# TAMBAHKAN baris import ini untuk menangani dekorator @require_POST +from django.views.decorators.http import require_POST + +# TAMBAHKAN baris import ini untuk Export excel +import openpyxl +from openpyxl.styles import Font, Alignment, PatternFill, Border, Side +from django.http import HttpResponse +from .models import Mesin, Area +import uuid +import os # Ditambahkan untuk membaca file path lokal di server +from django.conf import settings # Ditambahkan untuk mencari jalur folder static +from openpyxl.drawing.image import Image as OpenpyxlImage # Modul untuk menyisipkan gambar + +# TAMBAHKAN baris import ini untuk date custom +from django.utils.dateparse import parse_datetime + +# Import pdf +from django.shortcuts import render + +# Halaman pertama aksses ke Login +from django.contrib.auth.decorators import login_required +from django.shortcuts import render + +# 1. View untuk menampilkan halaman HTML Log Data +def log_kwh_view(request): + return render(request, 'dashboard/log_kwh.html') + +def api_log_data(request): + period = request.GET.get('period', 'hourly') + start_date_str = request.GET.get('start_date') + end_date_str = request.GET.get('end_date') + + # 1. Ambil parameter mesin_id dari URL + mesin_id = request.GET.get('mesin_id', None) + + queryset = KwhReadings.objects.all() + + # 2. Filter data berdasarkan mesin_id jika user memilih salah satu mesin secara spesifik + if mesin_id and mesin_id.strip() != '' and mesin_id != 'all' and mesin_id != 'undefined': + queryset = queryset.filter(mesin_id=mesin_id) + + use_max_diff_logic = False # Penanda apakah perlu pakai logika selisih antar periode + + # ─── LOGIKA CUSTOM DATE YANG FLEKSIBEL (Tetap Utuh) ─── + if period == 'custom' and start_date_str and end_date_str: + start_date = parse_datetime(start_date_str) + end_date = parse_datetime(end_date_str) + + if start_date and end_date: + queryset = queryset.filter(timestamp__range=(start_date, end_date)) + selisih_waktu = end_date - start_date + total_hari = selisih_waktu.days + + if total_hari > 31: + trunc_func = TruncMonth('timestamp') + date_format = '%b %Y' + elif total_hari >= 2: + trunc_func = TruncDay('timestamp') + date_format = '%d %b %Y' + else: + trunc_func = TruncHour('timestamp') + date_format = '%H:%M (%d %b)' + use_max_diff_logic = True # Custom rentang jam butuh logika ini + + limit = None + + # ─── KONDISI DEFAULT (TOMBOL NAVIGASI - Tetap Utuh) ─── + elif period == 'daily': + trunc_func = TruncDay('timestamp') + date_format = '%d %b %Y' + limit = 30 + elif period == 'monthly': + trunc_func = TruncMonth('timestamp') + date_format = '%b %Y' + limit = 12 + else: # Default 'hourly' + trunc_func = TruncHour('timestamp') + date_format = '%H:%M (%d %b)' + limit = 24 + use_max_diff_logic = True # Mode per jam wajib menggunakan logika ini + + # ─── PROSES AGREGASI DATABASE ─── + logs_query = ( + queryset + .annotate(period_label=trunc_func) + .values('period_label') + .annotate( + max_val=Max('active_power_kwh'), + min_val=Min('active_power_kwh') + ) + ) + + # 💡 PINTAR: Semua mode yang memiliki limit (hourly, daily, monthly) + # sekarang mengambil 1 data ekstra ke belakang untuk acuan nilai sebelumnya. + if limit: + logs = logs_query.order_by('-period_label')[:limit + 1] + logs = list(logs) + logs.reverse() # Urutkan maju kronologis (Past lama -> Baru) SEBELUM dihitung + else: + logs = logs_query.order_by('period_label') + + labels = [] + values = [] + prev_max_kwh = None + + for entry in logs: + if entry['period_label']: + max_kwh = entry['max_val'] or 0 + min_kwh = entry['min_val'] or 0 + + # 💡 ANTI-MENGUAP: Berlaku untuk per jam, per hari, per bulan, dan kustom rentang jam + if use_max_diff_logic or period in ['daily', 'monthly']: + if prev_max_kwh is None: + # Baris paling pertama/tertua di grafik menggunakan selisih internalnya sendiri + konsumsi_asli = max_kwh - min_kwh + else: + # Baris berikutnya selalu dikurangi nilai MAX periode sebelumnya + konsumsi_asli = max_kwh - prev_max_kwh + + # Pengaman jika kWh meter fisik diganti baru atau di-reset ke 0 + if konsumsi_asli < 0: + konsumsi_asli = max_kwh - min_kwh + else: + # Fallback untuk kustom range yang sangat panjang (>2 hari) + konsumsi_asli = max_kwh - min_kwh + if konsumsi_asli < 0: + konsumsi_asli = max_kwh + + labels.append(entry['period_label'].strftime(date_format)) + values.append(round(konsumsi_asli, 4)) + + # Kunci utama: Simpan Max periode ini untuk pengurang periode selanjutnya + prev_max_kwh = max_kwh + + # Potong data ekstra indeks pertama agar total batang grafik pas sesuai limit asli (24, 30, atau 12) + if limit and len(values) > limit: + labels = labels[1:] + values = values[1:] + + # ─── FITUR BARU: HITUNG JUMLAH TOTAL AKUMULASI KONSUMSI GRAFIK ─── + total_sum = sum(values) + + # 3. KONTROL PENCEGAHAN GRAFIK KOSONG + if not labels: + return JsonResponse({'labels': ['Belum Ada Data'], 'values': [], 'total_sum': 0}) + + # Kembalikan response lengkap termasuk total_sum baru ke frontend + return JsonResponse({ + 'labels': labels, + 'values': values, + 'total_sum': round(total_sum, 4) + }) + + # 2. Karena data diambil dari yang terbaru (mundur), kita balik (reverse) + # agar di grafik Chart.js tampilannya berurutan maju (kronologis) + logs = list(logs) + logs.reverse() + + labels = [] + values = [] + for entry in logs: + if entry['period_label']: + labels.append(entry['period_label'].strftime(date_format)) + + # Pengaman jika nilai Max atau Min None + max_kwh = entry['max_val'] or 0 + min_kwh = entry['min_val'] or 0 + + # Logika dasar Max - Min + konsumsi_asli = max_kwh - min_kwh + + # ANTISIPASI RESET: Jika kWh sempat di-reset ke 0 oleh ESP32 + # (Gunakan ini hanya jika ESP32 Anda sering reset/mati) + if konsumsi_asli < 0: + konsumsi_asli = max_kwh # Mengasumsikan nilai setelah reset dimulai dari 0 + + values.append(round(konsumsi_asli, 4)) + + return JsonResponse({'labels': labels, 'values': values}) + +# 3. View untuk menampilkan halaman HTML Dashboard Utama +def dashboard_view(request): + # Mengambil semua daftar mesin untuk dikirim ke base.html (jika belum menggunakan context processor) + mesin_global_list = Mesin.objects.select_related('area').all() + context = { + 'mesin_global_list': mesin_global_list + } + return render(request, 'dashboard/index.html', context) + + +# 4. View API untuk menampilkan 144 data realtime terakhir di halaman depan (Terfilter) 24 jam terakhir +def api_latest_data(request): + # 1. Tangkap parameter 'mesin_id' dari JavaScript fetch melalui URL + mesin_id = request.GET.get('mesin_id', None) + + # 2. Ambil 144 data TERBARU berdasarkan ID terbesar (-id) agar data yang mati berjam-jam tidak terlewat + if mesin_id and mesin_id.strip() != '' and mesin_id != 'all': + # Jika memilih mesin tertentu, ambil 144 data terakhir milik mesin tersebut + raw_data = KwhReadings.objects.filter(mesin_id=mesin_id).order_by('-id')[:144] + else: + # Jika global, ambil 144 data terakhir campuran secara default + raw_data = KwhReadings.objects.all().order_by('-id')[:144] + + # 3. BALIKKAN urutan list data (dari Desending ke Ascending) + # Ini WAJIB agar data yang paling baru posisinya bergeser ke sisi paling kanan grafik Chart.js + data_list = list(reversed(raw_data)) + + # Bungkus data ke dalam list kosong (Sama persis seperti struktur asli Anda) + timestamps = [] + apparent_power = [] + total_current = [] + power_factor = [] + active_power = [] + active_power_kwh = [] + + # Iterasi data untuk dimasukkan ke struktur JSON grafik + for item in data_list: + # Konversi waktu ke jam lokal agar tampilan teks di sumbu X grafik sesuai WIB + lokal_time = timezone.localtime(item.timestamp) if timezone.is_aware(item.timestamp) else item.timestamp + + + timestamps.append(lokal_time.strftime('%d %b %H:%M')) + apparent_power.append(item.apparent_power_va) + total_current.append(item.total_current_a) + power_factor.append(item.power_factor) + active_power.append(round(item.real_active_power_kw, 4)) + active_power_kwh.append(round(item.active_power_kwh, 4)) + + # Kembalikan response berupa format JSON terstruktur ke frontend + return JsonResponse({ + 'timestamps': timestamps, + 'apparent_power': apparent_power, + 'total_current': total_current, + 'power_factor': power_factor, + 'active_power': active_power, + 'active_power_kwh': active_power_kwh + }) + +# 5. Endpoint penerima kiriman data dari ESP32 (SINKRON 100%) +@csrf_exempt +def receive_kwh_data(request): + if request.method == 'POST': + # 1. Ambil token keamanan dari HTTP Header + token_diterima = request.META.get('HTTP_X_ESP32_TOKEN') + + if not token_diterima: + return JsonResponse({'status': 'error', 'message': 'Token keamanan tidak ditemukan!'}, status=401) + + try: + data = json.loads(request.body) + + # 2. Ambil nilai device_id dari JSON payload ESP32 + device_id_diterima = data.get('device_id') + + if not device_id_diterima: + return JsonResponse({'status': 'error', 'message': 'JSON payload harus menyertakan device_id'}, status=400) + + # 3. VALIDASI GANDA: Cocokkan Token AND Nama Mesin di Database + mesin_terdaftar = Mesin.objects.filter( + token=token_diterima, + nama_mesin=device_id_diterima + ).first() + + # Jika kombinasi token dan nama tidak cocok, langsung tolak + if not mesin_terdaftar: + return JsonResponse({ + 'status': 'error', + 'message': 'Validasi Gagal! Kombinasi Token dan Nama Mesin tidak cocok atau tidak terdaftar.' + }, status=403) + + # 4. Ambil data sensor lainnya + active_power_kwh = float(data.get('active_power_kwh', 0)) + apparent_power_va = float(data.get('apparent_power_va', 0)) + power_factor = float(data.get('power_factor', 0)) + total_current_a = float(data.get('total_current_a', 0)) + + # Hitung Nilai Daya Aktif Sesaat (kW) + real_active_power_kw = (apparent_power_va * power_factor) / 1000.0 + + # 5. Simpan ke database dengan menempelkan objek mesin yang sudah divalidasi + KwhReadings.objects.create( + mesin=mesin_terdaftar, # Mengisi kolom ForeignKey dengan ID Mesin secara otomatis + apparent_power_va=apparent_power_va, + total_current_a=total_current_a, + power_factor=power_factor, + active_power_kwh=active_power_kwh, + real_active_power_kw=real_active_power_kw + ) + + return JsonResponse({ + 'status': 'success', + 'message': f'Data untuk mesin {mesin_terdaftar.nama_mesin} sukses disimpan ke database' + }, status=201) + + except Exception as e: + print("\n❌ [ERROR DATABASE DJANGO]:", str(e), "\n") + return JsonResponse({'status': 'error', 'message': str(e)}, status=400) + + return JsonResponse({'status': 'invalid method'}, status=405) + + +# Export Excel KWH +def export_kwh_excel(request): + # 1. Ambil parameter dari request + period = request.GET.get('period', 'hourly') + start_date_str = request.GET.get('start_date') + end_date_str = request.GET.get('end_date') + mesin_id = request.GET.get('mesin_id', None) + + queryset = KwhReadings.objects.all() + limit = None + + # Ambil Informasi Lengkap Mesin & Area + nama_mesin_info = "Semua Unit Mesin" + area_info = "-" + keterangan_info = "-" + + if mesin_id and mesin_id.strip() != '' and mesin_id != 'all' and mesin_id != 'undefined': + queryset = queryset.filter(mesin_id=mesin_id) + try: + mesin_obj = Mesin.objects.select_related('area').get(id=mesin_id) + nama_mesin_info = mesin_obj.nama_mesin + keterangan_info = mesin_obj.keterangan or "-" + if mesin_obj.area: + area_info = mesin_obj.area.nama_area + except Mesin.DoesNotExist: + pass + + # 2. Logika Filter & Agregasi Sesuai Grafik (Hourly, Daily, Monthly, Custom) + if period == 'custom' and start_date_str and end_date_str: + start_date = parse_datetime(start_date_str) + end_date = parse_datetime(end_date_str) + + if start_date and end_date: + queryset = queryset.filter(timestamp__range=(start_date, end_date)) + selisih_waktu = end_date - start_date + total_hari = selisih_waktu.days + + if total_hari > 31: + trunc_func = TruncMonth('timestamp') + date_format = '%d-%m-%Y' + title_period = "Kustom Bulanan" + elif total_hari >= 2: + trunc_func = TruncDay('timestamp') + date_format = '%d-%m-%Y' + title_period = "Kustom Harian" + else: + trunc_func = TruncHour('timestamp') + date_format = '%d-%m-%Y %H:00' + title_period = "Kustom Per Jam" + + elif period == 'daily': + trunc_func = TruncDay('timestamp') + date_format = '%d-%m-%Y' + title_period = "Harian (30 Data Terakhir)" + limit = 30 + elif period == 'monthly': + trunc_func = TruncMonth('timestamp') + date_format = '%m-%Y' + title_period = "Bulanan (12 Data Terakhir)" + limit = 12 + else: + trunc_func = TruncHour('timestamp') + date_format = '%d-%m-%Y %H:00' + title_period = "Per Jam (24 Data Terakhir)" + limit = 24 + + # 3. Proses Agregasi Database + logs_query = ( + queryset + .annotate(period_label=trunc_func) + .values('period_label') + .annotate( + max_val=Max('active_power_kwh'), + min_val=Min('active_power_kwh') + ) + ) + + if limit: + logs = logs_query.order_by('-period_label')[:limit] + logs = list(logs) + logs.reverse() + else: + logs = logs_query.order_by('period_label') + + # 4. Inisialisasi Workbook Excel & Styling + wb = openpyxl.Workbook() + ws = wb.active + ws.title = "Report kWh" + + # Font & Style Setup + title_font = Font(name='Calibri', size=14, bold=True, color='1F2937') + company_font = Font(name='Calibri', size=11, bold=True, color='4B5563') + info_font_bold = Font(name='Calibri', size=11, bold=True) + info_font_regular = Font(name='Calibri', size=11, bold=False) + header_font = Font(name='Calibri', size=11, bold=True, color='FFFFFF') + header_fill = PatternFill(start_color='1F2937', end_color='1F2937', fill_type='solid') + align_center = Alignment(horizontal='center', vertical='center') + align_left = Alignment(horizontal='left', vertical='center') + border_thin = Border( + left=Side(style='thin', color='D1D5DB'), right=Side(style='thin', color='D1D5DB'), + top=Side(style='thin', color='D1D5DB'), bottom=Side(style='thin', color='D1D5DB') + ) + + # ─── FITUR LOGO PERUSAHAAN DI CELL A1 ─── + logo_path = os.path.join(settings.BASE_DIR, 'dashboard', 'static', 'images', 'FLN.png') + + if os.path.exists(logo_path): + img = OpenpyxlImage(logo_path) + target_height = 55 + target_width = int((img.width / img.height) * target_height) + img.width = target_width + img.height = target_height + ws.add_image(img, 'A1') + + ws.row_dimensions[1].height = 25 + ws.row_dimensions[2].height = 20 + ws.row_dimensions[3].height = 15 + + # ─── TEKS JUDUL KOLOM B ─── + ws['B1'] = "Sistem Informasi Monitoring Energi" + ws['B1'].font = title_font + ws['B2'] = "PT. Frina Lestari Nusantara" + ws['B2'].font = company_font + + # ─── BLOK INFORMASI MESIN BARIS 5 - 7 ─── + ws['A5'] = "Nama Mesin:" + ws['B5'] = nama_mesin_info + ws['A6'] = "Area/Lokasi:" + ws['B6'] = area_info + ws['A7'] = "Keterangan:" + ws['B7'] = keterangan_info + + for r in range(5, 8): + ws.cell(row=r, column=1).font = info_font_bold + ws.cell(row=r, column=2).font = info_font_regular + ws.cell(row=r, column=1).alignment = align_left + ws.cell(row=r, column=2).alignment = align_left + + # 5. ─── TABEL UTAMA PADA BARIS KE-9 ─── + headers = ['No', f'Periode ({title_period})', 'Min kWh', 'Max kWh', 'Total Konsumsi (kWh)'] + + for col_num, header in enumerate(headers, 1): + cell = ws.cell(row=9, column=col_num) + cell.value = header + cell.font = header_font + cell.fill = header_fill + cell.alignment = align_center + + # 6. ─── ISI DATA ROW MULAI DARI BARIS KE-10 ─── + row_num = 10 + total_excel_kwh = 0 + prev_max_kwh = None # Pembantu kalkulasi rentang antar jam + + # Ambil logs yang sudah diurutkan dari database + for idx, entry in enumerate(logs, 1): + if entry['period_label']: + min_kwh = entry['min_val'] or 0 + max_kwh = entry['max_val'] or 0 + + if prev_max_kwh is None: + konsumsi_asli = max_kwh - min_kwh + else: + konsumsi_asli = max_kwh - prev_max_kwh + + if konsumsi_asli < 0: + konsumsi_asli = max_kwh - min_kwh + + date_str = entry['period_label'].strftime(date_format) + total_excel_kwh += konsumsi_asli + + row = [idx, date_str, round(min_kwh, 4), round(max_kwh, 4), round(konsumsi_asli, 4)] + + for col_num, value in enumerate(row, 1): + cell = ws.cell(row=row_num, column=col_num) + cell.value = value + cell.border = border_thin + if col_num in (1, 2): + cell.alignment = align_center + + row_num += 1 + prev_max_kwh = max_kwh # Update penanda data sebelumnya + + + # ─── FITUR BARU: SUNTIKKAN BARIS REKAP TOTAL DI PALING BAWAH TABEL EXCEL ─── + # Satukan kolom A sampai D (kolom 1 sampai 4) untuk teks label total + ws.merge_cells(start_row=row_num, start_column=1, end_row=row_num, end_column=4) + cell_label = ws.cell(row=row_num, column=1) + cell_label.value = "TOTAL KONSUMSI ENERGI" + cell_label.font = Font(name='Calibri', size=11, bold=True) + cell_label.alignment = Alignment(horizontal='right', vertical='center') + + # Isi angka total kWh di kolom E (kolom 5) dan beri warna background amber/kuning soft + cell_total = ws.cell(row=row_num, column=5) + cell_total.value = round(total_excel_kwh, 4) + cell_total.font = Font(name='Calibri', size=11, bold=True) + cell_total.fill = PatternFill(start_color='FEF3C7', end_color='FEF3C7', fill_type='solid') + + # Aplikasikan border luar untuk seluruh kolom pada baris total tersebut + for col_idx in range(1, 6): + ws.cell(row=row_num, column=col_idx).border = border_thin + + # Autofit lebar kolom (Bebas Eror) + for col in ws.columns: + max_len = max(len(str(cell.value or '')) for cell in col) + col_letter = openpyxl.utils.get_column_letter(col[0].column) + ws.column_dimensions[col_letter].width = max(max_len + 4, 12) + + # ─── COPYRIGHT PADA FOOTER CETAK DOKUMEN (KIRI BAWAH) ─── + ws.oddFooter.left.text = "Copyright System IT-Dept-2026 | PT. Frina Lestari Nusantara" + ws.oddFooter.left.size = 9 + ws.oddFooter.left.font = "Calibri" + + # 7. Response Download Sheet + response = HttpResponse( + content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ) + filename = f"Report_kWh_{period}_{timezone.now().strftime('%Y%m%d_%H%M')}.xlsx" + response['Content-Disposition'] = f'attachment; filename="{filename}"' + wb.save(response) + + return response + + +# 1. View Render Halaman Analisis Grafik +def analisis_grafik_view(request): + return render(request, 'dashboard/analisis_grafik.html') + +# 2. API Data Analisis (Rata-rata Apparent, PF, Current per Periode) +def api_analysis_data(request): + period = request.GET.get('period', 'hourly') + start_date_str = request.GET.get('start_date') + end_date_str = request.GET.get('end_date') + + # 1. Ambil parameter mesin_id dari URL + mesin_id = request.GET.get('mesin_id', None) + + queryset = KwhReadings.objects.all() + limit = None + + # 2. Filter data berdasarkan mesin_id jika user memilih salah satu mesin secara spesifik + if mesin_id and mesin_id.strip() != '' and mesin_id != 'all' and mesin_id != 'undefined': + queryset = queryset.filter(mesin_id=mesin_id) + + # ─── LOGIKA CUSTOM DATE YANG FLEKSIBEL ─── + if period == 'custom' and start_date_str and end_date_str: + start_date = parse_datetime(start_date_str) + end_date = parse_datetime(end_date_str) + + if start_date and end_date: + queryset = queryset.filter(timestamp__range=(start_date, end_date)) + selisih_waktu = end_date - start_date + total_hari = selisih_waktu.days + + if total_hari > 31: + trunc_func = TruncMonth('timestamp') + date_format = '%b %Y' + elif total_hari >= 2: + trunc_func = TruncDay('timestamp') + date_format = '%d %b %Y' + else: + trunc_func = TruncHour('timestamp') + date_format = '%H:%M (%d %b)' + + # ─── KONDISI DEFAULT DENGAN BATASAN LIMIT DATA ─── + elif period == 'daily': + trunc_func = TruncDay('timestamp') + date_format = '%d %b %Y' + limit = 7 + elif period == 'monthly': + trunc_func = TruncMonth('timestamp') + date_format = '%b %Y' + limit = 12 + else: # Default 'hourly' + trunc_func = TruncHour('timestamp') + date_format = '%H:%M (%d %b)' + limit = 24 + + # ─── PROSES AGREGASI DATABASE (RATA-RATA) ─── + logs_query = ( + queryset + .annotate(period_label=trunc_func) + .values('period_label') + .annotate( + avg_apparent=Avg('apparent_power_va'), + avg_pf=Avg('power_factor'), + avg_current=Avg('total_current_a') + ) + ) + + if limit: + logs = logs_query.order_by('-period_label')[:limit] + logs = list(logs) + logs.reverse() + else: + logs = logs_query.order_by('period_label') + + labels = [] + apparent_power = [] + power_factor = [] + total_current = [] + + for entry in logs: + if entry['period_label']: + labels.append(entry['period_label'].strftime(date_format)) + apparent_power.append(round(entry['avg_apparent'] or 0, 2)) + power_factor.append(round(entry['avg_pf'] or 0, 3)) + total_current.append(round(entry['avg_current'] or 0, 4)) + + # Proteksi jika hasil query kosong agar Chart.js frontend tidak rusak + # ─── KODE PERBAIKAN UNTUK FUNGSI api_analysis_data ─── + if not labels: + return JsonResponse({ + 'labels': ['Belum Ada Data'], + 'apparent_power': [], + 'power_factor': [], + 'total_current': [] + }) + + + return JsonResponse({ + 'labels': labels, + 'apparent_power': apparent_power, + 'power_factor': power_factor, + 'total_current': total_current + }) + +# 3. Export Excel Data Analisis Parameter +# Export Excel Analisis Parameter Listrik +def export_analysis_excel(request): + period = request.GET.get('period', 'hourly') + start_date_str = request.GET.get('start_date') + end_date_str = request.GET.get('end_date') + mesin_id = request.GET.get('mesin_id', None) + + queryset = KwhReadings.objects.all() + limit = None + + # Ambil Informasi Lengkap Mesin & Area + nama_mesin_info = "Semua Unit Mesin" + area_info = "-" + keterangan_info = "-" + + if mesin_id and mesin_id.strip() != '' and mesin_id != 'all' and mesin_id != 'undefined': + queryset = queryset.filter(mesin_id=mesin_id) + try: + mesin_obj = Mesin.objects.select_related('area').get(id=mesin_id) + nama_mesin_info = mesin_obj.nama_mesin + keterangan_info = mesin_obj.keterangan or "-" + if mesin_obj.area: + area_info = mesin_obj.area.nama_area + except Mesin.DoesNotExist: + pass + + # ─── LOGIKA FILTER & AGREGASI SINKRON DENGAN GRAFIK ─── + if period == 'custom' and start_date_str and end_date_str: + start_date = parse_datetime(start_date_str) + end_date = parse_datetime(end_date_str) + + if start_date and end_date: + queryset = queryset.filter(timestamp__range=(start_date, end_date)) + selisih_waktu = end_date - start_date + total_hari = selisih_waktu.days + + if total_hari > 31: + trunc_func = TruncMonth('timestamp') + date_format = '%d-%m-%Y' + title_period = "Kustom Bulanan" + elif total_hari >= 2: + trunc_func = TruncDay('timestamp') + date_format = '%d-%m-%Y' + title_period = "Kustom Harian" + else: + trunc_func = TruncHour('timestamp') + date_format = '%d-%m-%Y %H:00' + title_period = "Kustom Per Jam" + + elif period == 'daily': + trunc_func = TruncDay('timestamp') + date_format = '%d-%m-%Y' + title_period = "Harian (7 Data Terakhir)" + limit = 7 + elif period == 'monthly': + trunc_func = TruncMonth('timestamp') + date_format = '%m-%Y' + title_period = "Bulanan (12 Data Terakhir)" + limit = 12 + else: # Default 'hourly' + trunc_func = TruncHour('timestamp') + date_format = '%d-%m-%Y %H:00' + title_period = "Per Jam (24 Data Terakhir)" + limit = 24 + + # ─── PROSES AGREGASI DATABASE (AVERAGE) ─── + logs_query = ( + queryset + .annotate(period_label=trunc_func) + .values('period_label') + .annotate( + avg_apparent=Avg('apparent_power_va'), + avg_pf=Avg('power_factor'), + avg_current=Avg('total_current_a') + ) + ) + + if limit: + logs = logs_query.order_by('-period_label')[:limit] + logs = list(logs) + logs.reverse() + else: + logs = logs_query.order_by('period_label') + + # ─── INISIALISASI WORKBOOK EXCEL & STYLING ─── + wb = openpyxl.Workbook() + ws = wb.active + ws.title = "Analisis Parameter" + + # Font & Style Setup + title_font = Font(name='Calibri', size=14, bold=True, color='1F2937') + company_font = Font(name='Calibri', size=11, bold=True, color='4B5563') + info_font_bold = Font(name='Calibri', size=11, bold=True) + info_font_regular = Font(name='Calibri', size=11, bold=False) + header_font = Font(name='Calibri', size=11, bold=True, color='FFFFFF') + header_fill = PatternFill(start_color='1F2937', end_color='1F2937', fill_type='solid') + align_center = Alignment(horizontal='center', vertical='center') + align_left = Alignment(horizontal='left', vertical='center') + border_thin = Border( + left=Side(style='thin', color='D1D5DB'), right=Side(style='thin', color='D1D5DB'), + top=Side(style='thin', color='D1D5DB'), bottom=Side(style='thin', color='D1D5DB') + ) + + # ─── FITUR LOGO PERUSAHAAN (PROPORSIONAL DI CELL A1) ─── + logo_path = os.path.join(settings.BASE_DIR, 'dashboard', 'static', 'images', 'FLN.png') + if os.path.exists(logo_path): + img = OpenpyxlImage(logo_path) + target_height = 55 + target_width = int((img.width / img.height) * target_height) + img.width = target_width + img.height = target_height + ws.add_image(img, 'A1') + + ws.row_dimensions[1].height = 25 + ws.row_dimensions[2].height = 20 + ws.row_dimensions[3].height = 15 + + # ─── TEKS JUDUL LAPORAN ─── + ws['B1'] = "Sistem Informasi Monitoring Energi" + ws['B1'].font = title_font + ws['B2'] = "PT. Frina Lestari Nusantara" + ws['B2'].font = company_font + + # ─── BLOK INFORMASI TERINTEGRASI MESIN (BARIS 5 - 7) ─── + ws['A5'] = "Nama Mesin:" + ws['B5'] = nama_mesin_info + ws['A6'] = "Area/Lokasi:" + ws['B6'] = area_info + ws['A7'] = "Keterangan:" + ws['B7'] = keterangan_info + + for r in range(5, 8): + ws.cell(row=r, column=1).font = info_font_bold + ws.cell(row=r, column=2).font = info_font_regular + ws.cell(row=r, column=1).alignment = align_left + ws.cell(row=r, column=2).alignment = align_left + + # ─── TABEL UTAMA DIMULAI PADA BARIS KE-9 ─── + headers = ['No', f'Periode ({title_period})', 'Avg Apparent Power (VA)', 'Avg Power Factor', 'Avg Total Current (A)'] + + for col_num, header in enumerate(headers, 1): + cell = ws.cell(row=9, column=col_num) + cell.value = header + cell.font = header_font + cell.fill = header_fill + cell.alignment = align_center + + # ─── ISI DATA TABEL EXCEL ─── + row_num = 10 + for idx, entry in enumerate(logs, 1): + if entry['period_label']: + date_str = entry['period_label'].strftime(date_format) + row = [ + idx, + date_str, + round(entry['avg_apparent'] or 0, 2), + round(entry['avg_pf'] or 0, 3), + round(entry['avg_current'] or 0, 4) + ] + + for col_num, value in enumerate(row, 1): + cell = ws.cell(row=row_num, column=col_num) + cell.value = value + cell.border = border_thin + if col_num in (1, 2): + cell.alignment = align_center + row_num += 1 + + # Autofit lebar kolom (Bebas Eror Tuple) + for col in ws.columns: + max_len = max(len(str(cell.value or '')) for cell in col) + col_letter = openpyxl.utils.get_column_letter(col[0].column) + ws.column_dimensions[col_letter].width = max(max_len + 4, 12) + + # ─── COPYRIGHT PADA FOOTER CETAK DOKUMEN ─── + ws.oddFooter.left.text = "Copyright System IT-Dept-2026 | PT. Frina Lestari Nusantara" + ws.oddFooter.left.size = 9 + ws.oddFooter.left.font = "Calibri" + + # Response Download Sheet + response = HttpResponse( + content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ) + filename = f"Analisis_Parameter_{period}_{timezone.now().strftime('%Y%m%d_%H%M')}.xlsx" + response['Content-Disposition'] = f'attachment; filename="{filename}"' + wb.save(response) + + return response + + +# View untuk menampilkan halaman list mesin & daftar area +def manajemen_mesin_view(request): + daftar_mesin = Mesin.objects.select_related('area').all().order_by('-created_at') + daftar_area = Area.objects.all().order_by('nama_area') + + context = { + 'daftar_mesin': daftar_mesin, + 'daftar_area': daftar_area + } + return render(request, 'dashboard/manajemen_mesin.html', context) + +# API untuk menyimpan data mesin baru + area + token dari popup +@csrf_exempt +def add_mesin_api(request): + if request.method == 'POST': + try: + data = json.loads(request.body) + nama = data.get('nama_mesin') + area_id = data.get('area_id') + keterangan = data.get('keterangan', '') + + if not nama: + return JsonResponse({'status': 'error', 'message': 'Nama mesin wajib diisi'}, status=400) + + # Generate Token Keamanan Unik untuk ESP32 + token_esp32 = str(uuid.uuid4()).replace('-', '') + + # Cari objek Area berdasarkan ID jika dipilih + area_obj = Area.objects.filter(id=area_id).first() if area_id else None + + # Simpan mesin baru + mesin_baru = Mesin.objects.create( + nama_mesin=nama, + area=area_obj, + keterangan=keterangan, + token=token_esp32 + ) + + return JsonResponse({ + 'status': 'success', + 'message': 'Mesin berhasil ditambahkan!', + 'data': { + 'id': mesin_baru.id, + 'nama': mesin_baru.nama_mesin, + 'area': mesin_baru.area.nama_area if mesin_baru.area else '-', + 'keterangan': mesin_baru.keterangan, + 'token': mesin_baru.token + } + }) + except Exception as e: + return JsonResponse({'status': 'error', 'message': str(e)}, status=500) + + return JsonResponse({'status': 'error', 'message': 'Method tidak diizinkan'}, status=405) + +# API untuk menyimpan data Area baru +@csrf_exempt +def add_area_api(request): + if request.method == 'POST': + try: + data = json.loads(request.body) + nama_area = data.get('nama_area') + keterangan = data.get('keterangan', '') + + if not nama_area: + return JsonResponse( + {'status': 'error', 'message': 'Nama area wajib diisi'}, + status=400, + ) + + area_baru = Area.objects.create( + nama_area=nama_area, keterangan=keterangan + ) + return JsonResponse({ + 'status': 'success', + 'message': 'Area berhasil ditambahkan!', + 'data': {'id': area_baru.id, 'nama_area': area_baru.nama_area}, + }) + except Exception as e: + return JsonResponse( + {'status': 'error', 'message': str(e)}, status=500 + ) + + return JsonResponse( + {'status': 'error', 'message': 'Method tidak diizinkan'}, status=405 + ) + +# API untuk edit keterangan +@require_POST +def update_keterangan_view(request, mesin_id): + try: + data = json.loads(request.body) + keterangan_baru = data.get('keterangan', '').strip() + + # Ambil data mesin berdasarkan ID + mesin = get_object_or_404(Mesin, id=mesin_id) + mesin.keterangan = keterangan_baru + mesin.save(update_fields=['keterangan']) # Hanya simpan kolom keterangan saja agar efisien + + return JsonResponse({ + 'status': 'success', + 'keterangan': mesin.keterangan + }) + except Exception as e: + return JsonResponse({ + 'status': 'error', + 'message': str(e) + }, status=400) + +# UNtuk halaman Report +def report_per_area(request): + # Logika data bisa diisi di sini nanti + return render(request, 'dashboard/report_per_area.html') + +def report_all(request): + # Logika data bisa diisi di sini nanti + return render(request, 'dashboard/report_all.html') + + +# 1. View untuk Render Halaman Report Area HTML +def report_per_area_view(request): + # Mengambil list area untuk dropdown filter awal + areas = Area.objects.all().order_by('nama_area') + + # SINKRONISASI DATABASE RIIL: Ambil tanggal unik berdasarkan bulan secara kronologis (Terbaru di atas) + # Ini mendeteksi field 'timestamp' di KwhReadings, mengambil bulan uniknya saja, dan mencegah duplikasi + bulan_db = ( + KwhReadings.objects + .dates('timestamp', 'month', order='DESC') + ) + + months_list = [] + for date_obj in bulan_db: + months_list.append({ + 'value': date_obj.strftime('%Y-%m'), # Nilai untuk sistem filter (Contoh: "2026-09") + 'label': date_obj.strftime('%B %Y') # Label teks yang dibaca user (Contoh: "September 2026") + }) + + # Pengaman jika seandainya database baru dideploy dan masih kosong total + if not months_list: + import datetime + today = datetime.date.today() + months_list.append({ + 'value': today.strftime('%Y-%m'), + 'label': today.strftime('%B %Y') + }) + + context = { + 'areas': areas, + 'months': months_list + } + return render(request, 'dashboard/report_per_area.html', context) + + +# 2. API Endpoint untuk mengambil data report via AJAX (Tetap Utuh) +def api_report_per_area(request): + selected_month = request.GET.get('month') # Format: "YYYY-MM" + area_id = request.GET.get('area_id') + + if not selected_month or not area_id: + return JsonResponse({'status': 'error', 'message': 'Parameter tidak lengkap'}, status=400) + + try: + year, month = map(int, selected_month.split('-')) + except ValueError: + return JsonResponse({'status': 'error', 'message': 'Format bulan salah'}, status=400) + + # Menggunakan .exclude() menjamin data status NULL atau 'normal' tetap dihitung + daftar_mesin = Mesin.objects.filter(area_id=area_id).exclude(status='review').order_by('nama_mesin') + + + labels_mesin = [] + values_kwh = [] + tabel_data = [] + total_akumulasi_area = 0 + + # 2. Hitung kwh per masing-masing mesin pada bulan tersebut + for mesin in daftar_mesin: + # Filter log berdasarkan mesin dan range bulan terpilih + queryset = KwhReadings.objects.filter( + mesin_id=mesin.id, + timestamp__year=year, + timestamp__month=month + ) + + # Agregasi Max dan Min pada bulan itu + agregasi = queryset.aggregate( + max_val=Max('active_power_kwh'), + min_val=Min('active_power_kwh') + ) + + max_kwh = agregasi['max_val'] or 0 + min_kwh = agregasi['min_val'] or 0 + + # Logika hitung konsumsi riil bulanan (seperti view log_kwh Anda) + konsumsi_bulan = max_kwh - min_kwh + if konsumsi_bulan < 0: + konsumsi_bulan = max_kwh + + konsumsi_bulan = round(konsumsi_bulan, 4) + total_akumulasi_area += konsumsi_bulan + + labels_mesin.append(mesin.nama_mesin) + values_kwh.append(konsumsi_bulan) + + # Masukkan ke list untuk kebutuhan render tabel data di HTML + tabel_data.append({ + 'nama_mesin': mesin.nama_mesin, + 'keterangan': mesin.keterangan or '-', + 'min_kwh': round(min_kwh, 4), + 'max_kwh': round(max_kwh, 4), + 'konsumsi': konsumsi_bulan + }) + + return JsonResponse({ + 'labels': labels_mesin, + 'values': values_kwh, + 'tabel_data': tabel_data, + 'total_sum': round(total_akumulasi_area, 4) + }) + + +# EXPORT EXCEL PER AREA +def export_report_area_excel(request): + # 1. Ambil parameter filter dari request URL + selected_month = request.GET.get('month') # Format: "YYYY-MM" + area_id = request.GET.get('area_id') + + if not selected_month or not area_id: + return HttpResponse("Parameter tidak lengkap untuk export excel.", status=400) + + try: + year, month = map(int, selected_month.split('-')) + # Membuat label nama bulan untuk judul/info (Contoh: "September 2026") + dt_obj = timezone.datetime(year, month, 1) + nama_bulan_info = dt_obj.strftime('%B %Y') + except ValueError: + return HttpResponse("Format bulan salah.", status=400) + + # Ambil Informasi Area untuk Header Excel + nama_area_info = "-" + try: + area_obj = Area.objects.get(id=area_id) + nama_area_info = area_obj.nama_area + except Area.DoesNotExist: + return HttpResponse("Area tidak ditemukan.", status=404) + + # Ganti baris pengambil daftar_mesin untuk excel: + daftar_mesin = Mesin.objects.filter(area_id=area_id).exclude(status='review').order_by('nama_mesin') + + + # 3. Inisialisasi Workbook Excel & Styling (Konsisten dengan tema sebelumnya) + wb = openpyxl.Workbook() + ws = wb.active + ws.title = "Report Per Area" + + # Font & Style Setup + title_font = Font(name='Calibri', size=14, bold=True, color='1F2937') + company_font = Font(name='Calibri', size=11, bold=True, color='4B5563') + info_font_bold = Font(name='Calibri', size=11, bold=True) + info_font_regular = Font(name='Calibri', size=11, bold=False) + header_font = Font(name='Calibri', size=11, bold=True, color='FFFFFF') + header_fill = PatternFill(start_color='1F2937', end_color='1F2937', fill_type='solid') + align_center = Alignment(horizontal='center', vertical='center') + align_left = Alignment(horizontal='left', vertical='center') + align_right = Alignment(horizontal='right', vertical='center') + border_thin = Border( + left=Side(style='thin', color='D1D5DB'), right=Side(style='thin', color='D1D5DB'), + top=Side(style='thin', color='D1D5DB'), bottom=Side(style='thin', color='D1D5DB') + ) + + # ─── FITUR LOGO PERUSAHAAN DI CELL A1 ─── + logo_path = os.path.join(settings.BASE_DIR, 'dashboard', 'static', 'images', 'FLN.png') + if os.path.exists(logo_path): + img = OpenpyxlImage(logo_path) + target_height = 55 + target_width = int((img.width / img.height) * target_height) + img.width = target_width + img.height = target_height + ws.add_image(img, 'A1') + + ws.row_dimensions[1].height = 25 + ws.row_dimensions[2].height = 20 + ws.row_dimensions[3].height = 15 + + # ─── TEKS JUDUL KOLOM B ─── + ws['B1'] = "Sistem Informasi Monitoring Energi" + ws['B1'].font = title_font + ws['B2'] = "PT. Frina Lestari Nusantara" + ws['B2'].font = company_font + + # ─── BLOK INFORMASI AREA & PERIODE BARIS 5 - 6 ─── + ws['A5'] = "Nama Area:" + ws['B5'] = nama_area_info + ws['A6'] = "Periode Bulan:" + ws['B6'] = nama_bulan_info + + for r in range(5, 7): + ws.cell(row=r, column=1).font = info_font_bold + ws.cell(row=r, column=2).font = info_font_regular + ws.cell(row=r, column=1).alignment = align_left + ws.cell(row=r, column=2).alignment = align_left + + # 4. ─── TABEL UTAMA PADA BARIS KE-8 ─── + headers = ['No', 'Nama Mesin', 'Keterangan', 'Min kWh Mula', 'Max kWh Akhir', 'Total Konsumsi (kWh)'] + + for col_num, header in enumerate(headers, 1): + cell = ws.cell(row=8, column=col_num) + cell.value = header + cell.font = header_font + cell.fill = header_fill + cell.alignment = align_center + + # 5. ─── ISI DATA ROW MULAI DARI BARIS KE-9 ─── + row_num = 9 + total_akumulasi_area = 0 + + for idx, mesin in enumerate(daftar_mesin, 1): + # Ambil data kwh_readings berdasarkan mesin dan rentang bulan terpilih + queryset = KwhReadings.objects.filter( + mesin_id=mesin.id, + timestamp__year=year, + timestamp__month=month + ) + + # Agregasi data Min dan Max pada bulan berjalan + agregasi = queryset.aggregate( + max_val=Max('active_power_kwh'), + min_val=Min('active_power_kwh') + ) + + min_kwh = agregasi['min_val'] or 0 + max_kwh = agregasi['max_val'] or 0 + + # Logika hitung konsumsi bulanan (sejalan dengan grafik & aturan log_kwh) + konsumsi_bulan = max_kwh - min_kwh + if konsumsi_bulan < 0: + konsumsi_bulan = max_kwh + + total_akumulasi_area += konsumsi_bulan + + # Susun baris data + row_data = [ + idx, + mesin.nama_mesin, + mesin.keterangan or "-", + round(min_kwh, 4), + round(max_kwh, 4), + round(konsumsi_bulan, 4) + ] + + for col_num, value in enumerate(row_data, 1): + cell = ws.cell(row=row_num, column=col_num) + cell.value = value + cell.border = border_thin + + # Styling perataan kolom + if col_num == 1: + cell.alignment = align_center + elif col_num in (2, 3): + cell.alignment = align_left + else: + cell.alignment = align_right + + row_num += 1 + + # 6. ─── SUNTIKKAN BARIS REKAP TOTAL DI PALING BAWAH TABEL EXCEL ─── + # Satukan kolom A sampai E (kolom 1 sampai 5) untuk label TOTAL + ws.merge_cells(start_row=row_num, start_column=1, end_row=row_num, end_column=5) + cell_label = ws.cell(row=row_num, column=1) + cell_label.value = f"TOTAL KONSUMSI ENERGI {nama_area_info.upper()}" + cell_label.font = Font(name='Calibri', size=11, bold=True) + cell_label.alignment = align_right + + # Isi angka total akumulasi di kolom F (kolom 6) dan beri warna background amber soft (FEF3C7) + cell_total = ws.cell(row=row_num, column=6) + cell_total.value = round(total_akumulasi_area, 4) + cell_total.font = Font(name='Calibri', size=11, bold=True) + cell_total.fill = PatternFill(start_color='FEF3C7', end_color='FEF3C7', fill_type='solid') + cell_total.alignment = align_right + + # Terapkan border tipis untuk baris total akumulasi ini + for col_idx in range(1, 7): + ws.cell(row=row_num, column=col_idx).border = border_thin + + # Autofit lebar kolom agar tulisan tidak terpotong + for col in ws.columns: + max_len = max(len(str(cell.value or '')) for cell in col) + col_letter = openpyxl.utils.get_column_letter(col[0].column) + ws.column_dimensions[col_letter].width = max(max_len + 4, 12) + + # COPYRIGHT PADA FOOTER CETAK DOKUMEN (KIRI BAWAH) + ws.oddFooter.left.text = "Copyright System IT-Dept-2026 | PT. Frina Lestari Nusantara" + ws.oddFooter.left.size = 9 + ws.oddFooter.left.font = "Calibri" + + # 7. Kirim Response ke Browser sebagai File Unduhan Excel + response = HttpResponse( + content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + ) + filename = f"Report_Area_{nama_area_info.replace(' ', '_')}_{selected_month}.xlsx" + response['Content-Disposition'] = f'attachment; filename="{filename}"' + wb.save(response) + + return response + +# Halaman Report All +def report_all_view(request): + bulan_db = KwhReadings.objects.dates('timestamp', 'month', order='DESC') + + months_list = [] + for date_obj in bulan_db: + months_list.append({ + 'value': date_obj.strftime('%Y-%m'), + 'label': date_obj.strftime('%B %Y') + }) + + if not months_list: + import datetime + today = datetime.date.today() + months_list.append({ + 'value': today.strftime('%Y-%m'), + 'label': today.strftime('%B %Y') + }) + + context = { + 'months': months_list + } + return render(request, 'dashboard/report_all.html', context) + + +# API Data Report All dengan Perbaikan Bug +def api_report_all_data(request): + selected_month = request.GET.get('month') # Format: "YYYY-MM" + if not selected_month: + return JsonResponse({'status': 'error', 'message': 'Bulan harus dipilih'}, status=400) + + try: + year, month = map(int, selected_month.split('-')) + except ValueError: + return JsonResponse({'status': 'error', 'message': 'Format bulan salah'}, status=400) + + daftar_area = Area.objects.all().order_by('nama_area') + + labels_area = [] + values_kwh = [] + tabel_data = [] + total_seluruh_pabrik = 0 + + for area in daftar_area: + + # 🟢 PERBAIKAN 1: Mengubah area_id menjadi area.id agar terbaca dari loop objek 'area' + mesin_di_area = Mesin.objects.filter(area_id=area.id).exclude(status='review') + total_kwh_area = 0 + + for mesin in mesin_di_area: + queryset = KwhReadings.objects.filter( + mesin_id=mesin.id, + timestamp__year=year, + timestamp__month=month + ) + + # 🟢 PERBAIKAN 2: Fungsi Max & Min di sini dijamin aman karena sudah di-import di atas + agregasi = queryset.aggregate( + max_val=Max('active_power_kwh'), + min_val=Min('active_power_kwh') + ) + max_kwh = agregasi['max_val'] or 0 + min_kwh = agregasi['min_val'] or 0 + + konsumsi = max_kwh - min_kwh + if konsumsi < 0: + konsumsi = max_kwh + total_kwh_area += konsumsi + + total_kwh_area = round(total_kwh_area, 2) + total_seluruh_pabrik += total_kwh_area + + labels_area.append(area.nama_area) + values_kwh.append(total_kwh_area) + + tabel_data.append({ + 'nama_area': area.nama_area, + 'jumlah_mesin': mesin_di_area.count(), + 'total_konsumsi': total_kwh_area + }) + + return JsonResponse({ + 'labels': labels_area, + 'values': values_kwh, + 'tabel_data': tabel_data, + 'total_sum': round(total_seluruh_pabrik, 2) + }) + + +# 📌 Pastikan dekorator ditulis rata kiri, sejajar dengan kata 'def' +@login_required +def dashboard_view(request): + # ... isi kode dashboard Anda saat ini ... + return render(request, 'dashboard/index.html') + +# API baru untuk mengubah status mesin (Normal / Review) dari dropdown tabel web +@require_POST +def update_status_view(request, mesin_id): + try: + data = json.loads(request.body) + status_baru = data.get('status', 'normal').strip() + + if status_baru not in ['normal', 'review']: + return JsonResponse({'status': 'error', 'message': 'Status tidak valid'}, status=400) + + # PERBAIKAN TOTAL: Paksa update langsung tembus ke baris tabel database asli + Mesin.objects.filter(id=mesin_id).update(status=status_baru) + + return JsonResponse({'status': 'success', 'message': 'Status mesin berhasil diperbarui'}) + except Exception as e: + return JsonResponse({'status': 'error', 'message': str(e)}, status=400) + diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..8e7ac79 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main()